Compare commits

...

159 Commits

Author SHA1 Message Date
drh c5d03adb7d Merge 3.44.2 changes into the wal2-3.44 sub-branch.
FossilOrigin-Name: 0118e8c981fdfa4f8e593b56a2cbb97c489c3a97a3494f21a7a63b196659530c
2023-11-24 12:38:54 +00:00
drh c8f9803dc3 Version 3.44.2
FossilOrigin-Name: ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f
2023-11-24 11:41:44 +00:00
drh b4b2be91dd Another assertion fault fix, similar to [a9443dbfbe25e588].
FossilOrigin-Name: f796da626b5c3b099cc246a8b46d92839922e34f398d673b0b03d7ee33a28a60
2023-11-23 12:12:54 +00:00
drh 6292bb4fc0 Fix harmless compiler warnings in debugging code.
FossilOrigin-Name: db40272c36c01d5eeb902daed2670d57ee858caae560785350aed2600b573c2d
2023-11-23 11:45:15 +00:00
drh 90d7893739 Fix an fts5 problem that could occur when mixing regular and secure delete operations on a single table.
FossilOrigin-Name: 25fb5a540b1a61e1d0ff3d74ad7135bc53eb3fbe9f5352f98dd22dc7edd063bb
2023-11-23 11:29:00 +00:00
drh efba33ed48 Increase the version number to 3.44.2.
FossilOrigin-Name: 73d3cb790950e317256f500e8bfd707a6156631628a80bcafce494e8bb1e1966
2023-11-23 11:21:20 +00:00
larrybr e6fa99aebd Fix output redirect bug reported in [forum:/forumposts/cbf4933cfeee74bb|the forum].
FossilOrigin-Name: 2ab256bc0bb351c16feaf0d4917ad9c3f55e39821cc7d319d86c6f0752188af7
2023-11-23 07:06:21 +00:00
stephan c028221c3f Correct the URL for loading sqlite3-worker1-bundler-friendly.mjs from sqlite3-worker1-promiser-bundler-friendly.js, so that the promiser can be used in bundler-using environments. Problem reported via email.
FossilOrigin-Name: b1128838f9508ba8e4b735a386c5dd42c1faf84705b95fb069ab724637341170
2023-11-22 17:13:27 +00:00
drh f407093a5a Merge the 3.44.1 patches into a sub-branch of wal2.
FossilOrigin-Name: 2672572cc373e97054cc56dd0d48aaf56be5fef9704f7c177f64bd622151eadb
2023-11-22 15:34:38 +00:00
drh fef8c0b942 Version 3.44.1
FossilOrigin-Name: d295f48e8f367b066b881780c98bdf980a1d550397d5ba0b0e49842c95b3e8b4
2023-11-22 14:18:12 +00:00
larrybr 1c83877d82 Pickup minor stylistic changes related to console I/O and, for Windows builds, get fact of UTF-16 translation into the sign-on banner. (a straight cherry-pick)
FossilOrigin-Name: d7a59e79467cf7aa13291c58f1cc4c1e2a51494bdd28661039421868f61088bd
2023-11-21 18:46:17 +00:00
drh 1dda1e22c9 Back out an incorrect change to the sqlite3ExprCompareSkip() function from
long ago.

FossilOrigin-Name: 89658abbcd04e6f6d5a2139fa92091df1de72e56bdbb12aacebf9e9178c58e3b
2023-11-20 15:58:14 +00:00
larrybr 84548fbd21 Arrange to not compile unused console I/O function.
FossilOrigin-Name: 184a0cd2e855c5177948eaf754c82685e2fcd5a08488d4d3d7b5fc7537e007b4
2023-11-20 13:59:44 +00:00
drh 8fa99e9568 Convert an assert in OP_VCheck into a branch that aborts the opcode, as this
can happen on some very obscure conditions, as discovered by dbsqlfuzz.

FossilOrigin-Name: 0d5f68717c829d4066c6af925c3a71f673ea34f14b1805388d1bdef152864d52
2023-11-20 13:12:05 +00:00
drh 02726b172a Cherry pick additional assert() fixes from trunk into the branch-3.44 branch.
FossilOrigin-Name: 6d8a8b700237d738e7b16dd844cf2514f0df7e2275bd9eab8de0a780e3687298
2023-11-20 12:00:29 +00:00
drh 61d0a37cdf Fix an assert() in fts5 that could be true following an OOM or IO error in contentless-delete mode.
FossilOrigin-Name: 80a0bd7a692b7f08d0fddc5bc2a75e3c8146c54a08c19a70d0e1b6d0e1ac383e
2023-11-20 11:50:22 +00:00
larrybr 4ba9f44d18 Fix test 5.0 in shell1.test for Windows. (A double-quote wrapped single-quote needs no further treatment to be recognized as a single single-quote.)
FossilOrigin-Name: aaa73400c41f382bbbd4ea32ad196d271c7a5e800bfee9afd998037a14fc89b9
2023-11-19 17:33:51 +00:00
larrybr bd0d38f410 Merge changes to do Windows console I/O with UTF-16.
FossilOrigin-Name: f782054e7ccdfb421a73acde6994f5046b99884924a508316a0d4a0dc9b03318
2023-11-18 22:10:40 +00:00
drh eedca24422 Correct conditional compilation issue seen with MSVC in the Win32 mutex subsystem.
FossilOrigin-Name: 6c069c5d664dca7908167e5759f952e407382b2669b25191167ad8d8fb03daa2
2023-11-18 20:24:55 +00:00
larrybr 241677519a Cherrypick changes to simplify and make more rational how console I/O package features are selected.
FossilOrigin-Name: b20c9f1785e94af4b81dcbbc63c49a883ab4095ff251b19e814ab6ef7ff06f2b
2023-11-16 20:50:56 +00:00
larrybr 22402d7d05 Get Fiddle build to succeed. (It runs, too, but not from changes here.)
FossilOrigin-Name: 957ebaa2be3056371d679f7a00aeba242db34218fb839ffd1d1197cad0c4a510
2023-11-15 16:54:49 +00:00
larrybr c283f969aa Changes to console I/O for Fiddle build, to always defer to C library (as before.) A WIP, pending testing with Fiddle build.
FossilOrigin-Name: 45b8061e7568ccca164fe000f1f0a0d984b1c28fad530bc9fdea35793a0f40bc
2023-11-15 15:20:52 +00:00
larrybr 26b57aaed7 Cherry-pick some assert()s to cover misuse of *Put*() from 500+ shell.c callers.
FossilOrigin-Name: c1a53c28a4286c4c52fb78398d4dbf5c03de514a1fa9199bf0cfcd2cd3cc7cd9
2023-11-14 03:31:24 +00:00
larrybr 6edc7ab317 Manual merge of branch-3.44 with 3 sources affected/created by console-io-lib changes.
FossilOrigin-Name: 18ebcf117aad77fa968ff5c537c9b56c1342dea687377a72a02519412a6aa565
2023-11-13 17:45:13 +00:00
drh 937ea25bcc Remove an incorrect ALWAYS() and NEVER().
FossilOrigin-Name: 94f62093866823e013f976db8f80390bee2a9140f4cbec50d1ad8ded28f732ae
2023-11-13 12:05:09 +00:00
drh 2f51f78f97 Fix another problem with mixed join types and the RIGHT JOIN strength-reduction optimization.
FossilOrigin-Name: 8f01f8b260bf70f047a720f1e61e578e500b87bdc2e867f8a8a521068a56c70c
2023-11-10 21:03:37 +00:00
drh a048396674 Fix an obscure problem with the join-strength-reduction optimization that could occur when mixing LEFT and RIGHT joins in the same query.
FossilOrigin-Name: dcf1c1378130538f1820263b4e62d06067d5ab30c07e2584c5c1b5082ede0d56
2023-11-10 15:20:41 +00:00
stephan f78c986679 Expose the missing SQLITE_SUBTYPE to wasm.
FossilOrigin-Name: 7bebfe20e77a2b4edc47debede669fab5af9ed165e5feb59a532fb2c7475fcb0
2023-11-10 15:01:45 +00:00
drh 3414ff463a Ensure 8-byte alignment of data structues in sqlite3_database_file_object().
FossilOrigin-Name: 3cfcaafaff181c7945cc659ff6d58a0d2232d49830a259f0510d833a7a5a824b
2023-11-09 18:41:42 +00:00
stephan 5f61fa6789 Expose SQLITE_RESULT_SUBTYPE to wasm.
FossilOrigin-Name: fc03988650645f0b08f1a3fb85b9ff54a04e0d7d27ca9f063198e43260826278
2023-11-09 17:55:27 +00:00
drh 599e56af76 Add the SQLITE_RESULT_SUBTYPE flag for application-defined functions. Add
the -DSQLITE_STRICT_SUBTYPE=1 compile-time option that raises an error if
any function invokes sqlite3_result_subtype() without the SQLITE_RESULT_SUBTYPE
flag.  SQLITE_RESULT_SUBTYPE prevents an indexed value of that function from
being used to replace an equivalent expression, since the indexed expression
does not carry the subtype.

FossilOrigin-Name: 65a9cfc466d3d904af50fa5eba46d29c5a24e7dde06e5c50c03b343723be7441
2023-11-09 17:42:46 +00:00
drh 5e34405f74 JSON5 bug fix: Escape double-quotes that occur inside of single-quoted strings.
FossilOrigin-Name: 6cc57bb2ce92f64af59c569696d4fbd08183feffaeee560450d13370d60f96d5
2023-11-09 01:56:55 +00:00
drh 6d12b9f850 Update the documentation to the sqlite3_set_auxdata() and sqlite3_get_auxdata()
routines to make it clear that they do not work as one might expect when they
are called during query planning, instead of during query execution.  The JSON
routines misuse those interfaces, so add a special flag to JSON routines that
prevents them from being invoked during query planning.

FossilOrigin-Name: 36259009c5b581ea692e8c86f505783336e4615bb5134e3afd5498f10eb36239
2023-11-07 19:15:55 +00:00
drh a7dc704f70 Update the srctree-check.tcl script and child script so that they can be run
on a read-only source tree and so that if any inconsistencies are found, the
script returns a non-zero exit code and thus halts the build.

FossilOrigin-Name: a0cc7e8117abf03c8d0ab903f1f4b8ff48b6c0e6de85080c9d2a915fd1c16778
2023-11-06 19:08:46 +00:00
drh 9d8ad69b1f Fix an fts5 problem where a transaction consisting of (a) a DELETE on rowid X, (b) a prefix query, and (c) an INSERT on rowid X, could corrupt the index.
FossilOrigin-Name: 34af510a5615339f2963875eab94d4b07725e766c20819f82add19faa229d552
2023-11-06 19:01:25 +00:00
drh 11379c0809 Update the version number to 3.44.1
FossilOrigin-Name: 34f23c3d0d080fef82e3515ecb74257f68878c74fb0bdceac176a004aa1a84e9
2023-11-02 11:14:43 +00:00
drh d9369971ef CLI to compile with older MSVC compiler.
FossilOrigin-Name: c8bf4f7a6a4c4f0f8cd21de25918f4d96f6831a145af4fb63e4b5984f79613b2
2023-11-02 11:08:57 +00:00
drh 07a7cd3714 Version 3.44.0 for the wal2 branch
FossilOrigin-Name: 470152fd2847296e0fc325fdf098e49c888e99a2332fb45533f976ad85a67d8d
2023-11-01 12:41:25 +00:00
drh 47e42cd143 Merge the latest 3.44.0 changes into wal2 branch.
FossilOrigin-Name: 4f65ae2df071d2064ff1494b918c1dee2147e174f79060cd031c25f1aff70a7e
2023-10-30 21:46:46 +00:00
dan 757372ab56 Merge latest trunk changes into this branch.
FossilOrigin-Name: 3a6479d3f9d929c63e0caed6288d24ef004edee669d242285dea3fc60345038a
2023-10-23 16:00:26 +00:00
dan 9d086cc562 Fix a sanitizer runtime error in wal2 code (that (1 << 31) cannot be represented as an int).
FossilOrigin-Name: 79a920c036c91bbae737e4f4c5310052d26407fe7d23bcf95a2aa79ea3773a0f
2023-09-08 16:49:45 +00:00
dan 1fd73f2693 Fix an apparently harmless buffer-overrun that could occur on this branch when committing multi-file transactions in wal2 mode.
FossilOrigin-Name: dde9fcbde16bf71c4ab708e2db769b9cefacd0d7bce8223a46bf1264ae7ddecd
2023-09-08 16:05:09 +00:00
drh 5267068d3d (no comment)
FossilOrigin-Name: 9e927eed2d9e379dd79ef82aa1e41102463c5654b8f4e343bb88bb0daf55c689
2023-08-29 20:19:42 +00:00
drh 0205717b93 Version 3.43.0 for the wal2 branch.
FossilOrigin-Name: b5970fc4599d4fe81312e049420724b14e3d2c1de04769844fb1ab8d953170cd
2023-08-24 13:19:33 +00:00
dan cc74eafee5 Merge latest trunk changes into this branch.
FossilOrigin-Name: 135bf72c6b5f436b11463dd40b3a73bcc610bf9c2dcbe6646dbedd0d9325f6a9
2023-08-21 18:02:57 +00:00
dan 45d92dd539 Merge latest trunk changes, including support for handling of structured-exceptions in MSVC builds, with this branch.
FossilOrigin-Name: 00bfae9ffafd71dfd0bbdbdc174e4ed7d7a850b385416f83be36a4f4a55d1873
2023-08-11 19:33:54 +00:00
drh 6fe6b73a8d Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: fe1bf30ca0c529c3c68f2531e28aca5659aef5d15c2e3a6925ecd35a5098386b
2023-08-11 11:40:32 +00:00
dan 7a1cc96197 Update test scripts specific to this branch so that they work on windows.
FossilOrigin-Name: f0ca13edad058628e454cc895faac5751de77115c5fea62e98c29d9fdb6b0559
2023-08-11 11:23:35 +00:00
dan 1e6ee1929c Mark test script wal2big.test as "TESTRUNNER: slow".
FossilOrigin-Name: ae7f3bcb5babfa50084f5b4d3c5663489dbf306440706152642b7f0fb47fa1f5
2023-08-10 17:04:29 +00:00
dan 832406c2b4 Merge latest trunk changes into this branch.
FossilOrigin-Name: 72f7807b34eee1fcfd94f72d27535e5273ed1f7ff3d464179a774b7c7241f5f5
2023-08-10 17:03:33 +00:00
drh 7331bc0002 Merge the json_remove() bug fix from trunk into the wal2 branch.
FossilOrigin-Name: e6c066cae4ed5d698820c0c1ea8840773146e9d1a665551d8d51bb9df121cdb7
2023-08-04 13:24:40 +00:00
drh 6f5c4810bc Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 6fa71e11197111ab52d1983b35190899a5881dcb9ed822488c92bc839c72cb55
2023-08-03 23:22:28 +00:00
drh b9b790e8cc Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: c1fa1cb5e0c420614481636f3ce2dd9ad2142274bb7b37d39e5c26228317f992
2023-07-28 18:47:49 +00:00
drh ecd48447b2 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: b2e56f62ad8f114126fda6b8c1266d194bb1356b8a302956c5e9ad90d8c1d73b
2023-07-24 13:20:39 +00:00
drh f578ed6838 Merge all the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: f07936535f6ad2671e4e3281214b097a0186a642055ad81e561515cd08bc4a61
2023-07-08 19:09:20 +00:00
drh b17135d81f Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 80ac494f734d9720fbbb1111741aa99fc319c6c9a32e7f13b5962001d6ace828
2023-06-22 14:20:03 +00:00
drh 5d2f5f4655 Merge all 3.42.0 release changes into the wal2 branch.
FossilOrigin-Name: 137057f95778b3c913854d2182d0fbbfd9dd117db5566dabb5a22d927a59de62
2023-05-16 13:00:36 +00:00
drh 1adff07cb9 Merge the latest 3.42.0 beta from trunk into the wal2 branch. For some reason,
the previous merge didn't work.  Probably a PEBKAC.

FossilOrigin-Name: 3bbfbdcd9b0e03b1ed50f41b1714ada5d241b8030f73ced8d0da8fff28a268e0
2023-05-13 15:07:27 +00:00
drh 5b39dd45e8 Merge the latest 3.42.0 beta changes into the wal2 branch.
FossilOrigin-Name: 771361e19e5b7f944cd2cfecb064b39175b892148fa877b763170744bca0b0cf
2023-05-13 15:00:47 +00:00
dan d17b9114aa Update this branch with latest changes from trunk.
FossilOrigin-Name: 49777032f29517d23c8c7483536f8ba828e7000dc303415da6881cc458620be2
2023-05-04 14:31:17 +00:00
drh 6c9cc2c4f8 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 0215dcc76d7b3a1dad10b8e6fd8b54f2ab5006a156db5cee992ab2dac98d9284
2023-05-02 19:58:35 +00:00
drh ca773a51de Update the wal2 branch to version 3.41.0.
FossilOrigin-Name: 7bb1f6dca2d2e0c0c70f1d2d0c7130c182fc45e48138c57a3fbe92ee1f68da96
2023-02-21 21:19:36 +00:00
drh ade7cd53ab Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: a36de0c803ee170b34105fadfc1f9790cda68a921fd5034790397f9853798f43
2023-02-18 21:42:38 +00:00
dan e3d452a826 Fix a dropped error code in wal.c.
FossilOrigin-Name: 2537db6f6b9df00913b57e2ad0e4deef2040ce47b28f9a9939f42c0443d70ac9
2023-02-07 11:19:20 +00:00
dan faff28a478 Fix an assert() in sqlite3WalFindFrame() so that it matches the equivalent assert() on trunk.
FossilOrigin-Name: f5bf91d9bf3910ab3dcf44c138084dfc26fb123edb8934bfdfcdd5c4afb67f2d
2023-02-07 10:58:39 +00:00
drh 70cfee98e5 Disable an invalid assert(). Add the "WAL2" compile-time property so that
test scripts can more easily determine that they are dealing with a
WAL2-capable build.

FossilOrigin-Name: e93113259e05fb6b81ad1b4a460bd54168ff5c372b643d4845c1b1c87b7db204
2023-02-06 19:00:53 +00:00
drh d94023257b Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 44f8f33d4ab159476800142e763dfc6beb2c2c1d857c8eebb286498dec4004fd
2023-02-06 17:48:49 +00:00
dan 1651f418e5 Merge trunk enhancements into this branch.
FossilOrigin-Name: c9b0180203378da26dc958c183ebb59274537e9fee3b346933b1e0844ed68a4a
2023-02-02 14:21:13 +00:00
drh 77508c4768 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 21ebd4cfcf843925cf8eaeb2f7e196713dba116cf618aea9f9f40e31f6aa6653
2022-12-21 20:28:58 +00:00
drh ce8a1720d6 Merge the 3.40.0 release into the wal2 branch.
FossilOrigin-Name: 2df915ef04a64cc8027330013f73ac0ee1fee8cb6eb61f3a608c21ea419d5928
2022-11-16 16:00:43 +00:00
drh d9da500bd7 Merge the 3.40.0 rc1 changes into the wal2 branch.
FossilOrigin-Name: a5a610a650b6b49f4bb5fbb8e2f43c730afbe88df2c3ae4ddf3d1e5392960387
2022-11-14 13:10:42 +00:00
drh 82ac3d8211 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: ca63a1bee16d30677c20c7576361dfb9a359e6e1b2b2b58a574da0059d3a8822
2022-11-04 18:58:48 +00:00
drh 73b1ef33ef Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: c22c7c879846b1357c00741700b7f6d1111c4b94895b4e7f552c92299d35712e
2022-09-30 13:54:27 +00:00
drh b77b56bd52 Merge all recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 0b7578bf3d389f323df5da2ade9f6455d57db92aacfd219f3136dd31588c3a9c
2022-08-22 15:57:51 +00:00
dan 86b7bb29da Fix a problem causing false corruption reports following recovery of a *-wal file that contains one or more transactions and a *-wal2 file that contains a valid header but no valid transactions.
FossilOrigin-Name: f6eafb65a43c650b065abe4a59e329c977cab1856c72dc9162046576d7bbfc8a
2022-06-27 21:42:45 +00:00
drh e81feadb41 Merge version 3.39.0 into the wal2 branch.
FossilOrigin-Name: ad3a7005e704711fb9de9e96883db3aed82c4f132a66cb74daf67c2527d79f73
2022-06-25 16:53:36 +00:00
drh 6c45111957 Merge 3.39.0 release candidate 1 into the wal2 branch.
FossilOrigin-Name: 5a5e6e368f5cc8fe7cf29696a07942101f5c114084d4117acf277bb3ad8555ac
2022-06-24 15:15:39 +00:00
drh 029eb1bf15 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: c8ad869938b06378f49c02655c00ee4f3315e1275d15e69d4ff61d6f60230fe8
2022-06-16 13:44:49 +00:00
drh 2a27e5e4cb Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 934656f13dabc41ccf307b10dca7377c758b8a3b93eca57c072745c2786d6b3c
2022-05-28 14:44:19 +00:00
drh 6702d6dadc Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 33d77fea4084c5aba9203dfeddb820424f102dcb8347dc59e32b922bdb241382
2022-05-10 12:39:00 +00:00
drh 6c75609f48 Merge the lates trunk enhancements into the wal2 branch.
FossilOrigin-Name: bafaefc6ab4fa59c0a3859cd16a9a29d3d157953fd9002c96e868fc7a54fa18c
2022-03-12 15:04:21 +00:00
drh 981dcb6236 Merge version 3.38.0 into the wal2 branch.
FossilOrigin-Name: de24c8ee41007bc6d25d25856b64d8bdc4581666bca53eb031530b0e498fb0fe
2022-02-22 19:46:57 +00:00
drh 3f17a238bb Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 7dba818893fb898e4556bb7ed9cb0dc5667b19a3d7969c7d35c902d2bf5450b1
2022-02-15 20:37:36 +00:00
drh 5666f09523 Merge trunk enhancements into the wal2 branch.
FossilOrigin-Name: d2de02f372a07b10e21f56fc49755545e7c8c889a9527bf3818e5e65cb33bb80
2022-02-04 17:52:05 +00:00
drh 8f1396ae8b Merge the latest trunk changes into the wal2 branch.
FossilOrigin-Name: 84f737abd1c05d66627b601dbd9be42c83d9c8e7a6c7fb4945dd85e7765569d9
2022-01-25 15:57:50 +00:00
drh aed427074b Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 82f031b41dbf041cdbdfb2f3ccc8d118b22d9e523e54a32e882a67535e9973c5
2022-01-17 19:36:10 +00:00
dan 348093c719 Fix a problem causing one wal file to be deleted without being checkpointed on close in cases where the last connection to close the db does so with an out of date wal-index header in memory.
FossilOrigin-Name: b0a70a2356c44d65c54c6d9bdf05972071462e72c28d6c6e593147ffa3d27ef2
2021-12-15 12:51:02 +00:00
drh b90edad19d Merge version 3.37.0 into the wal2 branch.
FossilOrigin-Name: 3425af625bac6c89950a50c2a22c4b7f66b0080811fe16ec8879158420641d5c
2021-11-27 15:00:54 +00:00
drh b321a9b0fa Merge trunk enhancements into the wal2 branch.
FossilOrigin-Name: 135133b7a65c652e95b0642bc2358425af72e46b1b6b64d256547b5e5e8f7e41
2021-11-22 16:47:29 +00:00
drh 234f384386 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 0894f59569378c41207b6cef43dbff9a4873582709d954c809c18f42d918aa03
2021-11-09 13:52:20 +00:00
dan 7271df982d Merge further changes from trunk into this branch.
FossilOrigin-Name: 700876b79c47017cfbf42b8710ec0b50d7a987864db7599593817b962763bc71
2021-11-06 16:46:27 +00:00
dan f54bc90ca3 Merge change [6979efbf07d93e7a] from trunk to this branch.
FossilOrigin-Name: 2bb2448d6042b8c1597aab53b2c1c1aa0cdf9b36f15ef5c44730558f213297da
2021-11-06 16:36:30 +00:00
dan fa4d43fb64 Merge changes from trunk into this branch.
FossilOrigin-Name: 52667bce485354ee4fee87f19015845baef12adf2674127f8c6f1bac1ccf3b7d
2021-11-06 16:10:10 +00:00
drh c77906eedd Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 7e2bc836f6aedfd69588f5723f8797f11ee6437d3b63ffc43c88d40e3baadb1c
2021-10-21 14:01:05 +00:00
drh e1c2be1134 Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 127173e0baba8839d5922a2537dc42e6bb64ed1499b0700bf3e95d42c2f260b3
2021-10-04 11:44:28 +00:00
drh 2303f0859c Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 84dac820a0b1f2af73f9563a137b2c57c4c13debcc864063c39027dc8de95ca6
2021-08-09 18:26:05 +00:00
dan 938ede2078 Merge latest trunk changes into this branch.
FossilOrigin-Name: 67ed7422f8173f95598a6b32447b9200ec369cadae71942c3e87c41d492cfc28
2021-08-09 11:03:15 +00:00
drh 0f1e95e616 Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: f615d7baa889030b230e0d4f018dc9f8a6fe95cd3a671d7e2b941ae3240fa6ca
2021-08-02 20:29:08 +00:00
drh ebc672832f Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 41363fb970273cb5ae2bddf53f3536de047d7d22736483089fd89493c0c701ca
2021-06-17 16:53:56 +00:00
dan 67f562233f Update this branch with latest changes from trunk.
FossilOrigin-Name: b38c2b8bc4237ee2167cb5e3ec63d08f10a8718654b2210a4bc04cca6d2adfdb
2021-06-14 14:12:57 +00:00
drh 80189c5bfe Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 95cc7783457b39bbe0866295648a86e7ee5e1660048ab133f1ccf300498ef1bf
2021-05-21 16:42:05 +00:00
drh 17e08c6149 Merge the 3.35.3 enhancements into the wal2 branch.
FossilOrigin-Name: a1b8d9d2131830510df291832565311803aa3e047fe07ba979fc69bb0ff329b0
2021-03-26 13:58:26 +00:00
drh e809deee13 Merge the 3.35.0 release into the wal2 branch.
FossilOrigin-Name: 03142e5f760ef46c7837fef1b21f54baf64f4b9d99d1c9e3f4d8d6c8d1ab875f
2021-03-12 17:08:43 +00:00
dan 226fda81af Merge latest trunk changes into this branch.
FossilOrigin-Name: 30f912d0b39ff6fcf9a555affb5990c4bce8726fbd27062cd0c95851724f91d4
2021-03-11 19:42:05 +00:00
drh c25b39e41d Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 0ae81039083dbeb67cd4da9f56cdcb31fd747ba258179a46781a12b2872e9f49
2021-03-03 19:32:30 +00:00
dan 1a2a4f12dc Merge latest trunk changes into this branch.
FossilOrigin-Name: cb1f6f18e74aeff522c332cb6c8f4c202bba8fba4ff7869198e4501ffa4a0387
2020-11-26 18:08:59 +00:00
dan 50c9522c24 Declare a variable "const" in order to avoid compiler warnings.
FossilOrigin-Name: 4f5481bf291c39e228dd9c67f504dfe70879617b7266245d6236cd1d2d99274c
2020-11-20 11:17:48 +00:00
dan 9bf3da81a0 Fix things so that sqlite3_database_file_object() works with wal2 filenames.
FossilOrigin-Name: c2426ae8a80d61e1ede2d065c10145ba31d4ac615803f48b7903f5f7daaa6f89
2020-11-19 16:08:08 +00:00
dan 174f4fa241 Merge latest trunk changes into this branch.
FossilOrigin-Name: 91262e665755a1430f3b667867b9c4fa0cc3aa0388c21e8ba436485beefa9f4a
2020-08-11 11:34:00 +00:00
dan aae84d814c Merge latest trunk changes into this branch.
FossilOrigin-Name: 0c0d0a77bc8fa68ee584ca6d7a0408dcd00734a9b6b69d127ee8477c230a749c
2020-07-31 16:01:33 +00:00
drh ea8c9a43aa Merge version 3.32.1 into the wal2 branch.
FossilOrigin-Name: 5c1837572586902313702c46057ef5dc84030683ff3467c6f3f25903b6ab22d1
2020-05-25 18:09:15 +00:00
drh ca97a18493 Merge version 3.32.0 into the wal2 branch.
FossilOrigin-Name: 1cb46a7431797978a37e1c6ed77f6473eb44f13d15cd37267d4f9555ac825f53
2020-05-22 18:28:59 +00:00
dan 69105498b9 Merge latest trunk changes into this branch.
FossilOrigin-Name: 16b1eca922d6e10a0ebce1deb559c6c7dd74f8655e3456bad8384c6f4637e6d6
2020-05-18 17:18:28 +00:00
drh bd74861e91 Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: 6fb870625cb7007fe5055609da35f6af87f3b375b7a43fd4e842d40dfef9169f
2020-04-09 18:46:15 +00:00
dan 6d671d4c09 Merge latest trunk changes into this branch.
FossilOrigin-Name: 6ad4d6b7ff2b34385039490f1dc8b020254e06fb70b9bff69d453d0c0affc2a2
2020-02-04 20:11:22 +00:00
drh 8caab4aebe Merge version 3.31.0
FossilOrigin-Name: 3bb267deb150c09bc424320d1de4bbaf519310e0e0c4af6a8ac5b6f8d59170b2
2020-01-22 21:12:27 +00:00
drh b3168a0056 Merge recent enhancements and fixes from trunk.
FossilOrigin-Name: 35eae71a4dd4bd4e2d4a8f12c5e4a0cdb93dadee353b92e67a70a79b29587984
2020-01-15 14:11:34 +00:00
drh 2c34d3c61e Bring the wal2 branch up to date with version 3.30.0
FossilOrigin-Name: 16e1dced8b56ef422e5b747dd26accba5bf9f2df69b24b10363ef288890e21ee
2019-10-04 16:15:45 +00:00
drh d59a566707 Merge 3.30.0 beta 1 changes from trunk.
FossilOrigin-Name: 918bd97d2946c0a403030fcf0eba596a742ada94b122bf0ac4b808097171056b
2019-09-30 16:44:00 +00:00
drh 254bcdd02d Merge recent trunk enhancements into the wal2 branch.
FossilOrigin-Name: da8bc974126729f1558f3c18118a32efcc5bdd9611533c34090f7e9e5176b4e6
2019-09-16 12:23:30 +00:00
drh e31602c62d Merge the 3.29.0 release into the wal2 branch.
FossilOrigin-Name: 8baa402282a231d42f419ac220a32b532766e52180e4a70da874d383d8703121
2019-07-10 18:30:00 +00:00
drh 1e469f79b1 Merge all enhancements from trunk into the wal2 branch.
FossilOrigin-Name: dcbcbc2a6905588a63b9c926473a7097ca0a03803c5bd3f416f268ae2aa3dc87
2019-07-08 21:19:34 +00:00
drh 6fdd8fc5f0 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 23ec34e4f61775198a2b6f8b683fa7db2c57efb1add32c12d5051558952c394c
2019-05-14 22:02:03 +00:00
drh e5fd180648 Merge the latest trunk enhancements.
FossilOrigin-Name: 8950f1195a5e5a67202192857fda50c359a446d20264eab328209239ae0a2d95
2019-04-15 15:17:40 +00:00
drh b83e6e9420 Merge enhancements from trunk.
FossilOrigin-Name: a0e2e90206fe09cdacc01fce93740fd515c88ed06b03c78c48076b4cb177349c
2019-03-26 12:22:30 +00:00
drh d9df7cb876 Merge the latest enhancements and fixes from trunk.
FossilOrigin-Name: bf20d4ffcb7b27b519502e2986cd0eb1d34d5fd273752fb27de9cdab75772acd
2019-03-08 15:57:31 +00:00
drh 281ee2f754 Add the bgckpt.c extension to Makefile.in and Makefile.msc.
FossilOrigin-Name: 3712d625d625f962c627c74222467ad4858be46feda570449f9cb640549c9ddd
2019-03-08 15:39:24 +00:00
dan f552a23740 Add new file doc/wal2.md to this branch.
FossilOrigin-Name: b495dce153f7f886f3dba09593f29ce2375718bf6508f2cfffd1af8071a995ae
2019-01-11 14:58:03 +00:00
dan 3eeda95d36 Reinstate assert() statements in os_unix.c that were removed to allow wal-mode
SHARED locks to be taken over more than one locking slot (this branch no
longer does that, so the assert() statements can go back in).

