summaryrefslogtreecommitdiff
path: root/libodbcpp/connection.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-04-05 17:15:14 +0000
committerrandomdan <randomdan@localhost>2010-04-05 17:15:14 +0000
commitb9b2dc0575ba01dd294264f217757a88cabafc62 (patch)
tree03851b0aa39cb2e5fade42e990179b9e7e127d24 /libodbcpp/connection.cpp
parentlots of gcc warning fixes and a few newbies (diff)
downloadlibdbpp-odbc-b9b2dc0575ba01dd294264f217757a88cabafc62.tar.bz2
libdbpp-odbc-b9b2dc0575ba01dd294264f217757a88cabafc62.tar.xz
libdbpp-odbc-b9b2dc0575ba01dd294264f217757a88cabafc62.zip
Minor fixes
Diffstat (limited to 'libodbcpp/connection.cpp')
-rw-r--r--libodbcpp/connection.cpp8
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;