diff options
Diffstat (limited to 'libodbcpp/connection.cpp')
-rw-r--r-- | libodbcpp/connection.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libodbcpp/connection.cpp b/libodbcpp/connection.cpp index d1c447d..e3e92c7 100644 --- a/libodbcpp/connection.cpp +++ b/libodbcpp/connection.cpp @@ -97,9 +97,11 @@ ODBC::Connection::~Connection() int ODBC::Connection::beginTx() const { - SQLRETURN dberr = SQLSetConnectOption(conn, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); - if ((dberr != SQL_SUCCESS)) { - throw Error(dberr, SQL_HANDLE_DBC, conn, "Set default auto commit"); + if (txDepth == 0) { + SQLRETURN dberr = SQLSetConnectOption(conn, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); + if ((dberr != SQL_SUCCESS)) { + throw Error(dberr, SQL_HANDLE_DBC, conn, "Set default auto commit"); + } } txDepth += 1; return txDepth; |