FossilOrigin-Name: 8445fb6d5dae98a0129514a10a15f08412bac5a1d8114b12e592c744ea2bc4c9
2019-01-02 17:00:00 +00:00
dan 1f3762607d Merge latest trunk changes into this branch.
FossilOrigin-Name: 87ef68f9174b5e21fa2fb4f2fa23e0ecd6a0ea854422c8aa74cd7306a1ed8427
2019-01-02 16:15:02 +00:00
dan d445ed094a Add new test file wal2rollback.test to this branch.
FossilOrigin-Name: 85a376fc6c77117b96814df800b3d68a441d69602ffc2eb8cd7dba29f25d69aa
2018-12-28 16:20:53 +00:00
dan ce909d1aae Increase test coverage of wal.c provided by permutation "coverage-wal" on this
branch.

FossilOrigin-Name: 2f7f893a702728745445f6ef5f914c1157058a8fbdfd1a58cfb8906e5566729d
2018-12-27 16:49:33 +00:00
dan 0f297b6e50 Improve testing of the wal.c changes on this branch.
FossilOrigin-Name: 63483e22c775183e01924b5cb3d0f3655b63c3cdd06faf26cacd4d0913c0055c
2018-12-26 20:42:32 +00:00
dan 2d111c8bbb Merge latest trunk changes with this branch.
FossilOrigin-Name: 404f9d99d325ddf82fde6d957860d30b2fb67f232c0878a3cf6df9596541f16e
2018-12-26 19:10:59 +00:00
dan 665f3d209b Enhance the wal2 header comment in wal.c to explain how the wal-hook is
invoked in wal2 mode.

FossilOrigin-Name: 118aa7e32a94ad971a955ab60db5bfc5b6241f93734a41ba83ab72ea71bc9aaa
2018-12-22 15:50:00 +00:00
dan c5140b39ce Add extra test case to wal2recover.test.
FossilOrigin-Name: 1a5aa73435b11fff0567672dc921d34aad57adf0381ad430e1389f39a6f025b7
2018-12-17 15:22:24 +00:00
dan 93543215e0 Further test cases for wal2 mode.
FossilOrigin-Name: 9cb5f8dab685f5ea36ad142cfa588dee82e87f3a89e8dcf84e0ee124bb29bc7f
2018-12-15 20:20:13 +00:00
dan e698c1f79e Add further tests for wal2 mode.
FossilOrigin-Name: 54e628f902a5508badc8941ceda1bec12fe8f58969c91c670a37888ef2681880
2018-12-14 19:53:39 +00:00
dan 597bf19266 Add tests cases for recovery in wal2 mode.
FossilOrigin-Name: 34f56f8a4239781071edf6317723d0a7333249551c2c1ce7ed39fc116d53d780
2018-12-13 16:26:43 +00:00
dan eeb778d506 Add new test file wal2big.test.
FossilOrigin-Name: e3e50bcdab8c91e003942d84430b3e580e034141236d19dda0e8af4ecf0e085b
2018-12-12 20:39:38 +00:00
dan 2c4328ed87 Add tests to ensure that each of the 4 wal read-locks does what it is supposed to.
FossilOrigin-Name: 4d5779f31d4931edb8bb8952d8886625ead5e51f0c308e5763e519427f6609e1
2018-12-12 19:04:19 +00:00
dan f17e510ee5 Change the way wal2 locks work to ensure a reader only ever has to lock a
single slot.

FossilOrigin-Name: 18b2c23ac53d985ccc5798ea2d92fb75644b857c373fb490e0d04d5d0194a3d5
2018-12-11 17:56:23 +00:00
dan ca72570a11 Merge latest trunk changes into this branch.
FossilOrigin-Name: d8dd98a39ea061dea264a7d81153f7b1be2f81b554b30d0ce289897c802209bd
2018-12-11 13:44:59 +00:00
dan d597b966d9 Add test file wal2snapshot.test that should have been added as part of an
earlier commit.

FossilOrigin-Name: f6baa7e1163ed5f61375b0554337030fec23e8a9f60c6412e1b5d626961e93f9
2018-12-06 16:54:44 +00:00
dan c30d437376 Fix a test script problem on this branch.
FossilOrigin-Name: 285d1c5904dd607457c6b5ff7be3d3191a90ca8b1fb0837327663c9910f978ac
2018-12-05 17:31:24 +00:00
dan e05f922583 Fix a problem causing "PRAGMA journal_mode" to report the wrong journal mode
(wal instead of wal2) under some circumstances.

FossilOrigin-Name: 1d8d4f689653ce80157740e339f7f1b42479bf90d82b176d8202d0a49f428398
2018-12-05 17:14:03 +00:00
dan 6456b3929c Fixes for snapshots API on this branch. Also ensure that the snapshots API
cannot be used with wal2 mode databases (for now anyhow).

FossilOrigin-Name: 19c61ab79458936ff4dfca46cf4d1fb1ab16d7bdb5024f502eb4339ec4eef32c
2018-12-05 16:31:02 +00:00
dan 816fc35956 Increase a timeout in test file walprotocol2.test. To account for unix builds
without HAVE_USLEEP.

FossilOrigin-Name: 480be916c840e9e28010c22cf29a8396502c9e6387f31f750260c6290f58e9a1
2018-12-03 18:13:46 +00:00
dan 8eed108df1 Sync this branch with the latest trunk.
FossilOrigin-Name: 7a44fa5a350a3f19b8e9f5196d22535788885f8c0e849572202bf64a055ddc2d
2018-12-01 20:14:06 +00:00
dan 6cbf8e173f Add new extension "bgckpt" in ext/misc/bgckpt.c. For experimenting with
running wal2 mode checkpoints in a background thread.

FossilOrigin-Name: 63955442304052f5adddd05ccaeebe87ddc5e25af695702793518f015b4f0a87
2017-10-10 20:11:10 +00:00
dan 2df2b3d05f Merge latest trunk changes with this branch.
FossilOrigin-Name: d218d815f89cb1368fdb5e3f774b7adaaf02560a367ba0f3e54987e08dd6241a
2017-10-09 19:50:09 +00:00
dan 40927fd61e Add a header comment to wal.c describing the differences between wal and wal2
mode.

FossilOrigin-Name: 9c80cd202f1c966929b279e18f19c663912686fcf92f03b85a02b9c7e55a0fc6
2017-10-09 19:49:08 +00:00
dan 50182fa846 Ignore the *-wal2 file if the *-wal file is zero bytes in size.
FossilOrigin-Name: f7360fad51f224f347bb7d263eb89056b27461c278309e00e575a0e8898c9f40
2017-10-07 19:55:37 +00:00
dan 5d122d308f Check in test file wal2simple.test.
FossilOrigin-Name: 8932b2f1d7e6a26221ea3dea01000832b2d1eb17ac0b70ef6028f9286ae450a3
2017-10-07 13:37:04 +00:00
dan 288e98fb4b Merge latest trunk changes into this branch.
FossilOrigin-Name: 7e43517861d4ecfa86766a16a2c721377b75da78771d5ba18870dcb9626a8dce
2017-10-06 14:25:25 +00:00
dan bfcf8d6d67 Fix a bug in recovering wal2 mode databases introduced by the previous commit.
FossilOrigin-Name: 9e1502e1b650217efc361732a3dfe686caa2e6352d040c73865f1faf09bf4591
2017-10-06 14:08:39 +00:00
dan 24f1b25c7b Fix frame overwriting in wal2 mode.
FossilOrigin-Name: a4b02bc9388226da21b3837a20c6c7eb0d13854dde62b7136e04f4978528dc71
2017-10-06 13:43:42 +00:00
dan 3400e78f38 Fix test case failures on this branch.
FossilOrigin-Name: 16decc13af908087fb8aa34eeccf43e8da1b8f2e4b808028986d1ef08134c72c
2017-10-05 18:14:46 +00:00
dan 055cc1e431 Add experimental mode that uses two wal files. Activated using "PRAGMA
journal_mode = wal2".

