Compare commits

...

133 Commits

Author SHA1 Message Date
mistachkin 9456ad4f1a Backport the 'stdcall' related enhancements from trunk.
FossilOrigin-Name: cbb93d1aa1f992f17f76fd71fe9a99e03082f103
2015-03-25 00:09:44 +00:00
drh 85ebe788c7 Version 3.8.8.3
FossilOrigin-Name: 9d6c1880fb75660bbabd693175579529785f8a6b
2015-02-25 13:29:11 +00:00
dan 87d9f8b595 Add support for linenoise to shell.c.
FossilOrigin-Name: ec27ab0eb3a1ee08a73dda23d2a0f9fb70962745
2015-02-25 12:52:33 +00:00
drh d72c1d639f Make sure partial indexes are not qualified incorrectly by a constraint that
is inside the ON clause of a LEFT JOIN.  Fix for ticket [2326c258d02ead33].
Cherry-pick from [491cfe9b3f87f].

FossilOrigin-Name: 9d94ac6a8b7a2721c15745184b3bb09b15a82503
2015-02-24 20:12:57 +00:00
drh 5e884edc9f Increase the version number to 3.8.8.3
FossilOrigin-Name: a92afe7d8cc7d0e84d843c8ea7ef714994c3585c
2015-02-24 16:22:01 +00:00
dan f002023104 Improve the performance of fts3/4 queries that use the OR operator and at least one auxiliary fts function. Cherrypick of [245e8730451f].
FossilOrigin-Name: b20824628f92dfa97533e9f751264b77129cc468
2015-02-12 17:15:17 +00:00
drh d8668c8752 Version 3.8.8.2
FossilOrigin-Name: 7757fc721220e136620a89c9d28247f28bbbc098
2015-01-30 14:30:45 +00:00
drh dd853fb6e5 Bump the version number to 3.8.8.2
FossilOrigin-Name: 65bfbbb416c048521ca749ebfb1c5f3eea0585ce
2015-01-29 20:01:14 +00:00
drh 0e8e04efd1 Ensure that "PRAGMA wal_checkpoint = TRUNCATE|FULL|RESTART" block on other connections and truncate the wal file as required even if the entire wal file has already been checkpointed. Cherry-pick from trunk.
FossilOrigin-Name: 18610617aff622d5212b5fb589b46542a205417a
2015-01-29 19:59:05 +00:00
drh 8c441848d2 Version 3.8.8.1
FossilOrigin-Name: f73337e3e289915a76ca96e7a05a1a8d4e890d55
2015-01-20 16:51:25 +00:00
drh 142f927687 Change the version number to 3.8.8.1
FossilOrigin-Name: c75555a354e3fd0195d9595ccf98ef7a93b4359f
2015-01-20 02:51:33 +00:00
drh 0a58f18b07 Fix another instance of an incorrect value for KeyInfo.nXField on a
sorting index.

FossilOrigin-Name: dc711db44ec424a7850231a39088229c23238f1b
2015-01-20 02:50:34 +00:00
drh f3b4d49a96 Ensure that the KeyInfo.nXField value for ephemeral tables used to implement
ORDER BY or GROUP BY clauses is set correctly, so that the
sqlite3VdbeFindCompare() routine can choose the correct comparison function.
Add assert() statements to the high-speed comparison functions to detect
cases where they are inappropriately chosen.
Fix for ticket [f97c4637102a3ae72b7911].

FossilOrigin-Name: 59e592f67fb88e2630c04655058fc63439af0913
2015-01-19 21:38:53 +00:00
drh 24bb5de5b0 Version 3.8.8
FossilOrigin-Name: 7d68a42face3ab14ed88407d4331872f5b243fdf
2015-01-16 12:08:06 +00:00
drh 3931112eab Fix the spelling of "malloc_usable_size" in configure and configure.ac.
FossilOrigin-Name: 8f45217cbafef2297cdcec3fd69f4371dfb83922
2015-01-15 17:38:35 +00:00
drh b43be55e53 Makefile enhancements: (1) Rename autoconf/tea/configure.in to
autoconf/tea/configure.ac so that it works with the latest versions of
autoconf.  (2) Add the "amalgamation-tarball" targets to Makefile.in and
main.mk (renamed from "dist" in the latter case).  (3) Update the
README.first file in autoconf/  (4) The TOP macro
in Makefile.in is now an absolute rather than a relative path.

FossilOrigin-Name: 3bafeec934e56f633d0de6890e84fca990e54435
2015-01-15 15:47:06 +00:00
drh 068a251d99 Simplify some code in rtree, to avoid confusing the optimizer in GCC on
some macs:
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00).
Prior to these changes, compiling with -O3 would cause incorrect code to
be generated.  The change to the nodeGetCell() routine is key.  The other
changes are merely cosmetic details discovered while bug hunting.

FossilOrigin-Name: 882181ff9dd75f32db266db6e476671021fc567b
2015-01-13 21:26:17 +00:00
drh e0e43029ef Fix the e_walauto.test test module so that it works on both little-endian and
big-ending machines.

FossilOrigin-Name: 5682db7b871689b9ee764afe070736f378e8ae1b
2015-01-13 01:12:43 +00:00
mistachkin 9ab31fcee1 Fix harmless compiler warnings when using -W4 with MSVC.
FossilOrigin-Name: e693e11d1b9265974c32bddba873ea30a4d0b708
2015-01-12 21:43:00 +00:00
mistachkin 189143d355 Fix harmless compiler warning in an assert() statement.
FossilOrigin-Name: bdbeed01ddc60a4ab322621fc118cc4767660fd3
2015-01-12 20:25:33 +00:00
mistachkin 32562501a1 Add two more classes of harmless MSVC compiler warnings.
FossilOrigin-Name: de30d5b053b8e004418c81945d626cfad315d6ba
2015-01-12 20:20:26 +00:00
mistachkin 7bb22ac7ff Silence some harmless uninitialized local variable warnings.
FossilOrigin-Name: 44375a34e59d1b0f0d765a99dcc7e6f30a4be7f7
2015-01-12 19:59:12 +00:00
mistachkin 27b2f05335 Harmless compiler warning fixes for 'testfixture' and the miscellaneous extensions when built with the MSVC makefile.
FossilOrigin-Name: 923fd66031ed1876bc63c3a038f0b8e33678184e
2015-01-12 19:49:46 +00:00
mistachkin 9b97b8fed9 Merge updates from trunk.
FossilOrigin-Name: ca5f2c545216c82486e66d26f55b49cbf351ffdc
2015-01-12 18:52:57 +00:00
mistachkin 7bb6e8e169 Get things compiling cleanly with MSVC and W4.
FossilOrigin-Name: c8725fa5fa361959b0f0a3fb36f204905d6f0ae9
2015-01-12 18:52:41 +00:00
mistachkin 1a51ce78ba Fix some harmless compiler warnings.
FossilOrigin-Name: 2b8eecbfe7935d3d9826fbcd473dd3a49138ad11
2015-01-12 18:38:02 +00:00
mistachkin c50428fa06 Fix comments and add another disabled warning for MSVC.
FossilOrigin-Name: 43b6b4cc051e5a801a992c56d2c82abcdcf45cec
2015-01-12 18:27:31 +00:00
mistachkin 2318d3387d Work in progress on fixing harmless compiler warnings when using -W4 and MSVC.
FossilOrigin-Name: 856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9
2015-01-12 18:02:52 +00:00
drh 8d9da63dac Add an assert() in order to calm a scan-build warning.
FossilOrigin-Name: 11e81ac2a7c917f7c9afc218d104d9870daf9668
2015-01-12 17:56:06 +00:00
drh 8567d40609 Add detection of the isnan() library function to the configure script. Make
the code responsive to the HAVE_ISNAN configuration option.

FossilOrigin-Name: 46f3aba2692d74c29ab5c1f24a6daac600fd6af8
2015-01-10 18:22:06 +00:00
drh f7a4a1b8c5 Make use of the fdatasync() interface if the HAVE_FDATASYNC macro is true.
FossilOrigin-Name: 694228e4632c2999efa47ecb49f679c177db02e5
2015-01-10 18:02:45 +00:00
drh 0ede9ebec7 Improvements to compile-time-option hygiene. Use "#if OPTION" instead of
"#ifdef OPTION" in cases where that makes sense, so that -DOPTION=0 will work.
Add the "Have-Not" configuration in releasetest.tcl which disables all of
the "HAVE_component" compile-time options.

FossilOrigin-Name: 9e92a5ed5aaba20461ed4ce8359d6e34e7773d68
2015-01-10 16:49:23 +00:00
drh 6aed1c4ff0 Add the ability to put comments in the Config and Platform setup sections of
the releasetest.tcl script.

FossilOrigin-Name: d6f8c899d8f1bf66a2234e0eb91b259dd64eed31
2015-01-10 15:21:26 +00:00
drh 05c7e0bdb6 Autoconf configure script updates: (1) remove the long-obsolete
--enable-cross-thread-connections option.  (2) remove the --with-hints= options.
(3) Extension loading is enabled by default.  (4) Check for strchrnull()
(5) Update the --help text.

FossilOrigin-Name: 5004063ce4c8816125372ecc5fd52140489306dd
2015-01-10 14:27:17 +00:00
drh db6bafaeb8 Change the testfixture binary so that it explicitly enabled core files
on a crash (on unix).  Add a test case to verify that this works.

FossilOrigin-Name: 90f422ed81311d7ab2a90a381d36cba9c20227fc
2015-01-09 21:54:58 +00:00
drh 1a803843ce Add SQLITE_ENABLE_STMT_SCANSTATUS to the Update-Delete-Limit configuration
in the releasetest.tcl script.

FossilOrigin-Name: c70d5edaf6327cb18df5285c3fc21b610f3d3294
2015-01-09 20:00:21 +00:00
drh ea18142624 Remove an unused preprocessor macro from pcache.c.
FossilOrigin-Name: 88a7a967116a48aeb5fa7014613c0134b1b47bb3
2015-01-09 19:45:28 +00:00
drh 179c59792e Improvements to the sqlite3_stmt_scanstatus() documentation. No changes
to code.

FossilOrigin-Name: 9309c9bc08c3cd5a96ada76544b11cae8e480c7a
2015-01-09 19:36:36 +00:00
drh 655814d2bd Fix three crash problems discovered by afl-fuzz.
Ticket [a59ae93ee990a55].

FossilOrigin-Name: fe5788633131281a0f27c5b75993ce2ff958bfeb
2015-01-09 01:27:29 +00:00
drh fa5ed0283c Add the "ascii" mode to the command-line shell.
FossilOrigin-Name: e1518a9478e1ce1ebd98894335e64c953064367f
2015-01-09 00:38:06 +00:00
drh 64134662c0 Omit modules from the "valgrind" permutation that fork off separate processes.
Also omit selectG.test because it is timing sensitive and valgrind is too slow
to get the right answer.

FossilOrigin-Name: 662932a69a0f69b7227cc05b75a9f1637a3862f4
2015-01-08 22:08:57 +00:00
drh 32e1f27960 Try to fix up the "valgrindtest" target in Makefile.in so that it avoids
misuse testing that can trigger false errors.

FossilOrigin-Name: 50b5a8af843fff93452cd1c8f82152124a1d864a
2015-01-08 16:47:51 +00:00
drh bc8b87a1bb Fix the extension tags on the "smoketest" makefile target for Windows.
FossilOrigin-Name: 826fd311e7e2849aefbd81724dcb4a5644cfa126
2015-01-08 02:28:02 +00:00
drh edb31cd191 In releasetest.tcl:
(1) Add the Failure-Detection platform.
(2) Re-add the --disable-shared argument on Default that was mistakenly
    removed by the previous commit.
(3) Remove the -ftrapv tests, as we read that -ftrapv does not work in GCC.

FossilOrigin-Name: 1f2fb77781a93427a2348f821b66dba7310c49b8
2015-01-08 02:15:11 +00:00
drh 5bfff9d2f6 In releasetest.tcl: add options --veryquick and pass-through compiler
optimization settings (ex: -O0).  Collect the SQLite version number from
the main.test output and show it during the summary report at the end.

FossilOrigin-Name: e7e7bc1d9a5c19571e7d87ad345b98c27a826fbd
2015-01-08 01:05:42 +00:00
drh 46350078eb In releasetest.tcl, always use --disable-shared together with
--disable-amalgamation because mingw generates a binary that crashes and
cannot be debugged using gdb if you don't.

FossilOrigin-Name: 19982439418fbd36c91853cf9e09a66606f293fc
2015-01-07 19:38:49 +00:00
drh f167a40284 In releasetest.tcl, copy certain command-line arguments (-g, -D..., etc)
down into each test run.

FossilOrigin-Name: 889864b58af1e51fb148af2d6a5cef4950f373f4
2015-01-07 18:44:59 +00:00
mistachkin d3a720e11e Modify the valgrind target to be consistent with regard to target suffixes.
FossilOrigin-Name: dc4aa7321262ace43d985a227ad052dfca7db6c7
2015-01-07 18:19:09 +00:00
mistachkin b13160f71f Fix threads-enabled builds on Windows when the amalgamation is not in use.
FossilOrigin-Name: 9b92a4d2b6585d5fdf20330e4138081df58960e9
2015-01-07 18:11:29 +00:00
drh 8f45555ddc In releasetest.tcl, change the --dryrun option to work as it does in
multitest.tcl of TH3.  Add the new --trace option that work like the --dryrun
option used to work.  Add the ability to specify additional configure-script
options in the Config array, and create configurations that use
--disable-shared and --disable-amalgamation for testing.

FossilOrigin-Name: be17ef03f1d74187f7d3b5d72a12fc00db513c8e
2015-01-07 14:41:18 +00:00
drh 8a2a0f560e Add a valgrind test to the Linux-x86_64 platform in releasetest.tcl.
FossilOrigin-Name: 4b6df035561add4e304fb56dd70ae4d413d6bd5d
2015-01-07 14:09:41 +00:00
dan ef3d66cb01 Fix a problem in the unix implementation of FCNTL_SIZE_HINT on systems that do not support posix_fallocate().
FossilOrigin-Name: af20eae1e6f608e4e61a07c3d14cf88c12751353
2015-01-06 21:31:47 +00:00
drh 6fab3d469a Improved and more rigorous test of large VALUES clauses.
FossilOrigin-Name: 6917d9f437224229fa103c847c2df87ade64e1e9
2015-01-06 16:53:49 +00:00
drh a5b43ac2f1 Enhance "INSERT INTO ... VALUES" so that the number of rows in the VALUES clause
is not limited by SQLITE_LIMIT_COMPOUND_SELECT, and so that the stack depth
is constant regardless of the number of rows in VALUES.

FossilOrigin-Name: e1c4a359aacfce97eb1652624789e71981e0d263
2015-01-05 20:13:49 +00:00
drh 3afd2b4d6d Avoid O(N*N) behavior with very long lists of VALUES.
FossilOrigin-Name: ee30fb35217f3429ee89aaad7c19f29710420e4c
2015-01-05 20:04:51 +00:00
drh 45f54a5778 Handle compound-select statements originating from VALUES clauses as a
special case that does not use recursion.

FossilOrigin-Name: 9ce9e43af38e6bc362734463d4bfc40ff0c98f8f
2015-01-05 19:16:42 +00:00
drh a0c01768f0 Towards getting INSERT statements to except many VALUE terms (more than
the limit imposed by SQLITE_LIMIT_COMPOUND_SELECT).  This check-in segfaults
on a stack overflow.  And it is slow.

FossilOrigin-Name: c9d65f739ad56f016c676e79aa39080be3fe868a
2015-01-05 16:27:43 +00:00
drh b87fbed5a3 Remove some needless recursion from compound SELECT processing.
FossilOrigin-Name: fe677d13f03e24fa667efc0c2e7f5bbb99521791
2015-01-05 15:48:45 +00:00
drh a780d8d767 In releasetest.tcl, omit the CC=clang text from the label on Sanitize tests,
so that the label fits on an 80-character line.

FossilOrigin-Name: 23d4c07eb81db5a5c6beb56b5820f0b6501f1fb6
2015-01-03 18:59:17 +00:00
drh b96ef64921 Fix a harmless compiler warning.
FossilOrigin-Name: e0de580726a0ed35565783ed14440ef9bcdc3a3d
2015-01-02 21:54:32 +00:00
mistachkin 6da0a6d0d4 Merge updates from trunk.
FossilOrigin-Name: ea99f4b29afb98dd474d96889c934763f5636891
2015-01-02 20:06:27 +00:00
drh 3bd1791dfb Add the SQLITE_CONFIG_PMASZ start-time option.
FossilOrigin-Name: acb0d1e8324f19da3d4d577d58748848de1bcef7
2015-01-02 15:55:29 +00:00
drh 4081d5da3b Add logic to releasetest.tcl that detects -fsanitize=undefined errors.
Fix a few false-positivies that come up when running the sanitize=undefined
test.

FossilOrigin-Name: 2835e79a0afec6e4d449ac9340afec068c2d4c11
2015-01-01 23:02:01 +00:00
drh 149735d946 Add the ability to specify an alternative compiler (clang instead of gcc)
on the default Makefile.  Use this in releasetest.tcl to implement an
-fsanitize=undefined test.

FossilOrigin-Name: c55c05fe22b9ddb61de55d473a411a11090d3d68
2015-01-01 19:53:10 +00:00
drh 0325d3962a Enhance the "lemon" executable so that it ignores -f, -W, -O, and -I
command-line options.  This permits most of the same options that are passed
to the compiler to also be harmlessly passed to lemon, and thus
simplifies makefiles.

FossilOrigin-Name: da408d128b4301d9fc7a3a00f219dce7ed48bc60
2015-01-01 19:11:22 +00:00
drh 7203aed919 Fix an error in the computation of the number of hours of runtime for
individual test runs in the releasetest.tcl script.

FossilOrigin-Name: e2b0ebe21cd8a63927decb645efd2db80bf88379
2015-01-01 18:54:23 +00:00
drh f0a88279bd Fix a harmless compiler warning in rtree.
FossilOrigin-Name: 30891c6b8ebe9dfc939f9695bb45a159fbaaf262
2015-01-01 16:47:43 +00:00
drh a0de826c9f Fix two test cases in memsubsys1 so that they work with the mmap permutation.
FossilOrigin-Name: 66269d0d8e49eb3dc7f508714753584f648bb022
2015-01-01 14:13:45 +00:00
drh fddfacc371 Fix the fkey-7.1 test so that it sorts its answer and hence always gives the
same answer.

FossilOrigin-Name: 5830c557f7ed048056e2faeb82a8705ee7ecfdd7
2015-01-01 14:06:24 +00:00
drh af700b3971 Fix to releasetest.tcl: When doing the secondary _debug runs, convert
"fulltest" to just "test".

FossilOrigin-Name: ec264bdee5ab8047fda9a36af27c8a2c8d964112
2014-12-31 20:35:11 +00:00
drh 0265eb666b Adjust the memsubsys1-5.5 test case to avoid occasional false positives.
FossilOrigin-Name: 432413187f41061a08ecff2697ce85c935fa6fa8
2014-12-31 20:25:33 +00:00
drh 9854248609 Fix a floating-point round-off error problem in the percentile.test module.
FossilOrigin-Name: 456948ea64c6980dab79dac30a538b5a6ab8773d
2014-12-31 20:19:20 +00:00
drh 2e5021d5ea Disable the bigsort.test module on machine with less than 8GB of available
RAM or machine, to avoid thrashing.

FossilOrigin-Name: 9d4fe11641043af4e663085e979f637676599da0
2014-12-31 19:58:32 +00:00
drh bcbac6843e Change threadtest3.c so that SQLITE_SCHEMA returns result in warnings
not hard errors.  Add the Darwin-x86_64 platform to releasetest.tcl.

FossilOrigin-Name: b09a139c9e2e1a45a3d53395ac1376e952d459e5
2014-12-31 18:55:09 +00:00
drh 169c464403 Update the command-line parsing for threadtest3 so that tests are run in the
order they are specified on the command-line.

FossilOrigin-Name: f489bc31165f043dc10570e6c1250a292673660e
2014-12-31 18:28:59 +00:00
dan b8a9d8db87 Add a missing sqlite3_close() call to threadtest3.c.
FossilOrigin-Name: a65a44f3ff851b71c9a79e96b9575c6a7006d2dd
2014-12-31 18:25:21 +00:00
drh fb212d02c5 Only run walthread5 once when running all tests in threadtest3.
FossilOrigin-Name: ca2e4a5b22e1dc9ea79f77853e328d401138f747
2014-12-31 18:10:07 +00:00
dan 23f8a7cd2f Do run pragma3.test as part of the mmap permutation. As it works as of [cf48eb608a].
FossilOrigin-Name: 11057e2645d92876fd0fb6d702757408077b7354
2014-12-31 18:08:46 +00:00
drh c67d650264 Change the width of output lines in releasetest.tcl from 70 to 79 characters.
FossilOrigin-Name: a468d96700c05d1a01a745930d13ce89c09ce4fa
2014-12-31 15:14:29 +00:00
drh 542d55865c Make sure PRAGMA data_version is updated even if the cache is empty when
another connection changes the database.

FossilOrigin-Name: cf48eb608af9102a8def2a5b7f5f7b348548116f
2014-12-31 14:18:48 +00:00
dan e895b87389 Do not run pragma3.test as part of the mmap permutation.
FossilOrigin-Name: 94101011966243d599519a69c99c202ea31b928d
2014-12-31 09:52:15 +00:00
drh bd41d56629 Add the "mptester" tests to releasetest.tcl.
FossilOrigin-Name: 93094a68d3a6178779878cbbe0e5e09ef31a323f
2014-12-30 20:40:32 +00:00
dan 592bf7faf5 Ensure that when a file is extended using FCNTL_SIZE_HINT the last page is allocated on disk, even if the file will only use part of it.
FossilOrigin-Name: c7f84717d61197afa9e0ac607c4b349361e6e2b7
2014-12-30 19:58:31 +00:00
drh 9486c1b020 Update the threadtest3 test program so that its output summary is
compatible with releasetest.tcl.  In threadtest3, do not record errors
that contain the string "no such table" as being fatal errors, since they
happen sometimes in a race condition in stress1.

FossilOrigin-Name: 98cb56e2401ae7e113b071df8997ba62265821d3
2014-12-30 19:26:07 +00:00
dan 55e115f060 Fix problems with the "inmemory_journal" permutation.
FossilOrigin-Name: 79693f0412ffb0486b974ee6c63b4231cfff5a77
2014-12-30 18:07:34 +00:00
dan d348c66e29 If the sorter uses mmap'd temp files, ensure all pages of the temp file have been allocated before it is accessed. Otherwise, a disk-full condition might result in a SIGBUS exception.
FossilOrigin-Name: 776648412c30dce206f1024ff849c2cb025bb006
2014-12-30 14:40:53 +00:00
drh 51dc84eb70 Make SQLITE_CONFIG_PCACHE_HDRSZ accurate (not an over-estimate) on 32-bit
systems.

FossilOrigin-Name: 340b347758e570db3e739b56af0dcf3fc34525be
2014-12-30 13:04:25 +00:00
dan 8ab4b9e964 Change notify2.test to check that sqlite3_blocking_step() uses CPU more efficiently than sqlite3_step(), not that it results in greater overall throughput for any specific number of threads.
FossilOrigin-Name: d904d29354a5ed85d33bafe4a7143f3c5ecee790
2014-12-30 12:03:35 +00:00
drh 37c057b8ff Round all object sizes that go into computing SQLITE_CONFIG_PCACHE_HDRSZ up
to a multiple of 8 bytes.

FossilOrigin-Name: b28ce75f2d3a6343dc20d581dc55afae89ab5efa
2014-12-30 00:57:29 +00:00
drh cb281a9a2c Fix the --dryrun option in releasetest.tcl.
FossilOrigin-Name: 0f9e549643ab94b0465e6891384dd20506708a8f
2014-12-29 19:54:10 +00:00
dan 620315840c Fix some recently added tests so that they work with SQLITE_DEFAULT_AUTOVACUUM=1.
FossilOrigin-Name: ef0626ab20f753f01090ca8e8a94e8b516eea55e
2014-12-29 12:02:31 +00:00
drh 622a53d54a Reinstate an assert() by adding an "|| CORRUPT_DB" term.
FossilOrigin-Name: 95ce20348d9b868a0407adccdb222a0e4c762945
2014-12-29 11:50:39 +00:00
drh 277b4e446c Fix the "checksymbols" target in Makefile.in so that it actually works.
Enhance the releasetest.tcl script to count the total number of tests
run over all configurations.

FossilOrigin-Name: 4eda1c746043acbdb7ef3e1f95bf8b01ee976479
2014-12-29 02:55:58 +00:00
drh e385d8876e Fix WITHOUT ROWID tables so that they correctly deal with PRIMARY KEYs that
contain redundant columns.

FossilOrigin-Name: 0dfef6757056ef0bdea8f049f7469ccf6960e2cb
2014-12-28 22:10:51 +00:00
drh 0ab0e05c6b Update the SQLITE_CONFIG_PAGECACHE documentation so that the maximum page
size is correctly stated to be 65536.

FossilOrigin-Name: 3286424b4d30035de69b88ef0b2897365ff848f9
2014-12-25 12:19:56 +00:00
drh 97876ee666 Fix the error counter in releasetest.tcl. And report the total time in
HH:MM:SS instead of just seconds.

FossilOrigin-Name: 6396f8046242286298fecd1748a6e8e786e6794e
2014-12-24 23:35:36 +00:00
dan ee7172f12a Fix a failing assert() in balance_nonroot().
FossilOrigin-Name: e2e323145f66cca31babe1a979db6ef97038b879
2014-12-24 18:11:50 +00:00
dan 8038953c15 When building the amalgamation with SQLITE_ENABLE_IOTRACE defined, do not mark symbol sqlite3IoTrace as static.
FossilOrigin-Name: 5b7ca013b7171a6807b15b128e140ce160f526d3
2014-12-24 17:17:30 +00:00
drh a7c432c273 Merge the new and improved releasetest.tcl script into trunk. Add a
"make releasetest" target to the autoconf makefile.

FossilOrigin-Name: 1deb00ec758c6d213da71ef64294cc816e204338
2014-12-23 21:17:58 +00:00
mistachkin 29f98f3077 Remove 'threadtest' as a target on Windows, due to lack of pthreads. Also, change 'fulltest' to 'fulltestonly'.
FossilOrigin-Name: a010c404b5140104b68087dcbb0698b7a85eef65
2014-12-23 21:10:38 +00:00
mistachkin 4d03a381f8 Fix typo in library object file name.
FossilOrigin-Name: f49566a79d05e630a86ea7b2acc04672d76d6337
2014-12-23 21:03:09 +00:00
mistachkin 054450f0bd Permit sqlite3_shutdown() to be called with OMIT_WSD enabled and without having called sqlite3_initialize() first.
FossilOrigin-Name: 3f7dbdb5df38bd4b8cd49d22a23b8412b8d506e5
2014-12-23 20:42:48 +00:00
drh e43ff920ce In the releasetest.tcl script, show the test target for each configuration
that is run.  And show the time in HH:MM:SS.

FossilOrigin-Name: 2295e9e0a22220ccb1b9cc2b031c1d8e702a1888
2014-12-23 20:41:13 +00:00
drh 069b8f2cb3 Add the threadtest target to Makefile.in. Add --enable-load-extension to
the configure issued by releasetest.tcl.

FossilOrigin-Name: cb128067faabf0503dff1298ed29934f484f71bb
2014-12-23 20:31:43 +00:00
mistachkin 7284056ad6 Draft of changes necessary to make releasetest work on Windows via MinGW.
FossilOrigin-Name: af166c5c64216d845269410d1ac2493310694b86
2014-12-23 20:22:57 +00:00
drh e5d7bf1e4c Fix a potential segfault following OOM error in the test harness. The
SQLite core itself is not at fault.

FossilOrigin-Name: 1bb26695ff28a96d740752e327c2e0a0da1d067e
2014-12-23 20:05:19 +00:00
drh 00fa334a0b Add the "checksymbols" target to Makefile.in
FossilOrigin-Name: 5bd73dba5e278db81f7d728c75e3142c02d37ff7
2014-12-23 19:52:26 +00:00
drh d477eee312 Rework the test/releasetest.tcl script so that it uses the autoconf makefile
instead of the test/releasetest.mk makefile.  Also add options like --dryrun
and --buildonly.  Omit the --makefile option and replace it with --srcdir
with the default computed relative to the releasetest.tcl script itself.

FossilOrigin-Name: 7c85e831153f9aef2afaf981d53db38a28091be5
2014-12-23 19:40:51 +00:00
drh 4a86d00162 Fix a typo in an evidence mark on a test script. No changes to code.
FossilOrigin-Name: a08b0c7512287ce5ae3fffe02c092d0eb25b3a25
2014-12-22 22:02:20 +00:00
drh 3da9c04712 Redefine the way PRAGMA data_version works: It continues to change when
any other connection commits, including shared-cache connections, but does not
change if the local connection commits.

FossilOrigin-Name: 7a97826f33460f3b4f3890c9cf97116c3355eeda
2014-12-22 18:41:21 +00:00
drh dd31b4e709 Fixes to the README.md file. No changes to code.
FossilOrigin-Name: ef4b734d1ff3dbb9c802c60dc1384033fdfd87e5
2014-12-21 11:56:02 +00:00
mistachkin d9d812fc38 Support manually disabling overlapped file I/O for Windows sub-platforms other than Windows CE.
FossilOrigin-Name: b9330b887cc8bed2b6b3e6c1b269788e08ccf50d
2014-12-20 22:21:49 +00:00
mistachkin cd54bab6fe Minor fixes and enhancements to the SQLITE_ENABLE_API_ARMOR functionality.
FossilOrigin-Name: cb3e4219ac9560d2773b85453aafda54b7c9346f
2014-12-20 21:14:14 +00:00
drh 59871fe748 Add the "PRAGMA data_version" command for checking to see if a database has
been modified.

FossilOrigin-Name: de50f25ce3226fa4929b8236c72c88b739859d5f
2014-12-20 14:50:28 +00:00
drh d7107b3852 Update the PRAGMA data_version command so that it reponse to changes made
by a shared-cache database connection, and also to changes made by the same
database connection.  Add test cases to verify the new behavior.

FossilOrigin-Name: 44ee538374940c50198949f2cbb9213ba2375b6a
2014-12-20 14:34:02 +00:00
mistachkin 129a752bad Merge updates from trunk.
FossilOrigin-Name: 555fb71f6c479936446c2ce75b1b120a9a121f49
2014-12-19 22:20:27 +00:00
drh 0d339e44a0 Adding test cases for the "PRAGMA data_version" command.
FossilOrigin-Name: c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5
2014-12-19 20:27:02 +00:00
drh 9161856495 Experimental "PRAGMA data_version" command for detecting when another process
has changed the database file.

FossilOrigin-Name: 43db1f44bce5a0ee50197b95ab0d844540b69d86
2014-12-19 19:28:02 +00:00
drh 8e755e7e19 Simplify the implementation of the "header-value" pragmas (schema_version,
user_version, freelist_count, and application_id) by making them more
table-driven.

