From: dan Date: Fri, 21 Nov 2014 14:37:24 +0000 (+0000) Subject: Merge latest trunk changes with this branch. X-Git-Tag: version-3.8.11~252^2~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841ed2b0f2bd9def5d529579d3cdb3ffeb41c6e0;p=thirdparty%2Fsqlite.git Merge latest trunk changes with this branch. FossilOrigin-Name: 7ef44c5b5bd30bcc4ef59ed172b9ce9ac6a843f6 --- 841ed2b0f2bd9def5d529579d3cdb3ffeb41c6e0 diff --cc manifest index 3c75754c18,3722a0fbac..bb2073b96b --- a/manifest +++ b/manifest @@@ -1,12 -1,12 +1,12 @@@ - C Changes\sto\scomments\sin\ssqlite3ota.h. - D 2014-11-21T11:22:11.959 -C Fix\sa\stypo\sin\sa\srequirements\smark\son\sthe\sabs()\sSQL\sfunction. -D 2014-11-20T23:21:23.554 ++C Merge\slatest\strunk\schanges\swith\sthis\sbranch. ++D 2014-11-21T14:37:24.898 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f - F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a + F Makefile.in a226317fdf3f4c895fb3cfedc355b4d0868ce1fb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 - F Makefile.msc e31dee24038965fb6269d6d61073fd6b7e331dec + F Makefile.msc 788f1288633a0c3c3cbbe0f3e4827d033f7ba530 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 - F VERSION 53a0b870e7f16d3b06623c31d233a304c163a6af + F VERSION d846487aff892625eb8e75960234e7285f0462fe F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 @@@ -165,7 -152,7 +166,7 @@@ F ext/userauth/userauth.c 5fa3bdb492f48 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 - F main.mk 8e4a294f77e23b2d19e2ac8f5a8761d260bfa4af -F main.mk 084976077a4aa3bd985154b5423e7aed88e4a2e9 ++F main.mk 4b47576110101e349ebe152008ad7e87dd6764b3 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@@ -177,29 -164,29 +178,29 @@@ F mptest/mptest.c 499a74af4be293b7c1c7c F mptest/multiwrite01.test 499ad0310da8dff8e8f98d2e272fc2a8aa741b2e F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b - F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494 + F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb - F src/analyze.c 8c322e1ecc08909526dbd5ab4421889d05f2263d + F src/analyze.c c59f238a39aacece176f8bb7dfece40deb268ee5 F src/attach.c f4e94df2d1826feda65eb0939f7f6f5f923a0ad9 - F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2 - F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e + F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 + F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5 - F src/btree.c c6022918315eab880df0176a0d5690aa4bf32e14 - F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8 - F src/btreeInt.h 026d0129724e8f265fdc60d44ec240cf5a4e6179 - F src/build.c 9dc2bd94347b878c89627000c92b0c8d97ec2919 -F src/btree.c 4db5e06ca2d1a5437be7075251fa702c76179b0e ++F src/btree.c 1ab82a27ed4f1e8dc640b7ca0ffb074c4233e495 + F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e + F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21 + F src/build.c 67bb05b1077e0cdaccb2e36bfcbe7a5df9ed31e8 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 - F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14 - F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638 - F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036 - F src/delete.c df9e2f273675ebf8d7f229e7668ba941bdc7021a - F src/expr.c fc204d08af06437ddaffe5a1b1f1f6f9e1a55d6d + F src/complete.c c4ba6e0626bb94bc77a0861735f3382fcf7cc818 + F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a + F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744 -F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417 ++F src/delete.c 2d2c4ff24bda5d28000d0aeb05960ee2883a2d3a + F src/expr.c 73de4c0da2eed6b149d40a05c589dfeb2c4a87a1 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7 - F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee - F src/global.c 01c1f36ecfcf10770db648422a8852c222308bb9 + F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430 + F src/global.c 6ded36dda9466fc1c9a3c5492ded81d79bf3977d F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5 F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 @@@ -208,8 -195,8 +209,8 @@@ F src/journal.c b4124532212b6952f42eb2c F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994 - F src/main.c 25088f9f0422ef29a12eb1ff57d12a2aac0f8c05 - F src/malloc.c 3c3ac67969612493d435e14b6832793209afd2ec -F src/main.c 54d0f4896cebc61ae5f831937464953780fe5346 ++F src/main.c e2adfa1e7bef8b553a1e7c250cc02bcb109d15f2 + F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 @@@ -227,31 -214,31 +228,31 @@@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7 - F src/os_win.c a019caaae2bcbbc0cc4c39af6e7d7e43d8426053 + F src/os_win.c a9e500dd963fb1f67d7860e58b5772abe6123862 F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21 - F src/pager.c e5378efabe8479cd8af8194ac71d0bab8bf979f5 - F src/pager.h 997a4aa3bad1638dabe90a0cbb674cc4a7b9c034 -F src/pager.c b8764f90c135482988268eec93d7f5cdb89d687a -F src/pager.h d1eee3c3f741be247ce6d82752a178515fc8578b ++F src/pager.c c2a4795e65b5794248dadd7c8bb65a8d9145995e ++F src/pager.h c6157af66a9999797629968921133f67716f8f9f F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45 - F src/pcache.c 4121a0571c18581ee9f82f086d5e2030051ebd6a - F src/pcache.h 9b559127b83f84ff76d735c8262f04853be0c59a - F src/pcache1.c e412cb585f777c840ddce0500eddc5c6043c2bb5 + F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4 + F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8 + F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98 -F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f +F src/pragma.c 272b122a873fc756e999c319f8e81de55ef39d5c - F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196 - F src/printf.c 6b79bbd063dcbadca4cf617a4cde255bcc13ea64 - F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece - F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89 + F src/prepare.c b7b7bf020bd4c962f7c8aed5a3c542c7dfe9f9c7 + F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 + F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 + F src/resolve.c 4965007d6497b6a4d7a6d98751cc39712885f952 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 428165951748151e87a15295b7357221433e311b - F src/shell.c 282f8f5278e0c78eb442217531172ec9e1538796 - F src/sqlite.h.in d368351cfb7f98d847ab42c760fbe01ab30d06fd + F src/shell.c bc28d5992109717c87804e2eb1a08a7c8cc7a2fd -F src/sqlite.h.in c63db0117aeb749ca02b6016dbbbccbbbd9a141d ++F src/sqlite.h.in 972125a6b4ea1891d2428cc55302c71f0fb1adb3 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d - F src/sqliteInt.h cf72fe02b33f46572c681cc90ad64a5851f10b8f -F src/sqliteInt.h c9e95b8fa9aee30d46387735c5be73fa58886e38 ++F src/sqliteInt.h d96b5f3ee07d35b52aa54a279028105b33a9592c F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d - F src/status.c 961d5926e5a8fda611d385ec22c226b8635cd1cb - F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb - F src/tclsqlite.c ac7d1672f69c9d69defeb022f656d04f5cefd198 - F src/test1.c 4b4659bb248c0bef8ef6cd85141f09f6c2a55e71 + F src/status.c 81712116e826b0089bb221b018929536b2b5406f + F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc -F src/tclsqlite.c 0a874655dd39a9875e39c5d3c464db662171d228 -F src/test1.c 6b0469b8e06c77b1de1d3e4a3834cf26edea9cc7 ++F src/tclsqlite.c 8cf7d53aa1e1393b79457e4d49a29c18fa8403bd ++F src/test1.c 76b5cbefaac443f48f05d3621f5cedc7b2801c65 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@@ -298,26 -286,26 +300,26 @@@ F src/test_vfstrace.c bab9594adc976cbe6 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 6de09362b657f19ba83e5fa521ee715787ce9fee F src/tokenize.c cc9016e5007fc5e76789079616d2f26741bcc689 -F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f +F src/trigger.c eb921d1292aca83d515bde5881df71df91d962d6 - F src/update.c 729f6f18fc27740591d085e1172cebe311144bf0 + F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c - F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8 - F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a - F src/vdbe.c 5ee15a66ce07e0482b92aa29e4dd0c5827a22d79 - F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327 - F src/vdbeInt.h e2a060a55ee18a6ab973353a5e2ec7ee569bf787 - F src/vdbeapi.c 37a6c6ae284a97bcace365f2f0a225680c0499d9 - F src/vdbeaux.c edbb7a9c8b2a8f7a68ac75c2475edd4040266b76 - F src/vdbeblob.c 42b1854c42dc7b7f53c9ff1a4b90d24b2daeee5b + F src/util.c 3b627daa45c7308c1e36e3dbaa3f9ce7e5c7fa73 + F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c + F src/vdbe.c ec1f55acef4864520ca2017b9f0d60c2ac1b8b78 + F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3 + F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78 + F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83 + F src/vdbeaux.c 5ce4f414147a3bc3cbcf00ec57f2606c25791629 -F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778 ++F src/vdbeblob.c 845c24601a4f107f4829725fa0c672b93b816bab F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f - F src/vdbesort.c 975aeffa99acb0991b2f288d30294756bff41438 + F src/vdbesort.c 87f3923483113d1c95d84640becb4e4946f27d9a F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010 - F src/vtab.c cb0c194303fea276b48d7d4b6d970b5a96bde8de - F src/wal.c 2787dfceb22d50c45ca51a8f56684516894a135c + F src/vtab.c 2a30791bbd7926b589401bd09c3abb33de563793 -F src/wal.c 486e644b3b8aa5ad066f625bc428aa8ff7001405 -F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 ++F src/wal.c e8fe2d73c40066872f97db5809ea62f285175825 +F src/wal.h 0d3ba0c3f1b4c25796cb213568a84b9f9063f465 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 - F src/where.c 2947912f1f3d6a7766fe087fd532a5d688d745b1 - F src/whereInt.h 124d970450955a6982e174b07c320ae6d62a595c + F src/where.c e275cb74731a3351a9da6ba8280bd5054db6192d + F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test b35b4cd69fc913f90d39a575e171e1116c3a4bb7 @@@ -779,11 -776,11 +791,11 @@@ F test/pagesize.test 1dd51367e752e742f5 F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54 -F test/permutations.test cef25f5e8499a15846eccd06785f17f4180407ab +F test/permutations.test 19cc048448340952b08a897167ec7b7bc85142b9 - F test/pragma.test 19d0241a007bcdd77fc2606ec60fc60357e7fc8b + F test/pragma.test 49ac8a73c0daa574824538fed28727d1259fe735 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 - F test/printf2.test bed79b4c3e5da08ba88ad637c0bf62586843cfb1 + F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca @@@ -1219,7 -1221,7 +1236,7 @@@ F tool/vdbe_profile.tcl 67746953071a9f8 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f - P 4dfcfe543945aa60a7ac397a3bdb0ac9e20ef7b6 - R ce2cc26848888f59033084d0ff8b06d9 -P 332cc9591d05508ac9cb56fde2b82e20e0342d1f -R 5693b17271f5aafc5aa0ee222d419f56 -U drh -Z 26e3a9a90b782d10bf5cba52cec231a6 ++P 14139542b68fbf01632a1b149cd6fca4bb01efa6 b1e6c02f8b9a2afaa12ac15a33e3f698c3be27d6 ++R 0115f003ae5ca012270e27f3f42f3f8e +U dan - Z 059883a58f80da6dc602fa5f1d52e4f7 ++Z 7ed6e391881cc7d739c6ad1cb9d3b777 diff --cc manifest.uuid index ba0bea7466,2d35c62379..ab5ea12dd7 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 14139542b68fbf01632a1b149cd6fca4bb01efa6 -b1e6c02f8b9a2afaa12ac15a33e3f698c3be27d6 ++7ef44c5b5bd30bcc4ef59ed172b9ce9ac6a843f6 diff --cc src/sqlite.h.in index e4b9ab0d7c,f1b917c308..e5e98d2a8a --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@@ -7411,95 -7440,99 +7445,188 @@@ int sqlite3_vtab_on_conflict(sqlite3 *) /* #define SQLITE_ABORT 4 // Also an error code */ #define SQLITE_REPLACE 5 +/* +** Allocate a statement handle that may be used to write directly to an +** index b-tree. This allows the user to create a corrupt database. Once +** the statement handle is allocated, it may be used with the same APIs +** as any statement handle created with sqlite3_prepare(). +** +** The statement writes to the index specified by parameter zIndex, which +** must be in the "main" database. If argument bDelete is false, then each +** time the statement is sqlite3_step()ed, an entry is inserted into the +** b-tree index. If it is true, then an entry may be deleted (or may not, if +** the specified key is not found) each time the statement is +** sqlite3_step()ed. +** +** If statement compilation is successful, *ppStmt is set to point to the +** new statement handle and SQLITE_OK is returned. Otherwise, if an error +** occurs, *ppStmt is set to NULL and an error code returned. An error +** message may be left in the database handle in this case. +** +** If statement compilation succeeds, output variable *pnCol is set to the +** total number of columns in the index, including the primary key columns +** at the end. Variable *paiCol is set to point to an array *pnCol entries +** in size. Each entry is the table column index, numbered from zero from left +** to right, of the corresponding index column. For example, if: +** +** CREATE TABLE t1(a, b, c, d); +** CREATE INDEX i1 ON t1(b, c); +** +** then *pnCol is 3 and *paiCol points to an array containing {1, 2, -1}. +** If table t1 had an explicit INTEGER PRIMARY KEY, then the "-1" in the +** *paiCol array would be replaced by its column index. Or if: +** +** CREATE TABLE t2(a, b, c, d, PRIMARY KEY(d, c)) WITHOUT ROWID; +** CREATE INDEX i2 ON t2(a); +** +** then (*pnCol) is 3 and *paiCol points to an array containing {0, 3, 2}. +** +** The lifetime of the array is the same as that of the statement handle - +** it is automatically freed when the statement handle is passed to +** sqlite3_finalize(). +** +** The statement has (*pnCol) SQL variables that values may be bound to. +** They correspond to the values used to create the index key that is +** inserted or deleted when the statement is stepped. +** +** If the index is a UNIQUE index, the usual checking and error codes apply +** to insert operations. +*/ +int sqlite3_index_writer( + sqlite3 *db, + int bDelete, /* Zero for insert, non-zero for delete */ + const char *zIndex, /* Index to write to */ + sqlite3_stmt**, /* OUT: New statement handle */ + const char ***pazColl, /* OUT: Collation sequences for each column */ + int **paiCol, int *pnCol /* OUT: See above */ +); + + /* + ** CAPI3REF: Prepared Statement Scan Status Opcodes + ** KEYWORDS: {scanstatus options} + ** + ** The following constants can be used for the T parameter to the + ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a + ** different metric for sqlite3_stmt_scanstatus() to return. + ** + **
+ ** [[SQLITE_SCANSTAT_NLOOP]]
SQLITE_SCANSTAT_NLOOP
+ **
^The [sqlite3_int64] variable pointed to by the T parameter will be set to the + ** total number of times that the X-th loop has run.
+ ** + ** [[SQLITE_SCANSTAT_NVISIT]]
SQLITE_SCANSTAT_NVISIT
+ **
^The [sqlite3_int64] variable pointed to by the T parameter will be set to the + ** total number of rows examined by all iterations of the X-th loop.
+ ** + ** [[SQLITE_SCANSTAT_EST]]
SQLITE_SCANSTAT_EST
+ **
^The "double" variable pointed to by the T parameter will be set to the + ** query planner's estimate for the average number of rows output from each + ** iteration of the X-th loop. If the query planner's estimates was accurate, + ** then this value will approximate the quotient NVISIT/NLOOP and the + ** product of this value for all prior loops with the same SELECTID will + ** be the NLOOP value for the current loop. + ** + ** [[SQLITE_SCANSTAT_NAME]]
SQLITE_SCANSTAT_NAME
+ **
^The "const char *" variable pointed to by the T parameter will be set to + ** a zero-terminated UTF-8 string containing the name of the index or table used + ** for the X-th loop. + ** + ** [[SQLITE_SCANSTAT_EXPLAIN]]
SQLITE_SCANSTAT_EXPLAIN
+ **
^The "const char *" variable pointed to by the T parameter will be set to + ** a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] description + ** for the X-th loop. + ** + ** [[SQLITE_SCANSTAT_SELECTID]]
SQLITE_SCANSTAT_SELECT
+ **
^The "int" variable pointed to by the T parameter will be set to the + ** "select-id" for the X-th loop. The select-id identifies which query or + ** subquery the loop is part of. The main query has a select-id of zero. + ** The select-id is the same value as is output in the first column + ** of an [EXPLAIN QUERY PLAN] query. + **
+ */ + #define SQLITE_SCANSTAT_NLOOP 0 + #define SQLITE_SCANSTAT_NVISIT 1 + #define SQLITE_SCANSTAT_EST 2 + #define SQLITE_SCANSTAT_NAME 3 + #define SQLITE_SCANSTAT_EXPLAIN 4 + #define SQLITE_SCANSTAT_SELECTID 5 + + /* + ** CAPI3REF: Prepared Statement Scan Status + ** + ** Return status data for a single loop within query pStmt. + ** + ** The "iScanStatusOp" parameter determines which status information to return. + ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior of + ** this interface is undefined. + ** ^The requested measurement is written into a variable pointed to by + ** the "pOut" parameter. + ** Parameter "idx" identifies the specific loop to retrieve statistics for. + ** Loops are numbered starting from zero. ^If idx is out of range - less than + ** zero or greater than or equal to the total number of loops used to implement + ** the statement - a non-zero value is returned and the variable that pOut + ** points to is unchanged. + ** + ** ^Statistics might not be available for all loops in all statements. ^In cases + ** where there exist loops with no available statistics, this function behaves + ** as if the loop did not exist - it returns non-zero and leave the variable + ** that pOut points to unchanged. + ** + ** This API is only available if the library is built with pre-processor + ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined. + ** + ** See also: [sqlite3_stmt_scanstatus_reset()] + */ + SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus( + sqlite3_stmt *pStmt, /* Prepared statement for which info desired */ + int idx, /* Index of loop to report on */ + int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */ + void *pOut /* Result written here */ + ); + + /* + ** CAPI3REF: Zero Scan-Status Counters + ** + ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters. + ** + ** 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*); + +/* +** Incremental checkpoint API. +** +** An incremental checkpoint handle is opened using the sqlite3_ckpt_open() +** API. To begin a new checkpoint, the second and third arguments should both +** be passed zero. To resume an earlier checkpoint, the second and third +** arguments should specify a buffer returned by an earlier call to +** sqlite3_ckpt_close(). When resuming a checkpoint, if the database or WAL +** file has been modified since the checkpoint was suspended, the +** sqlite3_ckpt_open() call fails with SQLITE_MISMATCH. +** +** Each time sqlite3_ckpt_step() is called on an open checkpoint handle, a +** single page is copied from the WAL file to the database. If no error +** occurs, but the checkpoint is not finished, SQLITE_OK is returned. If the +** checkpoint has been finished (and so sqlite3_ckpt_step() should not be +** called again), SQLITE_DONE is returned. Otherwise, if an error occurs, +** some other SQLite error code is returned. +** +** Calling sqlite3_ckpt_close() closes an open checkpoint handle. If the +** checkpoint has finished and no error has occurred, SQLITE_OK is returned +** and the two output parameters zeroed. Or, if an error has occurred, an +** error code is returned and the two output parameters are zeroed. Finally, +** if the checkpoint is not finished but no error has occurred, SQLITE_OK is +** returned and the first output variable set to point to a buffer allocated +** using sqlite3_malloc() containing the serialized state of the checkpoint. +** The contents of this buffer may be passed to a later call to +** sqlite3_ckpt_open() to restart the checkpoint. The second output variable +** is set to the size of the buffer in bytes. +*/ +typedef struct sqlite3_ckpt sqlite3_ckpt; +int sqlite3_ckpt_open(sqlite3*, unsigned char *a, int n, sqlite3_ckpt **ppCkpt); +int sqlite3_ckpt_step(sqlite3_ckpt*); +int sqlite3_ckpt_close(sqlite3_ckpt*, unsigned char **pa, int *pn); /* ** Undo the hack that converts floating point types to integer for diff --cc src/test1.c index 9304817dc3,ca3b54a513..272d708044 --- a/src/test1.c +++ b/src/test1.c @@@ -6867,8 -6789,12 +6789,13 @@@ int Sqlitetest1_Init(Tcl_Interp *interp { "sqlite3_user_change", test_user_change, 0 }, { "sqlite3_user_delete", test_user_delete, 0 }, #endif ++ + #ifdef SQLITE_ENABLE_STMT_SCANSTATUS + { "sqlite3_stmt_scanstatus", test_stmt_scanstatus, 0 }, + { "sqlite3_stmt_scanstatus_reset", test_stmt_scanstatus_reset, 0 }, + #endif - }; + static int bitmask_size = sizeof(Bitmask)*8; int i; extern int sqlite3_sync_count, sqlite3_fullsync_count;