Compare commits

..

91 Commits

Author SHA1 Message Date
dan 1fffa73ea2 Add tests for sqlite_rename_quotefix(). Fix a memory leak in the same.
FossilOrigin-Name: 531550056c38589c99c9a97b6afdbf8f34ff8d2131d74e9d42af3506e8045064
2021-03-16 18:24:49 +00:00
dan 2ad080aa82 Have ALTER TABLE RENAME COLUMN and DROP COLUMN use sqlite_rename_quotefix() to convert any double-quoted strings in the database schema to their single-quoted equivalents.
FossilOrigin-Name: 6446c0961077396086251670102ea7bf17d54a6b0f0ca56c6af89028a1ff9039
2021-03-16 16:14:48 +00:00
dan 00bc66f2cc Merge trunk changes into this branch.
FossilOrigin-Name: f15d51054afb1e3fec87938f2b04a5a0d0611b08248367850450de7c4166e3d1
2021-03-16 11:21:36 +00:00
dan 776a578c21 Fix a problem with ALTER TABLE RENAME COLUMN when used on a schema that features generated columns.
FossilOrigin-Name: 0e255b26872b50581d470952dd98e21dd82d081885006f58d49daa4b4576b35d
2021-03-16 11:11:07 +00:00
dan 1e24072d05 Add internal SQL function sqlite_rename_quotefix(). For converting double-quoted strings to their single-quoted counterparts in DDL statements.
FossilOrigin-Name: d874b300463ce0bbb53b7e2f88c6a12893e4fd751fcc7f810077ba108f4061ef
2021-03-15 20:22:34 +00:00
drh a7eaa518f8 Version 3.35.1
FossilOrigin-Name: aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a
2021-03-15 16:53:57 +00:00
drh 67c4ce131b Improvements to the built-in ".dump" documentation in the CLI.
FossilOrigin-Name: 0915f969f429a8d0b594e937e0128d5476774d9bbe4a24081dbc60273cb5bb9a
2021-03-15 15:12:10 +00:00
drh c9f1a7d1df Bump the version number to 3.35.1.
FossilOrigin-Name: 184d5a352f098459cfb0cc029713d5d43fefc83f6cc95ce5666bd07591aaac2f
2021-03-15 15:02:38 +00:00
drh 6127d73abc Improved detection of conflicting indexes when doing DROP COLUMN on a column
whose name is quoted in the index definition.
Fix for ticket [1c24a659e6d7f3a1].

FossilOrigin-Name: c450d0ad6b39db4bf93015d629e25f7af0d7a9779f7a987e2fc38a5ef064a182
2021-03-15 14:58:12 +00:00
larrybr 7bdbe59829 Make shell's .help output for .dump more accurate as to what can be dumped.
FossilOrigin-Name: f91d8c09a02f7a7ab354c49cd193d422074daa5eb908f17d1907a8c2b38f96a5
2021-03-15 12:56:00 +00:00
larrybr d8b4befdef Create new branch named "cli-tweaks"
FossilOrigin-Name: 4cf056a571cae6fded8136bc12f3a2787da37c6b52383cbf7b918827654ba4e7
2021-03-15 12:32:35 +00:00
drh 0e8075ab78 An additional test case
FossilOrigin-Name: 7e2d7ca15a84e5bd9f2b1360232607d15c2dbcc9d30b0f1a7cdbf2865e6b1af5
2021-03-14 20:17:06 +00:00
drh 44d441313a An alternative approach for fixing ticket [1c24a659e6d7f3a1].
FossilOrigin-Name: a2adae907a28e169e64cfe69d97d7b68cb94e6ba07d2dfa995e3fbc6672fafdd
2021-03-14 19:55:40 +00:00
larrybr 9c0fee296a Update generated autoconf/Makefile.msc to reflect its source.
FossilOrigin-Name: d9f8f488ff9d47fe7bb8838e683bae4fea038f7278ef885ecf292143a0dd88ed
2021-03-12 23:15:08 +00:00
drh f1c43ea647 Version 3.35.0
FossilOrigin-Name: acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b
2021-03-12 15:10:09 +00:00
drh 0ca23aa437 Fix broken requirement marks.
FossilOrigin-Name: 98d67152849e062c6de45b0e526daffc3d6cb29d563d40664a8d7140119a30b2
2021-03-12 13:49:09 +00:00
drh 9d59e3b1bf Fix the ".read" command in the CLI so that SQLITE_OMIT_POPEN disables
reading from a pipeline.

FossilOrigin-Name: cea34f3cc35ad6dc67691799a219a30739f2296945d624d232bf76150c598ec0
2021-03-12 01:49:08 +00:00
larrybr ab6098cfa6 Conform description of sqlite3changeset_op() arguments to implemented behavior, some reformatting.
This is a comment-only change; no code is affected.

FossilOrigin-Name: 9d6e544c47b9a5d97bd02a658db5cd202bd1952f8ba3bc50e8cf47d7206041c0
2021-03-12 00:44:10 +00:00
dan 3ddc3809bf Fix a Tcl object leak in test_session.c.
FossilOrigin-Name: 07150cf15ad36c7fc681a911f66db23d610ddf110a7be7f1fcefbd8750cd135a
2021-03-11 15:57:25 +00:00
drh 407cfe994d Bug fix in appendvfs.c: Adjust the size parameter for
SQLITE_FCNTL_SIZE_HINT to account for the prefix.

FossilOrigin-Name: 41df3bbefd63151f2ddb920066777eab8e07ecfc0edb0f71f9493debe0a4a2c4
2021-03-11 13:43:29 +00:00
dan 632f0ed265 Have the Tcl tests support environment variable SQLITE_TEST_PATTERN_LIST, so that if it is set it is interpreted as a list of patterns that are matched against tests file names. Only test files that match at least one pattern are run.
FossilOrigin-Name: b7c92e1d08f213865f026d8dbdc4e805fb5c119b7f206506ed06e83a878de657
2021-03-11 08:49:52 +00:00
dan 3fb7bd5ee0 Fix sanitizer complaint in fts3 code.
FossilOrigin-Name: 424b39eaeb578f85e58214af4b467e6e363431308ab7a327774e62fa70d3c2db
2021-03-10 20:04:21 +00:00
dan 55b2e8b062 Fix further sanitizer complaints in the fts5 code.
FossilOrigin-Name: 4cb00b9d4020a51f690720c6f51009c5be8c22ef8c70807ead1d953d19784f26
2021-03-10 19:32:47 +00:00
drh 662a1426cb Improved testcase() related the SQLITE_MAX_ATTACHED vs. SQLITE_MAX_DB problem.
FossilOrigin-Name: 27d3c00efef66ad48ed94228474dbea3ad81ea5c19425028c42cf4220920a645
2021-03-10 18:21:18 +00:00
drh 4d17e30624 Improvement to the ATTACH-abuse authorizer logic in fuzzcheck.
FossilOrigin-Name: 88132f698a7a9b7d41dd1dd393592cbda130d2bf1a9fd18c509503e1891b9655
2021-03-10 17:52:59 +00:00
dan ba34b79f15 Do not run avfs.test when testing SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 2ab6957a2238a2ab713a50d21dbd9921c944e8141197275bbfe7dae303fee7d0
2021-03-10 17:43:18 +00:00
drh 099b385d17 Do not confuse the constant SQLITE_MAX_ATTACHED with the maximum number of
schemas.  Add the new SQLITE_MAX_DB constant for the maximum number of
schemas.  [forum:/forumpost/a006d86f72|Forum post a006d86f72].

FossilOrigin-Name: 7b65fb9f7bd616f834633afd64b3448bf9ca2b6e4cc6d6c01e75d1d877c88a79
2021-03-10 16:35:37 +00:00
dan bc3c4e0830 Fix test file avfs.test so that it works with SQLITE_DEFAULT_AUTOVACUUM builds. Do not run avfs.test under test permutation "journaltest".
FossilOrigin-Name: 2c6078ebe797dd2cb6045b5f13e6d92a6b49393ecf96f9fd7222412f5a3eefd5
2021-03-10 15:10:20 +00:00
dan 3be2b860d0 Fix a few sanitizer complaints in fts5.
FossilOrigin-Name: 4fe4fee00e9294fa384bd073ed8e9a2a4ad10dcf653b6ad4851e44a64443ede9
2021-03-10 14:57:10 +00:00
dan a1c467f51f Fix a problem preventing wapptest from setting SQLITE_ENABLE_LOCKING_STYLE for OSX tests. Also modify the "Sanitize" configuration in releasetest_data.tcl to subsume test item 6g.
FossilOrigin-Name: f762d7df2a41a88560a4251d744e0887f42812f8160af4f0129d22a71c0fa48b
2021-03-10 10:43:17 +00:00
larrybr c5edbd1cf6 When shell has no .ar, fake its effect w.r.t. page_size and table creation/filling.
FossilOrigin-Name: 959f5c65ea14f4716df61e250e9d5a0d69d602a2a973ad22a364e640162c2983
2021-03-10 06:06:16 +00:00
drh a94c484584 Add appendvfs.c to the MSVC makefile.
FossilOrigin-Name: a6681fbb2e0c8d5a7c968f6fd458f61658fad6ac4c7eb8663762b6ac386cdae5
2021-03-09 23:38:27 +00:00
dan 4049ede97d Update a comment in btree.h.
FossilOrigin-Name: 9645fe1a050e8b61aea1fba2f142819c387ecb043741392c5719bf7ad303bf8b
2021-03-09 21:20:12 +00:00
drh 0db20c490a Fix a bad comment (copy-paste error) in the byte code engine. No code changes.
FossilOrigin-Name: 1c01745734c7b62a8c792f743aae08dfbb9e047dc92fef8da067fec152b20fd5
2021-03-09 20:58:21 +00:00
drh 45e4cb8e77 Improved comments on the NOT NULL strength reduction optimization.
FossilOrigin-Name: a85d72293914b48edbb39171fd591d37ffb09570d8103140a052203ec71d49ee
2021-03-09 19:52:15 +00:00
drh 6d0053cfa7 Extra comments and testcase() macros associated with the new
sqlite3ParserAddCleanup() mechanism.  No changes to release builds.

FossilOrigin-Name: c3c8691121e6cb7bfc326212cc81a7472c0e6f22e655ab024bd4bd885e1cd878
2021-03-09 19:32:37 +00:00
drh e7a377046d Add --enable-math to the amalgamation autoconf. On be default. Improved
logging of the amalgamation autoconf.

FossilOrigin-Name: 85d28b52250e1817b722dc10da3b7b73abf7539cbe7aa913b5960ae4da40d5f8
2021-03-09 17:09:00 +00:00
drh 42c93b5e9f Math functions are enabled by default in the main configure script.
FossilOrigin-Name: b7456e0715c63308b7b3acf49eb66ecd947481400d4688ae459e2e1499447bcd
2021-03-09 16:35:14 +00:00
drh 24ec37c3b3 Improvements to the configure script. Math functions are enabled
by --enable-all.

FossilOrigin-Name: c79c6d18dee608e54ae31388b240cc521218309094502d8815111bb4ddf7d9ef
2021-03-09 13:53:39 +00:00
drh 657a7a66c3 Update the authorizer in fuzzcheck to align with dbsqlfuzz.
FossilOrigin-Name: f86d8fae3b29de014d8bfcae38a15bdb15ddceabfcfff7829f3145cfd69dff2a
2021-03-09 13:12:58 +00:00
larrybr ddf4972063 Add tests for too-tiny appended DBs, clarify align macro.
FossilOrigin-Name: eb40a8dea6afe6890ddda989de83f3d4ae03b112bf78bfc818dfbd57cc5b5b2a
2021-03-08 20:13:43 +00:00
dan 52a0753152 Add test cases for ALTER TABLE.
FossilOrigin-Name: 9c9ba36e859e330c50ed40ede4b93eeb0a5c3337240465d953a7be9115a81390
2021-03-08 17:22:01 +00:00
drh e58b2b4a80 Fix a bad assert in RENAME COLUMN.
dbsqlfuzz 3f0a7245b69cd08617d7d7781ebaedb0fe765a93.

FossilOrigin-Name: f13e0d12f137cd6b4e83e92bd36652431d8416e6eed4797313e061f2e390d39b
2021-03-08 17:17:38 +00:00
drh baca9807f9 Fix a harmless compiler warning in appendvfs.c
FossilOrigin-Name: f538961a8058cc327d64c8ec317f1b4f8bbb604f90261160c6c27f26f4800682
2021-03-08 16:29:06 +00:00
drh 7ae0549961 Enable internal functions for fuzzcheck.
FossilOrigin-Name: 79281603b951b438303130820deb6b05baeca366c2cd93be7d8909d3232bcc96
2021-03-08 16:13:52 +00:00
larrybr b47e4c2819 Added test/avfs.test (missing from branch merge for some reason.)
FossilOrigin-Name: 08fa67053c20d223c9b5334fe2e85adc95588b91046c100d7fe8e8e2535e485f
2021-03-08 14:32:26 +00:00
larrybr fb645d20bc Merge appendvfs updates and testing.
FossilOrigin-Name: 63fcf301fedf1f3708e2226ed499a53b3e9c1d2cc2b17d4b0b736e36aff0ae74
2021-03-08 14:26:22 +00:00
drh e021890954 Require that the appendvfs suffix mark indicate that the appended database
begins at an offset that is a muliple of 512 and that the appended database
contains at least 512 bytes.

FossilOrigin-Name: aeb87cc70495dd172e170eff31fd754331d4b979c0b649ab239f8c5c0c76e695
2021-03-08 13:45:08 +00:00
drh 1e6f334645 Correct the precendence order for rules that determine how a database is
opened by appendvfs when a database is appended to another database.

FossilOrigin-Name: 92989fc56f2e81ac13f8106ec83c930f43d10715269b988ee47c9bfa53621995
2021-03-08 13:30:29 +00:00
drh 40942f22f1 Minor comment and formatting changes.
FossilOrigin-Name: cf2add064f70c477fee1473c3196b72deb41222eb0cdbbdbdcf4a79995184e2b
2021-03-08 12:59:16 +00:00
larrybr 5777380d19 Add tests for sqlite3 shell with -append flag.
FossilOrigin-Name: d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f
2021-03-08 01:31:53 +00:00
larrybr 7e398c04fe Add grow/shrink tests. Fix truncate bug. Make appendvfs.c easier to inspect.
FossilOrigin-Name: c9521fa55620d0cb3cec20db7b42bc5f18876b42dca07811d1cd0f4b2907eab2
2021-03-07 18:55:25 +00:00
larrybr b2e9640155 Merge from trunk.
FossilOrigin-Name: 729117cdfa2d6ff24b66656e9ccc380199606b830fc338286e4dd10e8e787597
2021-03-06 23:49:18 +00:00
larrybr 1b22ad8ae6 Create initial tests for appendvfs, and make it available as a statically loaded extension.
FossilOrigin-Name: 9f33d45179f5985bd4c4f7582e94f5833a63f853c8cdc19f39cf7e3ee70177d0
2021-03-06 23:36:47 +00:00
drh 4bb4293b2a Limit parenthesis nesting depth in FTS3 expressions to
SQLITE_MAX_EXPR_DEPTH.

FossilOrigin-Name: 5ddd8032ef9ecd5b53909d304c8f1375a72f270fd7810964cb4e385e25bedd4f
2021-03-06 15:13:26 +00:00
dan 7f8653a257 Ensure the correct collation sequence is used for comparisons when delimiting a RANGE window.
FossilOrigin-Name: 01eae68e85b31b7a9f08733459765bbd9bf9dad592bf64f10fc2fa32e02a89c2
2021-03-06 14:46:24 +00:00
dan fa9011ec70 Fix a crash in fts3 that could occur when running a NEAR query on a corrupt database.
FossilOrigin-Name: 609d94996324f3d3c12bb8cc04a2527d1d86c35cdb2267b5b34053c961158986
2021-03-06 13:28:07 +00:00
drh 747cc9425d Fix a possible NULL pointer dereference when applying a DROP COLUMN to a
corrupt database schema.  dbsqlfuzz 419aa525df93db6e463772c686ac6da27b46da9e

FossilOrigin-Name: 349ccf58ae4bb770805066102fc8e9e478d4da1f7a6a728223bd74eabf7b7843
2021-03-06 13:02:12 +00:00
larrybr 1f8f131a8b Merge last day of trunk changes, reverify build.
FossilOrigin-Name: 1d67ed1c98a6bc49cce6bdc156bd6f22b3f37d33226bd62430a43aa5318f5781
2021-03-05 20:52:19 +00:00
larrybr feecc9f547 Fix appendvfs bug exposed by docsapp build (in docsrc), and tighten/revise published behavior.
FossilOrigin-Name: 7f0f2eacdb496f7f36865ba62164a48edb324a3c6baede736b4e7edf5e8b0fdb
2021-03-05 20:46:53 +00:00
drh 70149ba47e Modify the SQLITE_DBCONFIG_ENABLE_VIEW option so that it always permits
TEMP views, just as SQLITE_DBCONFIG_ENABLE_TRIGGER always permits TEMP
triggers.

FossilOrigin-Name: 83dab8b358b6832a221a58e74dd5e99b9cdea4eee65124bb6799881e867d989c
2021-03-05 18:33:01 +00:00
dan 68d4f07577 Fix problems with RETURNING clauses attached to UPDATEs on tables with virtual columns.
FossilOrigin-Name: 6b41b136fbfc0b56a6948f2306b69fb1d69306adb86674a15a87fe3b52062512
2021-03-05 15:42:15 +00:00
dan 0d08072b68 Fix another problem with RETURNING clauses in UPDATEs against tables with virtual columns.
FossilOrigin-Name: f0ef5c76ab1a6568b9148b928277bf589d4cb7033c0acf3e6323879b656d8bd1
2021-03-05 15:29:22 +00:00
dan a7e16a2f05 Fix an assert() failure that could be triggered by a correlated sub-query in a RETURNING clause.
FossilOrigin-Name: 551260c8625828262809b1ef7acf5343a3527b7e167ca0cfd13b81e5ece0e66c
2021-03-05 15:10:33 +00:00
drh bc7819d176 Fix the processing of implied LIMIT clauses when flattening a compound
query.

FossilOrigin-Name: 90c6b9fcb0e15e2552fe5be53f8201f145bb535cc37b603d488eadf33438412b
2021-03-05 14:08:45 +00:00
larrybr b14d14696b Create new branch named "appendvfs_tighten"
FossilOrigin-Name: 48c968bf4c8e1517864bec68d3072441994ea511a9cb446d2fdf031d5f43b077
2021-03-05 09:42:58 +00:00
drh 05edf729f7 Mark the NotUsed parameter to the dropColumnFunc() function as unused,
to avoid a harmless compiler warning.

FossilOrigin-Name: 23459071091248e94202e609bb8031c3e34722b8ae8ff5a66851dcc528a2d2c2
2021-03-04 19:44:01 +00:00
drh 91be05a910 Put ALWAYS() on a branch that is now always true because of changes
in OOM behavior due to check-in [9adf6e2469d18bc3].

FossilOrigin-Name: 8a1bb9c3e92085fb71d75eb36f64eb85053a4730fd314acd401e7ad32c274748
2021-03-04 18:34:54 +00:00
dan 39b6bd5e17 Update shell.c.in so that SQLITE_SHELL_IS_UTF8 is set to 0 if the -municode option is passed to gcc on windows.
FossilOrigin-Name: 99e6a0f020fadda4011e4ca370d2421dbf2f97f6fb004fcbba9bd6c76faf7a73
2021-03-04 18:31:07 +00:00
drh 5f0922b96c Remove a branch made unreachable by check-in [e893f88750ea64d4].
FossilOrigin-Name: 20d7dc120dc964a0236da719e4de22bff5110b95da396e2ac6790e9f6b667899
2021-03-04 16:32:28 +00:00
dan e8dd6a4e77 Fix a segfault that could occur following an OOM condition.
FossilOrigin-Name: 9adf6e2469d18bc3bfc0c804cfcaa692e23ab6b3e13465dcfc51c4b111b05cb4
2021-03-04 16:10:23 +00:00
drh aae0f74e64 Earlier detection of a misplaced ORDER BY or LIMIT clause in a compound
SELECT.  This prevents problems in recursive CTEs with multiple recursive
terms in which there is an ORDER BY or LIMIT clause on the last non-recursive
term.

FossilOrigin-Name: e893f88750ea64d45922429e022c585748974016404f2a2b7952f5a227865246
2021-03-04 16:03:32 +00:00
dan 50f9f6c649 Fix a crash that could occur if a sub-select inside an EXISTS expression features an ORDER BY clause containing one or more window functions.
FossilOrigin-Name: 9768e7db624fbfe688d61ac06bffca14a169d439d8f65f5a14529af5660d3d2e
2021-03-04 14:18:22 +00:00
dan 8718f0b613 Fix a buffer overrun that could occur in fts5 when running a prefix query against a corrupt db.
FossilOrigin-Name: 4da40620ac8557aba6e1e06e720418b55e9950f406288b03749ef1b117041cd9
2021-03-03 19:36:40 +00:00
dan 0bff34aea3 Remove the --timeout option from the valgrindfuzz Makefile target.
FossilOrigin-Name: 3f520b8bdef7dcdad30e052ed8a07b0493bff4497603521e701fab7324df2995
2021-03-03 16:46:03 +00:00
dan c6920cdb0c Fix a case where fts3 was erroneously reporting corruption.
FossilOrigin-Name: e6c7683c7503ac743d1d476c60c31f887b7ad829e26e812c25acdd4366044db8
2021-03-03 16:00:26 +00:00
drh fad1ad0526 Fix a harmless assertion fault resulting from [6e6b3729e0549de0] that was
discovered by dbsqlfuzz.  Enhance .selecttrace output to show omitted
ORDER BY clauses.  New dbsqlfuzz test cases added.

FossilOrigin-Name: 27a0388ad616f80e8dcc986c247a5c23a8565dae9081b04ff85bac0d357e531b
2021-03-03 14:07:52 +00:00
dan 3083d5f5ea Fix a problem with using ALTER TABLE commands on database schemas that contain expressions of the form "<expr> NOT NULL" or "<expr> IS NULL" that can be evaluated at prepare time.
FossilOrigin-Name: d2630ffafa077b8cfd75110b6b73da30f780edc920d2788769a4dc747f09d3f6
2021-03-03 11:00:31 +00:00
drh bb05976dac Cast a string size variable to 64-bit to avoid any possibility of
integer overflow.

FossilOrigin-Name: a5940294b2ac8d157d7fa72f65ee70b713f7feb8a0a98d7f47e71acd1b6942b1
2021-03-02 21:07:41 +00:00
drh 898ec7927a Limit the size of the exponent input in the second argument to the
ieee754() SQL function, to avoid integer overflow.
Ticket [22dea1cfdb9151e4].

