From 3dffcf911fbda3b84a902e716ed0b8db6647d6df Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2016 19:29:56 +0000 Subject: [PATCH 01/13] The 'replace.tcl' tool should use Unix line-endings. FossilOrigin-Name: 50de96314f75494dc1f5b14d62c595a70c4e0638 --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/replace.tcl | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index dcecb8eb96..b092c43c87 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Updates\sto\srequirements\smarks.\s\sNo\schanges\sto\scode. -D 2016-08-02T13:26:34.987 +C The\s'replace.tcl'\stool\sshould\suse\sUnix\sline-endings. +D 2016-08-02T19:29:56.543 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 @@ -1458,7 +1458,7 @@ F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97 F tool/opcodesum.tcl 740ed206ba8c5040018988129abbf3089a0ccf4a F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b -F tool/replace.tcl 3856f87247dde5418d16dac92fa4060813431778 +F tool/replace.tcl 60f91e8dd06ab81f74d213ecbd9c9945f32ac048 F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076 @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e64a4173d2899acf13b73e6e28f2e164fd638a75 -R 2f7c4e993e0eb7bb61a5a37266251c67 -U drh -Z 9edc5e5cd5ca93c7d8faa216313b72e1 +P b23c10ac8f65bc88a6c7d88e140217222eb4cbe5 +R c637e4e7f2506406f1e6f5b4d9531797 +U mistachkin +Z d4fd0c8d72e7f688d1f1613e04849643 diff --git a/manifest.uuid b/manifest.uuid index ac57330bc6..f5829a3ed7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b23c10ac8f65bc88a6c7d88e140217222eb4cbe5 \ No newline at end of file +50de96314f75494dc1f5b14d62c595a70c4e0638 \ No newline at end of file diff --git a/tool/replace.tcl b/tool/replace.tcl index 1ecc6dc7b5..5a1ac5983c 100644 --- a/tool/replace.tcl +++ b/tool/replace.tcl @@ -4,6 +4,8 @@ # only lines successfully modified with a regular # expression. # +fconfigure stdout -translation binary -encoding binary +fconfigure stderr -translation binary -encoding binary set mode [string tolower [lindex $argv 0]] set from [lindex $argv 1] set to [lindex $argv 2] From c330887291f376837c13a54abd4b9f593085d0bf Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 2 Aug 2016 20:42:24 +0000 Subject: [PATCH 02/13] Fix a unused variable that comes up with -DSQLITE_OMIT_DATETIME_FUNCS. FossilOrigin-Name: e2f9919e34c70761e4e275eeffca8ccf9159223c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/date.c | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b092c43c87..592c083bb1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\s'replace.tcl'\stool\sshould\suse\sUnix\sline-endings. -D 2016-08-02T19:29:56.543 +C Fix\sa\sunused\svariable\sthat\scomes\sup\swith\s-DSQLITE_OMIT_DATETIME_FUNCS. +D 2016-08-02T20:42:24.701 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 @@ -334,7 +334,7 @@ F src/build.c d1fdfd7ab8f5447e494ef15825973bf0719527c6 F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7 -F src/date.c 1cc9fb516ec9932c6fd4d2a0d2f8bc4480145c39 +F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b F src/dbstat.c 4f6f7f52b49beb9636ffbd517cfe44a402ba4ad0 F src/delete.c 4aba4214a377ce8ddde2d2e609777bcc8235200f F src/expr.c fbc17c717a80b5b61158ea8f25b5af6f8cad66f8 @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b23c10ac8f65bc88a6c7d88e140217222eb4cbe5 -R c637e4e7f2506406f1e6f5b4d9531797 -U mistachkin -Z d4fd0c8d72e7f688d1f1613e04849643 +P 50de96314f75494dc1f5b14d62c595a70c4e0638 +R bccad16ef0c054ea297f2741dafcd976 +U drh +Z 284a9c0bc53e79a17d5b080e8200faff diff --git a/manifest.uuid b/manifest.uuid index f5829a3ed7..9ebb47b886 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50de96314f75494dc1f5b14d62c595a70c4e0638 \ No newline at end of file +e2f9919e34c70761e4e275eeffca8ccf9159223c \ No newline at end of file diff --git a/src/date.c b/src/date.c index cce16305a3..8b2f2fa717 100644 --- a/src/date.c +++ b/src/date.c @@ -1112,7 +1112,6 @@ static void currentTimeFunc( ){ time_t t; char *zFormat = (char *)sqlite3_user_data(context); - sqlite3 *db; sqlite3_int64 iT; struct tm *pTm; struct tm sNow; From a36e01a7723ebb700fec0b9e3d428d24998e0035 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 3 Aug 2016 13:40:54 +0000 Subject: [PATCH 03/13] Fix the --help output on fuzzcheck so that it fix in an 80-character window. FossilOrigin-Name: b91444b5db8465f09d112455e722c888b3f94329 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/fuzzcheck.c | 34 +++++++++++++++++----------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/manifest b/manifest index 592c083bb1..5028978397 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sunused\svariable\sthat\scomes\sup\swith\s-DSQLITE_OMIT_DATETIME_FUNCS. -D 2016-08-02T20:42:24.701 +C Fix\sthe\s--help\soutput\son\sfuzzcheck\sso\sthat\sit\sfix\sin\san\s80-character\swindow. +D 2016-08-03T13:40:54.644 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 @@ -807,7 +807,7 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1 F test/fuzz3.test b47377143f0c80f91ed29d722861077ff34415d5 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26 -F test/fuzzcheck.c f01d432d001ba29e7916df8411be7d4e7cddc574 +F test/fuzzcheck.c f2e8102f7829f7b946ebdb6f1a16c6f942d9de66 F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664 F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973 F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 50de96314f75494dc1f5b14d62c595a70c4e0638 -R bccad16ef0c054ea297f2741dafcd976 +P e2f9919e34c70761e4e275eeffca8ccf9159223c +R 6ce4351ec9908162cf69cba24dd464d6 U drh -Z 284a9c0bc53e79a17d5b080e8200faff +Z fde490c34eba36f3f6bb820fe63440a5 diff --git a/manifest.uuid b/manifest.uuid index 9ebb47b886..f473a8f752 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e2f9919e34c70761e4e275eeffca8ccf9159223c \ No newline at end of file +b91444b5db8465f09d112455e722c888b3f94329 \ No newline at end of file diff --git a/test/fuzzcheck.c b/test/fuzzcheck.c index 1d11b2986f..fec65881ce 100644 --- a/test/fuzzcheck.c +++ b/test/fuzzcheck.c @@ -782,23 +782,23 @@ static void showHelp(void){ "Read databases and SQL scripts from SOURCE-DB and execute each script against\n" "each database, checking for crashes and memory leaks.\n" "Options:\n" -" --cell-size-check Set the PRAGMA cell_size_check=ON\n" -" --dbid N Use only the database where dbid=N\n" -" --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n" -" --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n" -" --help Show this help text\n" -" -q|--quiet Reduced output\n" -" --limit-mem N Limit memory used by test SQLite instance to N bytes\n" -" --limit-vdbe Panic if an sync SQL runs for more than 100,000 cycles\n" -" --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n" -" --load-db ARGS... Load template databases from files into SOURCE_DB\n" -" -m TEXT Add a description to the database\n" -" --native-vfs Use the native VFS for initially empty database files\n" -" --rebuild Rebuild and vacuum the database file\n" -" --result-trace Show the results of each SQL command\n" -" --sqlid N Use only SQL where sqlid=N\n" -" --timeout N Abort if any single test case needs more than N seconds\n" -" -v|--verbose Increased output. Repeat for more output.\n" +" --cell-size-check Set the PRAGMA cell_size_check=ON\n" +" --dbid N Use only the database where dbid=N\n" +" --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n" +" --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n" +" --help Show this help text\n" +" -q|--quiet Reduced output\n" +" --limit-mem N Limit memory used by test SQLite instance to N bytes\n" +" --limit-vdbe Panic if any test runs for more than 100,000 cycles\n" +" --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n" +" --load-db ARGS... Load template databases from files into SOURCE_DB\n" +" -m TEXT Add a description to the database\n" +" --native-vfs Use the native VFS for initially empty database files\n" +" --rebuild Rebuild and vacuum the database file\n" +" --result-trace Show the results of each SQL command\n" +" --sqlid N Use only SQL where sqlid=N\n" +" --timeout N Abort if any single test needs more than N seconds\n" +" -v|--verbose Increased output. Repeat for more output.\n" ); } From c0d269e96ca1591110c67ce08958588582abc3cc Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 3 Aug 2016 14:51:16 +0000 Subject: [PATCH 04/13] Fix a typo in a comment in btree.c. No changes to code. FossilOrigin-Name: 722c12816347ee9fce7a090cfebef2c5841e7445 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5028978397..558a3d8e2d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s--help\soutput\son\sfuzzcheck\sso\sthat\sit\sfix\sin\san\s80-character\swindow. -D 2016-08-03T13:40:54.644 +C Fix\sa\stypo\sin\sa\scomment\sin\sbtree.c.\s\s\sNo\schanges\sto\scode. +D 2016-08-03T14:51:16.394 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 @@ -327,7 +327,7 @@ F src/auth.c 5c8e0f37f785f935f589496801edd19840485853 F src/backup.c 6df65fdd569c901a418887a1a76f82ec35044556 F src/bitvec.c 3ee4c8b2c94ed3a7377256e18199e6ff5cf33f63 F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 -F src/btree.c 6a42efa461cf3a0c33e8755e9d236371ac80d1b3 +F src/btree.c 2551bd3ecb8b8988fb8b23aabadfb214dbc38e46 F src/btree.h 075c45707c0f8f8af118f739f36df8098a08b7da F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 F src/build.c d1fdfd7ab8f5447e494ef15825973bf0719527c6 @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e2f9919e34c70761e4e275eeffca8ccf9159223c -R 6ce4351ec9908162cf69cba24dd464d6 +P b91444b5db8465f09d112455e722c888b3f94329 +R aa712e9e7089879865bbb38d4c2c515d U drh -Z fde490c34eba36f3f6bb820fe63440a5 +Z 2b4f8b48b03032bd1efbc47f9457218f diff --git a/manifest.uuid b/manifest.uuid index f473a8f752..a6f1d523fa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b91444b5db8465f09d112455e722c888b3f94329 \ No newline at end of file +722c12816347ee9fce7a090cfebef2c5841e7445 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 8ea20b9ad0..841aee9463 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6385,7 +6385,7 @@ static void insertCell( /* ** A CellArray object contains a cache of pointers and sizes for a -** consecutive sequence of cells that might be held multiple pages. +** consecutive sequence of cells that might be held on multiple pages. */ typedef struct CellArray CellArray; struct CellArray { From dd545d3bf219c13f839cfb21d0bc122c3b431d2b Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 4 Aug 2016 09:09:44 +0000 Subject: [PATCH 05/13] Make sure the ORDER BY LIMIT optimization is not applied if the inner-most loop can only have a single iteration and is hence not really a loop. FossilOrigin-Name: 13e3bd3de6b434b6182ef36be108d7ee0be8ca53 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/where.c | 2 +- test/limit2.test | 22 ++++++++++++++++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 558a3d8e2d..3ea36916cc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sa\scomment\sin\sbtree.c.\s\s\sNo\schanges\sto\scode. -D 2016-08-03T14:51:16.394 +C Make\ssure\sthe\sORDER\sBY\sLIMIT\soptimization\sis\snot\sapplied\sif\sthe\sinner-most\nloop\scan\sonly\shave\sa\ssingle\siteration\sand\sis\shence\snot\sreally\sa\sloop. +D 2016-08-04T09:09:44.760 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 @@ -463,7 +463,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2 F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354 -F src/where.c bb1444f6ae6bc3cbd086cc61cd9c6e3a6168d89b +F src/where.c 5c9df42d50888be8274a5a0eb062eb0629869bd3 F src/whereInt.h e5b939701a7ceffc5a3a8188a37f9746416ebcd0 F src/wherecode.c 99707d11907c71d289ee9553d2d1a22f1fd8ba41 F src/whereexpr.c d7dcbf14ce1b5876c1f76496162c30fcba669563 @@ -888,7 +888,7 @@ F test/like.test 81632c437a947bf1f7130b19537da6a1a844806a F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da F test/like3.test 3608a2042b6f922f900fbfd5d3ce4e7eca57f7c4 F test/limit.test 0c99a27a87b14c646a9d583c7c89fd06c352663e -F test/limit2.test 55c9f4d08c89311e00afd75045ee1a2aca205cb4 +F test/limit2.test 40e79f3d95f2077742aa5b7676f58c9af1735d83 F test/loadext.test d077450695ddb5c1ea3ad7d48e5f5850fe732ad9 F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7 F test/lock.test be4fe08118fb988fed741f429b7dd5d65e1c90db @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b91444b5db8465f09d112455e722c888b3f94329 -R aa712e9e7089879865bbb38d4c2c515d +P 722c12816347ee9fce7a090cfebef2c5841e7445 +R fd11dfb179ebaeb65493cf49055d4419 U drh -Z 2b4f8b48b03032bd1efbc47f9457218f +Z c8d986adc7b509414bb3aed9ed932c87 diff --git a/manifest.uuid b/manifest.uuid index a6f1d523fa..832eed621e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -722c12816347ee9fce7a090cfebef2c5841e7445 \ No newline at end of file +13e3bd3de6b434b6182ef36be108d7ee0be8ca53 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 9b3c281efc..c2706dc5dd 100644 --- a/src/where.c +++ b/src/where.c @@ -3971,7 +3971,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ pWInfo->revMask = pFrom->revLoop; if( pWInfo->nOBSat<=0 ){ pWInfo->nOBSat = 0; - if( nLoop>0 ){ + if( nLoop>0 && (pFrom->aLoop[nLoop-1]->wsFlags & WHERE_ONEROW)==0 ){ Bitmask m = 0; int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom, WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m); diff --git a/test/limit2.test b/test/limit2.test index f415f3263b..fb4c89644f 100644 --- a/test/limit2.test +++ b/test/limit2.test @@ -77,6 +77,28 @@ do_test limit2-120.3 { expr {$fast_count < 0.02*$slow_count} } {1} +# Bug report against the new ORDER BY LIMIT optimization just prior to +# release. (Unreleased so there is no ticket). +# +# Make sure the optimization is not applied if the inner loop can only +# provide a single row of output. +# +do_execsql_test limit2-200 { + CREATE TABLE t200(a, b); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000) + INSERT INTO t200(a,b) SELECT x, x FROM c; + CREATE TABLE t201(x INTEGER PRIMARY KEY, y); + INSERT INTO t201(x,y) VALUES(2,12345); + + SELECT *, '|' FROM t200, t201 WHERE x=b ORDER BY y LIMIT 3; +} {2 2 2 12345 |} +do_execsql_test limit2-210 { + SELECT *, '|' FROM t200 LEFT JOIN t201 ON x=b ORDER BY y LIMIT 3; +} {1 1 {} {} | 3 3 {} {} | 4 4 {} {} |} + + + + finish_test From cc15313cc9a8b6713dc9f995ccc4d4c088da55d7 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 4 Aug 2016 12:35:17 +0000 Subject: [PATCH 06/13] Add the experimental SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION compile-time option. When enabled, the "unknown function" error is suppressed for EXPLAIN and a no-op function named "unknown()" is substituted. This facilitiates using the command-line shell to analyze queries from applications that contain many application-defined functions that are not normally available to the shell. FossilOrigin-Name: b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e --- Makefile.in | 2 ++ Makefile.msc | 5 ++++- main.mk | 2 ++ manifest | 23 ++++++++++++----------- manifest.uuid | 2 +- src/expr.c | 5 +++++ src/func.c | 29 ++++++++++++++++++++++++++--- src/resolve.c | 6 +++++- 8 files changed, 57 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index fd0ad6b6a7..9b2fe86cf4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -558,7 +558,9 @@ TESTOPTS = --verbose=file --output=test-out.txt # Extra compiler options for various shell tools # SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 +# SHELL_OPT += -DSQLITE_ENABLE_FTS5 SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1 FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 diff --git a/Makefile.msc b/Makefile.msc index 527efd8f7d..5f7643978c 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1424,7 +1424,10 @@ FUZZDATA = \ # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 +# SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS5 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION !ENDIF # <> diff --git a/main.mk b/main.mk index e3da609750..451837ffff 100644 --- a/main.mk +++ b/main.mk @@ -470,6 +470,8 @@ TESTOPTS = --verbose=file --output=test-out.txt # Extra compiler options for various shell tools # SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 +SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1 FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 diff --git a/manifest b/manifest index 3ea36916cc..c4a95c5def 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Make\ssure\sthe\sORDER\sBY\sLIMIT\soptimization\sis\snot\sapplied\sif\sthe\sinner-most\nloop\scan\sonly\shave\sa\ssingle\siteration\sand\sis\shence\snot\sreally\sa\sloop. -D 2016-08-04T09:09:44.760 -F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db +C Add\sthe\sexperimental\sSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\scompile-time\soption.\nWhen\senabled,\sthe\s"unknown\sfunction"\serror\sis\ssuppressed\sfor\sEXPLAIN\sand\na\sno-op\sfunction\snamed\s"unknown()"\sis\ssubstituted.\s\sThis\sfacilitiates\susing\nthe\scommand-line\sshell\sto\sanalyze\squeries\sfrom\sapplications\sthat\scontain\nmany\sapplication-defined\sfunctions\sthat\sare\snot\snormally\savailable\sto\sthe\nshell. +D 2016-08-04T12:35:17.002 +F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233 +F Makefile.msc 817e65faf9ad66a8d462e5b5e645be600213efb8 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION cb29eb11e493dd85b3eeec4053c03949bf98478e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -308,7 +308,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk e9d66f1b1c4874221d12d940be3ce5f397c10741 +F main.mk 1883ecab643b136e8ab3fdc33785e6ea8b5ceb46 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -337,10 +337,10 @@ F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7 F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b F src/dbstat.c 4f6f7f52b49beb9636ffbd517cfe44a402ba4ad0 F src/delete.c 4aba4214a377ce8ddde2d2e609777bcc8235200f -F src/expr.c fbc17c717a80b5b61158ea8f25b5af6f8cad66f8 +F src/expr.c 9c5eca8602f6c496e8d4eefefe2aae3d831dd510 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c bc4145347595b7770f9a598cff1c848302cf5413 -F src/func.c 61a4114cf7004f10c542cfabbab9f2bcb9033045 +F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771 F src/global.c c45ea22aff29334f6a9ec549235ac3357c970015 F src/hash.c 55b5fb474100cee0b901edaf203e26c970940f36 F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 @@ -381,7 +381,7 @@ F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 -F src/resolve.c cca3aa77b95706df5d635a2141a4d1de60ae6598 +F src/resolve.c 0392c6686586b1d4dac9a4106959f03ddd70e9aa F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c f3c6e9065fb34f6a23af27ec7f1f717ffbfc2ee4 F src/shell.c 79dda477be6c96eba6e952a934957ad36f87acc7 @@ -1509,7 +1509,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 722c12816347ee9fce7a090cfebef2c5841e7445 -R fd11dfb179ebaeb65493cf49055d4419 +P 13e3bd3de6b434b6182ef36be108d7ee0be8ca53 +Q +4ada023ca075628fdafc3bc4520239b9789cff29 +R f1859801c403afb60ddad5424514cd57 U drh -Z c8d986adc7b509414bb3aed9ed932c87 +Z 688b79edff11cfb7031a01d005983417 diff --git a/manifest.uuid b/manifest.uuid index 832eed621e..ee38509af6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -13e3bd3de6b434b6182ef36be108d7ee0be8ca53 \ No newline at end of file +b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index c6d74cfd32..74f09bbee9 100644 --- a/src/expr.c +++ b/src/expr.c @@ -2943,6 +2943,11 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ assert( !ExprHasProperty(pExpr, EP_IntValue) ); zId = pExpr->u.zToken; pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0); +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + if( pDef==0 && pParse->explain ){ + pDef = sqlite3FindFunction(db, "unknown", nFarg, enc, 0); + } +#endif if( pDef==0 || pDef->xFinalize!=0 ){ sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); break; diff --git a/src/func.c b/src/func.c index 78c8806456..79bb1e3dd2 100644 --- a/src/func.c +++ b/src/func.c @@ -1316,6 +1316,26 @@ static void trimFunc( } +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION +/* +** The "unknown" function is automatically substituted in place of +** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN +** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used. +** When the "sqlite3" command-line shell is built using this functionality, +** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries +** involving application-defined functions to be examined in a generic +** sqlite3 shell. +*/ +static void unknownFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + /* no-op */ +} +#endif /*SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION*/ + + /* IMP: R-25361-16150 This function is omitted from SQLite by default. It ** is only available if the SQLITE_SOUNDEX compile-time option is used ** when SQLite is built. @@ -1786,13 +1806,16 @@ void sqlite3RegisterBuiltinFunctions(void){ AGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize), LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #ifdef SQLITE_CASE_SENSITIVE_LIKE +#ifdef SQLITE_CASE_SENSITIVE_LIKE LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #else +#else LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), - #endif +#endif +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + FUNCTION(unknown, -1, 0, 0, unknownFunc ), +#endif FUNCTION(coalesce, 1, 0, 0, 0 ), FUNCTION(coalesce, 0, 0, 0, 0 ), FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), diff --git a/src/resolve.c b/src/resolve.c index 77ce37f6d7..8ae7f0919c 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -718,7 +718,11 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); pNC->nErr++; is_agg = 0; - }else if( no_such_func && pParse->db->init.busy==0 ){ + }else if( no_such_func && pParse->db->init.busy==0 +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + && pParse->explain==0 +#endif + ){ sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); pNC->nErr++; }else if( wrong_num_args ){ From 70ae0e93ec253557ac9a7379b61c917ddb4786aa Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 4 Aug 2016 13:23:28 +0000 Subject: [PATCH 07/13] Revert the SQLITE_APICALL changes for now. That changes needs further research before it is released. Deferred until 3.15. FossilOrigin-Name: 9adda385267d1a0ecff259b42a284913668441a2 --- Makefile.msc | 80 ++++++++------------------------------------- manifest | 17 +++++----- manifest.uuid | 2 +- tool/mksqlite3c.tcl | 3 +- tool/mksqlite3h.tcl | 7 +--- 5 files changed, 25 insertions(+), 84 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 5f7643978c..cd866ce4a4 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -24,13 +24,6 @@ USE_AMALGAMATION = 1 USE_FULLWARN = 0 !ENDIF -# Set this non-0 to enable full runtime error checks (-RTC1, etc). This -# has no effect if (any) optimizations are enabled. -# -!IFNDEF USE_RUNTIME_CHECKS -USE_RUNTIME_CHECKS = 0 -!ENDIF - # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # @@ -471,32 +464,20 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS) # !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0 !IF "$(PLATFORM)"=="x86" -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -# <> -TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl -# <> +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall !ELSE !IFNDEF PLATFORM -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -# <> -TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl -# <> +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall !ELSE CORE_CCONV_OPTS = SHELL_CCONV_OPTS = -# <> -TEST_CCONV_OPTS = -# <> !ENDIF !ENDIF !ELSE CORE_CCONV_OPTS = SHELL_CCONV_OPTS = -# <> -TEST_CCONV_OPTS = -# <> !ENDIF # These are additional compiler options used for the core library. @@ -854,10 +835,6 @@ RCC = $(RCC) -D_DEBUG !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0 TCC = $(TCC) -Od BCC = $(BCC) -Od -!IF $(USE_RUNTIME_CHECKS)!=0 -TCC = $(TCC) -RTC1 -BCC = $(BCC) -RTC1 -!ENDIF !ELSEIF $(OPTIMIZATIONS)>=3 TCC = $(TCC) -Ox BCC = $(BCC) -Ox @@ -1258,12 +1235,6 @@ SRC11 = \ parse.h \ $(SQLITE3H) -# Generated Tcl header files -# -SRC12 = \ - sqlite_tcl.h \ - sqlite_tclDecls.h - # All source code files. # SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11) @@ -1370,7 +1341,7 @@ HDR = \ parse.h \ $(TOP)\src\pragma.h \ $(SQLITE3H) \ - sqlite3ext.h \ + $(TOP)\src\sqlite3ext.h \ $(TOP)\src\sqliteInt.h \ $(TOP)\src\sqliteLimit.h \ $(TOP)\src\vdbe.h \ @@ -1424,10 +1395,7 @@ FUZZDATA = \ # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -# SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS5 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS !ENDIF # <> @@ -1531,7 +1499,7 @@ mptest: mptester.exe # files are automatically generated. This target takes care of # all that automatic generation. # -.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c sqlite_tcl.h +.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c -rmdir /Q/S tsrc 2>NUL -mkdir tsrc for %i in ($(SRC00)) do copy /Y %i tsrc @@ -1546,7 +1514,6 @@ mptest: mptester.exe for %i in ($(SRC09)) do copy /Y %i tsrc for %i in ($(SRC10)) do copy /Y %i tsrc for %i in ($(SRC11)) do copy /Y %i tsrc - for %i in ($(SRC12)) do copy /Y %i tsrc copy /Y fts5.c tsrc copy /Y fts5.h tsrc del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL @@ -1828,10 +1795,10 @@ wherecode.lo: $(TOP)\src\wherecode.c $(HDR) whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c -tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h +tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) $(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c -tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h +tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) $(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS) @@ -1860,9 +1827,7 @@ $(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) sqlite3ext.h: .target_source - type tsrc\sqlite3ext.h | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*\)" "(SQLITE_CALLBACK *)" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_APICALL *" > sqlite3ext.h - copy /Y sqlite3ext.h tsrc\sqlite3ext.h + copy tsrc\sqlite3ext.h . mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c $(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) \ @@ -1995,7 +1960,6 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024 -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS) TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) @@ -2005,25 +1969,7 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0) TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1) !ENDIF -sqlite_tclDecls.h: - echo #ifndef SQLITE_TCLAPI > sqlite_tclDecls.h - echo # define SQLITE_TCLAPI >> sqlite_tclDecls.h - echo #endif >> sqlite_tclDecls.h - type "$(TCLINCDIR)\tclDecls.h" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN(?: CONST\d+?)?\s+?[^\(]*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tcl_" "(SQLITE_TCLAPI *tcl_" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tclFreeObj" "(SQLITE_TCLAPI *tclFreeObj" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> sqlite_tclDecls.h - -sqlite_tcl.h: sqlite_tclDecls.h - type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "typedef (.*?)\(Tcl_" "typedef \1 (SQLITE_TCLAPI Tcl_" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "void (*freeProc)" "void (SQLITE_TCLAPI *freeProc)" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*findProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *findProc)" \ - | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> sqlite_tcl.h - -testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) sqlite_tcl.h +testfixture.exe: $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \ -DBUILD_sqlite -I$(TCLINCDIR) \ $(TESTFIXTURE_SRC) \ @@ -2072,7 +2018,7 @@ smoketest: $(TESTPROGS) @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\main.test $(TESTOPTS) -sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl sqlite_tcl.h +sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl echo #define TCLSH 2 > $@ echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@ copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ @@ -2152,7 +2098,7 @@ clean: -rmdir /Q/S .libs 2>NUL -rmdir /Q/S tsrc 2>NUL del /Q .target_source 2>NUL - del /Q tclsqlite3.exe sqlite_tcl.h sqlite_tclDecls.h 2>NUL + del /Q tclsqlite3.exe 2>NUL del /Q testloadext.dll 2>NUL del /Q testfixture.exe test.db 2>NUL del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL diff --git a/manifest b/manifest index c4a95c5def..5b9bd0d8e5 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Add\sthe\sexperimental\sSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\scompile-time\soption.\nWhen\senabled,\sthe\s"unknown\sfunction"\serror\sis\ssuppressed\sfor\sEXPLAIN\sand\na\sno-op\sfunction\snamed\s"unknown()"\sis\ssubstituted.\s\sThis\sfacilitiates\susing\nthe\scommand-line\sshell\sto\sanalyze\squeries\sfrom\sapplications\sthat\scontain\nmany\sapplication-defined\sfunctions\sthat\sare\snot\snormally\savailable\sto\sthe\nshell. -D 2016-08-04T12:35:17.002 +C Revert\sthe\sSQLITE_APICALL\schanges\sfor\snow.\s\sThat\schanges\sneeds\sfurther\nresearch\sbefore\sit\sis\sreleased.\s\sDeferred\suntil\s3.15. +D 2016-08-04T13:23:28.286 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 817e65faf9ad66a8d462e5b5e645be600213efb8 +F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION cb29eb11e493dd85b3eeec4053c03949bf98478e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -1450,8 +1450,8 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl f0d5bb266d1d388cf86fce5ba01a891e95d72d41 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl aa58ea3be311c81821c2cd3209f55e46b07ab656 -F tool/mksqlite3c.tcl 655181fb25f69b3524b30efd0750c43513415216 -F tool/mksqlite3h.tcl cf5cd68028e69a51ed5c76042672664201f0f756 +F tool/mksqlite3c.tcl 63af8429841f08552e6da1d93b3dee4a93ff8071 +F tool/mksqlite3h.tcl e7b106fc4f29fbc258e8ba9b88d9108332ea2ade F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl 4abcaf3267171b2faadaf9b82a0dfbaa6e98f8b7 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 @@ -1509,8 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 13e3bd3de6b434b6182ef36be108d7ee0be8ca53 -Q +4ada023ca075628fdafc3bc4520239b9789cff29 -R f1859801c403afb60ddad5424514cd57 +P b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e +R 54afa4c645a3de150c21fe8a3504aa0b U drh -Z 688b79edff11cfb7031a01d005983417 +Z 5a54570e253d8550ab3d18086a0dcdce diff --git a/manifest.uuid b/manifest.uuid index ee38509af6..3bacaad736 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e \ No newline at end of file +9adda385267d1a0ecff259b42a284913668441a2 \ No newline at end of file diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index c5f765ed1c..7e8558d2ab 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -112,6 +112,7 @@ foreach hdr { pragma.h rtree.h sqlite3session.h + sqlite3ext.h sqlite3.h sqlite3ext.h sqlite3rbu.h @@ -231,7 +232,7 @@ proc copy_file {filename} { if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { - append line SQLITE_APICALL + append line SQLITE_STDCALL } append line " " $funcname $rest puts $out $line diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl index 9a4e7d2985..1af6d75730 100644 --- a/tool/mksqlite3h.tcl +++ b/tool/mksqlite3h.tcl @@ -21,8 +21,6 @@ # formatted as an integer (e.g. "3006017"). # 5) Replaces the string --SOURCE-ID-- with the date and time and sha1 # hash of the fossil-scm manifest for the source tree. -# 6) Adds the SQLITE_CALLBACK calling convention macro in front of all -# callback declarations. # # This script outputs to stdout. # @@ -122,14 +120,11 @@ foreach file $filelist { if {[lsearch -exact $cdecllist $funcname] >= 0} { append line SQLITE_CDECL } else { - append line SQLITE_APICALL + append line SQLITE_STDCALL } append line " " $funcname $rest } } - set line [string map [list (*sqlite3_syscall_ptr) \ - "(SQLITE_SYSAPI *sqlite3_syscall_ptr)"] $line] - regsub {\(\*} $line {(SQLITE_CALLBACK *} line puts $line } close $in From 0aafa9c89c543b6f9bb5c81346bd196d062e05a8 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 5 Aug 2016 14:35:47 +0000 Subject: [PATCH 08/13] Fix a very obscure problem following OOM in sqlite3_declare_vtab(). FossilOrigin-Name: 68eac74874d0646369bef3650c6cb271cca62ab4 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/build.c | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 5b9bd0d8e5..ad19c3dbd6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revert\sthe\sSQLITE_APICALL\schanges\sfor\snow.\s\sThat\schanges\sneeds\sfurther\nresearch\sbefore\sit\sis\sreleased.\s\sDeferred\suntil\s3.15. -D 2016-08-04T13:23:28.286 +C Fix\sa\svery\sobscure\sproblem\sfollowing\sOOM\sin\ssqlite3_declare_vtab(). +D 2016-08-05T14:35:47.568 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -330,7 +330,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 2551bd3ecb8b8988fb8b23aabadfb214dbc38e46 F src/btree.h 075c45707c0f8f8af118f739f36df8098a08b7da F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c d1fdfd7ab8f5447e494ef15825973bf0719527c6 +F src/build.c 7c3c780b703c09314032c8f6e4e7c1d80241a818 F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7 @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e -R 54afa4c645a3de150c21fe8a3504aa0b +P 9adda385267d1a0ecff259b42a284913668441a2 +R 36d01c6d4e5d55fe676a3ca2e553d6b8 U drh -Z 5a54570e253d8550ab3d18086a0dcdce +Z 0d50083da402e96d80dd6dfcbaebaad9 diff --git a/manifest.uuid b/manifest.uuid index 3bacaad736..6bcb510d7d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9adda385267d1a0ecff259b42a284913668441a2 \ No newline at end of file +68eac74874d0646369bef3650c6cb271cca62ab4 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 52f6f200f8..b14e6f2fc2 100644 --- a/src/build.c +++ b/src/build.c @@ -3037,6 +3037,13 @@ void sqlite3CreateIndex( if( zName==0 ){ goto exit_create_index; } + + /* Automatic index names generated from within sqlite3_declare_vtab() + ** must have names that are distinct from normal automatic index names. + ** The following statement converts "sqlite3_autoindex..." into + ** "sqlite3_butoindex..." in order to make the names distinct. + ** The "vtab_err.test" test demonstrates the need of this statement. */ + if( IN_DECLARE_VTAB ) zName[7]++; } /* Check for authorization to create an index. From 5360b55c6cc2298b72174871adfe3caabf20bf98 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 5 Aug 2016 15:34:42 +0000 Subject: [PATCH 09/13] Remove an incorrect ALWAYS() statement and add a test case to show when the condition is sometimes false. FossilOrigin-Name: 0f57effa3642e66a863f32cc7fba86d167084af3 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vtab.c | 2 +- test/stat.test | 13 +++++++++++++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index ad19c3dbd6..ec9b78cea8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\svery\sobscure\sproblem\sfollowing\sOOM\sin\ssqlite3_declare_vtab(). -D 2016-08-05T14:35:47.568 +C Remove\san\sincorrect\sALWAYS()\sstatement\sand\sadd\sa\stest\scase\sto\sshow\swhen\nthe\scondition\sis\ssometimes\sfalse. +D 2016-08-05T15:34:42.171 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -458,7 +458,7 @@ F src/vdbeblob.c 83d2d266383157b02e2b809350bb197e89d7895b F src/vdbemem.c 1ecaa5ee0caff07255f25d04e8dc88befb6f88d1 F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834 -F src/vtab.c 6fece06fdd50eb2b0673e37e627ce6710e4af5be +F src/vtab.c 6b3cfaff7e4397739d6b48511e777ca58c6d06d4 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2 @@ -1104,7 +1104,7 @@ F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 F test/sqldiff1.test 28cd737cf1b0078b1ec1bbf425e674c47785835e F test/sqllimits1.test a74ee2a3740b9f9c2437c246d8fb77354862a142 F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a -F test/stat.test ab95d28503d0f6d98ffd8ce204643c9da090ebf1 +F test/stat.test f8f1279ffffabe6df825723af18cc6e0ae70a893 F test/statfault.test f525a7bf633e50afd027700e9a486090684b1ac1 F test/stmt.test 64844332db69cf1a735fcb3e11548557fc95392f F test/subquery.test d7268d193dd33d5505df965399d3a594e76ae13f @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9adda385267d1a0ecff259b42a284913668441a2 -R 36d01c6d4e5d55fe676a3ca2e553d6b8 +P 68eac74874d0646369bef3650c6cb271cca62ab4 +R 8d5524e3947549ded2372df1ac699079 U drh -Z 0d50083da402e96d80dd6dfcbaebaad9 +Z 5feee06a3e8967a54a24fbeb2c1f3aea diff --git a/manifest.uuid b/manifest.uuid index 6bcb510d7d..64c0aece9a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -68eac74874d0646369bef3650c6cb271cca62ab4 \ No newline at end of file +0f57effa3642e66a863f32cc7fba86d167084af3 \ No newline at end of file diff --git a/src/vtab.c b/src/vtab.c index f37eb261aa..45c5e79abd 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -807,7 +807,7 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){ Table *pTab; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); - if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){ + if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){ VTable *p; int (*xDestroy)(sqlite3_vtab *); for(p=pTab->pVTable; p; p=p->pNext){ diff --git a/test/stat.test b/test/stat.test index 6a87a629b9..66ca5e2f2b 100644 --- a/test/stat.test +++ b/test/stat.test @@ -34,12 +34,25 @@ register_dbstat_vtab db do_execsql_test stat-0.0 { PRAGMA table_info(dbstat); } {/0 name TEXT .* 1 path TEXT .* 9 pgsize INTEGER/} + +# Attempts to drop an eponymous virtual table are a no-op. do_execsql_test stat-0.1 { + DROP TABLE dbstat; + PRAGMA table_info=dbstat; +} {/0 name TEXT .* 1 path TEXT .* 9 pgsize INTEGER/} + +db close +forcedelete test.db +sqlite3 db test.db +db func a_string a_string +register_dbstat_vtab db +do_execsql_test stat-0.2 { PRAGMA auto_vacuum = OFF; CREATE VIRTUAL TABLE temp.stat USING dbstat; SELECT * FROM stat; } {} + if {[wal_is_capable]} { do_execsql_test stat-0.1 { PRAGMA journal_mode = WAL; From 43c1ce390f25a6d988fb40ef95c2ef1afb1b7182 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 5 Aug 2016 16:16:26 +0000 Subject: [PATCH 10/13] Undo commit [f250166bb]. It is required to handle IO and other errors that occur within a VACUUM of a Zipvfs database. FossilOrigin-Name: ae72513af37cd806a6d94aaa7c47a740e119d3b1 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/backup.c | 6 ++++-- src/pager.c | 12 +++++++++++- src/pager.h | 1 + 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index ec9b78cea8..eab6773070 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sincorrect\sALWAYS()\sstatement\sand\sadd\sa\stest\scase\sto\sshow\swhen\nthe\scondition\sis\ssometimes\sfalse. -D 2016-08-05T15:34:42.171 +C Undo\scommit\s[f250166bb].\sIt\sis\srequired\sto\shandle\sIO\sand\sother\serrors\sthat\soccur\swithin\sa\sVACUUM\sof\sa\sZipvfs\sdatabase. +D 2016-08-05T16:16:26.624 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -324,7 +324,7 @@ F src/alter.c cc28ab933ae615b22add0d609794ffb6596b42ea F src/analyze.c 37fedc80ac966ce1745811746e68e4d8fa64c7fe F src/attach.c 771153bd1f4ab0b97a44a13dde2c7e5e1efeba22 F src/auth.c 5c8e0f37f785f935f589496801edd19840485853 -F src/backup.c 6df65fdd569c901a418887a1a76f82ec35044556 +F src/backup.c 17cd25a36d49330df2bacd2cadf2a61f3b525976 F src/bitvec.c 3ee4c8b2c94ed3a7377256e18199e6ff5cf33f63 F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 2551bd3ecb8b8988fb8b23aabadfb214dbc38e46 @@ -370,8 +370,8 @@ F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 F src/os_unix.c a9443cdab41d7f3cdf0df3a5aab62fd6e1c9b234 F src/os_win.c 520f23475f1de530c435d30b67b7b15fe90874b0 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c c368634b888b1c8740aea83b36bfd266f2443e60 -F src/pager.h 031a87445e5e0afc85312d1c380e123ad6c7aeaf +F src/pager.c 40928c450320da78bb4bd3ae82818f4239e19b7e +F src/pager.h 966d2769e76ae347c8a32c4165faf6e6cb64546d F src/parse.y 99b676e6fc2f4e331ab93e76b3987cffdbd28efa F src/pcache.c 5583c8ade4b05075a60ba953ef471d1c1a9c05df F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490 @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 68eac74874d0646369bef3650c6cb271cca62ab4 -R 8d5524e3947549ded2372df1ac699079 -U drh -Z 5feee06a3e8967a54a24fbeb2c1f3aea +P 0f57effa3642e66a863f32cc7fba86d167084af3 +R 7173910e7a14fcd3861af608a7447a5a +U dan +Z 5568e465afb61eecd4219a0cc50c6e2e diff --git a/manifest.uuid b/manifest.uuid index 64c0aece9a..4b900d08a6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0f57effa3642e66a863f32cc7fba86d167084af3 \ No newline at end of file +ae72513af37cd806a6d94aaa7c47a740e119d3b1 \ No newline at end of file diff --git a/src/backup.c b/src/backup.c index 3df56e5384..19c3b2a647 100644 --- a/src/backup.c +++ b/src/backup.c @@ -777,13 +777,15 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ ** sqlite3_backup_step(), we can guarantee that the copy finishes ** within a single call (unless an error occurs). The assert() statement ** checks this assumption - (p->rc) should be set to either SQLITE_DONE - ** or an error code. - */ + ** or an error code. */ sqlite3_backup_step(&b, 0x7FFFFFFF); assert( b.rc!=SQLITE_OK ); + rc = sqlite3_backup_finish(&b); if( rc==SQLITE_OK ){ pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; + }else{ + sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); } assert( sqlite3BtreeIsInTrans(pTo)==0 ); diff --git a/src/pager.c b/src/pager.c index 1ae831d148..cd8d1204b3 100644 --- a/src/pager.c +++ b/src/pager.c @@ -7157,6 +7157,17 @@ sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){ return &pPager->pBackup; } +#ifndef SQLITE_OMIT_VACUUM +/* +** Unless this is an in-memory or temporary database, clear the pager cache. +*/ +void sqlite3PagerClearCache(Pager *pPager){ + assert( MEMDB==0 || pPager->tempFile ); + if( pPager->tempFile==0 ) pager_reset(pPager); +} +#endif + + #ifndef SQLITE_OMIT_WAL /* ** This function is called when the user invokes "PRAGMA wal_checkpoint", @@ -7382,5 +7393,4 @@ int sqlite3PagerWalFramesize(Pager *pPager){ } #endif - #endif /* SQLITE_OMIT_DISKIO */ diff --git a/src/pager.h b/src/pager.h index af71d745a8..1046670912 100644 --- a/src/pager.h +++ b/src/pager.h @@ -203,6 +203,7 @@ const char *sqlite3PagerJournalname(Pager*); void *sqlite3PagerTempSpace(Pager*); int sqlite3PagerIsMemdb(Pager*); void sqlite3PagerCacheStat(Pager *, int, int, int *); +void sqlite3PagerClearCache(Pager*); int sqlite3SectorSize(sqlite3_file *); /* Functions used to truncate the database file. */ From e099b67c204286eb7ff45e07169001786dc35971 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 5 Aug 2016 20:54:45 +0000 Subject: [PATCH 11/13] Have the TEA package build without SQLITE_OMIT_DEPRECATED. As it uses recently deprecated interfaces sqlite3_profile() and sqlite3_trace(). FossilOrigin-Name: 95578898835b933901603bd4d5e063f1219a016f --- autoconf/tea/configure.ac | 1 - manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac index 8df0af6195..7fca05b2e7 100644 --- a/autoconf/tea/configure.ac +++ b/autoconf/tea/configure.ac @@ -78,7 +78,6 @@ TEA_ADD_LIBS([]) TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1]) TEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1]) TEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1]) -TEA_ADD_CFLAGS([-DSQLITE_OMIT_DEPRECATED=1]) TEA_ADD_STUB_SOURCES([]) TEA_ADD_TCL_SOURCES([]) diff --git a/manifest b/manifest index eab6773070..8f590c5751 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Undo\scommit\s[f250166bb].\sIt\sis\srequired\sto\shandle\sIO\sand\sother\serrors\sthat\soccur\swithin\sa\sVACUUM\sof\sa\sZipvfs\sdatabase. -D 2016-08-05T16:16:26.624 +C Have\sthe\sTEA\spackage\sbuild\swithout\sSQLITE_OMIT_DEPRECATED.\sAs\sit\suses\srecently\sdeprecated\sinterfaces\ssqlite3_profile()\sand\ssqlite3_trace(). +D 2016-08-05T20:54:45.205 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -18,7 +18,7 @@ F autoconf/configure.ac cacf2616abf6e4a569bde2ef365c143caeec40bc F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04 +F autoconf/tea/configure.ac 8aa16e3f0a5ca7959d4af198f46934ec187d395f F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in 3ef61715cf1c7bdcff56947ffadb26bc991ca39d @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0f57effa3642e66a863f32cc7fba86d167084af3 -R 7173910e7a14fcd3861af608a7447a5a +P ae72513af37cd806a6d94aaa7c47a740e119d3b1 +R 40e4a12455b009781006c09c1ead4d48 U dan -Z 5568e465afb61eecd4219a0cc50c6e2e +Z 73dc717651276499651d605bdf75c66a diff --git a/manifest.uuid b/manifest.uuid index 4b900d08a6..a4b041f403 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ae72513af37cd806a6d94aaa7c47a740e119d3b1 \ No newline at end of file +95578898835b933901603bd4d5e063f1219a016f \ No newline at end of file From 6da466e4f46d820f2751ccbd4d7a685107fcf2b1 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 7 Aug 2016 18:52:11 +0000 Subject: [PATCH 12/13] Fix documentation typos. No changes to code. FossilOrigin-Name: ebc396a19fa79bea208ecda277ffff5d02166d0b --- ext/fts5/fts5.h | 3 +-- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/sqlite.h.in | 6 +++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ext/fts5/fts5.h b/ext/fts5/fts5.h index b32e2132dd..a45c145d38 100644 --- a/ext/fts5/fts5.h +++ b/ext/fts5/fts5.h @@ -318,7 +318,7 @@ struct Fts5ExtensionApi { ** behaviour. The structure methods are expected to function as follows: ** ** xCreate: -** This function is used to allocate and inititalize a tokenizer instance. +** This function is used to allocate and initialize a tokenizer instance. ** A tokenizer instance is required to actually tokenize text. ** ** The first argument passed to this function is a copy of the (void*) @@ -577,4 +577,3 @@ struct fts5_api { #endif #endif /* _FTS5_H */ - diff --git a/manifest b/manifest index 8f590c5751..dd20d64d7b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sthe\sTEA\spackage\sbuild\swithout\sSQLITE_OMIT_DEPRECATED.\sAs\sit\suses\srecently\sdeprecated\sinterfaces\ssqlite3_profile()\sand\ssqlite3_trace(). -D 2016-08-05T20:54:45.205 +C Fix\sdocumentation\stypos.\s\sNo\schanges\sto\scode. +D 2016-08-07T18:52:11.690 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -97,7 +97,7 @@ F ext/fts3/unicode/UnicodeData.txt cd07314edb62d49fde34debdaf92fa2aa69011e7 F ext/fts3/unicode/mkunicode.tcl 2debed3f582d77b3fdd0b8830880250021571fd8 F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95 F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0 -F ext/fts5/fts5.h b770c5e0a8d2ee071ddffc7ab722dbf3474a8abe +F ext/fts5/fts5.h 62f3e33ceeb9a428db139f9c012186b371da1cc7 F ext/fts5/fts5Int.h 9bd0c7c64285b5b368eca0ac63613185c5ad24ba F ext/fts5/fts5_aux.c daa57fb45216491814520bbb587e97bf81ced458 F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd @@ -385,7 +385,7 @@ F src/resolve.c 0392c6686586b1d4dac9a4106959f03ddd70e9aa F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c f3c6e9065fb34f6a23af27ec7f1f717ffbfc2ee4 F src/shell.c 79dda477be6c96eba6e952a934957ad36f87acc7 -F src/sqlite.h.in e011dcc3942e6ddc8dd7b894e9e6702e4269161e +F src/sqlite.h.in 0f7580280d1b009b507d8beec1ff0f197ba0cc99 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae F src/sqliteInt.h d6f221a5bd572df935140beda82f357c2185a77c @@ -1509,7 +1509,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ae72513af37cd806a6d94aaa7c47a740e119d3b1 -R 40e4a12455b009781006c09c1ead4d48 -U dan -Z 73dc717651276499651d605bdf75c66a +P 95578898835b933901603bd4d5e063f1219a016f +R e7962d3372d6a1e29e3980753a6f0162 +U drh +Z 69a694206e64a93c59f8e06cf497782d diff --git a/manifest.uuid b/manifest.uuid index a4b041f403..fc541c54b5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -95578898835b933901603bd4d5e063f1219a016f \ No newline at end of file +ebc396a19fa79bea208ecda277ffff5d02166d0b \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f60ccaf55c..1ee39b6799 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1959,7 +1959,7 @@ struct sqlite3_mem_methods { ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. ** There should be two additional arguments. ** When the first argument to this interface is 1, then only the C-API is -** enabled and the SQL function remains disabled. If the first argment to +** enabled and the SQL function remains disabled. If the first argument to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. @@ -5537,7 +5537,7 @@ SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR and if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a -** NULL pointer, then this routine simply checks for the existance of the +** NULL pointer, then this routine simply checks for the existence of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. ** @@ -8132,7 +8132,7 @@ int sqlite3_db_cacheflush(sqlite3*); ** ^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 +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify 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 From e22c375659d073c435a49635c05f1fcd86aeb815 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 8 Aug 2016 13:40:27 +0000 Subject: [PATCH 13/13] Version 3.14 FossilOrigin-Name: d5e98057028abcf7217d0d2b2e29bbbcdf09d6de --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index dd20d64d7b..9d5c14e49e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sdocumentation\stypos.\s\sNo\schanges\sto\scode. -D 2016-08-07T18:52:11.690 +C Version\s3.14 +D 2016-08-08T13:40:27.974 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -1509,7 +1509,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 95578898835b933901603bd4d5e063f1219a016f +P ebc396a19fa79bea208ecda277ffff5d02166d0b R e7962d3372d6a1e29e3980753a6f0162 +T +bgcolor * #d0c0ff +T +sym-release * +T +sym-version-3.14.0 * U drh -Z 69a694206e64a93c59f8e06cf497782d +Z ecb9b7072c2b71d36f58909f83563ec2 diff --git a/manifest.uuid b/manifest.uuid index fc541c54b5..732a4af61b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ebc396a19fa79bea208ecda277ffff5d02166d0b \ No newline at end of file +d5e98057028abcf7217d0d2b2e29bbbcdf09d6de \ No newline at end of file