From: drh Date: Thu, 5 May 2011 15:46:16 +0000 (+0000) Subject: Merge the latest trunk changes into the sessions branch. X-Git-Tag: version-3.13.0~148^2~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0576a30dad1ebcaa8baa4f4dfddad93bff0f2b51;p=thirdparty%2Fsqlite.git Merge the latest trunk changes into the sessions branch. FossilOrigin-Name: 6883580e6c8973010a42d1d2c5bde04c6b2f4eb7 --- 0576a30dad1ebcaa8baa4f4dfddad93bff0f2b51 diff --cc main.mk index ba63ad0d6b,3df069a71d..c5f9798576 --- a/main.mk +++ b/main.mk @@@ -300,11 -299,10 +300,12 @@@ TESTSRC2 = $(TOP)/ext/fts3/fts3.c \ $(TOP)/ext/fts3/fts3_aux.c \ $(TOP)/ext/fts3/fts3_expr.c \ + $(TOP)/ext/fts3/fts3_term.c \ $(TOP)/ext/fts3/fts3_tokenizer.c \ $(TOP)/ext/fts3/fts3_write.c \ - $(TOP)/ext/async/sqlite3async.c + $(TOP)/ext/async/sqlite3async.c \ + $(TOP)/ext/session/sqlite3session.c \ + $(TOP)/ext/session/test_session.c # Header files used by all library source files. # diff --cc manifest index bae894c06c,edcbb7b26a..0c02b5eafe --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Merge\strunk\schanges\sinto\ssessions\sbranch. - D 2011-04-18T17:30:56.521 -C Bump\sthe\sversion\snumber\sto\s3.7.7\son\saccount\sof\sthe\snew\ssqlite3_vtab_config()\nand\ssqlite3_vtab_on_conflict()\sinterfaces.\s\sUpdates\sto\sthe\sdocumentation\son\nthose\sinterfaces. -D 2011-05-05T15:39:50.869 ++C Merge\sthe\slatest\strunk\schanges\sinto\sthe\ssessions\sbranch. ++D 2011-05-05T15:46:16.843 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@@ -99,19 -100,9 +100,19 @@@ F ext/rtree/rtree_util.tcl 06aab2ed5b82 F ext/rtree/sqlite3rtree.h 1af0899c63a688e272d69d8e746f24e76f10a3f0 F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 +F ext/session/session1.test f5d9f2e362abe2563181389509822bda956516ee +F ext/session/session2.test 99ca0da7ddb617d42bafd83adccf99f18ae0384b +F ext/session/session3.test a7a9ce59b8d1e49e2cc23d81421ac485be0eea01 +F ext/session/session4.test a6ed685da7a5293c5d6f99855bcf41dbc352ca84 +F ext/session/session5.test 8fdfaf9dba28a2f1c6b89b06168bdab1fef2d478 +F ext/session/session_common.tcl 1539d8973b2aea0025c133eb0cc4c89fcef541a5 +F ext/session/sessionfault.test 401045278298a242cbc2e4bc986c102f01ff2180 +F ext/session/sqlite3session.c 26de50c3e34d89ae62e97024ad07e772e1c52db2 +F ext/session/sqlite3session.h 665f5591562e3c71eb3d0da26f1a1efae26f7bcf +F ext/session/test_session.c 311e5b9228374d0b5780448f289847ff1cf7d388 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 - F main.mk f942406cb7df55d1aec40a88a7ae399b730cd94f -F main.mk 496cec8b7890e39127532294e28e5e1d1b1beae1 ++F main.mk 352002cedf9e754ec96cfe0a8d1688cdea343fea F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac @@@ -148,7 -139,7 +149,7 @@@ F src/global.c 02335177cf6946fe5525c6f0 F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 - F src/insert.c 8796ca3f9209b699cb8120fc44290fc97ac26abe -F src/insert.c 3eea5a53d2644116fb865afaa4699fabe62b441c ++F src/insert.c 1f1688a9da8b8e27114ba1909a6e74100791139b F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e @@@ -188,14 -179,14 +189,14 @@@ F src/resolve.c 1c0f32b64f8e3f555fe1f73 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff F src/shell.c 72e7e176bf46d5c6518d15ac4ad6847c4bb5df79 - F src/sqlite.h.in 0cf61c41c48e1e6b863ff8cf9ecd69620932330e -F src/sqlite.h.in 9bf19a5dcf6317b0f091c255edaed0b1fc01dcd0 ++F src/sqlite.h.in 628de30f6063695288eadf34c167e49bc34c9828 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 - F src/sqliteInt.h 9a29e5bb82f3abef6b4af91e18d637050fa3c883 -F src/sqliteInt.h e70a03bb66d209e279b3edeb57d4fdc42a1d9fda ++F src/sqliteInt.h 1577ac69cb67a1dc0c07974a4e5129b1cde039a3 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e -F src/tclsqlite.c 501c9a200fd998a268be475be5858febc90b725b +F src/tclsqlite.c fe0da0eb0ebd8d21eec90683b779456e64351de6 - F src/test1.c 9ca440e80e16e53920904a0a5ac7feffb9b2c9a1 + F src/test1.c e0e4af306b678da05334c2ccaf0377ae8f06e911 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 056093cfef69ff4227a6bdb9108564dc7f45e4bc F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@@ -208,8 -199,8 +209,8 @@@ F src/test_async.c 0612a752896fad42d55c F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2 -F src/test_config.c d536042f27226b4639f0f87d4795fd37428a9ddf +F src/test_config.c 25a4128c2dc9e1dbebafcb7e8c61d45f09f7fbc3 - F src/test_demovfs.c 31050680fa6925b4f677cfd4fa965b5f19195e50 + F src/test_demovfs.c 938d0f595f8bd310076e1c06cf7885a01ce7ce01 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5 F src/test_fuzzer.c f884f6f32e8513d34248d6e1ac8a32047fead254 @@@ -241,15 -232,15 +242,15 @@@ F src/test_wholenumber.c 6129adfbe7c744 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080 F src/trigger.c 144cc18bb701f3286484aae4292a9531f09278c8 - F src/update.c 3f3f3bb734a0da1dffd0ed33e504642b35ed3605 -F src/update.c 5bcb56e5c7380a2eecb0e71891dbd4ad7437748f ++F src/update.c f66b651c15e42875f36501ec39a968e836ee5586 F src/utf.c d83650c3ea08f7407bd9d0839d9885241c209c60 F src/util.c 465fe10aabf0ca7d7826a156dab919b0b65c525a F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e - F src/vdbe.c dd53dda1cf786397e72643a497b5c2f368ff11ba -F src/vdbe.c 672ec2f41b95a6f35b5bbfe555689457dea4789e -F src/vdbe.h 8a675fefdf7119441fe817c800a9a52440c2e797 -F src/vdbeInt.h fe8f58d305e629fff02f61f655aca1d299f1f6ae -F src/vdbeapi.c e0e2672e0a96ae3f8575c8ecd02912a3e8a554a1 -F src/vdbeaux.c 25aa5ba7d46b4fe7c8f33dc132d474242d5f9726 ++F src/vdbe.c fa5bfc0c820706a1f78042b134a0f7a388ca9a3e +F src/vdbe.h 44fd57aeed86da0cd31206626c13cdde0e72cc0e +F src/vdbeInt.h b95de01246c15499c700ae00cfda0de25c01358a +F src/vdbeapi.c 8051038f7674c708f4515ab189fc3ea929e09a4c - F src/vdbeaux.c b0a2a184a25380f7eb9d07e9336034ec38d1b213 ++F src/vdbeaux.c cc95d80b899b75829cb93d260d3f14125a5c26ad F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 @@@ -697,7 -689,7 +700,7 @@@ F test/tclsqlite.test 1ce9b6340d6d41242 F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05 - F test/tester.tcl fc2e27b3a782c5c5b03f7cded15cf498cad9bfef -F test/tester.tcl d5139260aadd64f318ecbcf982316d5bbc254b1b ++F test/tester.tcl cf301cdb35f20378b086849acd26a4574187183f F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca @@@ -940,7 -933,7 +944,7 @@@ F tool/speedtest8.c 2902c46588c40b55661 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f - P 99f0f35092b0b78b7016b21c242da263ab64b77b 3e135748f1efacb52b414b3ac3f4ae2c08bcd8fb - R b2692e50ee7820b096983b9aa33c1efd - U dan - Z c7fa020efb14904762c294d2eedf7456 -P 8485855afc71fb8078d53719c3da75021890ce9e -R d001197d2ada5bdc77fdb1803c900b72 ++P b91b4c31fe311b292044c9c747feba294ffce25c 930be6a1bdec8c150caafd790973f7a401fc1970 ++R 13217a0634732c3fc1250bf1a2936d3d + U drh -Z b6f82da815334ecd28dc3bea3383de2d ++Z f29377c78641e183f6acae5b288b38b3 diff --cc manifest.uuid index 446a5128f3,a54682b9ba..c83e756c42 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - b91b4c31fe311b292044c9c747feba294ffce25c -930be6a1bdec8c150caafd790973f7a401fc1970 ++6883580e6c8973010a42d1d2c5bde04c6b2f4eb7 diff --cc src/sqlite.h.in index 2ba183cdf9,19b418b439..260b240bed --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@@ -6389,102 -6401,95 +6401,190 @@@ int sqlite3_wal_checkpoint_v2 #define SQLITE_CHECKPOINT_FULL 1 #define SQLITE_CHECKPOINT_RESTART 2 + /* + ** CAPI3REF: Virtual Table Interface Configuration + ** + ** This function may be called by either the [xConnect] or [xCreate] method + ** of a [virtual table] implementation to configure + ** various facets of the virtual table interface. + ** + ** If this interface is invoked outside the context of an xConnect or + ** xCreate virtual table method then the behavior is undefined. + ** + ** At present, there is only one option that may be configured using + ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options + ** may be added in the future. + */ + int sqlite3_vtab_config(sqlite3*, int op, ...); + + /* + ** CAPI3REF: Virtual Table Configuration Options + ** + ** These macros define the various options to the + ** [sqlite3_vtab_config()] interface that [virtual table] implementations + ** can use to customize and optimize their behavior. + ** + **
+ **
SQLITE_VTAB_CONSTRAINT_SUPPORT + **
If the second argument to [sqlite3_vtab_config()] is + ** SQLITE_VTAB_CONSTRAINT_SUPPORT, then SQLite expects this function to + ** have been called with three arguments, the third of which being of + ** type 'int'. If the third argument is zero, then the virtual table + ** is indicating that it does not support constraints. In this case if + ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], the entire + ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been + ** specified as part of the users SQL statement, regardless of the actual + ** ON CONFLICT mode specified. + ** + ** If the third argument passed is non-zero, then the virtual table + ** implementation must guarantee that if [xUpdate] returns + ** [SQLITE_CONSTRAINT], it does so before any modifications to internal + ** or persistent data structures have been made. If the [ON CONFLICT] + ** mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite is able to roll back + ** a statement or database transaction, and abandon or continue processing + ** the current SQL statement as appropriate. If the ON CONFLICT mode is + ** REPLACE and the [xUpdate] method returns [SQLITE_CONSTRAINT], SQLite + ** handles this as if the ON CONFLICT mode had been ABORT. + ** + ** Virtual table implementations that are required to handle OR REPLACE + ** must do so within the xUpdate method. If a call to the + ** [sqlite3_vtab_on_conflict()] function indicates that the current ON + ** CONFLICT policy is REPLACE, the virtual table implementation should + ** silently replace the appropriate rows within the xUpdate callback and + ** return SQLITE_OK. Or, if this is not possible, it may return + ** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT + ** constraint handling. + **
+ ** + */ + #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 + + /* + ** CAPI3REF: Determine The Virtual Table Conflict Policy + ** + ** This function may only be called from within a call to the [xUpdate] method + ** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The + ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], + ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode + ** of the SQL statement that triggered the call to the [xUpdate] method of the + ** [virtual table]. + */ + int sqlite3_vtab_on_conflict(sqlite3 *); + + /* + ** CAPI3REF: Conflict resolution modes + ** + ** These constants are returned by [sqlite3_vtab_on_conflict()] to + ** inform a [virtual table] implementation what the [ON CONFLICT] mode + ** is for the SQL statement being evaluated. + ** + ** Note that the [SQLITE_IGNORE] constant is also used as a potential + ** return value from the [sqlite3_set_authorizer()] callback and that + ** [SQLITE_ABORT] is also a [result code]. + */ + #define SQLITE_ROLLBACK 1 + /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ + #define SQLITE_FAIL 3 + /* #define SQLITE_ABORT 4 // Also an error code */ + #define SQLITE_REPLACE 5 + + +/* +** CAPI3REF: The pre-update hook. +** EXPERIMENTAL +** +** ^These interfaces are only available if SQLite is compiled using the +** [SQLITE_ENABLE_UPDATE_HOOK] compile-time option. +** +** ^The [sqlite3_preupdate_hook()] interface registers a callback function +** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation. +** ^At most one preupdate hook may be registered at a time on a single +** [database connection]; each call to [sqlite3_preupdate_hook()] overrides +** the previous setting. +** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()] +** with a NULL pointer as the second parameter. +** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as +** the first parameter to callbacks. +** +** ^The preupdate hook only fires for changes to real tables; the preupdate +** hook is not invoked for changes to virtual tables. +** +** ^The second parameter to the preupdate callback is a pointer to +** the [database connection] that registered the preupdate hook. +** ^The third parameter to the preupdate callback is one of the constants +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the +** kind of update operation that is about to occur. +** ^(The fourth parameter to the preupdate callback is the name of the +** database within the database connection that is being modified. This +** will be "main" for the main database or "temp" for TEMP tables or +** the name given after the AS keyword in the [ATTACH] statement for attached +** databases.)^ +** ^The fifth parameter to the preupdate callback is the name of the +** table that is being modified. +** ^The sixth parameter to the preupdate callback is the initial [rowid] of the +** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is +** undefined for SQLITE_INSERT changes. +** ^The seventh parameter to the preupdate callback is the final [rowid] of +** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is +** undefined for SQLITE_DELETE changes. +** +** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()], +** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces +** provide additional information about a preupdate event. These routines +** may only be called from within a preupdate callback. Invoking any of +** these routines from outside of a preupdate callback or with a +** [database connection] pointer that is different from the one supplied +** to the preupdate callback results in undefined and probably undesirable +** behavior. +** +** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns +** in the row that is being inserted, updated, or deleted. +** +** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to +** a [protected sqlite3_value] that contains the value of the Nth column of +** the table row before it is updated. The N parameter must be between 0 +** and one less than the number of columns or the behavior will be +** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE +** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the +** behavior is undefined. The [sqlite3_value] that P points to +** will be destroyed when the preupdate callback returns. +** +** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to +** a [protected sqlite3_value] that contains the value of the Nth column of +** the table row after it is updated. The N parameter must be between 0 +** and one less than the number of columns or the behavior will be +** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE +** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the +** behavior is undefined. The [sqlite3_value] that P points to +** will be destroyed when the preupdate callback returns. +** +** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate +** callback was invoked as a result of a direct insert, update, or delete +** operation; or 1 for inserts, updates, or deletes invoked by top-level +** triggers; or 2 for changes resulting from triggers called by top-level +** triggers; and so forth. +** +** See also: [sqlite3_update_hook()] +*/ +SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook( + sqlite3 *db, + void(*xPreUpdate)( + void *pCtx, /* Copy of third arg to preupdate_hook() */ + sqlite3 *db, /* Database handle */ + int op, /* SQLITE_UPDATE, DELETE or INSERT */ + char const *zDb, /* Database name */ + char const *zName, /* Table name */ + sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */ + sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */ + ), + void* +); +SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); +SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *); +SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *); +SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); + /* ** Undo the hack that converts floating point types to integer for ** builds on processors without floating point support.