From: drh Date: Fri, 12 Jan 2018 23:38:10 +0000 (+0000) Subject: Add the sqlite3_value_nochange() API, usable from within the xUpdate method X-Git-Tag: version-3.22.0~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9df81a2989fb8f441f1db5a71c6d3b1b3c9ca33c;p=thirdparty%2Fsqlite.git Add the sqlite3_value_nochange() API, usable from within the xUpdate method of a virtual table to discover whether or not a column was unchanged at the SQL level. FossilOrigin-Name: dec3ea4e4e6c4b1761ddc883a29eaa50dcd663ce6199667cc0ff82f7849d4f2a --- 9df81a2989fb8f441f1db5a71c6d3b1b3c9ca33c diff --cc manifest index d9b6cfb745,06de123c8e..8932dc15ad --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Simplification\sto\sthe\simplementation\sof\sOP_Insert. - D 2018-01-12T19:33:18.062 -C Improved\scomments.\s\sSlightly\stighter\simplementation,\sbut\sno\sbig\schanges. -D 2018-01-12T23:18:38.948 ++C Add\sthe\ssqlite3_value_nochange()\sAPI,\susable\sfrom\swithin\sthe\sxUpdate\smethod\nof\sa\svirtual\stable\sto\sdiscover\swhether\sor\snot\sa\scolumn\swas\sunchanged\sat\sthe\nSQL\slevel. ++D 2018-01-12T23:38:10.473 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2 @@@ -487,10 -487,10 +487,10 @@@ F src/resolve.c bbee7e31d369a18a2f48366 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 8b22abe193e4d8243befa2038e4ae2405802fed1c446e5e502d11f652e09ba74 F src/shell.c.in b87abffd0db09203ad8a133d56fe8f154ace5ec0a14197a153fb7d80b1438c01 - F src/sqlite.h.in f83e63a48fb31fefc69c83bbe8700b4b44acdd64e440219087b0f14e35eeb8d4 -F src/sqlite.h.in 86cc0db2b9a55ae7bbde80c9387cdb56aabe24221ee69069ec09626493cff9a8 ++F src/sqlite.h.in 9daf78e8f3cecc9ea0c3a82201f75bb74f789ecbfcda28d2e47fa80b3d956961 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34 - F src/sqliteInt.h fd8702c65994d7de3e2d8f7d85d958731da1ed29476571fdfa2290fd8ec0bf80 + F src/sqliteInt.h 9c70315598b34810a83e4894455acb18e95cf63ce4e6cbb451ac2d17eabc2544 F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/status.c 9737ed017279a9e0c5da748701c3c7bf1e8ae0dae459aad20dd64fcff97a7e35 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 @@@ -1699,7 -1699,7 +1699,8 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 - P 874285e477dd9bd164e25ddb08b6b80daaa8cfd111b4180ecce59b1ce26f77a5 - R 0ce0db05c5816c8a3f6d5399a0318468 -P 8b7be15ece9e2e83959bb0e21e240106fe1077431242c3cc6b81f1baa2382f40 -R f998d1f4e8803d74f5f45b4d8b5e31dd ++P 6acbdba59e9df4313a6232d925a70390acdc43dfa380b4fba7bb8bd442d6e728 a1b3f28569f2a8d82b2931527fdfe191b421f3e1ea18ee30e04211e1ad645993 ++R 33c612cb07bc4c3b03c1437b3563b788 ++T +closed a1b3f28569f2a8d82b2931527fdfe191b421f3e1ea18ee30e04211e1ad645993 U drh - Z 101b1825b326975007694adf2a0d837c -Z 1d40e26fdb71cc6674c4c60bc100f971 ++Z 1fe0c448d0c954d66825b437c30d556c diff --cc manifest.uuid index cf6d922bb8,20282b7174..39a147bce2 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 6acbdba59e9df4313a6232d925a70390acdc43dfa380b4fba7bb8bd442d6e728 -a1b3f28569f2a8d82b2931527fdfe191b421f3e1ea18ee30e04211e1ad645993 ++dec3ea4e4e6c4b1761ddc883a29eaa50dcd663ce6199667cc0ff82f7849d4f2a diff --cc src/sqlite.h.in index ba673748ed,cd524a046f..2661c8f35f --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@@ -4799,6 -4799,6 +4799,9 @@@ SQLITE_DEPRECATED int sqlite3_memory_al ** datatype of the value ** sqlite3_value_numeric_type   ** →  Best numeric datatype of the value ++** sqlite3_value_nochange   ++** →  True if the column is unchanged in an UPDATE ++** against a virtual table. ** ** ** Details: @@@ -4847,6 -4847,17 +4850,19 @@@ ** then the conversion is performed. Otherwise no conversion occurs. ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ ** + ** ^Within the [xUpdate] method of a [virtual table], the + ** sqlite3_value_nochange(X) interface returns true if and only if + ** the column corresponding to X is unchanged by the UPDATE operation + ** that the xUpdate method call was invoked to implement and if + ** and the prior [xColumn] method call that was invoked to extracted + ** the value for that column returned without setting a result (probably + ** because it queried [sqlite3_vtab_nochange()] and found that the column -** was unchanging). If sqlite3_value_nochange(X) is invoked anywhere other ++** was unchanging). ^Within an [xUpdate] method, any value for which ++** sqlite3_value_nochange(X) is true will in all other respects appear ++** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other + ** than within an [xUpdate] method call for an UPDATE statement, then + ** the return value is arbitrary and meaningless. + ** ** Please pay particular attention to the fact that the pointer returned ** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** [sqlite3_value_text16()] can be invalidated by a subsequent call to @@@ -8306,6 -8318,6 +8323,13 @@@ int sqlite3_vtab_on_conflict(sqlite3 *) ** column value will not change. Applications might use this to substitute ** a lighter-weight value to return that the corresponding [xUpdate] method ** understands as a "no-change" value. ++** ++** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that ++** the column is not changed by the UPDATE statement, they the xColumn ++** method can optionally return without setting a result, without calling ++** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. ++** In that case, [sqlite3_value_nochange(X)] will return true for the ++** same column in the [xUpdate] method. */ int sqlite3_vtab_nochange(sqlite3_context*);