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
commit9cbf27d6de0b868c4c21a4d58e10a906a47f4d92 (patch)
treeb80e6dd7c005a1ac14662f397373b9195ce0b8c1
parent6ba692aabf2afae6dab83139ca5e219bfc614890 (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/sqlite/statement.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/odb/sqlite/statement.cxx b/odb/sqlite/statement.cxx
index 09188cb..5601047 100644
--- a/odb/sqlite/statement.cxx
+++ b/odb/sqlite/statement.cxx
@@ -675,9 +675,10 @@ namespace odb
// SQLITE_CONSTRAINT error code covers more than just a duplicate
// primary key. Unfortunately, there is nothing more precise that
// we can use (even sqlite3_errmsg() returns generic "constraint
- // failed").
+ // failed"). But an auto-assigned object id should never cause a
+ // duplicate primary key.
//
- if (e == SQLITE_CONSTRAINT)
+ if (returning_ == 0 && e == SQLITE_CONSTRAINT)
return false;
else
translate_error (e, conn_);