summaryrefslogtreecommitdiff
path: root/libodbcpp/modifycommand.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2006-07-08 16:32:05 +0000
committerrandomdan <randomdan@localhost>2006-07-08 16:32:05 +0000
commit2a1fa15d8baa4eda37e17b2e9362f8bde17a939d (patch)
tree09386e52320b7c52a521ab56fc7553896e639dcd /libodbcpp/modifycommand.cpp
downloadlibdbpp-odbc-2a1fa15d8baa4eda37e17b2e9362f8bde17a939d.tar.bz2
libdbpp-odbc-2a1fa15d8baa4eda37e17b2e9362f8bde17a939d.tar.xz
libdbpp-odbc-2a1fa15d8baa4eda37e17b2e9362f8bde17a939d.zip
libcodbcpp initial release
Diffstat (limited to 'libodbcpp/modifycommand.cpp')
-rw-r--r--libodbcpp/modifycommand.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/libodbcpp/modifycommand.cpp b/libodbcpp/modifycommand.cpp
new file mode 100644
index 0000000..706b3fd
--- /dev/null
+++ b/libodbcpp/modifycommand.cpp
@@ -0,0 +1,33 @@
+#include "modifycommand.h"
+#include "error.h"
+
+ODBC::ModifyCommand::ModifyCommand(const ODBC::Connection &c, String sql) :
+ Command(c, sql)
+{
+}
+
+ODBC::ModifyCommand::~ModifyCommand()
+{
+}
+
+unsigned int
+ODBC::ModifyCommand::execute(bool anc)
+{
+ RETCODE rc = SQLExecute(hStmt);
+ if (rc != SQL_SUCCESS) {
+ if (rc != SQL_NO_DATA || !anc) {
+ throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLExecute",
+ __FUNCTION__);
+ }
+ }
+ SQLINTEGER rows;
+ if ((rc = SQLRowCount(hStmt, &rows)) != SQL_SUCCESS) {
+ throw Error(rc, SQL_HANDLE_STMT, hStmt, "%s: SQLRowCount",
+ __FUNCTION__);
+ }
+ if (rows > 0 || anc) {
+ return rows;
+ }
+ throw Error("%s: No rows affected", __FUNCTION__);
+}
+