From: drh Date: Sat, 27 Oct 2007 16:25:16 +0000 (+0000) Subject: Clarify the behavior of sqlite3_last_insert_rowid() when using X-Git-Tag: version-3.6.10~1662 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc1d9f1bd4325d7dd61799ba6828f88433249129;p=thirdparty%2Fsqlite.git Clarify the behavior of sqlite3_last_insert_rowid() when using INSERT OR IGNORE. (CVS 4515) FossilOrigin-Name: c0fa0c8ba80f4cd60bd06da7a032c6424ffd16f8 --- diff --git a/manifest b/manifest index 6733771b41..4953ab78e3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Be\sa\sbit\smore\ssusicious\sof\sinvalid\sresults\sfrom\sthe\stokenizer.\s(CVS\s4514) -D 2007-10-24T23:24:22 +C Clarify\sthe\sbehavior\sof\ssqlite3_last_insert_rowid()\swhen\susing\nINSERT\sOR\sIGNORE.\s(CVS\s4515) +D 2007-10-27T16:25:16 F Makefile.in 30c7e3ba426ddb253b8ef037d1873425da6009a8 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -131,7 +131,7 @@ F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da F src/select.c 4706a6115da1bdc09a2be5991168a6cc2c0df267 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 82089379833e361ba8a2ae65316a2173785300c0 -F src/sqlite.h.in 06c1bbf810800ad11313e646df99b35d90d1c7df +F src/sqlite.h.in 430a26215c164a2d4236dcbce4730a704b455271 F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb F src/sqliteInt.h 7fd5cfa357d7aefe22cd2bcdfabcca4e7d5ab5b2 F src/sqliteLimit.h 1bcbbdfa856f8b71b561abb31edb864b0eca1d12 @@ -584,7 +584,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P a3b82548cb51431569aafacf38e3391a8a1b697b -R 9840b2a2e4a7e399d42f951e7101b4e6 -U shess -Z c626a985c57b5c6f7a3cfe6568c0f1ce +P deb8f56d3adea0025d28b8effabec7c7b7fe3026 +R 27a5740f77270c1f94cbbc07f45db7e7 +U drh +Z 09d045b0cf9283304b9f062260162563 diff --git a/manifest.uuid b/manifest.uuid index 4ccf98f3a2..52ad2d8271 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -deb8f56d3adea0025d28b8effabec7c7b7fe3026 \ No newline at end of file +c0fa0c8ba80f4cd60bd06da7a032c6424ffd16f8 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index a044f882ef..c2cce7e34f 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.267 2007/10/12 18:30:13 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.268 2007/10/27 16:25:16 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -748,9 +748,9 @@ int sqlite3_extended_result_codes(sqlite3*, int onoff); ** type INTEGER PRIMARY KEY then that column is another an alias for the ** rowid. ** -** This routine returns the rowid of the most recent INSERT into +** This routine returns the rowid of the most recent successful INSERT into ** the database from the database connection given in the first -** argument. If no inserts have ever occurred on this database +** argument. If no successful inserts have ever occurred on this database ** connection, zero is returned. ** ** If an INSERT occurs within a trigger, then the rowid of the @@ -759,6 +759,16 @@ int sqlite3_extended_result_codes(sqlite3*, int onoff); ** by this routine reverts to the last value inserted before the ** trigger fired. ** +** An INSERT that fails due to a constraint violation is not a +** successful insert and does not change the value returned by this +** routine. Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, +** and INSERT OR ABORT make no changes to the return value of this +** routine when their insertion fails. When INSERT OR REPLACE +** encounters a constraint violation, it does not fail. The +** INSERT continues to completion after deleting rows that caused +** the constraint problem so INSERT OR REPLACE will always change +** the return value of this interface. +** ** If another thread does a new insert on the same database connection ** while this routine is running and thus changes the last insert rowid, ** then the return value of this routine is undefined.