From 9cbf27d6de0b868c4c21a4d58e10a906a47f4d92 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 25 Nov 2014 07:02:55 +0200 Subject: Don't try to translate duplicate primary key for auto-assigned id An auto-assigned object id should never cause a duplicate primary key. --- odb/sqlite/statement.cxx | 5 +++-- 1 file 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_); -- cgit v1.1