aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-25 07:02:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-25 07:02:55 +0200
commit55e69b274fbdb31f428565a4daff1d4fa510024e (patch)
treea699f0afe1856bfc609d9c8587cec9844d56578a
parentd44d7c96d38453d5a971b813be4c6635bf0b38fb (diff)
Don't try to translate duplicate primary key for auto-assigned id
An auto-assigned object id should never cause a duplicate primary key.
-rw-r--r--odb/mysql/statement.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index 85732de..0badb17 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -623,7 +623,10 @@ namespace odb
if (mysql_stmt_execute (stmt_))
{
- if (mysql_stmt_errno (stmt_) == ER_DUP_ENTRY)
+ // An auto-assigned object id should never cause a duplicate
+ // primary key.
+ //
+ if (returning_ == 0 && mysql_stmt_errno (stmt_) == ER_DUP_ENTRY)
return false;
else
translate_error (conn_, stmt_);