diff options
author | randomdan <randomdan@localhost> | 2006-09-21 23:14:28 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2006-09-21 23:14:28 +0000 |
commit | 951e67b64812128249f572b60e7ca012bad28bfc (patch) | |
tree | 85b64c53883077e9ec11fe442ba60ee76d1a5431 /libodbcpp/modifycommand.cpp | |
parent | libcodbcpp initial release (diff) | |
download | libdbpp-odbc-951e67b64812128249f572b60e7ca012bad28bfc.tar.bz2 libdbpp-odbc-951e67b64812128249f572b60e7ca012bad28bfc.tar.xz libdbpp-odbc-951e67b64812128249f572b60e7ca012bad28bfc.zip |
Fix the C++ template errors
Add some half decent transaction support
Change the error handling to not 'handle' _with_info
Diffstat (limited to 'libodbcpp/modifycommand.cpp')
-rw-r--r-- | libodbcpp/modifycommand.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libodbcpp/modifycommand.cpp b/libodbcpp/modifycommand.cpp index 706b3fd..5e614b7 100644 --- a/libodbcpp/modifycommand.cpp +++ b/libodbcpp/modifycommand.cpp @@ -13,21 +13,27 @@ ODBC::ModifyCommand::~ModifyCommand() unsigned int ODBC::ModifyCommand::execute(bool anc) { + if (connection.txIsAborted()) { + throw Error("Transaction has been aborted, not issuing any more commands"); + } RETCODE rc = SQLExecute(hStmt); if (rc != SQL_SUCCESS) { if (rc != SQL_NO_DATA || !anc) { + connection.abortTx(); throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLExecute", __FUNCTION__); } } SQLINTEGER rows; if ((rc = SQLRowCount(hStmt, &rows)) != SQL_SUCCESS) { + connection.abortTx(); throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLRowCount", __FUNCTION__); } if (rows > 0 || anc) { return rows; } + connection.abortTx(); throw Error("%s: No rows affected", __FUNCTION__); } |