aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/statement.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-01 12:41:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-01 12:41:02 +0200
commitcd4e72208fad964a22c99bb9fc15708a528a1e39 (patch)
tree91f7767d87601a66ef89cc901d1c334c30e961dc /odb/mysql/statement.cxx
parent8f49a9a3eddfbaa3afda78aad964268b31d0890b (diff)
Implement support for optimistic concurrency
New pragmas: optimistic, version. New test: optimistic. New database function: reload().
Diffstat (limited to 'odb/mysql/statement.cxx')
-rw-r--r--odb/mysql/statement.cxx13
1 files changed, 4 insertions, 9 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index 7aa036d..4cd6f35 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -5,8 +5,6 @@
#include <cassert>
-#include <odb/exceptions.hxx> // object_not_persistent
-
#include <odb/mysql/mysql.hxx>
#include <odb/mysql/statement.hxx>
#include <odb/mysql/connection.hxx>
@@ -304,7 +302,7 @@ namespace odb
translate_error (conn_, stmt_);
}
- void update_statement::
+ unsigned long long update_statement::
execute ()
{
conn_.clear ();
@@ -325,13 +323,10 @@ namespace odb
my_ulonglong r (mysql_stmt_affected_rows (stmt_));
- if (r > 0)
- return;
-
- if (r == 0)
- throw object_not_persistent ();
- else
+ if (r == static_cast<my_ulonglong> (-1))
translate_error (conn_, stmt_);
+
+ return static_cast<unsigned long long> (r);
}
// delete_statement