FossilOrigin-Name: da27a09d1d991583b59997f6cc67efa28ffd9d6a
2014-12-19 18:49:55 +00:00
dan 1ac5fed3a7 Experimental opimizations to speed up FK constraint CASCADE and SET NULL action processing.
FossilOrigin-Name: 8c5dd6cc259e0cdaaddaa52ccfa96fee6b166906
2014-12-17 15:03:50 +00:00
drh e8d1777a2d Fix the e_walauto.test script so that it works on windows.
FossilOrigin-Name: 7d092ebb6724c3c0fdc05dc94ca767d158933fb5
2014-12-16 12:46:38 +00:00
mistachkin dd11f2d930 Update a comment.
FossilOrigin-Name: e0e102a0bd9d07bccdb1feb95767cb81fb57c29f
2014-12-11 04:49:46 +00:00
mistachkin 44b99f7e2e Rename a structure member to improve code clarity.
FossilOrigin-Name: d48eda16ef8a84a93de9c6f38f794aceb4a6ba0d
2014-12-11 03:29:14 +00:00
mistachkin 44ca920625 Remove an unused structure member.
FossilOrigin-Name: d8404340cb01af440feebd19d291eb7198cfa576
2014-12-11 03:25:05 +00:00
mistachkin f1f84a6ec1 Further simplify shell mode changes.
FossilOrigin-Name: cf9c6e7eea4cab073e608e6fefdd24be87a8abeb
2014-12-11 03:20:58 +00:00
mistachkin e0d6885f17 Simplify and cleanup the implementation of the new ASCII mode for the shell.
FossilOrigin-Name: 66a28f7abaeaf1ebe6e43d856af88ac64b1ff230
2014-12-11 03:12:33 +00:00
mistachkin 31868243e2 Merge updates from trunk.
FossilOrigin-Name: 5b5d3e4d0d158594c0db05ddbf4d926b65825042
2014-12-11 02:28:42 +00:00
mistachkin 18c8b58033 Merge updates from trunk.
FossilOrigin-Name: 51f33cf1290cf767c1c6ba0228f4f30e4059c994
2014-09-01 01:15:22 +00:00
mistachkin 22c9638efd Correct help text and make consistent use of snprintf.
FossilOrigin-Name: 9c424a5c50e4a2ed36556e99fba0e7072a2d3468
2014-07-24 22:51:18 +00:00
mistachkin 815ab5ac49 Update a shell test case.
FossilOrigin-Name: b84008cb964f234b6a6b441f738e344158c4c92a
2014-07-24 22:33:47 +00:00
mistachkin 486fd43fd8 Fix typo in comment and update help text.
FossilOrigin-Name: 289092bb64463efe78a5f01b06b24aa664a31feb
2014-07-24 22:20:23 +00:00
mistachkin fad4208f2f Merge updates from trunk.
FossilOrigin-Name: 8dc0cdf652f099d464d3de416dffd83efb895009
2014-07-24 22:13:12 +00:00
mistachkin 636bf9f768 Add new ASCII mode to the shell capable of importing and exporting using the official unit and record separators (i.e. 0x1F and 0x1E, respectively).
FossilOrigin-Name: 7fe601ead0d0ae26cb09d0dbc7d6367785376567
2014-07-19 20:15:16 +00:00
106 changed files with 3131 additions and 1510 deletions
+68 -6
View File
@@ -15,18 +15,22 @@
# The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure.in" script.
#
TOP = @srcdir@
TOP = @abs_srcdir@
# C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
BCC = @BUILD_CC@ @BUILD_CFLAGS@
# C Compile and options for use in building executables that
# TCC is the C Compile and options for use in building executables that
# will run on the target platform. (BCC and TCC are usually the
# same unless your are cross-compiling.)
# same unless your are cross-compiling.) Separate CC and CFLAGS macros
# are provide so that these aspects of the build process can be changed
# on the "make" command-line. Ex: "make CC=clang CFLAGS=-fsanitize=undefined"
#
TCC = @CC@ @CPPFLAGS@ @CFLAGS@ -I. -I${TOP}/src -I${TOP}/ext/rtree
CC = @CC@
CFLAGS = @CPPFLAGS@ @CFLAGS@
TCC = $(CC) $(CFLAGS) -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/fts3
# Define this for the autoconf-based build, so that the code knows it can
# include the generated config.h
@@ -37,7 +41,7 @@ TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
# Omitting the define will cause extra debugging code to be inserted and
# includes extra comments when "EXPLAIN stmt" is used.
#
TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
TCC += @TARGET_DEBUG@
# Compiler options needed for programs that use the TCL library.
#
@@ -230,6 +234,7 @@ SRC = \
$(TOP)/src/mem3.c \
$(TOP)/src/mem5.c \
$(TOP)/src/memjournal.c \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.c \
$(TOP)/src/mutex.h \
$(TOP)/src/mutex_noop.c \
@@ -459,6 +464,7 @@ HDR = \
$(TOP)/src/hash.h \
$(TOP)/src/hwtime.h \
keywordhash.h \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.h \
opcodes.h \
$(TOP)/src/os.h \
@@ -530,6 +536,11 @@ mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
$(TLIBS) -rpath "$(libdir)"
mptest: mptester$(EXE)
rm -f mptest1.db
./mptester$(EXE) mptest1.db $(TOP)/mptest/crash01.test
rm -f mptest2.db
./mptester$(EXE) mptest2.db $(TOP)/mptest/multiwrite01.test
# This target creates a directory named "tsrc" and fills it with
# copies of all of the C source code and header files needed to
@@ -921,19 +932,37 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC)
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \
-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
# A very detailed test running most or all test cases
fulltest: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/all.test
# Really really long testing
soaktest: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/all.test -soak=1
# Do extra testing but not aeverything.
fulltestonly: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/full.test
# This is the common case. Run many tests but not those that take
# a really long time.
#
test: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/veryquick.test
# Run a test using valgrind. This can take a really long time
# because valgrind is so much slower than a native machine.
#
valgrindtest: testfixture$(TEXE) sqlite3$(TEXE)
OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind
# A very fast test that checks basic sanity. The name comes from
# the 60s-era electronics testing: "Turn it on and see if smoke
# comes out."
#
smoketest: testfixture$(TEXE)
./testfixture$(TEXE) $(TOP)/test/main.test
sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
echo "#define TCLSH 2" > $@
cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
@@ -969,6 +998,39 @@ wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.c
speedtest1$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo
$(LTLINK) -o $@ $(TOP)/test/speedtest1.c sqlite3.lo $(TLIBS)
# This target will fail if the SQLite amalgamation contains any exported
# symbols that do not begin with "sqlite3_". It is run as part of the
# releasetest.tcl script.
#
checksymbols: sqlite3.lo
nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
echo '0 errors out of 1 tests'
# Build the amalgamation-autoconf package.
#
amalgamation-tarball: sqlite3.c
TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh
# The next two rules are used to support the "threadtest" target. Building
# threadtest runs a few thread-safety tests that are implemented in C. This
# target is invoked by the releasetest.tcl script.
#
THREADTEST3_SRC = $(TOP)/test/threadtest3.c \
$(TOP)/test/tt3_checkpoint.c \
$(TOP)/test/tt3_index.c \
$(TOP)/test/tt3_vacuum.c \
$(TOP)/test/tt3_stress.c \
$(TOP)/test/tt3_lookaside1.c
threadtest3$(TEXE): sqlite3.lo $(THREADTEST3_SRC)
$(LTLINK) $(TOP)/test/threadtest3.c sqlite3.lo -o $@ $(TLIBS)
threadtest: threadtest3$(TEXE)
./threadtest3$(TEXE)
releasetest:
$(TCLSH_CMD) $(TOP)/test/releasetest.tcl
# Standard install and cleanup targets
#
lib_install: libsqlite3.la
+334 -183
View File
@@ -16,6 +16,37 @@ TOP = .
USE_AMALGAMATION = 1
!ENDIF
# Set this non-0 to enable full warnings (-W4, etc) when compiling.
#
!IFNDEF USE_FULLWARN
USE_FULLWARN = 0
!ENDIF
# Set this non-0 to use "stdcall" calling convention for the core library
# and shell executable.
#
!IFNDEF USE_STDCALL
USE_STDCALL = 0
!ENDIF
# Set this non-0 to have the shell executable link against the core dynamic
# link library.
#
!IFNDEF DYNAMIC_SHELL
DYNAMIC_SHELL = 0
!ENDIF
# If necessary, create a list of harmless compiler warnings to disable when
# compiling the various tools. For the SQLite source code itself, warnings,
# if any, will be disabled from within it.
#
!IFNDEF NO_WARN
!IF $(USE_FULLWARN)!=0
NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210
NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
!ENDIF
!ENDIF
# Set this non-0 to use the library paths and other options necessary for
# Windows Phone 8.1.
#
@@ -108,11 +139,12 @@ WIN32HEAP = 0
# levels. Currently, the recognized values for DEBUG are:
#
# 0 == NDEBUG: Disables assert() and other runtime diagnostics.
# 1 == Disables NDEBUG and all optimizations and then enables PDBs.
# 2 == SQLITE_DEBUG: Enables various diagnostics messages and code.
# 3 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
# 4 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
# 5 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
# 1 == SQLITE_ENABLE_API_ARMOR: extra attempts to detect misuse of the API.
# 2 == Disables NDEBUG and all optimizations and then enables PDBs.
# 3 == SQLITE_DEBUG: Enables various diagnostics messages and code.
# 4 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
# 5 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
# 6 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
#
!IFNDEF DEBUG
DEBUG = 0
@@ -231,7 +263,11 @@ NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
# C compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
BCC = $(NCC) -W3
!IF $(USE_FULLWARN)!=0
BCC = $(NCC) -nologo -W4
!ELSE
BCC = $(NCC) -nologo -W3
!ENDIF
# Check if assembly code listings should be generated for the source
# code files to be compiled.
@@ -252,9 +288,107 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
# will run on the target platform. (BCC and TCC are usually the
# same unless your are cross-compiling.)
#
TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
!IF $(USE_FULLWARN)!=0
TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1
!ELSE
TCC = $(CC) -nologo -W3
!ENDIF
TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
# Check if we want to use the "stdcall" calling convention when compiling.
# This is not supported by the compilers for non-x86 platforms. It should
# also be noted here that building any target with these "stdcall" options
# will most likely fail if the Tcl library is also required. This is due
# to how the Tcl library functions are declared and exported (i.e. without
# an explicit calling convention, which results in "cdecl").
#
!IF $(USE_STDCALL)!=0
!IF "$(PLATFORM)"=="x86"
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_STDCALL=__stdcall
SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
!ENDIF
!ENDIF
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
!ENDIF
# These are additional compiler options used for the core library.
#
!IFNDEF CORE_COMPILE_OPTS
!IF $(USE_STDCALL)!=0
CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
!ELSE
CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
!ENDIF
!ENDIF
# These are the additional targets that the core library should depend on
# when linking.
#
!IFNDEF CORE_LINK_DEP
!IF $(USE_STDCALL)!=0
CORE_LINK_DEP =
!ELSE
CORE_LINK_DEP = sqlite3.def
!ENDIF
!ENDIF
# These are additional linker options used for the core library.
#
!IFNDEF CORE_LINK_OPTS
!IF $(USE_STDCALL)!=0
CORE_LINK_OPTS =
!ELSE
CORE_LINK_OPTS = /DEF:sqlite3.def
!ENDIF
!ENDIF
# These are additional compiler options used for the shell executable.
#
!IFNDEF SHELL_COMPILE_OPTS
!IF $(DYNAMIC_SHELL)!=0
SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
!ELSE
SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
!ENDIF
!ENDIF
# This is the core library that the shell executable should depend on.
#
!IFNDEF SHELL_CORE_DEP
!IF $(DYNAMIC_SHELL)!=0
SHELL_CORE_DEP = sqlite3.dll
!ELSE
SHELL_CORE_DEP = libsqlite3.lib
!ENDIF
!ENDIF
# This is the core library that the shell executable should link with.
#
!IFNDEF SHELL_CORE_LIB
!IF $(DYNAMIC_SHELL)!=0
SHELL_CORE_LIB = sqlite3.lib
!ELSE
SHELL_CORE_LIB = libsqlite3.lib
!ENDIF
!ENDIF
# These are additional linker options used for the shell executable.
#
!IFNDEF SHELL_LINK_OPTS
SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
!ENDIF
# Check if assembly code listings should be generated for the source
# code files to be compiled.
#
@@ -280,7 +414,7 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
# MSVC runtime library.
#
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
!IF $(DEBUG)>0
!IF $(DEBUG)>1
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
!ELSE
@@ -288,7 +422,7 @@ TCC = $(TCC) -MD
BCC = $(BCC) -MD
!ENDIF
!ELSE
!IF $(DEBUG)>0
!IF $(DEBUG)>1
TCC = $(TCC) -MTd
BCC = $(BCC) -MTd
!ELSE
@@ -313,7 +447,7 @@ RCC = $(RCC) -I$(TOP)\ext\rtree
# options are necessary in order to allow debugging symbols to
# work correctly with Visual Studio when using the amalgamation.
#
!IF $(DEBUG)>0
!IF $(DEBUG)>1
MKSQLITE3C_ARGS = --linemacros
!ELSE
MKSQLITE3C_ARGS =
@@ -329,17 +463,22 @@ BCC = $(BCC) -DNDEBUG
RCC = $(RCC) -DNDEBUG
!ENDIF
!IF $(DEBUG)>1
!IF $(DEBUG)>0
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR
!ENDIF
!IF $(DEBUG)>2
TCC = $(TCC) -DSQLITE_DEBUG
RCC = $(RCC) -DSQLITE_DEBUG
!ENDIF
!IF $(DEBUG)>3
!IF $(DEBUG)>4
TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1
RCC = $(RCC) -DSQLITE_DEBUG_OS_TRACE=1
!ENDIF
!IF $(DEBUG)>4
!IF $(DEBUG)>5
TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE
RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE
!ENDIF
@@ -371,7 +510,7 @@ RCC = $(RCC) -DSQLITE_WIN32_MALLOC=1
# Validate the heap on every call into the native Win32 heap subsystem?
#
!IF $(DEBUG)>2
!IF $(DEBUG)>3
TCC = $(TCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
RCC = $(RCC) -DSQLITE_WIN32_MALLOC_VALIDATE=1
!ENDIF
@@ -482,7 +621,7 @@ RCC = $(RCC) $(OPTS)
# If compiling for debugging, add some defines.
#
!IF $(DEBUG)>0
!IF $(DEBUG)>1
TCC = $(TCC) -D_DEBUG
BCC = $(BCC) -D_DEBUG
RCC = $(RCC) -D_DEBUG
@@ -491,7 +630,7 @@ RCC = $(RCC) -D_DEBUG
# If optimizations are enabled or disabled (either implicitly or
# explicitly), add the necessary flags.
#
!IF $(DEBUG)>0 || $(OPTIMIZATIONS)==0
!IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
TCC = $(TCC) -Od
BCC = $(BCC) -Od
!ELSEIF $(OPTIMIZATIONS)>=3
@@ -507,7 +646,7 @@ BCC = $(BCC) -O1
# If symbols are enabled (or compiling for debugging), enable PDBs.
#
!IF $(DEBUG)>0 || $(SYMBOLS)!=0
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
TCC = $(TCC) -Zi
BCC = $(BCC) -Zi
!ENDIF
@@ -536,8 +675,11 @@ LTLINK = $(TCC) -Fe$@
# set this for you. Otherwise, the linker will attempt
# to deduce the binary type based on the object files.
!IFDEF PLATFORM
LTLINKOPTS = /MACHINE:$(PLATFORM)
LTLIBOPTS = /MACHINE:$(PLATFORM)
LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
!ELSE
LTLINKOPTS = /NOLOGO
LTLIBOPTS = /NOLOGO
!ENDIF
# When compiling for use in the WinRT environment, the following
@@ -592,7 +734,7 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
# If either debugging or symbols are enabled, enable PDBs.
#
!IF $(DEBUG)>0 || $(SYMBOLS)!=0
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
LDFLAGS = /DEBUG
!ENDIF
@@ -663,7 +805,7 @@ LIBRESOBJS =
# All of the source code files.
#
SRC = \
SRC1 = \
$(TOP)\src\alter.c \
$(TOP)\src\analyze.c \
$(TOP)\src\attach.c \
@@ -700,6 +842,7 @@ SRC = \
$(TOP)\src\mem3.c \
$(TOP)\src\mem5.c \
$(TOP)\src\memjournal.c \
$(TOP)\src\msvc.h \
$(TOP)\src\mutex.c \
$(TOP)\src\mutex.h \
$(TOP)\src\mutex_noop.c \
@@ -712,7 +855,8 @@ SRC = \
$(TOP)\src\os_setup.h \
$(TOP)\src\os_unix.c \
$(TOP)\src\os_win.c \
$(TOP)\src\os_win.h \
$(TOP)\src\os_win.h
SRC2 = \
$(TOP)\src\pager.c \
$(TOP)\src\pager.h \
$(TOP)\src\parse.y \
@@ -759,15 +903,14 @@ SRC = \
# Source code for extensions
#
SRC = $(SRC) \
SRC3 = \
$(TOP)\ext\fts1\fts1.c \
$(TOP)\ext\fts1\fts1.h \
$(TOP)\ext\fts1\fts1_hash.c \
$(TOP)\ext\fts1\fts1_hash.h \
$(TOP)\ext\fts1\fts1_porter.c \
$(TOP)\ext\fts1\fts1_tokenizer.h \
$(TOP)\ext\fts1\fts1_tokenizer1.c
SRC = $(SRC) \
$(TOP)\ext\fts1\fts1_tokenizer1.c \
$(TOP)\ext\fts2\fts2.c \
$(TOP)\ext\fts2\fts2.h \
$(TOP)\ext\fts2\fts2_hash.c \
@@ -777,7 +920,7 @@ SRC = $(SRC) \
$(TOP)\ext\fts2\fts2_tokenizer.h \
$(TOP)\ext\fts2\fts2_tokenizer.c \
$(TOP)\ext\fts2\fts2_tokenizer1.c
SRC = $(SRC) \
SRC4 = \
$(TOP)\ext\fts3\fts3.c \
$(TOP)\ext\fts3\fts3.h \
$(TOP)\ext\fts3\fts3Int.h \
@@ -794,18 +937,16 @@ SRC = $(SRC) \
$(TOP)\ext\fts3\fts3_tokenize_vtab.c \
$(TOP)\ext\fts3\fts3_unicode.c \
$(TOP)\ext\fts3\fts3_unicode2.c \
$(TOP)\ext\fts3\fts3_write.c
SRC = $(SRC) \
$(TOP)\ext\fts3\fts3_write.c \
$(TOP)\ext\icu\sqliteicu.h \
$(TOP)\ext\icu\icu.c
SRC = $(SRC) \
$(TOP)\ext\icu\icu.c \
$(TOP)\ext\rtree\rtree.h \
$(TOP)\ext\rtree\rtree.c
# Generated source code files
#
SRC = $(SRC) \
SRC5 = \
keywordhash.h \
opcodes.c \
opcodes.h \
@@ -813,6 +954,10 @@ SRC = $(SRC) \
parse.h \
sqlite3.h
# All source code files.
#
SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5)
# Source code to the test files.
#
TESTSRC = \
@@ -932,6 +1077,7 @@ HDR = \
$(TOP)\src\hash.h \
$(TOP)\src\hwtime.h \
keywordhash.h \
$(TOP)\src\msvc.h \
$(TOP)\src\mutex.h \
opcodes.h \
$(TOP)\src\os.h \
@@ -982,14 +1128,13 @@ libsqlite3.lib: $(LIBOBJ)
libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
$(LTLINK) $(READLINE_FLAGS) \
$(TOP)\src\shell.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
sqlite3.exe: $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c \
/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
$(LTLINK) $(TOP)\mptest\mptest.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
mptester.exe: $(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
$(LTLINK) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
# This target creates a directory named "tsrc" and fills it with
# copies of all of the C source code and header files needed to
@@ -998,10 +1143,14 @@ mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
# all that automatic generation.
#
.target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl
-rmdir /S/Q tsrc
-rmdir /Q/S tsrc 2>NUL
-mkdir tsrc
for %i in ($(SRC)) do copy /Y %i tsrc
del /Q tsrc\sqlite.h.in tsrc\parse.y
for %i in ($(SRC1)) do copy /Y %i tsrc
for %i in ($(SRC2)) do copy /Y %i tsrc
for %i in ($(SRC3)) do copy /Y %i tsrc
for %i in ($(SRC4)) do copy /Y %i tsrc
for %i in ($(SRC5)) do copy /Y %i tsrc
del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
move vdbe.new tsrc\vdbe.c
echo > .target_source
@@ -1026,7 +1175,7 @@ SQLITE3C = sqlite3.c
# Rule to build the amalgamation
#
sqlite3.lo: $(SQLITE3C)
$(LTCOMPILE) -c $(SQLITE3C)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
# Rules to build the LEMON compiler generator
#
@@ -1034,7 +1183,8 @@ lempar.c: $(TOP)\src\lempar.c
copy $(TOP)\src\lempar.c .
lemon.exe: $(TOP)\tool\lemon.c lempar.c
$(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
$(BCC) $(NO_WARN) -Daccess=_access \
-Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
# Rules to build individual *.lo files from generated *.c files. This
# applies to:
@@ -1043,10 +1193,10 @@ lemon.exe: $(TOP)\tool\lemon.c lempar.c
# opcodes.lo
#
parse.lo: parse.c $(HDR)
$(LTCOMPILE) -c parse.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c parse.c
opcodes.lo: opcodes.c
$(LTCOMPILE) -c opcodes.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
# Rule to build the Win32 resources object file.
#
@@ -1064,223 +1214,223 @@ $(LIBRESOBJS): $(TOP)\src\sqlite3.rc $(HDR)
# Rules to build individual *.lo files from files in the src directory.
#
alter.lo: $(TOP)\src\alter.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\alter.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\alter.c
analyze.lo: $(TOP)\src\analyze.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\analyze.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\analyze.c
attach.lo: $(TOP)\src\attach.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\attach.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\attach.c
auth.lo: $(TOP)\src\auth.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\auth.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\auth.c
backup.lo: $(TOP)\src\backup.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\backup.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\backup.c
bitvec.lo: $(TOP)\src\bitvec.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\bitvec.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\bitvec.c
btmutex.lo: $(TOP)\src\btmutex.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\btmutex.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btmutex.c
btree.lo: $(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
$(LTCOMPILE) -c $(TOP)\src\btree.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btree.c
build.lo: $(TOP)\src\build.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\build.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\build.c
callback.lo: $(TOP)\src\callback.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\callback.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
complete.lo: $(TOP)\src\complete.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\complete.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
ctime.lo: $(TOP)\src\ctime.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\ctime.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
date.lo: $(TOP)\src\date.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\date.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
delete.lo: $(TOP)\src\delete.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\delete.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\delete.c
expr.lo: $(TOP)\src\expr.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\expr.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\expr.c
fault.lo: $(TOP)\src\fault.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\fault.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fault.c
fkey.lo: $(TOP)\src\fkey.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\fkey.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fkey.c
func.lo: $(TOP)\src\func.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\func.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\func.c
global.lo: $(TOP)\src\global.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\global.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\global.c
hash.lo: $(TOP)\src\hash.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\hash.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c
insert.lo: $(TOP)\src\insert.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\insert.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
journal.lo: $(TOP)\src\journal.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\journal.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\journal.c
legacy.lo: $(TOP)\src\legacy.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\legacy.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
loadext.lo: $(TOP)\src\loadext.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\loadext.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c
main.lo: $(TOP)\src\main.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\main.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\main.c
malloc.lo: $(TOP)\src\malloc.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\malloc.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\malloc.c
mem0.lo: $(TOP)\src\mem0.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mem0.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem0.c
mem1.lo: $(TOP)\src\mem1.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mem1.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem1.c
mem2.lo: $(TOP)\src\mem2.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mem2.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem2.c
mem3.lo: $(TOP)\src\mem3.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mem3.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem3.c
mem5.lo: $(TOP)\src\mem5.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mem5.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem5.c
memjournal.lo: $(TOP)\src\memjournal.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\memjournal.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\memjournal.c
mutex.lo: $(TOP)\src\mutex.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mutex.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex.c
mutex_noop.lo: $(TOP)\src\mutex_noop.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mutex_noop.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_noop.c
mutex_unix.lo: $(TOP)\src\mutex_unix.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mutex_unix.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_unix.c
mutex_w32.lo: $(TOP)\src\mutex_w32.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\mutex_w32.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_w32.c
notify.lo: $(TOP)\src\notify.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\notify.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\notify.c
pager.lo: $(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
$(LTCOMPILE) -c $(TOP)\src\pager.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pager.c
pcache.lo: $(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
$(LTCOMPILE) -c $(TOP)\src\pcache.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache.c
pcache1.lo: $(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
$(LTCOMPILE) -c $(TOP)\src\pcache1.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache1.c
os.lo: $(TOP)\src\os.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\os.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os.c
os_unix.lo: $(TOP)\src\os_unix.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\os_unix.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_unix.c
os_win.lo: $(TOP)\src\os_win.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\os_win.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_win.c
pragma.lo: $(TOP)\src\pragma.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\pragma.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pragma.c
prepare.lo: $(TOP)\src\prepare.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\prepare.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\prepare.c
printf.lo: $(TOP)\src\printf.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\printf.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\printf.c
random.lo: $(TOP)\src\random.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\random.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\random.c
resolve.lo: $(TOP)\src\resolve.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\resolve.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\resolve.c
rowset.lo: $(TOP)\src\rowset.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\rowset.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\rowset.c
select.lo: $(TOP)\src\select.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\select.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\select.c
status.lo: $(TOP)\src\status.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\status.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\status.c
table.lo: $(TOP)\src\table.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\table.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\table.c
threads.lo: $(TOP)\src\threads.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\threads.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\threads.c
tokenize.lo: $(TOP)\src\tokenize.c keywordhash.h $(HDR)
$(LTCOMPILE) -c $(TOP)\src\tokenize.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\tokenize.c
trigger.lo: $(TOP)\src\trigger.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\trigger.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\trigger.c
update.lo: $(TOP)\src\update.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\update.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\update.c
utf.lo: $(TOP)\src\utf.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\utf.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\utf.c
util.lo: $(TOP)\src\util.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\util.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\util.c
vacuum.lo: $(TOP)\src\vacuum.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vacuum.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vacuum.c
vdbe.lo: $(TOP)\src\vdbe.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbe.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbe.c
vdbeapi.lo: $(TOP)\src\vdbeapi.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbeapi.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeapi.c
vdbeaux.lo: $(TOP)\src\vdbeaux.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbeaux.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeaux.c
vdbeblob.lo: $(TOP)\src\vdbeblob.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbeblob.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeblob.c
vdbemem.lo: $(TOP)\src\vdbemem.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbemem.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbemem.c
vdbesort.lo: $(TOP)\src\vdbesort.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbesort.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbesort.c
vdbetrace.lo: $(TOP)\src\vdbetrace.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vdbetrace.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
vtab.lo: $(TOP)\src\vtab.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\vtab.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
wal.lo: $(TOP)\src\wal.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\wal.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wal.c
walker.lo: $(TOP)\src\walker.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\walker.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\walker.c
where.lo: $(TOP)\src\where.c $(HDR)
$(LTCOMPILE) -c $(TOP)\src\where.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
$(LTCOMPILE) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR)
$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
tclsqlite3.exe: tclsqlite-shell.lo libsqlite3.lib $(LIBRESOBJS)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ libsqlite3.lib tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS)
$(LTLINK) $(SQLITE3C) /link $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
# Rules to build opcodes.c and opcodes.h
#
@@ -1295,7 +1445,7 @@ opcodes.h: parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
parse.h: parse.c
parse.c: $(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
del /Q parse.y parse.h parse.h.temp
del /Q parse.y parse.h parse.h.temp 2>NUL
copy $(TOP)\src\parse.y .
.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
move parse.h parse.h.temp
@@ -1305,7 +1455,8 @@ sqlite3.h: $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c
$(BCC) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
$(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) \
$(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
.\mkkeywordhash.exe > keywordhash.h
@@ -1315,67 +1466,67 @@ keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
# Rules to build the extension objects.
#
icu.lo: $(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
fts2.lo: $(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
fts2_hash.lo: $(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
fts2_icu.lo: $(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
fts2_porter.lo: $(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
fts2_tokenizer.lo: $(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
fts2_tokenizer1.lo: $(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
fts3.lo: $(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
fts3_aux.lo: $(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
fts3_expr.lo: $(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
fts3_hash.lo: $(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
fts3_icu.lo: $(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
fts3_snippet.lo: $(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
fts3_porter.lo: $(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
fts3_tokenizer.lo: $(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
fts3_tokenizer1.lo: $(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
fts3_tokenize_vtab.lo: $(TOP)\ext\fts3\fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
fts3_unicode.lo: $(TOP)\ext\fts3\fts3_unicode.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
fts3_unicode2.lo: $(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
fts3_write.lo: $(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
rtree.lo: $(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
# Rules to build the 'testfixture' application.
@@ -1386,9 +1537,10 @@ rtree.lo: $(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
# hidden when the library is built via the amalgamation).
#
TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib
TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP)
TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
!IF $(USE_AMALGAMATION)==0
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
@@ -1428,77 +1580,76 @@ sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(
echo ; return zMainloop; } >> $@
sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
$(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
$(LTLINK) $(NO_WARN) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
testloadext.lo: $(TOP)\src\test_loadext.c
$(LTCOMPILE) -c $(TOP)\src\test_loadext.c
$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
testloadext.dll: testloadext.lo
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\showdb.c $(SQLITE3C)
showstat4.exe: $(TOP)\tool\showstat4.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\showstat4.c $(SQLITE3C)
showjournal.exe: $(TOP)\tool\showjournal.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\showjournal.c $(SQLITE3C)
showwal.exe: $(TOP)\tool\showwal.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\showwal.c $(SQLITE3C)
fts3view.exe: $(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
rollback-test.exe: $(TOP)\tool\rollback-test.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\tool\rollback-test.c $(SQLITE3C)
LogEst.exe: $(TOP)\tool\logest.c sqlite3.h
$(LTLINK) -Fe$@ $(TOP)\tool\LogEst.c
$(LTLINK) $(NO_WARN) -Fe$@ $(TOP)\tool\LogEst.c
wordcount.exe: $(TOP)\test\wordcount.c $(SQLITE3C)
$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\test\wordcount.c $(SQLITE3C)
speedtest1.exe: $(TOP)\test\speedtest1.c $(SQLITE3C)
$(LTLINK) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
$(TOP)\test\speedtest1.c $(SQLITE3C)
clean:
del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib
del /Q *.cod *.da *.bb *.bbg gmon.out
del /Q sqlite3.h opcodes.c opcodes.h
del /Q lemon.* lempar.c parse.*
del /Q mkkeywordhash.* keywordhash.h
del /Q notasharedlib.*
-rmdir /Q/S .deps
-rmdir /Q/S .libs
-rmdir /Q/S quota2a
-rmdir /Q/S quota2b
-rmdir /Q/S quota2c
-rmdir /Q/S tsrc
del /Q .target_source
del /Q tclsqlite3.exe tclsqlite3.exp
del /Q testloadext.dll testloadext.exp
del /Q testfixture.exe testfixture.exp test.db
del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe
del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe
del /Q wordcount.exe
del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
del /Q sqlite3.c sqlite3-*.c
del /Q sqlite3rc.h
del /Q shell.c sqlite3ext.h
del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
del /Q sqlite-*-output.vsix
del /Q mptester.exe
del /Q *.exp *.lo *.ilk *.lib *.obj *.pdb 2>NUL
del /Q *.cod *.da *.bb *.bbg gmon.out 2>NUL
del /Q sqlite3.h opcodes.c opcodes.h 2>NUL
del /Q lemon.* lempar.c parse.* 2>NUL
del /Q mkkeywordhash.* keywordhash.h 2>NUL
del /Q notasharedlib.* 2>NUL
-rmdir /Q/S .deps 2>NUL
-rmdir /Q/S .libs 2>NUL
-rmdir /Q/S quota2a 2>NUL
-rmdir /Q/S quota2b 2>NUL
-rmdir /Q/S quota2c 2>NUL
-rmdir /Q/S tsrc 2>NUL
del /Q .target_source 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
del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
del /Q mptester.exe wordcount.exe 2>NUL
del /Q sqlite3.exe sqlite3.dll sqlite3.def 2>NUL
del /Q sqlite3.c sqlite3-*.c 2>NUL
del /Q sqlite3rc.h 2>NUL
del /Q shell.c sqlite3ext.h 2>NUL
del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
del /Q sqlite-*-output.vsix 2>NUL
# Dynamic link library section.
#
@@ -1510,5 +1661,5 @@ sqlite3.def: libsqlite3.lib
| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
| sort >> sqlite3.def
sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
+2
View File
@@ -253,6 +253,7 @@ SRC = \
$(TOP)/src/mem3.c \
$(TOP)/src/mem5.c \
$(TOP)/src/memjournal.c \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.c \
$(TOP)/src/mutex.h \
$(TOP)/src/mutex_noop.c \
@@ -414,6 +415,7 @@ HDR = \
$(TOP)/src/hash.h \
$(TOP)/src/hwtime.h \
keywordhash.h \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.h \
opcodes.h \
$(TOP)/src/os.h \
+12 -12
View File
@@ -53,10 +53,10 @@ to the "sqlite3.dll" command line above. When debugging into the SQLite
code, adding the "DEBUG=1" argument to one of the above command lines is
recommended.
SQLite does not require Tcl to run, but a Tcl installation is required
by the makefiles (including those for MSVC). SQLite contains a lot of
generated code and Tcl is used to do much of that code generation. The
makefiles also require AWK.
SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation
is required by the makefiles (including those for MSVC). SQLite contains
a lot of generated code and Tcl is used to do much of that code generation.
The makefiles also require AWK.
## Source Code Tour
@@ -95,14 +95,14 @@ manually-edited files and automatically-generated files.
The SQLite interface is defined by the **sqlite3.h** header file, which is
generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION. The
Tcl script at tool/mksqlite3h.tcl does the conversion. The manifest.uuid
file contains the SHA1 hash of the particular check-in and is used to generate
the SQLITE_SOURCE_ID macro. The VERSION file contains the current SQLite
version number. The sqlite3.h header is really just a copy of src/sqlite.h.in
with the source-id and version number inserted at just the right spots.
Note that comment text in the sqlite3.h file is used to generate much of
the SQLite API documentation. The Tcl scripts used to generate that
documentation are in a separate source repository.
[Tcl script](http://www.tcl.tk) at tool/mksqlite3h.tcl does the conversion.
The manifest.uuid file contains the SHA1 hash of the particular check-in
and is used to generate the SQLITE\_SOURCE\_ID macro. The VERSION file
contains the current SQLite version number. The sqlite3.h header is really
just a copy of src/sqlite.h.in with the source-id and version number inserted
at just the right spots. Note that comment text in the sqlite3.h file is
used to generate much of the SQLite API documentation. The Tcl scripts
used to generate that documentation are in a separate source repository.
The SQL language parser is **parse.c** which is generate from a grammar in
the src/parse.y file. The conversion of "parse.y" into "parse.c" is done
+1 -1
View File
@@ -1 +1 @@
3.8.8
3.8.8.3
+8 -54
View File
@@ -1,57 +1,11 @@
This directory contains components use to build an autoconf-ready package
of the SQLite amalgamation: sqlite-autoconf-30XXXXXX.tar.gz
This file describes how to use the files in this directory to create a new
version of the "autoconf-amalgamation" package.
1. The following files should have executable permission:
chmod 755 install-sh
chmod 755 missing
chmod 755 depcomp
chmod 755 config.sub
chmod 755 config.guess
2. Copy new versions of the following SQLite files into this directory:
sqlite3.c
sqlite3.h
sqlite3ext.h
sqlite3.1
sqlite3.pc.in
shell.c
3. Update the SQLite version number in the AC_INIT macro in file
configure.ac:
AC_INIT(sqlite, 3.6.3, http://www.sqlite.org)
4. Run the following commands to push the version number change through
to the generated files.
aclocal
autoconf
automake
5. Create the tclsqlite3.c file in the tea/generic directory. As follows:
mkdir -p tea/generic
echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c
echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c
echo "#else" >> tea/generic/tclsqlite3.c
echo "#include \"../../sqlite3.c\"" >> tea/generic/tclsqlite3.c
echo "#endif" >> tea/generic/tclsqlite3.c
cat ../src/tclsqlite.c >> tea/generic/tclsqlite3.c
6. Update the SQLite version in the AC_INIT macro in file tea/configure.in:
AC_INIT([sqlite], [3.6.3])
7. From the 'tea' directory, run the following commands:
autoconf
rm -rf autom4te.cache
8. Run "./configure && make dist". This builds a distribution package
named something like "sqlite-3.6.3.tar.gz". Rename to
"sqlite-amalgamation-3.6.3.tar.gz" and use.
To build the autoconf amalgamation, run from the top-level:
./configure
make amalgamation-tarball
The amalgamation-tarball target (also available in "main.mk") runs the
script tool/mkautoconfamal.sh which does the work. Refer to that script
for details.
+6
View File
@@ -27,6 +27,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `isnan' function. */
#undef HAVE_ISNAN
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
@@ -48,6 +51,9 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the strchrnul() function */
#undef HAVE_STRCHRNUL
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
Vendored
+30 -100
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for sqlite 3.8.8.
# Generated by GNU Autoconf 2.62 for sqlite 3.8.8.3.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.8.8'
PACKAGE_STRING='sqlite 3.8.8'
PACKAGE_VERSION='3.8.8.3'
PACKAGE_STRING='sqlite 3.8.8.3'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
@@ -868,7 +868,6 @@ RELEASE
VERSION_NUMBER
BUILD_CC
SQLITE_THREADSAFE
XTHREADCONNECT
ALLOWRELEASE
TEMP_STORE
BUILD_EXEEXT
@@ -906,9 +905,7 @@ enable_fast_install
with_gnu_ld
enable_libtool_lock
enable_largefile
with_hints
enable_threadsafe
enable_cross_thread_connections
enable_releasemode
enable_tempstore
enable_tcl
@@ -1483,7 +1480,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.8.8 to adapt to many kinds of systems.
\`configure' configures sqlite 3.8.8.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1548,7 +1545,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.8.8:";;
short | recursive ) echo "Configuration of sqlite 3.8.8.3:";;
esac
cat <<\_ACEOF
@@ -1562,9 +1559,7 @@ Optional Features:
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-largefile omit support for large files
--enable-threadsafe Support threadsafe operation
--enable-cross-thread-connections
Allow connection sharing across threads
--disable-threadsafe Disable mutexing
--enable-releasemode Support libtool link to release mode
--enable-tempstore Use an in-ram database for temporary tables
(never,no,yes,always)
@@ -1573,7 +1568,8 @@ Optional Features:
--enable-debug enable debugging & verbose explain
--disable-amalgamation Disable the amalgamation and instead build all files
separately
--enable-load-extension Enable loading of external extensions
--disable-load-extension
Disable loading of external extensions
--enable-gcov Enable coverage testing using gcov
Optional Packages:
@@ -1582,7 +1578,6 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-hints=FILE Read configuration options from FILE
--with-tcl=DIR directory containing tcl configuration
(tclConfig.sh)
--with-readline-lib specify readline library
@@ -1664,7 +1659,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.8.8
sqlite configure 3.8.8.3
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1678,7 +1673,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.8.8, which was
It was created by sqlite $as_me 3.8.8.3, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -2058,9 +2053,6 @@ please regen with autoconf" >&2;}
{ (exit 1); exit 1; }; }
fi
# The following RCS revision string applies to configure.in
# $Revision: 1.56 $
#########
# Programs needed
#
@@ -3732,13 +3724,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:3735: $ac_compile\"" >&5)
(eval echo "\"\$as_me:3727: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:3738: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:3730: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:3741: output\"" >&5)
(eval echo "\"\$as_me:3733: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -4960,7 +4952,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4963 "configure"' > conftest.$ac_ext
echo '#line 4955 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6829,11 +6821,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6832: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6824: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6836: \$? = $ac_status" >&5
echo "$as_me:6828: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7168,11 +7160,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7171: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7163: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7175: \$? = $ac_status" >&5
echo "$as_me:7167: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7273,11 +7265,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7276: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7268: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7280: \$? = $ac_status" >&5
echo "$as_me:7272: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -7328,11 +7320,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7331: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7323: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7335: \$? = $ac_status" >&5
echo "$as_me:7327: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10141,7 +10133,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10144 "configure"
#line 10136 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10237,7 +10229,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10240 "configure"
#line 10232 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12146,7 +12138,9 @@ done
for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size
for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -12342,45 +12336,6 @@ VERSION_NUMBER=`cat $srcdir/VERSION \
$as_echo "$as_me: Version number set to $VERSION_NUMBER" >&6;}
#########
# Check to see if the --with-hints=FILE option is used. If there is none,
# then check for a files named "$host.hints" and ../$hosts.hints where
# $host is the hostname of the build system. If still no hints are
# found, try looking in $system.hints and ../$system.hints where
# $system is the result of uname -s.
#
# Check whether --with-hints was given.
if test "${with_hints+set}" = set; then
withval=$with_hints; hints=$withval
fi
if test "$hints" = ""; then
host=`hostname | sed 's/\..*//'`
if test -r $host.hints; then
hints=$host.hints
else
if test -r ../$host.hints; then
hints=../$host.hints
fi
fi
fi
if test "$hints" = ""; then
sys=`uname -s`
if test -r $sys.hints; then
hints=$sys.hints
else
if test -r ../$sys.hints; then
hints=../$sys.hints
fi
fi
fi
if test "$hints" != ""; then
{ $as_echo "$as_me:$LINENO: result: reading hints from $hints" >&5
$as_echo "reading hints from $hints" >&6; }
. $hints
fi
#########
# Locate a compiler for the build machine. This compiler should
# generate command-line programs that run on the build machine.
@@ -12552,31 +12507,6 @@ fi
fi
##########
# Do we want to allow a connection created in one thread to be used
# in another thread. This does not work on many Linux systems (ex: RedHat 9)
# due to bugs in the threading implementations. This is thus off by default.
#
# Check whether --enable-cross-thread-connections was given.
if test "${enable_cross_thread_connections+set}" = set; then
enableval=$enable_cross_thread_connections;
else
enable_xthreadconnect=no
fi
{ $as_echo "$as_me:$LINENO: checking whether to allow connections to be shared across threads" >&5
$as_echo_n "checking whether to allow connections to be shared across threads... " >&6; }
if test "$enable_xthreadconnect" = "no"; then
XTHREADCONNECT=''
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
fi
##########
# Do we want to support release
#
@@ -13427,7 +13357,7 @@ fi
if test "${enable_load_extension+set}" = set; then
enableval=$enable_load_extension; use_loadextension=$enableval
else
use_loadextension=no
use_loadextension=yes
fi
if test "${use_loadextension}" = "yes" ; then
@@ -14021,7 +13951,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.8.8, which was
This file was extended by sqlite $as_me 3.8.8.3, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14074,7 +14004,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sqlite config.status 3.8.8
sqlite config.status 3.8.8.3
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+5 -75
View File
@@ -69,19 +69,6 @@
# The filename extension for executables on the
# target platform. "" for Unix and ".exe" for windows.
#
# The generated configure script will make an attempt to guess
# at all of the above parameters. You can override any of
# the guesses by setting the environment variable named
# "config_AAAA" where "AAAA" is the name of the parameter
# described above. (Exception: srcdir cannot be set this way.)
# If you have a file that sets one or more of these environment
# variables, you can invoke configure as follows:
#
# configure --with-hints=FILE
#
# where FILE is the name of the file that sets the environment
# variables. FILE should be an absolute pathname.
#
# This configure.in file is easy to reuse on other projects. Just
# change the argument to AC_INIT(). And disable any features that
# you don't need (for example BLT) by erasing or commenting out
@@ -98,11 +85,6 @@ AC_MSG_ERROR([configure script is out of date:
please regen with autoconf])
fi
dnl Put the RCS revision string after AC_INIT so that it will also
dnl show in in configure.
# The following RCS revision string applies to configure.in
# $Revision: 1.56 $
#########
# Programs needed
#
@@ -127,7 +109,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
#########
# Figure out whether or not we have these functions
#
AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size])
AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
#########
# By default, we use the amalgamation (this may be changed below...)
@@ -180,41 +162,6 @@ VERSION_NUMBER=[`cat $srcdir/VERSION \
AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
AC_SUBST(VERSION_NUMBER)
#########
# Check to see if the --with-hints=FILE option is used. If there is none,
# then check for a files named "$host.hints" and ../$hosts.hints where
# $host is the hostname of the build system. If still no hints are
# found, try looking in $system.hints and ../$system.hints where
# $system is the result of uname -s.
#
AC_ARG_WITH(hints,
AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
hints=$withval)
if test "$hints" = ""; then
host=`hostname | sed 's/\..*//'`
if test -r $host.hints; then
hints=$host.hints
else
if test -r ../$host.hints; then
hints=../$host.hints
fi
fi
fi
if test "$hints" = ""; then
sys=`uname -s`
if test -r $sys.hints; then
hints=$sys.hints
else
if test -r ../$sys.hints; then
hints=../$sys.hints
fi
fi
fi
if test "$hints" != ""; then
AC_MSG_RESULT(reading hints from $hints)
. $hints
fi
#########
# Locate a compiler for the build machine. This compiler should
# generate command-line programs that run on the build machine.
@@ -236,7 +183,7 @@ AC_SUBST(BUILD_CC)
# Do we want to support multithreaded use of sqlite
#
AC_ARG_ENABLE(threadsafe,
AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
AC_MSG_CHECKING([whether to support threadsafe operation])
if test "$enable_threadsafe" = "no"; then
SQLITE_THREADSAFE=0
@@ -251,23 +198,6 @@ if test "$SQLITE_THREADSAFE" = "1"; then
AC_SEARCH_LIBS(pthread_create, pthread)
fi
##########
# Do we want to allow a connection created in one thread to be used
# in another thread. This does not work on many Linux systems (ex: RedHat 9)
# due to bugs in the threading implementations. This is thus off by default.
#
AC_ARG_ENABLE(cross-thread-connections,
AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
AC_MSG_CHECKING([whether to allow connections to be shared across threads])
if test "$enable_xthreadconnect" = "no"; then
XTHREADCONNECT=''
AC_MSG_RESULT([no])
else
XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
AC_MSG_RESULT([yes])
fi
AC_SUBST(XTHREADCONNECT)
##########
# Do we want to support release
#
@@ -605,9 +535,9 @@ AC_SUBST(USE_AMALGAMATION)
#########
# See whether we should allow loadable extensions
AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
[Enable loading of external extensions]),
[use_loadextension=$enableval],[use_loadextension=no])
AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
[Disable loading of external extensions]),
[use_loadextension=$enableval],[use_loadextension=yes])
if test "${use_loadextension}" = "yes" ; then
OPT_FEATURE_FLAGS=""
AC_SEARCH_LIBS(dlopen, dl)
+57 -65
View File
@@ -1853,7 +1853,7 @@ static int fts3SelectLeaf(
sqlite3_int64 *piLeaf, /* Selected leaf node */
sqlite3_int64 *piLeaf2 /* Selected leaf node */
){
int rc; /* Return code */
int rc = SQLITE_OK; /* Return code */
int iHeight; /* Height of this node in tree */
assert( piLeaf || piLeaf2 );
@@ -1864,7 +1864,7 @@ static int fts3SelectLeaf(
if( rc==SQLITE_OK && iHeight>1 ){
char *zBlob = 0; /* Blob read from %_segments table */
int nBlob; /* Size of zBlob in bytes */
int nBlob = 0; /* Size of zBlob in bytes */
if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){
rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0);
@@ -3086,7 +3086,7 @@ static int fts3FilterMethod(
int nVal, /* Number of elements in apVal */
sqlite3_value **apVal /* Arguments for the indexing scheme */
){
int rc;
int rc = SQLITE_OK;
char *zSql; /* SQL statement used to access %_content */
int eSearch;
Fts3Table *p = (Fts3Table *)pCursor->pVtab;
@@ -5020,6 +5020,22 @@ static void fts3EvalNextRow(
}
pExpr->iDocid = pLeft->iDocid;
pExpr->bEof = (pLeft->bEof || pRight->bEof);
if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){
if( pRight->pPhrase && pRight->pPhrase->doclist.aAll ){
Fts3Doclist *pDl = &pRight->pPhrase->doclist;
while( *pRc==SQLITE_OK && pRight->bEof==0 ){
memset(pDl->pList, 0, pDl->nList);
fts3EvalNextRow(pCsr, pRight, pRc);
}
}
if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){
Fts3Doclist *pDl = &pLeft->pPhrase->doclist;
while( *pRc==SQLITE_OK && pLeft->bEof==0 ){
memset(pDl->pList, 0, pDl->nList);
fts3EvalNextRow(pCsr, pLeft, pRc);
}
}
}
}
break;
}
@@ -5392,6 +5408,7 @@ static void fts3EvalRestart(
}
pPhrase->doclist.pNextDocid = 0;
pPhrase->doclist.iDocid = 0;
pPhrase->pOrPoslist = 0;
}
pExpr->iDocid = 0;
@@ -5637,6 +5654,7 @@ int sqlite3Fts3EvalPhrasePoslist(
iDocid = pExpr->iDocid;
pIter = pPhrase->doclist.pList;
if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
int rc = SQLITE_OK;
int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
int iMul; /* +1 if csr dir matches index dir, else -1 */
int bOr = 0;
@@ -5662,72 +5680,43 @@ int sqlite3Fts3EvalPhrasePoslist(
** an incremental phrase. Load the entire doclist for the phrase
** into memory in this case. */
if( pPhrase->bIncr ){
int rc = SQLITE_OK;
int bEofSave = pExpr->bEof;
fts3EvalRestart(pCsr, pExpr, &rc);
while( rc==SQLITE_OK && !pExpr->bEof ){
fts3EvalNextRow(pCsr, pExpr, &rc);
if( bEofSave==0 && pExpr->iDocid==iDocid ) break;
int bEofSave = pNear->bEof;
fts3EvalRestart(pCsr, pNear, &rc);
while( rc==SQLITE_OK && !pNear->bEof ){
fts3EvalNextRow(pCsr, pNear, &rc);
if( bEofSave==0 && pNear->iDocid==iDocid ) break;
}
pIter = pPhrase->doclist.pList;
assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
if( rc!=SQLITE_OK ) return rc;
}
iMul = ((pCsr->bDesc==bDescDoclist) ? 1 : -1);
while( bTreeEof==1
&& pNear->bEof==0
&& (DOCID_CMP(pNear->iDocid, pCsr->iPrevId) * iMul)<0
){
int rc = SQLITE_OK;
fts3EvalNextRow(pCsr, pExpr, &rc);
if( rc!=SQLITE_OK ) return rc;
iDocid = pExpr->iDocid;
pIter = pPhrase->doclist.pList;
}
bEof = (pPhrase->doclist.nAll==0);
assert( bDescDoclist==0 || bDescDoclist==1 );
assert( pCsr->bDesc==0 || pCsr->bDesc==1 );
if( bEof==0 ){
if( pCsr->bDesc==bDescDoclist ){
int dummy;
if( pNear->bEof ){
/* This expression is already at EOF. So position it to point to the
** last entry in the doclist at pPhrase->doclist.aAll[]. Variable
** iDocid is already set for this entry, so all that is required is
** to set pIter to point to the first byte of the last position-list
** in the doclist.
**
** It would also be correct to set pIter and iDocid to zero. In
** this case, the first call to sqltie3Fts4DoclistPrev() below
** would also move the iterator to point to the last entry in the
** doclist. However, this is expensive, as to do so it has to
** iterate through the entire doclist from start to finish (since
** it does not know the docid for the last entry). */
pIter = &pPhrase->doclist.aAll[pPhrase->doclist.nAll-1];
fts3ReversePoslist(pPhrase->doclist.aAll, &pIter);
}
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
sqlite3Fts3DoclistPrev(
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
&pIter, &iDocid, &dummy, &bEof
);
}
}else{
if( pNear->bEof ){
pIter = 0;
iDocid = 0;
}
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
sqlite3Fts3DoclistNext(
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
&pIter, &iDocid, &bEof
);
}
if( bTreeEof ){
while( rc==SQLITE_OK && !pNear->bEof ){
fts3EvalNextRow(pCsr, pNear, &rc);
}
}
if( rc!=SQLITE_OK ) return rc;
pIter = pPhrase->pOrPoslist;
iDocid = pPhrase->iOrDocid;
if( pCsr->bDesc==bDescDoclist ){
bEof = (pIter >= (pPhrase->doclist.aAll + pPhrase->doclist.nAll));
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
sqlite3Fts3DoclistNext(
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
&pIter, &iDocid, &bEof
);
}
}else{
bEof = !pPhrase->doclist.nAll || (pIter && pIter<=pPhrase->doclist.aAll);
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
int dummy;
sqlite3Fts3DoclistPrev(
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
&pIter, &iDocid, &dummy, &bEof
);
}
}
pPhrase->pOrPoslist = pIter;
pPhrase->iOrDocid = iDocid;
if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0;
}
@@ -5741,10 +5730,13 @@ int sqlite3Fts3EvalPhrasePoslist(
}
while( iThis<iCol ){
fts3ColumnlistCopy(0, &pIter);
if( *pIter==0x00 ) return 0;
if( *pIter==0x00 ) return SQLITE_OK;
pIter++;
pIter += fts3GetVarint32(pIter, &iThis);
}
if( *pIter==0x00 ){
pIter = 0;
}
*ppOut = ((iCol==iThis)?pIter:0);
return SQLITE_OK;
+5
View File
@@ -375,6 +375,11 @@ struct Fts3Phrase {
int bIncr; /* True if doclist is loaded incrementally */
int iDoclistToken;
/* Used by sqlite3Fts3EvalPhrasePoslist() if this is a descendent of an
** OR condition. */
char *pOrPoslist;
i64 iOrDocid;
/* Variables below this point are populated by fts3_expr.c when parsing
** a MATCH expression. Everything above is part of the evaluation phase.
*/
+27 -25
View File
@@ -442,37 +442,39 @@ static int fts3BestSnippet(
sIter.nSnippet = nSnippet;
sIter.nPhrase = nList;
sIter.iCurrent = -1;
(void)fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
if( rc==SQLITE_OK ){
/* Set the *pmSeen output variable. */
for(i=0; i<nList; i++){
if( sIter.aPhrase[i].pHead ){
*pmSeen |= (u64)1 << i;
/* Set the *pmSeen output variable. */
for(i=0; i<nList; i++){
if( sIter.aPhrase[i].pHead ){
*pmSeen |= (u64)1 << i;
}
}
}
/* Loop through all candidate snippets. Store the best snippet in
** *pFragment. Store its associated 'score' in iBestScore.
*/
pFragment->iCol = iCol;
while( !fts3SnippetNextCandidate(&sIter) ){
int iPos;
int iScore;
u64 mCover;
u64 mHighlight;
fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight);
assert( iScore>=0 );
if( iScore>iBestScore ){
pFragment->iPos = iPos;
pFragment->hlmask = mHighlight;
pFragment->covered = mCover;
iBestScore = iScore;
/* Loop through all candidate snippets. Store the best snippet in
** *pFragment. Store its associated 'score' in iBestScore.
*/
pFragment->iCol = iCol;
while( !fts3SnippetNextCandidate(&sIter) ){
int iPos;
int iScore;
u64 mCover;
u64 mHighlite;
fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover,&mHighlite);
assert( iScore>=0 );
if( iScore>iBestScore ){
pFragment->iPos = iPos;
pFragment->hlmask = mHighlite;
pFragment->covered = mCover;
iBestScore = iScore;
}
}
}
*piScore = iBestScore;
}
sqlite3_free(sIter.aPhrase);
*piScore = iBestScore;
return SQLITE_OK;
return rc;
}
+1 -1
View File
@@ -163,7 +163,7 @@ static int fts3tokConnectMethod(
sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */
char **pzErr /* OUT: sqlite3_malloc'd error message */
){
Fts3tokTable *pTab;
Fts3tokTable *pTab = 0;
const sqlite3_tokenizer_module *pMod = 0;
sqlite3_tokenizer *pTok = 0;
int rc;
+3 -3
View File
@@ -1625,7 +1625,7 @@ int sqlite3Fts3SegReaderNew(
** an array of pending terms by term. This occurs as part of flushing
** the contents of the pending-terms hash table to the database.
*/
static int fts3CompareElemByTerm(const void *lhs, const void *rhs){
static int SQLITE_CDECL fts3CompareElemByTerm(const void *lhs, const void *rhs){
char *z1 = fts3HashKey(*(Fts3HashElem **)lhs);
char *z2 = fts3HashKey(*(Fts3HashElem **)rhs);
int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs);
@@ -3082,8 +3082,8 @@ static int fts3PromoteSegments(
if( bOk ){
int iIdx = 0;
sqlite3_stmt *pUpdate1;
sqlite3_stmt *pUpdate2;
sqlite3_stmt *pUpdate1 = 0;
sqlite3_stmt *pUpdate2 = 0;
if( rc==SQLITE_OK ){
rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL_IDX, &pUpdate1, 0);
+1 -1
View File
@@ -398,7 +398,7 @@ static amatch_avl *amatchAvlInsert(amatch_avl **ppHead, amatch_avl *pNew){
*/
static void amatchAvlRemove(amatch_avl **ppHead, amatch_avl *pOld){
amatch_avl **ppParent;
amatch_avl *pBalance;
amatch_avl *pBalance = 0;
/* assert( amatchAvlSearch(*ppHead, pOld->zKey)==pOld ); */
ppParent = amatchAvlFromPtr(pOld, ppHead);
if( pOld->pBefore==0 && pOld->pAfter==0 ){
+2 -1
View File
@@ -342,7 +342,8 @@ static int fuzzerLoadOneRule(
rc = SQLITE_NOMEM;
}else{
memset(pRule, 0, sizeof(*pRule));
pRule->zFrom = &pRule->zTo[nTo+1];
pRule->zFrom = pRule->zTo;
pRule->zFrom += nTo + 1;
pRule->nFrom = nFrom;
memcpy(pRule->zFrom, zFrom, nFrom+1);
memcpy(pRule->zTo, zTo, nTo+1);
+1 -1
View File
@@ -356,7 +356,7 @@ static int substituteCost(char cPrev, char cFrom, char cTo){
static int editdist1(const char *zA, const char *zB, int *pnMatch){
int nA, nB; /* Number of characters in zA[] and zB[] */
int xA, xB; /* Loop counters for zA[] and zB[] */
char cA, cB; /* Current character of zA and zB */
char cA = 0, cB; /* Current character of zA and zB */
char cAprev, cBprev; /* Previous character of zA and zB */
char cAnext, cBnext; /* Next character in zA and zB */
int d; /* North-west cost value */
+8 -8
View File
@@ -369,13 +369,12 @@ static int readInt16(u8 *p){
return (p[0]<<8) + p[1];
}
static void readCoord(u8 *p, RtreeCoord *pCoord){
u32 i = (
pCoord->u = (
(((u32)p[0]) << 24) +
(((u32)p[1]) << 16) +
(((u32)p[2]) << 8) +
(((u32)p[3]) << 0)
);
*(u32 *)pCoord = i;
}
static i64 readInt64(u8 *p){
return (
@@ -404,7 +403,7 @@ static int writeCoord(u8 *p, RtreeCoord *pCoord){
u32 i;
assert( sizeof(RtreeCoord)==4 );
assert( sizeof(u32)==4 );
i = *(u32 *)pCoord;
i = pCoord->u;
p[0] = (i>>24)&0xFF;
p[1] = (i>>16)&0xFF;
p[2] = (i>> 8)&0xFF;
@@ -735,14 +734,13 @@ static void nodeGetCell(
RtreeCell *pCell /* OUT: Write the cell contents here */
){
u8 *pData;
u8 *pEnd;
RtreeCoord *pCoord;
int ii;
pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);
pData = pNode->zData + (12 + pRtree->nBytesPerCell*iCell);
pEnd = pData + pRtree->nDim*8;
pCoord = pCell->aCoord;
for(; pData<pEnd; pData+=4, pCoord++){
readCoord(pData, pCoord);
for(ii=0; ii<pRtree->nDim*2; ii++){
readCoord(&pData[ii*4], &pCoord[ii]);
}
}
@@ -1182,7 +1180,7 @@ static RtreeSearchPoint *rtreeEnqueue(
pNew = pCur->aPoint + i;
pNew->rScore = rScore;
pNew->iLevel = iLevel;
assert( iLevel>=0 && iLevel<=RTREE_MAX_DEPTH );
assert( iLevel<=RTREE_MAX_DEPTH );
while( i>0 ){
RtreeSearchPoint *pParent;
j = (i-1)/2;
@@ -2806,6 +2804,8 @@ static int rtreeUpdate(
rtreeReference(pRtree);
assert(nData>=1);
cell.iRowid = 0; /* Used only to suppress a compiler warning */
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
+3 -1
View File
@@ -112,6 +112,7 @@ SRC = \
$(TOP)/src/mem3.c \
$(TOP)/src/mem5.c \
$(TOP)/src/memjournal.c \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.c \
$(TOP)/src/mutex.h \
$(TOP)/src/mutex_noop.c \
@@ -345,6 +346,7 @@ HDR = \
$(TOP)/src/hash.h \
$(TOP)/src/hwtime.h \
keywordhash.h \
$(TOP)/src/msvc.h \
$(TOP)/src/mutex.h \
opcodes.h \
$(TOP)/src/os.h \
@@ -688,7 +690,7 @@ checksymbols: sqlite3.o
# Build the amalgamation-autoconf package.
#
dist: sqlite3.c
amalgamation-tarball: sqlite3.c
TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh
+112 -105
View File
@@ -1,12 +1,12 @@
C Fix\ssome\scomments\sin\sfkey.c.\sAdd\stests\sto\sfkey8.test.
D 2014-12-17T14:38:45.643
C Backport\sthe\s'stdcall'\srelated\senhancements\sfrom\strunk.
D 2015-03-25T00:09:44.052
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
F Makefile.in 5407a688f4d77a05c18a8142be8ae5a2829dd610
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc 10720782f88648bf2b5dcedf4c1524b067d43e47
F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0
F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8
F VERSION d846487aff892625eb8e75960234e7285f0462fe
F Makefile.msc 417530abef2e2a63b35dfc3ae49e5bbd967eac87
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866
F VERSION 0de46a30a2d0a7a6a686fd35186fbad0ac06ff71
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am 8fc2972d92769cf20ab8e4a73ea901b84d69bf44
F autoconf/README 14458f1046c118efa721aadec5f227e876d3cd38
F autoconf/README.first 47dd53221023b18c836ab00dba6e00bd86132453
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
F autoconf/config.guess 94cc57e2a3fdb9c235b362ace86d77e89d188cad x
F autoconf/config.sub 1efb390a8fb4bfafd74783a15a8fb5311c84300e x
F autoconf/configure.ac ba3e99ba1a8171d0682b68443517088fc5d6f13a
@@ -26,7 +26,7 @@ F autoconf/missing d7c9981a81af13370d4ed152b24c0a82b7028585 x
F autoconf/tea/Makefile.in d55bcc63832caf0309c2ff80358756116618cfca
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
F autoconf/tea/configure.in 93d43c79e936fb16556e22498177d7e8571efa04
F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04
F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb
F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523
F autoconf/tea/pkgIndex.tcl.in 3ef61715cf1c7bdcff56947ffadb26bc991ca39d
@@ -36,10 +36,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928
F autoconf/tea/win/nmakehlp.c 2070e086f39866b353a482d3a14dedaf26196506
F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure 4343c810cc772571210af75d1a8f7c2eb711d75a x
F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a
F configure 444b4cd66ec94631b2b624cf24d01142c9aac0ae x
F configure.ac 6a8d145aea6d81f0b90013340780e43ed74fd5f4
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
@@ -78,25 +78,25 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 8b6cceb3e0be22da26d83a3cec0e0e337e6b8ec6
F ext/fts3/fts3.c 845f20440dacac6e09f5c7735205609b9a86536b
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 53d4eca1fb23eab00681fb028fb82eb5705c1e21
F ext/fts3/fts3Int.h 394858c12a17740f7a1f6bd372c4606d4425a8d1
F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365
F ext/fts3/fts3_expr.c 40123785eaa3ebd4c45c9b23407cc44ac0c49905
F ext/fts3/fts3_hash.c 29b986e43f4e9dd40110eafa377dc0d63c422c60
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5
F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009
F ext/fts3/fts3_snippet.c 51beb5c1498176fd9caccaf1c75b55cb803a985a
F ext/fts3/fts3_snippet.c 55c126e07158b2a705f52dee2cdc57208d3e999a
F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763
F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038
F ext/fts3/fts3_tokenize_vtab.c 011170fe9eba5ff062f1a31d3188e00267716706
F ext/fts3/fts3_tokenize_vtab.c becc661223db7898b213f9e8a23d75bac02408c9
F ext/fts3/fts3_tokenizer.c bbdc731bc91338050675c6d1da9ab82147391e16
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145
F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057
F ext/fts3/fts3_write.c 8260388626516a7005d06a9dce94f9e55c6c2a41
F ext/fts3/fts3_write.c 5dc59cb435ed5b1f72459e5544f6854a928112e7
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3view.c 3986531f2fc0ceca0c89c31ec7d0589b6adb19d6
@@ -106,25 +106,25 @@ F ext/fts3/unicode/mkunicode.tcl a2567f9d6ad6779879a2e394c120ad8718557e65
F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
F ext/icu/icu.c d415ccf984defeb9df2c0e1afcfaa2f6dc05eacb
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1
F ext/misc/amatch.c 17ba78dc9b33601a40d2a7bc54c748b6f3eb7176
F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012
F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d
F ext/misc/fuzzer.c e3e18f47252c151b5553d7e806f38e757d37c4cc
F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F ext/misc/spellfix.c 56739fab8c2ed6a9e2dac5592a88d281a999c43b
F ext/misc/spellfix.c 25810dda37fc904b0772a13efd8ca072fb09e355
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 57bec53e1a677ab74217fe1f20a58c3a47261d6b
F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
F ext/rtree/rtree1.test 541bbcab74613907fea08b2ecdcdd5b7aa724cc9
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@@ -152,7 +152,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
F main.mk 9f8c54fe62b60e0a24a2e65cfc8d2add063dda07
F main.mk e392561ffe17fc4dad945eef852400d5bf2911a0
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
@@ -160,33 +160,33 @@ F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test cce8e306d8596d5a2e497e27112dae1f6e5e3538
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c 499a74af4be293b7c1c7c3d40f332b67227dd739
F mptest/mptest.c 24c5f72415df2eab7088ef8c9f99f163aed590c8
F mptest/multiwrite01.test 499ad0310da8dff8e8f98d2e272fc2a8aa741b2e
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb
F src/analyze.c 7a2986e6ea8247e5f21aca3d0b584598f58d84fe
F src/analyze.c 91540f835163d5369ccbae78e2e6c74d0dd53c1d
F src/attach.c 7f6b3fafa2290b407e4a94dcf1afda7ec0fe394b
F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
F src/backup.c 7ddee9c7d505e07e959a575b18498f17c71e53ea
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
F src/btree.c 92f745ccd18099973beb28e25fce80148545429e
F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e
F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21
F src/build.c 162d84e4833b03f9d07192ef06057b0226f6e543
F src/btree.c 4c098bb6e8678e4596983862abf78f7a0fcb807e
F src/btree.h 94277c1d30c0b75705974bcc8b0c05e79c03d474
F src/btreeInt.h a3d0ae1d511365e1a2b76ad10960dbe55c286f34
F src/build.c f5cfd7b32216f695b995bbc7c1a395f6d451d11f
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
F src/complete.c c4ba6e0626bb94bc77a0861735f3382fcf7cc818
F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a
F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744
F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417
F src/expr.c 00da3072f362b06f39ce4052baa1d4ce2bb36d1c
F src/complete.c 198a0066ba60ab06fc00fba1998d870a4d575463
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
F src/delete.c bd1a91ddd247ce13004075251e0b7fe2bf9925ef
F src/expr.c 7be80f7dc337329a24df45c2f3bdb2ea3b64c90e
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e0444b61bed271a76840cbe6182df93a9baa3f12
F src/func.c 6d3c4ebd72aa7923ce9b110a7dc15f9b8c548430
F src/global.c 6ded36dda9466fc1c9a3c5492ded81d79bf3977d
F src/global.c 12561d70a1b25f67b21154622bb1723426724f75
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
@@ -195,64 +195,65 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
F src/loadext.c 86bd4e2fccd520b748cba52492ab60c4a770f660
F src/main.c 48e0410a661c629471ca9061d4153245cc9f853b
F src/main.c 341fcc5601a8ca84389fa32bcf5a857f65af8dd0
F src/malloc.c 740db54387204c9a2eb67c6d98e68b08e9ef4eab
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
F src/msvc.h e78002098966e39b2fd9915bd70b7bc3ec8398b7
F src/mutex.c 19bf9acba69ca2f367c3761080f8a9f0cf4670a8
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1
F src/mutex_unix.c 551e2f25f0fa0ee8fd7a43f50fc3d8be00e95dde
F src/mutex_w32.c 06bfff9a3a83b53389a51a967643db3967032e1e
F src/mutex_w32.c df48fe07562a45c5c927c45b8d5873a27f98bbb0
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7
F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a
F src/os_unix.c aefeaf915aaef9f81aa2645e0d5d06fa1bd83beb
F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
F src/pager.c 7a5c5bc0e29b9b16834f5558a9d5d22bbae59a08
F src/pager.h d1eee3c3f741be247ce6d82752a178515fc8578b
F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45
F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4
F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
F src/parse.y c5d0d964f9ac023e8154cad512e54b0b6058e086
F src/pcache.c d210cf90d04365a74f85d21374dded65af67b0cb
F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8
F src/pcache1.c facbdd3ecc09c8f750089d941305694301328e98
F src/pragma.c c93be505649183b2d80082c2eef1a56879dabfe6
F src/pcache1.c 1e77432b40b7d3288327d9cdf399dcdfd2b6d3bf
F src/pragma.c ba149bbbc90783f84815636c509ced8eac11bbcf
F src/prepare.c 173a5a499138451b2561614ecb87d78f9f4644b9
F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236
F src/printf.c ea82bcb1b83273b4c67177c233c1f78c81fc42f9
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c f377fb8a5c73c10678ea74f3400f7913943e3d75
F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf
F src/sqlite.h.in 116dc731361549ee3fc79dcebace11b57d24dcfd
F src/select.c a4e8fda24c8eab2682a058bdda0d5d68cfe3919c
F src/shell.c 786d96e055595d598e936e63622e82f87255dac8
F src/sqlite.h.in eb8ab2878a39c650e9cf44dfc7b05b5a00b3c5cf
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
F src/sqliteInt.h d36da9a07130cae13cbfee0986bf20028cb01465
F src/sqliteInt.h eaf210295b551d4e40e622aec1b2261c0b28f844
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 81712116e826b0089bb221b018929536b2b5406f
F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc
F src/tclsqlite.c c6a21c64da1490e14d53cdc2062d1e2e57942622
F src/test1.c 56e33bf6b1827c6ca7520c189131ddd778fb2267
F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712
F src/table.c e7a09215315a978057fb42c640f890160dbcc45e
F src/tclsqlite.c 0bbb44543175ef2033d39780a233f98bf354eff9
F src/test1.c 093d8b5b54b829dcfebae3181d4406edcc935d90
F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1
F src/test6.c 41cacf3b0dd180823919bf9e1fbab287c9266723
F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2
F src/test8.c 54ccd7b1df5062f0ecbf50a8f7b618f8b1f13b20
F src/test8.c df8dd4c99c1dd2225cb2a6f334299cddc5dcf1f1
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8
F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
F src/test_backup.c 3875e899222b651e18b662f86e0e50daa946344e
F src/test_blob.c 1f2e3e25255b731c4fcf15ee7990d06347cb6c09
F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
F src/test_config.c 035c17a173937d019b8dfc1d524f9d3fc8123504
F src/test_config.c e7b2e1634324d746aa5e1c7e0929470e8be27953
F src/test_demovfs.c 69b2085076654ebc18014cbc6386f04409c959a9
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
@@ -261,16 +262,16 @@ F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32
F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834
F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202
F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64
F src/test_journal.c 5360fbe1d1e4416ca36290562fd5a2e3f70f32aa
F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4
F src/test_malloc.c ba34143f941a9d74b30bbffc8818389bb73a1ca2
F src/test_multiplex.c caadb62cc777268b4f8fb94d5b27b80156c8f7c0
F src/test_malloc.c b9495384e74923aefde8311de974bf9b0f5ba570
F src/test_multiplex.c 72c0ad1e97af3d6d19975bbd81813072b40c7290
F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3
F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f
F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25
F src/test_osinst.c 3d0340bc31a9f3d8a3547e0272373e80f78dde25
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
F src/test_quota.c 65f6348fec0f2b3020c907247fb47556b214abb9
F src/test_quota.c 180813f43683be5725458fc1ff13ac455d8e722d
F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
F src/test_rtree.c fdd8d29ca5165c7857987a2ba263fac5c69e231f
F src/test_schema.c 2bdba21b82f601da69793e1f1d11bf481a79b091
@@ -281,30 +282,30 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb
F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c
F src/test_vfs.c 8ee7be45fe773a150b4015ef957da960179ee43a
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 6de09362b657f19ba83e5fa521ee715787ce9fee
F src/tokenize.c cc9016e5007fc5e76789079616d2f26741bcc689
F src/threads.c 2fb3ea4d70d5acf68b539c2489b4adace61cc01b
F src/tokenize.c e00458c9938072b0ea711c850b8dcf4ddcb5fe18
F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f
F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c 3b627daa45c7308c1e36e3dbaa3f9ce7e5c7fa73
F src/util.c 98a7627ca48ad3265b6940915a1d08355eb3fc7e
F src/vacuum.c 9b30ec729337dd012ed88d4c292922c8ef9cf00c
F src/vdbe.c 1a9e671c9cfc259e4d2affc71f7df4a4c00a842c
F src/vdbe.c ddfc977981cd6324668aa6b114045eb1c677421a
F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3
F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78
F src/vdbeapi.c 4bc511a46b9839392ae0e90844a71dc96d9dbd71
F src/vdbeaux.c 07ef87c6d4b5abdf13ff33babb10205702fdab0a
F src/vdbeaux.c f06d38c71d7f533348c09869d69fd1b647042a5b
F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778
F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f
F src/vdbesort.c c150803a3e98fbc68bd07772cbbd4328a0a7212d
F src/vdbesort.c 6d64c5448b64851b99931ede980addc3af70d5e2
F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010
F src/vtab.c c08ec66f45919eaa726bf88aa53eb08379d607f9
F src/wal.c 847692349eb6e1fb8543dbc97e69ddbfa4cc7ea7
F src/wal.c 39303f2c9db02a4e422cd8eb2c8760420c6a51fe
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
F src/where.c d46de821bc604a4fd36fa3928c086950e91aafb1
F src/where.c 88509f19a64a36e1c22a1dbdac74ee1a62d99dc3
F src/whereInt.h d3633e9b592103241b74b0ec76185f3e5b8b62e0
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -348,7 +349,7 @@ F test/autoinc.test c58912526998a39e11f66b533e23cfabea7f25b7
F test/autoindex1.test 6ff78b94f43a59616c06c11c55b12935173506d7
F test/autoindex2.test af7e595c6864cc6ef5fc38d5db579a3e34940cb8
F test/autoindex3.test a3be0d1a53a7d2edff208a5e442312957047e972
F test/autoindex4.test fc807f9efd158bec60f5dfdf34ebe46fb274612d
F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf
F test/autovacuum.test 941892505d2c0f410a0cb5970dfa1c7c4e5f6e74
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
@@ -366,7 +367,7 @@ F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bigsort.test 835478d0ce83bd1e5b05c90571dedd9871a09196
F test/bigsort.test 8299fa9298f4f1e02fc7d2712e8b77d6cd60e5a2
F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c
F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0
F test/bitvec.test 75894a880520164d73b1305c1c3f96882615e142
@@ -478,8 +479,8 @@ F test/e_update.test 312cb8f5ccfe41515a6bb092f8ea562a9bd54d52
F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585
F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9
F test/e_wal.test 0967f0b8f1dfda871dc7b9b5574198f1f4f7d69a
F test/e_walauto.test a1fa9d36c160cc4001a934d1e009aae597b440b7
F test/e_walckpt.test 3116a98fa0dd9b2c9e493de7c59730adfe436746
F test/e_walauto.test ca70cf75c07a6cb1874ced101dd426da76625649
F test/e_walckpt.test 65e29b6631e51f210f83e4ff11571e647ba93608
F test/e_walhook.test da3ea8b3483d1af72190337bda50155a91a4b664
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
@@ -501,7 +502,7 @@ F test/fkey1.test e1d1fa84cde579185ea01358436839703e415a5b
F test/fkey2.test 1db212cda86b0d3ce72714001f7b6381c321341c
F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
F test/fkey5.test 8a1fde4e7721ae00b05b3178888833726ca2df8d
F test/fkey5.test 488601fbda8350619b3029487e56830447056fd2
F test/fkey6.test abb59f866c1b44926fd02d1fdd217d831fe04f48
F test/fkey7.test 72e915890ee4a005daaf3002cb208e8fe973ac13
F test/fkey8.test 8f08203458321e6c19a263829de4cfc936274ab0
@@ -619,7 +620,7 @@ F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f
F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4
F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74
F test/fuzz.test 96083052bf5765e4518c1ba686ce2bab785670d1
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
F test/fuzz2.test b34fe575aa10292135421ff4bf315de4cde7824a
F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
@@ -649,7 +650,7 @@ F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F test/index3.test 55a90cff99834305e8141df7afaef39674b57062
F test/index4.test ab92e736d5946840236cd61ac3191f91a7856bf6
F test/index5.test 25b0b451aceed4ac5f7d49f856f6de7257470b3e
F test/index6.test fb370966ac3cd0989053dd5385757b5c3e24ab6a
F test/index6.test c56852451b574ad5b2a1789e566e62e6ab244f42
F test/index7.test 917cf1e1c7439bb155abbeabec511b28945e157b
F test/indexedby.test b2f22f3e693a53813aa3f50b812eb609ba6df1ec
F test/indexfault.test 31d4ab9a7d2f6e9616933eb079722362a883eb1d
@@ -699,7 +700,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
F test/lock_common.tcl 0c270b121d40959fa2f3add382200c27045b3d95
F test/lookaside.test 93f07bac140c5bb1d49f3892d2684decafdc7af2
F test/main.test 39c4bb8a157f57298ed1659d6df89d9f35aaf2c8
F test/main.test 16131264ea0c2b93b95201f0c92958e85f2ba11a
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test 96939d2d1a6f39667bbebe5bc27c6525f2ab614e
F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a
@@ -727,7 +728,7 @@ F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e
F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f
F test/memdb.test fcb5297b321b562084fc79d64d5a12a1cd2b639b
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
F test/memsubsys1.test bf270964ab83bc2da5927960f78304a866fb9a9d
F test/memsubsys1.test 690d142525a7d31efb638b0d232e25fac3afeb1a
F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9
F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
@@ -755,7 +756,7 @@ F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a
F test/nolock.test 0540dd96f39b8876e3ffdd8814fad0ea425efeee
F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
F test/notify2.test ce23eb522c9e1fff6443f96376fe67872202061c
F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934
F test/notnull.test f8fcf58669ddba79274daa2770d61dfad8274f62
F test/null.test a8b09b8ed87852742343b33441a9240022108993
@@ -768,7 +769,8 @@ F test/orderby4.test 4d39bfbaaa3ae64d026ca2ff166353d2edca4ba4
F test/orderby5.test 8f08a54836d21fb7c70245360751aedd1c2286fb
F test/orderby6.test 8b38138ab0972588240b3fca0985d2e400432859
F test/orderby7.test 3d1383d52ade5b9eb3a173b3147fdd296f0202da
F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3
F test/orderby8.test 23ef1a5d72bd3adcc2f65561c654295d1b8047bd
F test/oserror.test 14fec2796c2b6fe431c7823750e8a18a761176d7
F test/ovfl.test 4f7ca651cba5c059a12d8c67dddd49bec5747799
F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
@@ -781,10 +783,11 @@ F test/pageropt.test 6b8f6a123a5572c195ad4ae40f2987007923bbd6
F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54
F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test f9cc1dd987986c9d4949211c7a4ed55ec9aecba1
F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5
F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a
F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
@@ -800,8 +803,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a
F test/releasetest.tcl a4279c890698584feb2ffc86735857a4e4474180
F test/releasetest.tcl 13f401c10dd4fe1a2fb811ae6ed27fd7d1300d3c
F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
@@ -840,6 +842,7 @@ F test/selectC.test 871fb55d884d3de5943c4057ebd22c2459e71977
F test/selectD.test b0f02a04ef7737decb24e08be2c39b9664b43394
F test/selectE.test fc02a1eb04c8eb537091482644b7d778ae8759b7
F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3
F test/selectG.test e8600e379589e85e9fefd2fe4d44a4cdd63f6982
F test/server1.test 46803bd3fe8b99b30dbc5ff38ffc756f5c13a118
F test/shared.test 1da9dbad400cee0d93f252ccf76e1ae007a63746
F test/shared2.test 03eb4a8d372e290107d34b6ce1809919a698e879
@@ -853,11 +856,11 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test ab6025d941f9c84c5b83412c6b4d8b57f78dfa3a
F test/shell1.test cdeb849acc2c37aada70d084564b0cc0a2c7df08
F test/shell2.test 12b8bf901b0e3a8ac58cf5c0c63a0a388d4d1862
F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29
F test/shell4.test 8a9c08976291e6c6c808b4d718f4a8b299f339f5
F test/shell5.test 15a419cc1df21c892ed64f5596ae7a501f2816f2
F test/shell5.test 81aba4793fa7441b1300daae1aec4f7e4b5741c1
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868
@@ -869,12 +872,12 @@ F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2
F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b
F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24
F test/sort.test c4400e7533748f6bd7413851ff148645e82b9e2d
F test/sort2.test 84a92eebf697feee9c6697746918c7d67373eea1
F test/sort.test 3f492e5b7be1d3f756728d2ff6edf4f6091e84cb
F test/sort2.test 37afbc03f5559f2eb0f18940b55d38dfbb5172ac
F test/sort3.test 6178ade30810ac9166fcdf14b7065e49c0f534e2
F test/sort4.test 6c37d85f7cd28d50cce222fcab84ccd771e105cb
F test/sort4.test d5e8903194ae551551349ce25dc8d0b40ca2b9c3
F test/sort5.test a448240a42b49239edc00f85d6d7ac7a1b261e1f
F test/sortfault.test b8e35177f97438b930ee87c9419ca2599e8073e1
F test/sortfault.test d4ccf606a0c77498e2beb542764fd9394acb4d66
F test/speed1.test f2974a91d79f58507ada01864c0e323093065452
F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb
F test/speed1p.test b180e98609c7677382cf618c0ec9b69f789033a8
@@ -914,7 +917,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46
F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
F test/threadtest3.c f8c6595664a4c5ef5f28d97a612386fe14dd1940
F test/threadtest3.c 9ab4b168681c3a6f70f6c833ba08e0d48dd4af9b
F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
@@ -1078,7 +1081,7 @@ F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe
F test/triggerC.test a68980c5955d62ee24be6f97129d824f199f9a4c
F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650
F test/triggerE.test 355e9c5cbaed5cd039a60baad1fb2197caeb8e52
F test/tt3_checkpoint.c 5e63ee65ed5f87176e25a996480cb02c6caec8b4
F test/tt3_checkpoint.c 9e75cf7c1c364f52e1c47fd0f14c4340a9db0fe1
F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a
F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9
F test/tt3_stress.c c57d804716165811d979d4a719e05baccd79277f
@@ -1123,7 +1126,7 @@ F test/wal.test 885f32b2b390b30b4aa3dbb0e568f8f78d40f5cc
F test/wal2.test 1f841d2048080d32f552942e333fd99ce541dada
F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test 174cc1512e304a7dfa28ac30527e28ea02fc37df
F test/wal5.test dba8f5f5de95178bc40521d6edf153b2e2829917
F test/wal6.test 527581f5527bf9c24394991e2be83000aace5f9e
F test/wal64k.test 163655ecd2cb8afef4737cac2a40fdd2eeaf20b8
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
@@ -1178,10 +1181,11 @@ F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
F test/without_rowid3.test 1081aabf60a1e1123b7f9a8f6ae19954351843b0
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F test/without_rowid5.test 61256715b686359df48ca1742db50cc7e3e7b862
F test/without_rowid6.test deddb78ef539c355bddec00cdfaea6c56efd8b3f
F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac
F tool/build-all-msvc.bat a0534c971b86fe95f1983f445db5b896d3394818 x
F tool/build-all-msvc.bat 72e05bc8deca39a547884485c086b915f50a91ed x
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
@@ -1191,18 +1195,18 @@ F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/lemon.c 3ff0fec22f92dfb54e62eeb48772eddffdbeb0d6
F tool/lemon.c 1864c4fe4a72b1bb28f1792b60504804fe82c5d2
F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
F tool/mkautoconfamal.sh 5dc5010e2e748a9e1bba67baca5956a2c2deda7b
F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f
F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
F tool/mkpragmatab.tcl cce51d8f60c7f145d8fccabe6b5dfdedf31c5f5c
F tool/mkpragmatab.tcl 07a5124cf2dbafa1b375eefcf8ac4227028b0f8b
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl 88a1e3b0c769773fb7a9ebb363ffc603a4ac21d8
F tool/mksqlite3c.tcl e72c0c97fe1a105fa9616483e652949be2199fe6
F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12
F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1
F tool/mksqlite3c-noext.tcl 98e112237c36c31d8e054c6fa7bbba207850b6d6
F tool/mksqlite3c.tcl 5f57fd1d01f78a37549fb99ae4f6543d69141dcf
F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mkvsix.tcl 52a4c613707ac34ae9c226e5ccc69cb948556105
F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97
@@ -1233,7 +1237,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 35a20a5f22245c70faa51965951e8cc011defa93
R c39a2128ba39a16276f2dc7a158fbe28
U dan
Z 96b8a9e537739194255aed7e579f65ad
P 9d6c1880fb75660bbabd693175579529785f8a6b
R 04e924db808653f423bb10222a2f5af0
T *branch * stdcall
T *sym-stdcall *
T -sym-branch-3.8.8 *
U mistachkin
Z 651b023c24d6c190166dc0205066f55f
+1 -1
View File
@@ -1 +1 @@
210cb2a6aaf780365064a26c0c99926bd6346e19
cbb93d1aa1f992f17f76fd71fe9a99e03082f103
+1 -1
View File
@@ -1395,7 +1395,7 @@ int main(int argc, char **argv){
maybeClose(g.pLog);
maybeClose(g.pErrLog);
if( iClient==0 ){
printf("Summary: %d errors in %d tests\n", g.nError, g.nTest);
printf("Summary: %d errors out of %d tests\n", g.nError, g.nTest);
}
return g.nError>0;
}
+1 -1
View File
@@ -448,7 +448,7 @@ static void statInit(
p->mxSample = mxSample;
p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[2])/(mxSample/3+1) + 1);
p->current.anLt = &p->current.anEq[nColUp];
p->iPrn = nCol*0x689e962d ^ sqlite3_value_int(argv[2])*0xd0944565;
p->iPrn = 0x689e962d*(u32)nCol ^ 0xd0944565*(u32)sqlite3_value_int(argv[2]);
/* Set up the Stat4Accum.a[] and aBest[] arrays */
p->a = (struct Stat4Sample*)&p->current.anLt[nColUp];
+16 -4
View File
@@ -3550,6 +3550,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
sqlite3BtreeLeave(p);
return rc;
}
p->iDataVersion--; /* Compensate for pPager->iDataVersion++; */
pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
}
@@ -6864,8 +6865,8 @@ static int balance_nonroot(
/* Do not allow any cells smaller than 4 bytes. If a smaller cell
** does exist, pad it with 0x00 bytes. */
assert( szCell[nCell]==3 );
assert( apCell[nCell]==&pTemp[iSpace1-3] );
pTemp[iSpace1++] = 0x00;
assert( apCell[nCell]==&aSpace1[iSpace1-3] );
aSpace1[iSpace1++] = 0x00;
szCell[nCell] = 4;
}
}
@@ -8177,6 +8178,13 @@ int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
** The schema layer numbers meta values differently. At the schema
** layer (and the SetCookie and ReadCookie opcodes) the number of
** free pages is not visible. So Cookie[0] is the same as Meta[1].
**
** This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead
** of reading the value out of the header, it instead loads the "DataVersion"
** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
** database file. It is a number computed by the pager. But its access
** pattern is the same as header meta values, and so it is convenient to
** read it from this routine.
*/
void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
BtShared *pBt = p->pBt;
@@ -8187,7 +8195,11 @@ void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
assert( pBt->pPage1 );
assert( idx>=0 && idx<=15 );
*pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);
if( idx==BTREE_DATA_VERSION ){
*pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion;
}else{
*pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);
}
/* If auto-vacuum is disabled in this build and this is an auto-vacuum
** database, mark the database as read-only. */
@@ -9134,4 +9146,4 @@ int sqlite3BtreeIsReadonly(Btree *p){
/*
** Return the size of the header added to each page by this module.
*/
int sqlite3HeaderSizeBtree(void){ return sizeof(MemPage); }
int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }
+7 -1
View File
@@ -19,7 +19,7 @@
/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/
#define SQLITE_N_BTREE_META 10
#define SQLITE_N_BTREE_META 16
/*
** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
@@ -134,6 +134,11 @@ int sqlite3BtreeNewDb(Btree *p);
** For example, the free-page-count field is located at byte offset 36 of
** the database file header. The incr-vacuum-flag field is located at
** byte offset 64 (== 36+4*7).
**
** The BTREE_DATA_VERSION value is not really a value stored in the header.
** It is a read-only number computed by the pager. But we merge it with
** the header value access routines since its access pattern is the same.
** Call it a "virtual meta value".
*/
#define BTREE_FREE_PAGE_COUNT 0
#define BTREE_SCHEMA_VERSION 1
@@ -144,6 +149,7 @@ int sqlite3BtreeNewDb(Btree *p);
#define BTREE_USER_VERSION 6
#define BTREE_INCR_VACUUM 7
#define BTREE_APPLICATION_ID 8
#define BTREE_DATA_VERSION 15 /* A virtual meta-value */
/*
** Values that may be OR'd together to form the second argument of an
+1
View File
@@ -351,6 +351,7 @@ struct Btree {
u8 locked; /* True if db currently has pBt locked */
int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
int nBackup; /* Number of backup operations reading this btree */
u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
Btree *pNext; /* List of other sharable Btrees from the same db */
Btree *pPrev; /* Back pointer of the same list */
#ifndef SQLITE_OMIT_SHARED_CACHE
+13
View File
@@ -1713,6 +1713,19 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
pTab->iPKey = -1;
}else{
pPk = sqlite3PrimaryKeyIndex(pTab);
/*
** Remove all redundant columns from the PRIMARY KEY. For example, change
** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
** code assumes the PRIMARY KEY contains no repeated columns.
*/
for(i=j=1; i<pPk->nKeyCol; i++){
if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
pPk->nColumn--;
}else{
pPk->aiColumn[j++] = pPk->aiColumn[i];
}
}
pPk->nKeyCol = j;
}
pPk->isCovering = 1;
assert( pPk!=0 );
+7 -7
View File
@@ -105,13 +105,6 @@ int sqlite3_complete(const char *zSql){
u8 state = 0; /* Current state, using numbers defined in header comment */
u8 token; /* Value of the next token */
#ifdef SQLITE_ENABLE_API_ARMOR
if( zSql==0 ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
#ifndef SQLITE_OMIT_TRIGGER
/* A complex statement machine used to detect the end of a CREATE TRIGGER
** statement. This is the normal case.
@@ -141,6 +134,13 @@ int sqlite3_complete(const char *zSql){
};
#endif /* SQLITE_OMIT_TRIGGER */
#ifdef SQLITE_ENABLE_API_ARMOR
if( zSql==0 ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
while( *zSql ){
switch( *zSql ){
case ';': { /* A semicolon */
+109 -109
View File
@@ -33,91 +33,91 @@ static const char * const azCompileOpt[] = {
#define CTIMEOPT_VAL_(opt) #opt
#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
#ifdef SQLITE_32BIT_ROWID
#if SQLITE_32BIT_ROWID
"32BIT_ROWID",
#endif
#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
#if SQLITE_4_BYTE_ALIGNED_MALLOC
"4_BYTE_ALIGNED_MALLOC",
#endif
#ifdef SQLITE_CASE_SENSITIVE_LIKE
#if SQLITE_CASE_SENSITIVE_LIKE
"CASE_SENSITIVE_LIKE",
#endif
#ifdef SQLITE_CHECK_PAGES
#if SQLITE_CHECK_PAGES
"CHECK_PAGES",
#endif
#ifdef SQLITE_COVERAGE_TEST
#if SQLITE_COVERAGE_TEST
"COVERAGE_TEST",
#endif
#ifdef SQLITE_DEBUG
#if SQLITE_DEBUG
"DEBUG",
#endif
#ifdef SQLITE_DEFAULT_LOCKING_MODE
#if SQLITE_DEFAULT_LOCKING_MODE
"DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
#endif
#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)
"DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
#endif
#ifdef SQLITE_DISABLE_DIRSYNC
#if SQLITE_DISABLE_DIRSYNC
"DISABLE_DIRSYNC",
#endif
#ifdef SQLITE_DISABLE_LFS
#if SQLITE_DISABLE_LFS
"DISABLE_LFS",
#endif
#ifdef SQLITE_ENABLE_API_ARMOR
#if SQLITE_ENABLE_API_ARMOR
"ENABLE_API_ARMOR",
#endif
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
#if SQLITE_ENABLE_ATOMIC_WRITE
"ENABLE_ATOMIC_WRITE",
#endif
#ifdef SQLITE_ENABLE_CEROD
#if SQLITE_ENABLE_CEROD
"ENABLE_CEROD",
#endif
#ifdef SQLITE_ENABLE_COLUMN_METADATA
#if SQLITE_ENABLE_COLUMN_METADATA
"ENABLE_COLUMN_METADATA",
#endif
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
#if SQLITE_ENABLE_EXPENSIVE_ASSERT
"ENABLE_EXPENSIVE_ASSERT",
#endif
#ifdef SQLITE_ENABLE_FTS1
#if SQLITE_ENABLE_FTS1
"ENABLE_FTS1",
#endif
#ifdef SQLITE_ENABLE_FTS2
#if SQLITE_ENABLE_FTS2
"ENABLE_FTS2",
#endif
#ifdef SQLITE_ENABLE_FTS3
#if SQLITE_ENABLE_FTS3
"ENABLE_FTS3",
#endif
#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
#if SQLITE_ENABLE_FTS3_PARENTHESIS
"ENABLE_FTS3_PARENTHESIS",
#endif
#ifdef SQLITE_ENABLE_FTS4
#if SQLITE_ENABLE_FTS4
"ENABLE_FTS4",
#endif
#ifdef SQLITE_ENABLE_ICU
#if SQLITE_ENABLE_ICU
"ENABLE_ICU",
#endif
#ifdef SQLITE_ENABLE_IOTRACE
#if SQLITE_ENABLE_IOTRACE
"ENABLE_IOTRACE",
#endif
#ifdef SQLITE_ENABLE_LOAD_EXTENSION
#if SQLITE_ENABLE_LOAD_EXTENSION
"ENABLE_LOAD_EXTENSION",
#endif
#ifdef SQLITE_ENABLE_LOCKING_STYLE
#if SQLITE_ENABLE_LOCKING_STYLE
"ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
#endif
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
"ENABLE_MEMORY_MANAGEMENT",
#endif
#ifdef SQLITE_ENABLE_MEMSYS3
#if SQLITE_ENABLE_MEMSYS3
"ENABLE_MEMSYS3",
#endif
#ifdef SQLITE_ENABLE_MEMSYS5
#if SQLITE_ENABLE_MEMSYS5
"ENABLE_MEMSYS5",
#endif
#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK
"ENABLE_OVERSIZE_CELL_CHECK",
#endif
#ifdef SQLITE_ENABLE_RTREE
#if SQLITE_ENABLE_RTREE
"ENABLE_RTREE",
#endif
#if defined(SQLITE_ENABLE_STAT4)
@@ -125,31 +125,31 @@ static const char * const azCompileOpt[] = {
#elif defined(SQLITE_ENABLE_STAT3)
"ENABLE_STAT3",
#endif
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
#if SQLITE_ENABLE_UNLOCK_NOTIFY
"ENABLE_UNLOCK_NOTIFY",
#endif
#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
"ENABLE_UPDATE_DELETE_LIMIT",
#endif
#ifdef SQLITE_HAS_CODEC
#if SQLITE_HAS_CODEC
"HAS_CODEC",
#endif
#ifdef SQLITE_HAVE_ISNAN
#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
"HAVE_ISNAN",
#endif
#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX
"HOMEGROWN_RECURSIVE_MUTEX",
#endif
#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
#if SQLITE_IGNORE_AFP_LOCK_ERRORS
"IGNORE_AFP_LOCK_ERRORS",
#endif
#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS
"IGNORE_FLOCK_LOCK_ERRORS",
#endif
#ifdef SQLITE_INT64_TYPE
"INT64_TYPE",
#endif
#ifdef SQLITE_LOCK_TRACE
#if SQLITE_LOCK_TRACE
"LOCK_TRACE",
#endif
#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)
@@ -158,226 +158,226 @@ static const char * const azCompileOpt[] = {
#ifdef SQLITE_MAX_SCHEMA_RETRY
"MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
#endif
#ifdef SQLITE_MEMDEBUG
#if SQLITE_MEMDEBUG
"MEMDEBUG",
#endif
#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT
"MIXED_ENDIAN_64BIT_FLOAT",
#endif
#ifdef SQLITE_NO_SYNC
#if SQLITE_NO_SYNC
"NO_SYNC",
#endif
#ifdef SQLITE_OMIT_ALTERTABLE
#if SQLITE_OMIT_ALTERTABLE
"OMIT_ALTERTABLE",
#endif
#ifdef SQLITE_OMIT_ANALYZE
#if SQLITE_OMIT_ANALYZE
"OMIT_ANALYZE",
#endif
#ifdef SQLITE_OMIT_ATTACH
#if SQLITE_OMIT_ATTACH
"OMIT_ATTACH",
#endif
#ifdef SQLITE_OMIT_AUTHORIZATION
#if SQLITE_OMIT_AUTHORIZATION
"OMIT_AUTHORIZATION",
#endif
#ifdef SQLITE_OMIT_AUTOINCREMENT
#if SQLITE_OMIT_AUTOINCREMENT
"OMIT_AUTOINCREMENT",
#endif
#ifdef SQLITE_OMIT_AUTOINIT
#if SQLITE_OMIT_AUTOINIT
"OMIT_AUTOINIT",
#endif
#ifdef SQLITE_OMIT_AUTOMATIC_INDEX
#if SQLITE_OMIT_AUTOMATIC_INDEX
"OMIT_AUTOMATIC_INDEX",
#endif
#ifdef SQLITE_OMIT_AUTORESET
#if SQLITE_OMIT_AUTORESET
"OMIT_AUTORESET",
#endif
#ifdef SQLITE_OMIT_AUTOVACUUM
#if SQLITE_OMIT_AUTOVACUUM
"OMIT_AUTOVACUUM",
#endif
#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
#if SQLITE_OMIT_BETWEEN_OPTIMIZATION
"OMIT_BETWEEN_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_BLOB_LITERAL
#if SQLITE_OMIT_BLOB_LITERAL
"OMIT_BLOB_LITERAL",
#endif
#ifdef SQLITE_OMIT_BTREECOUNT
#if SQLITE_OMIT_BTREECOUNT
"OMIT_BTREECOUNT",
#endif
#ifdef SQLITE_OMIT_BUILTIN_TEST
#if SQLITE_OMIT_BUILTIN_TEST
"OMIT_BUILTIN_TEST",
#endif
#ifdef SQLITE_OMIT_CAST
#if SQLITE_OMIT_CAST
"OMIT_CAST",
#endif
#ifdef SQLITE_OMIT_CHECK
#if SQLITE_OMIT_CHECK
"OMIT_CHECK",
#endif
#ifdef SQLITE_OMIT_COMPLETE
#if SQLITE_OMIT_COMPLETE
"OMIT_COMPLETE",
#endif
#ifdef SQLITE_OMIT_COMPOUND_SELECT
#if SQLITE_OMIT_COMPOUND_SELECT
"OMIT_COMPOUND_SELECT",
#endif
#ifdef SQLITE_OMIT_CTE
#if SQLITE_OMIT_CTE
"OMIT_CTE",
#endif
#ifdef SQLITE_OMIT_DATETIME_FUNCS
#if SQLITE_OMIT_DATETIME_FUNCS
"OMIT_DATETIME_FUNCS",
#endif
#ifdef SQLITE_OMIT_DECLTYPE
#if SQLITE_OMIT_DECLTYPE
"OMIT_DECLTYPE",
#endif
#ifdef SQLITE_OMIT_DEPRECATED
#if SQLITE_OMIT_DEPRECATED
"OMIT_DEPRECATED",
#endif
#ifdef SQLITE_OMIT_DISKIO
#if SQLITE_OMIT_DISKIO
"OMIT_DISKIO",
#endif
#ifdef SQLITE_OMIT_EXPLAIN
#if SQLITE_OMIT_EXPLAIN
"OMIT_EXPLAIN",
#endif
#ifdef SQLITE_OMIT_FLAG_PRAGMAS
#if SQLITE_OMIT_FLAG_PRAGMAS
"OMIT_FLAG_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_FLOATING_POINT
#if SQLITE_OMIT_FLOATING_POINT
"OMIT_FLOATING_POINT",
#endif
#ifdef SQLITE_OMIT_FOREIGN_KEY
#if SQLITE_OMIT_FOREIGN_KEY
"OMIT_FOREIGN_KEY",
#endif
#ifdef SQLITE_OMIT_GET_TABLE
#if SQLITE_OMIT_GET_TABLE
"OMIT_GET_TABLE",
#endif
#ifdef SQLITE_OMIT_INCRBLOB
#if SQLITE_OMIT_INCRBLOB
"OMIT_INCRBLOB",
#endif
#ifdef SQLITE_OMIT_INTEGRITY_CHECK
#if SQLITE_OMIT_INTEGRITY_CHECK
"OMIT_INTEGRITY_CHECK",
#endif
#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
#if SQLITE_OMIT_LIKE_OPTIMIZATION
"OMIT_LIKE_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_LOAD_EXTENSION
#if SQLITE_OMIT_LOAD_EXTENSION
"OMIT_LOAD_EXTENSION",
#endif
#ifdef SQLITE_OMIT_LOCALTIME
#if SQLITE_OMIT_LOCALTIME
"OMIT_LOCALTIME",
#endif
#ifdef SQLITE_OMIT_LOOKASIDE
#if SQLITE_OMIT_LOOKASIDE
"OMIT_LOOKASIDE",
#endif
#ifdef SQLITE_OMIT_MEMORYDB
#if SQLITE_OMIT_MEMORYDB
"OMIT_MEMORYDB",
#endif
#ifdef SQLITE_OMIT_OR_OPTIMIZATION
#if SQLITE_OMIT_OR_OPTIMIZATION
"OMIT_OR_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_PAGER_PRAGMAS
#if SQLITE_OMIT_PAGER_PRAGMAS
"OMIT_PAGER_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_PRAGMA
#if SQLITE_OMIT_PRAGMA
"OMIT_PRAGMA",
#endif
#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
#if SQLITE_OMIT_PROGRESS_CALLBACK
"OMIT_PROGRESS_CALLBACK",
#endif
#ifdef SQLITE_OMIT_QUICKBALANCE
#if SQLITE_OMIT_QUICKBALANCE
"OMIT_QUICKBALANCE",
#endif
#ifdef SQLITE_OMIT_REINDEX
#if SQLITE_OMIT_REINDEX
"OMIT_REINDEX",
#endif
#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
#if SQLITE_OMIT_SCHEMA_PRAGMAS
"OMIT_SCHEMA_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
"OMIT_SCHEMA_VERSION_PRAGMAS",
#endif
#ifdef SQLITE_OMIT_SHARED_CACHE
#if SQLITE_OMIT_SHARED_CACHE
"OMIT_SHARED_CACHE",
#endif
#ifdef SQLITE_OMIT_SUBQUERY
#if SQLITE_OMIT_SUBQUERY
"OMIT_SUBQUERY",
#endif
#ifdef SQLITE_OMIT_TCL_VARIABLE
#if SQLITE_OMIT_TCL_VARIABLE
"OMIT_TCL_VARIABLE",
#endif
#ifdef SQLITE_OMIT_TEMPDB
#if SQLITE_OMIT_TEMPDB
"OMIT_TEMPDB",
#endif
#ifdef SQLITE_OMIT_TRACE
#if SQLITE_OMIT_TRACE
"OMIT_TRACE",
#endif
#ifdef SQLITE_OMIT_TRIGGER
#if SQLITE_OMIT_TRIGGER
"OMIT_TRIGGER",
#endif
#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION
"OMIT_TRUNCATE_OPTIMIZATION",
#endif
#ifdef SQLITE_OMIT_UTF16
#if SQLITE_OMIT_UTF16
"OMIT_UTF16",
#endif
#ifdef SQLITE_OMIT_VACUUM
#if SQLITE_OMIT_VACUUM
"OMIT_VACUUM",
#endif
#ifdef SQLITE_OMIT_VIEW
#if SQLITE_OMIT_VIEW
"OMIT_VIEW",
#endif
#ifdef SQLITE_OMIT_VIRTUALTABLE
#if SQLITE_OMIT_VIRTUALTABLE
"OMIT_VIRTUALTABLE",
#endif
#ifdef SQLITE_OMIT_WAL
#if SQLITE_OMIT_WAL
"OMIT_WAL",
#endif
#ifdef SQLITE_OMIT_WSD
#if SQLITE_OMIT_WSD
"OMIT_WSD",
#endif
#ifdef SQLITE_OMIT_XFER_OPT
#if SQLITE_OMIT_XFER_OPT
"OMIT_XFER_OPT",
#endif
#ifdef SQLITE_PERFORMANCE_TRACE
#if SQLITE_PERFORMANCE_TRACE
"PERFORMANCE_TRACE",
#endif
#ifdef SQLITE_PROXY_DEBUG
#if SQLITE_PROXY_DEBUG
"PROXY_DEBUG",
#endif
#ifdef SQLITE_RTREE_INT_ONLY
#if SQLITE_RTREE_INT_ONLY
"RTREE_INT_ONLY",
#endif
#ifdef SQLITE_SECURE_DELETE
#if SQLITE_SECURE_DELETE
"SECURE_DELETE",
#endif
#ifdef SQLITE_SMALL_STACK
#if SQLITE_SMALL_STACK
"SMALL_STACK",
#endif
#ifdef SQLITE_SOUNDEX
#if SQLITE_SOUNDEX
"SOUNDEX",
#endif
#ifdef SQLITE_SYSTEM_MALLOC
#if SQLITE_SYSTEM_MALLOC
"SYSTEM_MALLOC",
#endif
#ifdef SQLITE_TCL
#if SQLITE_TCL
"TCL",
#endif
#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)
"TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
#endif
#ifdef SQLITE_TEST
#if SQLITE_TEST
"TEST",
#endif
#if defined(SQLITE_THREADSAFE)
"THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
#endif
#ifdef SQLITE_USE_ALLOCA
#if SQLITE_USE_ALLOCA
"USE_ALLOCA",
#endif
#ifdef SQLITE_USER_AUTHENTICATION
#if SQLITE_USER_AUTHENTICATION
"USER_AUTHENTICATION",
#endif
#ifdef SQLITE_WIN32_MALLOC
#if SQLITE_WIN32_MALLOC
"WIN32_MALLOC",
#endif
#ifdef SQLITE_ZERO_MALLOC
#if SQLITE_ZERO_MALLOC
"ZERO_MALLOC"
#endif
};
@@ -392,7 +392,7 @@ static const char * const azCompileOpt[] = {
int sqlite3_compileoption_used(const char *zOptName){
int i, n;
#ifdef SQLITE_ENABLE_API_ARMOR
#if SQLITE_ENABLE_API_ARMOR
if( zOptName==0 ){
(void)SQLITE_MISUSE_BKPT;
return 0;
+9 -7
View File
@@ -412,8 +412,9 @@ static void clearYMD_HMS_TZ(DateTime *p){
** already, check for an MSVC build environment that provides
** localtime_s().
*/
#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S \
&& defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
#undef HAVE_LOCALTIME_S
#define HAVE_LOCALTIME_S 1
#endif
@@ -433,8 +434,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
*/
static int osLocaltime(time_t *t, struct tm *pTm){
int rc;
#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \
&& (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)
#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S
struct tm *pX;
#if SQLITE_THREADSAFE>0
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
@@ -451,7 +451,7 @@ static int osLocaltime(time_t *t, struct tm *pTm){
#ifndef SQLITE_OMIT_BUILTIN_TEST
if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
#endif
#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R
#if HAVE_LOCALTIME_R
rc = localtime_r(t, pTm)==0;
#else
rc = localtime_s(pTm, t);
@@ -895,8 +895,10 @@ static void strftimeFunc(
size_t i,j;
char *z;
sqlite3 *db;
const char *zFmt = (const char*)sqlite3_value_text(argv[0]);
const char *zFmt;
char zBuf[100];
if( argc==0 ) return;
zFmt = (const char*)sqlite3_value_text(argv[0]);
if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
db = sqlite3_context_db_handle(context);
for(i=0, n=1; zFmt[i]; i++, n++){
@@ -1090,7 +1092,7 @@ static void currentTimeFunc(
iT = sqlite3StmtCurrentTime(context);
if( iT<=0 ) return;
t = iT/1000 - 10000*(sqlite3_int64)21086676;
#ifdef HAVE_GMTIME_R
#if HAVE_GMTIME_R
pTm = gmtime_r(&t, &sNow);
#else
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
+2 -2
View File
@@ -226,8 +226,8 @@ void sqlite3DeleteFrom(
WhereInfo *pWInfo; /* Information about the WHERE clause */
Index *pIdx; /* For looping over indices of the table */
int iTabCur; /* Cursor number for the table */
int iDataCur; /* VDBE cursor for the canonical data source */
int iIdxCur; /* Cursor number of the first index */
int iDataCur = 0; /* VDBE cursor for the canonical data source */
int iIdxCur = 0; /* Cursor number of the first index */
int nIdx; /* Number of indices */
sqlite3 *db; /* Main database structure */
AuthContext sContext; /* Authorization context */
+4 -3
View File
@@ -515,7 +515,7 @@ Expr *sqlite3PExpr(
const Token *pToken /* Argument token */
){
Expr *p;
if( op==TK_AND && pLeft && pRight ){
if( op==TK_AND && pLeft && pRight && pParse->nErr==0 ){
/* Take advantage of short-circuit false optimization for AND */
p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
}else{
@@ -4069,10 +4069,11 @@ static int exprSrcCount(Walker *pWalker, Expr *pExpr){
int i;
struct SrcCount *p = pWalker->u.pSrcCount;
SrcList *pSrc = p->pSrc;
for(i=0; i<pSrc->nSrc; i++){
int nSrc = pSrc ? pSrc->nSrc : 0;
for(i=0; i<nSrc; i++){
if( pExpr->iTable==pSrc->a[i].iCursor ) break;
}
if( i<pSrc->nSrc ){
if( i<nSrc ){
p->nThis++;
}else{
p->nOther++;
+8
View File
@@ -152,6 +152,13 @@ const unsigned char sqlite3CtypeMap[256] = {
# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
#endif
/* The minimum PMA size is set to this value multiplied by the database
** page size in bytes.
*/
#ifndef SQLITE_SORTER_PMASZ
# define SQLITE_SORTER_PMASZ 250
#endif
/*
** The following singleton contains the global configuration for
** the SQLite library.
@@ -182,6 +189,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
0, /* nPage */
0, /* mxParserStack */
0, /* sharedCacheEnabled */
SQLITE_SORTER_PMASZ, /* szPma */
/* All the rest should always be initialized to zero */
0, /* isInit */
0, /* inProgress */
+20 -5
View File
@@ -62,7 +62,7 @@ int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
** I/O active are written using this function. These messages
** are intended for debugging activity only.
*/
void (*sqlite3IoTrace)(const char*, ...) = 0;
/* not-private */ void (*sqlite3IoTrace)(const char*, ...) = 0;
#endif
/*
@@ -271,6 +271,13 @@ int sqlite3_initialize(void){
** when this routine is invoked, then this routine is a harmless no-op.
*/
int sqlite3_shutdown(void){
#ifdef SQLITE_OMIT_WSD
int rc = sqlite3_wsd_init(4096, 24);
if( rc!=SQLITE_OK ){
return rc;
}
#endif
if( sqlite3GlobalConfig.isInit ){
#ifdef SQLITE_EXTRA_SHUTDOWN
void SQLITE_EXTRA_SHUTDOWN(void);
@@ -587,6 +594,11 @@ int sqlite3_config(int op, ...){
}
#endif
case SQLITE_CONFIG_PMASZ: {
sqlite3GlobalConfig.szPma = va_arg(ap, unsigned int);
break;
}
default: {
rc = SQLITE_ERROR;
break;
@@ -1338,7 +1350,7 @@ static int sqliteDefaultBusyCallback(
void *ptr, /* Database connection */
int count /* Number of times table has been busy */
){
#if SQLITE_OS_WIN || (defined(HAVE_USLEEP) && HAVE_USLEEP)
#if SQLITE_OS_WIN || HAVE_USLEEP
static const u8 delays[] =
{ 1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 100 };
static const u8 totals[] =
@@ -1954,6 +1966,7 @@ int sqlite3_wal_checkpoint_v2(
rc = SQLITE_ERROR;
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb);
}else{
db->busyHandler.nBusy = 0;
rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);
sqlite3Error(db, rc);
}
@@ -3128,7 +3141,7 @@ int sqlite3_table_column_metadata(
char *zErrMsg = 0;
Table *pTab = 0;
Column *pCol = 0;
int iCol;
int iCol = 0;
char const *zDataType = 0;
char const *zCollSeq = 0;
@@ -3659,13 +3672,14 @@ Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){
** connection.
*/
const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
Btree *pBt;
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
pBt = sqlite3DbNameToBtree(db, zDbName);
return pBt ? sqlite3BtreeGetFilename(pBt) : 0;
}
@@ -3674,12 +3688,13 @@ const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){
** no such database exists.
*/
int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
Btree *pBt;
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) ){
(void)SQLITE_MISUSE_BKPT;
return -1;
}
#endif
Btree *pBt = sqlite3DbNameToBtree(db, zDbName);
pBt = sqlite3DbNameToBtree(db, zDbName);
return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;
}
+3 -3
View File
@@ -79,9 +79,9 @@ static malloc_zone_t* _sqliteZone_;
** The malloc.h header file is needed for malloc_usable_size() function
** on some systems (e.g. Linux).
*/
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)
# define SQLITE_USE_MALLOC_H
# define SQLITE_USE_MALLOC_USABLE_SIZE
#if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE
# define SQLITE_USE_MALLOC_H 1
# define SQLITE_USE_MALLOC_USABLE_SIZE 1
/*
** The MSVCRT has malloc_usable_size(), but it is called _msize(). The
** use of _msize() is automatic, but can be disabled by compiling with
+35
View File
@@ -0,0 +1,35 @@
/*
** 2015 January 12
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to MSVC.
*/
#ifndef _MSVC_H_
#define _MSVC_H_
#if defined(_MSC_VER)
#pragma warning(disable : 4054)
#pragma warning(disable : 4055)
#pragma warning(disable : 4100)
#pragma warning(disable : 4127)
#pragma warning(disable : 4152)
#pragma warning(disable : 4189)
#pragma warning(disable : 4206)
#pragma warning(disable : 4210)
#pragma warning(disable : 4232)
#pragma warning(disable : 4244)
#pragma warning(disable : 4305)
#pragma warning(disable : 4306)
#pragma warning(disable : 4702)
#pragma warning(disable : 4706)
#endif /* defined(_MSC_VER) */
#endif /* _MSVC_H_ */
+6
View File
@@ -209,6 +209,12 @@ static sqlite3_mutex *winMutexAlloc(int iType){
break;
}
default: {
#ifdef SQLITE_ENABLE_API_ARMOR
if( iType-2<0 || iType-2>=ArraySize(winMutex_staticMutexes) ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
assert( iType-2 >= 0 );
assert( iType-2 < ArraySize(winMutex_staticMutexes) );
assert( winMutex_isInit==1 );
+18 -14
View File
@@ -3386,9 +3386,9 @@ int sqlite3_fullsync_count = 0;
** We do not trust systems to provide a working fdatasync(). Some do.
** Others do no. To be safe, we will stick with the (slightly slower)
** fsync(). If you know that your system does support fdatasync() correctly,
** then simply compile with -Dfdatasync=fdatasync
** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC
*/
#if !defined(fdatasync)
#if !defined(fdatasync) && !HAVE_FDATASYNC
# define fdatasync fsync
#endif
@@ -3709,24 +3709,28 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
}while( err==EINTR );
if( err ) return SQLITE_IOERR_WRITE;
#else
/* If the OS does not have posix_fallocate(), fake it. First use
** ftruncate() to set the file size, then write a single byte to
** the last byte in each block within the extended region. This
** is the same technique used by glibc to implement posix_fallocate()
** on systems that do not have a real fallocate() system call.
/* If the OS does not have posix_fallocate(), fake it. Write a
** single byte to the last byte in each block that falls entirely
** within the extended region. Then, if required, a single byte
** at offset (nSize-1), to set the size of the file correctly.
** This is a similar technique to that used by glibc on systems
** that do not have a real fallocate() call.
*/
int nBlk = buf.st_blksize; /* File-system block size */
int nWrite = 0; /* Number of bytes written by seekAndWrite */
i64 iWrite; /* Next offset to write to */
if( robust_ftruncate(pFile->h, nSize) ){
pFile->lastErrno = errno;
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
}
iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1;
while( iWrite<nSize ){
int nWrite = seekAndWrite(pFile, iWrite, "", 1);
assert( iWrite>=buf.st_size );
assert( (iWrite/nBlk)==((buf.st_size+nBlk-1)/nBlk) );
assert( ((iWrite+1)%nBlk)==0 );
for(/*no-op*/; iWrite<nSize; iWrite+=nBlk ){
nWrite = seekAndWrite(pFile, iWrite, "", 1);
if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
}
if( nWrite==0 || (nSize%nBlk) ){
nWrite = seekAndWrite(pFile, nSize-1, "", 1);
if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
iWrite += nBlk;
}
#endif
}
+7 -7
View File
@@ -2479,7 +2479,7 @@ static int winRead(
int amt, /* Number of bytes to read */
sqlite3_int64 offset /* Begin reading at this offset */
){
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
OVERLAPPED overlapped; /* The offset for ReadFile. */
#endif
winFile *pFile = (winFile*)id; /* file handle */
@@ -2511,7 +2511,7 @@ static int winRead(
}
#endif
#if SQLITE_OS_WINCE
#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
if( winSeekFile(pFile, offset) ){
OSTRACE(("READ file=%p, rc=SQLITE_FULL\n", pFile->h));
return SQLITE_FULL;
@@ -2583,13 +2583,13 @@ static int winWrite(
}
#endif
#if SQLITE_OS_WINCE
#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
rc = winSeekFile(pFile, offset);
if( rc==0 ){
#else
{
#endif
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
OVERLAPPED overlapped; /* The offset for WriteFile. */
#endif
u8 *aRem = (u8 *)pBuf; /* Data yet to be written */
@@ -2597,14 +2597,14 @@ static int winWrite(
DWORD nWrite; /* Bytes written by each WriteFile() call */
DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
memset(&overlapped, 0, sizeof(OVERLAPPED));
overlapped.Offset = (LONG)(offset & 0xffffffff);
overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff);
#endif
while( nRem>0 ){
#if SQLITE_OS_WINCE
#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){
#else
if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, &overlapped) ){
@@ -2617,7 +2617,7 @@ static int winWrite(
lastErrno = osGetLastError();
break;
}
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
offset += nWrite;
overlapped.Offset = (LONG)(offset & 0xffffffff);
overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff);
+22 -12
View File
@@ -646,6 +646,8 @@ struct Pager {
u8 setMaster; /* True if a m-j name has been written to jrnl */
u8 doNotSpill; /* Do not spill the cache when non-zero */
u8 subjInMemory; /* True to use in-memory sub-journals */
u8 bUseFetch; /* True to use xFetch() */
u8 hasBeenUsed; /* True if any content previously read from this pager*/
Pgno dbSize; /* Number of pages in the database */
Pgno dbOrigSize; /* dbSize before the current transaction */
Pgno dbFileSize; /* Number of pages in the database file */
@@ -663,9 +665,9 @@ struct Pager {
sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */
PagerSavepoint *aSavepoint; /* Array of active savepoints */
int nSavepoint; /* Number of elements in aSavepoint[] */
u32 iDataVersion; /* Changes whenever database content changes */
char dbFileVers[16]; /* Changes whenever database file changes */
u8 bUseFetch; /* True to use xFetch() */
int nMmapOut; /* Number of mmap pages currently outstanding */
sqlite3_int64 szMmap; /* Desired maximum mmap size */
PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */
@@ -1681,10 +1683,19 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
** Discard the entire contents of the in-memory page-cache.
*/
static void pager_reset(Pager *pPager){
pPager->iDataVersion++;
sqlite3BackupRestart(pPager->pBackup);
sqlite3PcacheClear(pPager->pPCache);
}
/*
** Return the pPager->iDataVersion value
*/
u32 sqlite3PagerDataVersion(Pager *pPager){
assert( pPager->eState>PAGER_OPEN );
return pPager->iDataVersion;
}
/*
** Free all structures in the Pager.aSavepoint[] array and set both
** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal
@@ -3887,7 +3898,7 @@ static int pagerAcquireMapPage(
PgHdr **ppPage /* OUT: Acquired page object */
){
PgHdr *p; /* Memory mapped page to return */
if( pPager->pMmapFreelist ){
*ppPage = p = pPager->pMmapFreelist;
pPager->pMmapFreelist = p->pDirty;
@@ -5118,16 +5129,12 @@ int sqlite3PagerSharedLock(Pager *pPager){
);
}
if( !pPager->tempFile && (
pPager->pBackup
|| sqlite3PcachePagecount(pPager->pPCache)>0
|| USEFETCH(pPager)
)){
/* The shared-lock has just been acquired on the database file
** and there are already pages in the cache (from a previous
** read or write transaction). Check to see if the database
** has been modified. If the database has changed, flush the
** cache.
if( !pPager->tempFile && pPager->hasBeenUsed ){
/* The shared-lock has just been acquired then check to
** see if the database has been modified. If the database has changed,
** flush the cache. The pPager->hasBeenUsed flag prevents this from
** occurring on the very first access to a file, in order to save a
** single unnecessary sqlite3OsRead() call at the start-up.
**
** Database changes is detected by looking at 15 bytes beginning
** at offset 24 into the file. The first 4 of these 16 bytes are
@@ -5292,6 +5299,7 @@ int sqlite3PagerAcquire(
if( pgno==0 ){
return SQLITE_CORRUPT_BKPT;
}
pPager->hasBeenUsed = 1;
/* If the pager is in the error state, return an error immediately.
** Otherwise, request the page from the PCache layer. */
@@ -5441,6 +5449,7 @@ DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
assert( pgno!=0 );
assert( pPager->pPCache!=0 );
pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0);
assert( pPage==0 || pPager->hasBeenUsed );
return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage);
}
@@ -6307,6 +6316,7 @@ int sqlite3PagerCommitPhaseTwo(Pager *pPager){
}
PAGERTRACE(("COMMIT %d\n", PAGERID(pPager)));
pPager->iDataVersion++;
rc = pager_end_transaction(pPager, pPager->setMaster, 1);
return pager_error(pPager, rc);
}
+1
View File
@@ -172,6 +172,7 @@ int sqlite3PagerSharedLock(Pager *pPager);
/* Functions used to query pager state and configuration. */
u8 sqlite3PagerIsreadonly(Pager*);
u32 sqlite3PagerDataVersion(Pager*);
int sqlite3PagerRefcount(Pager*);
int sqlite3PagerMemUsed(Pager*);
const char *sqlite3PagerFilename(Pager*, int);
+8 -2
View File
@@ -415,13 +415,19 @@ select(A) ::= with(W) selectnowith(X). {
int cnt = 0, mxSelect;
p->pWith = W;
if( p->pPrior ){
u16 allValues = SF_Values;
pNext = 0;
for(pLoop=p; pLoop; pNext=pLoop, pLoop=pLoop->pPrior, cnt++){
pLoop->pNext = pNext;
pLoop->selFlags |= SF_Compound;
allValues &= pLoop->selFlags;
}
mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT];
if( mxSelect && cnt>mxSelect ){
if( allValues ){
p->selFlags |= SF_AllValues;
}else if(
(mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0
&& cnt>mxSelect
){
sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
}
}
+3 -14
View File
@@ -31,18 +31,6 @@ struct PCache {
PgHdr *pPage1; /* Reference to page 1 */
};
/*
** Some of the assert() macros in this code are too expensive to run
** even during normal debugging. Use them only rarely on long-running
** tests. Enable the expensive asserts using the
** -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 compile-time option.
*/
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
# define expensive_assert(X) assert(X)
#else
# define expensive_assert(X)
#endif
/********************************** Linked List Management ********************/
/* Allowed values for second argument to pcacheManageDirtyList() */
@@ -196,7 +184,8 @@ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
if( pCache->szPage ){
sqlite3_pcache *pNew;
pNew = sqlite3GlobalConfig.pcache2.xCreate(
szPage, pCache->szExtra + sizeof(PgHdr), pCache->bPurgeable
szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)),
pCache->bPurgeable
);
if( pNew==0 ) return SQLITE_NOMEM;
sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));
@@ -655,7 +644,7 @@ void sqlite3PcacheShrink(PCache *pCache){
** Return the size of the header added by this middleware layer
** in the page-cache hierarchy.
*/
int sqlite3HeaderSizePcache(void){ return sizeof(PgHdr); }
int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); }
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
+2 -2
View File
@@ -296,7 +296,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
pPg = 0;
}
#else
pPg = pcache1Alloc(sizeof(PgHdr1) + pCache->szPage + pCache->szExtra);
pPg = pcache1Alloc(ROUND8(sizeof(PgHdr1)) + pCache->szPage + pCache->szExtra);
p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];
#endif
pcache1EnterMutex(pCache->pGroup);
@@ -984,7 +984,7 @@ void sqlite3PCacheSetDefault(void){
/*
** Return the size of the header on each page of this PCACHE implementation.
*/
int sqlite3HeaderSizePcache1(void){ return sizeof(PgHdr1); }
int sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); }
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/*
+16 -24
View File
@@ -71,6 +71,7 @@
#define PragTyp_LOCK_STATUS 40
#define PragTyp_PARSER_TRACE 41
#define PragFlag_NeedSchema 0x01
#define PragFlag_ReadOnly 0x02
static const struct sPragmaNames {
const char *const zName; /* Name of pragma */
u8 ePragTyp; /* PragTyp_XXX value */
@@ -87,7 +88,7 @@ static const struct sPragmaNames {
{ /* zName: */ "application_id",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
/* iArg: */ BTREE_APPLICATION_ID },
#endif
#if !defined(SQLITE_OMIT_AUTOVACUUM)
{ /* zName: */ "auto_vacuum",
@@ -153,6 +154,12 @@ static const struct sPragmaNames {
/* ePragFlag: */ 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "data_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ PragFlag_ReadOnly,
/* iArg: */ BTREE_DATA_VERSION },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST,
@@ -208,8 +215,8 @@ static const struct sPragmaNames {
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "freelist_count",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
/* ePragFlag: */ PragFlag_ReadOnly,
/* iArg: */ BTREE_FREE_PAGE_COUNT },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "full_column_names",
@@ -361,7 +368,7 @@ static const struct sPragmaNames {
{ /* zName: */ "schema_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
/* iArg: */ BTREE_SCHEMA_VERSION },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "secure_delete",
@@ -427,7 +434,7 @@ static const struct sPragmaNames {
{ /* zName: */ "user_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
/* iArg: */ BTREE_USER_VERSION },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if defined(SQLITE_DEBUG)
@@ -470,7 +477,7 @@ static const struct sPragmaNames {
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
#endif
};
/* Number of pragmas: 57 on by default, 70 total. */
/* Number of pragmas: 58 on by default, 71 total. */
/* End of the automatically generated pragma table.
***************************************************************************/
@@ -720,7 +727,7 @@ void sqlite3Pragma(
Token *pId; /* Pointer to <id> token */
char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */
int iDb; /* Database index for <database> */
int lwr, upr, mid; /* Binary search bounds */
int lwr, upr, mid = 0; /* Binary search bounds */
int rc; /* return value form SQLITE_FCNTL_PRAGMA */
sqlite3 *db = pParse->db; /* The database connection */
Db *pDb; /* The specific database being pragmaed */
@@ -2126,24 +2133,9 @@ void sqlite3Pragma(
** applications for any purpose.
*/
case PragTyp_HEADER_VALUE: {
int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */
int iCookie = aPragmaNames[mid].iArg; /* Which cookie to read or write */
sqlite3VdbeUsesBtree(v, iDb);
switch( zLeft[0] ){
case 'a': case 'A':
iCookie = BTREE_APPLICATION_ID;
break;
case 'f': case 'F':
iCookie = BTREE_FREE_PAGE_COUNT;
break;
case 's': case 'S':
iCookie = BTREE_SCHEMA_VERSION;
break;
default:
iCookie = BTREE_USER_VERSION;
break;
}
if( zRight && iCookie!=BTREE_FREE_PAGE_COUNT ){
if( zRight && (aPragmaNames[mid].mPragFlag & PragFlag_ReadOnly)==0 ){
/* Write the specified cookie value */
static const VdbeOpList setCookie[] = {
{ OP_Transaction, 0, 1, 0}, /* 0 */
-11
View File
@@ -14,17 +14,6 @@
*/
#include "sqliteInt.h"
/*
** If the strchrnul() library function is available, then set
** HAVE_STRCHRNUL. If that routine is not available, this module
** will supply its own. The built-in version is slower than
** the glibc version so the glibc version is definitely preferred.
*/
#if !defined(HAVE_STRCHRNUL)
# define HAVE_STRCHRNUL 0
#endif
/*
** Conversion types fall into various categories as defined by the
** following enumeration.
+100 -31
View File
@@ -58,20 +58,25 @@ struct SortCtx {
#define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */
/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
** Delete all the content of a Select structure. Deallocate the structure
** itself only if bFree is true.
*/
static void clearSelect(sqlite3 *db, Select *p){
sqlite3ExprListDelete(db, p->pEList);
sqlite3SrcListDelete(db, p->pSrc);
sqlite3ExprDelete(db, p->pWhere);
sqlite3ExprListDelete(db, p->pGroupBy);
sqlite3ExprDelete(db, p->pHaving);
sqlite3ExprListDelete(db, p->pOrderBy);
sqlite3SelectDelete(db, p->pPrior);
sqlite3ExprDelete(db, p->pLimit);
sqlite3ExprDelete(db, p->pOffset);
sqlite3WithDelete(db, p->pWith);
static void clearSelect(sqlite3 *db, Select *p, int bFree){
while( p ){
Select *pPrior = p->pPrior;
sqlite3ExprListDelete(db, p->pEList);
sqlite3SrcListDelete(db, p->pSrc);
sqlite3ExprDelete(db, p->pWhere);
sqlite3ExprListDelete(db, p->pGroupBy);
sqlite3ExprDelete(db, p->pHaving);
sqlite3ExprListDelete(db, p->pOrderBy);
sqlite3ExprDelete(db, p->pLimit);
sqlite3ExprDelete(db, p->pOffset);
sqlite3WithDelete(db, p->pWith);
if( bFree ) sqlite3DbFree(db, p);
p = pPrior;
bFree = 1;
}
}
/*
@@ -130,8 +135,7 @@ Select *sqlite3SelectNew(
pNew->addrOpenEphm[0] = -1;
pNew->addrOpenEphm[1] = -1;
if( db->mallocFailed ) {
clearSelect(db, pNew);
if( pNew!=&standin ) sqlite3DbFree(db, pNew);
clearSelect(db, pNew, pNew!=&standin);
pNew = 0;
}else{
assert( pNew->pSrc!=0 || pParse->nErr>0 );
@@ -156,10 +160,7 @@ void sqlite3SelectSetName(Select *p, const char *zName){
** Delete the given Select structure and all of its substructures.
*/
void sqlite3SelectDelete(sqlite3 *db, Select *p){
if( p ){
clearSelect(db, p);
sqlite3DbFree(db, p);
}
clearSelect(db, p, 1);
}
/*
@@ -542,7 +543,9 @@ static void pushOntoSorter(
pKI = pOp->p4.pKeyInfo;
memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */
sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);
pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat, 1);
testcase( pKI->nXField>2 );
pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat,
pKI->nXField-1);
addrJmp = sqlite3VdbeCurrentAddr(v);
sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);
pSort->labelBkOut = sqlite3VdbeMakeLabel(v);
@@ -1053,7 +1056,7 @@ static KeyInfo *keyInfoFromExprList(
int i;
nExpr = pList->nExpr;
pInfo = sqlite3KeyInfoAlloc(db, nExpr+nExtra-iStart, 1);
pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1);
if( pInfo ){
assert( sqlite3KeyInfoIsWriteable(pInfo) );
for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){
@@ -2075,6 +2078,66 @@ static int multiSelectOrderBy(
SelectDest *pDest /* What to do with query results */
);
/*
** Error message for when two or more terms of a compound select have different
** size result sets.
*/
static void selectWrongNumTermsError(Parse *pParse, Select *p){
if( p->selFlags & SF_Values ){
sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms");
}else{
sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
" do not have the same number of result columns", selectOpName(p->op));
}
}
/*
** Handle the special case of a compound-select that originates from a
** VALUES clause. By handling this as a special case, we avoid deep
** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT
** on a VALUES clause.
**
** Because the Select object originates from a VALUES clause:
** (1) It has no LIMIT or OFFSET
** (2) All terms are UNION ALL
** (3) There is no ORDER BY clause
*/
static int multiSelectValues(
Parse *pParse, /* Parsing context */
Select *p, /* The right-most of SELECTs to be coded */
SelectDest *pDest /* What to do with query results */
){
Select *pPrior;
int nExpr = p->pEList->nExpr;
int nRow = 1;
int rc = 0;
assert( p->pNext==0 );
assert( p->selFlags & SF_AllValues );
do{
assert( p->selFlags & SF_Values );
assert( p->op==TK_ALL || (p->op==TK_SELECT && p->pPrior==0) );
assert( p->pLimit==0 );
assert( p->pOffset==0 );
if( p->pEList->nExpr!=nExpr ){
selectWrongNumTermsError(pParse, p);
return 1;
}
if( p->pPrior==0 ) break;
assert( p->pPrior->pNext==p );
p = p->pPrior;
nRow++;
}while(1);
while( p ){
pPrior = p->pPrior;
p->pPrior = 0;
rc = sqlite3Select(pParse, p, pDest);
p->pPrior = pPrior;
if( rc ) break;
p->nSelectRow = nRow;
p = p->pNext;
}
return rc;
}
/*
** This routine is called to process a compound query form from
@@ -2156,17 +2219,19 @@ static int multiSelect(
dest.eDest = SRT_Table;
}
/* Special handling for a compound-select that originates as a VALUES clause.
*/
if( p->selFlags & SF_AllValues ){
rc = multiSelectValues(pParse, p, &dest);
goto multi_select_end;
}
/* Make sure all SELECTs in the statement have the same number of elements
** in their result sets.
*/
assert( p->pEList && pPrior->pEList );
if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
if( p->selFlags & SF_Values ){
sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms");
}else{
sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
" do not have the same number of result columns", selectOpName(p->op));
}
selectWrongNumTermsError(pParse, p);
rc = 1;
goto multi_select_end;
}
@@ -4052,7 +4117,9 @@ static int selectExpander(Walker *pWalker, Select *p){
}
pTabList = p->pSrc;
pEList = p->pEList;
sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);
if( pWalker->xSelectCallback2==selectPopWith ){
sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);
}
/* Make sure cursor numbers have been assigned to all entries in
** the FROM clause of the SELECT statement.
@@ -4343,7 +4410,9 @@ static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
sqlite3WalkSelect(&w, pSelect);
}
w.xSelectCallback = selectExpander;
w.xSelectCallback2 = selectPopWith;
if( (pSelect->selFlags & SF_AllValues)==0 ){
w.xSelectCallback2 = selectPopWith;
}
sqlite3WalkSelect(&w, pSelect);
}
@@ -4857,7 +4926,7 @@ int sqlite3Select(
*/
if( sSort.pOrderBy ){
KeyInfo *pKeyInfo;
pKeyInfo = keyInfoFromExprList(pParse, sSort.pOrderBy, 0, 0);
pKeyInfo = keyInfoFromExprList(pParse, sSort.pOrderBy, 0, pEList->nExpr);
sSort.iECursor = pParse->nTab++;
sSort.addrSortIndex =
sqlite3VdbeAddOp4(v, OP_OpenEphemeral,
@@ -5031,7 +5100,7 @@ int sqlite3Select(
** will be converted into a Noop.
*/
sAggInfo.sortingIdx = pParse->nTab++;
pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, 0);
pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, sAggInfo.nColumn);
addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen,
sAggInfo.sortingIdx, sAggInfo.nSortingColumn,
0, (char*)pKeyInfo, P4_KEYINFO);
+292 -144
View File
@@ -17,6 +17,13 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
/*
** If requested, include the SQLite compiler options file for MSVC.
*/
#if defined(INCLUDE_MSVC_H)
#include "msvc.h"
#endif
/*
** Enable large-file support for fopen() and friends on unix.
*/
@@ -48,23 +55,42 @@
# include <sys/types.h>
#endif
#if defined(HAVE_READLINE) && HAVE_READLINE!=0
#if HAVE_READLINE
# include <readline/readline.h>
# include <readline/history.h>
#else
# undef HAVE_READLINE
#endif
#if defined(HAVE_EDITLINE) && !defined(HAVE_READLINE)
# define HAVE_READLINE 1
#if HAVE_EDITLINE
# include <editline/readline.h>
#endif
#if !defined(HAVE_READLINE)
# define add_history(X)
# define read_history(X)
# define write_history(X)
# define stifle_history(X)
#if HAVE_EDITLINE || HAVE_READLINE
# define shell_add_history(X) add_history(X)
# define shell_read_history(X) read_history(X)
# define shell_write_history(X) write_history(X)
# define shell_stifle_history(X) stifle_history(X)
# define shell_readline(X) readline(X)
#elif HAVE_LINENOISE
# include "linenoise.h"
# define shell_add_history(X) linenoiseHistoryAdd(X)
# define shell_read_history(X) linenoiseHistoryLoad(X)
# define shell_write_history(X) linenoiseHistorySave(X)
# define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
# define shell_readline(X) linenoise(X)
#else
# define shell_read_history(X)
# define shell_write_history(X)
# define shell_stifle_history(X)
# define SHELL_USE_LOCAL_GETLINE 1
#endif
#if defined(_WIN32) || defined(WIN32)
# include <io.h>
# include <fcntl.h>
@@ -425,14 +451,14 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
zResult = local_getline(zPrior, in);
}else{
zPrompt = isContinuation ? continuePrompt : mainPrompt;
#if defined(HAVE_READLINE)
free(zPrior);
zResult = readline(zPrompt);
if( zResult && *zResult ) add_history(zResult);
#else
#if SHELL_USE_LOCAL_GETLINE
printf("%s", zPrompt);
fflush(stdout);
zResult = local_getline(zPrior, stdin);
#else
free(zPrior);
zResult = shell_readline(zPrompt);
if( zResult && *zResult ) shell_add_history(zResult);
#endif
}
return zResult;
@@ -471,11 +497,11 @@ struct ShellState {
int showHeader; /* True to show column names in List or Column mode */
unsigned shellFlgs; /* Various flags */
char *zDestTable; /* Name of destination table when MODE_Insert */
char separator[20]; /* Separator character for MODE_List */
char newline[20]; /* Record separator in MODE_Csv */
char colSeparator[20]; /* Column separator character for several modes */
char rowSeparator[20]; /* Row separator character for MODE_Ascii */
int colWidth[100]; /* Requested width of each column when in column mode*/
int actualWidth[100]; /* Actual width of each column */
char nullvalue[20]; /* The text to print when a NULL comes back from
char nullValue[20]; /* The text to print when a NULL comes back from
** the database */
SavedModeInfo normalMode;/* Holds the mode just before .explain ON */
char outfile[FILENAME_MAX]; /* Filename for *out */
@@ -508,6 +534,7 @@ struct ShellState {
#define MODE_Tcl 6 /* Generate ANSI-C or TCL quoted elements */
#define MODE_Csv 7 /* Quote strings, numbers are plain */
#define MODE_Explain 8 /* Like MODE_Column, but do not truncate data */
#define MODE_Ascii 9 /* Use ASCII unit and record separators (0x1F/0x1E) */
static const char *modeDescr[] = {
"line",
@@ -519,8 +546,22 @@ static const char *modeDescr[] = {
"tcl",
"csv",
"explain",
"ascii",
};
/*
** These are the column/row/line separators used by the various
** import/export modes.
*/
#define SEP_Column "|"
#define SEP_Row "\n"
#define SEP_Tab "\t"
#define SEP_Space " "
#define SEP_Comma ","
#define SEP_CrLf "\r\n"
#define SEP_Unit "\x1F"
#define SEP_Record "\x1E"
/*
** Number of elements in an array
*/
@@ -677,22 +718,22 @@ static const char needCsvQuote[] = {
};
/*
** Output a single term of CSV. Actually, p->separator is used for
** the separator, which may or may not be a comma. p->nullvalue is
** Output a single term of CSV. Actually, p->colSeparator is used for
** the separator, which may or may not be a comma. p->nullValue is
** the null value. Strings are quoted if necessary. The separator
** is only issued if bSep is true.
*/
static void output_csv(ShellState *p, const char *z, int bSep){
FILE *out = p->out;
if( z==0 ){
fprintf(out,"%s",p->nullvalue);
fprintf(out,"%s",p->nullValue);
}else{
int i;
int nSep = strlen30(p->separator);
int nSep = strlen30(p->colSeparator);
for(i=0; z[i]; i++){
if( needCsvQuote[((unsigned char*)z)[i]]
|| (z[i]==p->separator[0] &&
(nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
|| (z[i]==p->colSeparator[0] &&
(nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
i = 0;
break;
}
@@ -709,7 +750,7 @@ static void output_csv(ShellState *p, const char *z, int bSep){
}
}
if( bSep ){
fprintf(p->out, "%s", p->separator);
fprintf(p->out, "%s", p->colSeparator);
}
}
@@ -747,10 +788,10 @@ static int shell_callback(
int len = strlen30(azCol[i] ? azCol[i] : "");
if( len>w ) w = len;
}
if( p->cnt++>0 ) fprintf(p->out,"\n");
if( p->cnt++>0 ) fprintf(p->out, "%s", p->rowSeparator);
for(i=0; i<nArg; i++){
fprintf(p->out,"%*s = %s\n", w, azCol[i],
azArg[i] ? azArg[i] : p->nullvalue);
fprintf(p->out,"%*s = %s%s", w, azCol[i],
azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator);
}
break;
}
@@ -767,7 +808,7 @@ static int shell_callback(
if( w==0 ){
w = strlen30(azCol[i] ? azCol[i] : "");
if( w<10 ) w = 10;
n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullValue);
if( w<n ) w = n;
}
if( i<ArraySize(p->actualWidth) ){
@@ -775,9 +816,11 @@ static int shell_callback(
}
if( p->showHeader ){
if( w<0 ){
fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": " ");
fprintf(p->out,"%*.*s%s",-w,-w,azCol[i],
i==nArg-1 ? p->rowSeparator : " ");
}else{
fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": " ");
fprintf(p->out,"%-*.*s%s",w,w,azCol[i],
i==nArg-1 ? p->rowSeparator : " ");
}
}
}
@@ -792,7 +835,7 @@ static int shell_callback(
}
fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
"----------------------------------------------------------",
i==nArg-1 ? "\n": " ");
i==nArg-1 ? p->rowSeparator : " ");
}
}
}
@@ -815,10 +858,12 @@ static int shell_callback(
}
if( w<0 ){
fprintf(p->out,"%*.*s%s",-w,-w,
azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " ");
azArg[i] ? azArg[i] : p->nullValue,
i==nArg-1 ? p->rowSeparator : " ");
}else{
fprintf(p->out,"%-*.*s%s",w,w,
azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " ");
azArg[i] ? azArg[i] : p->nullValue,
i==nArg-1 ? p->rowSeparator : " ");
}
}
break;
@@ -827,20 +872,21 @@ static int shell_callback(
case MODE_List: {
if( p->cnt++==0 && p->showHeader ){
for(i=0; i<nArg; i++){
fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
fprintf(p->out,"%s%s",azCol[i],
i==nArg-1 ? p->rowSeparator : p->colSeparator);
}
}
if( azArg==0 ) break;
for(i=0; i<nArg; i++){
char *z = azArg[i];
if( z==0 ) z = p->nullvalue;
if( z==0 ) z = p->nullValue;
fprintf(p->out, "%s", z);
if( i<nArg-1 ){
fprintf(p->out, "%s", p->separator);
fprintf(p->out, "%s", p->colSeparator);
}else if( p->mode==MODE_Semi ){
fprintf(p->out, ";\n");
fprintf(p->out, ";%s", p->rowSeparator);
}else{
fprintf(p->out, "\n");
fprintf(p->out, "%s", p->rowSeparator);
}
}
break;
@@ -859,7 +905,7 @@ static int shell_callback(
fprintf(p->out,"<TR>");
for(i=0; i<nArg; i++){
fprintf(p->out,"<TD>");
output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
fprintf(p->out,"</TD>\n");
}
fprintf(p->out,"</TR>\n");
@@ -869,16 +915,16 @@ static int shell_callback(
if( p->cnt++==0 && p->showHeader ){
for(i=0; i<nArg; i++){
output_c_string(p->out,azCol[i] ? azCol[i] : "");
if(i<nArg-1) fprintf(p->out, "%s", p->separator);
if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
}
fprintf(p->out,"\n");
fprintf(p->out, "%s", p->rowSeparator);
}
if( azArg==0 ) break;
for(i=0; i<nArg; i++){
output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
if(i<nArg-1) fprintf(p->out, "%s", p->separator);
output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
}
fprintf(p->out,"\n");
fprintf(p->out, "%s", p->rowSeparator);
break;
}
case MODE_Csv: {
@@ -890,13 +936,13 @@ static int shell_callback(
for(i=0; i<nArg; i++){
output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
}
fprintf(p->out,"%s",p->newline);
fprintf(p->out, "%s", p->rowSeparator);
}
if( nArg>0 ){
for(i=0; i<nArg; i++){
output_csv(p, azArg[i], i<nArg-1);
}
fprintf(p->out,"%s",p->newline);
fprintf(p->out, "%s", p->rowSeparator);
}
#if defined(WIN32) || defined(_WIN32)
fflush(p->out);
@@ -933,6 +979,22 @@ static int shell_callback(
fprintf(p->out,");\n");
break;
}
case MODE_Ascii: {
if( p->cnt++==0 && p->showHeader ){
for(i=0; i<nArg; i++){
if( i>0 ) fprintf(p->out, "%s", p->colSeparator);
fprintf(p->out,"%s",azCol[i] ? azCol[i] : "");
}
fprintf(p->out, "%s", p->rowSeparator);
}
if( azArg==0 ) break;
for(i=0; i<nArg; i++){
if( i>0 ) fprintf(p->out, "%s", p->colSeparator);
fprintf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
}
fprintf(p->out, "%s", p->rowSeparator);
break;
}
}
return 0;
}
@@ -1698,12 +1760,13 @@ static char zHelp[] =
#endif
".log FILE|off Turn logging on or off. FILE can be stderr/stdout\n"
".mode MODE ?TABLE? Set output mode where MODE is one of:\n"
" ascii Columns/rows delimited by 0x1F and 0x1E\n"
" csv Comma-separated values\n"
" column Left-aligned columns. (See .width)\n"
" html HTML <table> code\n"
" insert SQL insert statements for TABLE\n"
" line One value per line\n"
" list Values delimited by .separator string\n"
" list Values delimited by .separator strings\n"
" tabs Tab-separated values\n"
" tcl TCL list elements\n"
".nullvalue STRING Use STRING in place of NULL values\n"
@@ -1720,8 +1783,8 @@ static char zHelp[] =
".schema ?TABLE? Show the CREATE statements\n"
" If TABLE specified, only show tables matching\n"
" LIKE pattern TABLE.\n"
".separator STRING ?NL? Change separator used by output mode and .import\n"
" NL is the end-of-line mark for CSV\n"
".separator COL ?ROW? Change the column separator and optionally the row\n"
" separator for both the output mode and .import\n"
".shell CMD ARGS... Run CMD ARGS... in a system shell\n"
".show Show the current values for various settings\n"
".stats on|off Turn stats on or off\n"
@@ -2002,10 +2065,10 @@ static void test_breakpoint(void){
}
/*
** An object used to read a CSV file
** An object used to read a CSV and other files for import.
*/
typedef struct CSVReader CSVReader;
struct CSVReader {
typedef struct ImportCtx ImportCtx;
struct ImportCtx {
const char *zFile; /* Name of the input file */
FILE *in; /* Read the CSV text from this input stream */
char *z; /* Accumulated text for a field */
@@ -2013,11 +2076,12 @@ struct CSVReader {
int nAlloc; /* Space allocated for z[] */
int nLine; /* Current line number */
int cTerm; /* Character that terminated the most recent field */
int cSeparator; /* The separator character. (Usually ",") */
int cColSep; /* The column separator character. (Usually ",") */
int cRowSep; /* The row separator character. (Usually "\n") */
};
/* Append a single byte to z[] */
static void csv_append_char(CSVReader *p, int c){
static void import_append_char(ImportCtx *p, int c){
if( p->n+1>=p->nAlloc ){
p->nAlloc += p->nAlloc + 100;
p->z = sqlite3_realloc(p->z, p->nAlloc);
@@ -2035,15 +2099,17 @@ static void csv_append_char(CSVReader *p, int c){
** + Input comes from p->in.
** + Store results in p->z of length p->n. Space to hold p->z comes
** from sqlite3_malloc().
** + Use p->cSep as the separator. The default is ",".
** + Use p->cSep as the column separator. The default is ",".
** + Use p->rSep as the row separator. The default is "\n".
** + Keep track of the line number in p->nLine.
** + Store the character that terminates the field in p->cTerm. Store
** EOF on end-of-file.
** + Report syntax errors on stderr
*/
static char *csv_read_one_field(CSVReader *p){
int c, pc, ppc;
int cSep = p->cSeparator;
static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
int c;
int cSep = p->cColSep;
int rSep = p->cRowSep;
p->n = 0;
c = fgetc(p->in);
if( c==EOF || seenInterrupt ){
@@ -2051,12 +2117,13 @@ static char *csv_read_one_field(CSVReader *p){
return 0;
}
if( c=='"' ){
int pc, ppc;
int startLine = p->nLine;
int cQuote = c;
pc = ppc = 0;
while( 1 ){
c = fgetc(p->in);
if( c=='\n' ) p->nLine++;
if( c==rSep ) p->nLine++;
if( c==cQuote ){
if( pc==cQuote ){
pc = 0;
@@ -2064,8 +2131,8 @@ static char *csv_read_one_field(CSVReader *p){
}
}
if( (c==cSep && pc==cQuote)
|| (c=='\n' && pc==cQuote)
|| (c=='\n' && pc=='\r' && ppc==cQuote)
|| (c==rSep && pc==cQuote)
|| (c==rSep && pc=='\r' && ppc==cQuote)
|| (c==EOF && pc==cQuote)
){
do{ p->n--; }while( p->z[p->n]!=cQuote );
@@ -2079,19 +2146,19 @@ static char *csv_read_one_field(CSVReader *p){
if( c==EOF ){
fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
p->zFile, startLine, cQuote);
p->cTerm = EOF;
p->cTerm = c;
break;
}
csv_append_char(p, c);
import_append_char(p, c);
ppc = pc;
pc = c;
}
}else{
while( c!=EOF && c!=cSep && c!='\n' ){
csv_append_char(p, c);
while( c!=EOF && c!=cSep && c!=rSep ){
import_append_char(p, c);
c = fgetc(p->in);
}
if( c=='\n' ){
if( c==rSep ){
p->nLine++;
if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
}
@@ -2101,6 +2168,40 @@ static char *csv_read_one_field(CSVReader *p){
return p->z;
}
/* Read a single field of ASCII delimited text.
**
** + Input comes from p->in.
** + Store results in p->z of length p->n. Space to hold p->z comes
** from sqlite3_malloc().
** + Use p->cSep as the column separator. The default is "\x1F".
** + Use p->rSep as the row separator. The default is "\x1E".
** + Keep track of the row number in p->nLine.
** + Store the character that terminates the field in p->cTerm. Store
** EOF on end-of-file.
** + Report syntax errors on stderr
*/
static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
int c;
int cSep = p->cColSep;
int rSep = p->cRowSep;
p->n = 0;
c = fgetc(p->in);
if( c==EOF || seenInterrupt ){
p->cTerm = EOF;
return 0;
}
while( c!=EOF && c!=cSep && c!=rSep ){
import_append_char(p, c);
c = fgetc(p->in);
}
if( c==rSep ){
p->nLine++;
}
p->cTerm = c;
if( p->z ) p->z[p->n] = 0;
return p->z;
}
/*
** Try to transfer data for table zTable. If an error is seen while
** moving forward, try to go backwards. The backwards movement won't
@@ -2655,10 +2756,11 @@ static int do_meta_command(char *zLine, ShellState *p){
int nByte; /* Number of bytes in an SQL string */
int i, j; /* Loop counters */
int needCommit; /* True to COMMIT or ROLLBACK at end */
int nSep; /* Number of bytes in p->separator[] */
int nSep; /* Number of bytes in p->colSeparator[] */
char *zSql; /* An SQL statement */
CSVReader sCsv; /* Reader context */
int (*xCloser)(FILE*); /* Procedure to close th3 connection */
ImportCtx sCtx; /* Reader context */
char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
int (SQLITE_CDECL *xCloser)(FILE*); /* Func to close file */
if( nArg!=3 ){
fprintf(stderr, "Usage: .import FILE TABLE\n");
@@ -2667,55 +2769,79 @@ static int do_meta_command(char *zLine, ShellState *p){
zFile = azArg[1];
zTable = azArg[2];
seenInterrupt = 0;
memset(&sCsv, 0, sizeof(sCsv));
memset(&sCtx, 0, sizeof(sCtx));
open_db(p, 0);
nSep = strlen30(p->separator);
nSep = strlen30(p->colSeparator);
if( nSep==0 ){
fprintf(stderr, "Error: non-null separator required for import\n");
fprintf(stderr, "Error: non-null column separator required for import\n");
return 1;
}
if( nSep>1 ){
fprintf(stderr, "Error: multi-character separators not allowed"
fprintf(stderr, "Error: multi-character column separators not allowed"
" for import\n");
return 1;
}
sCsv.zFile = zFile;
sCsv.nLine = 1;
if( sCsv.zFile[0]=='|' ){
sCsv.in = popen(sCsv.zFile+1, "r");
sCsv.zFile = "<pipe>";
nSep = strlen30(p->rowSeparator);
if( nSep==0 ){
fprintf(stderr, "Error: non-null row separator required for import\n");
return 1;
}
if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator, SEP_CrLf)==0 ){
/* When importing CSV (only), if the row separator is set to the
** default output row separator, change it to the default input
** row separator. This avoids having to maintain different input
** and output row separators. */
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
nSep = strlen30(p->rowSeparator);
}
if( nSep>1 ){
fprintf(stderr, "Error: multi-character row separators not allowed"
" for import\n");
return 1;
}
sCtx.zFile = zFile;
sCtx.nLine = 1;
if( sCtx.zFile[0]=='|' ){
sCtx.in = popen(sCtx.zFile+1, "r");
sCtx.zFile = "<pipe>";
xCloser = pclose;
}else{
sCsv.in = fopen(sCsv.zFile, "rb");
sCtx.in = fopen(sCtx.zFile, "rb");
xCloser = fclose;
}
if( sCsv.in==0 ){
if( p->mode==MODE_Ascii ){
xRead = ascii_read_one_field;
}else{
xRead = csv_read_one_field;
}
if( sCtx.in==0 ){
fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
return 1;
}
sCsv.cSeparator = p->separator[0];
sCtx.cColSep = p->colSeparator[0];
sCtx.cRowSep = p->rowSeparator[0];
zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
if( zSql==0 ){
fprintf(stderr, "Error: out of memory\n");
xCloser(sCsv.in);
xCloser(sCtx.in);
return 1;
}
nByte = strlen30(zSql);
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
csv_append_char(&sCsv, 0); /* To ensure sCsv.z is allocated */
import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */
if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){
char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable);
char cSep = '(';
while( csv_read_one_field(&sCsv) ){
zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCsv.z);
while( xRead(&sCtx) ){
zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCtx.z);
cSep = ',';
if( sCsv.cTerm!=sCsv.cSeparator ) break;
if( sCtx.cTerm!=sCtx.cColSep ) break;
}
if( cSep=='(' ){
sqlite3_free(zCreate);
sqlite3_free(sCsv.z);
xCloser(sCsv.in);
fprintf(stderr,"%s: empty file\n", sCsv.zFile);
sqlite3_free(sCtx.z);
xCloser(sCtx.in);
fprintf(stderr,"%s: empty file\n", sCtx.zFile);
return 1;
}
zCreate = sqlite3_mprintf("%z\n)", zCreate);
@@ -2724,8 +2850,8 @@ static int do_meta_command(char *zLine, ShellState *p){
if( rc ){
fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable,
sqlite3_errmsg(db));
sqlite3_free(sCsv.z);
xCloser(sCsv.in);
sqlite3_free(sCtx.z);
xCloser(sCtx.in);
return 1;
}
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
@@ -2734,7 +2860,7 @@ static int do_meta_command(char *zLine, ShellState *p){
if( rc ){
if (pStmt) sqlite3_finalize(pStmt);
fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
xCloser(sCsv.in);
xCloser(sCtx.in);
return 1;
}
nCol = sqlite3_column_count(pStmt);
@@ -2744,7 +2870,7 @@ static int do_meta_command(char *zLine, ShellState *p){
zSql = sqlite3_malloc( nByte*2 + 20 + nCol*2 );
if( zSql==0 ){
fprintf(stderr, "Error: out of memory\n");
xCloser(sCsv.in);
xCloser(sCtx.in);
return 1;
}
sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
@@ -2760,46 +2886,56 @@ static int do_meta_command(char *zLine, ShellState *p){
if( rc ){
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
if (pStmt) sqlite3_finalize(pStmt);
xCloser(sCsv.in);
xCloser(sCtx.in);
return 1;
}
needCommit = sqlite3_get_autocommit(db);
if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
do{
int startLine = sCsv.nLine;
int startLine = sCtx.nLine;
for(i=0; i<nCol; i++){
char *z = csv_read_one_field(&sCsv);
char *z = xRead(&sCtx);
/*
** Did we reach end-of-file before finding any columns?
** If so, stop instead of NULL filling the remaining columns.
*/
if( z==0 && i==0 ) break;
/*
** Did we reach end-of-file OR end-of-line before finding any
** columns in ASCII mode? If so, stop instead of NULL filling
** the remaining columns.
*/
if( p->mode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break;
sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
if( i<nCol-1 && sCsv.cTerm!=sCsv.cSeparator ){
if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
fprintf(stderr, "%s:%d: expected %d columns but found %d - "
"filling the rest with NULL\n",
sCsv.zFile, startLine, nCol, i+1);
sCtx.zFile, startLine, nCol, i+1);
i++;
while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
}
}
if( sCsv.cTerm==sCsv.cSeparator ){
if( sCtx.cTerm==sCtx.cColSep ){
do{
csv_read_one_field(&sCsv);
xRead(&sCtx);
i++;
}while( sCsv.cTerm==sCsv.cSeparator );
}while( sCtx.cTerm==sCtx.cColSep );
fprintf(stderr, "%s:%d: expected %d columns but found %d - "
"extras ignored\n",
sCsv.zFile, startLine, nCol, i);
sCtx.zFile, startLine, nCol, i);
}
if( i>=nCol ){
sqlite3_step(pStmt);
rc = sqlite3_reset(pStmt);
if( rc!=SQLITE_OK ){
fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine,
fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCtx.zFile, startLine,
sqlite3_errmsg(db));
}
}
}while( sCsv.cTerm!=EOF );
}while( sCtx.cTerm!=EOF );
xCloser(sCsv.in);
sqlite3_free(sCsv.z);
xCloser(sCtx.in);
sqlite3_free(sCtx.z);
sqlite3_finalize(pStmt);
if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
}else
@@ -2917,28 +3053,32 @@ static int do_meta_command(char *zLine, ShellState *p){
p->mode = MODE_Html;
}else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
p->mode = MODE_Tcl;
sqlite3_snprintf(sizeof(p->separator), p->separator, " ");
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
}else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
p->mode = MODE_Csv;
sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
sqlite3_snprintf(sizeof(p->newline), p->newline, "\r\n");
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
}else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
p->mode = MODE_List;
sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Tab);
}else if( c2=='i' && strncmp(azArg[1],"insert",n2)==0 ){
p->mode = MODE_Insert;
set_table_name(p, nArg>=3 ? azArg[2] : "table");
}else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
p->mode = MODE_Ascii;
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
}else {
fprintf(stderr,"Error: mode should be one of: "
"column csv html insert line list tabs tcl\n");
"ascii column csv html insert line list tabs tcl\n");
rc = 1;
}
}else
if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
if( nArg==2 ){
sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
"%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
sqlite3_snprintf(sizeof(p->nullValue), p->nullValue,
"%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]);
}else{
fprintf(stderr, "Usage: .nullvalue STRING\n");
rc = 1;
@@ -3223,14 +3363,16 @@ static int do_meta_command(char *zLine, ShellState *p){
if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){
if( nArg<2 || nArg>3 ){
fprintf(stderr, "Usage: .separator SEPARATOR ?NEWLINE?\n");
fprintf(stderr, "Usage: .separator COL ?ROW?\n");
rc = 1;
}
if( nArg>=2 ){
sqlite3_snprintf(sizeof(p->separator), p->separator, azArg[1]);
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
"%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]);
}
if( nArg>=3 ){
sqlite3_snprintf(sizeof(p->newline), p->newline, azArg[2]);
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator,
"%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[2]);
}
}else
@@ -3261,23 +3403,24 @@ static int do_meta_command(char *zLine, ShellState *p){
rc = 1;
goto meta_command_exit;
}
fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
fprintf(p->out,"%12.12s: %s\n","echo", p->echoOn ? "on" : "off");
fprintf(p->out,"%12.12s: %s\n","eqp", p->autoEQP ? "on" : "off");
fprintf(p->out,"%9.9s: %s\n","explain", p->normalMode.valid ? "on" :"off");
fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
fprintf(p->out,"%9.9s: ", "nullvalue");
output_c_string(p->out, p->nullvalue);
fprintf(p->out,"%12.12s: %s\n","headers", p->showHeader ? "on" : "off");
fprintf(p->out,"%12.12s: %s\n","mode", modeDescr[p->mode]);
fprintf(p->out,"%12.12s: ", "nullvalue");
output_c_string(p->out, p->nullValue);
fprintf(p->out, "\n");
fprintf(p->out,"%9.9s: %s\n","output",
fprintf(p->out,"%12.12s: %s\n","output",
strlen30(p->outfile) ? p->outfile : "stdout");
fprintf(p->out,"%9.9s: ", "separator");
output_c_string(p->out, p->separator);
fprintf(p->out," ");
output_c_string(p->out, p->newline);
fprintf(p->out,"%12.12s: ", "colseparator");
output_c_string(p->out, p->colSeparator);
fprintf(p->out, "\n");
fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off");
fprintf(p->out,"%9.9s: ","width");
fprintf(p->out,"%12.12s: ", "rowseparator");
output_c_string(p->out, p->rowSeparator);
fprintf(p->out, "\n");
fprintf(p->out,"%12.12s: %s\n","stats", p->statsOn ? "on" : "off");
fprintf(p->out,"%12.12s: ","width");
for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
fprintf(p->out,"%d ",p->colWidth[i]);
}
@@ -3938,6 +4081,7 @@ static int process_sqliterc(
** Show available command line options
*/
static const char zOptions[] =
" -ascii set output mode to 'ascii'\n"
" -bail stop after hitting an error\n"
" -batch force batch I/O\n"
" -column set output mode to 'column'\n"
@@ -3959,11 +4103,11 @@ static const char zOptions[] =
#ifdef SQLITE_ENABLE_MULTIPLEX
" -multiplex enable the multiplexor VFS\n"
#endif
" -newline SEP set newline character(s) for CSV\n"
" -newline SEP set output row separator. Default: '\\n'\n"
" -nullvalue TEXT set text string for NULL values. Default ''\n"
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
" -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
" -separator SEP set output field separator. Default: '|'\n"
" -separator SEP set output column separator. Default: '|'\n"
" -stats print memory stats before each finalize\n"
" -version show SQLite version\n"
" -vfs NAME use NAME as the default VFS\n"
@@ -3990,8 +4134,8 @@ static void usage(int showDetail){
static void main_init(ShellState *data) {
memset(data, 0, sizeof(*data));
data->mode = MODE_List;
memcpy(data->separator,"|", 2);
memcpy(data->newline,"\r\n", 3);
memcpy(data->colSeparator,SEP_Column, 2);
memcpy(data->rowSeparator,SEP_Row, 2);
data->showHeader = 0;
data->shellFlgs = SHFLG_Lookaside;
sqlite3_config(SQLITE_CONFIG_URI, 1);
@@ -4034,7 +4178,7 @@ static char *cmdline_option_value(int argc, char **argv, int i){
return argv[i];
}
int main(int argc, char **argv){
int SQLITE_CDECL main(int argc, char **argv){
char *zErrMsg = 0;
ShellState data;
const char *zInitFile = 0;
@@ -4230,15 +4374,21 @@ int main(int argc, char **argv){
data.mode = MODE_Column;
}else if( strcmp(z,"-csv")==0 ){
data.mode = MODE_Csv;
memcpy(data.separator,",",2);
memcpy(data.colSeparator,",",2);
}else if( strcmp(z,"-ascii")==0 ){
data.mode = MODE_Ascii;
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,
SEP_Unit);
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,
SEP_Record);
}else if( strcmp(z,"-separator")==0 ){
sqlite3_snprintf(sizeof(data.separator), data.separator,
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,
"%s",cmdline_option_value(argc,argv,++i));
}else if( strcmp(z,"-newline")==0 ){
sqlite3_snprintf(sizeof(data.newline), data.newline,
sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,
"%s",cmdline_option_value(argc,argv,++i));
}else if( strcmp(z,"-nullvalue")==0 ){
sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
sqlite3_snprintf(sizeof(data.nullValue), data.nullValue,
"%s",cmdline_option_value(argc,argv,++i));
}else if( strcmp(z,"-header")==0 ){
data.showHeader = 1;
@@ -4358,13 +4508,11 @@ int main(int argc, char **argv){
sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
}
}
#if defined(HAVE_READLINE)
if( zHistory ) read_history(zHistory);
#endif
if( zHistory ) shell_read_history(zHistory);
rc = process_input(&data, 0);
if( zHistory ){
stifle_history(100);
write_history(zHistory);
shell_stifle_history(100);
shell_write_history(zHistory);
free(zHistory);
}
}else{
+35 -6
View File
@@ -43,11 +43,20 @@ extern "C" {
/*
** Add the ability to override 'extern'
** Provide the ability to override linkage features of the interface.
*/
#ifndef SQLITE_EXTERN
# define SQLITE_EXTERN extern
#endif
#ifndef SQLITE_API
# define SQLITE_API
#endif
#ifndef SQLITE_CDECL
# define SQLITE_CDECL
#endif
#ifndef SQLITE_STDCALL
# define SQLITE_STDCALL
#endif
/*
** These no-op macros are used in front of interfaces to mark those
@@ -1565,7 +1574,7 @@ struct sqlite3_mem_methods {
** 8-byte aligned
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 32768) plus some extra bytes for each
** (a power of two between 512 and 65536) plus some extra bytes for each
** page header. ^The number of extra bytes needed by the page header
** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
** to [sqlite3_config()].
@@ -1745,6 +1754,17 @@ struct sqlite3_mem_methods {
** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
** The amount of extra space required can change depending on the compiler,
** target platform, and SQLite version.
**
** [[SQLITE_CONFIG_PMASZ]]
** <dt>SQLITE_CONFIG_PMASZ
** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which
** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
** sorter to that integer. The default minimum PMA Size is set by the
** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
** to help with sort operations when multithreaded sorting
** is enabled (using the [PRAGMA threads] command) and the amount of content
** to be sorted exceeds the page size times the minimum of the
** [PRAGMA cache_size] setting and this value.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1771,6 +1791,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
/*
** CAPI3REF: Database Connection Configuration Options
@@ -7474,6 +7495,10 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
** different metric for sqlite3_stmt_scanstatus() to return.
**
** When the value returned to V is a string, space to hold that string is
** managed by the prepared statement S and will be automatically freed when
** S is finalized.
**
** <dl>
** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
@@ -7519,7 +7544,14 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
/*
** CAPI3REF: Prepared Statement Scan Status
**
** Return status data for a single loop within query pStmt.
** This interface returns information about the predicted and measured
** performance for pStmt. Advanced applications can use this
** interface to compare the predicted and the measured performance and
** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
**
** Since this interface is expected to be rarely used, it is only
** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
** compile-time option.
**
** The "iScanStatusOp" parameter determines which status information to return.
** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
@@ -7537,9 +7569,6 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
** 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(
+11 -2
View File
@@ -15,6 +15,14 @@
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
/*
** Include the header file used to customize the compiler options for MSVC.
** This should be done first so that it can successfully prevent spurious
** compiler warnings due to subsequent content in this file and other files
** that are included by this file.
*/
#include "msvc.h"
/*
** These #defines should enable >2GB file support on POSIX if the
** underlying operating system supports it. If the OS lacks
@@ -2349,7 +2357,7 @@ struct Select {
#define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */
#define SF_Compound 0x0040 /* Part of a compound query */
#define SF_Values 0x0080 /* Synthesized from VALUES clause */
/* 0x0100 NOT USED */
#define SF_AllValues 0x0100 /* All terms of compound are VALUES */
#define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */
#define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */
#define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */
@@ -2839,6 +2847,7 @@ struct Sqlite3Config {
int nPage; /* Number of pages in pPage[] */
int mxParserStack; /* maximum depth of the parser stack */
int sharedCacheEnabled; /* true if shared-cache mode enabled */
u32 szPma; /* Maximum Sorter PMA size */
/* The above might be initialized to non-zero. The following need to always
** initially be zero, however. */
int isInit; /* True after initialization has finished */
@@ -2976,7 +2985,7 @@ int sqlite3CantopenError(int);
** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3.
*/
#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)
# define SQLITE_ENABLE_FTS3
# define SQLITE_ENABLE_FTS3 1
#endif
/*
+1 -1
View File
@@ -127,7 +127,7 @@ int sqlite3_get_table(
TabResult res;
#ifdef SQLITE_ENABLE_API_ARMOR
if( pazResult==0 ) return SQLITE_MISUSE_BKPT;
if( !sqlite3SafetyCheckOk(db) || pazResult==0 ) return SQLITE_MISUSE_BKPT;
#endif
*pazResult = 0;
if( pnColumn ) *pnColumn = 0;
+27 -3
View File
@@ -25,6 +25,14 @@
** hundreds of new commands used for testing
** SQLite. This option implies -DSQLITE_TCLMD5.
*/
/*
** If requested, include the SQLite compiler options file for MSVC.
*/
#if defined(INCLUDE_MSVC_H)
#include "msvc.h"
#endif
#include "tcl.h"
#include <errno.h>
@@ -1085,10 +1093,10 @@ static int dbPrepareAndBind(
SqlPreparedStmt **ppPreStmt /* OUT: Object used to cache statement */
){
const char *zSql = zIn; /* Pointer to first SQL statement in zIn */
sqlite3_stmt *pStmt; /* Prepared statement object */
sqlite3_stmt *pStmt = 0; /* Prepared statement object */
SqlPreparedStmt *pPreStmt; /* Pointer to cached statement */
int nSql; /* Length of zSql in bytes */
int nVar; /* Number of variables in statement */
int nVar = 0; /* Number of variables in statement */
int iParm = 0; /* Next free entry in apParm */
char c;
int i;
@@ -3102,7 +3110,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** The EXTERN macros are required by TCL in order to work on windows.
*/
EXTERN int Sqlite3_Init(Tcl_Interp *interp){
int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK;
int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR;
if( rc==TCL_OK ){
Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
#ifndef SQLITE_3_SUFFIX_ONLY
@@ -3813,6 +3821,11 @@ static void init_all(Tcl_Interp *interp){
#endif
}
/* Needed for the setrlimit() system call on unix */
#if defined(unix)
#include <sys/resource.h>
#endif
#define TCLSH_MAIN main /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
Tcl_Interp *interp;
@@ -3826,6 +3839,17 @@ int TCLSH_MAIN(int argc, char **argv){
}
#endif
/* Since the primary use case for this binary is testing of SQLite,
** be sure to generate core files if we crash */
#if defined(SQLITE_TEST) && defined(unix)
{ struct rlimit x;
getrlimit(RLIMIT_CORE, &x);
x.rlim_cur = x.rlim_max;
setrlimit(RLIMIT_CORE, &x);
}
#endif /* SQLITE_TEST && unix */
/* Call sqlite3_shutdown() once before doing anything else. This is to
** test that sqlite3_shutdown() can be safely called by a process before
** sqlite3_initialize() is. */
+69 -5
View File
@@ -261,6 +261,8 @@ static int test_io_trace(
**
** Returns true if the program was compiled using clang with the
** -fsanitize=address switch on the command line. False otherwise.
**
** Also return true if the OMIT_MISUSE environment variable exists.
*/
static int clang_sanitize_address(
void *NotUsed,
@@ -274,6 +276,7 @@ static int clang_sanitize_address(
res = 1;
# endif
#endif
if( res==0 && getenv("OMIT_MISUSE")!=0 ) res = 1;
Tcl_SetObjResult(interp, Tcl_NewIntObj(res));
return TCL_OK;
}
@@ -564,7 +567,7 @@ static int test_get_table_printf(
Tcl_DString str;
int rc;
char *zErr = 0;
int nRow, nCol;
int nRow = 0, nCol = 0;
char **aResult;
int i;
char zBuf[30];
@@ -2117,7 +2120,7 @@ static int test_stmt_status(
Tcl_Obj *CONST objv[]
){
int iValue;
int i, op, resetFlag;
int i, op = 0, resetFlag;
const char *zOpName;
sqlite3_stmt *pStmt;
@@ -3095,7 +3098,7 @@ static int test_bind_double(
){
sqlite3_stmt *pStmt;
int idx;
double value;
double value = 0;
int rc;
const char *zVal;
int i;
@@ -3670,7 +3673,7 @@ static int test_prepare_v2(
assert(rc==SQLITE_OK || pStmt==0);
Tcl_ResetResult(interp);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
if( zTail && objc>=5 ){
if( rc==SQLITE_OK && zTail && objc>=5 ){
if( bytes>=0 ){
bytes = bytes - (int)(zTail-zSql);
}
@@ -5455,7 +5458,7 @@ static int test_limit(
{ "SQLITE_LIMIT_TOOSMALL", -1, },
{ "SQLITE_LIMIT_TOOBIG", SQLITE_LIMIT_WORKER_THREADS+1 },
};
int i, id;
int i, id = 0;
int val;
const char *zId;
@@ -6604,6 +6607,65 @@ static int test_user_delete(
}
#endif /* SQLITE_USER_AUTHENTICATION */
/*
** tclcmd: bad_behavior TYPE
**
** Do some things that should trigger a valgrind or -fsanitize=undefined
** warning. This is used to verify that errors and warnings output by those
** tools are detected by the test scripts.
**
** TYPE BEHAVIOR
** 1 Overflow a signed integer
** 2 Jump based on an uninitialized variable
** 3 Read after free
** 4 Panic
*/
static int test_bad_behavior(
ClientData clientData, /* Pointer to an integer containing zero */
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
int objc, /* Number of arguments */
Tcl_Obj *CONST objv[] /* Command arguments */
){
int iType;
int xyz;
int i = *(int*)clientData;
int j;
int w[10];
int *a;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "TYPE");
return TCL_ERROR;
}
if( Tcl_GetIntFromObj(interp, objv[1], &iType) ) return TCL_ERROR;
switch( iType ){
case 1: {
xyz = 0x7fffff00 - i;
xyz += 0x100;
Tcl_SetObjResult(interp, Tcl_NewIntObj(xyz));
break;
}
case 2: {
w[1] = 5;
if( w[i]>0 ) w[1]++;
Tcl_SetObjResult(interp, Tcl_NewIntObj(w[1]));
break;
}
case 3: {
a = malloc( sizeof(int)*10 );
for(j=0; j<10; j++) a[j] = j;
free(a);
Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i]));
break;
}
case 4: {
Tcl_Panic("Deliberate panic");
break;
}
}
return TCL_OK;
}
/*
** Register commands with the TCL interpreter.
*/
@@ -6620,6 +6682,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3_max_blobsize;
extern int sqlite3BtreeSharedCacheReport(void*,
Tcl_Interp*,int,Tcl_Obj*CONST*);
static int iZero = 0;
static struct {
char *zName;
Tcl_CmdProc *xProc;
@@ -6672,6 +6735,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
Tcl_ObjCmdProc *xProc;
void *clientData;
} aObjCmd[] = {
{ "bad_behavior", test_bad_behavior, (void*)&iZero },
{ "sqlite3_connection_pointer", get_sqlite_pointer, 0 },
{ "sqlite3_bind_int", test_bind_int, 0 },
{ "sqlite3_bind_zeroblob", test_bind_zeroblob, 0 },
+1 -1
View File
@@ -310,7 +310,7 @@ static int page_get(
){
Pager *pPager;
char zBuf[100];
DbPage *pPage;
DbPage *pPage = 0;
int pgno;
int rc;
if( argc!=3 ){
+5 -5
View File
@@ -648,12 +648,12 @@ static int echoRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
** indeed the hash of the supplied idxStr.
*/
static int hashString(const char *zString){
int val = 0;
u32 val = 0;
int ii;
for(ii=0; zString[ii]; ii++){
val = (val << 3) + (int)zString[ii];
}
return val;
return (int)(val&0x7fffffff);
}
/*
@@ -777,11 +777,11 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
sqlite3_stmt *pStmt = 0;
Tcl_Interp *interp = pVtab->interp;
int nRow;
int nRow = 0;
int useIdx = 0;
int rc = SQLITE_OK;
int useCost = 0;
double cost;
double cost = 0;
int isIgnoreUsable = 0;
if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){
isIgnoreUsable = 1;
@@ -927,7 +927,7 @@ int echoUpdate(
sqlite3 *db = pVtab->db;
int rc = SQLITE_OK;
sqlite3_stmt *pStmt;
sqlite3_stmt *pStmt = 0;
char *z = 0; /* SQL statement to execute */
int bindArgZero = 0; /* True to bind apData[0] to sql var no. nData */
int bindArgOne = 0; /* True to bind apData[1] to sql var no. 1 */
+1 -1
View File
@@ -41,7 +41,7 @@
** procedures use this to determine when tests should be omitted.
*/
static void set_options(Tcl_Interp *interp){
#ifdef HAVE_MALLOC_USABLE_SIZE
#if HAVE_MALLOC_USABLE_SIZE
Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1",
TCL_GLOBAL_ONLY);
#else
+5 -2
View File
@@ -409,7 +409,9 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
if( iOff==PENDING_BYTE ) continue;
rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize);
if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK;
if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){
rc = SQLITE_OK;
}
}
}
@@ -550,7 +552,8 @@ static int jtWrite(
*/
}else{
u32 pgno = (u32)(iOfst/p->nPagesize + 1);
assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
assert( (iAmt==1||iAmt==(int)p->nPagesize) &&
((iOfst+iAmt)%p->nPagesize)==0 );
assert( pgno<=p->nPage || p->nSync>0 );
assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
}
+31 -2
View File
@@ -1260,6 +1260,34 @@ static int test_config_cis(
return TCL_OK;
}
/*
** Usage: sqlite3_config_pmasz INTEGER
**
** Set the minimum PMA size.
*/
static int test_config_pmasz(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
int rc;
int iPmaSz;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "BOOL");
return TCL_ERROR;
}
if( Tcl_GetIntFromObj(interp, objv[1], &iPmaSz) ){
return TCL_ERROR;
}
rc = sqlite3_config(SQLITE_CONFIG_PMASZ, iPmaSz);
Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE);
return TCL_OK;
}
/*
** Usage: sqlite3_dump_memsys3 FILENAME
@@ -1310,7 +1338,7 @@ static int test_status(
Tcl_Obj *CONST objv[]
){
int rc, iValue, mxValue;
int i, op, resetFlag;
int i, op = 0, resetFlag;
const char *zOpName;
static const struct {
const char *zName;
@@ -1367,7 +1395,7 @@ static int test_db_status(
Tcl_Obj *CONST objv[]
){
int rc, iValue, mxValue;
int i, op, resetFlag;
int i, op = 0, resetFlag;
const char *zOpName;
sqlite3 *db;
extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**);
@@ -1514,6 +1542,7 @@ int Sqlitetest_malloc_Init(Tcl_Interp *interp){
{ "sqlite3_config_error", test_config_error ,0 },
{ "sqlite3_config_uri", test_config_uri ,0 },
{ "sqlite3_config_cis", test_config_cis ,0 },
{ "sqlite3_config_pmasz", test_config_pmasz ,0 },
{ "sqlite3_db_config_lookaside",test_db_config_lookaside ,0 },
{ "sqlite3_dump_memsys3", test_dump_memsys3 ,3 },
{ "sqlite3_dump_memsys5", test_dump_memsys3 ,5 },
+2 -2
View File
@@ -406,7 +406,7 @@ static void multiplexControlFunc(
){
int rc = SQLITE_OK;
sqlite3 *db = sqlite3_context_db_handle(context);
int op;
int op = 0;
int iVal;
if( !db || argc!=2 ){
@@ -535,7 +535,7 @@ static int multiplexOpen(
/* assign pointers to extra space allocated */
memset(pGroup, 0, sz);
pMultiplexOpen->pGroup = pGroup;
pGroup->bEnabled = -1;
pGroup->bEnabled = (unsigned char)-1;
pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate",
(flags & SQLITE_OPEN_MAIN_DB)==0);
pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",
+1 -1
View File
@@ -889,7 +889,7 @@ int sqlite3_quota_set(
** management, update its size.
*/
int sqlite3_quota_file(const char *zFilename){
char *zFull;
char *zFull = 0;
sqlite3_file *fd;
int rc;
int outFlags = 0;
+2 -2
View File
@@ -421,7 +421,7 @@ static int tvfsSync(sqlite3_file *pFile, int flags){
Testvfs *p = (Testvfs *)pFd->pVfs->pAppData;
if( p->pScript && p->mask&TESTVFS_SYNC_MASK ){
char *zFlags;
char *zFlags = 0;
switch( flags ){
case SQLITE_SYNC_NORMAL:
@@ -1225,7 +1225,7 @@ static int testvfs_obj_cmd(
case CMD_CANTOPENERR:
case CMD_IOERR:
case CMD_FULLERR: {
TestFaultInject *pTest;
TestFaultInject *pTest = 0;
int iRet;
switch( aSubcmd[i].eCmd ){
+3
View File
@@ -26,6 +26,9 @@
** single-threaded if desired.
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN
# include "os_win.h"
#endif
#if SQLITE_MAX_WORKER_THREADS>0
+3
View File
@@ -391,6 +391,9 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
int mxSqlLen; /* Max length of an SQL string */
#ifdef SQLITE_ENABLE_API_ARMOR
if( zSql==0 || pzErrMsg==0 ) return SQLITE_MISUSE_BKPT;
#endif
mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
if( db->nVdbeActive==0 ){
db->u1.isInterrupted = 0;
+4 -4
View File
@@ -17,7 +17,7 @@
*/
#include "sqliteInt.h"
#include <stdarg.h>
#ifdef SQLITE_HAVE_ISNAN
#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
# include <math.h>
#endif
@@ -58,7 +58,7 @@ int sqlite3FaultSim(int iTest){
*/
int sqlite3IsNaN(double x){
int rc; /* The value return */
#if !defined(SQLITE_HAVE_ISNAN)
#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN
/*
** Systems that support the isnan() library function should probably
** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have
@@ -88,9 +88,9 @@ int sqlite3IsNaN(double x){
volatile double y = x;
volatile double z = y;
rc = (y!=z);
#else /* if defined(SQLITE_HAVE_ISNAN) */
#else /* if HAVE_ISNAN */
rc = isnan(x);
#endif /* SQLITE_HAVE_ISNAN */
#endif /* HAVE_ISNAN */
testcase( rc );
return rc;
}
+2 -2
View File
@@ -3823,8 +3823,8 @@ case OP_Found: { /* jump, in3 */
/* For the OP_NoConflict opcode, take the jump if any of the
** input fields are NULL, since any key with a NULL will not
** conflict */
for(ii=0; ii<r.nField; ii++){
if( r.aMem[ii].flags & MEM_Null ){
for(ii=0; ii<pIdxKey->nField; ii++){
if( pIdxKey->aMem[ii].flags & MEM_Null ){
pc = pOp->p2 - 1; VdbeBranchTaken(1,2);
break;
}
+37
View File
@@ -3349,6 +3349,41 @@ debugCompareEnd:
}
#endif
#if SQLITE_DEBUG
/*
** Count the number of fields (a.k.a. columns) in the record given by
** pKey,nKey. The verify that this count is less than or equal to the
** limit given by pKeyInfo->nField + pKeyInfo->nXField.
**
** If this constraint is not satisfied, it means that the high-speed
** vdbeRecordCompareInt() and vdbeRecordCompareString() routines will
** not work correctly. If this assert() ever fires, it probably means
** that the KeyInfo.nField or KeyInfo.nXField values were computed
** incorrectly.
*/
static void vdbeAssertFieldCountWithinLimits(
int nKey, const void *pKey, /* The record to verify */
const KeyInfo *pKeyInfo /* Compare size with this KeyInfo */
){
int nField = 0;
u32 szHdr;
u32 idx;
u32 notUsed;
const unsigned char *aKey = (const unsigned char*)pKey;
if( CORRUPT_DB ) return;
idx = getVarint32(aKey, szHdr);
assert( szHdr<=nKey );
while( idx<szHdr ){
idx += getVarint32(aKey+idx, notUsed);
nField++;
}
assert( nField <= pKeyInfo->nField+pKeyInfo->nXField );
}
#else
# define vdbeAssertFieldCountWithinLimits(A,B,C)
#endif
/*
** Both *pMem1 and *pMem2 contain string values. Compare the two values
** using the collation sequence pColl. As usual, return a negative , zero
@@ -3760,6 +3795,7 @@ static int vdbeRecordCompareInt(
i64 v = pPKey2->aMem[0].u.i;
i64 lhs;
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
switch( serial_type ){
case 1: { /* 1-byte signed integer */
@@ -3847,6 +3883,7 @@ static int vdbeRecordCompareString(
int serial_type;
int res;
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
getVarint32(&aKey1[1], serial_type);
if( serial_type<12 ){
res = pPKey2->r1; /* (pKey1/nKey1) is a number or a null */
+12 -15
View File
@@ -152,7 +152,7 @@
** to a level 0 PMA. The purpose of this limit is to prevent various integer
** overflows. 512MiB.
*/
#define SQLITE_MAX_MXPMASIZE (1<<29)
#define SQLITE_MAX_PMASZ (1<<29)
/*
** Private objects used by the sorter
@@ -448,11 +448,6 @@ struct SorterRecord {
*/
#define SRVAL(p) ((void*)((SorterRecord*)(p) + 1))
/* The minimum PMA size is set to this value multiplied by the database
** page size in bytes. */
#ifndef SQLITE_SORTER_PMASZ
# define SQLITE_SORTER_PMASZ 10
#endif
/* Maximum number of PMAs that a single MergeEngine can merge */
#define SORTER_MAX_MERGE_COUNT 16
@@ -851,10 +846,11 @@ int sqlite3VdbeSorterInit(
}
if( !sqlite3TempInMemory(db) ){
pSorter->mnPmaSize = SQLITE_SORTER_PMASZ * pgsz;
u32 szPma = sqlite3GlobalConfig.szPma;
pSorter->mnPmaSize = szPma * pgsz;
mxCache = db->aDb[0].pSchema->cache_size;
if( mxCache<SQLITE_SORTER_PMASZ ) mxCache = SQLITE_SORTER_PMASZ;
pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE);
if( mxCache<(int)szPma ) mxCache = (int)szPma;
pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_PMASZ);
/* EVIDENCE-OF: R-26747-61719 When the application provides any amount of
** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary
@@ -1132,12 +1128,12 @@ void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){
*/
static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){
if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){
int rc = sqlite3OsTruncate(pFd, nByte);
if( rc==SQLITE_OK ){
void *p = 0;
sqlite3OsFetch(pFd, 0, (int)nByte, &p);
sqlite3OsUnfetch(pFd, 0, p);
}
void *p = 0;
int chunksize = 4*1024;
sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize);
sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte);
sqlite3OsFetch(pFd, 0, (int)nByte, &p);
sqlite3OsUnfetch(pFd, 0, p);
}
}
#else
@@ -2418,6 +2414,7 @@ int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){
}else
#endif
/*if( !pSorter->bUseThreads )*/ {
assert( pSorter->pMerger!=0 );
assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );
rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof);
}
+94 -91
View File
@@ -1694,7 +1694,7 @@ static int walCheckpoint(
int sync_flags, /* Flags for OsSync() (or 0) */
u8 *zBuf /* Temporary buffer to use */
){
int rc; /* Return code */
int rc = SQLITE_OK; /* Return code */
int szPage; /* Database page-size */
WalIterator *pIter = 0; /* Wal iterator context */
u32 iDbpage = 0; /* Next database page to write */
@@ -1708,104 +1708,107 @@ static int walCheckpoint(
testcase( szPage<=32768 );
testcase( szPage>=65536 );
pInfo = walCkptInfo(pWal);
if( pInfo->nBackfill>=pWal->hdr.mxFrame ) return SQLITE_OK;
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
/* Allocate the iterator */
rc = walIteratorInit(pWal, &pIter);
if( rc!=SQLITE_OK ){
return rc;
}
assert( pIter );
/* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
** in the SQLITE_CHECKPOINT_PASSIVE mode. */
assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
/* Compute in mxSafeFrame the index of the last frame of the WAL that is
** safe to write into the database. Frames beyond mxSafeFrame might
** overwrite database pages that are in use by active readers and thus
** cannot be backfilled from the WAL.
*/
mxSafeFrame = pWal->hdr.mxFrame;
mxPage = pWal->hdr.nPage;
for(i=1; i<WAL_NREADER; i++){
u32 y = pInfo->aReadMark[i];
if( mxSafeFrame>y ){
assert( y<=pWal->hdr.mxFrame );
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
if( rc==SQLITE_OK ){
pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
}else if( rc==SQLITE_BUSY ){
mxSafeFrame = y;
xBusy = 0;
}else{
goto walcheckpoint_out;
}
/* Allocate the iterator */
rc = walIteratorInit(pWal, &pIter);
if( rc!=SQLITE_OK ){
return rc;
}
}
assert( pIter );
if( pInfo->nBackfill<mxSafeFrame
&& (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0), 1))==SQLITE_OK
){
i64 nSize; /* Current size of database file */
u32 nBackfill = pInfo->nBackfill;
/* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
** in the SQLITE_CHECKPOINT_PASSIVE mode. */
assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
/* Sync the WAL to disk */
if( sync_flags ){
rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
}
/* If the database may grow as a result of this checkpoint, hint
** about the eventual size of the db file to the VFS layer.
/* Compute in mxSafeFrame the index of the last frame of the WAL that is
** safe to write into the database. Frames beyond mxSafeFrame might
** overwrite database pages that are in use by active readers and thus
** cannot be backfilled from the WAL.
*/
if( rc==SQLITE_OK ){
i64 nReq = ((i64)mxPage * szPage);
rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
if( rc==SQLITE_OK && nSize<nReq ){
sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
}
}
/* Iterate through the contents of the WAL, copying data to the db file. */
while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
i64 iOffset;
assert( walFramePgno(pWal, iFrame)==iDbpage );
if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue;
iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;
/* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */
rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
iOffset = (iDbpage-1)*(i64)szPage;
testcase( IS_BIG_INT(iOffset) );
rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
}
/* If work was actually accomplished... */
if( rc==SQLITE_OK ){
if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
i64 szDb = pWal->hdr.nPage*(i64)szPage;
testcase( IS_BIG_INT(szDb) );
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
if( rc==SQLITE_OK && sync_flags ){
rc = sqlite3OsSync(pWal->pDbFd, sync_flags);
mxSafeFrame = pWal->hdr.mxFrame;
mxPage = pWal->hdr.nPage;
for(i=1; i<WAL_NREADER; i++){
u32 y = pInfo->aReadMark[i];
if( mxSafeFrame>y ){
assert( y<=pWal->hdr.mxFrame );
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
if( rc==SQLITE_OK ){
pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
}else if( rc==SQLITE_BUSY ){
mxSafeFrame = y;
xBusy = 0;
}else{
goto walcheckpoint_out;
}
}
if( rc==SQLITE_OK ){
pInfo->nBackfill = mxSafeFrame;
}
}
/* Release the reader lock held while backfilling */
walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
}
if( pInfo->nBackfill<mxSafeFrame
&& (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
){
i64 nSize; /* Current size of database file */
u32 nBackfill = pInfo->nBackfill;
if( rc==SQLITE_BUSY ){
/* Reset the return code so as not to report a checkpoint failure
** just because there are active readers. */
rc = SQLITE_OK;
/* Sync the WAL to disk */
if( sync_flags ){
rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
}
/* If the database may grow as a result of this checkpoint, hint
** about the eventual size of the db file to the VFS layer.
*/
if( rc==SQLITE_OK ){
i64 nReq = ((i64)mxPage * szPage);
rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
if( rc==SQLITE_OK && nSize<nReq ){
sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
}
}
/* Iterate through the contents of the WAL, copying data to the db file */
while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
i64 iOffset;
assert( walFramePgno(pWal, iFrame)==iDbpage );
if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
continue;
}
iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;
/* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */
rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
iOffset = (iDbpage-1)*(i64)szPage;
testcase( IS_BIG_INT(iOffset) );
rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);
if( rc!=SQLITE_OK ) break;
}
/* If work was actually accomplished... */
if( rc==SQLITE_OK ){
if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
i64 szDb = pWal->hdr.nPage*(i64)szPage;
testcase( IS_BIG_INT(szDb) );
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
if( rc==SQLITE_OK && sync_flags ){
rc = sqlite3OsSync(pWal->pDbFd, sync_flags);
}
}
if( rc==SQLITE_OK ){
pInfo->nBackfill = mxSafeFrame;
}
}
/* Release the reader lock held while backfilling */
walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
}
if( rc==SQLITE_BUSY ){
/* Reset the return code so as not to report a checkpoint failure
** just because there are active readers. */
rc = SQLITE_OK;
}
}
/* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the
@@ -1820,7 +1823,7 @@ static int walCheckpoint(
}else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
u32 salt1;
sqlite3_randomness(4, &salt1);
assert( mxSafeFrame==pWal->hdr.mxFrame );
assert( pInfo->nBackfill==pWal->hdr.mxFrame );
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
if( rc==SQLITE_OK ){
if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
@@ -2412,7 +2415,7 @@ int sqlite3WalFindFrame(
for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){
u32 iFrame = aHash[iKey] + iZero;
if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){
/* assert( iFrame>iRead ); -- not true if there is corruption */
assert( iFrame>iRead || CORRUPT_DB );
iRead = iFrame;
}
if( (nCollide--)==0 ){
+6 -1
View File
@@ -1614,6 +1614,7 @@ static void constructAutomaticIndex(
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( pLoop->prereq==0
&& (pTerm->wtFlags & TERM_VIRTUAL)==0
&& !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
@@ -4694,7 +4695,11 @@ static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
int i;
WhereTerm *pTerm;
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab) ) return 1;
if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab)
&& !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
){
return 1;
}
}
return 0;
}
+31
View File
@@ -49,4 +49,35 @@ do_execsql_test autoindex4-2.0 {
ORDER BY rowid;
} {1 123 654 | 0 555 444 | 4 234 987 |}
# Ticket [2326c258d02ead33d]
# Two joins, one with and the other without an ORDER BY clause.
# The one without ORDER BY correctly returns two rows of result.
# The one with ORDER BY returns no rows.
#
do_execsql_test autoindex4-3.0 {
CREATE TABLE A(Name text);
CREATE TABLE Items(ItemName text , Name text);
INSERT INTO Items VALUES('Item1','Parent');
INSERT INTO Items VALUES('Item2','Parent');
CREATE TABLE B(Name text);
SELECT Items.ItemName
FROM Items
LEFT JOIN A ON (A.Name = Items.ItemName and Items.ItemName = 'dummy')
LEFT JOIN B ON (B.Name = Items.ItemName)
WHERE Items.Name = 'Parent'
ORDER BY Items.ItemName;
} {Item1 Item2}
do_execsql_test autoindex4-3.1 {
CREATE INDEX Items_x1 ON Items(ItemName,Name) WHERE ItemName = 'dummy';
SELECT Items.ItemName
FROM Items
LEFT JOIN A ON (A.Name = Items.ItemName and Items.ItemName = 'dummy')
LEFT JOIN B ON (B.Name = Items.ItemName)
WHERE Items.Name = 'Parent'
ORDER BY Items.ItemName;
} {Item1 Item2}
finish_test
+9 -2
View File
@@ -20,6 +20,15 @@ set testprefix bigsort
# loop if the product was also an integer multiple of 2^32, or
# inefficiency otherwise.
#
# This test causes thrashing on machines with smaller amounts of
# memory. Make sure the host has at least 8GB available before running
# this test.
#
if {[catch {exec free | grep Mem:} out] || [lindex $out 1]<8000000} {
finish_test
return
}
do_execsql_test 1.0 {
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b);
@@ -39,5 +48,3 @@ do_execsql_test 1.1 {
finish_test
+4 -3
View File
@@ -18,12 +18,12 @@ set testprefix e_walauto
proc read_nbackfill {} {
seek $::shmfd 96
binary scan [read $::shmfd 4] i nBackfill
binary scan [read $::shmfd 4] n nBackfill
set nBackfill
}
proc read_mxframe {} {
seek $::shmfd 16
binary scan [read $::shmfd 4] i mxFrame
binary scan [read $::shmfd 4] n mxFrame
set mxFrame
}
@@ -66,9 +66,10 @@ foreach {tn code} {
eval $code
reset_db
execsql { PRAGMA auto_vacuum = 0 }
do_execsql_test 1.$tn.0 { PRAGMA journal_mode = WAL } {wal}
do_execsql_test 1.$tn.1 { CREATE TABLE t1(a, b) }
set shmfd [open "test.db-shm"]
set shmfd [open "test.db-shm" rb]
# EVIDENCE-OF: R-41531-51083 Every new database connection defaults to
# having the auto-checkpoint enabled with a threshold of 1000 or
+2
View File
@@ -247,6 +247,7 @@ foreach {tn script} {
do_test $tn.3.2.1 {
db2 eval {
PRAGMA auto_vacuum = 0;
PRAGMA journal_mode = WAL;
CREATE TABLE t1(x, y);
INSERT INTO t1 VALUES(1,2);
@@ -706,6 +707,7 @@ sqlite3 db2 test.db
do_test 6.1 {
execsql {
PRAGMA auto_vacuum = 0;
PRAGMA journal_mode = WAL;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
+5 -1
View File
@@ -252,13 +252,17 @@ do_test fkey5-6.5 {
} {c12 1 p4 0 c12 3 p4 0 c12 6 p4 0}
do_test fkey5-7.1 {
set res {}
db eval {
INSERT OR IGNORE INTO c13 SELECT * FROM c12;
INSERT OR IGNORE INTO C14 SELECT * FROM c12;
DELETE FROM c12;
PRAGMA foreign_key_check;
} {
lappend res [list $table $rowid $fkid $parent]
}
} {c14 1 p4 0 c14 3 p4 0 c14 6 p4 0 c13 1 p3 0 c13 2 p3 0 c13 3 p3 0 c13 4 p3 0 c13 5 p3 0 c13 6 p3 0}
lsort $res
} {{c13 1 0 p3} {c13 2 0 p3} {c13 3 0 p3} {c13 4 0 p3} {c13 5 0 p3} {c13 6 0 p3} {c14 1 0 p4} {c14 3 0 p4} {c14 6 0 p4}}
do_test fkey5-7.2 {
db eval {
PRAGMA foreign_key_check(c14);
+22 -1
View File
@@ -12,7 +12,6 @@
#
# This file checks error recovery from malformed SQL strings.
#
# $Id: fuzz2.test,v 1.3 2007/05/15 16:51:37 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -105,4 +104,26 @@ do_test fuzz2-5.5 {
fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) AS AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAAA" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AAAAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( }
} {1}
# Test cases discovered by Michal Zalewski on 2015-01-03 and reported on the
# sqlite-users mailing list. All of these cases cause segfaults in
# SQLite 3.8.7.4 and earlier.
#
do_test fuzz2-6.1 {
catchsql {SELECT n()AND+#0;}
} {1 {near "#0": syntax error}}
do_test fuzz2-6.2 {
catchsql {SELECT strftime()}
} {0 {{}}}
do_test fuzz2-6.3 {
catchsql {DETACH(SELECT group_concat(q));}
} {1 {no such column: q}}
do_test fuzz2-6.4a {
db eval {DROP TABLE IF EXISTS t0; CREATE TABLE t0(t);}
catchsql {INSERT INTO t0 SELECT strftime();}
} {0 {}}
do_test fuzz2-6.4b {
db eval {SELECT quote(t) FROM t0}
} {NULL}
finish_test
+28
View File
@@ -267,5 +267,33 @@ do_execsql_test index6-6.2 {
PRAGMA integrity_check;
} {ok}
# Test case for ticket [2326c258d02ead33d69faa63de8f4686b9b1b9d9] on
# 2015-02-24. Any use of a partial index qualifying constraint inside
# the ON clause of a LEFT JOIN was causing incorrect results for all
# versions of SQLite 3.8.0 through 3.8.8.
#
do_execsql_test index6-7.0 {
CREATE TABLE t7a(x);
CREATE TABLE t7b(y);
INSERT INTO t7a(x) VALUES(1);
CREATE INDEX t7ax ON t7a(x) WHERE x=99;
PRAGMA automatic_index=OFF;
SELECT * FROM t7a LEFT JOIN t7b ON (x=99) ORDER BY x;
} {1 {}}
do_execsql_test index6-7.1 {
INSERT INTO t7b(y) VALUES(2);
SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
} {}
do_execsql_test index6-7.2 {
INSERT INTO t7a(x) VALUES(99);
SELECT * FROM t7a LEFT JOIN t7b ON (x=99) ORDER BY x;
} {1 {} 99 2}
do_execsql_test index6-7.3 {
SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
} {99 2}
do_execsql_test index6-7.4 {
EXPLAIN QUERY PLAN
SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
} {/USING COVERING INDEX t7ax/}
finish_test
+20
View File
@@ -514,5 +514,25 @@ if {$::tcl_platform(platform)=="unix"
} {1 {no such vfs: async}}
}
}
# Print the version number so that it can be picked up by releasetest.tcl.
#
puts [db one {SELECT 'VERSION: ' ||
sqlite_version() || ' ' ||
sqlite_source_id();}]
# Do deliberate failures if the TEST_FAILURE environment variable is set.
# This is done to verify that failure notifications are detected by the
# releasetest.tcl script, or possibly by other scripts involved in automatic
# testing.
#
if {[info exists ::env(TEST_FAILURE)]} {
set res 123
if {$::env(TEST_FAILURE)==0} {set res 234}
do_test main-99.1 {
bad_behavior $::env(TEST_FAILURE)
set x 123
} $res
}
finish_test
+4 -4
View File
@@ -176,20 +176,20 @@ do_test memsubsys1-4.6 {
set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2]
} 1
# Test 5: Activate both PAGECACHE and SCRATCH. But make the page size
# Test 5: Activate both PAGECACHE and SCRATCH. But make the page size is
# such that the SCRATCH allocations are too small.
#
db close
sqlite3_shutdown
sqlite3_config_pagecache [expr 4096+$xtra_size] 24
sqlite3_config_scratch 6000 2
sqlite3_config_scratch 4000 2
sqlite3_initialize
reset_highwater_marks
build_test_db memsubsys1-5 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-5.3 {
set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 24
} {/^2[34]$/}
do_test memsubsys1-5.4 {
set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
expr {$maxreq>4096}
@@ -215,7 +215,7 @@ build_test_db memsubsys1-6 {PRAGMA page_size=4096}
#show_memstats
do_test memsubsys1-6.3 {
set pg_used [lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 2]
} 24
} {/^2[34]$/}
#do_test memsubsys1-6.4 {
# set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2]
# expr {$maxreq>4096 && $maxreq<=(4096+$xtra_size)}
+33 -8
View File
@@ -101,6 +101,8 @@ set sql $zSql
# This loop runs for ~20 seconds.
#
set iStart [clock_seconds]
set nOp 0
set nAttempt 0
while { ([clock_seconds]-$iStart) < $nSecond } {
# Each transaction does 3 operations. Each operation is either a read
@@ -128,6 +130,7 @@ set sql $zSql
# Execute the SQL transaction.
#
incr nAttempt
set rc [catch { execsql_blocking $::DB "
BEGIN;
$SQL(1);
@@ -154,13 +157,14 @@ set sql $zSql
# returned "1". Otherwise, the invariant was false, indicating that
# some malfunction has occurred.
foreach r $msg { if {$r != 1} { puts "Invariant check failed: $msg" } }
incr nOp
}
}
# Close the database connection and return 0.
#
sqlite3_close $::DB
expr 0
list $nOp $nAttempt
}
foreach {iTest xStep xPrepare} {
@@ -204,7 +208,9 @@ foreach {iTest xStep xPrepare} {
for {set ii 0} {$ii < $nThread} {incr ii} {
do_test notify2-$iTest.2.$ii {
if {![info exists finished($ii)]} { vwait finished($ii) }
set finished($ii)
incr anSuccess($xStep) [lindex $finished($ii) 0]
incr anAttempt($xStep) [lindex $finished($ii) 1]
expr 0
} {0}
}
@@ -225,17 +231,36 @@ foreach {iTest xStep xPrepare} {
}
# The following tests checks to make sure sqlite3_blocking_step() is
# faster than sqlite3_step(). blocking_step() is always faster on
# multi-core and is usually faster on single-core. But sometimes, by
# chance, step() will be faster on a single core, in which case the
# faster than sqlite3_step(). "Faster" in this case means uses fewer
# CPU cycles. This is not always the same as faster in wall-clock time
# for this type of test. The number of CPU cycles per transaction is
# roughly proportional to the number of attempts made (i.e. one plus the
# number of SQLITE_BUSY or SQLITE_LOCKED errors that require the transaction
# to be retried). So this test just measures that a greater percentage of
# transactions attempted using blocking_step() succeed.
#
# The blocking_step() function is almost always faster on multi-core and is
# usually faster on single-core. But sometimes, by chance, step() will be
# faster on a single core, in which case the
# following test will fail.
#
puts "The following test seeks to demonstrate that the sqlite3_unlock_notify()"
puts "interface helps multi-core systems to run faster. This test sometimes"
puts "fails on single-core machines."
puts "interface helps multi-core systems to run more efficiently. This test"
puts "sometimes fails on single-core machines."
puts [array get anWrite]
do_test notify2-3 {
expr {$anWrite(sqlite3_blocking_step) > $anWrite(sqlite3_step)}
set blocking [expr {
double($anSuccess(sqlite3_blocking_step)) /
double($anAttempt(sqlite3_blocking_step))
}]
set non [expr {
double($anSuccess(sqlite3_step)) /
double($anAttempt(sqlite3_step))
}]
puts -nonewline [format " blocking: %.1f%% non-blocking %.1f%% ..." \
[expr $blocking*100.0] [expr $non*100.0]]
expr {$blocking > $non}
} {1}
sqlite3_enable_shared_cache $::enable_shared_cache
+41
View File
@@ -0,0 +1,41 @@
# 2015-01-19
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing ORDER BY and LIMIT on tables with
# many columns.
#
# These tests verify that ticket [f97c4637102a3ae72b7911167e1d4da12ce60722]
# from 2015-01-19 has been fixed.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix orderby8
do_test 1.0 {
db eval {
CREATE TABLE t1(x);
INSERT INTO t1(x) VALUES(1),(5),(9),(7),(3),(2),(4),(6),(8);
}
set ::result_set "x"
} {x}
for {set i 1} {$i<200} {incr i} {
append ::result_set ", x+$i"
do_test 1.$i {
set res {}
db eval "SELECT $::result_set FROM t1 ORDER BY x LIMIT -1" {
lappend res $x
}
set res
} {1 2 3 4 5 6 7 8 9}
}
finish_test
+14 -13
View File
@@ -51,19 +51,20 @@ proc do_re_test {tn script expression} {
# a call to getcwd() may fail if there are no free file descriptors. So
# an error may be reported for either open() or getcwd() here.
#
puts "Possible valgrind error about invalid file descriptor follows:"
do_test 1.1.1 {
set ::log [list]
list [catch {
for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 }
} msg] $msg
} {1 {unable to open database file}}
do_test 1.1.2 {
catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } }
} {1}
do_re_test 1.1.3 {
lindex $::log 0
} {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - }
if {![clang_sanitize_address]} {
do_test 1.1.1 {
set ::log [list]
list [catch {
for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 }
} msg] $msg
} {1 {unable to open database file}}
do_test 1.1.2 {
catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } }
} {1}
do_re_test 1.1.3 {
lindex $::log 0
} {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - }
}
# Test a failure in open() due to the path being a directory.
+1 -1
View File
@@ -200,7 +200,7 @@ ifcapable vtab {
} {
do_test percentile-2.1.$in {
execsql {
SELECT percentile(x, $in) from t3;
SELECT round(percentile(x, $in),1) from t3;
}
} $out
}
+18 -3
View File
@@ -118,6 +118,19 @@ set allquicktests [test_set $alltests -exclude {
if {[info exists ::env(QUICKTEST_INCLUDE)]} {
set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
}
if {[info exists ::env(QUICKTEST_OMIT)]} {
foreach x [split $::env(QUICKTEST_OMIT) ,] {
regsub -all \\y$x\\y $allquicktests {} allquicktests
}
}
# If the TEST_FAILURE environment variable is set, it means that we what to
# deliberately provoke test failures in order to test the test infrastructure.
# Only the main.test module is needed for this.
#
if {[info exists ::env(TEST_FAILURE)]} {
set allquicktests main.test
}
#############################################################################
# Start of tests
@@ -141,7 +154,7 @@ test_suite "veryquick" -prefix "" -description {
]
test_suite "mmap" -prefix "mm-" -description {
Similar to veryquick. Except with memory mapping disabled.
Similar to veryquick. Except with memory mapping enabled.
} -presql {
pragma mmap_size = 268435456;
} -files [
@@ -152,7 +165,9 @@ test_suite "valgrind" -prefix "" -description {
Run the "veryquick" test suite with a couple of multi-process tests (that
fail under valgrind) omitted.
} -files [
test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test
test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test \
shell*.test crash8.test atof1.test selectG.test \
tkt-fc62af4523.test
] -initialize {
set ::G(valgrind) 1
} -shutdown {
@@ -690,7 +705,7 @@ test_suite "inmemory_journal" -description {
zerodamage.test
# WAL mode is different.
wal* tkt-2d1a5c67d.test backcompat.test
wal* tkt-2d1a5c67d.test backcompat.test e_wal*
}]
ifcapable mem3 {
+253
View File
@@ -0,0 +1,253 @@
# 2014-12-19
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for PRAGMA data_version command.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_execsql_test pragma3-100 {
PRAGMA data_version;
} {1}
do_execsql_test pragma3-101 {
PRAGMA temp.data_version;
} {1}
# Writing to the pragma is a no-op
do_execsql_test pragma3-102 {
PRAGMA main.data_version=1234;
PRAGMA main.data_version;
} {1 1}
# EVIDENCE-OF: R-27726-60934 The "PRAGMA data_version" command provides
# an indication that the database file has been modified.
#
# EVIDENCE-OF: R-47505-58569 The "PRAGMA data_version" value is
# unchanged for commits made on the same database connection.
#
do_execsql_test pragma3-110 {
PRAGMA data_version;
BEGIN IMMEDIATE;
PRAGMA data_version;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(100),(200),(300);
PRAGMA data_version;
COMMIT;
SELECT * FROM t1;
PRAGMA data_version;
} {1 1 1 100 200 300 1}
sqlite3 db2 test.db
do_test pragma3-120 {
db2 eval {
SELECT * FROM t1;
PRAGMA data_version;
}
} {100 200 300 1}
do_execsql_test pragma3-130 {
PRAGMA data_version;
BEGIN IMMEDIATE;
PRAGMA data_version;
INSERT INTO t1 VALUES(400),(500);
PRAGMA data_version;
COMMIT;
SELECT * FROM t1;
PRAGMA data_version;
PRAGMA shrink_memory;
} {1 1 1 100 200 300 400 500 1}
# EVIDENCE-OF: R-63005-41812 The integer values returned by two
# invocations of "PRAGMA data_version" from the same connection will be
# different if changes were committed to the database by any other
# connection in the interim.
#
# Value went from 1 in pragma3-120 to 2 here.
#
do_test pragma3-140 {
db2 eval {
SELECT * FROM t1;
PRAGMA data_version;
BEGIN IMMEDIATE;
PRAGMA data_version;
UPDATE t1 SET a=a+1;
COMMIT;
SELECT * FROM t1;
PRAGMA data_version;
}
} {100 200 300 400 500 2 2 101 201 301 401 501 2}
do_execsql_test pragma3-150 {
SELECT * FROM t1;
PRAGMA data_version;
} {101 201 301 401 501 2}
#
do_test pragma3-160 {
db eval {
BEGIN;
PRAGMA data_version;
UPDATE t1 SET a=555 WHERE a=501;
PRAGMA data_version;
SELECT * FROM t1 ORDER BY a;
PRAGMA data_version;
}
} {2 2 101 201 301 401 555 2}
do_test pragma3-170 {
db2 eval {
PRAGMA data_version;
}
} {2}
do_test pragma3-180 {
db eval {
COMMIT;
PRAGMA data_version;
}
} {2}
do_test pragma3-190 {
db2 eval {
PRAGMA data_version;
}
} {3}
# EVIDENCE-OF: R-19326-44825 The "PRAGMA data_version" value is a local
# property of each database connection and so values returned by two
# concurrent invocations of "PRAGMA data_version" on separate database
# connections are often different even though the underlying database is
# identical.
#
do_test pragma3-195 {
expr {[db eval {PRAGMA data_version}]!=[db2 eval {PRAGMA data_version}]}
} {1}
# EVIDENCE-OF: R-54562-06892 The behavior of "PRAGMA data_version" is
# the same for all database connections, including database connections
# in separate processes and shared cache database connections.
#
# The next block checks the behavior for separate processes.
#
do_test pragma3-200 {
db eval {PRAGMA data_version; SELECT * FROM t1;}
} {2 101 201 301 401 555}
do_test pragma3-201 {
set fd [open pragma3.txt wb]
puts $fd {
sqlite3 db test.db;
db eval {DELETE FROM t1 WHERE a>300};
db close;
exit;
}
close $fd
exec [info nameofexec] pragma3.txt
forcedelete pragma3.txt
db eval {
PRAGMA data_version;
SELECT * FROM t1;
}
} {3 101 201}
db2 close
db close
# EVIDENCE-OF: R-54562-06892 The behavior of "PRAGMA data_version" is
# the same for all database connections, including database connections
# in separate processes and shared cache database connections.
#
# The next block checks that behavior is the same for shared-cache.
#
ifcapable shared_cache {
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
sqlite3 db test.db
sqlite3 db2 test.db
do_test pragma3-300 {
db eval {
PRAGMA data_version;
BEGIN;
CREATE TABLE t3(a,b,c);
CREATE TABLE t4(x,y,z);
INSERT INTO t4 VALUES(123,456,789);
PRAGMA data_version;
COMMIT;
PRAGMA data_version;
}
} {1 1 1}
do_test pragma3-310 {
db2 eval {
PRAGMA data_version;
BEGIN;
INSERT INTO t3(a,b,c) VALUES('abc','def','ghi');
SELECT * FROM t3;
PRAGMA data_version;
}
} {2 abc def ghi 2}
# The transaction in db2 has not yet committed, so the data_version in
# db is unchanged.
do_test pragma3-320 {
db eval {
PRAGMA data_version;
SELECT * FROM t4;
}
} {1 123 456 789}
do_test pragma3-330 {
db2 eval {
COMMIT;
PRAGMA data_version;
SELECT * FROM t4;
}
} {2 123 456 789}
do_test pragma3-340 {
db eval {
PRAGMA data_version;
SELECT * FROM t3;
SELECT * FROM t4;
}
} {2 abc def ghi 123 456 789}
db2 close
db close
sqlite3_enable_shared_cache $::enable_shared_cache
}
# Make sure this also works in WAL mode
#
# This will not work with the in-memory journal permutation, as opening
# [db2] switches the journal mode back to "memory"
#
ifcapable wal {
if {[permutation]!="inmemory_journal"} {
sqlite3 db test.db
db eval {PRAGMA journal_mode=WAL}
sqlite3 db2 test.db
do_test pragma3-400 {
db eval {
PRAGMA data_version;
PRAGMA journal_mode;
SELECT * FROM t1;
}
} {2 wal 101 201}
do_test pragma3-410 {
db2 eval {
PRAGMA data_version;
PRAGMA journal_mode;
SELECT * FROM t1;
}
} {2 wal 101 201}
do_test pragma3-420 {
db eval {UPDATE t1 SET a=111*(a/100); PRAGMA data_version; SELECT * FROM t1}
} {2 111 222}
do_test pragma3-430 {
db2 eval {PRAGMA data_version; SELECT * FROM t1;}
} {3 111 222}
db2 close
}
}
finish_test
-14
View File
@@ -1,14 +0,0 @@
########################################################
TOP=/home/drh/sqlite/sqlite
TCL_FLAGS=-I/home/drh/tcltk/86linux
LIBTCL=/home/drh/tcltk/86linux/libtcl8.6.a -lm -ldl -lpthread
BCC = gcc
TCC = gcc -ansi -g $(CFLAGS)
NAWK = awk
AR = ar cr
RANLIB = ranlib
THREADLIB = -lpthread -ldl -lz
include $(TOP)/main.mk
########################################################
+336 -104
View File
@@ -1,70 +1,63 @@
set rcsid {$Id: $}
#!/usr/bin/tclsh
#
# Documentation for this script. This may be output to stderr
# if the script is invoked incorrectly. See the [process_options]
# proc below.
#
set ::USAGE_MESSAGE {
This Tcl script is used to test the various configurations required
before releasing a new version. Supported command line options (all
before releasing a new version. Supported command line options (all
optional) are:
-makefile PATH-TO-MAKEFILE (default "releasetest.mk")
-platform PLATFORM (see below)
-quick BOOLEAN (default "0")
-config CONFIGNAME (Run only CONFIGNAME)
--srcdir TOP-OF-SQLITE-TREE (see below)
--platform PLATFORM (see below)
--config CONFIGNAME (Run only CONFIGNAME)
--quick (Run "veryquick.test" only)
--veryquick (Run "make smoketest" only)
--buildonly (Just build testfixture - do not run)
--dryrun (Print what would have happened)
--info (Show diagnostic info)
The default value for -makefile is "./releasetest.mk".
The default value for --srcdir is the parent of the directory holding
this script.
The script determines the default value for -platform using the
$tcl_platform(os) and $tcl_platform(machine) variables. Supported
The script determines the default value for --platform using the
$tcl_platform(os) and $tcl_platform(machine) variables. Supported
platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386".
If the -quick option is set to true, then the "veryquick.test" script
is run for all compilation configurations. Otherwise, sometimes "all.test"
is run, sometimes "veryquick.test".
Almost any SQLite makefile (except those generated by configure - see below)
should work. The following properties are required:
* The makefile should support the "fulltest" target.
* The makefile should support the variable "OPTS" as a way to pass
options from the make command line to lemon and the C compiler.
More precisely, the following invocation must be supported:
make -f $::MAKEFILE fulltest OPTS="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1"
Makefiles generated by the sqlite configure program cannot be used as
they do not respect the OPTS variable.
Example Makefile contents:
########################################################
TOP=/home/dan/work/sqlite/sqlite
TCL_FLAGS=-I/home/dan/tcl/include
LIBTCL=-L/home/dan/tcl/lib -ltcl
BCC = gcc
TCC = gcc -ansi -g $(CFLAGS)
NAWK = awk
AR = ar cr
RANLIB = ranlib
THREADLIB = -lpthread -ldl
include $(TOP)/main.mk
########################################################
Every test begins with a fresh run of the configure script at the top
of the SQLite source tree.
}
array set ::Configs {
# Omit comments (text between # and \n) in a long multi-line string.
#
proc strip_comments {in} {
regsub -all {#[^\n]*\n} $in {} out
return $out
}
array set ::Configs [strip_comments {
"Default" {
-O2
--disable-amalgamation --disable-shared
}
"Ftrapv" {
-O2 -ftrapv
-DSQLITE_MAX_ATTACHED=55
-DSQLITE_TCL_DEFAULT_FULLMUTEX=1
"Sanitize" {
CC=clang -fsanitize=undefined
-DSQLITE_ENABLE_STAT4
}
"Have-Not" {
# The "Have-Not" configuration sets all possible -UHAVE_feature options
# in order to verify that the code works even on platforms that lack
# these support services.
-DHAVE_FDATASYNC=0
-DHAVE_GMTIME_R=0
-DHAVE_ISNAN=0
-DHAVE_LOCALTIME_R=0
-DHAVE_LOCALTIME_S=0
-DHAVE_MALLOC_USABLE_SIZE=0
-DHAVE_STRCHRNUL=0
-DHAVE_USLEEP=0
-DHAVE_UTIME=0
}
"Unlock-Notify" {
-O2
@@ -81,6 +74,7 @@ array set ::Configs {
-O2
-DSQLITE_DEFAULT_FILE_FORMAT=4
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
-DSQLITE_ENABLE_STMT_SCANSTATUS
}
"Check-Symbols" {
-DSQLITE_MEMDEBUG=1
@@ -94,11 +88,13 @@ array set ::Configs {
-DSQLITE_SECURE_DELETE=1
-DSQLITE_SOUNDEX=1
-DSQLITE_ENABLE_ATOMIC_WRITE=1
-DSQLITE_ENABLE_IOTRACE=1
-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
-DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
-DSQLITE_ENABLE_STAT4
-DSQLITE_ENABLE_STMT_SCANSTATUS
}
"Debug-One" {
--disable-shared
-O2
-DSQLITE_DEBUG=1
-DSQLITE_MEMDEBUG=1
@@ -109,6 +105,8 @@ array set ::Configs {
-DSQLITE_ENABLE_MEMSYS5=1
-DSQLITE_ENABLE_MEMSYS3=1
-DSQLITE_ENABLE_COLUMN_METADATA=1
-DSQLITE_ENABLE_STAT4
-DSQLITE_MAX_ATTACHED=125
}
"Device-One" {
-O2
@@ -149,6 +147,7 @@ array set ::Configs {
-DSQLITE_ENABLE_LOCKING_STYLE=1
}
"OS-X" {
-O1 # Avoid a compiler bug in gcc 4.2.1 build 5658
-DSQLITE_OMIT_LOAD_EXTENSION=1
-DSQLITE_DEFAULT_MEMSTATUS=0
-DSQLITE_THREADSAFE=2
@@ -161,8 +160,9 @@ array set ::Configs {
-DSQLITE_DEFAULT_CACHE_SIZE=1000
-DSQLITE_MAX_LENGTH=2147483645
-DSQLITE_MAX_VARIABLE_NUMBER=500000
-DSQLITE_DEBUG=1
-DSQLITE_DEBUG=1
-DSQLITE_PREFER_PROXY_LOCKING=1
-DSQLITE_ENABLE_API_ARMOR=1
}
"Extra-Robustness" {
-DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
@@ -177,41 +177,80 @@ array set ::Configs {
-DSQLITE_DISABLE_FTS4_DEFERRED
-DSQLITE_ENABLE_RTREE
}
"No-lookaside" {
-DSQLITE_TEST_REALLOC_STRESS=1
-DSQLITE_OMIT_LOOKASIDE=1
-DHAVE_USLEEP=1
}
}
"Valgrind" {
-DSQLITE_ENABLE_STAT4
-DSQLITE_ENABLE_FTS4
-DSQLITE_ENABLE_RTREE
}
array set ::Platforms {
# The next group of configurations are used only by the
# Failure-Detection platform. They are all the same, but we need
# different names for them all so that they results appear in separate
# subdirectories.
#
Fail0 {-O0}
Fail2 {-O0}
Fail3 {-O0}
Fail4 {-O0}
}]
array set ::Platforms [strip_comments {
Linux-x86_64 {
"Check-Symbols" checksymbols
"Debug-One" test
"Debug-One" "mptest test"
"Have-Not" test
"Secure-Delete" test
"Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
"Update-Delete-Limit" test
"Extra-Robustness" test
"Device-Two" test
"Ftrapv" test
"No-lookaside" test
"Devkit" test
"Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test}
"Valgrind" valgrindtest
"Default" "threadtest fulltest"
"Device-One" fulltest
}
Linux-i686 {
"Devkit" test
"Have-Not" test
"Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
"Device-One" test
"Device-Two" test
"Default" "threadtest fulltest"
}
Darwin-i386 {
"Locking-Style" test
"Locking-Style" "mptest test"
"Have-Not" test
"OS-X" "threadtest fulltest"
}
}
Darwin-x86_64 {
"Locking-Style" "mptest test"
"Have-Not" test
"OS-X" "threadtest fulltest"
}
"Windows NT-intel" {
"Default" "mptest fulltestonly"
"Have-Not" test
}
# The Failure-Detection platform runs various tests that deliberately
# fail. This is used as a test of this script to verify that this script
# correctly identifies failures.
#
Failure-Detection {
Fail0 "TEST_FAILURE=0 test"
Sanitize "TEST_FAILURE=1 test"
Fail2 "TEST_FAILURE=2 valgrindtest"
Fail3 "TEST_FAILURE=3 valgrindtest"
Fail4 "TEST_FAILURE=4 test"
}
}]
# End of configuration section.
@@ -227,18 +266,82 @@ foreach {key value} [array get ::Platforms] {
}
}
# Open the file $logfile and look for a report on the number of errors
# and the number of test cases run. Add these values to the global
# $::NERRCASE and $::NTESTCASE variables.
#
# If any errors occur, then write into $errmsgVar the text of an appropriate
# one-line error message to show on the output.
#
proc count_tests_and_errors {logfile rcVar errmsgVar} {
if {$::DRYRUN} return
upvar 1 $rcVar rc $errmsgVar errmsg
set fd [open $logfile rb]
set seen 0
while {![eof $fd]} {
set line [gets $fd]
if {[regexp {(\d+) errors out of (\d+) tests} $line all nerr ntest]} {
incr ::NERRCASE $nerr
incr ::NTESTCASE $ntest
set seen 1
if {$nerr>0} {
set rc 1
set errmsg $line
}
}
if {[regexp {runtime error: +(.*)} $line all msg]} {
incr ::NERRCASE
if {$rc==0} {
set rc 1
set errmsg $msg
}
}
if {[regexp {ERROR SUMMARY: (\d+) errors.*} $line all cnt] && $cnt>0} {
incr ::NERRCASE
if {$rc==0} {
set rc 1
set errmsg $all
}
}
if {[regexp {^VERSION: 3\.\d+.\d+} $line]} {
set v [string range $line 9 end]
if {$::SQLITE_VERSION eq ""} {
set ::SQLITE_VERSION $v
} elseif {$::SQLITE_VERSION ne $v} {
set rc 1
set errmsg "version conflict: {$::SQLITE_VERSION} vs. {$v}"
}
}
}
close $fd
if {!$seen} {
set rc 1
set errmsg "Test did not complete"
if {[file readable core]} {
append errmsg " - core file exists"
}
}
}
proc run_test_suite {name testtarget config} {
# Tcl variable $opts is used to build up the value used to set the
# Tcl variable $opts is used to build up the value used to set the
# OPTS Makefile variable. Variable $cflags holds the value for
# CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
# CFLAGS is only passed to gcc.
#
set cflags ""
set cflags "-g"
set opts ""
set title ${name}($testtarget)
set configOpts ""
regsub -all {#[^\n]*\n} $config \n config
foreach arg $config {
if {[string match -D* $arg]} {
if {[regexp {^-[UD]} $arg]} {
lappend opts $arg
} elseif {[regexp {^[A-Z]+=} $arg]} {
lappend testtarget $arg
} elseif {[regexp {^--(enable|disable)-} $arg]} {
lappend configOpts $arg
} else {
lappend cflags $arg
}
@@ -258,30 +361,76 @@ proc run_test_suite {name testtarget config} {
append opts " -DSQLITE_OS_UNIX=1"
}
# Run the test.
#
set makefile [file normalize $::MAKEFILE]
file mkdir $dir
puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..."
flush stdout
if {!$::TRACE} {
set n [string length $title]
puts -nonewline "${title}[string repeat . [expr {63-$n}]]"
flush stdout
}
set makecmd [concat \
[list exec make -C $dir -f $makefile clean] \
$testtarget \
[list CFLAGS=$cflags OPTS=$opts >& $dir/test.log] \
]
set tm1 [clock seconds]
set rc [catch $makecmd]
set rc 0
set tm1 [clock seconds]
set origdir [pwd]
trace_cmd file mkdir $dir
trace_cmd cd $dir
set errmsg {}
catch {file delete core}
set rc [catch [configureCommand $configOpts]]
if {!$rc} {
set rc [catch [makeCommand $testtarget $cflags $opts]]
count_tests_and_errors test.log rc errmsg
}
trace_cmd cd $origdir
set tm2 [clock seconds]
set minutes [expr {($tm2-$tm1)/60}]
set seconds [expr {($tm2-$tm1)%60}]
puts -nonewline [format " (%d:%.2d) " $minutes $seconds]
if {$rc} {
puts "FAILED."
} else {
puts "Ok."
if {!$::TRACE} {
set hours [expr {($tm2-$tm1)/3600}]
set minutes [expr {(($tm2-$tm1)/60)%60}]
set seconds [expr {($tm2-$tm1)%60}]
set tm [format (%02d:%02d:%02d) $hours $minutes $seconds]
if {$rc} {
puts " FAIL $tm"
incr ::NERR
if {$errmsg!=""} {puts " $errmsg"}
} else {
puts " Ok $tm"
}
}
}
# The following procedure returns the "configure" command to be exectued for
# the current platform, which may be Windows (via MinGW, etc).
#
proc configureCommand {opts} {
set result [list trace_cmd exec]
if {$::tcl_platform(platform)=="windows"} {
lappend result sh
}
lappend result $::SRCDIR/configure --enable-load-extension
foreach x $opts {lappend result $x}
lappend result >& test.log
}
# The following procedure returns the "make" command to be executed for the
# specified targets, compiler flags, and options.
#
proc makeCommand { targets cflags opts } {
set result [list trace_cmd exec make clean]
foreach target $targets {
lappend result $target
}
lappend result CFLAGS=$cflags OPTS=$opts >>& test.log
}
# The following procedure prints its arguments if ::TRACE is true.
# And it executes the command of its arguments in the calling context
# if ::DRYRUN is false.
#
proc trace_cmd {args} {
if {$::TRACE} {
puts $args
}
if {!$::DRYRUN} {
uplevel 1 $args
}
}
@@ -292,16 +441,22 @@ proc run_test_suite {name testtarget config} {
# option.
#
proc process_options {argv} {
set ::MAKEFILE releasetest.mk ;# Default value
set ::QUICK 0 ;# Default value
set ::SRCDIR [file normalize [file dirname [file dirname $::argv0]]]
set ::QUICK 0
set ::BUILDONLY 0
set ::DRYRUN 0
set ::EXEC exec
set ::TRACE 0
set config {}
set platform $::tcl_platform(os)-$::tcl_platform(machine)
for {set i 0} {$i < [llength $argv]} {incr i} {
switch -- [lindex $argv $i] {
-makefile {
set x [lindex $argv $i]
if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]}
switch -glob -- $x {
-srcdir {
incr i
set ::MAKEFILE [lindex $argv $i]
set ::SRCDIR [file normalize [lindex $argv $i]]
}
-platform {
@@ -310,15 +465,57 @@ proc process_options {argv} {
}
-quick {
incr i
set ::QUICK [lindex $argv $i]
set ::QUICK 1
}
-veryquick {
set ::QUICK 2
}
-config {
incr i
set config [lindex $argv $i]
}
-buildonly {
set ::BUILDONLY 1
}
-dryrun {
set ::DRYRUN 1
}
-trace {
set ::TRACE 1
}
-info {
puts "Command-line Options:"
puts " --srcdir $::SRCDIR"
puts " --platform [list $platform]"
puts " --config [list $config]"
if {$::QUICK} {puts " --quick"}
if {$::BUILDONLY} {puts " --buildonly"}
if {$::DRYRUN} {puts " --dryrun"}
if {$::TRACE} {puts " --trace"}
puts "\nAvailable --platform options:"
foreach y [lsort [array names ::Platforms]] {
puts " [list $y]"
}
puts "\nAvailable --config options:"
foreach y [lsort [array names ::Configs]] {
puts " [list $y]"
}
exit
}
-g -
-D* -
-O* -
-enable-* -
-disable-* -
*=* {
lappend ::EXTRACONFIG [lindex $argv $i]
}
default {
puts stderr ""
puts stderr [string trim $::USAGE_MESSAGE]
@@ -327,8 +524,6 @@ proc process_options {argv} {
}
}
set ::MAKEFILE [file normalize $::MAKEFILE]
if {0==[info exists ::Platforms($platform)]} {
puts "Unknown platform: $platform"
puts -nonewline "Set the -platform option to "
@@ -347,8 +542,16 @@ proc process_options {argv} {
} else {
set ::CONFIGLIST $::Platforms($platform)
}
puts "Running the following configurations for $platform:"
puts "Running the following test configurations for $platform:"
puts " [string trim $::CONFIGLIST]"
puts -nonewline "Flags:"
if {$::DRYRUN} {puts -nonewline " --dryrun"}
if {$::BUILDONLY} {puts -nonewline " --buildonly"}
switch -- $::QUICK {
1 {puts -nonewline " --quick"}
2 {puts -nonewline " --veryquick"}
}
puts ""
}
# Main routine.
@@ -356,30 +559,59 @@ proc process_options {argv} {
proc main {argv} {
# Process any command line options.
set ::EXTRACONFIG {}
process_options $argv
puts [string repeat * 79]
set ::NERR 0
set ::NTEST 0
set ::NTESTCASE 0
set ::NERRCASE 0
set ::SQLITE_VERSION {}
set STARTTIME [clock seconds]
foreach {zConfig target} $::CONFIGLIST {
if {$::QUICK} {set target test}
set config_options $::Configs($zConfig)
if {$target ne "checksymbols"} {
switch -- $::QUICK {
1 {set target test}
2 {set target smoketest}
}
if {$::BUILDONLY} {set target testfixture}
}
set config_options [concat $::Configs($zConfig) $::EXTRACONFIG]
incr NTEST
run_test_suite $zConfig $target $config_options
# If the configuration included the SQLITE_DEBUG option, then remove
# it and run veryquick.test. If it did not include the SQLITE_DEBUG option
# add it and run veryquick.test.
if {$target!="checksymbols"} {
if {$target!="checksymbols" && $target!="valgrindtest"
&& !$::BUILDONLY && $::QUICK<2} {
set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*]
set xtarget $target
regsub -all {fulltest[a-z]*} $xtarget test xtarget
if {$debug_idx < 0} {
run_test_suite "${zConfig}_debug" test [
concat $config_options -DSQLITE_DEBUG=1
]
incr NTEST
append config_options " -DSQLITE_DEBUG=1"
run_test_suite "${zConfig}_debug" $xtarget $config_options
} else {
run_test_suite "${zConfig}_ndebug" test [
lreplace $config_options $debug_idx $debug_idx
]
incr NTEST
regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $config_options { } config_options
regsub { *-DSQLITE_DEBUG[^ ]* *} $config_options { } config_options
run_test_suite "${zConfig}_ndebug" $xtarget $config_options
}
}
}
set elapsetime [expr {[clock seconds]-$STARTTIME}]
set hr [expr {$elapsetime/3600}]
set min [expr {($elapsetime/60)%60}]
set sec [expr {$elapsetime%60}]
set etime [format (%02d:%02d:%02d) $hr $min $sec]
puts [string repeat * 79]
puts "$::NERRCASE failures out of $::NTESTCASE tests in $etime"
if {$::SQLITE_VERSION ne ""} {
puts "SQLite $::SQLITE_VERSION"
}
}
+39
View File
@@ -0,0 +1,39 @@
# 2015-01-05
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file verifies that INSERT operations with a very large number of
# VALUE terms works and does not hit the SQLITE_LIMIT_COMPOUND_SELECT limit.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix selectG
# Do an INSERT with a VALUES clause that contains 100,000 entries. Verify
# that this insert happens quickly (in less than 10 seconds). Actually, the
# insert will normally happen in less than 0.5 seconds on a workstation, but
# we allow plenty of overhead for slower machines. The speed test checks
# for an O(N*N) inefficiency that was once in the code and that would make
# the insert run for over a minute.
#
do_test 100 {
set sql "CREATE TABLE t1(x);\nINSERT INTO t1(x) VALUES"
for {set i 1} {$i<100000} {incr i} {
append sql "($i),"
}
append sql "($i);"
set microsec [lindex [time {db eval $sql}] 0]
db eval {
SELECT count(x), sum(x), avg(x), $microsec<10000000 FROM t1;
}
} {100000 5000050000 50000.5 1}
finish_test
+15 -13
View File
@@ -207,10 +207,10 @@ do_test shell1-2.2.4 {
} {0 {}}
do_test shell1-2.2.5 {
catchcmd "test.db" ".mode \"insert FOO"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-2.2.6 {
catchcmd "test.db" ".mode \'insert FOO"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
# check multiple tokens, and quoted tokens
do_test shell1-2.3.1 {
@@ -238,7 +238,7 @@ do_test shell1-2.3.7 {
# check quoted args are unquoted
do_test shell1-2.4.1 {
catchcmd "test.db" ".mode FOO"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-2.4.2 {
catchcmd "test.db" ".mode csv"
} {0 {}}
@@ -421,20 +421,21 @@ do_test shell1-3.12.3 {
} {1 {Usage: .indices ?LIKE-PATTERN?}}
# .mode MODE ?TABLE? Set output mode where MODE is one of:
# ascii Columns/rows delimited by 0x1F and 0x1E
# csv Comma-separated values
# column Left-aligned columns. (See .width)
# html HTML <table> code
# insert SQL insert statements for TABLE
# line One value per line
# list Values delimited by .separator string
# list Values delimited by .separator strings
# tabs Tab-separated values
# tcl TCL list elements
do_test shell1-3.13.1 {
catchcmd "test.db" ".mode"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-3.13.2 {
catchcmd "test.db" ".mode FOO"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-3.13.3 {
catchcmd "test.db" ".mode csv"
} {0 {}}
@@ -467,10 +468,10 @@ do_test shell1-3.13.11 {
# don't allow partial mode type matches
do_test shell1-3.13.12 {
catchcmd "test.db" ".mode l"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-3.13.13 {
catchcmd "test.db" ".mode li"
} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
do_test shell1-3.13.14 {
catchcmd "test.db" ".mode lin"
} {0 {}}
@@ -586,10 +587,10 @@ CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
CREATE VIEW v1 AS SELECT y+1 FROM v2;}}
db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}
# .separator STRING Change separator used by output mode and .import
# .separator STRING Change column separator used by output and .import
do_test shell1-3.22.1 {
catchcmd "test.db" ".separator"
} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
} {1 {Usage: .separator COL ?ROW?}}
do_test shell1-3.22.2 {
catchcmd "test.db" ".separator FOO"
} {0 {}}
@@ -599,7 +600,7 @@ do_test shell1-3.22.3 {
do_test shell1-3.22.4 {
# too many arguments
catchcmd "test.db" ".separator FOO BAD BAD2"
} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
} {1 {Usage: .separator COL ?ROW?}}
# .show Show the current values for various settings
do_test shell1-3.23.1 {
@@ -610,10 +611,11 @@ do_test shell1-3.23.1 {
[regexp {mode:} $res] \
[regexp {nullvalue:} $res] \
[regexp {output:} $res] \
[regexp {separator:} $res] \
[regexp {colseparator:} $res] \
[regexp {rowseparator:} $res] \
[regexp {stats:} $res] \
[regexp {width:} $res]
} {1 1 1 1 1 1 1 1 1}
} {1 1 1 1 1 1 1 1 1 1}
do_test shell1-3.23.2 {
# too many arguments
catchcmd "test.db" ".show BAD"
+37 -5
View File
@@ -55,7 +55,7 @@ do_test shell5-1.1.3 {
# .separator STRING Change separator used by output mode and .import
do_test shell5-1.2.1 {
catchcmd "test.db" ".separator"
} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
} {1 {Usage: .separator COL ?ROW?}}
do_test shell5-1.2.2 {
catchcmd "test.db" ".separator ONE"
} {0 {}}
@@ -65,12 +65,18 @@ do_test shell5-1.2.3 {
do_test shell5-1.2.4 {
# too many arguments
catchcmd "test.db" ".separator ONE TWO THREE"
} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
} {1 {Usage: .separator COL ?ROW?}}
# separator should default to "|"
do_test shell5-1.3.1 {
# column separator should default to "|"
do_test shell5-1.3.1.1 {
set res [catchcmd "test.db" ".show"]
list [regexp {separator: \"\|\"} $res]
list [regexp {colseparator: \"\|\"} $res]
} {1}
# row separator should default to "\n"
do_test shell5-1.3.1.2 {
set res [catchcmd "test.db" ".show"]
list [regexp {rowseparator: \"\\n\"} $res]
} {1}
# set separator to different value.
@@ -372,5 +378,31 @@ CREATE TABLE t4(a, b);
db eval { SELECT * FROM t4 }
} {xy\" hello one 2 {} {}}
#----------------------------------------------------------------------------
# Tests for the shell "ascii" import/export mode.
#
do_test shell5-3.1 {
set fd [open shell5.csv w]
fconfigure $fd -encoding binary -translation binary
puts -nonewline $fd "\"test 1\"\x1F,test 2\r\n\x1E"
puts -nonewline $fd "test 3\x1Ftest 4\n"
close $fd
catchcmd test.db {
.mode ascii
CREATE TABLE t5(a, b);
.import shell5.csv t5
}
db eval { SELECT * FROM t5 }
} "\{\"test 1\"} \{,test 2\r\n\} \{test 3\} \{test 4\n\}"
do_test shell5-3.2 {
set x [catchcmd test.db {
.mode ascii
SELECT * FROM t5;
}]
# Handle platform end-of-line differences
regsub -all {[\n\r]?\n} $x <EOL> x
set x
} "0 \{\"test 1\"\x1F,test 2<EOL>\x1Etest 3\x1Ftest 4<EOL>\x1E\}"
finish_test
+5
View File
@@ -16,6 +16,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix sort
db close
sqlite3_shutdown
sqlite3_config_pmasz 10
sqlite3_initialize
sqlite3 db test.db
# Create a bunch of data to sort against
#
+5
View File
@@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix sort2
db close
sqlite3_shutdown
sqlite3_config_pmasz 10
sqlite3_initialize
sqlite3 db test.db
foreach {tn script} {
1 { }
+6
View File
@@ -17,6 +17,12 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix sort4
db close
sqlite3_shutdown
sqlite3_config_pmasz 10
sqlite3_initialize
sqlite3 db test.db
# Configure the sorter to use 3 background threads.
db eval {PRAGMA threads=3}
+6
View File
@@ -17,6 +17,12 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix sortfault
db close
sqlite3_shutdown
sqlite3_config_pmasz 10
sqlite3_initialize
sqlite3 db test.db
do_execsql_test 1.0 {
PRAGMA cache_size = 5;
+64 -60
View File
@@ -1,41 +1,41 @@
/*
** 2010-07-22
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** The code in this file runs a few multi-threaded test cases using the
** SQLite library. It can be compiled to an executable on unix using the
** following command:
**
** gcc -O2 threadtest3.c sqlite3.c -ldl -lpthread -lm
**
** Then run the compiled program. The exit status is non-zero if any tests
** failed (hopefully there is also some output to stdout to clarify what went
** wrong).
** Even though threadtest3.c is the only C source code file mentioned on
** the compiler command-line, #include macros are used to pull in additional
** C code files named "tt3_*.c".
**
** There are three parts to the code in this file, in the following order:
** After compiling, run this program with an optional argument telling
** which test to run. All tests are run if no argument is given. The
** argument can be a glob pattern to match multiple tests. Examples:
**
** 1. Code for the SQL aggregate function md5sum() copied from
** tclsqlite.c in the SQLite distribution. The names of all the
** types and functions in this section begin with "MD5" or "md5".
** ./a.out -- Run all tests
** ./a.out walthread3 -- Run the "walthread3" test
** ./a.out 'wal*' -- Run all of the wal* tests
** ./a.out --help -- List all available tests
**
** 2. A set of utility functions that may be used to implement
** multi-threaded test cases. These are all called by test code
** via macros that help with error reporting. The macros are defined
** immediately below this comment.
**
** 3. The test code itself. And a main() routine to drive the test
** code.
** The exit status is non-zero if any test fails.
*/
/*************************************************************************
** Start of test code/infrastructure interface macros.
**
** The following macros constitute the interface between the test
** programs and the test infrastructure. Test infrastructure code
** does not itself use any of these macros. Test code should not
** call any of the macroname_x() functions directly.
**
** See the header comments above the corresponding macroname_x()
** function for a description of each interface.
/*
** The "Set Error Line" macro.
*/
#define SEL(e) ((e)->iLine = ((e)->rc ? (e)->iLine : __LINE__))
/* Database functions */
#define opendb(w,x,y,z) (SEL(w), opendb_x(w,x,y,z))
@@ -391,9 +391,9 @@ static void md5finalize(sqlite3_context *context){
sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
}
/*************************************************************************
/*
** End of copied md5sum() code.
*/
**************************************************************************/
typedef sqlite3_int64 i64;
@@ -447,8 +447,13 @@ static void free_err(Error *p){
static void print_err(Error *p){
if( p->rc!=SQLITE_OK ){
printf("Error: (%d) \"%s\" at line %d\n", p->rc, p->zErr, p->iLine);
nGlobalErr++;
int isWarn = 0;
if( p->rc==SQLITE_SCHEMA ) isWarn = 1;
if( sqlite3_strglob("* - no such table: *",p->zErr)==0 ) isWarn = 1;
printf("%s: (%d) \"%s\" at line %d\n", isWarn ? "Warning" : "Error",
p->rc, p->zErr, p->iLine);
if( !isWarn ) nGlobalErr++;
fflush(stdout);
}
}
@@ -785,6 +790,7 @@ static void join_all_threads_x(
if( pErr->rc==SQLITE_OK ) system_error(pErr, rc);
}else{
printf("Thread %d says: %s\n", p->iTid, (ret==0 ? "..." : (char *)ret));
fflush(stdout);
}
sqlite3_free(p);
}
@@ -898,11 +904,6 @@ static int timetostop_x(
return ret;
}
/*
** The "Set Error Line" macro.
*/
#define SEL(e) ((e)->iLine = ((e)->rc ? (e)->iLine : __LINE__))
/*************************************************************************
**************************************************************************
@@ -984,6 +985,7 @@ static void walthread1(int nMs){
"INSERT INTO t1 VALUES(randomblob(100));"
"INSERT INTO t1 SELECT md5sum(x) FROM t1;"
);
closedb(&err, &db);
setstoptime(&err, nMs);
for(i=0; i<WALTHREAD1_NTHREAD; i++){
@@ -1427,16 +1429,15 @@ static void dynamic_triggers(int nMs){
int main(int argc, char **argv){
struct ThreadTest {
void (*xTest)(int);
const char *zTest;
int nMs;
void (*xTest)(int); /* Routine for running this test */
const char *zTest; /* Name of this test */
int nMs; /* How long to run this test, in milliseconds */
} aTest[] = {
{ walthread1, "walthread1", 20000 },
{ walthread2, "walthread2", 20000 },
{ walthread3, "walthread3", 20000 },
{ walthread4, "walthread4", 20000 },
{ walthread5, "walthread5", 1000 },
{ walthread5, "walthread5", 1000 },
{ cgt_pager_1, "cgt_pager_1", 0 },
{ dynamic_triggers, "dynamic_triggers", 20000 },
@@ -1450,30 +1451,35 @@ int main(int argc, char **argv){
{ stress1, "stress1", 10000 },
{ stress2, "stress2", 60000 },
};
int i;
int bTestfound = 0;
static char *substArgv[] = { 0, "*", 0 };
int i, iArg;
int nTestfound = 0;
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
for(i=0; i<sizeof(aTest)/sizeof(aTest[0]); i++){
char const *z = aTest[i].zTest;
if( argc>1 ){
int iArg;
for(iArg=1; iArg<argc; iArg++){
if( 0==sqlite3_strglob(argv[iArg], z) ) break;
}
if( iArg==argc ) continue;
}
printf("Running %s for %d seconds...\n", z, aTest[i].nMs/1000);
aTest[i].xTest(aTest[i].nMs);
bTestfound++;
if( argc<2 ){
argc = 2;
argv = substArgv;
}
if( bTestfound==0 ) goto usage;
for(iArg=1; iArg<argc; iArg++){
for(i=0; i<sizeof(aTest)/sizeof(aTest[0]); i++){
if( sqlite3_strglob(argv[iArg],aTest[i].zTest)==0 ) break;
}
if( i>=sizeof(aTest)/sizeof(aTest[0]) ) goto usage;
}
for(iArg=1; iArg<argc; iArg++){
for(i=0; i<sizeof(aTest)/sizeof(aTest[0]); i++){
char const *z = aTest[i].zTest;
if( sqlite3_strglob(argv[iArg],z)==0 ){
printf("Running %s for %d seconds...\n", z, aTest[i].nMs/1000);
fflush(stdout);
aTest[i].xTest(aTest[i].nMs);
nTestfound++;
}
}
}
if( nTestfound==0 ) goto usage;
printf("Total of %d errors across all tests\n", nGlobalErr);
printf("%d errors out of %d tests\n", nGlobalErr, nTestfound);
return (nGlobalErr>0 ? 255 : 0);
usage:
@@ -1485,5 +1491,3 @@ int main(int argc, char **argv){
return 254;
}
+1 -3
View File
@@ -1,5 +1,5 @@
/*
** 2001 September 15
** 2011-02-02
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
@@ -146,5 +146,3 @@ static void checkpoint_starvation_2(int nMs){
}
print_and_free_err(&err);
}
+87 -5
View File
@@ -363,9 +363,10 @@ foreach {testprefix do_wal_checkpoint} {
code2 $do_wal_checkpoint
code3 $do_wal_checkpoint
do_test 3.$tn.1 {
do_test 4.$tn.1 {
sql1 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 0;
PRAGMA journal_mode = WAL;
PRAGMA synchronous = normal;
CREATE TABLE t1(x, y);
@@ -376,19 +377,100 @@ foreach {testprefix do_wal_checkpoint} {
file size test.db-wal
} [wal_file_size 8 1024]
do_test 3.$tn.2 { do_wal_checkpoint db -mode truncate } {0 0 0}
do_test 3.$tn.3 { file size test.db-wal } 0
do_test 4.$tn.2 { do_wal_checkpoint db -mode truncate } {0 0 0}
do_test 4.$tn.3 { file size test.db-wal } 0
do_test 3.$tn.4 {
do_test 4.$tn.4 {
sql2 { SELECT * FROM t1 }
} {1 2 3 4}
do_test 3.$tn.5 {
do_test 4.$tn.5 {
sql2 { INSERT INTO t1 VALUES('a', 'b') }
file size test.db-wal
} [wal_file_size 2 1024]
}
# Test that FULL, RESTART and TRUNCATE callbacks block on other clients
# and truncate the wal file as required even if the entire wal file has
# already been checkpointed when they are invoked.
#
do_multiclient_test tn {
code1 $do_wal_checkpoint
code2 $do_wal_checkpoint
code3 $do_wal_checkpoint
do_test 5.$tn.1 {
sql1 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 0;
PRAGMA journal_mode = WAL;
PRAGMA synchronous = normal;
CREATE TABLE t1(x, y);
CREATE INDEX i1 ON t1(x, y);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
INSERT INTO t1 VALUES(5, 6);
}
file size test.db-wal
} [wal_file_size 10 1024]
do_test 5.$tn.2 {
sql2 { BEGIN; SELECT * FROM t1 }
} {1 2 3 4 5 6}
do_test 5.$tn.3 { do_wal_checkpoint db -mode passive } {0 10 10}
do_test 5.$tn.4 {
sql3 { BEGIN; INSERT INTO t1 VALUES(7, 8); }
} {}
do_test 5.$tn.5 { do_wal_checkpoint db -mode passive } {0 10 10}
do_test 5.$tn.6 { do_wal_checkpoint db -mode full } {1 10 10}
do_test 5.$tn.7 { sql3 { ROLLBACK } } {}
do_test 5.$tn.8 { do_wal_checkpoint db -mode full } {0 10 10}
do_test 5.$tn.9 { do_wal_checkpoint db -mode truncate } {1 10 10}
do_test 5.$tn.10 {
file size test.db-wal
} [wal_file_size 10 1024]
proc xBusyHandler {n} { sql2 { COMMIT } ; return 0 }
db busy xBusyHandler
do_test 5.$tn.11 { do_wal_checkpoint db -mode truncate } {0 0 0}
do_test 5.$tn.12 { file size test.db-wal } 0
do_test 5.$tn.13 {
sql1 {
INSERT INTO t1 VALUES(7, 8);
INSERT INTO t1 VALUES(9, 10);
SELECT * FROM t1;
}
} {1 2 3 4 5 6 7 8 9 10}
do_test 5.$tn.14 {
sql2 { BEGIN; SELECT * FROM t1 }
} {1 2 3 4 5 6 7 8 9 10}
proc xBusyHandler {n} { return 1 }
do_test 5.$tn.14 { do_wal_checkpoint db -mode truncate } {1 4 4}
do_test 5.$tn.15 { file size test.db-wal } [wal_file_size 4 1024]
do_test 5.$tn.16 { do_wal_checkpoint db -mode restart } {1 4 4}
proc xBusyHandler {n} { sql2 { COMMIT } ; return 0 }
db busy xBusyHandler
do_test 5.$tn.17 { do_wal_checkpoint db -mode restart } {0 4 4}
do_test 5.$tn.18 { file size test.db-wal } [wal_file_size 4 1024]
do_test 5.$tn.19 { do_wal_checkpoint db -mode truncate } {0 0 0}
do_test 5.$tn.20 { file size test.db-wal } 0
}
}
+41
View File
@@ -0,0 +1,41 @@
# 2014-12-28
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Verify that WITHOUT ROWID tables work correctly when the PRIMARY KEY
# has redundant columns.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_execsql_test without_rowid6-100 {
CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,a,b,c,d,a,b,c)) WITHOUT ROWID;
CREATE INDEX t1a ON t1(b, b);
WITH RECURSIVE
c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<1000)
INSERT INTO t1(a,b,c,d,e) SELECT i, i+1000, printf('x%dy',i), 0, 0 FROM c;
ANALYZE;
} {}
do_execsql_test without_rowid6-110 {
SELECT c FROM t1 WHERE a=123;
} {x123y}
do_execsql_test without_rowid6-120 {
SELECT c FROM t1 WHERE b=1123;
} {x123y}
do_execsql_test without_rowid6-130 {
SELECT c FROM t1 ORDER BY a DESC LIMIT 5;
} {x1000y x999y x998y x997y x996y}
do_execsql_test without_rowid6-140 {
SELECT c FROM t1 ORDER BY b LIMIT 5;
} {x1y x2y x3y x4y x5y}
finish_test
+76 -4
View File
@@ -58,6 +58,9 @@ IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)
SET REDIRECT=^>
IF DEFINED __ECHO SET REDIRECT=^^^>
%_AECHO% Running %0 %*
REM SET DFLAGS=/L
@@ -318,7 +321,18 @@ FOR %%P IN (%PLATFORMS%) DO (
%_AECHO% Building the %%B configuration for platform %%P with name %%D...
IF /I "%%B" == "Debug" (
SET DEBUG=2
REM
REM NOTE: Using this level for the DEBUG environment variable should
REM disable all compiler optimizations and prevent use of the
REM NDEBUG define. Additionally, both SQLITE_ENABLE_API_ARMOR
REM and SQLITE_DEBUG defines should be enabled.
REM
SET DEBUG=3
REM
REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG
REM define.
REM
SET MEMDEBUG=1
) ELSE (
CALL :fn_UnsetVariable DEBUG
@@ -420,11 +434,11 @@ FOR %%P IN (%PLATFORMS%) DO (
) ELSE (
REM
REM NOTE: Even when the cleaning step has been disabled, we still
REM need to remove the build output for the files we are
REM need to remove the build output for all the files we are
REM specifically wanting to build for each platform.
REM
%_AECHO% Cleaning final output files only...
%__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb
%_AECHO% Cleaning final core library output files only...
%__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb 2%REDIRECT% NUL
)
REM
@@ -476,6 +490,64 @@ FOR %%P IN (%PLATFORMS%) DO (
GOTO errors
)
)
REM
REM NOTE: If requested, also build the shell executable.
REM
IF DEFINED BUILD_ALL_SHELL (
REM
REM NOTE: If necessary, make sure any previous build output for the
REM shell executable is deleted.
REM
IF DEFINED NOCLEAN (
REM
REM NOTE: Even when the cleaning step has been disabled, we still
REM need to remove the build output for all the files we are
REM specifically wanting to build for each platform.
REM
%_AECHO% Cleaning final shell executable output files only...
%__ECHO% DEL /Q sqlite3.exe sqlite3sh.pdb 2%REDIRECT% NUL
)
REM
REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.exe"
REM binary. The x86 compiler will be used to compile the native
REM command line tools needed during the build process itself.
REM Also, disable looking for and/or linking to the native Tcl
REM runtime library.
REM
%__ECHO% %NMAKE_CMD% sqlite3.exe XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
IF ERRORLEVEL 1 (
ECHO Failed to build %%B "sqlite3.exe" for platform %%P.
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
REM for the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.exe "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.exe" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3sh.pdb" file to the appropriate directory
REM for the build and platform beneath the binary directory
REM unless we are prevented from doing so.
REM
IF NOT DEFINED NOSYMBOLS (
%__ECHO% XCOPY sqlite3sh.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3sh.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
)
)
)
)
)
+14 -8
View File
@@ -1497,10 +1497,12 @@ int main(int argc, char **argv)
{OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."},
{OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."},
{OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."},
{OPT_FSTR, "T", (char*)handle_T_option, "Specify a template file."},
{OPT_FSTR, "f", 0, "Ignored. (Placeholder for -f compiler options.)"},
{OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."},
{OPT_FSTR, "I", 0, "Ignored. (Placeholder for '-I' compiler options.)"},
{OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file."},
{OPT_FLAG, "l", (char*)&nolinenosflag, "Do not print #line statements."},
{OPT_FSTR, "O", 0, "Ignored. (Placeholder for '-O' compiler options.)"},
{OPT_FLAG, "p", (char*)&showPrecedenceConflict,
"Show conflicts resolved by precedence rules"},
{OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."},
@@ -1508,6 +1510,8 @@ int main(int argc, char **argv)
{OPT_FLAG, "s", (char*)&statistics,
"Print parser stats to standard output."},
{OPT_FLAG, "x", (char*)&version, "Print the version number."},
{OPT_FSTR, "T", (char*)handle_T_option, "Specify a template file."},
{OPT_FSTR, "W", 0, "Ignored. (Placeholder for '-W' compiler options.)"},
{OPT_FLAG,0,0,0}
};
int i;
@@ -1812,6 +1816,8 @@ static int handleflags(int i, FILE *err)
errline(i,1,err);
}
errcnt++;
}else if( op[j].arg==0 ){
/* Ignore this option */
}else if( op[j].type==OPT_FLAG ){
*((int*)op[j].arg) = v;
}else if( op[j].type==OPT_FFLAG ){
@@ -2001,17 +2007,17 @@ void OptPrint(){
break;
case OPT_INT:
case OPT_FINT:
fprintf(errstream," %s=<integer>%*s %s\n",op[i].label,
fprintf(errstream," -%s<integer>%*s %s\n",op[i].label,
(int)(max-lemonStrlen(op[i].label)-9),"",op[i].message);
break;
case OPT_DBL:
case OPT_FDBL:
fprintf(errstream," %s=<real>%*s %s\n",op[i].label,
fprintf(errstream," -%s<real>%*s %s\n",op[i].label,
(int)(max-lemonStrlen(op[i].label)-6),"",op[i].message);
break;
case OPT_STR:
case OPT_FSTR:
fprintf(errstream," %s=<string>%*s %s\n",op[i].label,
fprintf(errstream," -%s<string>%*s %s\n",op[i].label,
(int)(max-lemonStrlen(op[i].label)-8),"",op[i].message);
break;
}
@@ -2436,7 +2442,7 @@ to follow the previous rule.");
if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){
const char *zOld, *zNew;
char *zBuf, *z;
int nOld, n, nLine, nNew, nBack;
int nOld, n, nLine = 0, nNew, nBack;
int addLineMacro;
char zLine[50];
zNew = x;
@@ -2635,7 +2641,7 @@ void Parse(struct lemon *gp)
struct pstate ps;
FILE *fp;
char *filebuf;
int filesize;
unsigned int filesize;
int lineno;
int c;
char *cp, *nextcp;
@@ -2769,7 +2775,7 @@ void Parse(struct lemon *gp)
c = *cp;
*cp = 0; /* Null terminate the token */
parseonetoken(&ps); /* Parse the token */
*cp = c; /* Restore the buffer */
*cp = (char)c; /* Restore the buffer */
cp = nextcp;
}
free(filebuf); /* Release the buffer after parsing */
@@ -3392,7 +3398,7 @@ PRIVATE char *append_str(const char *zText, int n, int p1, int p2){
zText++;
n--;
}else{
z[used++] = c;
z[used++] = (char)c;
}
}
z[used] = 0;

Some files were not shown because too many files have changed in this diff Show More