aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/connection.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-07-30 13:26:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-07-30 13:26:36 +0200
commita559fc0b0cb8e3a4de91680773a8f4fea2c9a3d3 (patch)
treed961bde579e33d5b8706a39ece131b3bfee863da /odb/mysql/connection.cxx
parent861857508074a0bd8ebafd51007d9c0662b07101 (diff)
Pass CLIENT_FOUND_ROWS to connect
Diffstat (limited to 'odb/mysql/connection.cxx')
-rw-r--r--odb/mysql/connection.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/odb/mysql/connection.cxx b/odb/mysql/connection.cxx
index 2e42b9e..27e3067 100644
--- a/odb/mysql/connection.cxx
+++ b/odb/mysql/connection.cxx
@@ -20,6 +20,11 @@ namespace odb
if (mysql_init (handle_) == 0)
throw std::bad_alloc ();
+ // Force the CLIENT_FOUND_ROWS flag so that UPDATE returns the
+ // number of found rows, not the number of changed rows. This
+ // is necessary to distinguish between the object-not-persistent
+ // and nothing-changed conditions.
+ //
if (mysql_real_connect (handle_,
db.host (),
db.user (),
@@ -27,7 +32,7 @@ namespace odb
db.db (),
db.port (),
db.socket (),
- db.client_flags ()) == 0)
+ db.client_flags () | CLIENT_FOUND_ROWS) == 0)
{
database_exception e (handle_);
mysql_close (handle_);