FossilOrigin-Name: 99aab32da14cc76beb5c1823a70bdeab144459398d61c42a858be4d6868d361e
2021-03-02 16:27:04 +00:00
dan 730629680a Change the timeout for test case "valgrindfuzz" from 600 seconds to 1200.
FossilOrigin-Name: 7c6aa6f38403931df7940c7acfeba4e2f8099a419222fcab2a3c959ccae90e40
2021-03-02 13:50:56 +00:00
dan eefef9ae80 Do not run test file windowpushd.test as part of the "no_optimization" permutation.
FossilOrigin-Name: 275a75aa82bf5d2366fd4020066d7b9fbb93a955ac9ec15dc7d5b8bfa29074e4
2021-03-02 13:36:37 +00:00
drh 1b1a1dda9e Add ALWAYS() to an always-true conditional.
FossilOrigin-Name: fa3506db2051ceade8aa535d92c0900b3cfdd8850c6d00adedeb1ebfaf6f885f
2021-03-02 00:42:46 +00:00
drh 2d7a691fba Add #ifndef macros so that the build works again with
-DSQLITE_OMIT_AUTHORIZATION and -DSQLITE_OMIT_WINDOWFUNC.

FossilOrigin-Name: 9400bdc60294be6a938025d481e50aad9af246e64f38fafecc6ca4f24112a98c
2021-03-01 21:43:25 +00:00
dan 531d01cae0 Fix a couple of memory-sanitizer complaints that could be triggered by a corrupt database.
FossilOrigin-Name: 39c8686cabe6c437ba4860aade49a701c4f5772b97d9fbe6cb9a394e85b9c092
2021-03-01 16:16:59 +00:00
dan 1f9f576695 Fix another msan complain triggered by a corrupt database.
FossilOrigin-Name: d235d406283191fc7b9e1299be602f1e8be6f36cee8b183cf85c8660519a1c3b
2021-03-01 16:15:41 +00:00
dan 1e06c70eb0 Initialize extra field in PgHdr1 to fix an msan complaint.
FossilOrigin-Name: 4cb2ea5795b0c0678665fd89bd560209beaab8a756fe00335dbfd07493b0542d
2021-02-28 08:24:56 +00:00
dan a3944bc4fe Add OOM test case associated with the fix in the previous commit.
FossilOrigin-Name: a631c38d22bc00d38b0f112a623fb24c0e03a962f661ffe0931dad32fd31ba31
2021-02-27 15:32:02 +00:00
drh 676c869d52 Remove a NEVER() that might sometimes be tree following an OOM.
FossilOrigin-Name: ccb8cf5256d01b3ff13e75e1471b1afb0055ec2c344ba886f98b83d47eba00f8
2021-02-27 15:12:24 +00:00
dan 15de3ce9ab Fix a segfault that could occur when optimizing a NOT NULL constraint against an IPK column of a sub-query.
FossilOrigin-Name: e4d1970ef17b2330f78c750d71d625c2997f79ed1445d0351ec32b482485a954
2021-02-26 21:39:34 +00:00
dan eca6d60bfa Attempt to optimize "x IS NULL" and "x IS NOT NULL" expressions when x is a column with a NOT NULL constraint.
FossilOrigin-Name: de9c86c9e4cdb34f4b7d65f160d1e589fb969bbf64c66d2b24c502d1ee424dbb
2021-02-26 20:39:08 +00:00
70 changed files with 5571 additions and 369 deletions
+2 -1
View File
@@ -440,6 +440,7 @@ TESTSRC += \
$(TOP)/ext/expert/sqlite3expert.c \
$(TOP)/ext/expert/test_expert.c \
$(TOP)/ext/misc/amatch.c \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/carray.c \
$(TOP)/ext/misc/cksumvfs.c \
$(TOP)/ext/misc/closure.c \
@@ -1267,7 +1268,7 @@ fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuz
./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db
valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA)
valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db
# The veryquick.test TCL tests.
+1
View File
@@ -1560,6 +1560,7 @@ TESTEXT = \
$(TOP)\ext\expert\sqlite3expert.c \
$(TOP)\ext\expert\test_expert.c \
$(TOP)\ext\misc\amatch.c \
$(TOP)\ext\misc\appendvfs.c \
$(TOP)\ext\misc\carray.c \
$(TOP)\ext\misc\cksumvfs.c \
$(TOP)\ext\misc\closure.c \
+1 -1
View File
@@ -1 +1 @@
3.35.0
3.35.1
+3
View File
@@ -303,6 +303,9 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
!ENDIF
# Always enable math functions on Windows
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
# Should the rbu extension be enabled? If so, add compilation options
# to enable it.
#
+44
View File
@@ -111,14 +111,34 @@ AC_MSG_CHECKING([for whether to support dynamic extensions])
AC_MSG_RESULT($enable_dynamic_extensions)
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# --enable-math
#
AC_ARG_ENABLE(math, [AS_HELP_STRING(
[--enable-math], [SQL math functions [default=yes]])],
[], [enable_math=yes])
AC_MSG_CHECKING([SQL math functions])
if test x"$enable_math" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_MATH_FUNCTIONS"
AC_MSG_RESULT([enabled])
AC_SEARCH_LIBS(ceil, m)
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# --enable-fts4
#
AC_ARG_ENABLE(fts4, [AS_HELP_STRING(
[--enable-fts4], [include fts4 support [default=yes]])],
[], [enable_fts4=yes])
AC_MSG_CHECKING([FTS4 extension])
if test x"$enable_fts4" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -128,8 +148,12 @@ fi
AC_ARG_ENABLE(fts3, [AS_HELP_STRING(
[--enable-fts3], [include fts3 support [default=no]])],
[], [])
AC_MSG_CHECKING([FTS3 extension])
if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -139,9 +163,13 @@ fi
AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
[--enable-fts5], [include fts5 support [default=yes]])],
[], [enable_fts5=yes])
AC_MSG_CHECKING([FTS5 extension])
if test x"$enable_fts5" = "xyes"; then
AC_MSG_RESULT([enabled])
AC_SEARCH_LIBS(log, m)
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5"
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -151,8 +179,12 @@ fi
AC_ARG_ENABLE(json1, [AS_HELP_STRING(
[--enable-json1], [include json1 support [default=yes]])],
[],[enable_json1=yes])
AC_MSG_CHECKING([JSON functions])
if test x"$enable_json1" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -162,8 +194,12 @@ fi
AC_ARG_ENABLE(rtree, [AS_HELP_STRING(
[--enable-rtree], [include rtree support [default=yes]])],
[], [enable_rtree=yes])
AC_MSG_CHECKING([RTREE extension])
if test x"$enable_rtree" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -173,8 +209,12 @@ fi
AC_ARG_ENABLE(session, [AS_HELP_STRING(
[--enable-session], [enable the session extension [default=no]])],
[], [])
AC_MSG_CHECKING([Session extension])
if test x"$enable_session" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi
#-----------------------------------------------------------------------
@@ -184,9 +224,13 @@ fi
AC_ARG_ENABLE(debug, [AS_HELP_STRING(
[--enable-debug], [build with debugging features enabled [default=no]])],
[], [])
AC_MSG_CHECKING([Build type])
if test x"$enable_debug" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
CFLAGS="-g -O0"
AC_MSG_RESULT([debug])
else
AC_MSG_RESULT([release])
fi
#-----------------------------------------------------------------------
Vendored
+83 -20
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.35.0.
# Generated by GNU Autoconf 2.69 for sqlite 3.35.1.
#
#
# 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.35.0'
PACKAGE_STRING='sqlite 3.35.0'
PACKAGE_VERSION='3.35.1'
PACKAGE_STRING='sqlite 3.35.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -904,9 +904,9 @@ enable_debug
enable_amalgamation
enable_load_extension
enable_math
enable_all
enable_memsys5
enable_memsys3
enable_all
enable_fts3
enable_fts4
enable_fts5
@@ -1467,7 +1467,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.35.0 to adapt to many kinds of systems.
\`configure' configures sqlite 3.35.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1532,7 +1532,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.35.0:";;
short | recursive ) echo "Configuration of sqlite 3.35.1:";;
esac
cat <<\_ACEOF
@@ -1559,9 +1559,9 @@ Optional Features:
--disable-load-extension
Disable loading of external extensions
--disable-math Disable math functions
--enable-all Enable FTS4, FTS5, Geopoly, JSON, RTree, Sessions
--enable-memsys5 Enable MEMSYS5
--enable-memsys3 Enable MEMSYS3
--enable-all Enable FTS4, FTS5, Geopoly, JSON, RTree, Sessions
--enable-fts3 Enable the FTS3 extension
--enable-fts4 Enable the FTS4 extension
--enable-fts5 Enable the FTS5 extension
@@ -1660,7 +1660,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.35.0
sqlite configure 3.35.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2079,7 +2079,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.35.0, which was
It was created by sqlite $as_me 3.35.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -11251,10 +11251,16 @@ if test "${enable_debug+set}" = set; then :
enableval=$enable_debug;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build type" >&5
$as_echo_n "checking build type... " >&6; }
if test "${enable_debug}" = "yes" ; then
TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: debug" >&5
$as_echo "debug" >&6; }
else
TARGET_DEBUG="-DNDEBUG"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: release" >&5
$as_echo "release" >&6; }
fi
@@ -11490,6 +11496,16 @@ fi
fi
########
# The --enable-all argument is short-hand to enable
# multiple extensions.
# Check whether --enable-all was given.
if test "${enable_all+set}" = set; then :
enableval=$enable_all;
fi
##########
# Do we want to support memsys3 and/or memsys5
#
@@ -11524,15 +11540,6 @@ else
$as_echo "no" >&6; }
fi
########
# The --enable-extensions argument is short-hand to enable
# multiple extensions.
# Check whether --enable-all was given.
if test "${enable_all+set}" = set; then :
enableval=$enable_all;
fi
#########
# See whether we should enable Full Text Search extensions
# Check whether --enable-fts3 was given.
@@ -11540,15 +11547,26 @@ if test "${enable_fts3+set}" = set; then :
enableval=$enable_fts3;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support FTS3" >&5
$as_echo_n "checking whether to support FTS3... " >&6; }
if test "${enable_fts3}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Check whether --enable-fts4 was given.
if test "${enable_fts4+set}" = set; then :
enableval=$enable_fts4;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support FTS4" >&5
$as_echo_n "checking whether to support FTS4... " >&6; }
if test "${enable_fts4}" = "yes" -o "${enable_all}" = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log" >&5
$as_echo_n "checking for library containing log... " >&6; }
@@ -11606,13 +11624,20 @@ if test "$ac_res" != no; then :
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Check whether --enable-fts5 was given.
if test "${enable_fts5+set}" = set; then :
enableval=$enable_fts5;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support FTS5" >&5
$as_echo_n "checking whether to support FTS5... " >&6; }
if test "${enable_fts5}" = "yes" -o "${enable_all}" = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log" >&5
$as_echo_n "checking for library containing log... " >&6; }
@@ -11670,6 +11695,9 @@ if test "$ac_res" != no; then :
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -11679,8 +11707,15 @@ if test "${enable_json1+set}" = set; then :
enableval=$enable_json1;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support JSON" >&5
$as_echo_n "checking whether to support JSON... " >&6; }
if test "${enable_json1}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_JSON1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -11691,8 +11726,15 @@ if test "${enable_update_limit+set}" = set; then :
enableval=$enable_update_limit;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support LIMIT on UPDATE and DELETE statements" >&5
$as_echo_n "checking whether to support LIMIT on UPDATE and DELETE statements... " >&6; }
if test "${enable_update_limit}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -11704,9 +11746,16 @@ else
enable_geopoly=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support GEOPOLY" >&5
$as_echo_n "checking whether to support GEOPOLY... " >&6; }
if test "${enable_geopoly}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
enable_rtree=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -11716,8 +11765,15 @@ if test "${enable_rtree+set}" = set; then :
enableval=$enable_rtree;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support RTREE" >&5
$as_echo_n "checking whether to support RTREE... " >&6; }
if test "${enable_rtree}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -11727,9 +11783,16 @@ if test "${enable_session+set}" = set; then :
enableval=$enable_session;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support SESSION" >&5
$as_echo_n "checking whether to support SESSION... " >&6; }
if test "${enable_session}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION"
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
#########
@@ -12315,7 +12378,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.35.0, which was
This file was extended by sqlite $as_me 3.35.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12381,7 +12444,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.35.0
sqlite config.status 3.35.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+42 -6
View File
@@ -555,10 +555,13 @@ AC_SEARCH_LIBS(fdatasync, [rt])
#########
# check for debug enabled
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]))
AC_MSG_CHECKING([build type])
if test "${enable_debug}" = "yes" ; then
TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
AC_MSG_RESULT([debug])
else
TARGET_DEBUG="-DNDEBUG"
AC_MSG_RESULT([release])
fi
AC_SUBST(TARGET_DEBUG)
@@ -602,6 +605,13 @@ else
AC_SEARCH_LIBS(ceil, m)
fi
########
# The --enable-all argument is short-hand to enable
# multiple extensions.
AC_ARG_ENABLE(all, AC_HELP_STRING([--enable-all],
[Enable FTS4, FTS5, Geopoly, JSON, RTree, Sessions]))
##########
# Do we want to support memsys3 and/or memsys5
#
@@ -624,37 +634,47 @@ else
AC_MSG_RESULT([no])
fi
########
# The --enable-extensions argument is short-hand to enable
# multiple extensions.
AC_ARG_ENABLE(all, AC_HELP_STRING([--enable-all],
[Enable FTS4, FTS5, Geopoly, JSON, RTree, Sessions]))
#########
# See whether we should enable Full Text Search extensions
AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
[Enable the FTS3 extension]))
AC_MSG_CHECKING([whether to support FTS3])
if test "${enable_fts3}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
[Enable the FTS4 extension]))
AC_MSG_CHECKING([whether to support FTS4])
if test "${enable_fts4}" = "yes" -o "${enable_all}" = "yes" ; then
AC_MSG_RESULT([yes])
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4"
AC_SEARCH_LIBS([log],[m])
else
AC_MSG_RESULT([no])
fi
AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
[Enable the FTS5 extension]))
AC_MSG_CHECKING([whether to support FTS5])
if test "${enable_fts5}" = "yes" -o "${enable_all}" = "yes" ; then
AC_MSG_RESULT([yes])
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5"
AC_SEARCH_LIBS([log],[m])
else
AC_MSG_RESULT([no])
fi
#########
# See whether we should enable JSON1
AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],[Enable the JSON1 extension]))
AC_MSG_CHECKING([whether to support JSON])
if test "${enable_json1}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_JSON1"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#########
@@ -662,8 +682,12 @@ fi
# statements.
AC_ARG_ENABLE(update-limit, AC_HELP_STRING([--enable-update-limit],
[Enable the UPDATE/DELETE LIMIT clause]))
AC_MSG_CHECKING([whether to support LIMIT on UPDATE and DELETE statements])
if test "${enable_update_limit}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#########
@@ -671,26 +695,38 @@ fi
AC_ARG_ENABLE(geopoly, AC_HELP_STRING([--enable-geopoly],
[Enable the GEOPOLY extension]),
[enable_geopoly=yes],[enable_geopoly=no])
AC_MSG_CHECKING([whether to support GEOPOLY])
if test "${enable_geopoly}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
enable_rtree=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#########
# See whether we should enable RTREE
AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
[Enable the RTREE extension]))
AC_MSG_CHECKING([whether to support RTREE])
if test "${enable_rtree}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#########
# See whether we should enable the SESSION extension
AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
[Enable the SESSION extension]))
AC_MSG_CHECKING([whether to support SESSION])
if test "${enable_session}" = "yes" -o "${enable_all}" = "yes" ; then
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION"
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
#########
+2 -2
View File
@@ -5212,9 +5212,9 @@ static int fts3EvalNearTrim(
);
if( res ){
nNew = (int)(pOut - pPhrase->doclist.pList) - 1;
if( nNew>=0 ){
assert_fts3_nc( nNew<=pPhrase->doclist.nList && nNew>0 );
if( nNew>=0 && nNew<=pPhrase->doclist.nList ){
assert( pPhrase->doclist.pList[nNew]=='\0' );
assert( nNew<=pPhrase->doclist.nList && nNew>0 );
memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew);
pPhrase->doclist.nList = nNew;
}
+5
View File
@@ -493,6 +493,11 @@ static int getNextNode(
if( *zInput=='(' ){
int nConsumed = 0;
pParse->nNest++;
#if !defined(SQLITE_MAX_EXPR_DEPTH)
if( pParse->nNest>1000 ) return SQLITE_ERROR;
#elif SQLITE_MAX_EXPR_DEPTH>0
if( pParse->nNest>SQLITE_MAX_EXPR_DEPTH ) return SQLITE_ERROR;
#endif
rc = fts3ExprParse(pParse, zInput+1, nInput-1, ppExpr, &nConsumed);
*pnConsumed = (int)(zInput - z) + 1 + nConsumed;
return rc;
+1
View File
@@ -285,6 +285,7 @@ static int unicodeOpen(
pCsr->aInput = (const unsigned char *)aInput;
if( aInput==0 ){
pCsr->nInput = 0;
pCsr->aInput = (const unsigned char*)"";
}else if( nInput<0 ){
pCsr->nInput = (int)strlen(aInput);
}else{
+18 -19
View File
@@ -4335,27 +4335,26 @@ static int fts3IncrmergeLoad(
while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
blobGrowBuffer(&pNode->key, reader.term.n, &rc);
if( rc==SQLITE_OK ){
if( reader.term.n<=0 ){
rc = FTS_CORRUPT_VTAB;
}else{
assert_fts3_nc( reader.term.n>0 || reader.aNode==0 );
if( reader.term.n>0 ){
memcpy(pNode->key.a, reader.term.a, reader.term.n);
pNode->key.n = reader.term.n;
if( i>0 ){
char *aBlock = 0;
int nBlock = 0;
pNode = &pWriter->aNodeWriter[i-1];
pNode->iBlock = reader.iChild;
rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
blobGrowBuffer(&pNode->block,
MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
);
if( rc==SQLITE_OK ){
memcpy(pNode->block.a, aBlock, nBlock);
pNode->block.n = nBlock;
memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
}
sqlite3_free(aBlock);
}
pNode->key.n = reader.term.n;
if( i>0 ){
char *aBlock = 0;
int nBlock = 0;
pNode = &pWriter->aNodeWriter[i-1];
pNode->iBlock = reader.iChild;
rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
blobGrowBuffer(&pNode->block,
MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
);
if( rc==SQLITE_OK ){
memcpy(pNode->block.a, aBlock, nBlock);
pNode->block.n = nBlock;
memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
}
sqlite3_free(aBlock);
}
}
}
+10 -4
View File
@@ -4822,6 +4822,9 @@ static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
}
pIter->aPoslist = p;
if( &pIter->aPoslist[pIter->nPoslist]>pIter->aEof ){
pIter->aPoslist = 0;
}
}
}
@@ -4830,9 +4833,11 @@ static void fts5DoclistIterInit(
Fts5DoclistIter *pIter
){
memset(pIter, 0, sizeof(*pIter));
pIter->aPoslist = pBuf->p;
pIter->aEof = &pBuf->p[pBuf->n];
fts5DoclistIterNext(pIter);
if( pBuf->n>0 ){
pIter->aPoslist = pBuf->p;
pIter->aEof = &pBuf->p[pBuf->n];
fts5DoclistIterNext(pIter);
}
}
#if 0
@@ -5594,8 +5599,9 @@ int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){
const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){
int n;
const char *z = (const char*)fts5MultiIterTerm((Fts5Iter*)pIndexIter, &n);
assert_nc( z || n<=1 );
*pn = n-1;
return &z[1];
return (z ? &z[1] : 0);
}
/*
+7 -4
View File
@@ -2177,7 +2177,8 @@ static int fts5ApiPhraseFirst(
int n;
int rc = fts5CsrPoslist(pCsr, iPhrase, &pIter->a, &n);
if( rc==SQLITE_OK ){
pIter->b = &pIter->a[n];
assert( pIter->a || n==0 );
pIter->b = (pIter->a ? &pIter->a[n] : 0);
*piCol = 0;
*piOff = 0;
fts5ApiPhraseNext(pCtx, pIter, piCol, piOff);
@@ -2236,7 +2237,8 @@ static int fts5ApiPhraseFirstColumn(
rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n);
}
if( rc==SQLITE_OK ){
pIter->b = &pIter->a[n];
assert( pIter->a || n==0 );
pIter->b = (pIter->a ? &pIter->a[n] : 0);
*piCol = 0;
fts5ApiPhraseNextColumn(pCtx, pIter, piCol);
}
@@ -2244,7 +2246,8 @@ static int fts5ApiPhraseFirstColumn(
int n;
rc = fts5CsrPoslist(pCsr, iPhrase, &pIter->a, &n);
if( rc==SQLITE_OK ){
pIter->b = &pIter->a[n];
assert( pIter->a || n==0 );
pIter->b = (pIter->a ? &pIter->a[n] : 0);
if( n<=0 ){
*piCol = -1;
}else if( pIter->a[0]==0x01 ){
@@ -2722,7 +2725,7 @@ int sqlite3Fts5GetTokenizer(
*pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]);
}else{
rc = pMod->x.xCreate(
pMod->pUserData, &azArg[1], (nArg?nArg-1:0), &pConfig->pTok
pMod->pUserData, (azArg?&azArg[1]:0), (nArg?nArg-1:0), &pConfig->pTok
);
pConfig->pTokApi = &pMod->x;
if( rc!=SQLITE_OK ){
+1 -1
View File
@@ -211,7 +211,7 @@ static int fts5tokConnectMethod(
rc = pApi->xFindTokenizer(pApi, zModule, &pTokCtx, &pTab->tok);
if( rc==SQLITE_OK ){
const char **azArg = (const char **)&azDequote[1];
const char **azArg = (nDequote>1 ? (const char **)&azDequote[1] : 0);
int nArg = nDequote>0 ? nDequote-1 : 0;
rc = pTab->tok.xCreate(pTokCtx, azArg, nArg, &pTab->pTok);
}
File diff suppressed because it is too large Load Diff
+185 -91
View File
@@ -14,24 +14,23 @@
** appended onto the end of some other file, such as an executable.
**
** A special record must appear at the end of the file that identifies the
** file as an appended database and provides an offset to page 1. For
** best performance page 1 should be located at a disk page boundary, though
** that is not required.
** file as an appended database and provides the offset to the first page
** of the exposed content. (Or, it is the length of the content prefix.)
** For best performance page 1 should be located at a disk page boundary,
** though that is not required.
**
** When opening a database using this VFS, the connection might treat
** the file as an ordinary SQLite database, or it might treat is as a
** database appended onto some other file. Here are the rules:
** the file as an ordinary SQLite database, or it might treat it as a
** database appended onto some other file. The decision is made by
** applying the following rules in order:
**
** (1) When opening a new empty file, that file is treated as an ordinary
** database.
** (1) An empty file is an ordinary database.
**
** (2) When opening a file that begins with the standard SQLite prefix
** string "SQLite format 3", that file is treated as an ordinary
** database.
** (2) If the file ends with the appendvfs trailer string
** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database.
**
** (3) When opening a file that ends with the appendvfs trailer string
** "Start-Of-SQLite3-NNNNNNNN" that file is treated as an appended
** database.
** (3) If the file begins with the standard SQLite prefix string
** "SQLite format 3", that file is an ordinary database.
**
** (4) If none of the above apply and the SQLITE_OPEN_CREATE flag is
** set, then a new database is appended to the already existing file.
@@ -39,13 +38,13 @@
** (5) Otherwise, SQLITE_CANTOPEN is returned.
**
** To avoid unnecessary complications with the PENDING_BYTE, the size of
** the file containing the database is limited to 1GB. This VFS will refuse
** to read or write past the 1GB mark. This restriction might be lifted in
** future versions. For now, if you need a large database, then keep the
** database in a separate file.
** the file containing the database is limited to 1GB. (1000013824 bytes)
** This VFS will not read or write past the 1GB mark. This restriction
** might be lifted in future versions. For now, if you need a larger
** database, then keep it in a separate file.
**
** If the file being opened is not an appended database, then this shim is
** a pass-through into the default underlying VFS.
** If the file being opened is a plain database (not an appended one), then
** this shim is a pass-through into the default underlying VFS. (rule 3)
**/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
@@ -58,11 +57,12 @@ SQLITE_EXTENSION_INIT1
** 123456789 123456789 12345
**
** The NNNNNNNN represents a 64-bit big-endian unsigned integer which is
** the offset to page 1.
** the offset to page 1, and also the length of the prefix content.
*/
#define APND_MARK_PREFIX "Start-Of-SQLite3-"
#define APND_MARK_PREFIX_SZ 17
#define APND_MARK_SIZE 25
#define APND_MARK_FOS_SZ 8
#define APND_MARK_SIZE (APND_MARK_PREFIX_SZ+APND_MARK_FOS_SZ)
/*
** Maximum size of the combined prefix + database + append-mark. This
@@ -70,6 +70,13 @@ SQLITE_EXTENSION_INIT1
*/
#define APND_MAX_SIZE (65536*15259)
/*
** Size of storage page upon which to align appendvfs portion.
*/
#ifndef APND_ROUNDUP_BITS
#define APND_ROUNDUP_BITS 12
#endif
/*
** Forward declaration of objects used by this utility
*/
@@ -82,11 +89,39 @@ typedef struct ApndFile ApndFile;
#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData))
#define ORIGFILE(p) ((sqlite3_file*)(((ApndFile*)(p))+1))
/* An open file */
/* Invariants for an open appendvfs file:
* Once an appendvfs file is opened, it will be in one of three states:
* State 0: Never written. Underlying file (if any) is unaltered.
* State 1: Append mark is persisted, content write is in progress.
* State 2: Append mark is persisted, content writes are complete.
*
* State 0 is persistent in the sense that nothing will have been done
* to the underlying file, including any attempt to convert it to an
* appendvfs file.
*
* State 1 is normally transitory. However, if a write operation ends
* abnormally (disk full, power loss, process kill, etc.), then State 1
* may be persistent on disk with an incomplete content write-out. This
* is logically equivalent to an interrupted write to an ordinary file,
* where some unknown portion of to-be-written data is persisted while
* the remainder is not. Database integrity in such cases is maintained
* (or not) by the same measures available for ordinary file access.
*
* State 2 is persistent under normal circumstances (when there is no
* abnormal termination of a write operation such that data provided
* to the underlying VFS write method has not yet reached storage.)
*
* In order to maintain the state invariant, the append mark is written
* in advance of content writes where any part of such content would
* overwrite an existing (or yet to be written) append mark.
*/
struct ApndFile {
sqlite3_file base; /* IO methods */
sqlite3_int64 iPgOne; /* File offset to page 1 */
sqlite3_int64 iMark; /* Start of the append-mark */
/* Access to IO methods of the underlying file */
sqlite3_file base;
/* File offset to beginning of appended content (unchanging) */
sqlite3_int64 iPgOne;
/* File offset of written append-mark, or -1 if unwritten */
sqlite3_int64 iMark;
};
/*
@@ -178,8 +213,6 @@ static const sqlite3_io_methods apnd_io_methods = {
apndUnfetch /* xUnfetch */
};
/*
** Close an apnd-file.
*/
@@ -197,22 +230,37 @@ static int apndRead(
int iAmt,
sqlite_int64 iOfst
){
ApndFile *p = (ApndFile *)pFile;
ApndFile *paf = (ApndFile *)pFile;
pFile = ORIGFILE(pFile);
return pFile->pMethods->xRead(pFile, zBuf, iAmt, iOfst+p->iPgOne);
return pFile->pMethods->xRead(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
}
/*
** Add the append-mark onto the end of the file.
** Add the append-mark onto what should become the end of the file.
* If and only if this succeeds, internal ApndFile.iMark is updated.
* Parameter iWriteEnd is the appendvfs-relative offset of the new mark.
*/
static int apndWriteMark(ApndFile *p, sqlite3_file *pFile){
int i;
static int apndWriteMark(
ApndFile *paf,
sqlite3_file *pFile,
sqlite_int64 iWriteEnd
){
sqlite_int64 iPgOne = paf->iPgOne;
unsigned char a[APND_MARK_SIZE];
int i = APND_MARK_FOS_SZ;
int rc;
assert(pFile == ORIGFILE(paf));
memcpy(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ);
for(i=0; i<8; i++){
a[APND_MARK_PREFIX_SZ+i] = (p->iPgOne >> (56 - i*8)) & 0xff;
while (--i >= 0) {
a[APND_MARK_PREFIX_SZ+i] = (unsigned char)(iPgOne & 0xff);
iPgOne >>= 8;
}
return pFile->pMethods->xWrite(pFile, a, APND_MARK_SIZE, p->iMark);
iWriteEnd += paf->iPgOne;
if( SQLITE_OK==(rc = pFile->pMethods->xWrite
(pFile, a, APND_MARK_SIZE, iWriteEnd)) ){
paf->iMark = iWriteEnd;
}
return rc;
}
/*
@@ -224,38 +272,30 @@ static int apndWrite(
int iAmt,
sqlite_int64 iOfst
){
int rc;
ApndFile *p = (ApndFile *)pFile;
ApndFile *paf = (ApndFile *)pFile;
sqlite_int64 iWriteEnd = iOfst + iAmt;
if( iWriteEnd>=APND_MAX_SIZE ) return SQLITE_FULL;
pFile = ORIGFILE(pFile);
if( iOfst+iAmt>=APND_MAX_SIZE ) return SQLITE_FULL;
rc = pFile->pMethods->xWrite(pFile, zBuf, iAmt, iOfst+p->iPgOne);
if( rc==SQLITE_OK && iOfst + iAmt + p->iPgOne > p->iMark ){
sqlite3_int64 sz = 0;
rc = pFile->pMethods->xFileSize(pFile, &sz);
if( rc==SQLITE_OK ){
p->iMark = sz - APND_MARK_SIZE;
if( iOfst + iAmt + p->iPgOne > p->iMark ){
p->iMark = p->iPgOne + iOfst + iAmt;
rc = apndWriteMark(p, pFile);
}
}
/* If append-mark is absent or will be overwritten, write it. */
if( paf->iMark < 0 || paf->iPgOne + iWriteEnd > paf->iMark ){
int rc = apndWriteMark(paf, pFile, iWriteEnd);
if( SQLITE_OK!=rc )
return rc;
}
return rc;
return pFile->pMethods->xWrite(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
}
/*
** Truncate an apnd-file.
*/
static int apndTruncate(sqlite3_file *pFile, sqlite_int64 size){
int rc;
ApndFile *p = (ApndFile *)pFile;
ApndFile *paf = (ApndFile *)pFile;
pFile = ORIGFILE(pFile);
rc = pFile->pMethods->xTruncate(pFile, size+p->iPgOne+APND_MARK_SIZE);
if( rc==SQLITE_OK ){
p->iMark = p->iPgOne+size;
rc = apndWriteMark(p, pFile);
}
return rc;
/* The append mark goes out first so truncate failure does not lose it. */
if( SQLITE_OK!=apndWriteMark(paf, pFile, size) )
return SQLITE_IOERR;
/* Truncate underlying file just past append mark */
return pFile->pMethods->xTruncate(pFile, paf->iMark+APND_MARK_SIZE);
}
/*
@@ -268,16 +308,12 @@ static int apndSync(sqlite3_file *pFile, int flags){
/*
** Return the current file-size of an apnd-file.
** If the append mark is not yet there, the file-size is 0.
*/
static int apndFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
ApndFile *p = (ApndFile *)pFile;
int rc;
pFile = ORIGFILE(p);
rc = pFile->pMethods->xFileSize(pFile, pSize);
if( rc==SQLITE_OK && p->iPgOne ){
*pSize -= p->iPgOne + APND_MARK_SIZE;
}
return rc;
ApndFile *paf = (ApndFile *)pFile;
*pSize = ( paf->iMark >= 0 )? (paf->iMark - paf->iPgOne) : 0;
return SQLITE_OK;
}
/*
@@ -308,12 +344,13 @@ static int apndCheckReservedLock(sqlite3_file *pFile, int *pResOut){
** File control method. For custom operations on an apnd-file.
*/
static int apndFileControl(sqlite3_file *pFile, int op, void *pArg){
ApndFile *p = (ApndFile *)pFile;
ApndFile *paf = (ApndFile *)pFile;
int rc;
pFile = ORIGFILE(pFile);
if( op==SQLITE_FCNTL_SIZE_HINT ) *(sqlite3_int64*)pArg += paf->iPgOne;
rc = pFile->pMethods->xFileControl(pFile, op, pArg);
if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){
*(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", p->iPgOne, *(char**)pArg);
*(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne,*(char**)pArg);
}
return rc;
}
@@ -372,6 +409,8 @@ static int apndFetch(
void **pp
){
ApndFile *p = (ApndFile *)pFile;
if( p->iMark < 0 || iOfst+iAmt > p->iMark)
return SQLITE_IOERR; /* Cannot read what is not yet there. */
pFile = ORIGFILE(pFile);
return pFile->pMethods->xFetch(pFile, iOfst+p->iPgOne, iAmt, pp);
}
@@ -383,40 +422,79 @@ static int apndUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
return pFile->pMethods->xUnfetch(pFile, iOfst+p->iPgOne, pPage);
}
/*
** Check to see if the file is an ordinary SQLite database file.
*/
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
int rc;
char zHdr[16];
static const char aSqliteHdr[] = "SQLite format 3";
if( sz<512 ) return 0;
rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0);
if( rc ) return 0;
return memcmp(zHdr, aSqliteHdr, sizeof(zHdr))==0;
}
/*
** Try to read the append-mark off the end of a file. Return the
** start of the appended database if the append-mark is present. If
** there is no append-mark, return -1;
** start of the appended database if the append-mark is present.
** If there is no valid append-mark, return -1;
**
** An append-mark is only valid if the NNNNNNNN start-of-database offset
** indicates that the appended database contains at least one page. The
** start-of-database value must be a multiple of 512.
*/
static sqlite3_int64 apndReadMark(sqlite3_int64 sz, sqlite3_file *pFile){
int rc, i;
sqlite3_int64 iMark;
int msbs = 8 * (APND_MARK_FOS_SZ-1);
unsigned char a[APND_MARK_SIZE];
if( sz<=APND_MARK_SIZE ) return -1;
if( APND_MARK_SIZE!=(sz & 0x1ff) ) return -1;
rc = pFile->pMethods->xRead(pFile, a, APND_MARK_SIZE, sz-APND_MARK_SIZE);
if( rc ) return -1;
if( memcmp(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ)!=0 ) return -1;
iMark = ((sqlite3_int64)(a[APND_MARK_PREFIX_SZ]&0x7f))<<56;
for(i=1; i<8; i++){
iMark += (sqlite3_int64)a[APND_MARK_PREFIX_SZ+i]<<(56-8*i);
iMark = ((sqlite3_int64)(a[APND_MARK_PREFIX_SZ] & 0x7f)) << msbs;
for(i=1; i<8; i++){
msbs -= 8;
iMark |= (sqlite3_int64)a[APND_MARK_PREFIX_SZ+i]<<msbs;
}
if( iMark > (sz - APND_MARK_SIZE - 512) ) return -1;
if( iMark & 0x1ff ) return -1;
return iMark;
}
static const char apvfsSqliteHdr[] = "SQLite format 3";
/*
** Check to see if the file is an appendvfs SQLite database file.
** Return true iff it is such. Parameter sz is the file's size.
*/
static int apndIsAppendvfsDatabase(sqlite3_int64 sz, sqlite3_file *pFile){
int rc;
char zHdr[16];
sqlite3_int64 iMark = apndReadMark(sz, pFile);
if( iMark>=0 ){
/* If file has right end-marker, the expected odd size, and the
* SQLite DB type marker where the end-marker puts it, then it
* is an appendvfs database (to be treated as such.)
*/
rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), iMark);
if( SQLITE_OK==rc && memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))==0
&& (sz & 0x1ff)== APND_MARK_SIZE && sz>=512+APND_MARK_SIZE )
return 1; /* It's an appendvfs database */
}
return 0;
}
/*
** Check to see if the file is an ordinary SQLite database file.
** Return true iff so. Parameter sz is the file's size.
*/
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
char zHdr[16];
if( apndIsAppendvfsDatabase(sz, pFile) /* rule 2 */
|| (sz & 0x1ff) != 0
|| SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
|| memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0
){
return 0;
}else{
return 1;
}
}
/* Round-up used to get appendvfs portion to begin at a page boundary. */
#define APND_ALIGN_MASK(nbits) ((1<<nbits)-1)
#define APND_START_ROUNDUP(fsz, nbits) \
( ((fsz)+APND_ALIGN_MASK(nbits)) & ~(sqlite3_int64)APND_ALIGN_MASK(nbits) )
/*
** Open an apnd file handle.
*/
@@ -434,6 +512,7 @@ static int apndOpen(
sqlite3_int64 sz;
pSubVfs = ORIGVFS(pVfs);
if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){
/* The appendvfs is not to be used for transient or temporary databases. */
return pSubVfs->xOpen(pSubVfs, zName, pFile, flags, pOutFlags);
}
p = (ApndFile*)pFile;
@@ -451,27 +530,42 @@ static int apndOpen(
memmove(pFile, pSubFile, pSubVfs->szOsFile);
return SQLITE_OK;
}
p->iMark = 0;
/* Record that append mark has not been written until seen otherwise. */
p->iMark = -1;
p->iPgOne = apndReadMark(sz, pFile);
if( p->iPgOne>0 ){
if( p->iPgOne>=0 ){
/* Append mark was found, infer its offset */
p->iMark = sz - p->iPgOne - APND_MARK_SIZE;
return SQLITE_OK;
}
if( (flags & SQLITE_OPEN_CREATE)==0 ){
pSubFile->pMethods->xClose(pSubFile);
rc = SQLITE_CANTOPEN;
}
p->iPgOne = (sz+0xfff) & ~(sqlite3_int64)0xfff;
/* Round newly added appendvfs location to #define'd page boundary.
* Note that nothing has yet been written to the underlying file.
* The append mark will be written along with first content write.
* Until then, the p->iMark value indicates it is not yet written.
*/
p->iPgOne = APND_START_ROUNDUP(sz, APND_ROUNDUP_BITS);
apnd_open_done:
if( rc ) pFile->pMethods = 0;
return rc;
}
/*
** All other VFS methods are pass-thrus.
** Delete an apnd file.
** For an appendvfs, this could mean delete the appendvfs portion,
** leaving the appendee as it was before it gained an appendvfs.
** For now, this code deletes the underlying file too.
*/
static int apndDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
return ORIGVFS(pVfs)->xDelete(ORIGVFS(pVfs), zPath, dirSync);
}
/*
** All other VFS methods are pass-thrus.
*/
static int apndAccess(
sqlite3_vfs *pVfs,
const char *zPath,
+8
View File
@@ -167,6 +167,14 @@ static void ieee754func(
int isNeg = 0;
m = sqlite3_value_int64(argv[0]);
e = sqlite3_value_int64(argv[1]);
/* Limit the range of e. Ticket 22dea1cfdb9151e4 2021-03-02 */
if( e>10000 ){
e = 10000;
}else if( e<-10000 ){
e = -10000;
}
if( m<0 ){
isNeg = 1;
m = -m;
+15 -10
View File
@@ -550,18 +550,23 @@ int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
** is not the case, this function returns [SQLITE_MISUSE].
**
** If argument pzTab is not NULL, then *pzTab is set to point to a
** nul-terminated utf-8 encoded string containing the name of the table
** affected by the current change. The buffer remains valid until either
** sqlite3changeset_next() is called on the iterator or until the
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
** set to the number of columns in the table affected by the change. If
** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
** outputs are set through these pointers:
**
** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
** depending on the type of change that the iterator currently points to;
**
** *pnCol is set to the number of columns in the table affected by the change; and
**
** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
** the name of the table affected by the current change. The buffer remains
** valid until either sqlite3changeset_next() is called on the iterator
** or until the conflict-handler function returns.
**
** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect
** changes. Finally, if pOp is not NULL, then *pOp is set to one of
** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
** type of change that the iterator currently points to.
** changes.
**
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
** SQLite error code is returned. The values of the output variables may not
+4 -1
View File
@@ -146,7 +146,10 @@ static int SQLITE_TCLAPI test_sql_exec_changeset(
static int test_tcl_integer(Tcl_Interp *interp, const char *zVar){
Tcl_Obj *pObj;
int iVal = 0;
pObj = Tcl_ObjGetVar2(interp, Tcl_NewStringObj(zVar, -1), 0, TCL_GLOBAL_ONLY);
Tcl_Obj *pName = Tcl_NewStringObj(zVar, -1);
Tcl_IncrRefCount(pName);
pObj = Tcl_ObjGetVar2(interp, pName, 0, TCL_GLOBAL_ONLY);
Tcl_DecrRefCount(pName);
if( pObj ) Tcl_GetIntFromObj(0, pObj, &iVal);
return iVal;
}
+2 -1
View File
@@ -360,6 +360,7 @@ TESTSRC = \
#
TESTSRC += \
$(TOP)/ext/misc/amatch.c \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/carray.c \
$(TOP)/ext/misc/cksumvfs.c \
$(TOP)/ext/misc/closure.c \
@@ -954,7 +955,7 @@ fuzztest: fuzzcheck$(EXE) $(FUZZDATA) sessionfuzz$(EXE) $(TOP)/test/sessionfuzz-
./sessionfuzz run $(TOP)/test/sessionfuzz-data1.db
valgrindfuzz: fuzzcheck$(EXE) $(FUZZDATA) sessionfuzz$(EXE) $(TOP)/test/sessionfuzz-data1.db
valgrind ./fuzzcheck$(EXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA)
valgrind ./fuzzcheck$(EXE) --cell-size-check --limit-mem 10M $(FUZZDATA)
valgrind ./sessionfuzz run $(TOP)/test/sessionfuzz-data1.db
# The veryquick.test TCL tests.
+73 -73
View File
@@ -1,13 +1,13 @@
C Attempt\sto\soptimize\s"x\sIS\sNULL"\sand\s"x\sIS\sNOT\sNULL"\sexpressions\swhen\sx\sis\sa\scolumn\swith\sa\sNOT\sNULL\sconstraint.
D 2021-02-26T20:14:32.131
C Add\stests\sfor\ssqlite_rename_quotefix().\sFix\sa\smemory\sleak\sin\sthe\ssame.
D 2021-03-16T18:24:49.563
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in 9cae1bffe5cb811216bf7425395e7fc0594daa2ce31f625835a9d0c3fb25315f
F Makefile.in fe6cc1db11e02b308f3ab0ec2504344697b9eaaa410fa73f48d16a143462e5d3
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc ad07bbd645132533e1fd7164a03acfa9afecda378b3787c10f62ab4c7c45e6ea
F Makefile.msc 6b5428cef2af1288e02faeb602dabe68fbf2de7bc8a8e29c7299778ee08cd35c
F README.md 1514a365ffca3c138e00c5cc839906108a01011a6b082bad19b09781e3aa498a
F VERSION 92f3e4c5cdee6f0779aef1eae857dfc21d0eabb1f2af169dc90e63cd76b15bb2
F VERSION 370d0120d7353c276a7c1ff568347d937267543bd54883f9efe0d859df7f7079
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
@@ -15,10 +15,10 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am a8d1d24affe52ebf8d7ddcf91aa973fa0316618ab95bb68c87cabf8faf527dc8
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F autoconf/Makefile.msc e0f1dafc48d000fd6ddfdb01815271528db55cbc7299ca888df5b93367f0d5a4
F autoconf/Makefile.msc ebe7e66edbb2f453593cbde186d1a0fa0dcd8cae9977febcae27aef1dab5678d
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1
F autoconf/configure.ac 55be6fc04a5b030b367fe317b72dc8c0eafc4713991fe6182cf647b02fb782cb
F autoconf/configure.ac a8ba2a9e61216f5093d44f3b7d2cb8fe1890d6b7dc330a02f802d8efaa1fdc79
F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
@@ -34,8 +34,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6
F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc
F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559
F configure 91893a81f698778dda4d8fb24bfca606ded31ef02bcfbc2ab072d30fb67138d6 x
F configure.ac 412b65c6107e41c098ad7f5f2e6a3f74ac02ffc6e92b9a6264b9f1060c235a04
F configure bdf7d9a9192514a07ab2e56eaf927729ea548cfabee3eac080079492014fbfce x
F configure.ac 4e4b58b32f88c8da9914a2f2c3158f80e69907eccc019fcc7e3ba14ffd91c640
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
F doc/lemon.html 1bb72ece6271df0d901d233551dd985f2c6ba30d09382cf2d321ed951ab57491
@@ -84,11 +84,11 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 4809e0b05af4519ad8bfa13d684f7ad635d1390a758299d2302f7e85c48ec160
F ext/fts3/fts3.c 7b449348226a91cc851fe969f5c1932d4f00c359a32fd17f2afea92bf875147b
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 045179f538c478ced266ca14327269cde8ad8d573c5be902230a5ebaa5636c59
F ext/fts3/fts3_aux.c 96708c8b3a7d9b8ca1b68ea2b7e503e283f20e95f145becadedfad096dbd0f34
F ext/fts3/fts3_expr.c f081e38da641724cd72c20e23b71db2bf4d0c9517c14637442f6910259f11a34
F ext/fts3/fts3_expr.c 5853cd7a35a79d193614add9b4c461b2d56f465d90899ca4309f05d9d1536558
F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116
@@ -100,9 +100,9 @@ F ext/fts3/fts3_tokenize_vtab.c 8d15b148e7d88a4280389a200b26e8d52abda4c4ec2e9a35
F ext/fts3/fts3_tokenizer.c 6d8fc150c48238955d5182bf661498db0dd473c8a2a80e00c16994a646fa96e7
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 4b9af6151c29b35ed09574937083cece7c31e911f69615e168a39677569b684d
F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c 3b5df74d6563df46f90103a84630613a9fdb782ed93161470df2186e8e906d8c
F ext/fts3/fts3_write.c a5159accfd88f85fd3fc2298286d7a9427a02d1ea9a52b7c79730cff7a0bc03f
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
@@ -119,12 +119,12 @@ F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6
F ext/fts5/fts5_config.c be54f44fca491e96c6923a4b9a736f2da2b13811600eb6e38d1bcc91c4ea2e61
F ext/fts5/fts5_expr.c 016bd06030679bd31b0f07ef87d62c42031e5da25cb3174a84e5b0f6ef4b47b0
F ext/fts5/fts5_hash.c 1aa93c9b5f461afba66701ee226297dc78402b3bdde81e90a10de5fe3df14959
F ext/fts5/fts5_index.c acbe3ccd36f5a7373009dfff02a11c4a817af73bc3ef8c340f2105d7d073f8b4
F ext/fts5/fts5_main.c b4e4931c7fcc9acfa0c3b8b5e5e80b5b424b8d9207aae3a22b674bd35ccf149d
F ext/fts5/fts5_index.c df5e18b705ac601e826576298a5ce23ef1e5d417fbfdb3feb5f702f89e5f6f41
F ext/fts5/fts5_main.c d77648a52b8d73d13887306149912e420f7e0b2d7b3d7da2f54152bfa140ac02
F ext/fts5/fts5_storage.c 58ba71e6cd3d43a5735815e7956ee167babb4d2cbfe206905174792af4d09d75
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c f96c6e193c466711d6d7828d5f190407fe7ab897062d371426dd3036f01258e7
F ext/fts5/fts5_test_tok.c a2bed8edb25f6432e8cdb62aad5916935c19dba8dac2b8324950cfff397e25ff
F ext/fts5/fts5_tokenize.c 5e251efb0f1af99a25ed50010ba6b1ad1250aca5921af1988fdcabe5ebc3cb43
F ext/fts5/fts5_unicode2.c eca63dbc797f8ff0572e97caf4631389c0ab900d6364861b915bdd4735973f00
F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80
@@ -160,7 +160,7 @@ F ext/fts5/test/fts5connect.test 08030168fc96fc278fa81f28654fb7e90566f33aff269c0
F ext/fts5/test/fts5content.test 213506436fb2c87567b8e31f6d43ab30aab99354cec74ed679f22aad0cdbf283
F ext/fts5/test/fts5corrupt.test 77ae6f41a7eba10620efb921cf7dbe218b0ef232b04519deb43581cb17a57ebe
F ext/fts5/test/fts5corrupt2.test 7453752ba12ce91690c469a6449d412561cc604b1dec994e16ab132952e7805f
F ext/fts5/test/fts5corrupt3.test 5df97f353102f0078d0bb418d620652d03460ee1cceb2992a3b5ee6fb619b24e
F ext/fts5/test/fts5corrupt3.test 1cad09897fc69084a904c921dee7f777e1c866964ee2ec2cc7a8a69cc3f1ab68
F ext/fts5/test/fts5corrupt4.test f4c08e2182a48d8b70975fd869ee5391855c06d8a0ff87b6a2529e7c5a88a1d3
F ext/fts5/test/fts5delete.test 619295b20dbc1d840b403ee07c878f52378849c3c02e44f2ee143b3e978a0aa7
F ext/fts5/test/fts5detail.test 31b240dbf6d44ac3507e2f8b65f29fdc12465ffd531212378c7ce1066766f54e
@@ -286,7 +286,7 @@ F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f607
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 55121d311d408ba9c62c3cfa367408887638f02f9522dd9859891d0ee69a7eba
F ext/misc/appendvfs.c 7fff57cd4a5d63758d20a1dd1a96c64c7c123cf48fd98bbd36cfe8b063236e3d
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
F ext/misc/carray.c b75a0f207391038bf1540d3372f482a95c3613511c7c474db51ede1196321c7c
@@ -304,7 +304,7 @@ F ext/misc/explain.c 0086fab288d4352ea638cf40ac382aad3b0dc5e845a1ea829a694c015fd
F ext/misc/fileio.c 9b69e25da3b51d4a1d905a464ccb96709792ad627a742ba09215bc0d1447e7bd
F ext/misc/fossildelta.c 1240b2d3e52eab1d50c160c7fe1902a9bd210e052dc209200a750bbf885402d5
F ext/misc/fuzzer.c eae560134f66333e9e1ca4c8ffea75df42056e2ce8456734565dbe1c2a92bf3d
F ext/misc/ieee754.c 5c7ca326361c7368f95f5743972eade3b8b24f60359ed7cba4706668a5682896
F ext/misc/ieee754.c cd6ab89f85fda8a020559b3f4d03001a8a62dd856beda5af3f558621d12be913
F ext/misc/json1.c f31e89171f932d1821c91f10d2cb4979fc0447030030a8bce70420cd43d074c0
F ext/misc/memstat.c 3017a0832c645c0f8c773435620d663855f04690172316bd127270d1a7523d4d
F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b
@@ -456,15 +456,15 @@ F ext/session/sessionrebase.test ccfa716b23bd1d3b03217ee58cfd90c78d4b99f53e6a9a2
F ext/session/sessionstat1.test 218d351cf9fcd6648f125a26b607b140310160184723c2666091b54450a68fb5
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3session.c a7c5ac1acfe21d94b37921b29b0458d64d022a66b282338eee4aafa9c018cb1c
F ext/session/sqlite3session.h f53c99731882bf59c7362855cdeba176ce1fe8eeba089e38a8cce0172f8473aa
F ext/session/test_session.c 93ca965112d2b4d9d669c9c0be6b1e52942a268796050a145612df1eee175ce0
F ext/session/sqlite3session.h f48662626e7a3176a188787a0bd360933dd46cccd98df01c208b02051c540fb7
F ext/session/test_session.c 90ccf1c30c857bd2fb3f6c990163e8f389ddbdbdc7fa5baa2f6f5f287df41c08
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
F main.mk 443a4ec1ca89ad267cbde45dadc68861154b99c7bd26e7b7dc74303a664002b8
F main.mk c6afb1c8bcacc4c3e320ab10259879bc927f0747401e184b64e8f4b78f057ab2
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@@ -476,17 +476,17 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c d5fd529509880eade9ea59ddb24a56e9fe0579ee7f2e9e18bac62b7bd05b3a10
F src/alter.c 842bb68d8fe651a9c997a30ca212f892b9f293a1e6446d748aa2de6e78345f15
F src/analyze.c 01c6c6765cb4d40b473b71d85535093730770bb186f2f473abac25f07fcdee5c
F src/attach.c 9cbe761e464025694df8e6f6ee4d9f41432c3a255ca9443ccbb4130eeb87cf72
F src/auth.c 08954fdc4cc2da5264ba5b75cfd90b67a6fc7d1710a02ccf917c38eadec77853
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 694020ad8a3af3d79b09f74c8f1421272a419cdea42a13401e3b0f7dea6e9c3e
F src/btree.h 285f8377aa1353185a32bf455faafa9ff9a0d40d074d60509534d14990c7829e
F src/btree.c bafa3a2e8b6622a3aa8791f90c8ecc70e8ae551ba9023f865213890f5b8a8994
F src/btree.h 096cc53baa58be22b02c896d1cf933c38cfc6d65f9253c1367ece8cc88a24de5
F src/btreeInt.h 7614cae30f95b6aed0c7cac7718276a55cfe2c77058cbfd8bef5b75329757331
F src/build.c e1790f21cd19708af231ceed5e52f495b94c4b2609e27d2b5ce2805a9aa3464e
F src/build.c fec73c39d756f31d35ccbaa80fe1e040a8d675a318d4d30f41c444167bf3b860
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 2a322b9a3d75771fb4d99e0702851f4f68dda982507a0f798eefb0712969a410
@@ -494,7 +494,7 @@ F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c 73f57a9a183532c344a3135cf8f2a5589376e39183e0b5f562d6b61b2af0f4d8
F src/expr.c 6793c836aff149b14011ad546ae1648a18573779ee78f5a7d375f2a3047e8c8e
F src/expr.c d681f0b48b1e16173ad8e1e8f7323cda120a0c517cb7a3d5b329c4e2c57f18bd
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c e9063648396c58778f77583a678342fe4a9bc82436bf23c5f9f444f2df0fdaa4
F src/func.c 479f6929be027eb0210cbdde9d3529c012facf082d64a6b854a9415940761e5e
@@ -506,7 +506,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 8942baede303a54ba3b6d06200d5b74c9bc25ababec8a55823e06309748cd4a3
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 8c9c8cd2bd8eecdb06d9b6e89de7e9e65bae45cc8fc33609cc74023a5c296067
F src/main.c 1c5de7b3fabcdf05f4fe563aab5d81d175b89c67a8678a12ba86629356afa356
F src/main.c 2a7ece3a67c646e5fe9984ffe0277d6a76f80ce9715bf2faa591d8cb66b9d913
F src/malloc.c c1af4ac5a463648cd2953fd4ac679b3ba9022ce5ec794a60806150ad69dfd33a
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -514,7 +514,7 @@ F src/mem2.c b93b8762ab999a29ae7751532dadf0a1ac78040308a5fb1d17fcc365171d67eb
F src/mem3.c 30301196cace2a085cbedee1326a49f4b26deff0af68774ca82c1f7c06fda4f6
F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944
F src/memdb.c ab0632d42407e866d2b616bd19d4211ac0ad1b430f04c4e187d60005b8700b98
F src/memjournal.c bb0533253ad4a9657c29742d8504b6813c8367ccf135c0fb553d786850a55ea9
F src/memjournal.c 431c70a111223a8a6e2e7e9f014afc6c88d818d357d866afc563195f2277d50e
F src/msvc.h 3a15918220367a8876be3fa4f2abe423a861491e84b864fb2b7426bf022a28f8
F src/mutex.c 5e3409715552348732e97b9194abe92fdfcd934cfb681df4ba0ab87ac6c18d25
F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a
@@ -531,28 +531,28 @@ F src/os_win.c 77d39873836f1831a9b0b91894fec45ab0e9ca8e067dc8c549e1d1eca1566fe9
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 970691daea03f9f15e34de671bd8675c1e136232b529e21bfd36d4dba6d41753
F src/pager.h 4bf9b3213a4b2bebbced5eaa8b219cf25d4a82f385d093cd64b7e93e5285f66f
F src/parse.y f3e8d7978c10495850c0bb502fe2669b55cf2841c4670b1f7261782e82069471
F src/parse.y 2107aff88e361bbf8388fdede3fed20fda875f23ba7585ec83b20e3e16a95670
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
F src/pragma.c 6daaaecc26a4b09481d21722525b079ce756751a43a79cc1d8f122d686806193
F src/pcache1.c 388304fd2d91c39591080b5e0f3c62cfba87db20370e7e0554062bfb29740e9f
F src/pragma.c eb42cb9bec189cf18cef5d8fcae56e13bb73ef2b019b198fb48740ced81bce95
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/prepare.c f634a9e799a6b1c136d8ee12479cffa22862bfb807d307b1db406aa0cdb042a5
F src/printf.c 10e61ec79dd9d41fdc77afee4e0df04fbb427f309c043118fe0b26a7d7db488a
F src/prepare.c e21b54489b5c73b06ada15e6fc79b5c6f64b06701924a6ca98944ae59e06256f
F src/printf.c 2b03a80d7c11bb422115dca175a18bf430e9c9dbaa0eee63b758f0c022f8f34f
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 2272b62c9f20cd6628c1d19963c4f96e41297b50cdfeffdcc47fcfded6a607d7
F src/resolve.c d95db73d3e6a5c689e5f6604b4d2521350e45f2a0f0f84f5a2dc2bfee56580a0
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 7cf048e52f678726dadc448c41fab40262f6da37eeb1d8ff0f14ef1b17feed9e
F src/shell.c.in 844417f84df1f6c4fce1c815629a888cfdcf219e86513e9c332bbcc38832f477
F src/sqlite.h.in 8855a19f37ade8dad189a9e48233a2ebe1b46faf469c7eb0906a654e252dcc57
F src/select.c fc904a7aa7ebfd5c7a57a0141d829c9f5388ac7773e0d1d9668768c1bbc87fc3
F src/shell.c.in 8df3912a7ca4873a1443d4adef1b25baee8c086ab479fd9c4f13ab03f98049ab
F src/sqlite.h.in 3426a080ea1f222a73e3bd91e7eacbd30570a0117c03d42c6dde606f33e5e318
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 61b38c073d5e1e96a3d45271b257aef27d0d13da2bea5347692ae579475cd95e
F src/sqliteInt.h 11b9d47e9b9520b123bc75254da7a4e215463e811e62b89518fc5e9a192a0222
F src/sqliteInt.h 3652edb9e6032808d51d6f26d9c6f9eb621ac199e0fd2d2a5aa551799d91a296
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 986b6391f02cd9b53c1d688be55899f6ffddeb8e8014cd83c1b73ff912579a71
F src/test1.c 2197966d2f7211ef9eefaa6c3c7dd2c7d786d1f33f2aadef2f08c8c79eceec26
F src/test1.c cff43d8e21be543b77651b4d2caf49bd6488fee220f8540ecd9f71d13169dbd1
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F src/test4.c 7c4420e01c577b5c4add2cb03119743b1a357543d347773b9e717195ea967159
@@ -614,7 +614,7 @@ F src/upsert.c df8f1727d62b5987c4fd302cd4d7c0c84ae57cd65683c5a34a740dfe24039235
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c 41c7a72da1df47864faa378a1c720b38adb288c6838cb6be5594511b6287a048
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
F src/vdbe.c d8d2f2a1247bada7db7acf1f4ae65088bc09f020f4acf15810ef67f4aabe1ce9
F src/vdbe.c b79b222f07690874d436eef4ad5e76845b2796e7094b1d0545cc94333f0d8e50
F src/vdbe.h 25dabb25c7e157b84e59260cfb5b466c3ac103ede9f36f4db371332c47601abe
F src/vdbeInt.h 3df118924e1711f1bbc8e30c46260d0ab6c3b029b32dd411f789111f76434f3c
F src/vdbeapi.c 4a43e303ec3354c785f453e881521969378e85628278ab74ba4a9df790c0d93b
@@ -629,11 +629,11 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c d42d6c80ea363ef689a462e65eefcfe87deab924c50de5baa37ecb6af7d7ddaa
F src/where.c a02138440d7230493b5e508664d629f3e1e7615737a5d83aac3a2955d3a654ff
F src/where.c 10d06b16670a1d2a992d52a9f08e49426d38a08fb0a7ae5f7f62fd023d560e1e
F src/whereInt.h 446e5e8018f83358ef917cf32d8e6a86dc8430113d0b17e720f1839d3faa44c4
F src/wherecode.c e57a8690311a75d06e723e8d379f9831de04aba300e07174d236e32a7f9c7a13
F src/whereexpr.c 5bbce43bc16b8e53cd670bbbb0a8583296b1d1517303abe94a770d9d792413a8
F src/window.c fdf01316f6cecf060378aa1713a29e527ab683823ba7d15b8978ec70165e8bdb
F src/whereexpr.c 53452fe2fb07be2f4cb17f55cc721416fae0092c00717f106faf289c990b6494
F src/window.c 7e89ac4b6cd6bb9b7772234a625d19c39b530f4ac06e43688a8b7e6a1ab512a2
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
F test/affinity3.test eecb0dabee4b7765a8465439d5e99429279ffba23ca74a7eae270a452799f9e7
@@ -641,21 +641,22 @@ F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 2f65ec8132e0ca896de550b9908094d49ad65a99116a9d79deeb6017604ad4f6
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13
F test/alter.test 25e109787dc5e631e117eb6e1c57f96a572bb51228db3b4f8b5f41d665e2ccaa
F test/alter.test f53d8a4ecd35f051c07e54a36beec5d0a30d30a9d98bc723f6cde6afbfb3c5ca
F test/alter2.test a966ccfcddf9ce0a4e0e6ff1aca9e6e7948e0e242cd7e43fc091948521807687
F test/alter3.test e487958dec7932453e0b83baf21d6b1e71d5e7d9a55bc20eadfa62a51ddffc29
F test/alter4.test dfd6086faf461b27ca2d2999848dcd207edf23352fc1592d0005c0844f3f08cf
F test/alterauth.test 63442ba61ceb0c1eeb63aac1f4f5cebfa509d352276059d27106ae256bafc959
F test/alterauth2.test 794ac5cef251819fe364b4fe20f12f86e9c5d68070513c7fd26c17cb244c89af
F test/altercol.test 1d6a6fe698b81e626baea4881f5717f9bc53d7d07f1cd23ee7ad1b931f117ddf
F test/alterauth2.test 381b1ab603c9ef96314a3158528ea17f7964449385a28eeaf8191120b2e24a8d
F test/altercol.test 91f4eb0023d90beee000c06d45f521e07a2444d013b83381c62e88d5f209560f
F test/altercorrupt.test 584d707a80e106952d6382790c8919bcf9f0db678ed3a1c09fd98b7f9d1d3a10
F test/alterdropcol.test baad37ff9b07078ea02dcc33dbfb82bde655f3eee5c453e218f69501c36f02ba
F test/alterdropcol2.test 3948c805ca52f4621051b35968c18c09d107eb117e2b656c78cee3b2870650c0
F test/alterdropcol.test 596623cb8a72d9570bfb8417b0f302810efe007873796f03c17a9e9ff28dade1
F test/alterdropcol2.test 527fce683b200d620f560f666c44ae33e22728e990a10a48a543280dfd4b4d41
F test/alterlegacy.test f38c6d06cda39e1f7b955bbce57f2e3ef5b7cb566d3d1234502093e228c15811
F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74a3fb80c9
F test/altermalloc2.test fa7b1c1139ea39b8dec407cf1feb032ca8e0076bd429574969b619175ad0174b
F test/altermalloc3.test 2c7bbd8cf3e9c4a91e28675bb62bcc2ef70f227967fa74349f03d9f4642f0615
F test/altertab.test 6d7bbac2c4a6ef71b775094a3298fa3a92274d95034ee23157ffba92768e47e6
F test/altermalloc3.test 7a21b042413c3e9571af4f583e327a6961ec2b7a34eae57a530f89b236a46a72
F test/alterqf.test 67568ad152db8c1187b15633b801242cf960f1beafc51261a3d1725d910baeb2
F test/altertab.test 7691872aadfe00a94b459af9086504bcf399dd936336e486da1b182930744b77
F test/altertab2.test b0d62f323ca5dab42b0bc028c52e310ebdd13e655e8fac070fe622bad7852c2b
F test/altertab3.test 2b82fa2236a3a91553d53ae5555d8e723c7eec174c41f1fa62ff497355398479
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
@@ -682,7 +683,7 @@ F test/atof1.test 10049623e77006691c4c2978c1dc8a3f75276377a53417811aa85bda7493f9
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
F test/atrc.c c388fac43dbba05c804432a7135ae688b32e8f25818e9994ffba4b64cf60c27c
F test/attach.test d42862c72fef3d54367d962d41dcfb5363442a4a1bd898c22ae950cea1aa0dd3
F test/attach.test 54f8e49e88d0de48f6428267a678465863d2b8f72320612f35bd5c02e240bc2f
F test/attach2.test 256bd240da1835fb8408dd59fb7ef71f8358c7a756c46662434d11d07ba3a0ce
F test/attach3.test c59d92791070c59272e00183b7353eeb94915976
F test/attach4.test aa05b1d8218b24eba5a7cccf4f224f514ba57ba705c9267f09d2bb63fed0eea1
@@ -699,6 +700,7 @@ F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf
F test/autoindex5.test a5d72fe8c217cc0ea356dc6fa06a282a8a3fc53aa807709d79dba07a8f248102
F test/autovacuum.test 0831cd34e14695d297187f7f6519265e3121c5b0a1720e548e86829e796129e9
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
F test/avfs.test 67a27e590b1baae5249bc857d10814a13231dbe2d624c64f2aa78c4ba85afff9
F test/avtrans.test b7dc25459ecbd86c6fa9c606ee3068f59d81e225118617dcf2bbb6ded2ade89e
F test/backcompat.test 3e64cedda754c778ef6bbe417b6e7a295e662a4d
F test/backup.test dd4a5ff756e3df3931dacb1791db0584d4bad989
@@ -854,7 +856,7 @@ F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 235c610f8bf8ec44513e222b9085c7e49fad65ad0c1975ac2577109dd06fd8fa
F test/e_dropview.test 74e405df7fa0f762e0c9445b166fe03955856532e2bb234c372f7c51228d75e7
F test/e_expr.test 6ba7a51ece7b3e7fc145f14f924eed25ebb5a24e7b8596c78f3838d372cf0385
F test/e_fkey.test 0b458b85f192cdb9e9933d5891848bb19bcc44d3f49faf111a375f2844a164d3
F test/e_fkey.test a2907f749cccd0b2c30d8576b673002eebdcc1fc9964bae61e5117b1d54733e2
F test/e_fts3.test 17ba7c373aba4d4f5696ba147ee23fd1a1ef70782af050e03e262ca187c5ee07
F test/e_insert.test f02f7f17852b2163732c6611d193f84fc67bc641fb4882c77a464076e5eba80e
F test/e_reindex.test 2b0e29344497d9a8a999453a003cb476b6b1d2eef2d6c120f83c2d3a429f3164
@@ -970,7 +972,7 @@ F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c788
F test/fts3corrupt3.test 0d5b69a0998b4adf868cc301fc78f3d0707745f1d984ce044c205cdb764b491f
F test/fts3corrupt4.test b71512ec391d39da96d60d01959e4e9f20d4237a964a94abcf5f5a2ad28378c1
F test/fts3corrupt5.test 0549f85ec4bd22e992f645f13c59b99d652f2f5e643dac75568bfd23a6db7ed5
F test/fts3corrupt6.test b6c55218b704b0cef224b284c756f9c55d0afd0b3c3837618bffeaa8c31e0d8e
F test/fts3corrupt6.test d5896a8d389bd824457772dc1e2d2023cd5c5cf8e42733607b5d632103018d8b
F test/fts3cov.test 7eacdbefd756cfa4dc2241974e3db2834e9b372ca215880e00032222f32194cf
F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f
F test/fts3defer.test f4c20e4c7153d20a98ee49ee5f3faef624fefc9a067f8d8d629db380c4d9f1de
@@ -1044,7 +1046,7 @@ F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c
F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
F test/fuzz_common.tcl b7197de6ed1ee8250a4f82d67876f4561b42ee8cbbfc6160dcb66331bad3f830
F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
F test/fuzzcheck.c 95427205d6cedb8fdb95bf7738e95785c790febf782d9c1e6067baaa1adc871d
F test/fuzzcheck.c 8f83829e6c4da26abf6aded7fe9f04e56d46a418c8d7b8b67e14cf6f2ee0a25c
F test/fuzzdata1.db d36e88741b4f23bcbaaf55b006290669d03c6c891cf13c7b3a53bc1b097b693f
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -1052,10 +1054,10 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4
F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5
F test/fuzzdata6.db 92a80e4afc172c24f662a10a612d188fb272de4a9bd19e017927c95f737de6d7
F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2
F test/fuzzdata8.db 977cb95f4a5d828056dea804a6de416debe3fa0182c77f47fe19a0554aaf4db0
F test/fuzzdata8.db c8325de6fbdd24d030cd3a01384a2ff325dda5d5e3ff5d531a26ada3d9d7e010
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c
F test/gencol1.test b05e6c5edb9b10d48efb634ed07342441bddc89d225043e17095c36e567521a0
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
@@ -1093,7 +1095,7 @@ F test/index6.test f172653b35b20233e59200e8b92a76db61bf7285437bf777b93b306ba26a4
F test/index7.test b8a0ba2110fd517bb48c4e76d26d60f1ab2ed9e257b18d71f820d7e71e9f8570
F test/index8.test bc2e3db70e8e62459aaa1bd7e4a9b39664f8f9d7
F test/index9.test 0aa3e509dddf81f93380396e40e9bb386904c1054924ba8fa9bcdfe85a8e7721
F test/indexedby.test f54aac21c06948872010a956fd02de5178c362c7785a9887cf0b8616be17883b
F test/indexedby.test a3ca11f0819a9279619099f36b624bcaa315f7a1ed65c3ed2219c2a944683d2c
F test/indexexpr1.test 284e119999d132cc8bf37735a928c9859b28e8e295d02b7a6a4f93977c7f9ba5
F test/indexexpr2.test dba11dbb0a58fcba4cd694f46b4004976123b81b0501f525d43c9be59f0207b1
F test/indexfault.test 98d78a8ff1f5335628b62f886a1cb7c7dac1ef6d48fa39c51ec871c87dce9811
@@ -1144,7 +1146,7 @@ F test/lemon-test01.y 58b764610fd934e189ffbb0bbfa33d171b9cb06019b55bdc04d090d676
F test/like.test 0b7b4765ca59d95a1f92dfab9e4d810c9fb8280b5edd6332a01340a20db9e0ed
F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da
F test/like3.test 03d1bdf848483b78d2cfd1db283d75c4ec2e37c8b8eccc006813f3978d78fbbd
F test/limit.test 0c99a27a87b14c646a9d583c7c89fd06c352663e
F test/limit.test 350f5d03c29e7dff9a2cde016f84f8d368d40bcd02fa2b2a52fa10c4bf3cbfaf
F test/limit2.test 9409b033284642a859fafc95f29a5a6a557bd57c1f0d7c3f554bd64ed69df77e
F test/loadext.test faa4f6eed07a5aac35d57fdd7bc07f8fc82464cfd327567c10cf0ba3c86cde04
F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7
@@ -1224,7 +1226,8 @@ F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934
F test/notnull.test a37b663d5bb728d66fc182016613fb8e4a0a4bbf3d75b8876a7527f7d4ed3f18
F test/notnull2.test a5fb3d643322e5471117c7c1d70e6f116134bca84378a4ea92d021cc6a989d0d
F test/notnull2.test 965a893619751255e59c911a8c58504b3174a3788b1458b7c7365b232209711b
F test/notnullfault.test 6126e31300632070ca6021698393c7fcf61ab4791bc2aa1d6d704242c0fcd4f8
F test/null.test b7ff206a1c60fe01aa2abd33ef9ea83c93727d993ca8a613de86e925c9f2bc6f
F test/nulls1.test 82c5bc33148405f21205865abf13c786084438d573a4ac4e87e11b6091cde526
F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1
@@ -1261,7 +1264,7 @@ F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035c
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 661a4325a5717957a77836910ee164ba26594a502d7a3df0e1ae7b9cba829c5d
F test/permutations.test 0a7cf0b6b1283cdd4f0d6e31cb7afbde81d20b1caef60b73914e85b6bf660b8a
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 50b91bedea9324d3ab48e793f908ee7d2c7dcf84bfa2281e792838be59641ec8
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1280,7 +1283,7 @@ F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a
F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8
F test/quote.test 3f9238ab0e1db70dea89af9afa5859dbd759b0ce0a63da67d547553e2c316475
F test/quote.test b8ddaba6b81dcf63bb31243219e28a2f96e04396adc50108cc7e5593019c3eb5
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
@@ -1290,10 +1293,10 @@ F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/releasetest.tcl fb76d8fcc95ac29d6356cd9e52b726ab9e43a24082897618dfbcb7c2b0049153 x
F test/releasetest_data.tcl d60628b6a04891e97cc4f5fbce08abe13c5b74cb23dcca5ac24800471a3bc6db
F test/releasetest_data.tcl 3d41ddb3f04f474ac9d925485da24ce6576ff0ebc4c7201c8a340bc09846c261
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/returning1.test 684e1c73d961422a7376c932fcdd6dacf02bad21d12f749cfe8c19991ef379f6
F test/returning1.test 209b910c132cb2015bb1159f852c7124778004963c09095c42c3d2442110c56c
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
F test/rollback2.test bc868d57899dc6972e2b4483faae0e03365a0556941474eec487ae21d8d38bb6
F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
@@ -1675,7 +1678,7 @@ F test/vacuum6.test d3173a54edc81d13d99e4cf4972232b3cbb52f1d56ed48c3a939ef4e751c
F test/vacuummem.test 7b42abb3208bd82dd23a7536588396f295a314f2
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
F test/view.test fd48eddb32a35a98c3de70062ebac66ebf4a2bbfc75a1cc1109159ef8bfc47a9
F test/view.test ea88361d5e9bc8eabf9f573185a16aea73a885be9b6c6a95ae84908913416a80
F test/vtab1.test c5d9e90ed02bcacd776dcbb7360199d290f7f53c26b484ddece543060c54319f
F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082
F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e
@@ -1698,7 +1701,7 @@ F test/vtab_alter.test 736e66fb5ec7b4fee58229aa3ada2f27ec58bc58c00edae4836890c37
F test/vtab_err.test dcc8b7b9cb67522b3fe7a272c73856829dae4ab7fdb30399aea1b6981bda2b65
F test/vtab_shared.test 5253bff2355a9a3f014c15337da7e177ab0ef8ad
F test/vtabdrop.test 65d4cf6722972e5499bdaf0c0d70ee3b8133944a4e4bc31862563f32a7edca12
F test/wal.test 16180bc4becda176428ad02eaea437b4b8f5ae099314de443a4e12b2dcc007a2
F test/wal.test b7cc6984709f54afbf8441747ced1f646af120bf0c1b1d847bfa39306fbea089
F test/wal2.test 31f6e2c404b9f2cdf9ca19b105a1742fdc19653c2c936da39e3658c617524046
F test/wal3.test 2a93004bc0fb2b5c29888964024695bade278ab2
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
@@ -1780,7 +1783,7 @@ F test/window8.tcl f2711aa3571e4e6b0dad98db8d95fd6cb8d9db0c92bbdf535f153b07606a1
F test/window8.test c4331b27a6f66d69fa8f8bab10cc731db1a81d293ae108a68f7c3487fa94e65b
F test/window9.test 4d8c875b73febdbac9b8f2b52ec132b98f48261cdafd6b08db62bc6d8ff913fc
F test/windowA.test 6d63dc1260daa17141a55007600581778523a8b420629f1282d2acfc36af23be
F test/windowB.test 7a983ea1cc1cf72be7f378e4b32f6cb2d73014c5cd8b25aaee825164cd4269e5
F test/windowB.test 6e601f8178ba8ba28b2f19e74fe613815084bb4a8d2ad942defc7d42e191e521
F test/windowerr.tcl f5acd6fbc210d7b5546c0e879d157888455cd4a17a1d3f28f07c1c8a387019e0
F test/windowerr.test a8b752402109c15aa1c5efe1b93ccb0ce1ef84fa964ae1cd6684dd0b3cc1819b
F test/windowfault.test d543d46571b32d19f198cb04b6505747fabf3cc369970daae47074ee793612be
@@ -1908,10 +1911,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 310dac342e7b1f9b5a5df6a9d598e85d5fef59bba9307d9230baf77c8f2351a2
R 5da9c9b015e5cf6e85f36d061ac9c73d
T *branch * ifnull-opt
T *sym-ifnull-opt *
T -sym-trunk *
P 6446c0961077396086251670102ea7bf17d54a6b0f0ca56c6af89028a1ff9039
R b66159d3defa695ee162d96725abba18
U dan
Z 9cbe82fbe7c5328bb13207c38d4a331e
Z c919991679b7a45f0f2c00ac17619d54
+1 -1
View File
@@ -1 +1 @@
5ecd842555009ce27ee6390325ac5c2504143474b12b730933f0833b3dad788a
531550056c38589c99c9a97b6afdbf8f34ff8d2131d74e9d42af3506e8045064
+221 -43
View File
@@ -53,7 +53,8 @@ static void renameTestSchema(
Parse *pParse, /* Parse context */
const char *zDb, /* Name of db to verify schema of */
int bTemp, /* True if this is the temp db */
const char *zWhen /* "when" part of error message */
const char *zWhen, /* "when" part of error message */
int bNoDQS /* Do not allow DQS in the schema */
){
pParse->colNamesSet = 1;
sqlite3NestedParse(pParse,
@@ -61,9 +62,9 @@ static void renameTestSchema(
"FROM \"%w\"." DFLT_SCHEMA_TABLE " "
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'"
" AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
" AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL ",
zDb,
zDb, bTemp, zWhen
zDb, bTemp, zWhen, bNoDQS
);
if( bTemp==0 ){
@@ -72,8 +73,32 @@ static void renameTestSchema(
"FROM temp." DFLT_SCHEMA_TABLE " "
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'"
" AND sqlite_rename_test(%Q, sql, type, name, 1, %Q)=NULL ",
zDb, zWhen
" AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL ",
zDb, zWhen, bNoDQS
);
}
}
/*
** Generate VM code to replace any double-quoted strings (but not double-quoted
** identifiers) within the "sql" column of the sqlite_schema table in
** database zDb with their single-quoted equivalents. If argument bTemp is
** not true, similarly update all SQL statements in the sqlite_schema table
** of the temp db.
*/
static void renameFixQuotes(Parse *pParse, const char *zDb, int bTemp){
sqlite3NestedParse(pParse,
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE
" SET sql = sqlite_rename_quotefix(%Q, sql)"
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'" , zDb, zDb
);
if( bTemp==0 ){
sqlite3NestedParse(pParse,
"UPDATE temp." DFLT_SCHEMA_TABLE
" SET sql = sqlite_rename_quotefix('temp', sql)"
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'"
);
}
}
@@ -236,7 +261,7 @@ void sqlite3AlterRenameTable(
"sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
"tbl_name = "
"CASE WHEN tbl_name=%Q COLLATE nocase AND "
" sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
" sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) "
"THEN %Q ELSE tbl_name END "
"WHERE type IN ('view', 'trigger')"
, zDb, zTabName, zName, zTabName, zDb, zName);
@@ -256,7 +281,7 @@ void sqlite3AlterRenameTable(
#endif
renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
renameTestSchema(pParse, zDb, iDb==1, "after rename");
renameTestSchema(pParse, zDb, iDb==1, "after rename", 0);
exit_rename_table:
sqlite3SrcListDelete(db, pSrc);
@@ -595,6 +620,10 @@ void sqlite3AlterRenameColumn(
goto exit_rename_column;
}
/* Ensure the schema contains no double-quoted strings */
renameTestSchema(pParse, zDb, iSchema==1, "", 0);
renameFixQuotes(pParse, zDb, iSchema==1);
/* Do the rename operation using a recursive UPDATE statement that
** uses the sqlite_rename_column() SQL function to compute the new
** CREATE statement text for the sqlite_schema table.
@@ -624,7 +653,7 @@ void sqlite3AlterRenameColumn(
/* Drop and reload the database schema. */
renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
renameTestSchema(pParse, zDb, iSchema==1, "after rename");
renameTestSchema(pParse, zDb, iSchema==1, "after rename", 1);
exit_rename_column:
sqlite3SrcListDelete(db, pSrc);
@@ -1109,47 +1138,75 @@ static int renameEditSql(
int nSql = sqlite3Strlen30(zSql);
sqlite3 *db = sqlite3_context_db_handle(pCtx);
int rc = SQLITE_OK;
char *zQuot;
char *zQuot = 0;
char *zOut;
int nQuot;
char *zBuf1 = 0;
char *zBuf2 = 0;
/* Set zQuot to point to a buffer containing a quoted copy of the
** identifier zNew. If the corresponding identifier in the original
** ALTER TABLE statement was quoted (bQuote==1), then set zNew to
** point to zQuot so that all substitutions are made using the
** quoted version of the new column name. */
zQuot = sqlite3MPrintf(db, "\"%w\"", zNew);
if( zQuot==0 ){
return SQLITE_NOMEM;
if( zNew ){
/* Set zQuot to point to a buffer containing a quoted copy of the
** identifier zNew. If the corresponding identifier in the original
** ALTER TABLE statement was quoted (bQuote==1), then set zNew to
** point to zQuot so that all substitutions are made using the
** quoted version of the new column name. */
zQuot = sqlite3MPrintf(db, "\"%w\"", zNew);
if( zQuot==0 ){
return SQLITE_NOMEM;
}else{
nQuot = sqlite3Strlen30(zQuot);
}
if( bQuote ){
zNew = zQuot;
nNew = nQuot;
}
assert( nQuot>=nNew );
zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1);
}else{
nQuot = sqlite3Strlen30(zQuot);
}
if( bQuote ){
zNew = zQuot;
nNew = nQuot;
zOut = (char*)sqlite3DbMallocZero(db, (nSql*2+1) * 3);
if( zOut ){
zBuf1 = &zOut[nSql*2+1];
zBuf2 = &zOut[nSql*4+2];
}
}
/* At this point pRename->pList contains a list of RenameToken objects
** corresponding to all tokens in the input SQL that must be replaced
** with the new column name. All that remains is to construct and
** return the edited SQL string. */
assert( nQuot>=nNew );
zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1);
** with the new column name, or with single-quoted versions of themselves.
** All that remains is to construct and return the edited SQL string. */
if( zOut ){
int nOut = nSql;
memcpy(zOut, zSql, nSql);
while( pRename->pList ){
int iOff; /* Offset of token to replace in zOut */
RenameToken *pBest = renameColumnTokenNext(pRename);
u32 nReplace;
const char *zReplace;
if( sqlite3IsIdChar(*pBest->t.z) ){
nReplace = nNew;
zReplace = zNew;
RenameToken *pBest = renameColumnTokenNext(pRename);
if( zNew ){
if( sqlite3IsIdChar(*pBest->t.z) ){
nReplace = nNew;
zReplace = zNew;
}else{
nReplace = nQuot;
zReplace = zQuot;
}
}else{
nReplace = nQuot;
zReplace = zQuot;
/* Dequote the double-quoted token. Then requote it again, this time
** using single quotes. If the character immediately following the
** original token within the input SQL was a single quote ('), then
** add another space after the new, single-quoted version of the
** token. This is so that (SELECT "string"'alias') maps to
** (SELECT 'string' 'alias'), and not (SELECT 'string''alias'). */
memcpy(zBuf1, pBest->t.z, pBest->t.n);
zBuf1[pBest->t.n] = 0;
sqlite3Dequote(zBuf1);
sqlite3_snprintf(nSql*2, zBuf2, "%Q%s", zBuf1,
pBest->t.z[pBest->t.n]=='\'' ? " " : ""
);
zReplace = zBuf2;
nReplace = sqlite3Strlen30(zReplace);
}
iOff = pBest->t.z - zSql;
@@ -1241,9 +1298,8 @@ static int renameResolveTrigger(Parse *pParse){
rc = sqlite3ResolveExprListNames(&sNC, pStep->pExprList);
}
assert( !pStep->pUpsert || (!pStep->pWhere && !pStep->pExprList) );
if( pStep->pUpsert ){
if( pStep->pUpsert && rc==SQLITE_OK ){
Upsert *pUpsert = pStep->pUpsert;
assert( rc==SQLITE_OK );
pUpsert->pUpsertSrc = pSrc;
sNC.uNC.pUpsert = pUpsert;
sNC.ncFlags = NC_UUpsert;
@@ -1430,12 +1486,12 @@ static void renameColumnFunc(
for(pIdx=sParse.pNewIndex; pIdx; pIdx=pIdx->pNext){
sqlite3WalkExprList(&sWalker, pIdx->aColExpr);
}
}
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
for(i=0; i<sParse.pNewTable->nCol; i++){
sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt);
}
for(i=0; i<sParse.pNewTable->nCol; i++){
sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt);
}
#endif
}
for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){
for(i=0; i<pFKey->nCol; i++){
@@ -1695,6 +1751,119 @@ static void renameTableFunc(
return;
}
static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_STRING && (pExpr->flags & EP_DblQuoted) ){
renameTokenFind(pWalker->pParse, pWalker->u.pRename, (void*)pExpr);
}
return WRC_Continue;
}
/*
** The implementation of an SQL scalar function that rewrites DDL statements
** so that any string literals that use double-quotes are modified so that
** they use single quotes.
**
** Two arguments must be passed:
**
** 0: Database name ("main", "temp" etc.).
** 1: SQL statement to edit.
**
** The returned value is the modified SQL statement. For example, given
** the database schema:
**
** CREATE TABLE t1(a, b, c);
**
** SELECT sqlite_rename_quotefix('main',
** 'CREATE VIEW v1 AS SELECT "a", "string" FROM t1'
** );
**
** returns the string:
**
** CREATE VIEW v1 AS SELECT "a", 'string' FROM t1
*/
static void renameQuotefixFunc(
sqlite3_context *context,
int NotUsed,
sqlite3_value **argv
){
sqlite3 *db = sqlite3_context_db_handle(context);
char const *zDb = (const char*)sqlite3_value_text(argv[0]);
char const *zInput = (const char*)sqlite3_value_text(argv[1]);
#ifndef SQLITE_OMIT_AUTHORIZATION
sqlite3_xauth xAuth = db->xAuth;
db->xAuth = 0;
#endif
sqlite3BtreeEnterAll(db);
UNUSED_PARAMETER(NotUsed);
if( zDb && zInput ){
int rc;
Parse sParse;
rc = renameParseSql(&sParse, zDb, db, zInput, 0);
if( rc==SQLITE_OK ){
RenameCtx sCtx;
Walker sWalker;
/* Walker to find tokens that need to be replaced. */
memset(&sCtx, 0, sizeof(RenameCtx));
memset(&sWalker, 0, sizeof(Walker));
sWalker.pParse = &sParse;
sWalker.xExprCallback = renameQuotefixExprCb;
sWalker.xSelectCallback = renameColumnSelectCb;
sWalker.u.pRename = &sCtx;
if( sParse.pNewTable ){
Select *pSelect = sParse.pNewTable->pSelect;
if( pSelect ){
pSelect->selFlags &= ~SF_View;
sParse.rc = SQLITE_OK;
sqlite3SelectPrep(&sParse, pSelect, 0);
rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
if( rc==SQLITE_OK ){
sqlite3WalkSelect(&sWalker, pSelect);
}
}else{
int i;
sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck);
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
for(i=0; i<sParse.pNewTable->nCol; i++){
sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt);
}
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
}
}else if( sParse.pNewIndex ){
sqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr);
sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
}else{
#ifndef SQLITE_OMIT_TRIGGER
rc = renameResolveTrigger(&sParse);
if( rc==SQLITE_OK ){
renameWalkTrigger(&sWalker, sParse.pNewTrigger);
}
#endif /* SQLITE_OMIT_TRIGGER */
}
if( rc==SQLITE_OK ){
rc = renameEditSql(context, &sCtx, zInput, 0, 0);
}
renameTokenFree(db, sCtx.pList);
}
if( rc!=SQLITE_OK ){
sqlite3_result_error_code(context, rc);
}
renameParseCleanup(&sParse);
}
#ifndef SQLITE_OMIT_AUTHORIZATION
db->xAuth = xAuth;
#endif
sqlite3BtreeLeaveAll(db);
}
/*
** An SQL user function that checks that there are no parse or symbol
** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement.
@@ -1708,6 +1877,7 @@ static void renameTableFunc(
** 3: Object name.
** 4: True if object is from temp schema.
** 5: "when" part of error message.
** 6: True to disable the DQS quirk when parsing SQL.
**
** Unless it finds an error, this function normally returns NULL. However, it
** returns integer value 1 if:
@@ -1726,6 +1896,7 @@ static void renameTableTest(
int bTemp = sqlite3_value_int(argv[4]);
int isLegacy = (db->flags & SQLITE_LegacyAlter);
char const *zWhen = (const char*)sqlite3_value_text(argv[5]);
int bNoDQS = sqlite3_value_int(argv[6]);
#ifndef SQLITE_OMIT_AUTHORIZATION
sqlite3_xauth xAuth = db->xAuth;
@@ -1733,10 +1904,14 @@ static void renameTableTest(
#endif
UNUSED_PARAMETER(NotUsed);
if( zDb && zInput ){
int rc;
Parse sParse;
int flags = db->flags;
if( bNoDQS ) db->flags &= ~(SQLITE_DqsDML|SQLITE_DqsDDL);
rc = renameParseSql(&sParse, zDb, db, zInput, bTemp);
db->flags |= (flags & (SQLITE_DqsDML|SQLITE_DqsDDL));
if( rc==SQLITE_OK ){
if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
NameContext sNC;
@@ -1803,10 +1978,11 @@ static void dropColumnFunc(
db->xAuth = 0;
#endif
UNUSED_PARAMETER(NotUsed);
rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
if( rc!=SQLITE_OK ) goto drop_column_done;
pTab = sParse.pNewTable;
if( pTab->nCol==1 || iCol>=pTab->nCol ){
if( pTab==0 || pTab->nCol==1 || iCol>=pTab->nCol ){
/* This can happen if the sqlite_schema table is corrupt */
rc = SQLITE_CORRUPT_BKPT;
goto drop_column_done;
@@ -1896,7 +2072,8 @@ void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
assert( iDb>=0 );
zDb = db->aDb[iDb].zDbSName;
renameTestSchema(pParse, zDb, iDb==1, "");
renameTestSchema(pParse, zDb, iDb==1, "", 0);
renameFixQuotes(pParse, zDb, iDb==1);
sqlite3NestedParse(pParse,
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
"sql = sqlite_drop_column(%d, sql, %d) "
@@ -1906,7 +2083,7 @@ void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
/* Drop and reload the database schema. */
renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
renameTestSchema(pParse, zDb, iDb==1, "after drop column");
renameTestSchema(pParse, zDb, iDb==1, "after drop column", 1);
/* Edit rows of table on disk */
if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
@@ -1966,8 +2143,9 @@ void sqlite3AlterFunctions(void){
static FuncDef aAlterTableFuncs[] = {
INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
INTERNAL_FUNCTION(sqlite_rename_test, 6, renameTableTest),
INTERNAL_FUNCTION(sqlite_rename_test, 7, renameTableTest),
INTERNAL_FUNCTION(sqlite_drop_column, 3, dropColumnFunc),
INTERNAL_FUNCTION(sqlite_rename_quotefix,2, renameQuotefixFunc),
};
sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
}
+6 -6
View File
@@ -7637,7 +7637,9 @@ static int balance_nonroot(
}
pgno = get4byte(pRight);
while( 1 ){
rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
if( rc==SQLITE_OK ){
rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
}
if( rc ){
memset(apOld, 0, (i+1)*sizeof(MemPage*));
goto balance_cleanup;
@@ -7676,12 +7678,10 @@ static int balance_nonroot(
if( pBt->btsFlags & BTS_FAST_SECURE ){
int iOff;
/* If the following if() condition is not true, the db is corrupted.
** The call to dropCell() below will detect this. */
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
if( (iOff+szNew[i])>(int)pBt->usableSize ){
rc = SQLITE_CORRUPT_BKPT;
memset(apOld, 0, (i+1)*sizeof(MemPage*));
goto balance_cleanup;
}else{
if( (iOff+szNew[i])<=(int)pBt->usableSize ){
memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
}
+1 -1
View File
@@ -262,7 +262,7 @@ int sqlite3BtreeDelete(BtCursor*, u8 flags);
#define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
#define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
#define BTREE_APPEND 0x08 /* Insert is likely an append */
#define BTREE_PREFORMAT 0x80 /* Insert is likely an append */
#define BTREE_PREFORMAT 0x80 /* Inserted data is a preformated cell */
/* An instance of the BtreePayload object describes the content of a single
** entry in either an index or table btree.
+2 -1
View File
@@ -1325,6 +1325,7 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){
pRet->pReturnEL = pList;
sqlite3ParserAddCleanup(pParse,
(void(*)(sqlite3*,void*))sqlite3DeleteReturning, pRet);
testcase( pParse->earlyCleanup );
if( db->mallocFailed ) return;
pRet->retTrig.zName = RETURNING_TRIGGER_NAME;
pRet->retTrig.op = TK_RETURNING;
@@ -4863,7 +4864,7 @@ int sqlite3OpenTempDatabase(Parse *pParse){
static void sqlite3CodeVerifySchemaAtToplevel(Parse *pToplevel, int iDb){
assert( iDb>=0 && iDb<pToplevel->db->nDb );
assert( pToplevel->db->aDb[iDb].pBt!=0 || iDb==1 );
assert( iDb<SQLITE_MAX_ATTACHED+2 );
assert( iDb<SQLITE_MAX_DB );
assert( sqlite3SchemaMutexHeld(pToplevel->db, iDb, 0) );
if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
DbMaskSet(pToplevel->cookieMask, iDb);
+1 -1
View File
@@ -2585,7 +2585,7 @@ int sqlite3FindInIndex(
/* Code an OP_Transaction and OP_TableLock for <table>. */
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
assert( iDb>=0 && iDb<SQLITE_MAX_ATTACHED );
assert( iDb>=0 && iDb<SQLITE_MAX_DB );
sqlite3CodeVerifySchema(pParse, iDb);
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
+7 -3
View File
@@ -2374,7 +2374,7 @@ int sqlite3_wal_checkpoint_v2(
return SQLITE_OK;
#else
int rc; /* Return code */
int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
int iDb; /* Schema to checkpoint */
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
@@ -2397,6 +2397,8 @@ int sqlite3_wal_checkpoint_v2(
sqlite3_mutex_enter(db->mutex);
if( zDb && zDb[0] ){
iDb = sqlite3FindDbName(db, zDb);
}else{
iDb = SQLITE_MAX_DB; /* This means process all schemas */
}
if( iDb<0 ){
rc = SQLITE_ERROR;
@@ -2445,7 +2447,7 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
** associated with the specific b-tree being checkpointed is taken by
** this function while the checkpoint is running.
**
** If iDb is passed SQLITE_MAX_ATTACHED, then all attached databases are
** If iDb is passed SQLITE_MAX_DB then all attached databases are
** checkpointed. If an error is encountered it is returned immediately -
** no attempt is made to checkpoint any remaining databases.
**
@@ -2460,9 +2462,11 @@ int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){
assert( sqlite3_mutex_held(db->mutex) );
assert( !pnLog || *pnLog==-1 );
assert( !pnCkpt || *pnCkpt==-1 );
testcase( iDb==SQLITE_MAX_ATTACHED ); /* See forum post a006d86f72 */
testcase( iDb==SQLITE_MAX_DB );
for(i=0; i<db->nDb && rc==SQLITE_OK; i++){
if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){
if( i==iDb || iDb==SQLITE_MAX_DB ){
rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt);
pnLog = 0;
pnCkpt = 0;
+1 -1
View File
@@ -267,7 +267,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){
iOff += p->nChunkSize;
}
if( pIter ){
if( ALWAYS(pIter) ){
memjrnlFreeChunks(pIter->pNext);
pIter->pNext = 0;
}
+13 -3
View File
@@ -497,11 +497,21 @@ cmd ::= select(X). {
static void parserDoubleLinkSelect(Parse *pParse, Select *p){
assert( p!=0 );
if( p->pPrior ){
Select *pNext = 0, *pLoop;
int mxSelect, cnt = 0;
for(pLoop=p; pLoop; pNext=pLoop, pLoop=pLoop->pPrior, cnt++){
Select *pNext = 0, *pLoop = p;
int mxSelect, cnt = 1;
while(1){
pLoop->pNext = pNext;
pLoop->selFlags |= SF_Compound;
pNext = pLoop;
pLoop = pLoop->pPrior;
if( pLoop==0 ) break;
cnt++;
if( pLoop->pOrderBy || pLoop->pLimit ){
sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
pLoop->pOrderBy!=0 ? "ORDER BY" : "LIMIT",
sqlite3SelectOpName(pNext->op));
break;
}
}
if( (p->selFlags & SF_MultiValue)==0 &&
(mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 &&
+1
View File
@@ -461,6 +461,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
p->page.pExtra = &p[1];
p->isBulkLocal = 0;
p->isAnchor = 0;
p->pLruPrev = 0; /* Initializing this saves a valgrind error */
}
(*pCache->pnPurgeable)++;
return p;
+1 -1
View File
@@ -1969,7 +1969,7 @@ void sqlite3Pragma(
** Checkpoint the database.
*/
case PragTyp_WAL_CHECKPOINT: {
int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
int iBt = (pId2->z?iDb:SQLITE_MAX_DB);
int eMode = SQLITE_CHECKPOINT_PASSIVE;
if( zRight ){
if( sqlite3StrICmp(zRight, "full")==0 ){
+9 -1
View File
@@ -589,13 +589,21 @@ void sqlite3ParserReset(Parse *pParse){
** sqlite3ParserReset(), which reduces the total CPU cycle count.
**
** If a memory allocation error occurs, then the cleanup happens immediately.
** When eithr SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the
** When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the
** pParse->earlyCleanup flag is set in that case. Calling code show verify
** that test cases exist for which this happens, to guard against possible
** use-after-free errors following an OOM. The preferred way to do this is
** to immediately follow the call to this routine with:
**
** testcase( pParse->earlyCleanup );
**
** This routine returns a copy of its pPtr input (the third parameter)
** except if an early cleanup occurs, in which case it returns NULL. So
** another way to check for early cleanup is to check the return value.
** Or, stop using the pPtr parameter with this call and use only its
** return value thereafter. Something like this:
**
** pObj = sqlite3ParserAddCleanup(pParse, destructor, pObj);
*/
void *sqlite3ParserAddCleanup(
Parse *pParse, /* Destroy when this Parser finishes */
+1 -1
View File
@@ -921,7 +921,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
}else{
char *zOld = isMalloced(p) ? p->zText : 0;
i64 szNew = p->nChar;
szNew += N + 1;
szNew += (sqlite3_int64)N + 1;
if( szNew+p->nChar<=p->mxAlloc ){
/* Force exponential buffer size growth as long as it does not overflow,
** to avoid having to call this routine too often */
+20 -13
View File
@@ -417,6 +417,7 @@ static int lookupName(
}
if( iCol<pTab->nCol ){
cnt++;
pMatch = 0;
#ifndef SQLITE_OMIT_UPSERT
if( pExpr->iTable==EXCLUDED_TABLE_NUMBER ){
testcase( iCol==(-1) );
@@ -435,8 +436,8 @@ static int lookupName(
pExpr->y.pTab = pTab;
if( pParse->bReturning ){
eNewExprOp = TK_REGISTER;
pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
+ iCol + 1;
pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable +
sqlite3TableColumnToStorage(pTab, iCol) + 1;
}else{
pExpr->iColumn = (i16)iCol;
eNewExprOp = TK_TRIGGER;
@@ -636,11 +637,13 @@ static int lookupName(
lookupname_end:
if( cnt==1 ){
assert( pNC!=0 );
#ifndef SQLITE_OMIT_AUTHORIZATION
if( pParse->db->xAuth
&& (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)
){
sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
}
#endif
/* Increment the nRef value on all name contexts from TopNC up to
** the point where the name matched. */
for(;;){
@@ -785,16 +788,19 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
break;
}
/* An "<expr> IS NOT NULL" or "<expr> IS NULL". After resolving the
** LHS, check if there is a NOT NULL constraint in the schema that
** means the value of the expression can be determined immediately.
** If that is the case, replace the current expression node with
** a TK_TRUEFALSE node.
/* An optimization: Attempt to convert
**
** If the node is replaced with a TK_TRUEFALSE node, then also restore
** the NameContext ref-counts to the state they where in before the
** LHS expression was resolved. This prevents the current select
** from being erroneously marked as correlated in some cases.
** "expr IS NOT NULL" --> "TRUE"
** "expr IS NULL" --> "FALSE"
**
** if we can prove that "expr" is never NULL. Call this the
** "NOT NULL strength reduction optimization".
**
** If this optimization occurs, also restore the NameContext ref-counts
** to the state they where in before the "column" LHS expression was
** resolved. This prevents "column" from being counted as having been
** referenced, which might prevent a SELECT from being erroneously
** marked as correlated.
*/
case TK_NOTNULL:
case TK_ISNULL: {
@@ -805,7 +811,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
anRef[i] = p->nRef;
}
sqlite3WalkExpr(pWalker, pExpr->pLeft);
if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) ){
if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
if( pExpr->op==TK_NOTNULL ){
pExpr->u.zToken = "true";
ExprSetProperty(pExpr, EP_IsTrue);
@@ -1050,6 +1056,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( pWin==pExpr->y.pWin );
if( IN_RENAME_OBJECT==0 ){
sqlite3WindowUpdate(pParse, pSel ? pSel->pWinDefn : 0, pWin, pDef);
if( pParse->db->mallocFailed ) break;
}
sqlite3WalkExprList(pWalker, pWin->pPartition);
sqlite3WalkExprList(pWalker, pWin->pOrderBy);
@@ -1124,7 +1131,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( !ExprHasProperty(pExpr, EP_Reduced) );
/* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
** and "x IS NOT FALSE". */
if( pRight && (pRight->op==TK_ID || pRight->op==TK_TRUEFALSE) ){
if( ALWAYS(pRight) && (pRight->op==TK_ID || pRight->op==TK_TRUEFALSE) ){
int rc = resolveExprStep(pWalker, pRight);
if( rc==WRC_Abort ) return WRC_Abort;
if( pRight->op==TK_TRUEFALSE ){
+36 -22
View File
@@ -85,12 +85,16 @@ static void clearSelect(sqlite3 *db, Select *p, int bFree){
sqlite3ExprDelete(db, p->pHaving);
sqlite3ExprListDelete(db, p->pOrderBy);
sqlite3ExprDelete(db, p->pLimit);
if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith);
#ifndef SQLITE_OMIT_WINDOWFUNC
if( OK_IF_ALWAYS_TRUE(p->pWinDefn) ){
sqlite3WindowListDelete(db, p->pWinDefn);
}
while( p->pWin ){
assert( p->pWin->ppThis==&p->pWin );
sqlite3WindowUnlinkFromSelect(p->pWin);
}
#endif
if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith);
if( bFree ) sqlite3DbFreeNN(db, p);
p = pPrior;
bFree = 1;
@@ -1386,7 +1390,7 @@ KeyInfo *sqlite3KeyInfoFromExprList(
/*
** Name of the connection operator, used for error messages.
*/
static const char *selectOpName(int id){
const char *sqlite3SelectOpName(int id){
char *z;
switch( id ){
case TK_ALL: z = "UNION ALL"; break;
@@ -2605,12 +2609,8 @@ static int multiSelect(
db = pParse->db;
pPrior = p->pPrior;
dest = *pDest;
if( pPrior->pOrderBy || pPrior->pLimit ){
sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op));
rc = 1;
goto multi_select_end;
}
assert( pPrior->pOrderBy==0 );
assert( pPrior->pLimit==0 );
v = sqlite3GetVdbe(pParse);
assert( v!=0 ); /* The VDBE already created by calling function */
@@ -2667,7 +2667,7 @@ static int multiSelect(
pPrior->iOffset = p->iOffset;
pPrior->pLimit = p->pLimit;
rc = sqlite3Select(pParse, pPrior, &dest);
p->pLimit = 0;
pPrior->pLimit = 0;
if( rc ){
goto multi_select_end;
}
@@ -2688,8 +2688,8 @@ static int multiSelect(
pDelete = p->pPrior;
p->pPrior = pPrior;
p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);
if( pPrior->pLimit
&& sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)
if( p->pLimit
&& sqlite3ExprIsInteger(p->pLimit->pLeft, &nLimit)
&& nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit)
){
p->nSelectRow = sqlite3LogEst((u64)nLimit);
@@ -2753,7 +2753,7 @@ static int multiSelect(
p->pLimit = 0;
uniondest.eDest = op;
ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
selectOpName(p->op)));
sqlite3SelectOpName(p->op)));
rc = sqlite3Select(pParse, p, &uniondest);
testcase( rc!=SQLITE_OK );
assert( p->pOrderBy==0 );
@@ -2829,7 +2829,7 @@ static int multiSelect(
p->pLimit = 0;
intersectdest.iSDParm = tab2;
ExplainQueryPlan((pParse, 1, "%s USING TEMP B-TREE",
selectOpName(p->op)));
sqlite3SelectOpName(p->op)));
rc = sqlite3Select(pParse, p, &intersectdest);
testcase( rc!=SQLITE_OK );
pDelete = p->pPrior;
@@ -2938,7 +2938,8 @@ void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){
sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms");
}else{
sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
" do not have the same number of result columns", selectOpName(p->op));
" do not have the same number of result columns",
sqlite3SelectOpName(p->op));
}
}
@@ -3035,10 +3036,8 @@ static int generateOutputSubroutine(
** if it is the RHS of a row-value IN operator.
*/
case SRT_Mem: {
if( pParse->nErr==0 ){
testcase( pIn->nSdst>1 );
sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, pIn->nSdst);
}
testcase( pIn->nSdst>1 );
sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, pIn->nSdst);
/* The LIMIT clause will jump out of the loop for us */
break;
}
@@ -3330,7 +3329,7 @@ static int multiSelectOrderBy(
sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA);
sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB);
ExplainQueryPlan((pParse, 1, "MERGE (%s)", selectOpName(p->op)));
ExplainQueryPlan((pParse, 1, "MERGE (%s)", sqlite3SelectOpName(p->op)));
/* Generate a coroutine to evaluate the SELECT statement to the
** left of the compound operator - the "A" select.
@@ -5255,7 +5254,10 @@ static int selectExpander(Walker *pWalker, Select *p){
u8 eCodeOrig = pWalker->eCode;
if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
assert( pFrom->pSelect==0 );
if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){
if( pTab->pSelect
&& (db->flags & SQLITE_EnableView)==0
&& pTab->pSchema!=db->aDb[1].pSchema
){
sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited",
pTab->zName);
}
@@ -6034,8 +6036,19 @@ int sqlite3Select(
pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard ||
pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_DistFifo );
/* All of these destinations are also able to ignore the ORDER BY clause */
sqlite3ExprListDelete(db, p->pOrderBy);
p->pOrderBy = 0;
if( p->pOrderBy ){
#if SELECTTRACE_ENABLED
SELECTTRACE(1,pParse,p, ("dropping superfluous ORDER BY:\n"));
if( sqlite3SelectTrace & 0x100 ){
sqlite3TreeViewExprList(0, p->pOrderBy, 0, "ORDERBY");
}
#endif
sqlite3ParserAddCleanup(pParse,
(void(*)(sqlite3*,void*))sqlite3ExprListDelete,
p->pOrderBy);
testcase( pParse->earlyCleanup );
p->pOrderBy = 0;
}
p->selFlags &= ~SF_Distinct;
p->selFlags |= SF_NoopOrderBy;
}
@@ -6654,6 +6667,7 @@ int sqlite3Select(
if( pAggInfo ){
sqlite3ParserAddCleanup(pParse,
(void(*)(sqlite3*,void*))agginfoFree, pAggInfo);
testcase( pParse->earlyCleanup );
}
if( db->mallocFailed ){
goto select_end;
+10 -3
View File
@@ -3891,13 +3891,13 @@ static const char *(azHelp[]) = {
".databases List names and files of attached databases",
".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
".dbinfo ?DB? Show status information about the database",
".dump ?TABLE? Render database content as SQL",
".dump ?OBJECTS? Render database content as SQL",
" Options:",
" --data-only Output only INSERT statements",
" --newlines Allow unescaped newline characters in output",
" --nosys Omit system tables (ex: \"sqlite_stat1\")",
" --preserve-rowids Include ROWID values in the output",
" TABLE is a LIKE pattern for the tables to dump",
" OBJECTS is a LIKE pattern for tables, indexes, triggers or views to dump",
" Additional LIKE patterns can be given in subsequent arguments",
".echo on|off Turn command echo on or off",
".eqp on|off|full|... Enable or disable automatic EXPLAIN QUERY PLAN",
@@ -9038,6 +9038,11 @@ static int do_meta_command(char *zLine, ShellState *p){
goto meta_command_exit;
}
if( azArg[1][0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
raw_printf(stderr, "Error: pipes are not supported in this OS\n");
rc = 1;
p->out = stdout;
#else
p->in = popen(azArg[1]+1, "r");
if( p->in==0 ){
utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
@@ -9046,6 +9051,7 @@ static int do_meta_command(char *zLine, ShellState *p){
rc = process_input(p);
pclose(p->in);
}
#endif
}else if( notNormalFile(azArg[1]) || (p->in = fopen(azArg[1], "rb"))==0 ){
utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
rc = 1;
@@ -10823,7 +10829,8 @@ static char *cmdline_option_value(int argc, char **argv, int i){
}
#ifndef SQLITE_SHELL_IS_UTF8
# if (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
# if (defined(_WIN32) || defined(WIN32)) \
&& (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
# define SQLITE_SHELL_IS_UTF8 (0)
# else
# define SQLITE_SHELL_IS_UTF8 (1)
+7 -1
View File
@@ -2132,7 +2132,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the view setting is not reported back. </dd>
** which case the view setting is not reported back.
**
** <p>Originally this option disabled all views. ^(However, since
** SQLite version 3.35.0, TEMP views are still allowed even if
** this option is off. So, in other words, this option now only disables
** views in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
+6
View File
@@ -1481,6 +1481,11 @@ void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);
#endif /* SQLITE_OMIT_DEPRECATED */
#define SQLITE_TRACE_NONLEGACY_MASK 0x0f /* Normal flags */
/*
** Maximum number of sqlite3.aDb[] entries. This is the number of attached
** databases plus 2 for "main" and "temp".
*/
#define SQLITE_MAX_DB (SQLITE_MAX_ATTACHED+2)
/*
** Each database connection is an instance of the following structure.
@@ -4795,6 +4800,7 @@ void sqlite3KeyInfoUnref(KeyInfo*);
KeyInfo *sqlite3KeyInfoRef(KeyInfo*);
KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*);
KeyInfo *sqlite3KeyInfoFromExprList(Parse*, ExprList*, int, int);
const char *sqlite3SelectOpName(int);
int sqlite3HasExplicitNulls(Parse*, ExprList*);
#ifdef SQLITE_DEBUG
+4 -2
View File
@@ -6648,7 +6648,7 @@ static int SQLITE_TCLAPI prng_seed(
Tcl_WrongNumArgs(interp, 1, objv, "SEED ?DB?");
return TCL_ERROR;
}
if( Tcl_GetIntFromObj(interp,objv[0],&i) ) return TCL_ERROR;
if( Tcl_GetIntFromObj(interp,objv[1],&i) ) return TCL_ERROR;
if( objc==3 && getDbPointer(interp, Tcl_GetString(objv[2]), &db) ){
return TCL_ERROR;
}
@@ -7494,6 +7494,7 @@ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd(
Tcl_Obj *CONST objv[]
){
extern int sqlite3_amatch_init(sqlite3*,char**,const sqlite3_api_routines*);
extern int sqlite3_appendvfs_init(sqlite3*,char**,const sqlite3_api_routines*);
extern int sqlite3_carray_init(sqlite3*,char**,const sqlite3_api_routines*);
extern int sqlite3_closure_init(sqlite3*,char**,const sqlite3_api_routines*);
extern int sqlite3_csv_init(sqlite3*,char**,const sqlite3_api_routines*);
@@ -7523,6 +7524,7 @@ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd(
int (*pInit)(sqlite3*,char**,const sqlite3_api_routines*);
} aExtension[] = {
{ "amatch", sqlite3_amatch_init },
{ "appendvfs", sqlite3_appendvfs_init },
{ "carray", sqlite3_carray_init },
{ "closure", sqlite3_closure_init },
{ "csv", sqlite3_csv_init },
@@ -7571,7 +7573,7 @@ static int SQLITE_TCLAPI tclLoadStaticExtensionCmd(
}else{
rc = SQLITE_OK;
}
if( rc!=SQLITE_OK || zErrMsg ){
if( (rc!=SQLITE_OK && rc!=SQLITE_OK_LOAD_PERMANENTLY) || zErrMsg ){
Tcl_AppendResult(interp, "initialization of ", zName, " failed: ", zErrMsg,
(char*)0);
sqlite3_free(zErrMsg);
+1 -1
View File
@@ -1461,7 +1461,7 @@ case OP_ChngCntRow: {
if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){
goto abort_due_to_error;
}
/* Fall through to the next case, OP_String */
/* Fall through to the next case, OP_ResultRow */
/* no break */ deliberate_fall_through
}
+1 -1
View File
@@ -4991,7 +4991,7 @@ WhereInfo *sqlite3WhereBegin(
if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){
pWInfo->revMask = ALLBITS;
}
if( pParse->nErr || NEVER(db->mallocFailed) ){
if( pParse->nErr || db->mallocFailed ){
goto whereBeginError;
}
#ifdef WHERETRACE_ENABLED
+5 -1
View File
@@ -1210,7 +1210,10 @@ static void exprAnalyzeExists(
assert( pExpr->op==TK_EXISTS );
assert( (pExpr->flags & EP_VarSelect) && (pExpr->flags & EP_xIsSelect) );
if( (pSel->selFlags & SF_Aggregate) || pSel->pWin ) return;
if( pSel->selFlags & SF_Aggregate ) return;
#ifndef SQLITE_OMIT_WINDOWFUNC
if( pSel->pWin ) return;
#endif
if( pSel->pPrior ) return;
if( pSel->pWhere==0 ) return;
if( 0==exprAnalyzeExistsFindEq(pSel, 0, 0) ) return;
@@ -1409,6 +1412,7 @@ static void exprAnalyze(
pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask;
}else if( op==TK_ISNULL && 0==sqlite3ExprCanBeNull(pLeft) ){
pExpr->op = TK_TRUEFALSE;
pExpr->u.zToken = "false";
ExprSetProperty(pExpr, EP_IsFalse);
pTerm->prereqAll = 0;
pTerm->eOperator = 0;
+3
View File
@@ -2065,6 +2065,7 @@ static void windowCodeRangeTest(
int regString = ++pParse->nMem; /* Reg. for constant value '' */
int arith = OP_Add; /* OP_Add or OP_Subtract */
int addrGe; /* Jump destination */
CollSeq *pColl;
assert( op==OP_Ge || op==OP_Gt || op==OP_Le );
assert( pOrderBy && pOrderBy->nExpr==1 );
@@ -2155,6 +2156,8 @@ static void windowCodeRangeTest(
** control skips over this test if the BIGNULL flag is set and either
** reg1 or reg2 contain a NULL value. */
sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v);
pColl = sqlite3ExprNNCollSeq(pParse, pOrderBy->a[0].pExpr);
sqlite3VdbeAppendP4(v, (void*)pColl, P4_COLLSEQ);
sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
assert( op==OP_Ge || op==OP_Gt || op==OP_Lt || op==OP_Le );
+12
View File
@@ -903,4 +903,16 @@ ifcapable rtree {
} {1 1.0 2.0 3 1.5 3.5}
}
# 2021-03-08 dbsqlfuzz 3f0a7245b69cd08617d7d7781ebaedb0fe765a93
reset_db
do_catchsql_test alter-18.1 {
CREATE TABLE t1(a,b,c);
CREATE TABLE log(a INTEGER PRIMARY KEY,b,c);
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
INSERT INTO logx(a,b,c) VALUES(new.a,new.b,new.c)
ON CONFLICT(a) DO UPDATE SET c=excluded.c, b=new.b;
END;
ALTER TABLE log RENAME COLUMN a TO x;
} {1 {error in trigger tr1: no such table: main.logx}}
finish_test
+3
View File
@@ -82,6 +82,7 @@ do_auth_test 1.2 {
{SQLITE_ALTER_TABLE main t2 {} {}}
{SQLITE_FUNCTION {} like {} {}}
{SQLITE_FUNCTION {} sqlite_rename_column {} {}}
{SQLITE_FUNCTION {} sqlite_rename_quotefix {} {}}
{SQLITE_FUNCTION {} sqlite_rename_test {} {}}
{SQLITE_READ sqlite_master name main {}}
{SQLITE_READ sqlite_master sql main {}}
@@ -100,6 +101,7 @@ do_auth_test 1.3 {
} {
{SQLITE_FUNCTION {} like {} {}}
{SQLITE_FUNCTION {} sqlite_drop_column {} {}}
{SQLITE_FUNCTION {} sqlite_rename_quotefix {} {}}
{SQLITE_FUNCTION {} sqlite_rename_test {} {}}
{SQLITE_READ sqlite_master name main {}}
{SQLITE_READ sqlite_master sql main {}}
@@ -110,6 +112,7 @@ do_auth_test 1.3 {
{SQLITE_READ sqlite_temp_master type temp {}}
{SQLITE_SELECT {} {} {} {}}
{SQLITE_UPDATE sqlite_master sql main {}}
{SQLITE_UPDATE sqlite_temp_master sql temp {}}
}
finish_test
+46 -3
View File
@@ -13,8 +13,6 @@
# file format change that may be used in the future to implement
# "ALTER TABLE ... RENAME COLUMN ... TO".
#
# $Id: alter4.test,v 1.1 2009/02/02 18:03:22 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -569,7 +567,7 @@ do_execsql_test 13.1.6 {
do_catchsql_test 13.1.7 {
ALTER TABLE x1 RENAME COLUMN t TO ttt;
} {1 {database disk image is malformed}}
} {1 {error in index x1i: }}
do_execsql_test 13.1.8 {
DELETE FROM sqlite_master WHERE name = 'x1i';
@@ -804,6 +802,51 @@ do_execsql_test 20.110 {
SELECT sql FROM sqlite_master WHERE name='t1';
} {{CREATE TABLE t1(xx UNIQUE,yy UNIQUE,zz UNIQUE,UNIQUE(xx),PRIMARY KEY(yy),UNIQUE(zz))}}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 21.0 {
CREATE TABLE t1(a, b, c NOT NULL);
CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.c IS NOT NULL BEGIN
SELECT c NOT NULL FROM t1;
END;
}
do_execsql_test 21.1 {
ALTER TABLE t1 RENAME c TO d;
}
do_execsql_test 21.2 {
SELECT sql FROM sqlite_schema WHERE name IS 'tr1'
} {{CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.d IS NOT NULL BEGIN
SELECT d NOT NULL FROM t1;
END}
}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 22.0 {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, othername, extra AS (c + 1));
ALTER TABLE t1 RENAME a to othername;
SELECT sql FROM sqlite_schema;
} {
{CREATE TABLE t1(othername, b)}
{CREATE TABLE t2(c, othername, extra AS (c + 1))}
}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 22.0 {
CREATE TABLE t1(a, b);
CREATE INDEX x1 on t1("c"=b);
INSERT INTO t1 VALUES('a', 'a');
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'c');
ALTER TABLE t1 RENAME COLUMN a TO "c";
PRAGMA integrity_check;
} {ok}
finish_test
+21
View File
@@ -255,4 +255,25 @@ do_catchsql_test 5.5.2 {
ALTER TABLE c1 DROP COLUMN y
} {1 {error in trigger tr: no such column: new.z}}
# 2021-03-06 dbsqlfuzz crash-419aa525df93db6e463772c686ac6da27b46da9e
reset_db
do_catchsql_test 6.0 {
CREATE TABLE t1(a,b,c);
CREATE TABLE t2(x,y,z);
PRAGMA writable_schema=ON;
UPDATE sqlite_schema SET sql='CREATE INDEX t1b ON t1(b)' WHERE name='t2';
PRAGMA writable_schema=OFF;
ALTER TABLE t2 DROP COLUMN z;
} {1 {database disk image is malformed}}
reset_db
do_catchsql_test 6.1 {
CREATE TABLE t1(a,b,c);
CREATE TABLE t2(x,y,z);
PRAGMA writable_schema=ON;
UPDATE sqlite_schema SET sql='CREATE VIEW t2(x,y,z) AS SELECT b,a,c FROM t1'
WHERE name='t2';
PRAGMA writable_schema=OFF;
ALTER TABLE t2 DROP COLUMN z;
} {1 {database disk image is malformed}}
finish_test
+13 -5
View File
@@ -57,7 +57,7 @@ proc do_atdc_error_test {tn schema atdc error} {
# and does not have a UNIQUE constraint.
#
# EVIDENCE-OF: R-05184-13006 The column is a PRIMARY KEY.
# EVIDENCE-OF: R-52436-31752 The column is a PRIMARY KEY or part of one.
#
do_atdc_error_test 2.1.1 {
CREATE TABLE x1(a PRIMARY KEY, b, c);
@@ -66,6 +66,13 @@ do_atdc_error_test 2.1.1 {
} {
cannot drop PRIMARY KEY column: "a"
}
do_atdc_error_test 2.1.2 {
CREATE TABLE x1(a,b,c,d,e, PRIMARY KEY(b,c,d));
} {
ALTER TABLE x1 DROP COLUMN c
} {
cannot drop PRIMARY KEY column: "c"
}
# EVIDENCE-OF: R-43412-16016 The column has a UNIQUE constraint.
#
@@ -84,7 +91,7 @@ do_atdc_error_test 2.2.2 {
error in table x1 after drop column: no such column: c
}
# EVIDENCE-OF: R-46731-08965: The column is indexed.
# EVIDENCE-OF: R-46731-08965 The column is indexed.
#
do_atdc_error_test 2.3.1 {
CREATE TABLE 'one two'('x y', 'z 1', 'a b');
@@ -103,7 +110,7 @@ do_atdc_error_test 2.3.2 {
error in index idx after drop column: no such column: a
}
# EVIDENCE-OF: R-46731-08965: The column is indexed.
# EVIDENCE-OF: R-46731-08965 The column is indexed.
#
do_atdc_error_test 2.4.1 {
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
@@ -114,7 +121,8 @@ do_atdc_error_test 2.4.1 {
error in index i1 after drop column: no such column: a
}
# EVIDENCE-OF: R-18825-17786 The column appears in a table CHECK constraint.
# EVIDENCE-OF: R-47838-03249 The column is named in a table or column
# CHECK constraint not associated with the column being dropped.
#
do_atdc_error_test 2.5.1 {
CREATE TABLE x1234(a, b, c PRIMARY KEY, CHECK(((a+5)%10)!=0)) WITHOUT ROWID;
@@ -187,7 +195,7 @@ do_atdc_error_test 2.8.3 {
# if the CHECK constraint was specified as part of the column definition.
#
# EVIDENCE-OF: R-60924-11170 However, the column being deleted can be used in a
# STALE-EVIDENCE: R-60924-11170 However, the column being deleted can be used in a
# column CHECK constraint because the column CHECK constraint is dropped
# together with the column itself.
do_execsql_test 3.0 {
+8
View File
@@ -22,6 +22,14 @@ ifcapable !altertable {
}
do_execsql_test 1.0 {
CREATE TABLE x1(
one, two, three, PRIMARY KEY(one),
CHECK (three!="xyz"), CHECK (two!="one")
) WITHOUT ROWID;
CREATE INDEX x1i ON x1(one+"two"+"four") WHERE "five";
CREATE TEMP TRIGGER AFTER INSERT ON x1 BEGIN
UPDATE x1 SET two=new.three || "new" WHERE one=new.one||"";
END;
CREATE TABLE t1(a, b, c, d, PRIMARY KEY(d, b)) WITHOUT ROWID;
INSERT INTO t1 VALUES(1, 2, 3, 4);
}
+111
View File
@@ -0,0 +1,111 @@
# 2021 March 16
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. This
# script focuses on testing internal function sqlite_rename_quotefix().
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix alterqf
sqlite3_test_control SQLITE_TESTCTRL_INTERNAL_FUNCTIONS db
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c);
}
foreach {tn before after} {
1 {CREATE VIEW v1 AS SELECT "a", "b", "notacolumn!", "c" FROM t1}
{CREATE VIEW v1 AS SELECT "a", "b", 'notacolumn!', "c" FROM t1}
2 {CREATE VIEW v1 AS SELECT "a", "b", "not'a'column!", "c" FROM t1}
{CREATE VIEW v1 AS SELECT "a", "b", 'not''a''column!', "c" FROM t1}
3 {CREATE VIEW v1 AS SELECT "a", "b", "not""a""column!", "c" FROM t1}
{CREATE VIEW v1 AS SELECT "a", "b", 'not"a"column!', "c" FROM t1}
4 {CREATE VIEW v1 AS SELECT "val", count("b") FROM t1 GROUP BY "abc"}
{CREATE VIEW v1 AS SELECT 'val', count("b") FROM t1 GROUP BY 'abc'}
5 {CREATE TABLE xyz(a CHECK (a!="str"), b AS (a||"str"))}
{CREATE TABLE xyz(a CHECK (a!='str'), b AS (a||'str'))}
6 {CREATE INDEX i1 ON t1(a || "str", "b", "val")}
{CREATE INDEX i1 ON t1(a || 'str', "b", 'val')}
7 {CREATE TRIGGER tr AFTER INSERT ON t1 BEGIN SELECT "abcd"; END}
{CREATE TRIGGER tr AFTER INSERT ON t1 BEGIN SELECT 'abcd'; END}
8 {CREATE VIEW v1 AS SELECT "string"'alias' FROM t1}
{CREATE VIEW v1 AS SELECT 'string' 'alias' FROM t1}
9 {CREATE INDEX i1 ON t1(a) WHERE "b"="bb"}
{CREATE INDEX i1 ON t1(a) WHERE "b"='bb'}
10 {CREATE TABLE t2(abc, xyz CHECK (xyz != "123"))}
{CREATE TABLE t2(abc, xyz CHECK (xyz != '123'))}
11 {
CREATE TRIGGER ott AFTER UPDATE ON t1 BEGIN
SELECT max("str", new."a") FROM t1
WHERE group_concat("b", ",") OVER (ORDER BY c||"str");
UPDATE t1 SET c= b + "str";
DELETE FROM t1 WHERE EXISTS (
SELECT 1 FROM t1 AS o WHERE o."a" = "o.a" AND t1.b IN("t1.b")
);
END;
} {
CREATE TRIGGER ott AFTER UPDATE ON t1 BEGIN
SELECT max('str', new."a") FROM t1
WHERE group_concat("b", ',') OVER (ORDER BY c||'str');
UPDATE t1 SET c= b + 'str';
DELETE FROM t1 WHERE EXISTS (
SELECT 1 FROM t1 AS o WHERE o."a" = 'o.a' AND t1.b IN('t1.b')
);
END;
}
} {
do_execsql_test 1.$tn {
SELECT sqlite_rename_quotefix('main', $before)
} [list $after]
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE x1(
one, two, three, PRIMARY KEY(one),
CHECK (three!="xyz"), CHECK (two!="one")
) WITHOUT ROWID;
CREATE INDEX x1i ON x1(one+"two"+"four") WHERE "five";
CREATE TEMP TRIGGER AFTER INSERT ON x1 BEGIN
UPDATE x1 SET two=new.three || "new" WHERE one=new.one||"";
END;
}
do_execsql_test 2.1 {
ALTER TABLE x1 RENAME two TO 'four';
SELECT sql FROM sqlite_schema;
SELECT sql FROM sqlite_temp_schema;
} {{CREATE TABLE x1(
one, "four", three, PRIMARY KEY(one),
CHECK (three!='xyz'), CHECK ("four"!="one")
) WITHOUT ROWID}
{CREATE INDEX x1i ON x1(one+"four"+'four') WHERE 'five'}
{CREATE TRIGGER AFTER INSERT ON x1 BEGIN
UPDATE x1 SET "four"=new.three || 'new' WHERE one=new.one||'';
END}
}
finish_test
+26
View File
@@ -711,5 +711,31 @@ do_execsql_test 23.4 {
{CREATE VIEW v1 AS SELECT * FROM "idx2" WHERE y='abc'}
}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 24.1.0 {
CREATE TABLE t1(a, b);
CREATE TRIGGER AFTER INSERT ON t1 BEGIN
INSERT INTO nosuchtable VALUES(new.a) ON CONFLICT(a) DO NOTHING;
END;
}
do_catchsql_test 24.1.1 {
ALTER TABLE t1 RENAME TO t2;
} {1 {error in trigger AFTER: no such table: main.nosuchtable}}
reset_db
do_execsql_test 24.2.0 {
CREATE TABLE t1(a, b);
CREATE TRIGGER AFTER INSERT ON t1 BEGIN
INSERT INTO v1 VALUES(new.a) ON CONFLICT(a) DO NOTHING;
END;
CREATE VIEW v1 AS SELECT * FROM nosuchtable;
}
do_catchsql_test 24.2.1 {
ALTER TABLE t1 RENAME TO t2;
} {1 {error in trigger AFTER: no such table: main.nosuchtable}}
finish_test
+15
View File
@@ -910,4 +910,19 @@ do_execsql_test attach-12.1 {
PRAGMA integrity_check;
} {ok}
# 2021-03-10 Forum post https://sqlite.org/forum/forumpost/a006d86f72
#
reset_db
do_test attach-13.1 {
sqlite3 db :memory:
db eval {CREATE TABLE base(x);}
for {set i 0} {$i<$SQLITE_MAX_ATTACHED} {incr i} {
db eval "ATTACH ':memory:' AS a$i"
}
set m "a[expr {$SQLITE_MAX_ATTACHED-1}]"
db eval "CREATE TABLE $m.t1(a INTEGER PRIMARY KEY, b);"
db eval "CREATE TABLE $m.t2(a INTEGER PRIMARY KEY, b);"
db eval {SELECT a FROM t1 WHERE b IN (SELECT a FROM t2);}
} {}
finish_test
+337
View File
@@ -0,0 +1,337 @@
# 2021-03-06
#
# 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 tests for the appendvfs extension.
#
# Tests performed:
# avfs-1.0. Test that an appendvfs DB can be added to an empty (ZLF) file.
# avfs-1.1. Test that the DB can be read with correct content upon reopen.
# avfs-1.2. Test that an appendvfs DB can be added to a simple text file.
# avfs-1.3. Test that the DB can be read with correct content upon reopen.
# avfs-1.4. Test that appended DB is aligned to default page boundary.
# avfs-2.1. Test that the simple text file retains its initial text.
# avfs-3.1. Test that the appendvfs can grow and shrink, remaining intact.
# avfs-3.2. Test that appendvfs is intact after grow/shrink/close/reopen.
# avfs-4.1. Test shell's ability to append to a non-appendvfs file.
# avfs-4.2. Test shell's ability to append to empty or nonexistent file.
# avfs-4.3. Test shell's ability to reopen and alter an appendvfs file.
# avfs-5.1. Test appendvfs refusal to open too-tiny DB appended onto ZLF.
# avfs-5.2. Test appendvfs refusal to open too-tiny DB appended on other.
# ...
# (more to come)
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix avfs
# Do not attempt this test if SQLITE_OMIT_VIRTUALTABLE is defined.
#
ifcapable !vtab {
finish_test
return
}
set CLI [test_find_cli]
db close
# forcedelete test.db
load_static_extension db appendvfs
set ::fa avfs.adb
set ::fza avfs.sdb
forcedelete $::fa $::fza
set ::result {}
proc shellDoesAr {} {
set shdo "sh_app1.sql"
forcedelete $shdo
set fd [open $shdo w]
puts $fd ".help\n.q"
close $fd
set res [catchcmd "-batch -cmd \".read $shdo\""]
return [regexp {^.archive} [lindex $res 1]]
}
set ::vf "&vfs=apndvfs"
# Return file offset of appendvfs portion of a file, or {} if none such.
proc fosAvfs {fname} {
if {[file size $fname] < 25} {
return {}
}
if {[catch {set fd [open $fname rb]}]} {
return {}
}
seek $fd -25 end
set am [read $fd 17]
set ao [read $fd 8]
close $fd
if {$am ne "Start-Of-SQLite3-"} {
return {}
}
binary scan $ao "W" rvo
return $rvo
}
do_test 1.0 {
set results {}
set out [open $::fza wb]
close $out
sqlite3 adb "file:$::fza?mode=rwc$::vf" -uri 1
adb eval {
PRAGMA page_size=1024;
PRAGMA cache_size=10;
CREATE TABLE t1(a TEXT);
INSERT INTO t1 VALUES ('dog'),('cat');
SELECT group_concat(a) as pets FROM (SELECT a FROM t1 ORDER BY a);
} { lappend results $pets }
adb close
lappend results [fosAvfs $fza]
set ::result [join $results " | "]
} {cat,dog | 0}
do_test 1.1 {
set results {}
sqlite3 adb "file:$::fza?mode=rw$::vf" -uri 1
adb eval {
SELECT group_concat(a) as pets FROM (SELECT a FROM t1 ORDER BY a DESC);
} { lappend results $pets }
adb close
set ::result [join $results " | "]
} {dog,cat}
do_test 1.2 {
set results {}
set out [open $::fa wb]
set ::tlo { "Just some text," "and more text," "ending at 3 lines." }
puts $out [join $::tlo "\n"]
close $out
set adbSz [file size $::fa]
sqlite3 adb "file:$::fa?mode=rwc$::vf" -uri 1
adb eval {
PRAGMA auto_vacuum = 0;
PRAGMA page_size=512;
PRAGMA cache_size=0;
CREATE TABLE t1(a TEXT);
INSERT INTO t1 VALUES ('dog'),('cat'),('pig');
SELECT group_concat(a) as pets FROM (SELECT a FROM t1 ORDER BY a);
} { lappend results $pets }
adb close
set adaSz [file size $::fa]
lappend results "Bytes before/after $adbSz/$adaSz"
set ::result [join $results " | "]
} {cat,dog,pig | Bytes before/after 50/5145}
do_test 1.3 {
set results {}
sqlite3 adb "file:$::fa?mode=rw$::vf" -uri 1
adb eval {
SELECT group_concat(a) as pets FROM (SELECT a FROM t1 ORDER BY a DESC);
} { lappend results $pets }
adb close
set ::result [join $results " | "]
} {pig,dog,cat}
do_test 1.4 {
set ::result [fosAvfs $fa]
} {4096}
do_test 2.1 {
set in [open $::fa r]
set tli {}
for {set i [llength $::tlo]} {$i > 0} {incr i -1} {
lappend tli [gets $in]
}
close $in
if { [join $tli ":"] ne [join $::tlo ":"] } {
set ::result "Appendee changed."
} else {
set ::result "Appendee intact."
}
} {Appendee intact.}
# Set of repeatable random integers for a couple tests.
proc rint {v} {
return [::tcl::mathfunc::int [expr $v * 100000]]
}
array set ::randints [list 0 [rint [::tcl::mathfunc::srand 0]]]
for {set i 1} {$i < 10000} {incr i} {
set ::randints($i) [rint [::tcl::mathfunc::rand]]
}
do_test 3.1 {
set results {}
sqlite3 adb "file:$::fa?mode=rw$::vf" -uri 1
adb eval {
DROP TABLE t1;
PRAGMA cache_size=10;
CREATE TABLE ri (i INTEGER);
BEGIN;
}
for {set i 0} {$i < 10000} {incr i} {
set r $::randints($i)
set s $::randints([incr i])
set t $::randints([incr i])
set u $::randints([incr i])
set v $::randints([incr i])
adb eval {
INSERT INTO ri VALUES ($r),($s),($t),($u),($v)
}
}
adb eval {
COMMIT;
SELECT integrity_check as ic FROM pragma_integrity_check();
} { lappend results $ic }
set adbSz [file size $::fa]
set qr {}
adb eval {
SELECT count(*) as ic FROM ri;
DELETE FROM ri WHERE (i % 50) <> 25;
SELECT integrity_check as ic FROM pragma_integrity_check();
VACUUM;
SELECT integrity_check as ic FROM pragma_integrity_check();
SELECT count(*) as ic FROM ri;
} { lappend qr $ic }
adb close
set adaSz [file size $::fa]
set adba [expr ($adbSz + 0.1)/$adaSz]
# lappend results $adbSz $adaSz
set results [concat $results [lrange $qr 0 2]]
lappend results [expr {$adba > 10.0 && $adba < 20.0}]
set ::result [join $results " | "]
} {ok | 10000 | ok | ok | 1}
do_test 3.2 {
set results {}
sqlite3 adb "file:$::fa?mode=rw$::vf" -uri 1
adb eval {
SELECT integrity_check as ic FROM pragma_integrity_check();
} { lappend results $ic }
adb close
set ::result [join $results " | "]
} {ok}
set ::cliDoesAr [shellDoesAr]
do_test 4.1 {
set shdo "sh_app1.sql"
set shod "sh_app1.adb"
forcedelete $shdo $shod
set ofd [open $shdo w]
if {$::cliDoesAr} {
puts $ofd ".ar -c"
} else {
puts $ofd "pragma page_size=512;"
puts $ofd "create table sqlar (a);"
}
puts $ofd ".tables"
puts $ofd ".q"
close $ofd
set ofd [open $shod wb]
puts $ofd "Some text."
close $ofd
set res [catchcmd "-append -batch -init $shdo $shod" ""]
lappend res [fosAvfs $shod]
forcedelete $shdo $shod
set ::result [join $res " | "]
} {0 | sqlar | 4096}
do_test 4.2 {
set shdo "sh_app1.sql"
set shod "sh_app1.adb"
forcedelete $shdo $shod
set ofd [open $shdo w]
if {$::cliDoesAr} {
puts $ofd ".ar -c"
} else {
puts $ofd "pragma page_size=512;"
puts $ofd "create table sqlar (a);"
}
puts $ofd ".tables"
puts $ofd ".q"
close $ofd
set ofd [open $shod wb]
close $ofd
set res [catchcmd "-append -batch -init $shdo $shod" ""]
lappend res [fosAvfs $shod]
forcedelete $shdo ; # Leave $shod for next test.
set ::result [join $res " | "]
} {0 | sqlar | 0}
do_test 4.3 {
set shdo "sh_app1.sql"
set shod "sh_app1.adb" ; # Same as test 4.2, reusing ADB.
forcedelete $shdo
set ofd [open $shdo w]
if {$::cliDoesAr} {
puts $ofd ".ar -u $shdo"
puts $ofd "select count(*) from sqlar where name = '$shdo';"
} else {
puts $ofd "insert into sqlar values (1);"
puts $ofd "select count(*) from sqlar;"
}
puts $ofd ".q"
close $ofd
set res [catchcmd "-append -batch -init $shdo $shod" ""]
sqlite3 adb "file:$shod?mode=rw$::vf" -uri 1
adb eval {
SELECT count(*) as n FROM sqlar
} { lappend res $n }
adb close
forcedelete $shdo $shod;
set ::result [join $res " | "]
} {0 | 1 | 1}
do_test 5.1 {
set fake "faketiny.sdb"
forcedelete $fake
set ofd [open $fake wb]
puts -nonewline $ofd "SQLite format 3"
puts -nonewline $ofd [binary format "c" 0]
puts -nonewline $ofd "Start-Of-SQLite3-"
puts -nonewline $ofd [binary format "W" 0]
close $ofd
if {[catch {sqlite3 adb "file:$fake?mode=rw$::vf" -uri 1}]} {
set res "Open failed."
} else {
adb close
set res "Opened when should not."
}
forcedelete $fake
set ::result $res
} {Open failed.}
do_test 5.2 {
set fake "faketiny.sdb"
forcedelete $fake
set ofd [open $fake wb]
set fakeAppendee "Dog ate my homework.\n"
puts -nonewline $ofd $fakeAppendee
puts -nonewline $ofd "SQLite format 3"
puts -nonewline $ofd [binary format "c" 0]
puts -nonewline $ofd "Start-Of-SQLite3-"
puts -nonewline $ofd [binary format "W" [string length $fakeAppendee]]
close $ofd
if {[catch {sqlite3 adb "file:$fake?mode=rw$::vf" -uri 1}]} {
set res "Open failed."
} else {
adb close
set res "Opened when should not."
}
forcedelete $fake
set ::result $res
} {Open failed.}
forcedelete $::fa $::fza
unset -nocomplain ::fa ::fza ::tlo ::result ::randints ::cliDoesAr
finish_test
+2 -2
View File
@@ -2055,9 +2055,9 @@ do_test e_fkey-44.5 {
#-------------------------------------------------------------------------
# Test SET DEFAULT actions.
#
# EVIDENCE-OF: R-43054-54832 The "SET DEFAULT" actions are similar to
# EVIDENCE-OF: R-55814-22637 The "SET DEFAULT" actions are similar to
# "SET NULL", except that each of the child key columns is set to
# contain the columns default value instead of NULL.
# contain the column's default value instead of NULL.
#
drop_all_tables
do_test e_fkey-45.1 {
+10 -2
View File
@@ -11,8 +11,6 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS3 module.
#
# $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -54,6 +52,16 @@ do_execsql_test 1.3 {
SELECT 42+matchinfo(t1,'yxyyxy') FROM t1 WHERE t1 MATCH x'2b0a312b0a312a312a2a0b5d0a0b0b0a312a0a0b0b0a312a0b310a392a0b0a27312a2a0b5d0a312a0b310a31315d0b310a312a316d2a0b313b15bceaa50a312a0b0a27312a2a0b5d0a312a0b310a312b0b2a310a312a0b2a0b2a0b2e5d0a0bff313336e34a2a312a0b0a3c310b0a0b4b4b0b4b2a4bec40322b2a0b310a0a312a0a0a0a0a0a0a0a0a0b310a312a2a2a0b5d0a0b0b0a312a0b310a312a0b0a4e4541530b310a5df5ced70a0a0a0a0a4f520a0a0a0a0a0a0a312a0b0a4e4541520b310a5d616161610a0a0a0a4f520a0a0a0a0a0a312b0a312a312a0a0a0a0a0a0a004a0b0a310b220a0b0a310a4a22310a0b0a7e6fe0e0e030e0e0e0e0e01176e02000e0e0e0e0e01131320226310a0b0a310a4a22310a0b0a310a766f8b8b4ee0e0300ae0090909090909090909090909090909090909090909090909090909090909090947aaaa540b09090909090909090909090909090909090909090909090909090909090909fae0e0f2f22164e0e0f273e07fefefef7d6dfafafafa6d6d6d6d';
} {42}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t0 USING fts3(a);
INSERT INTO t0_segdir VALUES(0,0,0,0,'0 42',X'000131030782000103323334050100fff200010461616161050101020200000462626262050101030200');
}
do_execsql_test 2.1 {
SELECT count(*) FROM t0 WHERE t0 MATCH '(1 NEAR 1) AND (aaaa OR 1)';
} 1
set sqlite_fts3_enable_parentheses $saved_sqlite_fts3_enable_parentheses
finish_test
+6 -3
View File
@@ -759,9 +759,10 @@ static int block_troublesome_sql(
if( sqlite3_stricmp("oom",zArg1)==0 && zArg2!=0 && zArg2[0]!=0 ){
oomCounter = atoi(zArg2);
}
}else if( (eCode==SQLITE_ATTACH || eCode==SQLITE_DETACH)
&& zArg1 && zArg1[0] ){
return SQLITE_DENY;
}else if( eCode==SQLITE_ATTACH ){
if( zArg1==0 || (zArg1[0]!=0 && strcmp(zArg1,":memory:")!=0) ){
return SQLITE_DENY;
}
}
return SQLITE_OK;
}
@@ -1989,6 +1990,8 @@ int main(int argc, char **argv){
sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH, 50);
if( cellSzCkFlag ) runSql(db, "PRAGMA cell_size_check=ON", runFlags);
setAlarm((iTimeout+999)/1000);
/* Enable test functions */
sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, db);
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
if( sqlFuzz || vdbeLimitFlag ){
sqlite3_progress_handler(db, 100000, progressHandler,
BIN
View File
Binary file not shown.
+19
View File
@@ -88,5 +88,24 @@ do_faultsim_test 3 -prep {
faultsim_test_result {0 2} {1 {vtable constructor failed: x1}}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 4.0 {
CREATE TABLE t1_a(a INTEFDR PRIMARY KEY, b TEXT);
CREATE TABLE t3_a(k FnTEGER PRIMARY KEY, v TEXT);
CREATE TABLE t3_b(k INTEÀ5R PRIMARY KEY, v TEXT);
CREATE VIEW t3 AS SELECT * FROM t3_a UNION ALL SELECT * FROM t3_b;
}
faultsim_save_and_close
do_faultsim_test 4 -faults oom-t* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT 1 FROM t1_a LEFT JOIN t3 ON ((1+1) AND k=1)
}
} -test {
faultsim_test_result {0 {}}
}
finish_test
+3 -3
View File
@@ -90,9 +90,9 @@ do_test indexedby-2.4 {
catchsql { SELECT * FROM t1 INDEXED BY i3 WHERE a = 'one' AND b = 'two'}
} {1 {no such index: i3}}
# EVIDENCE-OF: R-62112-42456 If the query optimizer is unable to use the
# index specified by the INDEX BY clause, then the query will fail with
# an error.
# EVIDENCE-OF: R-05301-32681 If the query optimizer is unable to use the
# index specified by the INDEXED BY clause, then the query will fail
# with an error.
do_test indexedby-2.4.1 {
catchsql { SELECT b FROM t1 INDEXED BY i1 WHERE b = 'two' }
} {0 {}}
+23
View File
@@ -641,5 +641,28 @@ do_execsql_test limit-14.7 {
SELECT 123 LIMIT -1 OFFSET 1
} {}
# 2021-03-05 dbsqlfuzz crash-d811039c9f44f2d43199d5889fcf4085ef6221b9
#
reset_db
do_execsql_test limit-15.1 {
CREATE TABLE t1(a PRIMARY KEY, b TEXT);
CREATE TABLE t4(c PRIMARY KEY, d);
CREATE TABLE t5(e PRIMARY KEY, f);
CREATE TABLE t6(g, h);
CREATE TABLE t3_a(k, v);
CREATE TABLE t3_b(k, v);
CREATE VIEW t3 AS SELECT * FROM t3_a UNION ALL SELECT * FROM t3_b;
INSERT INTO t5(e,f) VALUES(500000,'orange');
INSERT INTO t4(c,d) VALUES(300000,'blue'),(400,'green'),(8000,'grey');
INSERT INTO t1(a,b) VALUES(300000,'purple');
INSERT INTO t3_a VALUES(300000,'yellow'),(500,'pink'),(8000,'red');
INSERT INTO t6 default values;
SELECT (
SELECT 100000 FROM
(SELECT 200000 FROM t6 WHERE a = ( SELECT 300000 FROM t3 WHERE a ) ),
(SELECT 400000 FROM t5 WHERE e=500000),
(SELECT 600000 FROM t4 WHERE c=a)
) FROM t1;
} {100000}
finish_test
+10
View File
@@ -86,6 +86,16 @@ do_vmstep_test 1.5.2 {
)
} +100000 {1000}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE T1(a INTEGER PRIMARY KEY, b);
CREATE TABLE T3(k, v);
}
do_execsql_test 2.1 {
SELECT * FROM (SELECT a, b FROM t1) LEFT JOIN t3 ON a IS NULL;
}
finish_test
+56
View File
@@ -0,0 +1,56 @@
# 2021 February 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 optimizations associated with "IS NULL"
# and "IS NOT NULL" operators on columns with NOT NULL constraints.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix notnullfault
do_execsql_test 1.0 {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d NOT NULL);
}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT * FROM t2 WHERE d NOT NULL
}
} -test {
faultsim_test_result {0 {}}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a, b, c);
CREATE TABLE t2(a, b, c, PRIMARY KEY(a, b, c)) WITHOUT ROWID;
}
faultsim_save_and_close
do_faultsim_test 2.1 -faults oom-t* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT dense_rank() OVER win FROM t2
WINDOW win AS (ORDER BY c IS NULL)
}
} -test {
faultsim_test_result {0 {}}
}
finish_test
+14 -4
View File
@@ -989,7 +989,7 @@ test_suite "journaltest" -description {
pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock*
pager2.test *fault* rowal* snapshot* superlock* symlink.test
delete_db.test shmlock.test chunksize.test
busy2.test
busy2.test avfs.test
}]
if {[info commands register_demovfs] != ""} {
@@ -1062,7 +1062,8 @@ test_suite "no_optimization" -description {
where6.test where7.test where8.test where9.test \
whereA.test whereB.test wherelimit.test \
select1.test select2.test select3.test select4.test select5.test \
select7.test select8.test selectA.test selectC.test
select7.test select8.test selectA.test selectC.test \
-exclude windowpushd.test
] -dbconfig {
optimization_control $::dbhandle all 0
}
@@ -1137,11 +1138,20 @@ proc run_tests {name args} {
set ::G(perm:presql) $options(-presql)
foreach file [lsort $options(-files)] {
uplevel $options(-initialize)
if {[file tail $file] == $file} { set file [file join $::testdir $file] }
if {[info exists ::env(SQLITE_TEST_PATTERN_LIST)]} {
set ok 0
foreach p $::env(SQLITE_TEST_PATTERN_LIST) {
set p [string map {% *} $p]
if {[string match $p [file tail $file]]} {set ok 1 ; break}
}
if {!$ok} continue
}
uplevel $options(-initialize)
slave_test_file $file
uplevel $options(-shutdown)
unset -nocomplain ::G(perm:sqlite3_args)
}
+42 -3
View File
@@ -110,7 +110,7 @@ do_execsql_test 2.2 {
PRAGMA writable_schema = 1;
CREATE TABLE xyz(a, b, c CHECK (c!="null") );
CREATE INDEX i2 ON t1(x, y, z||"abc");
CREATE INDEX i3 ON t1("w");
CREATE INDEX i3 ON t1("w"||"");
CREATE INDEX i4 ON t1(x) WHERE z="w";
}
@@ -135,10 +135,49 @@ do_execsql_test 2.5 {
{CREATE TABLE t1(x, y, z)}
{CREATE TABLE xyz(a, b, c CHECK (c!="null") )}
{CREATE INDEX i2 ON t1(x, y, z||"abc")}
{CREATE INDEX i3 ON t1("w")}
{CREATE INDEX i3 ON t1("w"||"")}
{CREATE INDEX i4 ON t1(x) WHERE z="w"}
}
# 2021-03-13
# ticket 1c24a659e6d7f3a1
reset_db
do_catchsql_test 3.0 {
CREATE TABLE t1(a,b);
CREATE INDEX x1 on t1("b");
ALTER TABLE t1 DROP COLUMN b;
} {1 {error in index x1 after drop column: no such column: b}}
do_catchsql_test 3.1 {
DROP TABLE t1;
CREATE TABLE t1(a,"b");
CREATE INDEX x1 on t1("b");
ALTER TABLE t1 DROP COLUMN b;
} {1 {error in index x1 after drop column: no such column: b}}
do_catchsql_test 3.2 {
DROP TABLE t1;
CREATE TABLE t1(a,'b');
CREATE INDEX x1 on t1("b");
ALTER TABLE t1 DROP COLUMN b;
} {1 {error in index x1 after drop column: no such column: b}}
do_catchsql_test 3.3 {
DROP TABLE t1;
CREATE TABLE t1(a,"b");
CREATE INDEX x1 on t1('b');
ALTER TABLE t1 DROP COLUMN b;
} {1 {error in index x1 after drop column: no such column: b}}
do_catchsql_test 3.4 {
DROP TABLE t1;
CREATE TABLE t1(a, b, c);
CREATE INDEX x1 ON t1("a"||"b");
INSERT INTO t1 VALUES(1,2,3),(1,4,5);
ALTER TABLE t1 DROP COLUMN b;
} {1 {error in index x1 after drop column: no such column: b}}
do_catchsql_test 3.5 {
DROP TABLE t1;
CREATE TABLE t1(a, b, c);
CREATE INDEX x1 ON t1("a"||"x");
INSERT INTO t1 VALUES(1,2,3),(1,4,5);
ALTER TABLE t1 DROP COLUMN b;
} {0 {}}
finish_test
+10 -2
View File
@@ -283,7 +283,7 @@ array set ::Configs [strip_comments {
FuzzFail2 {-O0}
}]
if {$tcl_platform(os)=="Darwin"} {
lappend Configs(Apple -DSQLITE_ENABLE_LOCKING_STYLE=1
lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1
}
array set ::Platforms [strip_comments {
@@ -302,7 +302,7 @@ array set ::Platforms [strip_comments {
"No-lookaside" test
"Devkit" test
"Apple" test
"Sanitize" {QUICKTEST_OMIT=crash*,shell*,sqldiff*,sessionB.test test}
"Sanitize" test
"Device-One" fulltest
"Default" "threadtest fulltest"
"Valgrind*" valgrindtest
@@ -355,6 +355,14 @@ array set ::Platforms [strip_comments {
}
}]
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# End of configuration section.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Configuration verification: Check that each entry in the list of configs
# specified for each platforms exists.
#
+32
View File
@@ -83,5 +83,37 @@ do_execsql_test 4.5 {
RETURNING *, '|';
} {2 3 4 | 4 100 6 | 5 6 7 |}
#-------------------------------------------------------------------------
# Test RETURNING on a table with virtual columns.
#
reset_db
do_execsql_test 5.0 {
CREATE TABLE t1(xyz);
CREATE TABLE t2(a as (1+1), b);
}
do_execsql_test 5.1 {
UPDATE t2 SET b='123' WHERE b='abc' RETURNING (SELECT b FROM t1);
} {}
do_execsql_test 5.2 {
INSERT INTO t2(b) VALUES('abc');
}
do_execsql_test 5.3 {
UPDATE t2 SET b='123' WHERE b='abc' RETURNING (SELECT b FROM t1);
} {{}}
do_execsql_test 5.4 {
INSERT INTO t2(b) VALUES('abc');
INSERT INTO t1(xyz) VALUES(1);
UPDATE t2 SET b='123' WHERE b='abc' RETURNING b;
} {123}
do_execsql_test 5.5 {
INSERT INTO t2(b) VALUES('abc');
UPDATE t2 SET b='123' WHERE b='abc' RETURNING (SELECT b FROM t1);
} {123}
finish_test
+6 -1
View File
@@ -44,12 +44,17 @@ do_test view-1.1.100 {
SELECT * FROM v1 ORDER BY a;
}
} {1 {access to view "v1" prohibited}}
do_execsql_test view-1.1.101 {
CREATE TEMP VIEW v1temp AS SELECT a, b FROM t1;
SELECT * FROM v1temp ORDER BY a;
} {1 2 4 5 7 8}
do_test view-1.1.110 {
db config enable_view on
catchsql {
SELECT * FROM v1 ORDER BY a;
SELECT * FROM v1temp ORDER BY a;
}
} {0 {1 2 4 5 7 8}}
} {0 {1 2 4 5 7 8 1 2 4 5 7 8}}
do_test view-1.2 {
catchsql {
ROLLBACK;
+31
View File
@@ -1515,5 +1515,36 @@ foreach mode {OFF MEMORY PERSIST DELETE TRUNCATE WAL} {
db close
}
# 2021-03-10 forum post https://sqlite.org/forum/forumpost/a006d86f72
#
file delete test.db
sqlite3 db test.db
db eval {PRAGMA journal_mode=WAL}
for {set i 0} {$i<$SQLITE_MAX_ATTACHED} {incr i} {
do_test wal-26.1.$i {
file delete attached-$i.db
db eval "ATTACH 'attached-$i.db' AS a$i;"
db eval "PRAGMA a$i.journal_mode=WAL;"
db eval "CREATE TABLE a$i.t$i (x);"
db eval "INSERT INTO t$i VALUES(zeroblob(10000));"
db eval "DELETE FROM t$i;"
db eval "INSERT INTO t$i VALUES(randomblob(10000));"
expr {[file size attached-$i.db-wal]>10000}
} {1}
}
for {set i [expr {$SQLITE_MAX_ATTACHED-1}]} {$i>=0} {incr i -1} {
do_test wal-26.2.$i {
db eval "PRAGMA a$i.wal_checkpoint(TRUNCATE);"
file size attached-$i.db-wal
} {0}
for {set j 0} {$j<$i} {incr j} {
do_test wal-26.2.$i.$j {
expr {[file size attached-$j.db-wal]>10000}
} {1}
}
}
db close
test_restore_config_pagecache
finish_test
+21
View File
@@ -336,4 +336,25 @@ do_execsql_test 7.4 {
) FROM t1;
} {{} 45 {} 45 7 {} 7 {} 8 {} 8 {} abc 1001 abc 1001 xyz 3333}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 8.0 {
BEGIN TRANSACTION;
CREATE TABLE t1(a, c);
INSERT INTO t1 VALUES('aa', 111);
INSERT INTO t1 VALUES('BB', 660);
INSERT INTO t1 VALUES('CC', 938);
INSERT INTO t1 VALUES('dd', 979);
COMMIT;
CREATE INDEX i1 ON t1(a COLLATE nocase);
}
do_execsql_test 8.1 {
SELECT sum(c) OVER
(ORDER BY a COLLATE nocase RANGE BETWEEN 10.0 PRECEDING AND 5.0 PRECEDING)
FROM t1;
} {111 660 938 979}
finish_test