From: drh Date: Wed, 20 May 2015 22:01:31 +0000 (+0000) Subject: Add the sqlite3_value_dup() and sqlite3_value_free() interfaces and use those X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0322ef1bf9ae0d74434bb6f027b671d3ea77e9b;p=thirdparty%2Fsqlite.git Add the sqlite3_value_dup() and sqlite3_value_free() interfaces and use those to add the sqlite3_rtree_query_info.apSqlParam field to the query callback in R-Tree. FossilOrigin-Name: 2007391cec8989de6d6aa0ffc5789c32d48e4c08 --- b0322ef1bf9ae0d74434bb6f027b671d3ea77e9b diff --cc manifest index 9590e630bd,753486c81e..32381a57b3 --- a/manifest +++ b/manifest @@@ -1,9 -1,9 +1,9 @@@ - C Merge\sthe\sMakefile.msc\sfix\sand\sthe\scompiler\swarning\sfix\sfrom\strunk.\s\sAlso\nfix\sanother\scompiler\swarning\sin\ssqlite3session_diff(). - D 2015-05-19T23:04:26.372 -C Add\sthe\ssqlite3_value_dup()\sand\ssqlite3_value_free()\sinterfaces.\s\sUse\nthese\sinterfaces\sto\senhance\sR-Tree\sto\sadd\sthe\nsqlite3_rtree_query_info.apSqlParam\sfield. -D 2015-05-20T21:28:32.417 ++C Add\sthe\ssqlite3_value_dup()\sand\ssqlite3_value_free()\sinterfaces\sand\suse\sthose\nto\sadd\sthe\ssqlite3_rtree_query_info.apSqlParam\sfield\sto\sthe\squery\scallback\nin\sR-Tree. ++D 2015-05-20T22:01:31.064 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 0a6ae26396ec696221021780dffbb894ff3cead7 +F Makefile.in 66db4ec2c6cd63d0f3e29d366aaaab769aba175b F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 55fdbee85598e2c61fc1e643d02f38f1f943463c +F Makefile.msc ea72907f6c4b92181dd6dfca665253025705d85f F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 0bfccb18927349653c09137a458b961fa8ab4cb9 F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db @@@ -162,27 -162,9 +162,27 @@@ F ext/rtree/rtreeE.test b268eed6a621613 F ext/rtree/rtreeF.test 66deb9fd1611c7ca2e374adba63debdc2dbb12b4 F ext/rtree/rtree_perf.tcl 6c18c1f23cd48e0f948930c98dfdd37dfccb5195 F ext/rtree/rtree_util.tcl 06aab2ed5b826545bf215fff90ecb9255a8647ea - F ext/rtree/sqlite3rtree.h 83349d519fe5f518b3ea025d18dd1fe51b1684bd + F ext/rtree/sqlite3rtree.h 9c5777af3d2921c7b4ae4954e8e5697502289d28 F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 +F ext/session/changeset.c 4ccbaa4531944c24584bf6a61ba3a39c62b6267a +F ext/session/session1.test 4653867f32a98ce4bbb4a181aac6debe51ca4dfb +F ext/session/session2.test a95a2d270b32638c1acba7cb9c81856712d469ac +F ext/session/session3.test a7a9ce59b8d1e49e2cc23d81421ac485be0eea01 +F ext/session/session4.test a6ed685da7a5293c5d6f99855bcf41dbc352ca84 +F ext/session/session5.test 716bc6fafd625ce60dfa62ae128971628c1a1169 +F ext/session/session6.test 443789bc2fca12e4f7075cf692c60b8a2bea1a26 +F ext/session/session8.test 8e194b3f655d861ca36de5d4de53f702751bab3b +F ext/session/session9.test 5409d90d8141881d08285ed1c2c0d8d10fb92069 +F ext/session/sessionA.test 1feeab0b8e03527f08f2f1defb442da25480138f +F ext/session/sessionB.test 06961b7c3641151f5d23088250ecad132501113c +F ext/session/sessionC.test 3982f8577b0744c5ce3aaef7cfeb5bd903f17fe4 +F ext/session/sessionD.test d4744c78334162851d2a2f285c7e603e31b49aa2 +F ext/session/session_common.tcl 9de0451b6a47218fc16b9ed8876b6238a0a3d88d +F ext/session/sessionfault.test bef044d0952c0d62c31c8d2400be72c8684545cc +F ext/session/sqlite3session.c 9ccf68d542f4afc5dc14295d984bf37a7db6b936 +F ext/session/sqlite3session.h 8e86f9eec3ed71f1f30eefbe810cbe5bc10b5aa9 +F ext/session/test_session.c 187bd344c5ae9d5be85e22ef7c3010f0c17307ce F ext/userauth/sqlite3userauth.h 19cb6f0e31316d0ee4afdfb7a85ef9da3333a220 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e @@@ -268,12 -250,12 +268,12 @@@ F src/printf.c 13ce37e5574f9b0682fa86db F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 99eabf7eff0bfa65b75939b46caa82e2b2133f28 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e - F src/select.c 6d9d6ae899acb9bf148862e8cccdf16085514b26 + F src/select.c 95e728e1bdbca2ee45016308e3eb6d19095155cc -F src/shell.c 07dda7cd692911d2f22269953418d049f2e2c0ee -F src/sqlite.h.in f97f23de94767ab7e2c97745308920a749d4a4b5 +F src/shell.c f26cca96f7dadab5efb5e655edf548f4b91695c5 - F src/sqlite.h.in 6805658a16c77dc153131c2dd7e39cc766bd9454 ++F src/sqlite.h.in 5808551a21911fb58584316ccf878c4cd74d3258 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad - F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d + F src/sqlite3ext.h 2ebeb634e751a61a6f0eebfa0f4669f46a42f6cd -F src/sqliteInt.h 88738d94a343000e7a5c0e295d111c4cfccb18b0 +F src/sqliteInt.h 88f58e88856dcfed5b03ae020335e3a562c91f29 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@@ -330,13 -312,13 +330,13 @@@ F src/update.c d207deb7a031f698104bee87 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/util.c a6431c92803b975b7322724a7b433e538d243539 F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 -F src/vdbe.c 6aee8a041742413ab3113e6682bc7ad1628a2bbe -F src/vdbe.h 7e538ecf47dccb307ea2d087c3ddc2dd8d70e79d -F src/vdbeInt.h f0ccddac48583d5f762dc554a9f79e85ea8807e0 -F src/vdbeapi.c f9ad1be11b9e8f2f8580656191abeeefd24f71dd -F src/vdbeaux.c efe1667d31e8648dbe04a441e5aa9b62dbee2f03 -F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90 -F src/vdbemem.c e87e076b863e4228d71d8c4d1c4df6836d810043 +F src/vdbe.c e4b07daec26aaeb3700308f82770485f0a28a988 +F src/vdbe.h 01d8c35cb877faca74331bb690f0327493c2cb50 - F src/vdbeInt.h 0c025e70881b42896c0a7575f4b1191a2f3ea5f9 - F src/vdbeapi.c d95f2bb43d01a91d93231cde181811b38182202e ++F src/vdbeInt.h 50e298245b66b320c8930219c8aeab492c9a4cce ++F src/vdbeapi.c 87c9a5517aeeb0f8d53168201dd2275e0e926f6e +F src/vdbeaux.c 38233cc7faa4ad1dfbc1a9bc5a54ecf996d6840b +F src/vdbeblob.c ab33f9b57cfce7dddb23853090186da614be4846 - F src/vdbemem.c eda55a13cfaa797f89ef243a129f3f5a457719e7 ++F src/vdbemem.c c704f0f2515a658d8d1566a5f2f3dc9870622427 F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0 F src/vtab.c c535e80259ebe616467181a83a4263555b97c694 @@@ -1297,7 -1278,10 +1297,10 @@@ F tool/vdbe_profile.tcl 67746953071a9f8 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f - P 0a0de8b72ca24f287f9c84766a14e12ea4564b59 c7b16645307d6e46c4153693d6806269de64955f - R 4c94d0a5b34d5dffef0e5fc7fa5c812a -P 6a0cf3ce9e68d0127f9653232e588ed59d34eca5 -R bf385fc150043c4fd0764e8a32885eb2 -T *branch * value-dup -T *sym-value-dup * -T -sym-trunk * ++P 7530e1bf557083ef91447a02f05b019dbe60fa70 a7ee40c4fc62843ac5b96ba47ca14a66e8cd6961 ++R d2163e09200f9f143d5de18a03f83bdf ++T *branch * sessions-value-dup ++T *sym-sessions-value-dup * ++T -sym-sessions * U drh - Z 5fb8b92e45ad4729c65ff31de37671dd -Z 7924e70131eeabe4b6a3d5fe0f7548fa ++Z c4ab43ad24ffbf6a36ab01db9a273da1 diff --cc manifest.uuid index 00488e39ab,8af005bae6..79d6a34a5b --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 7530e1bf557083ef91447a02f05b019dbe60fa70 -a7ee40c4fc62843ac5b96ba47ca14a66e8cd6961 ++2007391cec8989de6d6aa0ffc5789c32d48e4c08 diff --cc src/sqlite.h.in index 382d3bd6c2,b07bdbd533..ffa9de1380 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@@ -7701,104 -7718,9 +7718,104 @@@ int sqlite3_stmt_scanstatus ** This API is only available if the library is built with pre-processor ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined. */ - SQLITE_EXPERIMENTAL void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*); + void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*); +/* +** 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.