FossilOrigin-Name: e2fc5c814cf6862d536aacb9eca66ecd31ba7e3e3033fa4c5564d533f4a18dfc
2017-10-04 20:57:14 +00:00
76 changed files with 6252 additions and 2198 deletions
+3
View File
@@ -426,6 +426,7 @@ TESTSRC += \
$(TOP)/ext/expert/sqlite3expert.c \
$(TOP)/ext/expert/test_expert.c \
$(TOP)/ext/misc/amatch.c \
$(TOP)/ext/misc/bgckpt.c \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/basexx.c \
$(TOP)/ext/misc/carray.c \
@@ -1137,6 +1138,8 @@ SHELL_SRC = \
$(TOP)/src/shell.c.in \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/completion.c \
$(TOP)/ext/consio/console_io.c \
$(TOP)/ext/consio/console_io.h \
$(TOP)/ext/misc/decimal.c \
$(TOP)/ext/misc/basexx.c \
$(TOP)/ext/misc/base64.c \
+3
View File
@@ -1565,6 +1565,7 @@ TESTEXT = \
$(TOP)\ext\misc\amatch.c \
$(TOP)\ext\misc\appendvfs.c \
$(TOP)\ext\misc\basexx.c \
$(TOP)\ext\misc\bgckpt.c \
$(TOP)\ext\misc\carray.c \
$(TOP)\ext\misc\cksumvfs.c \
$(TOP)\ext\misc\closure.c \
@@ -2261,6 +2262,8 @@ keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
# Source files that go into making shell.c
SHELL_SRC = \
$(TOP)\src\shell.c.in \
$(TOP)\ext\consio\console_io.c \
$(TOP)\ext\consio\console_io.h \
$(TOP)\ext\misc\appendvfs.c \
$(TOP)\ext\misc\completion.c \
$(TOP)\ext\misc\base64.c \
+1 -1
View File
@@ -1 +1 @@
3.44.0
3.44.2
+1 -1
View File
@@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
# so that we create the export library with the dll.
#-----------------------------------------------------------------------
AC_INIT([sqlite],[3.44.0])
AC_INIT([sqlite],[3.44.2])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
Vendored
+9 -9
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.44.0.
# Generated by GNU Autoconf 2.69 for sqlite 3.44.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.44.0'
PACKAGE_STRING='sqlite 3.44.0'
PACKAGE_VERSION='3.44.2'
PACKAGE_STRING='sqlite 3.44.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1472,7 +1472,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.44.0 to adapt to many kinds of systems.
\`configure' configures sqlite 3.44.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1537,7 +1537,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.44.0:";;
short | recursive ) echo "Configuration of sqlite 3.44.2:";;
esac
cat <<\_ACEOF
@@ -1668,7 +1668,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.44.0
sqlite configure 3.44.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2087,7 +2087,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.44.0, which was
It was created by sqlite $as_me 3.44.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -12481,7 +12481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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.44.0, which was
This file was extended by sqlite $as_me 3.44.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12547,7 +12547,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sqlite config.status 3.44.0
sqlite config.status 3.44.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+98
View File
@@ -0,0 +1,98 @@
Wal2 Mode Notes
===============
## Activating/Deactivating Wal2 Mode
"Wal2" mode is very similar to "wal" mode. To change a database to wal2 mode,
use the command:
>
PRAGMA journal_mode = wal2;
It is not possible to change a database directly from "wal" mode to "wal2"
mode. Instead, it must first be changed to rollback mode. So, to change a wal
mode database to wal2 mode, the following two commands may be used:
>
PRAGMA journal_mode = delete;
PRAGMA journal_mode = wal2;
A database in wal2 mode may only be accessed by versions of SQLite compiled
from this branch. Attempting to use any other version of SQLite results in an
SQLITE&#95;NOTADB error. A wal2 mode database may be changed back to rollback mode
(making it accessible by all versions of SQLite) using:
>
PRAGMA journal_mode = delete;
## The Advantage of Wal2 Mode
In legacy wal mode, when a writer writes data to the database, it doesn't
modify the database file directly. Instead, it appends new data to the
"&lt;database>-wal" file. Readers read data from both the original database
file and the "&lt;database>-wal" file. At some point, data is copied from the
"&lt;database>-wal" file into the database file, after which the wal file can
be deleted or overwritten. Copying data from the wal file into the database
file is called a "checkpoint", and may be done explictly (either by "PRAGMA
wal&#95;checkpoint" or sqlite3&#95;wal&#95;checkpoint&#95;v2()), or
automatically (by configuring "PRAGMA wal&#95;autocheckpoint" - this is the
default).
Checkpointers do not block writers, and writers do not block checkpointers.
However, if a writer writes to the database while a checkpoint is ongoing,
then the new data is appended to the end of the wal file. This means that,
even following the checkpoint, the wal file cannot be overwritten or deleted,
and so all subsequent transactions must also be appended to the wal file. The
work of the checkpointer is not wasted - SQLite remembers which parts of the
wal file have already been copied into the db file so that the next checkpoint
does not have to do so again - but it does mean that the wal file may grow
indefinitely if the checkpointer never gets a chance to finish without a
writer appending to the wal file. There are also circumstances in which
long-running readers may prevent a checkpointer from checkpointing the entire
wal file - also causing the wal file to grow indefinitely in a busy system.
Wal2 mode does not have this problem. In wal2 mode, wal files do not grow
indefinitely even if the checkpointer never has a chance to finish
uninterrupted.
In wal2 mode, the system uses two wal files instead of one. The files are named
"&lt;database>-wal" and "&lt;database>-wal2", where "&lt;database>" is of
course the name of the database file. When data is written to the database, the
writer begins by appending the new data to the first wal file. Once the first
wal file has grown large enough, writers switch to appending data to the second
wal file. At this point the first wal file can be checkpointed (after which it
can be overwritten). Then, once the second wal file has grown large enough and
the first wal file has been checkpointed, writers switch back to the first wal
file. And so on.
## Application Programming
From the point of view of the user, the main differences between wal and
wal2 mode are to do with checkpointing:
* In wal mode, a checkpoint may be attempted at any time. In wal2
mode, the checkpointer has to wait until writers have switched
to the "other" wal file before a checkpoint can take place.
* In wal mode, the wal-hook (callback registered using
sqlite3&#95;wal&#95;hook()) is invoked after a transaction is committed
with the total number of pages in the wal file as an argument. In wal2
mode, the argument is either the total number of uncheckpointed pages in
both wal files, or - if the "other" wal file is empty or already
checkpointed - 0.
Clients are recommended to use the same strategies for checkpointing wal2 mode
databases as for wal databases - by registering a wal-hook using
sqlite3&#95;wal&#95;hook() and attempting a checkpoint when the parameter
exceeds a certain threshold.
However, it should be noted that although the wal-hook is invoked after each
transaction is committed to disk and database locks released, it is still
invoked from within the sqlite3&#95;step() call used to execute the "COMMIT"
command. In BEGIN CONCURRENT systems, where the "COMMIT" is often protected by
an application mutex, this may reduce concurrency. In such systems, instead of
executing a checkpoint from within the wal-hook, a thread might defer this
action until after the application mutex has been released.
+679
View File
@@ -0,0 +1,679 @@
/*
** 2023 November 4
**
** 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 various interfaces used for console and stream I/O
** by the SQLite project command-line tools, as explained in console_io.h .
** Functions prefixed by "SQLITE_INTERNAL_LINKAGE" behave as described there.
*/
#ifndef SQLITE_CDECL
# define SQLITE_CDECL
#endif
#ifndef SHELL_NO_SYSINC
# include <stdarg.h>
# include <string.h>
# include <stdlib.h>
# include <limits.h>
# include <assert.h>
# include "console_io.h"
# include "sqlite3.h"
#endif
#ifndef SQLITE_CIO_NO_TRANSLATE
# if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT
# ifndef SHELL_NO_SYSINC
# include <io.h>
# include <fcntl.h>
# undef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# endif
# define CIO_WIN_WC_XLATE 1 /* Use WCHAR Windows APIs for console I/O */
# else
# ifndef SHELL_NO_SYSINC
# include <unistd.h>
# endif
# define CIO_WIN_WC_XLATE 0 /* Use plain C library stream I/O at console */
# endif
#else
# define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */
#endif
#if CIO_WIN_WC_XLATE
/* Character used to represent a known-incomplete UTF-8 char group () */
static WCHAR cBadGroup = 0xfffd;
#endif
#if CIO_WIN_WC_XLATE
static HANDLE handleOfFile(FILE *pf){
int fileDesc = _fileno(pf);
union { intptr_t osfh; HANDLE fh; } fid = {
(fileDesc>=0)? _get_osfhandle(fileDesc) : (intptr_t)INVALID_HANDLE_VALUE
};
return fid.fh;
}
#endif
#ifndef SQLITE_CIO_NO_TRANSLATE
typedef struct PerStreamTags {
# if CIO_WIN_WC_XLATE
HANDLE hx;
DWORD consMode;
char acIncomplete[4];
# else
short reachesConsole;
# endif
FILE *pf;
} PerStreamTags;
/* Define NULL-like value for things which can validly be 0. */
# define SHELL_INVALID_FILE_PTR ((FILE *)~0)
# if CIO_WIN_WC_XLATE
# define SHELL_INVALID_CONS_MODE 0xFFFF0000
# endif
# if CIO_WIN_WC_XLATE
# define PST_INITIALIZER { INVALID_HANDLE_VALUE, SHELL_INVALID_CONS_MODE, \
{0,0,0,0}, SHELL_INVALID_FILE_PTR }
# else
# define PST_INITIALIZER { 0, SHELL_INVALID_FILE_PTR }
# endif
/* Quickly say whether a known output is going to the console. */
# if CIO_WIN_WC_XLATE
static short pstReachesConsole(PerStreamTags *ppst){
return (ppst->hx != INVALID_HANDLE_VALUE);
}
# else
# define pstReachesConsole(ppst) 0
# endif
# if CIO_WIN_WC_XLATE
static void restoreConsoleArb(PerStreamTags *ppst){
if( pstReachesConsole(ppst) ) SetConsoleMode(ppst->hx, ppst->consMode);
}
# else
# define restoreConsoleArb(ppst)
# endif
/* Say whether FILE* appears to be a console, collect associated info. */
static short streamOfConsole(FILE *pf, /* out */ PerStreamTags *ppst){
# if CIO_WIN_WC_XLATE
short rv = 0;
DWORD dwCM = SHELL_INVALID_CONS_MODE;
HANDLE fh = handleOfFile(pf);
ppst->pf = pf;
if( INVALID_HANDLE_VALUE != fh ){
rv = (GetFileType(fh) == FILE_TYPE_CHAR && GetConsoleMode(fh,&dwCM));
}
ppst->hx = (rv)? fh : INVALID_HANDLE_VALUE;
ppst->consMode = dwCM;
return rv;
# else
ppst->pf = pf;
ppst->reachesConsole = ( (short)isatty(fileno(pf)) );
return ppst->reachesConsole;
# endif
}
# if CIO_WIN_WC_XLATE
/* Define console modes for use with the Windows Console API. */
# define SHELL_CONI_MODE \
(ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT | 0x80 \
| ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT)
# define SHELL_CONO_MODE (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT \
| ENABLE_VIRTUAL_TERMINAL_PROCESSING)
# endif
typedef struct ConsoleInfo {
PerStreamTags pstSetup[3];
PerStreamTags pstDesignated[3];
StreamsAreConsole sacSetup;
} ConsoleInfo;
static short isValidStreamInfo(PerStreamTags *ppst){
return (ppst->pf != SHELL_INVALID_FILE_PTR);
}
static ConsoleInfo consoleInfo = {
{ /* pstSetup */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
{ /* pstDesignated[] */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
SAC_NoConsole /* sacSetup */
};
SQLITE_INTERNAL_LINKAGE FILE* invalidFileStream = (FILE *)~0;
# if CIO_WIN_WC_XLATE
static void maybeSetupAsConsole(PerStreamTags *ppst, short odir){
if( pstReachesConsole(ppst) ){
DWORD cm = odir? SHELL_CONO_MODE : SHELL_CONI_MODE;
SetConsoleMode(ppst->hx, cm);
}
}
# else
# define maybeSetupAsConsole(ppst,odir)
# endif
SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void){
# if CIO_WIN_WC_XLATE
int ix = 0;
while( ix < 6 ){
PerStreamTags *ppst = (ix<3)?
&consoleInfo.pstSetup[ix] : &consoleInfo.pstDesignated[ix-3];
maybeSetupAsConsole(ppst, (ix % 3)>0);
++ix;
}
# endif
}
SQLITE_INTERNAL_LINKAGE StreamsAreConsole
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){
StreamsAreConsole rv = SAC_NoConsole;
FILE* apf[3] = { pfIn, pfOut, pfErr };
int ix;
for( ix = 2; ix >= 0; --ix ){
PerStreamTags *ppst = &consoleInfo.pstSetup[ix];
if( streamOfConsole(apf[ix], ppst) ){
rv |= (SAC_InConsole<<ix);
}
consoleInfo.pstDesignated[ix] = *ppst;
if( ix > 0 ) fflush(apf[ix]);
}
consoleInfo.sacSetup = rv;
consoleRenewSetup();
return rv;
}
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ){
# if CIO_WIN_WC_XLATE
static ConsoleInfo *pci = &consoleInfo;
if( pci->sacSetup ){
int ix;
for( ix=0; ix<3; ++ix ){
if( pci->sacSetup & (SAC_InConsole<<ix) ){
PerStreamTags *ppst = &pci->pstSetup[ix];
SetConsoleMode(ppst->hx, ppst->consMode);
}
}
}
# endif
}
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
#ifdef SQLITE_CIO_INPUT_REDIR
/* Say whether given FILE* is among those known, via either
** consoleClassifySetup() or set{Output,Error}Stream, as
** readable, and return an associated PerStreamTags pointer
** if so. Otherwise, return 0.
*/
static PerStreamTags * isKnownReadable(FILE *pf){
static PerStreamTags *apst[] = {
&consoleInfo.pstDesignated[0], &consoleInfo.pstSetup[0], 0
};
int ix = 0;
do {
if( apst[ix]->pf == pf ) break;
} while( apst[++ix] != 0 );
return apst[ix];
}
#endif
#ifndef SQLITE_CIO_NO_TRANSLATE
/* Say whether given FILE* is among those known, via either
** consoleClassifySetup() or set{Output,Error}Stream, as
** writable, and return an associated PerStreamTags pointer
** if so. Otherwise, return 0.
*/
static PerStreamTags * isKnownWritable(FILE *pf){
static PerStreamTags *apst[] = {
&consoleInfo.pstDesignated[1], &consoleInfo.pstDesignated[2],
&consoleInfo.pstSetup[1], &consoleInfo.pstSetup[2], 0
};
int ix = 0;
do {
if( apst[ix]->pf == pf ) break;
} while( apst[++ix] != 0 );
return apst[ix];
}
static FILE *designateEmitStream(FILE *pf, unsigned chix){
FILE *rv = consoleInfo.pstDesignated[chix].pf;
if( pf == invalidFileStream ) return rv;
else{
/* Setting a possibly new output stream. */
PerStreamTags *ppst = isKnownWritable(pf);
if( ppst != 0 ){
PerStreamTags pst = *ppst;
consoleInfo.pstDesignated[chix] = pst;
}else streamOfConsole(pf, &consoleInfo.pstDesignated[chix]);
}
return rv;
}
SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf){
return designateEmitStream(pf, 1);
}
# ifdef CONSIO_SET_ERROR_STREAM
SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf){
return designateEmitStream(pf, 2);
}
# endif
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
#ifndef SQLITE_CIO_NO_SETMODE
# if CIO_WIN_WC_XLATE
static void setModeFlushQ(FILE *pf, short bFlush, int mode){
if( bFlush ) fflush(pf);
_setmode(_fileno(pf), mode);
}
# else
# define setModeFlushQ(f, b, m) if(b) fflush(f)
# endif
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *pf, short bFlush){
setModeFlushQ(pf, bFlush, _O_BINARY);
}
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *pf, short bFlush){
setModeFlushQ(pf, bFlush, _O_TEXT);
}
# undef setModeFlushQ
#else /* defined(SQLITE_CIO_NO_SETMODE) */
# define setBinaryMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
# define setTextMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
#endif /* defined(SQLITE_CIO_NO_SETMODE) */
#ifndef SQLITE_CIO_NO_TRANSLATE
# if CIO_WIN_WC_XLATE
/* Write buffer cBuf as output to stream known to reach console,
** limited to ncTake char's. Return ncTake on success, else 0. */
static int conZstrEmit(PerStreamTags *ppst, const char *z, int ncTake){
int rv = 0;
if( z!=NULL ){
int nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, 0,0);
if( nwc > 0 ){
WCHAR *zw = sqlite3_malloc64(nwc*sizeof(WCHAR));
if( zw!=NULL ){
nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, zw,nwc);
if( nwc > 0 ){
/* Translation from UTF-8 to UTF-16, then WCHARs out. */
if( WriteConsoleW(ppst->hx, zw,nwc, 0, NULL) ){
rv = ncTake;
}
}
sqlite3_free(zw);
}
}
}
return rv;
}
/* For {f,o,e}PrintfUtf8() when stream is known to reach console. */
static int conioVmPrintf(PerStreamTags *ppst, const char *zFormat, va_list ap){
char *z = sqlite3_vmprintf(zFormat, ap);
if( z ){
int rv = conZstrEmit(ppst, z, (int)strlen(z));
sqlite3_free(z);
return rv;
}else return 0;
}
# endif /* CIO_WIN_WC_XLATE */
# ifdef CONSIO_GET_EMIT_STREAM
static PerStreamTags * getDesignatedEmitStream(FILE *pf, unsigned chix,
PerStreamTags *ppst){
PerStreamTags *rv = isKnownWritable(pf);
short isValid = (rv!=0)? isValidStreamInfo(rv) : 0;
if( rv != 0 && isValid ) return rv;
streamOfConsole(pf, ppst);
return ppst;
}
# endif
/* Get stream info, either for designated output or error stream when
** chix equals 1 or 2, or for an arbitrary stream when chix == 0.
** In either case, ppst references a caller-owned PerStreamTags
** struct which may be filled in if none of the known writable
** streams is being held by consoleInfo. The ppf parameter is a
** byref output when chix!=0 and a byref input when chix==0.
*/
static PerStreamTags *
getEmitStreamInfo(unsigned chix, PerStreamTags *ppst,
/* in/out */ FILE **ppf){
PerStreamTags *ppstTry;
FILE *pfEmit;
if( chix > 0 ){
ppstTry = &consoleInfo.pstDesignated[chix];
if( !isValidStreamInfo(ppstTry) ){
ppstTry = &consoleInfo.pstSetup[chix];
pfEmit = ppst->pf;
}else pfEmit = ppstTry->pf;
if( !isValidStreamInfo(ppstTry) ){
pfEmit = (chix > 1)? stderr : stdout;
ppstTry = ppst;
streamOfConsole(pfEmit, ppstTry);
}
*ppf = pfEmit;
}else{
ppstTry = isKnownWritable(*ppf);
if( ppstTry != 0 ) return ppstTry;
streamOfConsole(*ppf, ppst);
return ppst;
}
return ppstTry;
}
SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...){
va_list ap;
int rv;
FILE *pfOut;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
# else
getEmitStreamInfo(1, &pst, &pfOut);
# endif
assert(zFormat!=0);
va_start(ap, zFormat);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
rv = conioVmPrintf(ppst, zFormat, ap);
}else{
# endif
rv = vfprintf(pfOut, zFormat, ap);
# if CIO_WIN_WC_XLATE
}
# endif
va_end(ap);
return rv;
}
SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...){
va_list ap;
int rv;
FILE *pfErr;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
# else
getEmitStreamInfo(2, &pst, &pfErr);
# endif
assert(zFormat!=0);
va_start(ap, zFormat);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
rv = conioVmPrintf(ppst, zFormat, ap);
}else{
# endif
rv = vfprintf(pfErr, zFormat, ap);
# if CIO_WIN_WC_XLATE
}
# endif
va_end(ap);
return rv;
}
SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...){
va_list ap;
int rv;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
# else
getEmitStreamInfo(0, &pst, &pfO);
# endif
assert(zFormat!=0);
va_start(ap, zFormat);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
maybeSetupAsConsole(ppst, 1);
rv = conioVmPrintf(ppst, zFormat, ap);
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
}else{
# endif
rv = vfprintf(pfO, zFormat, ap);
# if CIO_WIN_WC_XLATE
}
# endif
va_end(ap);
return rv;
}
SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO){
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
# else
getEmitStreamInfo(0, &pst, &pfO);
# endif
assert(z!=0);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
int rv;
maybeSetupAsConsole(ppst, 1);
rv = conZstrEmit(ppst, z, (int)strlen(z));
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
return rv;
}else {
# endif
return (fputs(z, pfO)<0)? 0 : (int)strlen(z);
# if CIO_WIN_WC_XLATE
}
# endif
}
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z){
FILE *pfErr;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
# else
getEmitStreamInfo(2, &pst, &pfErr);
# endif
assert(z!=0);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
else {
# endif
return (fputs(z, pfErr)<0)? 0 : (int)strlen(z);
# if CIO_WIN_WC_XLATE
}
# endif
}
SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
FILE *pfOut;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
# else
getEmitStreamInfo(1, &pst, &pfOut);
# endif
assert(z!=0);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
else {
# endif
return (fputs(z, pfOut)<0)? 0 : (int)strlen(z);
# if CIO_WIN_WC_XLATE
}
# endif
}
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
#if !(defined(SQLITE_CIO_NO_UTF8SCAN) && defined(SQLITE_CIO_NO_TRANSLATE))
/* Skip over as much z[] input char sequence as is valid UTF-8,
** limited per nAccept char's or whole characters and containing
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
** sequence z:return (inclusive:exclusive) is validated UTF-8.
** Limit: nAccept>=0 => char count, nAccept<0 => character
*/
SQLITE_INTERNAL_LINKAGE const char*
zSkipValidUtf8(const char *z, int nAccept, long ccm){
int ng = (nAccept<0)? -nAccept : 0;
const char *pcLimit = (nAccept>=0)? z+nAccept : 0;
assert(z!=0);
while( (pcLimit)? (z<pcLimit) : (ng-- != 0) ){
char c = *z;
if( (c & 0x80) == 0 ){
if( ccm != 0L && c < 0x20 && ((1L<<c) & ccm) != 0 ) return z;
++z; /* ASCII */
}else if( (c & 0xC0) != 0xC0 ) return z; /* not a lead byte */
else{
const char *zt = z+1; /* Got lead byte, look at trail bytes.*/
do{
if( pcLimit && zt >= pcLimit ) return z;
else{
char ct = *zt++;
if( ct==0 || (zt-z)>4 || (ct & 0xC0)!=0x80 ){
/* Trailing bytes are too few, too many, or invalid. */
return z;
}
}
} while( ((c <<= 1) & 0x40) == 0x40 ); /* Eat lead byte's count. */
z = zt;
}
}
return z;
}
#endif /*!(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))*/
#ifndef SQLITE_CIO_NO_TRANSLATE
#ifdef CONSIO_SPUTB
SQLITE_INTERNAL_LINKAGE int
fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept){
assert(pfO!=0);
# if CIO_WIN_WC_XLATE
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
if( pstReachesConsole(ppst) ){
int rv;
maybeSetupAsConsole(ppst, 1);
rv = conZstrEmit(ppst, cBuf, nAccept);
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
return rv;
}else {
# endif
return (int)fwrite(cBuf, 1, nAccept, pfO);
# if CIO_WIN_WC_XLATE
}
# endif
}
#endif /* defined(CONSIO_SPUTB) */
SQLITE_INTERNAL_LINKAGE int
oPutbUtf8(const char *cBuf, int nAccept){
FILE *pfOut;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
# if CIO_WIN_WC_XLATE
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
# else
getEmitStreamInfo(1, &pst, &pfOut);
# endif
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
return conZstrEmit(ppst, cBuf, nAccept);
}else {
# endif
return (int)fwrite(cBuf, 1, nAccept, pfOut);
# if CIO_WIN_WC_XLATE
}
# endif
}
# ifdef CONSIO_EPUTB
SQLITE_INTERNAL_LINKAGE int
ePutbUtf8(const char *cBuf, int nAccept){
FILE *pfErr;
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
# if CIO_WIN_WC_XLATE
if( pstReachesConsole(ppst) ){
return conZstrEmit(ppst, cBuf, nAccept);
}else {
# endif
return (int)fwrite(cBuf, 1, nAccept, pfErr);
# if CIO_WIN_WC_XLATE
}
# endif
}
# endif /* defined(CONSIO_EPUTB) */
SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
if( pfIn==0 ) pfIn = stdin;
# if CIO_WIN_WC_XLATE
if( pfIn == consoleInfo.pstSetup[0].pf
&& (consoleInfo.sacSetup & SAC_InConsole)!=0 ){
# if CIO_WIN_WC_XLATE==1
# define SHELL_GULP 150 /* Count of WCHARS to be gulped at a time */
WCHAR wcBuf[SHELL_GULP+1];
int lend = 0, noc = 0;
if( ncMax > 0 ) cBuf[0] = 0;
while( noc < ncMax-8-1 && !lend ){
/* There is room for at least 2 more characters and a 0-terminator. */
int na = (ncMax > SHELL_GULP*4+1 + noc)? SHELL_GULP : (ncMax-1 - noc)/4;
# undef SHELL_GULP
DWORD nbr = 0;
BOOL bRC = ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf, na, &nbr, 0);
if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){
/* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */
DWORD nbrx;
bRC &= ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf+nbr, 1, &nbrx, 0);
if( bRC ) nbr += nbrx;
}
if( !bRC || (noc==0 && nbr==0) ) return 0;
if( nbr > 0 ){
int nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,0,0,0,0);
if( nmb != 0 && noc+nmb <= ncMax ){
int iseg = noc;
nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,cBuf+noc,nmb,0,0);
noc += nmb;
/* Fixup line-ends as coded by Windows for CR (or "Enter".)
** This is done without regard for any setMode{Text,Binary}()
** call that might have been done on the interactive input.
*/
if( noc > 0 ){
if( cBuf[noc-1]=='\n' ){
lend = 1;
if( noc > 1 && cBuf[noc-2]=='\r' ) cBuf[--noc-1] = '\n';
}
}
/* Check for ^Z (anywhere in line) too, to act as EOF. */
while( iseg < noc ){
if( cBuf[iseg]=='\x1a' ){
noc = iseg; /* Chop ^Z and anything following. */
lend = 1; /* Counts as end of line too. */
break;
}
++iseg;
}
}else break; /* Drop apparent garbage in. (Could assert.) */
}else break;
}
/* If got nothing, (after ^Z chop), must be at end-of-file. */
if( noc > 0 ){
cBuf[noc] = 0;
return cBuf;
}else return 0;
# endif
}else{
# endif
return fgets(cBuf, ncMax, pfIn);
# if CIO_WIN_WC_XLATE
}
# endif
}
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
#undef SHELL_INVALID_FILE_PTR
+280
View File
@@ -0,0 +1,280 @@
/*
** 2023 November 1
**
** 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 exposes various interfaces used for console and other I/O
** by the SQLite project command-line tools. These interfaces are used
** at either source conglomeration time, compilation time, or run time.
** This source provides for either inclusion into conglomerated,
** "single-source" forms or separate compilation then linking.
**
** Platform dependencies are "hidden" here by various stratagems so
** that, provided certain conditions are met, the programs using this
** source or object code compiled from it need no explicit conditional
** compilation in their source for their console and stream I/O.
**
** The symbols and functionality exposed here are not a public API.
** This code may change in tandem with other project code as needed.
**
** When this .h file and its companion .c are directly incorporated into
** a source conglomeration (such as shell.c), the preprocessor symbol
** CIO_WIN_WC_XLATE is defined as 0 or 1, reflecting whether console I/O
** translation for Windows is effected for the build.
*/
#ifndef SQLITE_INTERNAL_LINKAGE
# define SQLITE_INTERNAL_LINKAGE extern /* external to translation unit */
# include <stdio.h>
#else
# define SHELL_NO_SYSINC /* Better yet, modify mkshellc.tcl for this. */
#endif
#ifndef SQLITE3_H
# include "sqlite3.h"
#endif
#ifndef SQLITE_CIO_NO_CLASSIFY
/* Define enum for use with following function. */
typedef enum StreamsAreConsole {
SAC_NoConsole = 0,
SAC_InConsole = 1, SAC_OutConsole = 2, SAC_ErrConsole = 4,
SAC_AnyConsole = 0x7
} StreamsAreConsole;
/*
** Classify the three standard I/O streams according to whether
** they are connected to a console attached to the process.
**
** Returns the bit-wise OR of SAC_{In,Out,Err}Console values,
** or SAC_NoConsole if none of the streams reaches a console.
**
** This function should be called before any I/O is done with
** the given streams. As a side-effect, the given inputs are
** recorded so that later I/O operations on them may be done
** differently than the C library FILE* I/O would be done,
** iff the stream is used for the I/O functions that follow,
** and to support the ones that use an implicit stream.
**
** On some platforms, stream or console mode alteration (aka
** "Setup") may be made which is undone by consoleRestore().
*/
SQLITE_INTERNAL_LINKAGE StreamsAreConsole
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr );
/* A usual call for convenience: */
#define SQLITE_STD_CONSOLE_INIT() consoleClassifySetup(stdin,stdout,stderr)
/*
** After an initial call to consoleClassifySetup(...), renew
** the same setup it effected. (A call not after is an error.)
** This will restore state altered by consoleRestore();
**
** Applications which run an inferior (child) process which
** inherits the same I/O streams may call this function after
** such a process exits to guard against console mode changes.
*/
SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void);
/*
** Undo any side-effects left by consoleClassifySetup(...).
**
** This should be called after consoleClassifySetup() and
** before the process terminates normally. It is suitable
** for use with the atexit() C library procedure. After
** this call, no console I/O should be done until one of
** console{Classify or Renew}Setup(...) is called again.
**
** Applications which run an inferior (child) process that
** inherits the same I/O streams might call this procedure
** before so that said process will have a console setup
** however users have configured it or come to expect.
*/
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void );
#else /* defined(SQLITE_CIO_NO_CLASSIFY) */
# define consoleClassifySetup(i,o,e)
# define consoleRenewSetup()
# define consoleRestore()
#endif /* defined(SQLITE_CIO_NO_CLASSIFY) */
#ifndef SQLITE_CIO_NO_REDIRECT
/*
** Set stream to be used for the functions below which write
** to "the designated X stream", where X is Output or Error.
** Returns the previous value.
**
** Alternatively, pass the special value, invalidFileStream,
** to get the designated stream value without setting it.
**
** Before the designated streams are set, they default to
** those passed to consoleClassifySetup(...), and before
** that is called they default to stdout and stderr.
**
** It is error to close a stream so designated, then, without
** designating another, use the corresponding {o,e}Emit(...).
*/
SQLITE_INTERNAL_LINKAGE FILE *invalidFileStream;
SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf);
# ifdef CONSIO_SET_ERROR_STREAM
SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf);
# endif
#else
# define setOutputStream(pf)
# define setErrorStream(pf)
#endif /* !defined(SQLITE_CIO_NO_REDIRECT) */
#ifndef SQLITE_CIO_NO_TRANSLATE
/*
** Emit output like fprintf(). If the output is going to the
** console and translation from UTF-8 is necessary, perform
** the needed translation. Otherwise, write formatted output
** to the provided stream almost as-is, possibly with newline
** translation as specified by set{Binary,Text}Mode().
*/
SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...);
/* Like fPrintfUtf8 except stream is always the designated output. */
SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...);
/* Like fPrintfUtf8 except stream is always the designated error. */
SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...);
/*
** Emit output like fputs(). If the output is going to the
** console and translation from UTF-8 is necessary, perform
** the needed translation. Otherwise, write given text to the
** provided stream almost as-is, possibly with newline
** translation as specified by set{Binary,Text}Mode().
*/
SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO);
/* Like fPutsUtf8 except stream is always the designated output. */
SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z);
/* Like fPutsUtf8 except stream is always the designated error. */
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z);
/*
** Emit output like fPutsUtf8(), except that the length of the
** accepted char or character sequence is limited by nAccept.
**
** Returns the number of accepted char values.
*/
#ifdef CONSIO_SPUTB
SQLITE_INTERNAL_LINKAGE int
fPutbUtf8(FILE *pfOut, const char *cBuf, int nAccept);
#endif
/* Like fPutbUtf8 except stream is always the designated output. */
SQLITE_INTERNAL_LINKAGE int
oPutbUtf8(const char *cBuf, int nAccept);
/* Like fPutbUtf8 except stream is always the designated error. */
#ifdef CONSIO_EPUTB
SQLITE_INTERNAL_LINKAGE int
ePutbUtf8(const char *cBuf, int nAccept);
#endif
/*
** Collect input like fgets(...) with special provisions for input
** from the console on platforms that require same. Defers to the
** C library fgets() when input is not from the console. Newline
** translation may be done as set by set{Binary,Text}Mode(). As a
** convenience, pfIn==NULL is treated as stdin.
*/
SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
/* Like fGetsUtf8 except stream is always the designated input. */
/* SQLITE_INTERNAL_LINKAGE char* iGetsUtf8(char *cBuf, int ncMax); */
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
#ifndef SQLITE_CIO_NO_SETMODE
/*
** Set given stream for binary mode, where newline translation is
** not done, or for text mode where, for some platforms, newlines
** are translated to the platform's conventional char sequence.
** If bFlush true, flush the stream.
**
** An additional side-effect is that if the stream is one passed
** to consoleClassifySetup() as an output, it is flushed first.
**
** Note that binary/text mode has no effect on console I/O
** translation. On all platforms, newline to the console starts
** a new line and CR,LF chars from the console become a newline.
*/
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *, short bFlush);
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *, short bFlush);
#endif
#ifdef SQLITE_CIO_PROMPTED_IN
typedef struct Prompts {
int numPrompts;
const char **azPrompts;
} Prompts;
/*
** Macros for use of a line editor.
**
** The following macros define operations involving use of a
** line-editing library or simple console interaction.
** A "T" argument is a text (char *) buffer or filename.
** A "N" argument is an integer.
**
** SHELL_ADD_HISTORY(T) // Record text as line(s) of history.
** SHELL_READ_HISTORY(T) // Read history from file named by T.
** SHELL_WRITE_HISTORY(T) // Write history to file named by T.
** SHELL_STIFLE_HISTORY(N) // Limit history to N entries.
**
** A console program which does interactive console input is
** expected to call:
** SHELL_READ_HISTORY(T) before collecting such input;
** SHELL_ADD_HISTORY(T) as record-worthy input is taken;
** SHELL_STIFLE_HISTORY(N) after console input ceases; then
** SHELL_WRITE_HISTORY(T) before the program exits.
*/
/*
** Retrieve a single line of input text from an input stream.
**
** If pfIn is the input stream passed to consoleClassifySetup(),
** and azPrompt is not NULL, then a prompt is issued before the
** line is collected, as selected by the isContinuation flag.
** Array azPrompt[{0,1}] holds the {main,continuation} prompt.
**
** If zBufPrior is not NULL then it is a buffer from a prior
** call to this routine that can be reused, or will be freed.
**
** The result is stored in space obtained from malloc() and
** must either be freed by the caller or else passed back to
** this function as zBufPrior for reuse.
**
** This function may call upon services of a line-editing
** library to interactively collect line edited input.
*/
SQLITE_INTERNAL_LINKAGE char *
shellGetLine(FILE *pfIn, char *zBufPrior, int nLen,
short isContinuation, Prompts azPrompt);
#endif /* defined(SQLITE_CIO_PROMPTED_IN) */
/*
** TBD: Define an interface for application(s) to generate
** completion candidates for use by the line-editor.
**
** This may be premature; the CLI is the only application
** that does this. Yet, getting line-editing melded into
** console I/O is desirable because a line-editing library
** may have to establish console operating mode, possibly
** in a way that interferes with the above functionality.
*/
#if !(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))
/* Skip over as much z[] input char sequence as is valid UTF-8,
** limited per nAccept char's or whole characters and containing
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
** sequence z:return (inclusive:exclusive) is validated UTF-8.
** Limit: nAccept>=0 => char count, nAccept<0 => character
*/
SQLITE_INTERNAL_LINKAGE const char*
zSkipValidUtf8(const char *z, int nAccept, long ccm);
#endif
+2 -4
View File
@@ -432,10 +432,8 @@ static Fts5HashEntry *fts5HashEntryMerge(
}
/*
** Extract all tokens from hash table iHash and link them into a list
** in sorted order. The hash table is cleared before returning. It is
** the responsibility of the caller to free the elements of the returned
** list.
** Link all tokens from hash table iHash into a list in sorted order. The
** tokens are not removed from the hash table.
*/
static int fts5HashEntrySort(
Fts5Hash *pHash,
+26 -11
View File
@@ -2719,6 +2719,14 @@ static void fts5SegIterHashInit(
pLeaf->p = (u8*)pList;
}
}
/* The call to sqlite3Fts5HashScanInit() causes the hash table to
** fill the size field of all existing position lists. This means they
** can no longer be appended to. Since the only scenario in which they
** can be appended to is if the previous operation on this table was
** a DELETE, by clearing the Fts5Index.bDelete flag we can avoid this
** possibility altogether. */
p->bDelete = 0;
}else{
p->rc = sqlite3Fts5HashQuery(p->pHash, sizeof(Fts5Data),
(const char*)pTerm, nTerm, (void**)&pLeaf, &nList
@@ -4396,7 +4404,7 @@ static void fts5WriteAppendPoslistData(
const u8 *a = aData;
int n = nData;
assert( p->pConfig->pgsz>0 );
assert( p->pConfig->pgsz>0 || p->rc!=SQLITE_OK );
while( p->rc==SQLITE_OK
&& (pPage->buf.n + pPage->pgidx.n + n)>=p->pConfig->pgsz
){
@@ -5129,18 +5137,24 @@ static void fts5DoSecureDelete(
iOff = iStart;
/* Set variable bLastInDoclist to true if this entry happens to be
** the last rowid in the doclist for its term. */
/* If the position-list for the entry being removed flows over past
** the end of this page, delete the portion of the position-list on the
** next page and beyond.
**
** Set variable bLastInDoclist to true if this entry happens
** to be the last rowid in the doclist for its term. */
if( iNextOff>=iPgIdx ){
int pgno = pSeg->iLeafPgno+1;
fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
iNextOff = iPgIdx;
}
if( pSeg->bDel==0 ){
if( iNextOff>=iPgIdx ){
int pgno = pSeg->iLeafPgno+1;
fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
iNextOff = iPgIdx;
}else{
if( iNextOff!=iPgIdx ){
/* Loop through the page-footer. If iNextOff (offset of the
** entry following the one we are removing) is equal to the
** offset of a key on this page, then the entry is the last
** in its doclist. */
** in its doclist. */
int iKeyOff = 0;
for(iIdx=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0;
@@ -5656,8 +5670,9 @@ int sqlite3Fts5IndexOptimize(Fts5Index *p){
assert( p->rc==SQLITE_OK );
fts5IndexFlush(p);
assert( p->nContentlessDelete==0 );
assert( p->rc!=SQLITE_OK || p->nContentlessDelete==0 );
pStruct = fts5StructureRead(p);
assert( p->rc!=SQLITE_OK || pStruct!=0 );
fts5StructureInvalidate(p);
if( pStruct ){
@@ -6204,7 +6219,7 @@ int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){
/* Flush the hash table to disk if required */
if( iRowid<p->iWriteRowid
|| (iRowid==p->iWriteRowid && p->bDelete==0)
|| (p->nPendingData > p->pConfig->nHashSize)
|| (p->nPendingData > p->pConfig->nHashSize)
){
fts5IndexFlush(p);
}
+85
View File
@@ -880,6 +880,91 @@ do_catchsql_test 5.4 {
UPDATE t1 SET content=randomblob(500);
} {1 {database disk image is malformed}}
#-------------------------------------------------------------------------
reset_db
do_test 6.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
.open --hexdb
| size 32768 pagesize 4096 filename crash-42fa37b694d45a.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 07 .....@ ........
| 96: 00 00 00 00 0d 00 00 00 07 0d d2 00 0f c4 0f 6d ...............m
| 112: 0f 02 0e ab 0e 4e 0d f6 0d d2 00 00 00 00 00 00 .....N..........
| 3536: 00 00 22 07 06 17 11 11 01 31 74 61 62 6c 65 74 .........1tablet
| 3552: 32 74 32 07 43 52 45 41 54 45 20 54 41 42 4c 45 2t2.CREATE TABLE
| 3568: 20 74 32 28 78 29 56 06 06 17 1f 1f 01 7d 74 61 t2(x)V.......ta
| 3584: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63 blet1_configt1_c
| 3600: 6f 6e 66 69 67 06 43 52 45 41 54 45 20 54 41 42 onfig.CREATE TAB
| 3616: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b LE 't1_config'(k
| 3632: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 PRIMARY KEY, v)
| 3648: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 05 WITHOUT ROWID[.
| 3664: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64 ..!!...tablet1_d
| 3680: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 ocsizet1_docsize
| 3696: 05 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 .CREATE TABLE 't
| 3712: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 1_docsize'(id IN
| 3728: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE
| 3744: 59 2c 20 73 7a 20 42 4c 4f 42 29 55 04 06 17 21 Y, sz BLOB)U...!
| 3760: 21 01 77 74 61 62 6c 65 74 31 5f 63 6f 6e 74 65 !.wtablet1_conte
| 3776: 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 04 43 52 45 ntt1_content.CRE
| 3792: 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 6f ATE TABLE 't1_co
| 3808: 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 45 ntent'(id INTEGE
| 3824: 52 20 50 52 49 4d 41 52 49 20 4b 45 59 2c 20 63 R PRIMARI KEY, c
| 3840: 30 29 69 03 07 17 19 19 01 81 2d 74 61 62 6c 65 0)i.......-table
| 3856: 74 31 5f 69 64 78 74 31 5f 69 64 78 03 43 52 45 t1_idxt1_idx.CRE
| 3872: 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 69 64 ATE TABLE 't1_id
| 3888: 78 27 28 73 65 67 69 64 2c 20 74 65 72 6d 2c 20 x'(segid, term,
| 3904: 70 67 6e 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45 pgno, PRIMARY KE
| 3920: 59 28 73 65 67 69 64 2c 20 74 65 72 6d 29 29 20 Y(segid, term))
| 3936: 57 49 54 48 4f 55 54 20 52 4f 57 49 44 55 02 07 WITHOUT ROWIDU..
| 3952: 17 1b 1b 01 81 01 74 61 62 6c 65 74 31 5f 64 61 ......tablet1_da
| 3968: 74 61 74 31 5f 64 61 74 61 02 43 52 45 41 54 45 tat1_data.CREATE
| 3984: 20 54 41 42 4c 45 20 27 74 31 5f 64 61 74 61 27 TABLE 't1_data'
| 4000: 28 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d (id INTEGER PRIM
| 4016: 41 52 b9 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 AR. KEY, block B
| 4032: 4c 4f 42 29 3a 01 06 17 11 11 08 63 74 61 62 6c LOB):......ctabl
| 4048: 65 74 31 74 31 43 52 45 41 54 45 20 56 49 52 54 et1t1CREATE VIRT
| 4064: 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 49 UAL TABLE t1 USI
| 4080: 4e 47 20 66 74 73 35 28 63 6f 6e 74 65 6e 74 29 NG fts5(content)
| page 2 offset 4096
| 0: 0d 00 00 00 03 0f bd 00 0f e8 0f ef 0f bd f0 00 ................
| 16: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| 4016: 00 00 00 00 00 00 00 00 00 00 00 00 00 24 84 80 .............$..
| 4032: 80 80 80 01 03 00 4e 00 10 00 1e 06 30 61 62 61 ......N.....0aba
| 4048: 63 6c 01 02 02 04 02 66 74 02 5f 02 04 04 6e 64 cl.....ft._...nd
| 4064: 6f 6e 02 02 02 04 0a 07 05 01 03 00 10 03 03 0f on..............
| 4080: 0a 03 00 24 00 00 00 00 01 01 01 00 01 01 01 11 ...$............
| page 3 offset 8192
| 0: 0a 00 00 00 01 0f 00 01 00 00 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
| page 4 offset 12288
| 0: 0d 00 00 00 03 0f e0 00 0f f6 0f ec 0f e0 00 00 ................
| 4064: 0a 03 03 00 1b 61 62 61 6e 64 6f 6e 08 02 03 00 .....abandon....
| 4080: 17 61 62 61 66 74 08 01 03 00 17 61 62 61 63 6b .abaft.....aback
| page 5 offset 16384
| 0: 0d 00 00 00 03 0f ee 00 0f fa 0f 00 00 00 00 00 ................
| 4064: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 03 ................
| 4080: 03 00 0e 01 04 02 03 00 0e 01 04 01 03 00 0e 01 ................
| page 6 offset 20480
| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
| page 7 offset 24576
| 0: 0d 00 00 10 03 0f d6 00 0f 00 00 00 00 00 00 00 ................
| 4048: 00 00 00 00 00 00 09 03 02 1b 72 65 62 75 69 6c ..........rebuil
| 4064: 64 11 02 02 2b 69 6e 74 65 67 72 69 74 79 2d 63 d...+integrity-c
| 4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 00 00 00 heck....optim...
| page 8 offset 28672
| 0: 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| end crash-42fa37b694d45a.db
}]} {}
do_execsql_test 6.1 {
INSERT INTO t1(t1,rank) VALUES('secure-delete',1);
}
do_catchsql_test 6.2 {
UPDATE t1 SET content=randomblob(500) WHERE t1;
} {1 {constraint failed}}
sqlite3_fts5_may_be_corrupt 0
finish_test
+26
View File
@@ -46,5 +46,31 @@ do_faultsim_test 1 -faults oom* -prep {
faultsim_test_result {0 {}}
}
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a, content=, contentless_delete=1);
BEGIN;
INSERT INTO t1 VALUES('here''s some text');
INSERT INTO t1 VALUES('useful stuff, text');
INSERT INTO t1 VALUES('what would we do without text!');
COMMIT;
}
faultsim_save_and_close
do_faultsim_test 2 -faults oom* -prep {
faultsim_restore_and_reopen
execsql {
BEGIN;
DELETE FROM t1 WHERE rowid=2;
}
} -body {
execsql {
INSERT INTO t1(t1) VALUES('optimize');
}
} -test {
faultsim_integrity_check
faultsim_test_result {0 {}}
}
finish_test
+30
View File
@@ -52,6 +52,36 @@ do_execsql_test 2.1 {
SELECT * FROM t2('to*');
} {top to tommy}
#-------------------------------------------------------------------------
foreach {tn newrowid} {
1 122
2 123
3 124
} {
reset_db
do_execsql_test 3.$tn.0 {
CREATE VIRTUAL TABLE t12 USING fts5(x);
INSERT INTO t12(rowid, x) VALUES(123, 'wwww');
}
do_execsql_test 3.$tn.1 {
BEGIN;
DELETE FROM t12 WHERE rowid=123;
SELECT * FROM t12('wwww*');
INSERT INTO t12(rowid, x) VALUES($newrowid, 'wwww');
SELECT * FROM t12('wwww*');
END;
} {wwww}
do_execsql_test 3.$tn.2 {
INSERT INTO t12(t12) VALUES('integrity-check');
}
do_execsql_test 3.$tn.3 {
SELECT rowid FROM t12('wwww*');
} $newrowid
}
finish_test
finish_test
+51
View File
@@ -0,0 +1,51 @@
# 2023 Nov 23
#
# 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.
#
#*************************************************************************
#
source [file join [file dirname [info script]] fts5_common.tcl]
ifcapable !fts5 { finish_test ; return }
set ::testprefix fts5secure8
proc sql_repeat {txt n} {
string repeat $txt $n
}
db func repeat sql_repeat
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE ft USING fts5(x);
INSERT INTO ft(ft, rank) VALUES('pgsz', 64);
INSERT INTO ft(rowid, x) VALUES(100, 'hello world');
INSERT INTO ft(rowid, x) VALUES(200, 'one day');
BEGIN;
INSERT INTO ft(rowid, x) VALUES(45, 'one two three');
UPDATE ft SET x = repeat('hello world ', 500) WHERE rowid=100;
COMMIT
}
do_execsql_test 1.1 {
INSERT INTO ft(ft, rank) VALUES('secure-delete', 1);
DELETE FROM ft WHERE rowid=100;
}
do_execsql_test 1.2 {
PRAGMA integrity_check;
} {ok}
finish_test
+244
View File
@@ -0,0 +1,244 @@
/*
** 2017-10-11
**
** 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.
**
******************************************************************************
**
*/
#if !defined(SQLITE_TEST) || defined(SQLITE_OS_UNIX)
#include "sqlite3.h"
#include <string.h>
#include <pthread.h>
/*
** API declarations.
*/
typedef struct Checkpointer Checkpointer;
int sqlite3_bgckpt_create(const char *zFilename, Checkpointer **pp);
int sqlite3_bgckpt_checkpoint(Checkpointer *p, int bBlock);
void sqlite3_bgckpt_destroy(Checkpointer *p);
struct Checkpointer {
sqlite3 *db; /* Database handle */
pthread_t thread; /* Background thread */
pthread_mutex_t mutex;
pthread_cond_t cond;
int rc; /* Error from "PRAGMA wal_checkpoint" */
int bCkpt; /* True if checkpoint requested */
int bExit; /* True if exit requested */
};
static void *bgckptThreadMain(void *pCtx){
int rc = SQLITE_OK;
Checkpointer *p = (Checkpointer*)pCtx;
while( rc==SQLITE_OK ){
int bExit;
pthread_mutex_lock(&p->mutex);
if( p->bCkpt==0 && p->bExit==0 ){
pthread_cond_wait(&p->cond, &p->mutex);
}
p->bCkpt = 0;
bExit = p->bExit;
pthread_mutex_unlock(&p->mutex);
if( bExit ) break;
rc = sqlite3_exec(p->db, "PRAGMA wal_checkpoint", 0, 0, 0);
if( rc==SQLITE_BUSY ){
rc = SQLITE_OK;
}
}
pthread_mutex_lock(&p->mutex);
p->rc = rc;
pthread_mutex_unlock(&p->mutex);
return 0;
}
void sqlite3_bgckpt_destroy(Checkpointer *p){
if( p ){
void *ret = 0;
/* Signal the background thread to exit */
pthread_mutex_lock(&p->mutex);
p->bExit = 1;
pthread_cond_broadcast(&p->cond);
pthread_mutex_unlock(&p->mutex);
pthread_join(p->thread, &ret);
sqlite3_close(p->db);
sqlite3_free(p);
}
}
int sqlite3_bgckpt_create(const char *zFilename, Checkpointer **pp){
Checkpointer *pNew = 0;
int rc;
pNew = (Checkpointer*)sqlite3_malloc(sizeof(Checkpointer));
if( pNew==0 ){
rc = SQLITE_NOMEM;
}else{
memset(pNew, 0, sizeof(Checkpointer));
rc = sqlite3_open(zFilename, &pNew->db);
}
if( rc==SQLITE_OK ){
pthread_mutex_init(&pNew->mutex, 0);
pthread_cond_init(&pNew->cond, 0);
pthread_create(&pNew->thread, 0, bgckptThreadMain, (void*)pNew);
}
if( rc!=SQLITE_OK ){
sqlite3_bgckpt_destroy(pNew);
pNew = 0;
}
*pp = pNew;
return rc;
}
int sqlite3_bgckpt_checkpoint(Checkpointer *p, int bBlock){
int rc;
pthread_mutex_lock(&p->mutex);
rc = p->rc;
if( rc==SQLITE_OK ){
p->bCkpt = 1;
pthread_cond_broadcast(&p->cond);
}
pthread_mutex_unlock(&p->mutex);
return rc;
}
#ifdef SQLITE_TEST
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
# ifndef SQLITE_TCLAPI
# define SQLITE_TCLAPI
# endif
#endif
const char *sqlite3ErrName(int rc);
static void SQLITE_TCLAPI bgckpt_del(void * clientData){
Checkpointer *pCkpt = (Checkpointer*)clientData;
sqlite3_bgckpt_destroy(pCkpt);
}
/*
** Tclcmd: $ckpt SUBCMD ...
*/
static int SQLITE_TCLAPI bgckpt_obj_cmd(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
Checkpointer *pCkpt = (Checkpointer*)clientData;
const char *aCmd[] = { "checkpoint", "destroy", 0 };
int iCmd;
if( objc<2 ){
Tcl_WrongNumArgs(interp, 1, objv, "SUBCMD ...");
return TCL_ERROR;
}
if( Tcl_GetIndexFromObj(interp, objv[1], aCmd, "sub-command", 0, &iCmd) ){
return TCL_ERROR;
}
switch( iCmd ){
case 0: {
int rc;
int bBlock = 0;
if( objc>3 ){
Tcl_WrongNumArgs(interp, 2, objv, "?BLOCKING?");
return TCL_ERROR;
}
if( objc==3 && Tcl_GetBooleanFromObj(interp, objv[2], &bBlock) ){
return TCL_ERROR;
}
rc = sqlite3_bgckpt_checkpoint(pCkpt, bBlock);
if( rc!=SQLITE_OK ){
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
return TCL_ERROR;
}
break;
}
case 1: {
Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
break;
}
}
return TCL_OK;
}
/*
** Tclcmd: bgckpt CMDNAME FILENAME
*/
static int SQLITE_TCLAPI bgckpt_cmd(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
const char *zCmd;
const char *zFilename;
int rc;
Checkpointer *pCkpt;
if( objc!=3 ){
Tcl_WrongNumArgs(interp, 1, objv, "CMDNAME FILENAME");
return TCL_ERROR;
}
zCmd = Tcl_GetString(objv[1]);
zFilename = Tcl_GetString(objv[2]);
rc = sqlite3_bgckpt_create(zFilename, &pCkpt);
if( rc!=SQLITE_OK ){
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
return TCL_ERROR;
}
Tcl_CreateObjCommand(interp, zCmd, bgckpt_obj_cmd, (void*)pCkpt, bgckpt_del);
Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
int Bgckpt_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, "bgckpt", bgckpt_cmd, 0, 0);
return TCL_OK;
}
#endif /* SQLITE_TEST */
#else
#if defined(INCLUDE_SQLITE_TCL_H)
# include "sqlite_tcl.h"
#else
# include "tcl.h"
# ifndef SQLITE_TCLAPI
# define SQLITE_TCLAPI
# endif
#endif
int Bgckpt_Init(Tcl_Interp *interp){ return TCL_OK; }
#endif
@@ -1,10 +1,7 @@
_fiddle_exec
_fiddle_interrupt
_fiddle_experiment
_fiddle_the_db
_fiddle_db_arg
_fiddle_db_filename
_fiddle_exec
_fiddle_experiment
_fiddle_interrupt
_fiddle_main
_fiddle_reset_db
_fiddle_db_handle
_fiddle_db_vfs
_fiddle_export_db
+5 -136
View File
@@ -1,8 +1,3 @@
_malloc
_free
_realloc
_sqlite3_aggregate_context
_sqlite3_auto_extension
_sqlite3_bind_blob
_sqlite3_bind_double
_sqlite3_bind_int
@@ -10,16 +5,11 @@ _sqlite3_bind_int64
_sqlite3_bind_null
_sqlite3_bind_parameter_count
_sqlite3_bind_parameter_index
_sqlite3_bind_pointer
_sqlite3_bind_text
_sqlite3_busy_handler
_sqlite3_busy_timeout
_sqlite3_cancel_auto_extension
_sqlite3_changes
_sqlite3_changes64
_sqlite3_clear_bindings
_sqlite3_close_v2
_sqlite3_collation_needed
_sqlite3_column_blob
_sqlite3_column_bytes
_sqlite3_column_count
@@ -30,28 +20,12 @@ _sqlite3_column_int64
_sqlite3_column_name
_sqlite3_column_text
_sqlite3_column_type
_sqlite3_column_value
_sqlite3_commit_hook
_sqlite3_compileoption_get
_sqlite3_compileoption_used
_sqlite3_complete
_sqlite3_context_db_handle
_sqlite3_create_collation
_sqlite3_create_collation_v2
_sqlite3_create_function
_sqlite3_create_function_v2
_sqlite3_create_module
_sqlite3_create_module_v2
_sqlite3_create_window_function
_sqlite3_data_count
_sqlite3_db_filename
_sqlite3_db_handle
_sqlite3_db_name
_sqlite3_db_status
_sqlite3_declare_vtab
_sqlite3_deserialize
_sqlite3_drop_modules
_sqlite3_errcode
_sqlite3_errmsg
_sqlite3_error_offset
_sqlite3_errstr
@@ -59,38 +33,16 @@ _sqlite3_exec
_sqlite3_expanded_sql
_sqlite3_extended_errcode
_sqlite3_extended_result_codes
_sqlite3_file_control
_sqlite3_finalize
_sqlite3_free
_sqlite3_get_auxdata
_sqlite3_initialize
_sqlite3_keyword_count
_sqlite3_keyword_name
_sqlite3_keyword_check
_sqlite3_last_insert_rowid
_sqlite3_interrupt
_sqlite3_libversion
_sqlite3_libversion_number
_sqlite3_limit
_sqlite3_malloc
_sqlite3_malloc64
_sqlite3_msize
_sqlite3_open
_sqlite3_open_v2
_sqlite3_overload_function
_sqlite3_prepare_v2
_sqlite3_prepare_v3
_sqlite3_preupdate_blobwrite
_sqlite3_preupdate_count
_sqlite3_preupdate_depth
_sqlite3_preupdate_hook
_sqlite3_preupdate_new
_sqlite3_preupdate_old
_sqlite3_progress_handler
_sqlite3_randomness
_sqlite3_realloc
_sqlite3_realloc64
_sqlite3_reset
_sqlite3_reset_auto_extension
_sqlite3_result_blob
_sqlite3_result_double
_sqlite3_result_error
@@ -98,106 +50,23 @@ _sqlite3_result_error_code
_sqlite3_result_error_nomem
_sqlite3_result_error_toobig
_sqlite3_result_int
_sqlite3_result_int64
_sqlite3_result_null
_sqlite3_result_pointer
_sqlite3_result_subtype
_sqlite3_result_text
_sqlite3_result_zeroblob
_sqlite3_result_zeroblob64
_sqlite3_rollback_hook
_sqlite3_serialize
_sqlite3_set_authorizer
_sqlite3_set_auxdata
_sqlite3_set_last_insert_rowid
_sqlite3_shutdown
_sqlite3_sourceid
_sqlite3_sql
_sqlite3_status
_sqlite3_status64
_sqlite3_step
_sqlite3_stmt_isexplain
_sqlite3_stmt_readonly
_sqlite3_stmt_status
_sqlite3_strglob
_sqlite3_stricmp
_sqlite3_strlike
_sqlite3_strnicmp
_sqlite3_table_column_metadata
_sqlite3_total_changes
_sqlite3_total_changes64
_sqlite3_trace_v2
_sqlite3_txn_state
_sqlite3_update_hook
_sqlite3_uri_boolean
_sqlite3_uri_int64
_sqlite3_uri_key
_sqlite3_uri_parameter
_sqlite3_user_data
_sqlite3_value_blob
_sqlite3_value_bytes
_sqlite3_value_double
_sqlite3_value_dup
_sqlite3_value_free
_sqlite3_value_frombind
_sqlite3_value_int
_sqlite3_value_int64
_sqlite3_value_nochange
_sqlite3_value_numeric_type
_sqlite3_value_pointer
_sqlite3_value_subtype
_sqlite3_value_text
_sqlite3_value_type
_sqlite3_vfs_find
_sqlite3_vfs_register
_sqlite3_vfs_unregister
_sqlite3_vtab_collation
_sqlite3_vtab_distinct
_sqlite3_vtab_in
_sqlite3_vtab_in_first
_sqlite3_vtab_in_next
_sqlite3_vtab_nochange
_sqlite3_vtab_on_conflict
_sqlite3_vtab_rhs_value
_sqlite3changegroup_add
_sqlite3changegroup_add_strm
_sqlite3changegroup_delete
_sqlite3changegroup_new
_sqlite3changegroup_output
_sqlite3changegroup_output_strm
_sqlite3changeset_apply
_sqlite3changeset_apply_strm
_sqlite3changeset_apply_v2
_sqlite3changeset_apply_v2_strm
_sqlite3changeset_concat
_sqlite3changeset_concat_strm
_sqlite3changeset_conflict
_sqlite3changeset_finalize
_sqlite3changeset_fk_conflicts
_sqlite3changeset_invert
_sqlite3changeset_invert_strm
_sqlite3changeset_new
_sqlite3changeset_next
_sqlite3changeset_old
_sqlite3changeset_op
_sqlite3changeset_pk
_sqlite3changeset_start
_sqlite3changeset_start_strm
_sqlite3changeset_start_v2
_sqlite3changeset_start_v2_strm
_sqlite3session_attach
_sqlite3session_changeset
_sqlite3session_changeset_size
_sqlite3session_changeset_strm
_sqlite3session_config
_sqlite3session_create
_sqlite3session_delete
_sqlite3session_diff
_sqlite3session_enable
_sqlite3session_indirect
_sqlite3session_isempty
_sqlite3session_memory_used
_sqlite3session_object_config
_sqlite3session_patchset
_sqlite3session_patchset_strm
_sqlite3session_table_filter
_sqlite3_wasm_db_error
_sqlite3_wasm_enum_json
_malloc
_free
+3 -1
View File
@@ -877,7 +877,7 @@ const char * sqlite3_wasm_enum_json(void){
DefInt(SQLITE_STMTSTATUS_FILTER_HIT);
DefInt(SQLITE_STMTSTATUS_MEMUSED);
} _DefGroup;
DefGroup(syncFlags) {
DefInt(SQLITE_SYNC_NORMAL);
DefInt(SQLITE_SYNC_FULL);
@@ -901,6 +901,8 @@ const char * sqlite3_wasm_enum_json(void){
DefInt(SQLITE_DETERMINISTIC);
DefInt(SQLITE_DIRECTONLY);
DefInt(SQLITE_INNOCUOUS);
DefInt(SQLITE_SUBTYPE);
DefInt(SQLITE_RESULT_SUBTYPE);
} _DefGroup;
DefGroup(version) {
+15 -26
View File
@@ -114,7 +114,7 @@
by all client code except that which tests this API. The `row`
property contains the row result in the form implied by the
`rowMode` option (defaulting to `'array'`). The `rowNumber` is a
1-based integer value incremented by 1 on each call into the
1-based integer value incremented by 1 on each call into th
callback.
At the end of the result set, the same event is fired with
@@ -122,17 +122,8 @@
the end of the result set has been reached. Note that the rows
arrive via worker-posted messages, with all the implications
of that.
Notable shortcomings:
- This API was not designed with ES6 modules in mind. Neither Firefox
nor Safari support, as of March 2023, the {type:"module"} flag to the
Worker constructor, so that particular usage is not something we're going
to target for the time being:
https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
*/
globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
// Inspired by: https://stackoverflow.com/a/52439530
if(1===arguments.length && 'function'===typeof arguments[0]){
const f = config;
@@ -169,7 +160,7 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
if(msgHandler && msgHandler.onrow){
msgHandler.onrow(ev);
return;
}
}
if(config.onunhandled) config.onunhandled(arguments[0]);
else err("sqlite3Worker1Promiser() unhandled worker message:",ev);
return;
@@ -196,9 +187,10 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
if(1===arguments.length){
msg = arguments[0];
}else if(2===arguments.length){
msg = Object.create(null);
msg.type = arguments[0];
msg.args = arguments[1];
msg = {
type: arguments[0],
args: arguments[1]
};
}else{
toss("Invalid arugments for sqlite3Worker1Promiser()-created factory.");
}
@@ -244,31 +236,28 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
return p;
};
}/*sqlite3Worker1Promiser()*/;
globalThis.sqlite3Worker1Promiser.defaultConfig = {
self.sqlite3Worker1Promiser.defaultConfig = {
worker: function(){
//#if target=es6-bundler-friendly
return new Worker("sqlite3-worker1-bundler-friendly.mjs",{
type: 'module' /* Noting that neither Firefox nor Safari suppor this,
as of this writing. */
});
return new Worker("sqlite3-worker1.js");
//#else
let theJs = "sqlite3-worker1.js";
if(this.currentScript){
const src = this.currentScript.src.split('/');
src.pop();
theJs = src.join('/')+'/' + theJs;
//sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs);
}else if(globalThis.location){
//sqlite3.config.warn("promiser globalThis.location =",globalThis.location);
const urlParams = new URL(globalThis.location.href).searchParams;
//console.warn("promiser currentScript, theJs =",this.currentScript,theJs);
}else{
//console.warn("promiser self.location =",self.location);
const urlParams = new URL(self.location.href).searchParams;
if(urlParams.has('sqlite3.dir')){
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
}
}
return new Worker(theJs + globalThis.location.search);
return new Worker(theJs + self.location.search);
//#endif
}.bind({
currentScript: globalThis?.document?.currentScript
currentScript: self?.document?.currentScript
}),
onerror: (...args)=>console.error('worker1 promiser error',...args)
};
@@ -273,6 +273,11 @@
</fieldset>
</div>
</div> <!-- #view-split -->
<!-- Maintenance notes:
... TODO... currently being refactored...
-->
<script src="fiddle.js"></script>
</body>
</html>
+1
View File
@@ -344,6 +344,7 @@ TESTSRC += \
$(TOP)/ext/misc/amatch.c \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/basexx.c \
$(TOP)/ext/misc/bgckpt.c \
$(TOP)/ext/misc/carray.c \
$(TOP)/ext/misc/cksumvfs.c \
$(TOP)/ext/misc/closure.c \
+79 -65
View File
@@ -1,13 +1,13 @@
C Version\s3.44.0
D 2023-11-01T11:23:50.173
C Merge\s3.44.2\schanges\sinto\sthe\swal2-3.44\ssub-branch.
D 2023-11-24T12:38:54.644
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20
F Makefile.in a116e61f0fcf16c2305a70e40be4c2c7b236a3a6c1ce09c3263575cf8493bb69
F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6
F Makefile.msc f0cf219350d9af4fba411b4f6306dce2adc897484e8f446de1fb4f40de674d00
F Makefile.msc e7455bcbcd4853c5c6980d15d5217ff720aeb6f1c0256117929332554c106c19
F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8
F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e
F VERSION 672a5ddf487d19856d8b1015797e14578fd8f8d59c14d9832ab0fe5938c6ab9b
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
@@ -22,7 +22,7 @@ F autoconf/configure.ac ec7fa914c5e74ff212fe879f9bb6918e1234497e05facfb641f30c4d
F autoconf/tea/Makefile.in 106a96f2f745d41a0f6193f1de98d7355830b65d45032c18cd7c90295ec24196
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
F autoconf/tea/configure.ac 1ee185f2f8c2e9bed69d0113222724202f962d04eafd57197e65c662d2d9b180
F autoconf/tea/configure.ac 0c358d924fe9cd5c624b9038e025bca35b572a15501014c69afe38b8ae4d7371
F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb
F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523
F autoconf/tea/pkgIndex.tcl.in b9eb6dd37f64e08e637d576b3c83259814b9cddd78bec4af2e5abfc6c5c750ce
@@ -33,7 +33,7 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034
F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6
F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559
F configure 1d9cbcb416cb5387b3f750ae6db63cfedb703a2e46bf8ca61daecff31d208252 x
F configure a56c8f24e118eff90e3870411bfc844e86c00577faf092ded131120a637ad2da x
F configure.ac de31fea7d975bb7ebafbe0e2190a855cc80d48558bf0c9a6578a1836daf1cd3a
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
@@ -46,10 +46,13 @@ F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d
F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc14046bc49df56
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d
F doc/wal2.md a807405a05e19a4945c5905a9ffa0fe45b8560dd7572461192501f565c19cdb5
F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
F ext/consio/console_io.c e048bd69f3a357a4b6b5da01c504728631d944ad5735ad83c44800c80a91e978 x
F ext/consio/console_io.h d18bcc50f4e4d42b65be8fecba72918364ae77182c86360aca842e44b823384e
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6
@@ -93,8 +96,8 @@ F ext/fts5/fts5_aux.c 35c4101613eff86902877a4dedd9400b07922e412cbdd637b45041dce2
F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b729225eeaf6a5
F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081
F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6
F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d
F ext/fts5/fts5_index.c 730c9c32ada18ce1eb7ff847b36507f4b005d88d47af7b47db521e695a8ea4c7
F ext/fts5/fts5_hash.c 076058f93327051952a752dc765df1acfe783eb11b419b30652aa1fc1f987902
F ext/fts5/fts5_index.c 458cbed8a3e17617cbf7e80cdfb7612000b9bb3781f286b345fb9655858658cf
F ext/fts5/fts5_main.c a07ed863b8bd9e6fefb62db2fd40a3518eb30a5f7dcfda5be915dd2db45efa2f
F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca56d6601426d
F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae
@@ -143,7 +146,7 @@ F ext/fts5/test/fts5corrupt.test b6d4034b682bb3387bc44c510c71b3c67d4349e4df13949
F ext/fts5/test/fts5corrupt2.test 99e7e23a58b4d89eb7167c6de1669cbc595cd3c79ab333e0eb56405473319e77
F ext/fts5/test/fts5corrupt3.test 7da9895dafa404efd20728f66ff4b94399788bdc042c36fe2689801bba2ccd78
F ext/fts5/test/fts5corrupt4.test f4c08e2182a48d8b70975fd869ee5391855c06d8a0ff87b6a2529e7c5a88a1d3
F ext/fts5/test/fts5corrupt5.test eb6ba5ca28ef7c4c6b01e850d388cdb3dacc8c4c2f383f79d0a98128257742b4
F ext/fts5/test/fts5corrupt5.test 38a238df26c4de471e1c4b98f8de6c902bc692577a1c08d0ff4f2251f3559644
F ext/fts5/test/fts5corrupt6.test bf8eeae07825b088b9665d9d8e4accbd8dc9bf3cb85b6c64cf6c9e18ccc420a4
F ext/fts5/test/fts5corrupt7.test 80ad7f683a8bda2404731bb77e8c3dbbb620c1f6cc583cca8239f6accd6338c0
F ext/fts5/test/fts5delete.test 619295b20dbc1d840b403ee07c878f52378849c3c02e44f2ee143b3e978a0aa7
@@ -167,7 +170,7 @@ F ext/fts5/test/fts5faultB.test d606bdb8e81aaeb6f41de3fc9fc7ae315733f0903fbff05c
F ext/fts5/test/fts5faultD.test e7ed7895abfe6bc98a5e853826f6b74956e7ba7f594f1860bbf9e504b9647996
F ext/fts5/test/fts5faultE.test 844586ce71dab4be85bb86880e87b624d089f851654cd22e4710c77eb8ce7075
F ext/fts5/test/fts5faultF.test 4abef99f86e99d9f0c6460dd68c586a766b6b9f1f660ada55bf2e8266bd1bbc1
F ext/fts5/test/fts5faultG.test 340e59d2c2c1c7c379224f3968ee8d09b0f64bf56c5194217d1ded887b9d47c4
F ext/fts5/test/fts5faultG.test d2e5a4d9a34e08dcaadcaeafef74d10cbc2abdd11aa2659a18af0294bf2812d3
F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079
F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717
F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e
@@ -193,7 +196,7 @@ F ext/fts5/test/fts5plan.test b65cfcca9ddd6fdaa118c61e17aeec8e8433bc5b6bb307abd1
F ext/fts5/test/fts5porter.test 8d08010c28527db66bc3feebd2b8767504aaeb9b101a986342fa7833d49d0d15
F ext/fts5/test/fts5porter2.test 0d251a673f02fa13ca7f011654873b3add20745f7402f108600a23e52d8c7457
F ext/fts5/test/fts5prefix.test a0fa67b06650f2deaa7bf27745899d94e0fb547ad9ecbd08bfad98c04912c056
F ext/fts5/test/fts5prefix2.test 3847ce46f70b82d61c6095103a9d7c53f2952c40a4704157bc079c04d9c8b18b
F ext/fts5/test/fts5prefix2.test ad751d4a5b029726ee908a7664e27d27bde7584218b8d7944c2a323afd381432
F ext/fts5/test/fts5query.test ac363b17a442620bb0780e93c24f16a5f963dfe2f23dc85647b869efcfada728
F ext/fts5/test/fts5rank.test 30f29e278cd7fb8831ba4f082feb74d8eb90c463bf07113ae200afc2b467ef32
F ext/fts5/test/fts5rebuild.test 55d6f17715cddbf825680dd6551efbc72ed916d8cf1cde40a46fc5d785b451e7
@@ -207,6 +210,7 @@ F ext/fts5/test/fts5secure4.test 0d10a80590c07891478700af7793b232962042677432b98
F ext/fts5/test/fts5secure5.test c07a68ced5951567ac116c22f2d2aafae497e47fe9fcb6a335c22f9c7a4f2c3a
F ext/fts5/test/fts5secure6.test 74bf04733cc523bccca519bb03d3b4e2ed6f6e3db7c59bf6be82c88a0ac857fd
F ext/fts5/test/fts5secure7.test fd03d0868d64340a1db8615b02e5508fea409de13910114e4f19eaefc120777a
F ext/fts5/test/fts5secure8.test eb3579e9d58b0acad97e8082dee1f99b2d393198f03500b453c2b25761c0c298
F ext/fts5/test/fts5securefault.test dbca2b6a1c16700017f5051138991b705410889933f2a37c57ae8a23b296b10b
F ext/fts5/test/fts5simple.test a298670508c1458b88ce6030440f26a30673931884eb5f4094ac1773b3ba217b
F ext/fts5/test/fts5simple2.test 258a1b0c590409bfa5271e872c79572b319d2a56554d0585f68f146a0da603f0
@@ -353,6 +357,7 @@ F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e
F ext/misc/base64.c a71b131e50300c654a66c469a25b62874481f3d1cb3beb56aca9a68edd812e0d
F ext/misc/base85.c 073054111988db593ef5fdb87ab8c459df1ea0c3aaaddf0f5bfa3d72b7e6280a
F ext/misc/basexx.c 89ad6b76558efbceb627afd5e2ef1d84b2e96d9aaf9b7ecb20e3d00b51be6fcf
F ext/misc/bgckpt.c 49ae19aa03e6da393db5d17da256374d4c4d36889fdd89d6e4bc93aca2b752e6
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c cb952620eedf5c0b7625b678f0f08e54d2ec0011d4e50efda5ebdc97f3df7d04
F ext/misc/carray.c 34fac63770971611c5285de0a9f0ac67d504eaf66be891f637add9290f1c76a5
@@ -560,7 +565,7 @@ F ext/session/test_session.c 7b94ad945cd4afe6c73ee935aeb3d44b4446186e1729362af61
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/EXPORTED_FUNCTIONS.fiddle 7fb73f7150ab79d83bb45a67d257553c905c78cd3d693101699243f36c5ae6c3
F ext/wasm/GNUmakefile 0e362f3fc04eab6628cbe4f1e35f4ab4a200881f6b5f753b27fb45eabeddd9d2
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
@@ -569,7 +574,7 @@ F ext/wasm/SQLTester/SQLTester.mjs ec2f6ba63a0f2f0562941a0fb8e46b7dc55589711513f
F ext/wasm/SQLTester/SQLTester.run.mjs c72b7fe2072d05992f7a3d8c6a1d34e95712513ceabe40849784e24e41c84638
F ext/wasm/SQLTester/index.html 3f8a016df0776be76605abf20e815ecaafbe055abac0e1fe5ea080e7846b760d
F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api c5eaceabb9e759aaae7d3101a4a3e542f96ab2c99d89a80ce20ec18c23115f33
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 5eb44fa02e9c693a1884a3692428647894b0380b24bca120866b7a24c8786134
@@ -588,8 +593,8 @@ F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256
F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 595953994aa3ae2287c889c4da39ab3d6f17b6461ecf4bec334b7a3faafddb02
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e
F ext/wasm/api/sqlite3-wasm.c 038de1b6d40b2cc0f41a143a0451db60b2a6f1b5bc06de67da255c54ea1661b7
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f
F ext/wasm/api/sqlite3-wasm.c d0e09eb5ed3743c00294e30019e591c3aa150572ae7ffe8a8994568a7377589f
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a
F ext/wasm/api/sqlite3-worker1.c-pp.js a541112aa51e16705f13a99bb943c64efe178aa28c86704a955f8fd9afe4ba37
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
@@ -612,8 +617,8 @@ F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c
F ext/wasm/fiddle.make fa2ba6e90457ba2a71cb745f200d409caf773076df75ae5b177cc225d7627a11
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js e0153f9af6500805c6f09c0b3cfdb7d857e9d6863dbee9d50d1628fccf5f4b4d
F ext/wasm/fiddle/fiddle.html 550c5aafce40bd218de9bf26192749f69f9b10bc379423ecd2e162bcef885c08
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
F ext/wasm/index-dist.html 22379774f0ad4edcaaa8cf9c674c82e794cc557719a8addabed74eb8069d412e
F ext/wasm/index.html 4e7847b909f4ae0da8c829b150b79454050e53b3658431f138636257729cd42b
F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54
@@ -641,7 +646,7 @@ F ext/wasm/wasmfs.make 8a4955882aaa0783b3f60a9484a1f0f3d8b6f775c0fcd17c082f31966
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 51fd5fc8565007266e6bfd9e299199c752b171707a667b8914a204b38258e1b1
F main.mk 45dfa7a1a9745188f08d9a5bcf15680fe14382d24add829e34b281cd761d7eb7
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -660,18 +665,18 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645
F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
F src/btree.c f3b09c5414de3a11db73e11e1d66f4c5e53c9e89876ff3b531a887ab656ca303 x
F src/btree.c edb79e04dbb4df37a67bcebdde0de4495dfba3c9948a93f6d10f74fd61ab2391 x
F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240
F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15
F src/build.c 189e4517d67f09f0a3e0d8e1faa6e2ef0c2e95f6ac82e33c912cb7efa2a359cc
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b
F src/ctime.c 047a0613c4c3ff65e05903d5b6931185b3df8f34b5178ad2f8d865ada4e9da44
F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574
F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782
F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43
F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500
F src/expr.c 433f12e1237524482b0b2681c07da3cd54ddada2a625237cecde419f3e3a2553
F src/expr.c cacf230b124891ea830d80395ea2119c2d7ee52c134a010f3950de9391ab79d1
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00
F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43
@@ -681,10 +686,10 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238
F src/json.c b2045aafc52f0475dc5d723d11cc0aaa9e1d233a28031b08c8174a3e407ed50c
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
F src/main.c e1bc8864834697503d370d94613be945d05ca1c5ebdda43e7d5c8ee8c48d433c
F src/main.c 1b89f3de98d1b59fec5bac1d66d6ece21f703821b8eaa0d53d9604c35309f6f9
F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -698,7 +703,7 @@ F src/mutex.c 1b4c7e5e3621b510e0c18397210be27cd54c8084141144fbbafd003fde948e88
F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
F src/mutex_unix.c f7ee5a2061a4c11815a2bf4fc0e2bfa6fb8d9dc89390eb613ca0cec32fc9a3d1
F src/mutex_w32.c 38b56d0bc8d54c17c20cbaaad3719b0c36b92fd07a7e34360d0c6a18d5589912
F src/mutex_w32.c 28f8d480387db5b2ef5248705dd4e19db0cfc12c3ba426695a7d2c45c48e6885
F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878
F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
@@ -708,25 +713,25 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210
F src/os_unix.c cb116fde9e3ca3c1bbfdf89d6928f776a2a34da168e2667426523a4db353b271
F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 699aab8dfc88056d796b03b40c0ab979040d58dfc3ae9db207f1be91e4880bbf
F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473
F src/pager.c 3f41b76db0cf601f05ab4df508a9f19b90ad50fc5031a5f41fb8f23b16ed9429
F src/pager.h 1da654b51a4a002e6d8bf68fbdb454e1f31ebe43cc4d399a4dfb8da4ad2fe182
F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec
F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00
F src/pragma.c b3b4ad9c0298d63098a067acca613c21a5f56b4d176d5842922bcd0b07b7164e
F src/pragma.c 087234c661e4f09e0cc53ae29ed59ed2e555d49c0dd12d913665a6bcf5ab9e1b
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9
F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515
F src/shell.c.in 3e9371ca6a93294931a8ed8b098bc3cb15d57567aa9a1f2ade72db7f5c572795
F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276
F src/select.c 85857bedd2913d888aa571755b48c54cd2e6e7fcb0087e19b226ee0368cfda1e
F src/shell.c.in cbe850737d4166347bfe5fc7d695229379347509bf114cf6abeb1e384f2d7a70
F src/sqlite.h.in 4f841d3d117b830ee5ee45e8d89ceff1195f3ebb72d041ace8d116ba4c103b35
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c
F src/sqliteInt.h 08efc0ad9ddbbc5ea859111521dff2c4cecc589c0c9a3e4840c927663b31445b
F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -751,7 +756,7 @@ F src/test_demovfs.c 38a459d1c78fd9afa770445b224c485e079018d6ac07332ff9bd07b54d2
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
F src/test_fs.c 56cc17e4fdc57efa61695026e2ba96e910b17060d7ee01d775ec048791522e2f
F src/test_func.c 24df3a346c012b1fc9e1001d346db6054deb426db0a7437e92490630e71c9b0a
F src/test_hexio.c 9478e56a0f08e07841a014a93b20e4ba2709ab56d039d1ca8020e26846aa19bd
F src/test_hexio.c a605a100e628d39330044ae5f34cb19d50843061ed3178c3f83b37aef65f7e0a
F src/test_init.c f2cc4774b7c9140f76e45ecbb2ae219f68e3acbbe248c0179db666a70eae9f08
F src/test_intarray.c 26ffba666beb658d73cd925d9b4fb56913a3ca9aaeac122b3691436abb192b92
F src/test_intarray.h 6c3534641108cd1bea517a8e117dcba237081310a29a4c35bd2190caa8972293
@@ -772,7 +777,7 @@ F src/test_schema.c cbfd7a9a9b6b40d4377d0c76a6c5b2a58387385977f26edab4e77eb5f90a
F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
F src/test_syscall.c 9fdb13b1df05e639808d44fcb8f6064aaded32b6565c00b215cfd05a060d1aca
F src/test_tclsh.c 3ff5d188a72f00807425954ea3b493dfd3a4b890ecc6700ea83bad2fd1332ecf
F src/test_tclsh.c 01c76e2ee362cda246710c476351b105371cf4620857c8492121858744998dc9
F src/test_tclvar.c 3273f9d59395b336e381b53cfc68ec6ebdaada4e93106a2e976ffb0550504e1c
F src/test_thread.c 7ddcf0c8b79fa3c1d172f82f322302c963d923cdb503c6171f3c8081586d0b01
F src/test_vdbecov.c f60c6f135ec42c0de013a1d5136777aa328a776d33277f92abac648930453d43
@@ -791,26 +796,26 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677
F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104
F src/vdbe.c 14479441337135eed8e290fb1d4abb7db657d93217a3b1ea8a2f031d3895536a
F src/vdbe.c 7bd1c8301f01b1febaaeec52d5df62fcaf83f5e90ba9326f8b18470b4d52836a
F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0
F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c
F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6
F src/vdbeaux.c dffcf79e7e415fcd6e4c8ac1ec7124cae5257018443adf09551c807655b04993
F src/vdbeapi.c dd812ddd2f7806519e9d492c820456f86628bb6014b559034506e7f9d7f683c5
F src/vdbeaux.c b51bdb7b2c6d17af604fb187bb22775e38cbca9e4e3f485a06a5fb7a6f9c21ca
F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5
F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b
F src/vdbemem.c 0012d5f01cc866833847c2f3ae4c318ac53a1cb3d28acad9c35e688039464cf0
F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7
F src/vtab.c 154725ebecd3bc02f7fbd7ad3974334f73fff76e02a964e828e48a7c5fb7efff
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 01e051a1e713d9eabdb25df38602837cec8f4c2cae448ce2cf6accc87af903e9
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/wal.c ffbca820a2ee9827269488cf8e1356ae66ad1e65da636da4eb4f3fcdf9d6ddd5
F src/wal.h 97b8a9903387401377b59507e86b93a148ef1ad4e5ce0f23659a12dcdce56af2
F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
F src/where.c 313ce81270d2a414672370e1ee74e65949ad620519193d4cac2986d073cbc8a0
F src/where.c 45b2239e127beaaae2367e503ca4c82868d8fef707c7f7f4a6c0528e7d5f65ff
F src/whereInt.h 4b38c5889514e3aead3f27d0ee9a26e47c3f150efc59e2a8b4e3bc8835e4d7a1
F src/wherecode.c 5d77db30a2a3dd532492ae882de114edba2fae672622056b1c7fd61f5917a8f1
F src/whereexpr.c dc5096eca5ed503999be3bdee8a90c51361289a678d396a220912e9cb73b3c00
F src/window.c ad21e2b73ec75acc79dde2576c573f54a338b0c49e9de847ce984f9b9595b5e2
F src/window.c 5b1387d59df30d481ed14cceef5f4d1dab1f8752aa106ba72c8b62777bd139d2
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9
@@ -820,7 +825,7 @@ F test/aggnested.test 2e738bfe2980df301a782f6e7bbf9459266f64f7e72f58f3b5c843bf89
F test/aggorderby.test e6b98dbbf3ababa96892435d387de2dcf602ef02c2b848d2d817473066f154ba
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13
F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454
F test/alter.test 3c00eff1e2036b9f93e9cd0f3d3e63750ac87ecb5bc71b9d7bd07cbf2ac4c494
F test/alter2.test a966ccfcddf9ce0a4e0e6ff1aca9e6e7948e0e242cd7e43fc091948521807687
F test/alter3.test ffc4ab29ce78a3517a66afd69b2730667e3471622509c283b2bd4c46f680fba3
F test/alter4.test 716caa071dd8a3c6d57225778d15d3c3cbf5e34b2e84ae44199aeb2bbf50a707
@@ -978,7 +983,7 @@ F test/corrupt6.test fc6a891716139665dae0073b6945e3670bf92568
F test/corrupt7.test ffa86896fe63a3d00b0a131e1e64f402e4da9f7e5d89609d6501c851e511d73a
F test/corrupt8.test 2399dfe40d2c0c63af86706e30f3e6302a8d0516
F test/corrupt9.test 730a3db08d4ab9aa43392ea30d9c2b4879cbff85
F test/corruptA.test 112f4b2ae0b95ebf3ea63718642fb969a93acea557ace3a307234d19c245989b
F test/corruptA.test 56e8f321adaf3411960e9d2c7136669d8e1a91cbde6cf401ea84e6d6c7ccbe10
F test/corruptB.test 73a8d6c0b9833697ecf16b63e3c5c05c945b5dec
F test/corruptC.test 9cf32275dae3ca33f645afe5d1d3f5ba5ac2af2b0833dfb5282f9dccb6fb81bb
F test/corruptD.test a828c788535946a372a56a750b242cd96287cd823657abe5a73c5e51b91bdd28
@@ -1266,7 +1271,7 @@ F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a91
F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997
F test/indexA.test 11d84f6995e6e5b9d8315953fb1b6d29772ee7c7803ee9112715e7e4dd3e4974
F test/indexedby.test f21eca4f7a6ffe14c8500a7ad6cd53166666c99e5ccd311842a28bc94a195fe0
F test/indexexpr1.test 62558b1cfd7ccbe7bc015849cc6d1a13ef124e80cbd5b3a98dc66c3c9cce0cf4
F test/indexexpr1.test 833f511213a5e26549186813f0566bd72f978177a7e6e98a2d2dd695de3c670d
F test/indexexpr2.test 1c382e81ef996d8ae8b834a74f2a9013dddf59214c32201d7c8a656d739f999a
F test/indexfault.test 98d78a8ff1f5335628b62f886a1cb7c7dac1ef6d48fa39c51ec871c87dce9811
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
@@ -1306,7 +1311,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2
F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28
F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b
F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127
F test/joinH.test 84198ea42bf78b79fe399c0567218cd6df36c50c6dd27d9c4aab221acaad929e
F test/joinH.test f69e5b53b7d887914e854b6a131efbed4ea9f5ca52bdab81788bfc3e79299f43
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
@@ -1322,7 +1327,7 @@ F test/json102.test 4c69694773a470f1fda34e5f4ba24920b35184fb66050b450fc2ef9ab5ad
F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1
F test/json105.test 11670a4387f4308ae0318cadcbd6a918ea7edcd19fbafde020720a073952675d
F test/json501.test f71710f60fa45b19dc336fbaac9e8362f70f80cf81badefdb845ed3f7c7c2ccc
F test/json501.test c419deb835b70c1a2c8532936927bcc1146730328edd2052276715bfd209724d
F test/json502.test 98c38e3c4573841028a1381dfb81d4c3f9b105d39668167da10d055e503f6d0b
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
F test/kvtest.c 6e0228409ea7ca0497dad503fbd109badb5e59545d131014b6aaac68b56f484a
@@ -1455,7 +1460,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/pendingrace.test 6aa33756b950c4529f79c4f3817a9a1e4025bd0d9961571a05c0279bd183d9c6
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test f7caf8dd5c7b1da74842a48df116f7f193399c656d4ffc805cd0d9658568c675
F test/permutations.test 58188152f3e0e319cd916f5f6e1afb34c8d3a5219fe49fe62c0c706514e54970
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 57a36226218c03cfb381019fe43234b2cefbd8a1f12825514f906a17ccf7991e
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1479,7 +1484,7 @@ F test/quote.test ffb40f0eb7a25c1d8cfe11ee2fe67f8e85fbf3fed348810834114be1fdada1
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/rdonly.test 21e99ee237265d0cf95a0c84b50c784e834acaa4ef05d92a27b262626a656682
F test/recover.test fd5199f928757cb308661b5fdca1abc19398a798ff7f24b57c3071e9f8e0471e
F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
@@ -1510,11 +1515,11 @@ F test/rowvaluefault.test 963ae9cdaed30a85a29668dd514e639f3556cae903ee9f172ea972
F test/rowvaluevtab.test cd9747bb3f308086944c07968f547ad6b05022e698d80b9ffbdfe09ce0b8da6f
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
F test/savepoint.test 6e9804a17767f08432c7a5e738b9a8f4b891d243110b63d3a41d270d3d1378ec
F test/savepoint.test 63a120ec4fbbd5025b238c259d12ed0516fbf4bca6384041cb995ade9a5f00d2
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7
F test/savepoint6.test 48a645a7bb3a59a6fcf06a7364cfe5b655c336760de39068f7c241b0fc80d963
F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa
F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2
F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e
@@ -1561,7 +1566,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21
F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test 2191c892d8256b1b6cccb4fca894cfc2e748450cf422e6ec80a320a0d538b6df
F test/shell1.test c7127a5e780ffc9e14c476773127fdf292c6db226529c44c1676f37b3793123f
F test/shell2.test 35226c070a8c7f64fd016dfac2a0db2a40f709b3131f61daacd9dad61536c9cb
F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a
F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f
@@ -1646,7 +1651,7 @@ F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d1631311a16
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 68454ef88508c196d19e8694daa27bff7107a91857799eaa12f417188ae53ede
F test/tester.tcl e6b9adcf4e56aa5c658501c10650646fee467b85d51a4ac80263d2cdae3993ba
F test/testrunner.tcl 14c8b8ece841b1dd17516a0dc9c7ad9b5f4d4db7987974d3fdf66ae56b2a71fa
F test/testrunner_data.tcl 7f73f93634d32dafc857ed491b840f371113d09fde6a8bfb9e47b938d47b8c85
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
@@ -1869,7 +1874,7 @@ F test/upsert3.test 88d7d590a1948a9cb6eac1b54b0642f67a9f35a1fc0f19b200e97d5d39e3
F test/upsert4.test 25d2a1da92f149331ae0c51ca6e3eee78189577585eab92de149900d62994fa5
F test/upsert5.test fff0dcfce73c649204543088d8e5bde01172676063ec9b8f8fc7f195abc386fe
F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
F test/uri.test c1abaaaa28e9422d61e5f3f9cbc8ef993ec49fe802f581520731708561d49384
F test/uri.test 8f27eaa41804099fca15101e30fd1b29aebbebf32d4e3c24614fa6319216936d
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
F test/userauth01.test e740a2697a7b40d7c5003a7d7edaee16acd349a9
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
@@ -1912,8 +1917,20 @@ F test/vtab_shared.test 5253bff2355a9a3f014c15337da7e177ab0ef8ad
F test/vtabdistinct.test 7688f0889358f849fd60bbfde1ded38b014b18066076d4bfbb75395804dfe072
F test/vtabdrop.test 65d4cf6722972e5499bdaf0c0d70ee3b8133944a4e4bc31862563f32a7edca12
F test/vtabrhs1.test 9b5ecbc74a689500c33a4b2b36761f9bcc22fcc4e3f9d21066ee0c9c74cf5f6c
F test/wal.test b7cc6984709f54afbf8441747ced1f646af120bf0c1b1d847bfa39306fbea089
F test/wal.test 07d61ee522bc203235a7979645d6c5d84f86882afad5b678532ee37b5b85b133
F test/wal2.test 31f6e2c404b9f2cdf9ca19b105a1742fdc19653c2c936da39e3658c617524046
F test/wal2big.test 829141cbecdda4329db8fa38705424c4a73db72a06b9540b06811a825d330409
F test/wal2fault.test 2e8e60cacd5bcd451618aeffd05f676894d17202d3e2986e288d36e2c5993249
F test/wal2lock.test 0ef98d72dc6bcf7711dedd684760488400d9a9a6eec0dc5d3822060437793552
F test/wal2openclose.test 2b26be723ea7f4263c8d5d70b37efd1c359561a0526e39466c45fe8e6478daee
F test/wal2recover.test 28b3fa0acb4e8725211a02803cd51116cd048841a876224f244af78039ba34fa
F test/wal2recover2.test 3fe5d5932b16a3a38304a85bafed1f965faef40c230fd450838a0502e61343bb
F test/wal2recover3.test 4a91689e165a38bc401736e6518188c2b0ff4fa1566d1810b8867536db128177
F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c
F test/wal2rollback.test 23adc4a099b23f6aaea8b04fdca1c35861d887dd80f8be7da2d5273eb777e428
F test/wal2savepoint.test 2c82bd6a6ee5066c156040d2e9c2415646fcf96116ae7ad127eaf0c0b4a85f22
F test/wal2simple.test 320a08927f307d0ead26fa3fcef4e3f64279f49be9504f918cb33294f75aeec8
F test/wal2snapshot.test 7a5f4629a3c43a43c3440b8b2ea9f07de91a46b0b9eea5f08f62b5bf5b6468df
F test/wal3.test 5de023bb862fd1eb9d2ad26fa8d9c43abb5370582e5b08b2ae0d6f93661bc310
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test 9c11da7aeccd83a46d79a556ad11a18d3cb15aa9
@@ -1939,7 +1956,7 @@ F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
F test/waloverwrite.test dad2f26567f1b45174e54fbf9a8dc1cb876a7f03
F test/walpersist.test 8d78a1ec91299163451417b451a2bac3481f8eb9f455b1ca507a6625c927ca6e
F test/walprotocol.test 1b3f922125e341703f6e946d77fdc564d38fb3e07a9385cfdc6c99cac1ecf878
F test/walprotocol2.test 7d3b6b4bf0b12f8007121b1e6ef714bc99101fb3b48e46371df1db868eebc131
F test/walprotocol2.test 7e4bedd5ee83607e2928ac438bf7332a396b980d3e02aa0746509ce11ad1f13c
F test/walro.test cb438d05ba0d191f10b688e39c4f0cd5b71569a1d1f4440e5bdf3c6880e08c20
F test/walro2.test 33955a6fd874dd9724005e17f77fef89d334b3171454a1256fe4941a96766cdc
F test/walrofault.test c70cb6e308c443867701856cce92ad8288cd99488fa52afab77cca6cfd51af68
@@ -1966,7 +1983,7 @@ F test/whereC.test cae295158703cb3fc23bf1a108a9ab730efff0f6
F test/whereD.test c1c335e914e28b122e000e9310f02d2be83e1c9dbca2e29f46bd732703944d1b
F test/whereE.test 7a727b5d5b6bc8fa4cef5206e90cc0363e55ca7f0566f6fbad0206e43170f59e
F test/whereF.test 926b65519608e3f2aa28720822b9154fb5c7b13519dd78194f434a511ab3dac5
F test/whereG.test b2a479f425f7d0a432df7e842e8484560908ef703fe0fd407888ff85e7097238
F test/whereG.test 649d5ad02a87a76ec2ac8de9441e2c83a4dd0f29e459a31215c0533788c6bf07
F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2
F test/whereI.test c4bb7e2ca56d49bd8ab5c7bd085b8b83e353922b46904d68aefb3c7468643581
F test/whereJ.test fc05e374cc9f2dc204148d6c06822c380ad388895fe97a6d335b94a26a08aecf
@@ -2059,13 +2076,13 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a
F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x
F tool/mkctimec.tcl 372452e24267dfe1b496eec3992d10c6e5e7d7870a152560cdcfe5404bc8cc04 x
F tool/mkctimec.tcl 9edac3f6d9b867cfeb9da44fe2ab6ab9bb2bdfe66a7f171a8035013a15253b95 x
F tool/mkkeywordhash.c b9faa0ae7e14e4dbbcd951cddd786bf46b8a65bb07b129ba8c0cfade723aaffd
F tool/mkmsvcmin.tcl 8897d515ef7f94772322db95a3b6fce6c614d84fe0bdd06ba5a1c786351d5a1d
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
F tool/mkopcodeh.tcl 769d9e6a8b462323150dc13a8539d6064664b72974f7894befe2491cc73e05cd
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
F tool/mkpragmatab.tcl bd07bd59d45d0f3448e123d6937e9811195f9908a51e09d774609883055bfd3d
F tool/mkpragmatab.tcl 32e359ccb21011958a821955254bd7a5fa7915d01a8c16fed91ffc8b40cb4adf
F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971fed0
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
@@ -2106,7 +2123,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
F tool/src-verify.c 41c586dee84d0b190ad13e0282ed83d4a65ec9fefde9adf4943efdf6558eea7f
F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f
F tool/srctree-check.tcl cef630bc4ff21a460d72479c43a42bf1c1ed61897659305c35c8d72e91bcb176
F tool/srctree-check.tcl 9f1098d439159692ece45cc9e701b35df4956269399fe0c770e41f235d1ce5e6
F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43
F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37
F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d
@@ -2139,11 +2156,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510
R 06db090922d30265c1e1381238ea6702
T +sym-major-release *
T +sym-release *
T +sym-version-3.44.0 *
P 2672572cc373e97054cc56dd0d48aaf56be5fef9704f7c177f64bd622151eadb ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f
R 79dd4db7e84abf2dfef496293e208c75
U drh
Z 14f36413d8197ea0c35026cb3842c9f7
Z c2e274816d57ff4863e5f579538a274a
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301
0118e8c981fdfa4f8e593b56a2cbb97c489c3a97a3494f21a7a63b196659530c
+5 -5
View File
@@ -3260,10 +3260,10 @@ static int lockBtree(BtShared *pBt){
goto page1_init_failed;
}
#else
if( page1[18]>2 ){
if( page1[18]>3 ){
pBt->btsFlags |= BTS_READ_ONLY;
}
if( page1[19]>2 ){
if( page1[19]>3 ){
goto page1_init_failed;
}
@@ -3275,9 +3275,9 @@ static int lockBtree(BtShared *pBt){
** may not be the latest version - there may be a newer one in the log
** file.
*/
if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
if( page1[19]>=2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
int isOpen = 0;
rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);
rc = sqlite3PagerOpenWal(pBt->pPager, (page1[19]==3), &isOpen);
if( rc!=SQLITE_OK ){
goto page1_init_failed;
}else{
@@ -11306,7 +11306,7 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
BtShared *pBt = pBtree->pBt;
int rc; /* Return code */
assert( iVersion==1 || iVersion==2 );
assert( iVersion==1 || iVersion==2 || iVersion==3 );
/* If setting the version fields to 1, do not automatically open the
** WAL connection, even if the version fields are currently set to 2.
+1
View File
@@ -776,6 +776,7 @@ static const char * const sqlite3azCompileOpt[] = {
#ifdef SQLITE_VDBE_COVERAGE
"VDBE_COVERAGE",
#endif
"WAL2",
#ifdef SQLITE_WIN32_MALLOC
"WIN32_MALLOC",
#endif
+2 -2
View File
@@ -6043,8 +6043,8 @@ int sqlite3ExprListCompare(const ExprList *pA, const ExprList *pB, int iTab){
*/
int sqlite3ExprCompareSkip(Expr *pA,Expr *pB, int iTab){
return sqlite3ExprCompare(0,
sqlite3ExprSkipCollateAndLikely(pA),
sqlite3ExprSkipCollateAndLikely(pB),
sqlite3ExprSkipCollate(pA),
sqlite3ExprSkipCollate(pB),
iTab);
}
+56 -40
View File
@@ -432,13 +432,19 @@ static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){
zIn++;
N -= 2;
while( N>0 ){
for(i=0; i<N && zIn[i]!='\\'; i++){}
for(i=0; i<N && zIn[i]!='\\' && zIn[i]!='"'; i++){}
if( i>0 ){
jsonAppendRawNZ(p, zIn, i);
zIn += i;
N -= i;
if( N==0 ) break;
}
if( zIn[0]=='"' ){
jsonAppendRawNZ(p, "\\\"", 2);
zIn++;
N--;
continue;
}
assert( zIn[0]=='\\' );
switch( (u8)zIn[1] ){
case '\'':
@@ -833,7 +839,8 @@ static void jsonReturnJson(
JsonParse *pParse, /* The complete JSON */
JsonNode *pNode, /* Node to return */
sqlite3_context *pCtx, /* Return value for this function */
int bGenerateAlt /* Also store the rendered text in zAlt */
int bGenerateAlt, /* Also store the rendered text in zAlt */
int omitSubtype /* Do not call sqlite3_result_subtype() */
){
JsonString s;
if( pParse->oom ){
@@ -848,7 +855,7 @@ static void jsonReturnJson(
pParse->nAlt = s.nUsed;
}
jsonResult(&s);
sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
if( !omitSubtype ) sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
}
}
@@ -889,7 +896,8 @@ static u32 jsonHexToInt4(const char *z){
static void jsonReturn(
JsonParse *pParse, /* Complete JSON parse tree */
JsonNode *pNode, /* Node to return */
sqlite3_context *pCtx /* Return value for this function */
sqlite3_context *pCtx, /* Return value for this function */
int omitSubtype /* Do not call sqlite3_result_subtype() */
){
switch( pNode->eType ){
default: {
@@ -1035,7 +1043,7 @@ static void jsonReturn(
}
case JSON_ARRAY:
case JSON_OBJECT: {
jsonReturnJson(pParse, pNode, pCtx, 0);
jsonReturnJson(pParse, pNode, pCtx, 0, omitSubtype);
break;
}
}
@@ -2387,7 +2395,7 @@ static void jsonParseFunc(
printf("iSubst = %u\n", p->iSubst);
printf("iHold = %u\n", p->iHold);
jsonDebugPrintNodeEntries(p->aNode, p->nNode);
jsonReturnJson(p, p->aNode, ctx, 1);
jsonReturnJson(p, p->aNode, ctx, 1, 0);
}
/*
@@ -2573,15 +2581,14 @@ static void jsonExtractFunc(
}
if( pNode ){
if( flags & JSON_JSON ){
jsonReturnJson(p, pNode, ctx, 0);
jsonReturnJson(p, pNode, ctx, 0, 0);
}else{
jsonReturn(p, pNode, ctx);
sqlite3_result_subtype(ctx, 0);
jsonReturn(p, pNode, ctx, 1);
}
}
}else{
pNode = jsonLookup(p, zPath, 0, ctx);
if( p->nErr==0 && pNode ) jsonReturn(p, pNode, ctx);
if( p->nErr==0 && pNode ) jsonReturn(p, pNode, ctx, 0);
}
}else{
/* Two or more PATH arguments results in a JSON array with each
@@ -2707,7 +2714,7 @@ static void jsonPatchFunc(
if( pResult && pX->oom==0 ){
jsonDebugPrintParse(pX);
jsonDebugPrintNode(pResult);
jsonReturnJson(pX, pResult, ctx, 0);
jsonReturnJson(pX, pResult, ctx, 0, 0);
}else{
sqlite3_result_error_nomem(ctx);
}
@@ -2786,7 +2793,7 @@ static void jsonRemoveFunc(
}
}
if( (pParse->aNode[0].jnFlags & JNODE_REMOVE)==0 ){
jsonReturnJson(pParse, pParse->aNode, ctx, 1);
jsonReturnJson(pParse, pParse->aNode, ctx, 1, 0);
}
remove_done:
jsonDebugPrintParse(p);
@@ -2915,7 +2922,7 @@ static void jsonReplaceFunc(
jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]);
}
}
jsonReturnJson(pParse, pParse->aNode, ctx, 1);
jsonReturnJson(pParse, pParse->aNode, ctx, 1, 0);
replace_err:
jsonDebugPrintParse(pParse);
jsonParseFree(pParse);
@@ -2969,7 +2976,7 @@ static void jsonSetFunc(
}
}
jsonDebugPrintParse(pParse);
jsonReturnJson(pParse, pParse->aNode, ctx, 1);
jsonReturnJson(pParse, pParse->aNode, ctx, 1, 0);
jsonSetDone:
jsonParseFree(pParse);
}
@@ -3484,7 +3491,7 @@ static int jsonEachColumn(
case JEACH_KEY: {
if( p->i==0 ) break;
if( p->eType==JSON_OBJECT ){
jsonReturn(&p->sParse, pThis, ctx);
jsonReturn(&p->sParse, pThis, ctx, 0);
}else if( p->eType==JSON_ARRAY ){
u32 iKey;
if( p->bRecursive ){
@@ -3500,7 +3507,7 @@ static int jsonEachColumn(
}
case JEACH_VALUE: {
if( pThis->jnFlags & JNODE_LABEL ) pThis++;
jsonReturn(&p->sParse, pThis, ctx);
jsonReturn(&p->sParse, pThis, ctx, 0);
break;
}
case JEACH_TYPE: {
@@ -3511,7 +3518,7 @@ static int jsonEachColumn(
case JEACH_ATOM: {
if( pThis->jnFlags & JNODE_LABEL ) pThis++;
if( pThis->eType>=JSON_ARRAY ) break;
jsonReturn(&p->sParse, pThis, ctx);
jsonReturn(&p->sParse, pThis, ctx, 0);
break;
}
case JEACH_ID: {
@@ -3804,34 +3811,43 @@ static sqlite3_module jsonTreeModule = {
void sqlite3RegisterJsonFunctions(void){
#ifndef SQLITE_OMIT_JSON
static FuncDef aJsonFunc[] = {
JFUNCTION(json, 1, 0, jsonRemoveFunc),
JFUNCTION(json_array, -1, 0, jsonArrayFunc),
JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc),
JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc),
JFUNCTION(json_error_position,1, 0, jsonErrorFunc),
JFUNCTION(json_extract, -1, 0, jsonExtractFunc),
JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc),
JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc),
JFUNCTION(json_insert, -1, 0, jsonSetFunc),
JFUNCTION(json_object, -1, 0, jsonObjectFunc),
JFUNCTION(json_patch, 2, 0, jsonPatchFunc),
JFUNCTION(json_quote, 1, 0, jsonQuoteFunc),
JFUNCTION(json_remove, -1, 0, jsonRemoveFunc),
JFUNCTION(json_replace, -1, 0, jsonReplaceFunc),
JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc),
JFUNCTION(json_type, 1, 0, jsonTypeFunc),
JFUNCTION(json_type, 2, 0, jsonTypeFunc),
JFUNCTION(json_valid, 1, 0, jsonValidFunc),
#if SQLITE_DEBUG
JFUNCTION(json_parse, 1, 0, jsonParseFunc),
JFUNCTION(json_test1, 1, 0, jsonTest1Func),
/* calls sqlite3_result_subtype() */
/* | */
/* Uses cache ______ | __ calls sqlite3_value_subtype() */
/* | | | */
/* Num args _________ | | | ___ Flags */
/* | | | | | */
/* | | | | | */
JFUNCTION(json, 1, 1, 1, 0, 0, jsonRemoveFunc),
JFUNCTION(json_array, -1, 0, 1, 1, 0, jsonArrayFunc),
JFUNCTION(json_array_length, 1, 1, 0, 0, 0, jsonArrayLengthFunc),
JFUNCTION(json_array_length, 2, 1, 0, 0, 0, jsonArrayLengthFunc),
JFUNCTION(json_error_position,1, 1, 0, 0, 0, jsonErrorFunc),
JFUNCTION(json_extract, -1, 1, 1, 0, 0, jsonExtractFunc),
JFUNCTION(->, 2, 1, 1, 0, JSON_JSON, jsonExtractFunc),
JFUNCTION(->>, 2, 1, 0, 0, JSON_SQL, jsonExtractFunc),
JFUNCTION(json_insert, -1, 1, 1, 1, 0, jsonSetFunc),
JFUNCTION(json_object, -1, 0, 1, 1, 0, jsonObjectFunc),
JFUNCTION(json_patch, 2, 1, 1, 0, 0, jsonPatchFunc),
JFUNCTION(json_quote, 1, 0, 1, 1, 0, jsonQuoteFunc),
JFUNCTION(json_remove, -1, 1, 1, 0, 0, jsonRemoveFunc),
JFUNCTION(json_replace, -1, 1, 1, 1, 0, jsonReplaceFunc),
JFUNCTION(json_set, -1, 1, 1, 1, JSON_ISSET, jsonSetFunc),
JFUNCTION(json_type, 1, 1, 0, 0, 0, jsonTypeFunc),
JFUNCTION(json_type, 2, 1, 0, 0, 0, jsonTypeFunc),
JFUNCTION(json_valid, 1, 1, 0, 0, 0, jsonValidFunc),
#ifdef SQLITE_DEBUG
JFUNCTION(json_parse, 1, 1, 1, 0, 0, jsonParseFunc),
JFUNCTION(json_test1, 1, 1, 0, 1, 0, jsonTest1Func),
#endif
WAGGREGATE(json_group_array, 1, 0, 0,
jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse,
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC),
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|
SQLITE_DETERMINISTIC),
WAGGREGATE(json_group_object, 2, 0, 0,
jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse,
SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC)
SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|
SQLITE_DETERMINISTIC)
};
sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc));
#endif
+1 -1
View File
@@ -1914,7 +1914,7 @@ int sqlite3CreateFunc(
assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC );
assert( SQLITE_FUNC_DIRECT==SQLITE_DIRECTONLY );
extraFlags = enc & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY|
SQLITE_SUBTYPE|SQLITE_INNOCUOUS);
SQLITE_SUBTYPE|SQLITE_INNOCUOUS|SQLITE_RESULT_SUBTYPE);
enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY);
/* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But
+1 -1
View File
@@ -87,7 +87,7 @@ void sqlite3MemoryBarrier(void){
SQLITE_MEMORY_BARRIER;
#elif defined(__GNUC__)
__sync_synchronize();
#elif MSVC_VERSION>=1300
#elif MSVC_VERSION>=1400
_ReadWriteBarrier();
#elif defined(MemoryBarrier)
MemoryBarrier();
+33 -26
View File
@@ -789,20 +789,6 @@ static const unsigned char aJournalMagic[] = {
# define USEFETCH(x) 0
#endif
/*
** The argument to this macro is a file descriptor (type sqlite3_file*).
** Return 0 if it is not open, or non-zero (but not 1) if it is.
**
** This is so that expressions can be written as:
**
** if( isOpen(pPager->jfd) ){ ...
**
** instead of
**
** if( pPager->jfd->pMethods ){ ...
*/
#define isOpen(pFd) ((pFd)->pMethods!=0)
#ifdef SQLITE_DIRECT_OVERFLOW_READ
/*
** Return true if page pgno can be read directly from the database file
@@ -934,6 +920,7 @@ static int assert_pager_state(Pager *p){
assert( isOpen(p->jfd)
|| p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_WAL
|| p->journalMode==PAGER_JOURNALMODE_WAL2
);
}
assert( pPager->dbOrigSize==pPager->dbFileSize );
@@ -948,6 +935,7 @@ static int assert_pager_state(Pager *p){
assert( isOpen(p->jfd)
|| p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_WAL
|| p->journalMode==PAGER_JOURNALMODE_WAL2
|| (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
);
assert( pPager->dbOrigSize<=pPager->dbHintSize );
@@ -960,6 +948,7 @@ static int assert_pager_state(Pager *p){
assert( isOpen(p->jfd)
|| p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_WAL
|| p->journalMode==PAGER_JOURNALMODE_WAL2
|| (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
);
break;
@@ -2081,7 +2070,7 @@ static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){
}
pPager->journalOff = 0;
}else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST
|| (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)
|| (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL)
){
rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile);
pPager->journalOff = 0;
@@ -2096,6 +2085,7 @@ static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){
assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE
|| pPager->journalMode==PAGER_JOURNALMODE_MEMORY
|| pPager->journalMode==PAGER_JOURNALMODE_WAL
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
);
sqlite3OsClose(pPager->jfd);
if( bDelete ){
@@ -3251,6 +3241,10 @@ static int pagerBeginReadTransaction(Pager *pPager){
if( rc!=SQLITE_OK || changed ){
pager_reset(pPager);
if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
);
pPager->journalMode = sqlite3WalJournalMode(pPager->pWal);
}
return rc;
@@ -3346,9 +3340,9 @@ static int pagerOpenWalIfPresent(Pager *pPager){
rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
}else{
testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
rc = sqlite3PagerOpenWal(pPager, 0);
rc = sqlite3PagerOpenWal(pPager, 0, 0);
}
}else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
}else if( pPager->journalMode>=PAGER_JOURNALMODE_WAL ){
pPager->journalMode = PAGER_JOURNALMODE_DELETE;
}
}
@@ -4852,6 +4846,7 @@ int sqlite3PagerOpen(
nPathname + 8 + 1 + /* Journal filename */
#ifndef SQLITE_OMIT_WAL
nPathname + 4 + 1 + /* WAL filename */
nPathname + 5 + 1 + /* Second WAL filename */
#endif
3 /* Terminator */
);
@@ -4904,6 +4899,8 @@ int sqlite3PagerOpen(
sqlite3FileSuffix3(zFilename, pPager->zWal);
pPtr = (u8*)(pPager->zWal + sqlite3Strlen30(pPager->zWal)+1);
#endif
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
memcpy(pPtr, "-wal2", 5); pPtr += 5 + 1;
}else{
pPager->zWal = 0;
}
@@ -5062,10 +5059,13 @@ act_like_temp_file:
*/
sqlite3_file *sqlite3_database_file_object(const char *zName){
Pager *pPager;
const char *p;
while( zName[-1]!=0 || zName[-2]!=0 || zName[-3]!=0 || zName[-4]!=0 ){
zName--;
}
pPager = *(Pager**)(zName - 4 - sizeof(Pager*));
p = zName - 4 - sizeof(Pager*);
assert( EIGHT_BYTE_ALIGNMENT(p) );
pPager = *(Pager**)p;
return pPager->fd;
}
@@ -7337,7 +7337,8 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
|| eMode==PAGER_JOURNALMODE_OFF /* 2 */
|| eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */
|| eMode==PAGER_JOURNALMODE_MEMORY /* 4 */
|| eMode==PAGER_JOURNALMODE_WAL /* 5 */ );
|| eMode==PAGER_JOURNALMODE_WAL /* 5 */
|| eMode==PAGER_JOURNALMODE_WAL2 /* 6 */ );
/* This routine is only called from the OP_JournalMode opcode, and
** the logic there will never allow a temporary file to be changed
@@ -7371,9 +7372,12 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 );
assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
assert( (PAGER_JOURNALMODE_WAL2 & 5)==4 );
assert( isOpen(pPager->fd) || pPager->exclusiveMode );
if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0
&& eMode!=PAGER_JOURNALMODE_WAL2 /* TODO: fix this if possible */
){
/* In this case we would like to delete the journal file. If it is
** not possible, then that is not a problem. Deleting the journal file
** here is an optimization only.
@@ -7548,7 +7552,7 @@ static int pagerExclusiveLock(Pager *pPager){
** lock on the database file and use heap-memory to store the wal-index
** in. Otherwise, use the normal shared-memory.
*/
static int pagerOpenWal(Pager *pPager){
static int pagerOpenWal(Pager *pPager, int bWal2){
int rc = SQLITE_OK;
assert( pPager->pWal==0 && pPager->tempFile==0 );
@@ -7569,7 +7573,7 @@ static int pagerOpenWal(Pager *pPager){
if( rc==SQLITE_OK ){
rc = sqlite3WalOpen(pPager->pVfs,
pPager->fd, pPager->zWal, pPager->exclusiveMode,
pPager->journalSizeLimit, &pPager->pWal
pPager->journalSizeLimit, bWal2, &pPager->pWal
);
}
pagerFixMaplimit(pPager);
@@ -7595,6 +7599,7 @@ static int pagerOpenWal(Pager *pPager){
*/
int sqlite3PagerOpenWal(
Pager *pPager, /* Pager object */
int bWal2, /* Open in wal2 mode if not already open */
int *pbOpen /* OUT: Set to true if call is a no-op */
){
int rc = SQLITE_OK; /* Return code */
@@ -7611,9 +7616,9 @@ int sqlite3PagerOpenWal(
/* Close any rollback journal previously open */
sqlite3OsClose(pPager->jfd);
rc = pagerOpenWal(pPager);
rc = pagerOpenWal(pPager, bWal2);
if( rc==SQLITE_OK ){
pPager->journalMode = PAGER_JOURNALMODE_WAL;
pPager->journalMode = bWal2?PAGER_JOURNALMODE_WAL2:PAGER_JOURNALMODE_WAL;
pPager->eState = PAGER_OPEN;
}
}else{
@@ -7635,7 +7640,9 @@ int sqlite3PagerOpenWal(
int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
int rc = SQLITE_OK;
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
);
/* If the log file is not already open, but does exist in the file-system,
** it may need to be checkpointed before the connection can switch to
@@ -7650,7 +7657,7 @@ int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
);
}
if( rc==SQLITE_OK && logexists ){
rc = pagerOpenWal(pPager);
rc = pagerOpenWal(pPager, 0);
}
}
+18 -1
View File
@@ -82,6 +82,23 @@ typedef struct PgHdr DbPage;
#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */
#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */
#define PAGER_JOURNALMODE_WAL2 6 /* Use write-ahead logging mode 2 */
#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL || (x)==PAGER_JOURNALMODE_WAL2)
/*
** The argument to this macro is a file descriptor (type sqlite3_file*).
** Return 0 if it is not open, or non-zero (but not 1) if it is.
**
** This is so that expressions can be written as:
**
** if( isOpen(pPager->jfd) ){ ...
**
** instead of
**
** if( pPager->jfd->pMethods ){ ...
*/
#define isOpen(pFd) ((pFd)->pMethods!=0)
/*
** Flags that make up the mask passed to sqlite3PagerGet().
@@ -175,7 +192,7 @@ int sqlite3PagerSharedLock(Pager *pPager);
int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
int sqlite3PagerWalSupported(Pager *pPager);
int sqlite3PagerWalCallback(Pager *pPager);
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
int sqlite3PagerOpenWal(Pager *pPager, int, int *pisOpen);
int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
# ifdef SQLITE_ENABLE_SNAPSHOT
int sqlite3PagerSnapshotGet(Pager*, sqlite3_snapshot **ppSnapshot);
+2 -1
View File
@@ -262,7 +262,7 @@ const char *sqlite3JournalModename(int eMode){
static char * const azModeName[] = {
"delete", "persist", "off", "truncate", "memory"
#ifndef SQLITE_OMIT_WAL
, "wal"
, "wal", "wal2"
#endif
};
assert( PAGER_JOURNALMODE_DELETE==0 );
@@ -271,6 +271,7 @@ const char *sqlite3JournalModename(int eMode){
assert( PAGER_JOURNALMODE_TRUNCATE==3 );
assert( PAGER_JOURNALMODE_MEMORY==4 );
assert( PAGER_JOURNALMODE_WAL==5 );
assert( PAGER_JOURNALMODE_WAL2==6 );
assert( eMode>=0 && eMode<=ArraySize(azModeName) );
if( eMode==ArraySize(azModeName) ) return 0;
+7 -6
View File
@@ -2319,7 +2319,8 @@ void sqlite3SubqueryColumnTypes(
NameContext sNC;
assert( pSelect!=0 );
assert( (pSelect->selFlags & SF_Resolved)!=0 );
testcase( (pSelect->selFlags & SF_Resolved)==0 );
assert( (pSelect->selFlags & SF_Resolved)!=0 || IN_RENAME_OBJECT );
assert( pTab->nCol==pSelect->pEList->nExpr || pParse->nErr>0 );
assert( aff==SQLITE_AFF_NONE || aff==SQLITE_AFF_BLOB );
if( db->mallocFailed || IN_RENAME_OBJECT ) return;
@@ -6372,10 +6373,11 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
SrcList *pTabList;
SrcItem *pFrom;
assert( p->selFlags & SF_Resolved );
if( p->selFlags & SF_HasTypeInfo ) return;
p->selFlags |= SF_HasTypeInfo;
pParse = pWalker->pParse;
testcase( (p->selFlags & SF_Resolved)==0 );
assert( (p->selFlags & SF_Resolved) || IN_RENAME_OBJECT );
pTabList = p->pSrc;
for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
Table *pTab = pFrom->pTab;
@@ -7397,6 +7399,7 @@ int sqlite3Select(
TREETRACE(0x1000,pParse,p,
("LEFT-JOIN simplifies to JOIN on term %d\n",i));
pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER);
unsetJoinExpr(p->pWhere, pItem->iCursor, 0);
}
}
if( pItem->fg.jointype & JT_LTORJ ){
@@ -7411,17 +7414,15 @@ int sqlite3Select(
TREETRACE(0x1000,pParse,p,
("RIGHT-JOIN simplifies to JOIN on term %d\n",j));
pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER);
unsetJoinExpr(p->pWhere, pI2->iCursor, 1);
}
}
}
for(j=pTabList->nSrc-1; j>=i; j--){
for(j=pTabList->nSrc-1; j>=0; j--){
pTabList->a[j].fg.jointype &= ~JT_LTORJ;
if( pTabList->a[j].fg.jointype & JT_RIGHT ) break;
}
}
assert( pItem->iCursor>=0 );
unsetJoinExpr(p->pWhere, pItem->iCursor,
pTabList->a[0].fg.jointype & JT_LTORJ);
}
/* No further action if this term of the FROM clause is not a subquery */
+897 -1172
View File
File diff suppressed because it is too large Load Diff
+52 -9
View File
@@ -5573,13 +5573,27 @@ int sqlite3_create_window_function(
** </dd>
**
** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
** Specifying this flag makes no difference for scalar or aggregate user
** functions. However, if it is not specified for a user-defined window
** function, then any sub-types belonging to arguments passed to the window
** function may be discarded before the window function is called (i.e.
** sqlite3_value_subtype() will always return 0).
** This flag instructs SQLite to omit some corner-case optimizations that
** might disrupt the operation of the [sqlite3_value_subtype()] function,
** causing it to return zero rather than the correct subtype().
** SQL functions that invokes [sqlite3_value_subtype()] should have this
** property. If the SQLITE_SUBTYPE property is omitted, then the return
** value from [sqlite3_value_subtype()] might sometimes be zero even though
** a non-zero subtype was specified by the function argument expression.
**
** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
** result.
** Every function that invokes [sqlite3_result_subtype()] should have this
** property. If it does not, then the call to [sqlite3_result_subtype()]
** might become a no-op if the function is used as term in an
** [expression index]. On the other hand, SQL functions that never invoke
** [sqlite3_result_subtype()] should avoid setting this property, as the
** purpose of this property is to disable certain optimizations that are
** incompatible with subtypes.
** </dd>
** </dl>
*/
@@ -5587,6 +5601,7 @@ int sqlite3_create_window_function(
#define SQLITE_DIRECTONLY 0x000080000
#define SQLITE_SUBTYPE 0x000100000
#define SQLITE_INNOCUOUS 0x000200000
#define SQLITE_RESULT_SUBTYPE 0x001000000
/*
** CAPI3REF: Deprecated Functions
@@ -5783,6 +5798,12 @@ int sqlite3_value_encoding(sqlite3_value*);
** information can be used to pass a limited amount of context from
** one SQL function to another. Use the [sqlite3_result_subtype()]
** routine to set the subtype for the return value of an SQL function.
**
** Every [application-defined SQL function] that invoke this interface
** should include the [SQLITE_SUBTYPE] property in the text
** encoding argument when the function is [sqlite3_create_function|registered].
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
** might return zero instead of the upstream subtype in some corner cases.
*/
unsigned int sqlite3_value_subtype(sqlite3_value*);
@@ -5913,14 +5934,22 @@ sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
** parameter)^, or
** <li> ^(during the original sqlite3_set_auxdata() call when a memory
** allocation error occurs.)^ </ul>
** allocation error occurs.)^
** <li> ^(during the original sqlite3_set_auxdata() call if the function
** is evaluated during query planning instead of during query execution,
** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
**
** Note the last bullet in particular. The destructor X in
** Note the last two bullets in particular. The destructor X in
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
** should be called near the end of the function implementation and the
** function implementation should not make any use of P after
** sqlite3_set_auxdata() has been called.
** sqlite3_set_auxdata() has been called. Furthermore, a call to
** sqlite3_get_auxdata() that occurs immediately after a corresponding call
** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
** condition occurred during the sqlite3_set_auxdata() call or if the
** function is being evaluated during query planning rather than during
** query execution.
**
** ^(In practice, auxiliary data is preserved between function calls for
** function parameters that are compile-time constants, including literal
@@ -6194,6 +6223,20 @@ int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
** higher order bits are discarded.
** The number of subtype bytes preserved by SQLite might increase
** in future releases of SQLite.
**
** Every [application-defined SQL function] that invokes this interface
** should include the [SQLITE_RESULT_SUBTYPE] property in its
** text encoding argument when the SQL function is
** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
** property is omitted from the function that invokes sqlite3_result_subtype(),
** then in some cases the sqlite3_result_subtype() might fail to set
** the result subtype.
**
** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
** SQL function that invokes the sqlite3_result_subtype() interface
** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
** by default.
*/
void sqlite3_result_subtype(sqlite3_context*,unsigned int);
+7 -5
View File
@@ -2014,14 +2014,15 @@ struct FuncDestructor {
#define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
** single query - might change over time */
#define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
/* 0x8000 -- available for reuse */
#define SQLITE_FUNC_RUNONLY 0x8000 /* Cannot be used by valueFromFunction */
#define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
#define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
#define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
/* SQLITE_SUBTYPE 0x00100000 // Consumer of subtypes */
#define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
#define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */
#define SQLITE_FUNC_BUILTIN 0x00800000 /* This is a built-in function */
/* SQLITE_RESULT_SUBTYPE 0x01000000 // Generator of subtypes */
#define SQLITE_FUNC_ANYORDER 0x08000000 /* count/min/max aggregate */
/* Identifier numbers for each in-line function */
@@ -2113,9 +2114,10 @@ struct FuncDestructor {
#define MFUNCTION(zName, nArg, xPtr, xFunc) \
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
#define JFUNCTION(zName, nArg, iArg, xFunc) \
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|\
SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
#define JFUNCTION(zName, nArg, bUseCache, bWS, bRS, iArg, xFunc) \
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_FUNC_CONSTANT|\
SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|\
((bRS)*SQLITE_SUBTYPE)|((bWS)*SQLITE_RESULT_SUBTYPE), \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_FUNC_BUILTIN|\
+17 -5
View File
@@ -190,7 +190,7 @@ static int SQLITE_TCLAPI hexio_write(
}
/*
** USAGE: hexio_get_int HEXDATA
** USAGE: hexio_get_int [-littleendian] HEXDATA
**
** Interpret the HEXDATA argument as a big-endian integer. Return
** the value of that integer. HEXDATA can contain between 2 and 8
@@ -207,12 +207,20 @@ static int SQLITE_TCLAPI hexio_get_int(
const unsigned char *zIn;
unsigned char *aOut;
unsigned char aNum[4];
int bLittle = 0;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "HEXDATA");
if( objc==3 ){
int n;
char *z = Tcl_GetStringFromObj(objv[1], &n);
if( n>=2 && n<=13 && memcmp(z, "-littleendian", n)==0 ){
bLittle = 1;
}
}
if( (objc-bLittle)!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "[-littleendian] HEXDATA");
return TCL_ERROR;
}
zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &nIn);
zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1+bLittle], &nIn);
aOut = sqlite3_malloc( 1 + nIn/2 );
if( aOut==0 ){
return TCL_ERROR;
@@ -225,7 +233,11 @@ static int SQLITE_TCLAPI hexio_get_int(
memcpy(&aNum[4-nOut], aOut, nOut);
}
sqlite3_free(aOut);
val = (aNum[0]<<24) | (aNum[1]<<16) | (aNum[2]<<8) | aNum[3];
if( bLittle ){
val = (aNum[3]<<24) | (aNum[2]<<16) | (aNum[1]<<8) | aNum[0];
}else{
val = (aNum[0]<<24) | (aNum[1]<<16) | (aNum[2]<<8) | aNum[3];
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(val));
return TCL_OK;
}
+3
View File
@@ -98,6 +98,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
extern int Fts5tcl_Init(Tcl_Interp *);
extern int SqliteRbu_Init(Tcl_Interp*);
extern int Sqlitetesttcl_Init(Tcl_Interp*);
extern int Bgckpt_Init(Tcl_Interp*);
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
extern int Sqlitetestfts3_Init(Tcl_Interp *interp);
#endif
@@ -167,6 +168,8 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
Fts5tcl_Init(interp);
SqliteRbu_Init(interp);
Sqlitetesttcl_Init(interp);
Bgckpt_Init(interp);
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
Sqlitetestfts3_Init(interp);
+41 -27
View File
@@ -132,11 +132,12 @@ int sqlite3_found_count = 0;
** sqlite3CantopenError(lineno)
*/
static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){
static int n = 0;
static u64 n = 0;
(void)pc;
(void)pOp;
(void)v;
n++;
if( n==LARGEST_UINT64 ) abort(); /* So that n is used, preventing a warning */
}
#endif
@@ -7840,6 +7841,7 @@ case OP_JournalMode: { /* out2 */
|| eNew==PAGER_JOURNALMODE_OFF
|| eNew==PAGER_JOURNALMODE_MEMORY
|| eNew==PAGER_JOURNALMODE_WAL
|| eNew==PAGER_JOURNALMODE_WAL2
|| eNew==PAGER_JOURNALMODE_QUERY
);
assert( pOp->p1>=0 && pOp->p1<db->nDb );
@@ -7858,16 +7860,25 @@ case OP_JournalMode: { /* out2 */
/* Do not allow a transition to journal_mode=WAL for a database
** in temporary storage or if the VFS does not support shared memory
*/
if( eNew==PAGER_JOURNALMODE_WAL
if( isWalMode(eNew)
&& (sqlite3Strlen30(zFilename)==0 /* Temp file */
|| !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */
){
eNew = eOld;
}
if( (eNew!=eOld)
&& (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
){
if( eNew!=eOld && (isWalMode(eNew) || isWalMode(eOld)) ){
/* Prevent changing directly to wal2 from wal mode. And vice versa. */
if( isWalMode(eNew) && isWalMode(eOld) ){
rc = SQLITE_ERROR;
sqlite3VdbeError(p, "cannot change from %s to %s mode",
sqlite3JournalModename(eOld), sqlite3JournalModename(eNew)
);
goto abort_due_to_error;
}
/* Prevent switching into or out of wal/wal2 mode mid-transaction */
if( !db->autoCommit || db->nVdbeRead>1 ){
rc = SQLITE_ERROR;
sqlite3VdbeError(p,
@@ -7875,31 +7886,34 @@ case OP_JournalMode: { /* out2 */
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
);
goto abort_due_to_error;
}else{
if( eOld==PAGER_JOURNALMODE_WAL ){
/* If leaving WAL mode, close the log file. If successful, the call
** to PagerCloseWal() checkpoints and deletes the write-ahead-log
** file. An EXCLUSIVE lock may still be held on the database file
** after a successful return.
*/
rc = sqlite3PagerCloseWal(pPager, db);
if( rc==SQLITE_OK ){
sqlite3PagerSetJournalMode(pPager, eNew);
}
}else if( eOld==PAGER_JOURNALMODE_MEMORY ){
/* Cannot transition directly from MEMORY to WAL. Use mode OFF
** as an intermediate */
sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
}
}
/* Open a transaction on the database file. Regardless of the journal
** mode, this transaction always uses a rollback journal.
if( isWalMode(eOld) ){
/* If leaving WAL mode, close the log file. If successful, the call
** to PagerCloseWal() checkpoints and deletes the write-ahead-log
** file. An EXCLUSIVE lock may still be held on the database file
** after a successful return.
*/
assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
rc = sqlite3PagerCloseWal(pPager, db);
if( rc==SQLITE_OK ){
rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
sqlite3PagerSetJournalMode(pPager, eNew);
}
}else if( eOld==PAGER_JOURNALMODE_MEMORY ){
/* Cannot transition directly from MEMORY to WAL. Use mode OFF
** as an intermediate */
sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
}
/* Open a transaction on the database file. Regardless of the journal
** mode, this transaction always uses a rollback journal.
*/
assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
if( rc==SQLITE_OK ){
/* 1==rollback, 2==wal, 3==wal2 */
rc = sqlite3BtreeSetVersion(pBt,
1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
);
}
}
#endif /* ifndef SQLITE_OMIT_WAL */
@@ -8183,7 +8197,7 @@ case OP_VCheck: { /* out2 */
pTab = pOp->p4.pTab;
assert( pTab!=0 );
assert( IsVirtual(pTab) );
assert( pTab->u.vtab.p!=0 );
if( pTab->u.vtab.p==0 ) break;
pVtab = pTab->u.vtab.p->pVtab;
assert( pVtab!=0 );
pModule = pVtab->pModule;
+12
View File
@@ -531,6 +531,18 @@ void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
#ifdef SQLITE_ENABLE_API_ARMOR
if( pCtx==0 ) return;
#endif
#if defined(SQLITE_STRICT_SUBTYPE) && SQLITE_STRICT_SUBTYPE+0!=0
if( pCtx->pFunc!=0
&& (pCtx->pFunc->funcFlags & SQLITE_RESULT_SUBTYPE)==0
){
char zErr[200];
sqlite3_snprintf(sizeof(zErr), zErr,
"misuse of sqlite3_result_subtype() by %s()",
pCtx->pFunc->zName);
sqlite3_result_error(pCtx, zErr, -1);
return;
}
#endif /* SQLITE_STRICT_SUBTYPE */
pOut = pCtx->pOut;
assert( sqlite3_mutex_held(pOut->db->mutex) );
pOut->eSubtype = eSubtype & 0xff;
+4 -2
View File
@@ -211,10 +211,11 @@ static int growOpArray(Vdbe *v, int nOp){
** sqlite3CantopenError(lineno)
*/
static void test_addop_breakpoint(int pc, Op *pOp){
static int n = 0;
static u64 n = 0;
(void)pc;
(void)pOp;
n++;
if( n==LARGEST_UINT64 ) abort(); /* so that n is used, preventing a warning */
}
#endif
@@ -2916,7 +2917,8 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
/* OFF */ 0,
/* TRUNCATE */ 1,
/* MEMORY */ 0,
/* WAL */ 0
/* WAL */ 0,
/* WAL2 */ 0
};
Pager *pPager; /* Pager associated with pBt */
needXcommit = 1;
+1 -1
View File
@@ -1515,7 +1515,7 @@ static int valueFromFunction(
#endif
assert( pFunc );
if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
|| (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
|| (pFunc->funcFlags & (SQLITE_FUNC_NEEDCOLL|SQLITE_FUNC_RUNONLY))!=0
){
return SQLITE_OK;
}
+1451 -575
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -26,7 +26,7 @@
#define CKPT_SYNC_FLAGS(X) (((X)>>2)&0x03)
#ifdef SQLITE_OMIT_WAL
# define sqlite3WalOpen(x,y,z) 0
# define sqlite3WalOpen(w,x,y,z) 0
# define sqlite3WalLimit(x,y)
# define sqlite3WalClose(v,w,x,y,z) 0
# define sqlite3WalBeginReadTransaction(y,z) 0
@@ -45,6 +45,7 @@
# define sqlite3WalFramesize(z) 0
# define sqlite3WalFindFrame(x,y,z) 0
# define sqlite3WalFile(x) 0
# define sqlite3WalJournalMode(x) 0
# undef SQLITE_USE_SEH
#else
@@ -56,7 +57,7 @@
typedef struct Wal Wal;
/* Open and close a connection to a write-ahead log. */
int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**);
int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *,int,i64,int,Wal**);
int sqlite3WalClose(Wal *pWal, sqlite3*, int sync_flags, int, u8 *);
/* Set the limiting size of a WAL file. */
@@ -147,6 +148,9 @@ int sqlite3WalFramesize(Wal *pWal);
/* Return the sqlite3_file object for the WAL file */
sqlite3_file *sqlite3WalFile(Wal *pWal);
/* Return the journal mode (WAL or WAL2) used by this Wal object. */
int sqlite3WalJournalMode(Wal *pWal);
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
int sqlite3WalWriteLock(Wal *pWal, int bLock);
void sqlite3WalDb(Wal *pWal, sqlite3 *db);
+14
View File
@@ -5810,6 +5810,20 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
continue;
}
if( sqlite3ExprIsConstant(pExpr) ) continue;
if( pExpr->op==TK_FUNCTION ){
/* Functions that might set a subtype should not be replaced by the
** value taken from an expression index since the index omits the
** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */
int n;
FuncDef *pDef;
sqlite3 *db = pParse->db;
assert( ExprUseXList(pExpr) );
n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
continue;
}
}
p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr));
if( p==0 ) break;
p->pIENext = pParse->pIdxEpr;
+1 -1
View File
@@ -1038,7 +1038,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
assert( ExprUseXList(pWin->pOwner) );
assert( pWin->pWFunc!=0 );
pArgs = pWin->pOwner->x.pList;
if( pWin->pWFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
if( pWin->pWFunc->funcFlags & SQLITE_SUBTYPE ){
selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
pWin->bExprArgs = 1;
+29
View File
@@ -954,4 +954,33 @@ do_catchsql_test alter-20.3 {
INSERT INTO t1(a) VALUES(45);
} {1 {cannot store BLOB value in TEXT column t1.b}}
# 2023-11-17 dbsqlfuzz e0900262dadd5c78c2226ad6a435c7f0255be2cd
# Assertion fault associated with ALTER TABLE and an
# aggregate ORDER BY within an unknown aggregate function.
#
reset_db
do_execsql_test alter-21.1 {
CREATE TABLE t1(a,b,c,d);
CREATE TABLE t2(a,b,c,d,x);
CREATE TRIGGER r1 AFTER INSERT ON t2 BEGIN
SELECT unknown_function(a ORDER BY (SELECT group_concat(DISTINCT a ORDER BY a) FROM t1)) FROM t1;
END;
ALTER TABLE t2 RENAME TO e;
} {}
do_execsql_test alter-21.2 {
SELECT name, type FROM sqlite_schema ORDER BY name;
} {e table r1 trigger t1 table}
do_execsql_test alter-21.3 {
DROP TRIGGER r1;
CREATE TRIGGER r2 AFTER INSERT ON e BEGIN
SELECT unknown_function(a ORDER BY (SELECT group_concat(a ORDER BY a) FROM (SELECT b FROM t1))) FROM t1;
END;
ALTER TABLE e RENAME TO t99;
}
do_execsql_test alter-21.4 {
SELECT name, type FROM sqlite_schema ORDER BY name;
} {r2 trigger t1 table t99 table}
finish_test
+1 -1
View File
@@ -47,7 +47,7 @@ db close
forcecopy test.db test.db-template
set unreadable_version 02
ifcapable wal { set unreadable_version 03 }
ifcapable wal { set unreadable_version 04 }
do_test corruptA-2.1 {
forcecopy test.db-template test.db
hexio_write test.db 19 $unreadable_version ;# the read format number
+14
View File
@@ -616,4 +616,18 @@ do_execsql_test indexexpr1-2200 {
) v ON v.type = 0 AND v.tag = u.tag;
} {7 100 8 101}
# 2023-11-08 Forum post https://sqlite.org/forum/forumpost/68d284c86b082c3e
#
# Functions that return subtypes and that are indexed cannot be used to
# cover function calls from the main table, since the indexed value does
# not know the subtype.
#
reset_db
do_execsql_test indexexpr1-2300 {
CREATE TABLE t1(x INT, y TEXT);
INSERT INTO t1(x,y) VALUES(1,'{b:5}');
CREATE INDEX t1j ON t1(json(y));
SELECT json_insert('{}', '$.a', json(y)) FROM t1;
} {{{"a":{"b":5}}}}
finish_test
+58
View File
@@ -250,5 +250,63 @@ do_catchsql_test 9.11 {
SELECT oid FROM wo2 JOIN (wo3 JOIN x3)
} {0 99}
reset_db
do_execsql_test 10.0 {
CREATE TABLE rt0 (c0 INTEGER, c1 INTEGER, c2 INTEGER, c3 INTEGER, c4 INTEGER);
CREATE TABLE rt3 (c3 INTEGER);
INSERT INTO rt0(c3, c1) VALUES (x'', '1');
INSERT INTO rt0(c3, c1) VALUES ('-1', -1e500);
INSERT INTO rt0(c3, c1) VALUES (1, x'');
CREATE VIEW v6(c0, c1, c2) AS SELECT 0, 0, 0;
}
do_execsql_test 10.1 {
SELECT COUNT(*) FROM rt0 LEFT JOIN rt3 JOIN v6 ON ((CASE v6.c0 WHEN rt0.c4 THEN rt3.c3 END) NOT BETWEEN (rt0.c4) AND (NULL)) WHERE (rt0.c1); -- 2
} {0}
do_execsql_test 10.2 {
SELECT COUNT(*) FROM rt0 LEFT JOIN rt3 RIGHT OUTER JOIN v6 ON ((CASE v6.c0 WHEN rt0.c4 THEN rt3.c3 END) NOT BETWEEN (rt0.c4) AND (NULL)) WHERE (rt0.c1); -- 2
} {0}
#-------------------------------------------------------------------------
do_execsql_test 11.1 {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
CREATE TABLE t3(e, f);
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t2 VALUES(2, 2);
INSERT INTO t3 VALUES(3, 3);
}
do_execsql_test 11.2 {
SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10)
} {{} {} {} {} 3 3}
do_execsql_test 11.3 {
SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10) WHERE t1.a=1
} {}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 12.1 {
CREATE TABLE t1(a1 INT, b1 TEXT);
INSERT INTO t1 VALUES(88,'');
CREATE TABLE t2(c2 INT, d2 TEXT);
INSERT INTO t2 VALUES(88,'');
CREATE TABLE t3(e3 TEXT PRIMARY KEY);
INSERT INTO t3 VALUES('');
}
do_execsql_test 12.2 {
SELECT * FROM t1 LEFT JOIN t2 ON true RIGHT JOIN t3 ON d2=e3 WHERE c2 BETWEEN NULL AND a1;
}
do_execsql_test 12.3 {
SELECT * FROM t1 LEFT JOIN t2 ON true RIGHT JOIN t3 ON d2=e3 WHERE c2 BETWEEN NULL AND a1;
}
finish_test
+5
View File
@@ -300,5 +300,10 @@ do_execsql_test 12.4 {
|| ' "xyz"}')->>'a';
} xyz
# 2023-11-08 forum/forumpost/ddcad3e884
#
do_execsql_test 13.1 {
SELECT json('{x:''a "b" c''}');
} {{{"x":"a \"b\" c"}}}
finish_test
+29 -9
View File
@@ -464,18 +464,21 @@ lappend ::testsuitelist xxx
test_suite "coverage-wal" -description {
Coverage tests for file wal.c.
} -files {
wal.test wal2.test wal3.test wal4.test wal5.test
wal2big.test wal2recover.test wal2rewrite.test
wal2simple.test wal2snapshot.test wal2.test
wal3.test wal4.test wal5.test
wal64k.test wal6.test wal7.test wal8.test wal9.test
walbak.test walbig.test walblock.test walcksum.test walcrash2.test
walcrash3.test walcrash4.test walcrash.test walfault.test walhook.test
walmode.test walnoshm.test waloverwrite.test walpersist.test
walprotocol2.test walprotocol.test walro2.test walrofault.test
walro.test walshared.test walslow.test walvfs.test
walfault2.test
nockpt.test
walbak.test walbig.test walblock.test walcksum.test
walfault.test walhook.test walmode.test walnoshm.test
waloverwrite.test walpersist.test walprotocol2.test
walprotocol.test walro2.test walrofault.test walro.test
walshared.test walslow.test wal.test
wal2savepoint.test wal2lock.test wal2recover2.test
walvfs.test walfault2.test nockpt.test
snapshot2.test snapshot3.test snapshot4.test
snapshot_fault.test snapshot.test snapshot_up.test
walcrash2.test walcrash3.test walcrash4.test walcrash.test
wal2fault.test
}
test_suite "coverage-pager" -description {
@@ -1033,6 +1036,23 @@ test_suite "wal" -description {
fts3c.test fts3d.test fts3e.test fts3query.test
}
test_suite "wal2" -description {
Run tests with journal_mode=WAL2
} -initialize {
set ::G(savepoint6_iterations) 100
} -shutdown {
unset -nocomplain ::G(savepoint6_iterations)
} -files {
savepoint.test savepoint2.test savepoint6.test
trans.test avtrans.test
fts3aa.test fts3ab.test fts3ac.test fts3ad.test
fts3ae.test fts3af.test fts3ag.test fts3ah.test
fts3ai.test fts3aj.test fts3ak.test fts3al.test
fts3am.test fts3an.test fts3ao.test fts3b.test
fts3c.test fts3d.test fts3e.test fts3query.test
}
test_suite "rtree" -description {
All R-tree related tests. Provides coverage of source file rtree.c.
} -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
+3 -3
View File
@@ -41,7 +41,7 @@ do_test rdonly-1.1.1 {
sqlite3_db_readonly db main
} {0}
# Changes the write version from 1 to 3. Verify that the database
# Changes the write version from 1 to 4. Verify that the database
# can be read but not written.
#
do_test rdonly-1.2 {
@@ -49,7 +49,7 @@ do_test rdonly-1.2 {
hexio_get_int [hexio_read test.db 18 1]
} 1
do_test rdonly-1.3 {
hexio_write test.db 18 03
hexio_write test.db 18 04
sqlite3 db test.db
execsql {
SELECT * FROM t1;
@@ -83,7 +83,7 @@ do_test rdonly-1.5 {
# the database is read-only until after it is locked.
#
set ro_version 02
ifcapable wal { set ro_version 03 }
ifcapable wal { set ro_version 04 }
do_test rdonly-1.6 {
hexio_write test.db 18 $ro_version ; # write-version
hexio_write test.db 24 11223344 ; # change-counter
+3 -1
View File
@@ -30,6 +30,7 @@ do_test savepoint-1.1 {
RELEASE sp1;
}
} {}
wal_check_journal_mode savepoint-1.1
do_test savepoint-1.2 {
execsql {
SAVEPOINT sp1;
@@ -807,7 +808,8 @@ do_test savepoint-11.6 {
integrity_check savepoint-11.7
do_test savepoint-11.8 {
execsql { ROLLBACK }
execsql { PRAGMA wal_checkpoint }
db close
sqlite3 db test.db
file size test.db
} {8192}
+14 -3
View File
@@ -15,6 +15,10 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl
proc sql {zSql} {
if {0 && $::debug_op} {
puts stderr "$zSql ;"
flush stderr
}
uplevel db eval [list $zSql]
#puts stderr "$zSql ;"
}
@@ -67,11 +71,13 @@ proc x_to_y {x} {
# delete_rows XVALUES
#
proc savepoint {zName} {
if {$::debug_op} { puts stderr "savepoint $zName" ; flush stderr }
catch { sql "SAVEPOINT $zName" }
lappend ::lSavepoint [list $zName [array get ::aEntry]]
}
proc rollback {zName} {
if {$::debug_op} { puts stderr "rollback $zName" ; flush stderr }
catch { sql "ROLLBACK TO $zName" }
for {set i [expr {[llength $::lSavepoint]-1}]} {$i>=0} {incr i -1} {
set zSavepoint [lindex $::lSavepoint $i 0]
@@ -89,6 +95,7 @@ proc rollback {zName} {
}
proc release {zName} {
if {$::debug_op} { puts stderr "release $zName" ; flush stderr }
catch { sql "RELEASE $zName" }
for {set i [expr {[llength $::lSavepoint]-1}]} {$i>=0} {incr i -1} {
set zSavepoint [lindex $::lSavepoint $i 0]
@@ -104,6 +111,7 @@ proc release {zName} {
}
proc insert_rows {lX} {
if {$::debug_op} { puts stderr "insert_rows $lX" ; flush stderr }
foreach x $lX {
set y [x_to_y $x]
@@ -116,6 +124,7 @@ proc insert_rows {lX} {
}
proc delete_rows {lX} {
if {$::debug_op} { puts stderr "delete_rows $lX" ; flush stderr }
foreach x $lX {
# Update database [db]
sql "DELETE FROM t1 WHERE x = $x"
@@ -164,6 +173,11 @@ proc random_integers {nRes nRange} {
}
#-------------------------------------------------------------------------
set ::debug_op 0
proc debug_ops {} {
set ::debug_op 1
}
proc database_op {} {
set i [expr int(rand()*2)]
if {$i==0} {
@@ -185,9 +199,6 @@ proc savepoint_op {} {
set C [lindex $cmds [expr int(rand()*6)]]
set N [lindex $names [expr int(rand()*5)]]
#puts stderr " $C $N ; "
#flush stderr
$C $N
return ok
}
+10 -5
View File
@@ -496,11 +496,16 @@ do_test shell1-3.14.3 {
# .output FILENAME Send output to FILENAME
do_test shell1-3.15.1 {
catchcmd "test.db" ".output"
} {0 {}}
catchcmd "test.db" ".output
.print x"
} {0 x}
do_test shell1-3.15.2 {
catchcmd "test.db" ".output FOO"
} {0 {}}
catchcmd "test.db" ".output FOO
.print x
.output
SELECT readfile('FOO');"
} {0 {x
}}
do_test shell1-3.15.3 {
# too many arguments
catchcmd "test.db" ".output FOO BAD"
@@ -1067,7 +1072,7 @@ do_test shell1-5.0 {
#
set escapes [list \
\a \\a \b \\b \t \\t \n \\n \v \\v \f \\f \r \\r \
" " "\" \"" \" \\\" ' \"'\" \\ \\\\]
" " "\" \"" \" \\\" \\ \\\\]
} else {
#
# NOTE: On Unix, we need to escape most of the whitespace characters
+20 -4
View File
@@ -613,6 +613,7 @@ proc reset_db {} {
forcedelete test.db
forcedelete test.db-journal
forcedelete test.db-wal
forcedelete test.db-wal2
sqlite3 db ./test.db
set ::DB [sqlite3_connection_pointer db]
if {[info exists ::SETUP_SQL]} {
@@ -2317,17 +2318,32 @@ proc drop_all_indexes {{db db}} {
# Returns true if this test should be run in WAL mode. False otherwise.
#
proc wal_is_wal_mode {} {
expr {[permutation] eq "wal"}
if {[permutation] eq "wal"} { return 1 }
if {[permutation] eq "wal2"} { return 2 }
return 0
}
proc wal_set_journal_mode {{db db}} {
if { [wal_is_wal_mode] } {
$db eval "PRAGMA journal_mode = WAL"
switch -- [wal_is_wal_mode] {
0 {
}
1 {
$db eval "PRAGMA journal_mode = WAL"
}
2 {
$db eval "PRAGMA journal_mode = WAL2"
}
}
}
proc wal_check_journal_mode {testname {db db}} {
if { [wal_is_wal_mode] } {
$db eval { SELECT * FROM sqlite_master }
do_test $testname [list $db eval "PRAGMA main.journal_mode"] {wal}
set expected "wal"
if {[wal_is_wal_mode]==2} {
set expected "wal2"
}
do_test $testname [list $db eval "PRAGMA main.journal_mode"] $expected
}
}
+2 -2
View File
@@ -282,11 +282,11 @@ ifcapable wal {
INSERT INTO t2 VALUES('x', 'y');
}
lsort [array names ::T1]
} {test.db1 test.db1-journal test.db1-wal}
} {test.db1 test.db1-journal test.db1-wal test.db1-wal2}
do_test 5.1.2 {
lsort [array names ::T2]
} {test.db2 test.db2-journal test.db2-wal}
} {test.db2 test.db2-journal test.db2-wal test.db2-wal2}
db close
tvfs1 delete
+6 -6
View File
@@ -1175,7 +1175,7 @@ foreach {tn pgsz works} {
9 32768 1
10 65536 1
11 131072 0
11 1016 0
12 1016 0
} {
if {$::SQLITE_MAX_PAGE_SIZE < $pgsz} {
@@ -1185,14 +1185,14 @@ foreach {tn pgsz works} {
for {set pg 1} {$pg <= 3} {incr pg} {
forcecopy testX.db test.db
forcedelete test.db-wal
# Check that the database now exists and consists of three pages. And
# that there is no associated wal file.
#
do_test wal-18.2.$tn.$pg.1 { file exists test.db-wal } 0
do_test wal-18.2.$tn.$pg.2 { file exists test.db } 1
do_test wal-18.2.$tn.$pg.3 { file size test.db } [expr 1024*3]
do_test wal-18.2.$tn.$pg.4 {
# Create a wal file that contains a single frame (database page
@@ -1224,16 +1224,16 @@ foreach {tn pgsz works} {
puts -nonewline $fd $framehdr
puts -nonewline $fd $framebody
close $fd
file size test.db-wal
} [wal_file_size 1 $pgsz]
do_test wal-18.2.$tn.$pg.5 {
sqlite3 db test.db
set rc [catch { db one {PRAGMA integrity_check} } msg]
expr { $rc!=0 || $msg!="ok" }
} $works
db close
}
}
+73
View File
@@ -0,0 +1,73 @@
# 2017 September 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.
#
#***********************************************************************
# TESTRUNNER: slow
#
# This file implements regression tests for SQLite library. The
# focus of this file is testing the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2big
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
CREATE INDEX t1a ON t1(a);
CREATE INDEX t1b ON t1(b);
CREATE INDEX t1c ON t1(c);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 10000000;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
} {wal2 10000000}
do_execsql_test 1.1 {
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
}
do_test 1.2 {
list [expr [file size test.db-wal]>10000000] \
[expr [file size test.db-wal2]>10000000]
} {1 1}
do_test 1.3 {
sqlite3 db2 test.db
execsql {
SELECT count(*) FROM t1;
PRAGMA integrity_check;
} db2
} {400000 ok}
do_test 1.4 {
db2 close
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcecopy test.db-wal2 test.db2-wal2
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
PRAGMA integrity_check;
}
} {400000 ok}
finish_test
+52
View File
@@ -0,0 +1,52 @@
# 2010 May 03
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
source $testdir/lock_common.tcl
ifcapable !wal {finish_test ; return }
set testprefix wal2fault
do_execsql_test 1.0 {
CREATE TABLE t1(x,y);
PRAGMA journal_mode = wal2;
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
} {wal2}
do_test 1.1 {
expr [file size test.db-wal]>10000
} {1}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore_and_reopen
execsql {
PRAGMA journal_size_limit = 10000;
SELECT count(*) FROM sqlite_master;
}
} -body {
execsql {
INSERT INTO t1 VALUES(1, 2);
}
} -test {
faultsim_test_result {0 {}}
}
finish_test
+106
View File
@@ -0,0 +1,106 @@
# 2018 December 15
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2lock
ifcapable !wal {finish_test ; return }
db close
testvfs tvfs
sqlite3 db test.db -vfs tvfs
do_execsql_test 1.0 {
PRAGMA journal_mode = wal2;
CREATE TABLE y1(y, yy);
CREATE INDEX y1y ON y1(y);
CREATE INDEX y1yy ON y1(yy);
INSERT INTO y1 VALUES(1, 2), (3, 4), (5, 6);
} {wal2}
tvfs script vfs_callback
tvfs filter xShmLock
set ::lock [list]
proc vfs_callback {func file name lock} {
lappend ::lock $lock
return SQLITE_OK
}
do_execsql_test 1.1.1 {
SELECT * FROM y1
} {1 2 3 4 5 6}
do_test 1.1.2 {
set ::lock
} {{4 1 lock shared} {4 1 unlock shared}}
set ::bFirst 1
proc vfs_callback {func file name lock} {
if {$::bFirst} {
set ::bFirst 0
return SQLITE_BUSY
}
return SQLITE_OK
}
do_execsql_test 1.2 {
SELECT * FROM y1
} {1 2 3 4 5 6}
set ::bFirst 1
proc vfs_callback {func file name lock} {
if {$::bFirst} {
set ::bFirst 0
return SQLITE_IOERR
}
return SQLITE_OK
}
do_catchsql_test 1.3 {
SELECT * FROM y1
} {1 {disk I/O error}}
puts "# Warning: This next test case causes SQLite to call xSleep(1) 100 times."
puts "# Normally this equates to a delay of roughly 10 seconds, but if SQLite"
puts "# is built on unix without HAVE_USLEEP defined, it may be much longer."
proc vfs_callback {func file name lock} { return SQLITE_BUSY }
do_catchsql_test 1.4 {
SELECT * FROM y1
} {1 {locking protocol}}
proc vfs_callback {func file name lock} { return SQLITE_OK }
sqlite3 db2 test.db -vfs tvfs
set ::bFirst 1
proc vfs_callback {func file name lock} {
if {$::bFirst} {
set ::bFirst 0
db2 eval { INSERT INTO y1 VALUES(7, 8) }
}
}
do_execsql_test 1.5.1 {
SELECT * FROM y1
} {1 2 3 4 5 6 7 8}
do_execsql_test 1.5.2 {
SELECT * FROM y1
} {1 2 3 4 5 6 7 8}
db close
db2 close
tvfs delete
finish_test
+81
View File
@@ -0,0 +1,81 @@
# 2017 September 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2openclose
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
PRAGMA journal_mode = wal2;
PRAGMA wal_autocheckpoint = 0;
PRAGMA journal_size_limit = 75000;
} {wal2 0 75000}
do_test 1.1 {
for {set ii 1} {$ii <= 200} {incr ii} {
execsql {
INSERT INTO t1 VALUES($ii, $ii, $ii);
}
}
expr ([file size test.db-wal2] - 75000) > 30000
} {1}
do_test 1.2 {
db close
list [file exists test.db-wal] [file exists test.db-wal2]
} {0 0}
sqlite3 db test.db
do_execsql_test 1.3 {
SELECT sum(c) FROM t1
} {20100}
db close
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a, b, c);
PRAGMA journal_mode = wal2;
INSERT INTO t1 VALUES(1, 2, 3);
} {wal2}
db_save_and_close
db_restore_and_reopen
do_execsql_test 2.1 {
SELECT * FROM t1;
} {1 2 3}
do_test 2.2 {
sqlite3 db2 test.db
db2 eval {INSERT INTO t1 VALUES(4, 5, 6)}
db2 close
} {}
breakpoint
db close
sqlite3 db test.db
do_execsql_test 2.2 {
SELECT * FROM t1;
} {1 2 3 4 5 6}
finish_test
+272
View File
@@ -0,0 +1,272 @@
# 2018 December 13
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2recover
ifcapable !wal {finish_test ; return }
proc db_copy {from to} {
forcecopy $from $to
forcecopy ${from}-wal ${to}-wal
forcecopy ${from}-wal2 ${to}-wal2
}
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
CREATE INDEX t1a ON t1(a);
CREATE INDEX t1b ON t1(b);
CREATE INDEX t1c ON t1(c);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 15000;
PRAGMA wal_autocheckpoint = 0;
} {wal2 15000 0}
do_test 1.1 {
for {set i 1} {$i <= 1000} {incr i} {
execsql { INSERT INTO t1 VALUES(random(), random(), random()) }
db_copy test.db test.db2
sqlite3 db2 test.db
set res [execsql {
SELECT count(*) FROM t1;
PRAGMA integrity_check;
} db2]
db2 close
if {$res != [list $i ok]} {
error "failure on iteration $i"
}
}
set {} {}
} {}
#--------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(x UNIQUE);
CREATE TABLE t2(x UNIQUE);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 10000;
PRAGMA wal_autocheckpoint = 0;
BEGIN;
INSERT INTO t1 VALUES(randomblob(4000));
INSERT INTO t1 VALUES(randomblob(4000));
INSERT INTO t1 VALUES(randomblob(4000));
COMMIT;
BEGIN;
INSERT INTO t2 VALUES(randomblob(4000));
INSERT INTO t2 VALUES(randomblob(4000));
INSERT INTO t2 VALUES(randomblob(4000));
COMMIT;
} {wal2 10000 0}
do_test 2.0.1 {
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
} {5120 28328 28328}
# Test recovery with both wal files intact.
#
do_test 2.1 {
db_copy test.db test.db2
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {3 3 ok}
do_test 2.2 {
db2 close
db_copy test.db test.db2
hexio_write test.db2-wal 16 12345678
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
} db2
} {0 3}
do_test 2.3 {
db2 close
db_copy test.db test.db2
hexio_write test.db2-wal2 16 12345678
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {3 0 ok}
do_test 2.4 {
db2 close
db_copy test.db test.db2
forcecopy test.db-wal test.db2-wal2
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {3 0 ok}
do_test 2.5 {
db2 close
db_copy test.db test.db2
forcecopy test.db-wal test.db2-wal2
forcecopy test.db-wal2 test.db2-wal
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {3 3 ok}
do_test 2.6 {
db2 close
db_copy test.db test.db2
forcecopy test.db-wal test.db2-wal2
close [open test.db-wal w]
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {3 0 ok}
do_test 2.7 {
db2 close
db_copy test.db test.db2
forcedelete test.db2-wal
sqlite3 db2 test.db2
execsql {
SELECT count(*) FROM t1;
SELECT count(*) FROM t2;
PRAGMA integrity_check;
} db2
} {0 0 ok}
db2 close
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 3.0 {
CREATE TABLE t1(a TEXT, b TEXT, c TEXT);
CREATE INDEX t1a ON t1(a);
CREATE INDEX t1b ON t1(b);
CREATE INDEX t1c ON t1(c);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 10000;
PRAGMA wal_autocheckpoint = 0;
PRAGMA cache_size = 5;
} {wal2 10000 0}
do_execsql_test 3.1 {
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
INSERT INTO t1 SELECT i, i, i FROM s;
INSERT INTO t1 VALUES(201, 201, 201);
} {}
do_test 3.2 {
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
} {5120 15752 4224}
do_test 3.3 {
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcecopy test.db-wal2 test.db2-wal2
sqlite3 db2 test.db2
execsql {
PRAGMA journal_size_limit = 10000;
PRAGMA wal_autocheckpoint = 0;
PRAGMA cache_size = 5;
BEGIN;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
INSERT INTO t1 SELECT i, i, i FROM s;
} db2
list [file size test.db2] [file size test.db2-wal] [file size test.db2-wal2]
} {5120 15752 23088}
if {$tcl_platform(platform)!="windows"} {
# These cannot be run under windows, as the *-shm file may not be read
# while it is locked by the database connection.
do_test 3.4 {
set fd [open test.db2-shm]
fconfigure $fd -encoding binary -translation binary
set data [read $fd]
close $fd
set fd [open test.db-shm w]
fconfigure $fd -encoding binary -translation binary
puts -nonewline $fd $data
close $fd
execsql {
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
INSERT INTO t1 SELECT i, i, i FROM s;
SELECT count(*) FROM t1;
PRAGMA integrity_check;
}
} {211 ok}
do_test 3.5 {
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
} {5120 15752 18896}
}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 4.0 {
PRAGMA journal_mode = wal2;
CREATE TABLE xyz(x, y, z);
INSERT INTO xyz VALUES('x', 'y', 'z');
} {wal2}
db close
do_test 4.1 {
close [open test.db-wal w]
file mkdir test.db-wal2
sqlite3 db test.db
catchsql { SELECT * FROM xyz }
} {1 {unable to open database file}}
db close
file delete test.db-wal2
db2 close
do_test 4.2 {
sqlite3 db test.db
execsql {
INSERT INTO xyz VALUES('a', 'b', 'c');
}
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcedelete test.db2-wal2
file mkdir test.db2-wal2
sqlite3 db2 test.db2
catchsql { SELECT * FROM xyz } db2
} {1 {unable to open database file}}
db2 close
file delete test.db2-wal2
finish_test
+273
View File
@@ -0,0 +1,273 @@
# 2018 December 13
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2recover2
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(x);
CREATE TABLE t2(x);
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t1 SELECT i FROM s;
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t2 SELECT i FROM s;
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 10000;
} {wal2 10000}
set ::L 1125750
set ::M 1126500
set ::H 1127250
do_execsql_test 1.1 {
UPDATE t1 SET x=x+1;
UPDATE t2 SET x=x+1 WHERE rowid<=750;
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} [list $H $M]
do_test 1.2 {
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
} {31744 14704 7368}
proc cksum {zIn data} {
if {[string length $zIn]==0} {
set s0 0
set s1 0
} else {
set s0 [hexio_get_int [string range $zIn 0 7]]
set s1 [hexio_get_int [string range $zIn 8 15]]
}
set n [expr [string length $data] / 8]
for {set i 0} {$i < $n} {incr i 2} {
set x0 [hexio_get_int -l [string range $data [expr $i*8] [expr $i*8+7]]]
set x1 [hexio_get_int -l [string range $data [expr $i*8+8] [expr $i*8+8+7]]]
set s0 [expr ($s0 + $x0 + $s1) & 0xFFFFFFFF]
set s1 [expr ($s1 + $x1 + $s0) & 0xFFFFFFFF]
}
return "[hexio_render_int32 $s0][hexio_render_int32 $s1]"
}
proc fix_wal_cksums {file} {
# Fix the checksum on the wal header.
set data [hexio_read $file 0 32]
set cksum [cksum {} [string range $data 0 47]]
set salt [hexio_read $file 16 8]
hexio_write $file 24 $cksum
# Fix the checksums for all pages in the wal file.
set pgsz [hexio_get_int [hexio_read $file 8 4]]
set sz [file size $file]
for {set off 32} {$off < $sz} {incr off [expr $pgsz+24]} {
set e [hexio_read $file $off 8]
set cksum [cksum $cksum $e]
set p [hexio_read $file [expr $off+24] $pgsz]
set cksum [cksum $cksum $p]
hexio_write $file [expr $off+8] $salt
hexio_write $file [expr $off+16] $cksum
}
}
proc wal_incr_hdrfield {file field} {
switch -- $field {
nCkpt { set offset 12 }
salt0 { set offset 16 }
salt1 { set offset 20 }
default {
error "unknown field $field - should be \"nCkpt\", \"salt0\" or \"salt1\""
}
}
# Increment the value in the wal header.
set v [hexio_get_int [hexio_read $file $offset 4]]
incr v
hexio_write $file $offset [hexio_render_int32 $v]
# Fix various checksums
fix_wal_cksums $file
}
proc wal_set_nckpt {file val} {
# Increment the value in the wal header.
hexio_write $file 12 [hexio_render_int32 $val]
# Fix various checksums
fix_wal_cksums $file
}
proc wal_set_follow {file prevfile} {
set pgsz [hexio_get_int [hexio_read $prevfile 8 4]]
set sz [file size $prevfile]
set cksum [hexio_read $prevfile [expr $sz-$pgsz-8] 8]
hexio_write $file 16 $cksum
fix_wal_cksums $file
}
foreach {tn file field} {
1 test.db2-wal salt0
2 test.db2-wal salt1
3 test.db2-wal nCkpt
4 test.db2-wal2 salt0
5 test.db2-wal2 salt1
6 test.db2-wal2 nCkpt
} {
do_test 1.3.$tn {
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcecopy test.db-wal2 test.db2-wal2
wal_incr_hdrfield $file $field
sqlite3 db2 test.db2
execsql {
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} db2
} [list $H $L]
db2 close
}
do_test 1.4 {
forcecopy test.db test.db2
forcecopy test.db-wal2 test.db2-wal
forcedelete test.db2-wal2
sqlite3 db2 test.db2
execsql {
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} db2
} [list $L $M]
do_test 1.5 {
db2 close
forcecopy test.db test.db2
forcecopy test.db-wal2 test.db2-wal
forcecopy test.db-wal test.db2-wal2
sqlite3 db2 test.db2
execsql {
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} db2
} [list $H $M]
db2 close
foreach {tn file field} {
1 test.db2-wal salt0
2 test.db2-wal salt1
3 test.db2-wal2 salt0
4 test.db2-wal2 salt1
} {
do_test 1.6.$tn {
forcecopy test.db test.db2
forcecopy test.db-wal2 test.db2-wal
forcecopy test.db-wal test.db2-wal2
wal_incr_hdrfield $file $field
sqlite3 db2 test.db2
execsql {
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} db2
} [list $H $L]
db2 close
}
foreach {tn nCkpt1 nCkpt2 res} [list \
1 2 1 "$H $M" \
2 2 2 "$L $M" \
3 3 1 "$H $L" \
4 15 14 "$H $M" \
5 0 15 "$H $M" \
6 1 15 "$L $M" \
] {
do_test 1.7.$tn {
forcecopy test.db test.db2
forcecopy test.db-wal2 test.db2-wal
forcecopy test.db-wal test.db2-wal2
wal_set_nckpt test.db2-wal2 $nCkpt2
wal_set_nckpt test.db2-wal $nCkpt1
wal_set_follow test.db2-wal test.db2-wal2
sqlite3 db2 test.db2
execsql {
SELECT sum(x) FROM t1;
SELECT sum(x) FROM t2;
} db2
} $res
db2 close
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 1.8.1 {
PRAGMA autovacuum = 0;
PRAGMA page_size = 4096;
CREATE TABLE t1(x);
CREATE TABLE t2(x);
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t1 SELECT i FROM s;
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t2 SELECT i FROM s;
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 10000;
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t2 SELECT i FROM s;
} {wal2 10000}
do_test 1.8.2 {
list [file size test.db-wal] [file size test.db-wal2]
} {24752 0}
do_execsql_test 1.8.3 { PRAGMA user_version = 123 }
do_test 1.8.4 {
list [file size test.db-wal] [file size test.db-wal2]
} {24752 4152}
do_test 1.8.5 {
hexio_write test.db-wal2 [expr 56+16] 0400
fix_wal_cksums test.db-wal2
} {}
ifcapable oversize_cell_check {
set msg {database disk image is malformed}
} else {
set msg {malformed database schema (?)}
}
do_test 1.8.6 {
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcecopy test.db-wal2 test.db2-wal2
sqlite3 db2 test.db2
catchsql { SELECT * FROM sqlite_master } db2
} [list 1 $msg]
db2 close
finish_test
+52
View File
@@ -0,0 +1,52 @@
# 2022 June 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2recover3
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(x);
CREATE TABLE t2(x);
PRAGMA journal_mode = wal2;
PRAGMA wal_autocheckpoint = 0;
PRAGMA journal_size_limit = 10000;
} {wal2 0 10000}
do_execsql_test 1.1 {
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t1 SELECT i FROM s;
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
INSERT INTO t2 SELECT i FROM s;
}
db_save_and_close
set fd [open sv_test.db-wal2 r+]
seek $fd 4000
puts -nonewline $fd 0
close $fd
db_restore_and_reopen
do_execsql_test 1.2 {
SELECT sql FROM sqlite_schema;
} {{CREATE TABLE t1(x)} {CREATE TABLE t2(x)}}
finish_test
+92
View File
@@ -0,0 +1,92 @@
# 2017 September 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2rewrite
ifcapable !wal {finish_test ; return }
proc filesize {filename} {
if {[file exists $filename]} {
return [file size $filename]
}
return 0
}
foreach {tn jrnlmode} {
1 wal
2 wal2
} {
reset_db
execsql "PRAGMA journal_mode = $jrnlmode"
do_execsql_test $tn.1 {
PRAGMA journal_size_limit = 10000;
PRAGMA cache_size = 5;
PRAGMA wal_autocheckpoint = 10;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b INTEGER, c BLOB);
CREATE INDEX t1b ON t1(b);
CREATE INDEX t1c ON t1(c);
WITH s(i) AS (
SELECT 1 UNION SELECT i+1 FROM s WHERE i<10
)
INSERT INTO t1 SELECT i, i, randomblob(800) FROM s;
} {10000 10}
for {set i 0} {$i < 4} {incr i} {
do_execsql_test $tn.$i.1 {
UPDATE t1 SET c=randomblob(800) WHERE (b%10)==5 AND ($i%2)
}
do_execsql_test $tn.$i.2 {
BEGIN;
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
UPDATE t1 SET b=b+10, c=randomblob(800);
}
execsql COMMIT
do_test $tn.$i.3 { expr [filesize test.db-wal] < 100000 } 1
do_test $tn.$i.4 { expr [filesize test.db-wal2] < 100000 } 1
set sum [db eval {SELECT sum(b), md5sum(c) FROM t1}]
do_test $tn.$i.5 {
foreach f [glob -nocomplain test.db2*] {forcedelete $f}
foreach f [glob -nocomplain test.db*] {
forcecopy $f [string map {test.db test.db2} $f]
}
sqlite3 db2 test.db2
db2 eval {SELECT sum(b), md5sum(c) FROM t1}
} $sum
db2 close
}
}
finish_test
+62
View File
@@ -0,0 +1,62 @@
# 2017 September 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2rollback
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
CREATE TABLE t2(a, b, c);
CREATE INDEX i1 ON t1(a);
CREATE INDEX i2 ON t1(b);
PRAGMA journal_mode = wal2;
PRAGMA cache_size = 5;
PRAGMA journal_size_limit = 10000;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 1000
)
INSERT INTO t1 SELECT i, i, randomblob(200) FROM s;
} {wal2 10000}
do_test 1.1 {
expr [file size test.db-wal] > 10000
} 1
do_test 1.2 {
execsql {
BEGIN;
UPDATE t1 SET b=b+1;
INSERT INTO t2 VALUES(1,2,3);
}
expr [file size test.db-wal2] > 10000
} {1}
breakpoint
do_execsql_test 1.3 {
ROLLBACK;
SELECT * FROM t2;
SELECT count(*) FROM t1 WHERE a=b;
PRAGMA integrity_check;
} {1000 ok}
finish_test
+73
View File
@@ -0,0 +1,73 @@
# 2018 December 13
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2savepoint
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
CREATE INDEX t1a ON t1(a);
CREATE INDEX t1b ON t1(b);
CREATE INDEX t1c ON t1(c);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 15000;
PRAGMA wal_autocheckpoint = 0;
PRAGMA cache_size = 5;
} {wal2 15000 0}
do_execsql_test 1.1 {
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
} {}
do_test 1.2 {
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
} {5120 23088 0}
do_execsql_test 1.3 {
BEGIN;
SAVEPOINT abc;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 100)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
ROLLBACK TO abc;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
COMMIT;
SELECT count(*) FROM t1;
PRAGMA integrity_check;
} {210 ok}
do_execsql_test 1.4 {
BEGIN;
SAVEPOINT abc;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 100)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
ROLLBACK TO abc;
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
INSERT INTO t1 SELECT random(), random(), random() FROM s;
COMMIT;
SELECT count(*) FROM t1;
PRAGMA integrity_check;
} {220 ok}
finish_test
+475
View File
@@ -0,0 +1,475 @@
# 2017 September 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix wal2simple
ifcapable !wal {finish_test ; return }
#-------------------------------------------------------------------------
# The following tests verify that a client can switch in and out of wal
# and wal2 mode. But that it is not possible to change directly from wal
# to wal2, or from wal2 to wal mode.
#
do_execsql_test 1.1.0 {
PRAGMA journal_mode = wal2
} {wal2}
execsql { SELECT * FROM sqlite_master}
do_execsql_test 1.x {
PRAGMA journal_mode;
PRAGMA main.journal_mode;
} {wal2 wal2}
db close
do_test 1.1.1 { file size test.db } {1024}
do_test 1.1.2 { hexio_read test.db 18 2 } 0303
sqlite3 db test.db
do_execsql_test 1.2.0 {
SELECT * FROM sqlite_master;
PRAGMA journal_mode = delete;
} {delete}
db close
do_test 1.2.1 { file size test.db } {1024}
do_test 1.2.2 { hexio_read test.db 18 2 } 0101
sqlite3 db test.db
do_execsql_test 1.3.0 {
SELECT * FROM sqlite_master;
PRAGMA journal_mode = wal;
} {wal}
db close
do_test 1.3.1 { file size test.db } {1024}
do_test 1.3.2 { hexio_read test.db 18 2 } 0202
sqlite3 db test.db
do_catchsql_test 1.4.0 {
PRAGMA journal_mode = wal2;
} {1 {cannot change from wal to wal2 mode}}
do_execsql_test 1.4.1 {
PRAGMA journal_mode = wal;
PRAGMA journal_mode = delete;
PRAGMA journal_mode = wal2;
PRAGMA journal_mode = wal2;
} {wal delete wal2 wal2}
do_catchsql_test 1.4.2 {
PRAGMA journal_mode = wal;
} {1 {cannot change from wal2 to wal mode}}
db close
do_test 1.4.3 { hexio_read test.db 18 2 } 0303
#-------------------------------------------------------------------------
# Test that recovery in wal2 mode works.
#
forcedelete test.db test.db-wal test.db-wal2
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 5000;
} {wal2 5000}
proc wal_hook {DB nm nFrame} { $DB eval { PRAGMA wal_checkpoint } }
db wal_hook {wal_hook db}
for {set i 1} {$i <= 200} {incr i} {
execsql { INSERT INTO t1 VALUES(NULL, randomblob(100)) }
set res [db eval { SELECT sum(a), md5sum(b) FROM t1 }]
do_test 2.1.$i {
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
forcecopy test.db test.db2
forcecopy test.db-wal test.db2-wal
forcecopy test.db-wal2 test.db2-wal2
sqlite3 db2 test.db2
db2 eval { SELECT sum(a), md5sum(b) FROM t1 }
} $res
db2 close
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 3.0 {
CREATE TABLE t1(x BLOB, y INTEGER PRIMARY KEY);
CREATE INDEX i1 ON t1(x);
PRAGMA cache_size = 5;
PRAGMA journal_mode = wal2;
} {wal2}
do_test 3.1 {
execsql BEGIN
for {set i 1} {$i < 1000} {incr i} {
execsql { INSERT INTO t1 VALUES(randomblob(800), $i) }
}
execsql COMMIT
} {}
do_execsql_test 3.2 {
PRAGMA integrity_check;
} {ok}
#-------------------------------------------------------------------------
catch { db close }
foreach f [glob -nocomplain test.db*] { forcedelete $f }
reset_db
do_execsql_test 4.0 {
CREATE TABLE t1(x, y);
PRAGMA journal_mode = wal2;
} {wal2}
do_execsql_test 4.1 {
SELECT * FROM t1;
} {}
do_execsql_test 4.2 {
INSERT INTO t1 VALUES(1, 2);
} {}
do_execsql_test 4.3 {
SELECT * FROM t1;
} {1 2}
do_test 4.4 {
sqlite3 db2 test.db
execsql { SELECT * FROM t1 } db2
} {1 2}
do_test 4.5 {
lsort [glob test.db*]
} {test.db test.db-shm test.db-wal test.db-wal2}
do_test 4.6 {
db close
db2 close
sqlite3 db test.db
execsql { SELECT * FROM t1 }
} {1 2}
do_execsql_test 4.7 {
PRAGMA journal_size_limit = 4000;
INSERT INTO t1 VALUES(3, 4);
INSERT INTO t1 VALUES(5, 6);
INSERT INTO t1 VALUES(7, 8);
INSERT INTO t1 VALUES(9, 10);
INSERT INTO t1 VALUES(11, 12);
INSERT INTO t1 VALUES(13, 14);
INSERT INTO t1 VALUES(15, 16);
INSERT INTO t1 VALUES(17, 18);
SELECT * FROM t1;
} {4000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
do_test 4.8 {
sqlite3 db2 test.db
execsql { SELECT * FROM t1 } db2
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
do_test 4.9 {
db close
db2 close
lsort [glob test.db*]
} {test.db}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 5.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
CREATE INDEX i1 ON t1(b, c);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 4000;
} {wal2 4000}
proc wal_hook {DB nm nFrame} {
$DB eval { PRAGMA wal_checkpoint }
}
db wal_hook [list wal_hook db]
foreach js {4000 8000 12000} {
foreach NROW [list 100 200 300 400 500 600 1000] {
do_test 5.$js.$NROW.1 {
db eval "DELETE FROM t1"
db eval "PRAGMA journal_size_limit = $js"
set nTotal 0
for {set i 0} {$i < $NROW} {incr i} {
db eval { INSERT INTO t1 VALUES($i, $i, randomblob(abs(random()%50))) }
incr nTotal $i
}
set {} {}
} {}
do_test 5.$js.$NROW.2 {
sqlite3 db2 test.db
db2 eval {
PRAGMA integrity_check;
SELECT count(*), sum(b) FROM t1;
}
} [list ok $NROW $nTotal]
db2 close
}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE TABLE tx(x);
PRAGMA journal_mode = wal2;
PRAGMA journal_size_limit = 3500;
} {wal2 3500}
do_test 6.1 {
for {set i 0} {$i < 10} {incr i} {
execsql "CREATE TABLE t$i (x);"
}
} {}
do_test 6.2.1 {
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
forcecopy test.db-wal2 test.db2-wal2
sqlite3 db2 test.db2
db2 eval { SELECT * FROM sqlite_master }
} {}
do_test 6.2.2 {
db2 eval {
PRAGMA journal_mode = wal2;
SELECT * FROM sqlite_master;
}
} {wal2}
do_test 6.3.1 {
db2 close
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
forcecopy test.db-wal2 test.db2-wal2
forcecopy test.db test.db2
sqlite3 db2 test.db2
db2 eval { SELECT * FROM sqlite_master }
} {table tx tx 2 {CREATE TABLE tx(x)}}
do_test 6.3.2 {
db2 eval {
PRAGMA journal_mode = wal2;
SELECT * FROM sqlite_master;
}
} {wal2 table tx tx 2 {CREATE TABLE tx(x)}}
do_test 6.4.1 {
db2 close
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
forcecopy test.db-wal2 test.db2-wal2
forcecopy test.db-wal test.db2-wal
sqlite3 db2 test.db2
db2 eval { SELECT * FROM sqlite_master }
} {}
do_test 6.4.2 {
db2 eval {
PRAGMA journal_mode = wal2;
SELECT * FROM sqlite_master;
}
} {wal2}
db2 close
#-------------------------------------------------------------------------
reset_db
sqlite3 db2 test.db
do_execsql_test 7.0 {
PRAGMA journal_size_limit = 10000;
PRAGMA journal_mode = wal2;
PRAGMA wal_autocheckpoint = 0;
BEGIN;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES( randomblob(8000) );
COMMIT;
} {10000 wal2 0}
do_test 7.1 {
list [file size test.db-wal] [file size test.db-wal2]
} {9464 0}
# Connection db2 is holding a PART1 lock.
#
# 7.2.2: Test that the PART1 does not prevent db from switching to the
# other wal file.
#
# 7.2.3: Test that the PART1 does prevent a checkpoint of test.db-wal.
#
# 7.2.4: Test that after the PART1 is released the checkpoint is possible.
#
do_test 7.2.1 {
execsql {
BEGIN;
SELECT count(*) FROM t1;
} db2
} {1}
do_test 7.2.2 {
execsql {
INSERT INTO t1 VALUES( randomblob(800) );
INSERT INTO t1 VALUES( randomblob(800) );
}
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {13656 3176 1024}
do_test 7.2.3 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {13656 3176 1024}
do_test 7.2.4 {
execsql { END } db2
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {13656 3176 11264}
# Connection db2 is holding a PART2_FULL1 lock.
#
# 7.3.2: Test that the lock does not prevent checkpointing.
#
# 7.3.3: Test that the lock does prevent the writer from overwriting
# test.db-wal.
#
# 7.3.4: Test that after the PART2_FULL1 is released the writer can
# switch wal files and overwrite test.db-wal
#
db close
db2 close
sqlite3 db test.db
sqlite3 db2 test.db
do_test 7.3.1 {
execsql {
PRAGMA wal_autocheckpoint = 0;
PRAGMA journal_size_limit = 10000;
INSERT INTO t1 VALUES(randomblob(10000));
INSERT INTO t1 VALUES(randomblob(500));
}
execsql {
BEGIN;
SELECT count(*) FROM t1;
} db2
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 3176 12288}
do_test 7.3.2 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 3176 22528}
do_test 7.3.3 {
execsql {
INSERT INTO t1 VALUES(randomblob(10000));
INSERT INTO t1 VALUES(randomblob(500));
}
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 18896 22528}
do_test 7.3.4 {
execsql END db2
execsql { INSERT INTO t1 VALUES(randomblob(5000)); }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 18896 22528}
# Connection db2 is holding a PART2 lock.
#
# 7.4.2: Test that the lock does not prevent writer switching to test.db-wal.
#
# 7.3.3: Test that the lock does prevent checkpointing of test.db-wal2.
#
# 7.3.4: Test that after the PART2 is released test.db-wal2 can be
# checkpointed.
#
db close
db2 close
breakpoint
sqlite3 db test.db
sqlite3 db2 test.db
do_test 7.4.1 {
execsql {
PRAGMA wal_autocheckpoint = 0;
PRAGMA journal_size_limit = 10000;
INSERT INTO t1 VALUES(randomblob(10000));
INSERT INTO t1 VALUES(randomblob(10000));
PRAGMA wal_checkpoint;
}
execsql {
BEGIN;
SELECT count(*) FROM t1;
} db2
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 50176}
do_test 7.4.2 {
execsql {
INSERT INTO t1 VALUES(randomblob(5000));
}
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 50176}
do_test 7.4.3 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 50176}
do_test 7.4.4 {
execsql END db2
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 60416}
# Connection db2 is holding a PART1_FULL2 lock.
#
# 7.5.2: Test that the lock does not prevent a checkpoint of test.db-wal2.
#
# 7.5.3: Test that the lock does prevent the writer from overwriting
# test.db-wal2.
#
# 7.5.4: Test that after the PART1_FULL2 lock is released, the writer
# can switch to test.db-wal2.
#
db close
db2 close
sqlite3 db test.db
sqlite3 db2 test.db
do_test 7.5.1 {
execsql {
PRAGMA wal_autocheckpoint = 0;
PRAGMA journal_size_limit = 10000;
INSERT INTO t1 VALUES(randomblob(10000));
INSERT INTO t1 VALUES(randomblob(10000));
PRAGMA wal_checkpoint;
INSERT INTO t1 VALUES(randomblob(5000));
}
execsql {
BEGIN;
SELECT count(*) FROM t1;
} db2
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 76800}
do_test 7.5.2 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {12608 12608 87040}
do_test 7.5.3.1 {
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {14704 12608 87040}
do_test 7.5.3.2 {
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {22040 12608 87040}
do_test 7.5.4 {
execsql END db2
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
} {22040 12608 87040}
finish_test
+93
View File
@@ -0,0 +1,93 @@
# 2018 December 5
#
# 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 the operation of the library in
# "PRAGMA journal_mode=WAL2" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix wal2snapshot
ifcapable !wal {finish_test ; return }
ifcapable !snapshot {finish_test; return}
foreach {tn mode} {1 wal 2 wal2} {
reset_db
do_execsql_test $tn.1 "PRAGMA journal_mode = $mode" $mode
do_execsql_test $tn.2 {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
BEGIN;
}
# Check that sqlite3_snapshot_get() is an error for a wal2 db.
#
if {$tn==1} {
do_test 1.3 {
set S [sqlite3_snapshot_get db main]
sqlite3_snapshot_free $S
} {}
} else {
do_test 2.3 {
list [catch { sqlite3_snapshot_get db main } msg] $msg
} {1 SQLITE_ERROR}
}
# Check that sqlite3_snapshot_recover() is an error for a wal2 db.
#
do_execsql_test $tn.4 COMMIT
if {$tn==1} {
do_test 1.5 {
sqlite3_snapshot_recover db main
} {}
} else {
do_test 2.5 {
list [catch { sqlite3_snapshot_recover db main } msg] $msg
} {1 SQLITE_ERROR}
}
# Check that sqlite3_snapshot_open() is an error for a wal2 db.
#
if {$tn==1} {
do_test 1.6 {
execsql BEGIN
set SNAPSHOT [sqlite3_snapshot_get_blob db main]
sqlite3_snapshot_open_blob db main $SNAPSHOT
execsql COMMIT
} {}
} else {
do_test 2.6.1 {
execsql BEGIN
set res [
list [catch { sqlite3_snapshot_open_blob db main $SNAPSHOT } msg] $msg
]
execsql COMMIT
set res
} {1 SQLITE_ERROR}
do_test 2.6.2 {
execsql BEGIN
execsql {SELECT * FROM sqlite_master}
set res [
list [catch { sqlite3_snapshot_open_blob db main $SNAPSHOT } msg] $msg
]
execsql COMMIT
set res
} {1 SQLITE_ERROR}
}
}
finish_test
+1 -1
View File
@@ -85,7 +85,7 @@ proc lock_callback {method filename handle lock} {
db2 eval { INSERT INTO x VALUES('x') }
}
}
db timeout 10
db timeout 1100
do_catchsql_test 2.4 {
BEGIN EXCLUSIVE;
} {0 {}}
+14
View File
@@ -311,6 +311,20 @@ do_execsql_test 8.9 {
do_execsql_test 8.10 {
SELECT * FROM t0 WHERE likelihood(t0.rowid <= '0', 0.5);
} {}
# Forum https://sqlite.org/forum/forumpost/45ec3d9788
reset_db
do_execsql_test 8.11 {
CREATE TABLE t1(c0 INT);
INSERT INTO t1(c0) VALUES (NULL);
CREATE INDEX i46 ON t1(CAST( (c0 IS TRUE) AS TEXT));
CREATE VIEW v0(c2) AS SELECT CAST( (c0 IS TRUE) AS TEXT ) FROM t1;
}
do_execsql_test 8.12 {
SELECT quote(c0), quote(c2) FROM t1, v0 WHERE (0 < LIKELY(v0.c2));
} {NULL '0'}
do_execsql_test 8.13 {
SELECT quote(c0), quote(c2) FROM t1, v0 WHERE (0 < LIKELY(v0.c2)) IS TRUE;
} {NULL '0'}
# 2019-12-31: assertion fault discovered by Yongheng's fuzzer.
# Harmless memIsValid() due to the code generators failure to
+17 -3
View File
@@ -7,6 +7,13 @@
# definition used in src/ctime.c, run this script from
# the checkout root. It generates src/ctime.c .
#
# Results are normally written into src/ctime.c. But if an argument is
# provided, results are written there instead. Examples:
#
# tclsh tool/mkctimec.tcl ;# <-- results to src/ctime.c
#
# tclsh tool/mkctimec.tcl /dev/tty ;# <-- results to the terminal
#
set ::headWarning {/* DO NOT EDIT!
@@ -381,6 +388,8 @@ set options(THREADSAFE) {
#endif
}
set options(WAL2) { "WAL2", }
proc trim_name {in} {
set ret $in
if {[string range $in 0 6]=="SQLITE_"} {
@@ -429,10 +438,15 @@ foreach v $value2_options {
}]
}
set ctime_c "src/ctime.c"
if {$argc>0} {
set destfile [lindex $argv 0]
} else {
set destfile "[file dir [file dir [file normal $argv0]]]/src/ctime.c"
puts "Overwriting $destfile..."
}
if {[catch {set cfd [open $ctime_c w]}]!=0} {
puts stderr "File '$ctime_c' unwritable."
if {[catch {set cfd [open $destfile w]}]!=0} {
puts stderr "File '$destfile' unwritable."
exit 1;
}
+14 -2
View File
@@ -9,6 +9,14 @@
# Then add the extra "case PragTyp_XXXXX:" and subsequent code for the
# new pragma in ../src/pragma.c.
#
# The results are normally written into the ../src/pragma.h file. However,
# if an alternative output file name is provided as an argument, then
# results are written into the alternative. For example:
#
# tclsh tool/mkpragmatab.tcl ;# <--- Results to src/pragma.h
#
# tclsh tool/mkpragmatab.tcl /dev/tty ;# <-- results to terminal
#
# Flag meanings:
set flagMeaning(NeedSchema) {Force schema load before running}
@@ -402,8 +410,12 @@ set pragma_def {
# Open the output file
#
set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h"
puts "Overwriting $destfile with new pragma table..."
if {$argc>0} {
set destfile [lindex $argv 0]
} else {
set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h"
puts "Overwriting $destfile with new pragma table..."
}
set fd [open $destfile wb]
puts $fd {/* DO NOT EDIT!
** This file is automatically generated by the script at
+25 -14
View File
@@ -27,12 +27,15 @@ proc readfile {filename} {
# Find the root of the tree.
#
set ROOT [file dir [file dir [file normalize $argv0]]]
cd $ROOT
# Name of the TCL interpreter
#
set TCLSH [info nameofexe]
# Number of errors seen.
#
set NERR 0
######################### autoconf/tea/configure.ac ###########################
set confac [readfile $ROOT/autoconf/tea/configure.ac]
@@ -42,38 +45,46 @@ append pattern [string trim $vers]
append pattern {])}
if {[string first $pattern $confac]<=0} {
puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION"
exit 1
puts "...... Fix: manually edit ./autoconf/tea/configure.ac to"
incr NERR
}
######################### autoconf/Makefile.msc ###############################
set f1 [readfile $ROOT/autoconf/Makefile.msc]
exec mv $ROOT/autoconf/Makefile.msc $ROOT/autoconf/Makefile.msc.tmp
exec $TCLSH $ROOT/tool/mkmsvcmin.tcl
set f2 [readfile $ROOT/autoconf/Makefile.msc]
exec mv $ROOT/autoconf/Makefile.msc.tmp $ROOT/autoconf/Makefile.msc
exec $TCLSH $ROOT/tool/mkmsvcmin.tcl $ROOT/Makefile.msc tmp1.txt
set f2 [readfile tmp1.txt]
file delete tmp1.txt
if {$f1 != $f2} {
puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc"
puts "...... Fix: tclsh tool/mkmsvcmin.tcl"
incr NERR
}
######################### src/pragma.h ########################################
set f1 [readfile $ROOT/src/pragma.h]
exec mv $ROOT/src/pragma.h $ROOT/src/pragma.h.tmp
exec $TCLSH $ROOT/tool/mkpragmatab.tcl
set f2 [readfile $ROOT/src/pragma.h]
exec mv $ROOT/src/pragma.h.tmp $ROOT/src/pragma.h
exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt
set f2 [readfile tmp2.txt]
file delete tmp2.txt
if {$f1 != $f2} {
puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl"
puts "...... Fix: tclsh tool/mkpragmatab.tcl"
incr NERR
}
######################### src/ctime.c ########################################
set f1 [readfile $ROOT/src/ctime.c]
exec mv $ROOT/src/ctime.c $ROOT/src/ctime.c.tmp
exec $TCLSH $ROOT/tool/mkctimec.tcl
set f2 [readfile $ROOT/src/ctime.c]
exec mv $ROOT/src/ctime.c.tmp $ROOT/src/ctime.c
exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt
set f2 [readfile tmp3.txt]
file delete tmp3.txt
if {$f1 != $f2} {
puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl"
puts "..... Fix: tclsh tool/mkctimec.tcl"
incr NERR
}
# If any errors are seen, exit 1 so that the build will fail.
#
if {$NERR>0} {exit 1}