Compare commits

..

41 Commits

Author SHA1 Message Date
stephan a89d43e5db Correct test from [96a48a15760a] - that journal was indeed corrupt, but not in the intended manner. Add a verification that the bad journal gets replaced after a write.
FossilOrigin-Name: c9171221160f241b450d425f41bb53b42362dccfad4c3fdf64dd5c3562ed4096
2026-06-21 11:38:05 +00:00
stephan 646931b83e Extend the test from the previous check-in a bit.
FossilOrigin-Name: bd6bbd0e84226c90d864c28ac4d6acd908c4f06bfe63dcfd6fa6b8d17105b338
2026-06-21 11:10:17 +00:00
stephan 9be4c57ca1 Add a JS test demonstrating that [7c4db1cd2d06] recovers gracefully from journal corruption.
FossilOrigin-Name: 96a48a15760a2eee2642926874e9dfd4082518c6669f930fcc367ffd16669f39
2026-06-21 10:55:09 +00:00
stephan d7e055d41c Fix a result value semantics bug which broke application of a journal in kvvfs. Fix a memory-reset bug in hypothetical non-WASM builds of kvvfs. Bug report [bugs:7fcd3ea30fa4fcfc|2026-06-20T18:22:59Z], and this resolves the journaling issue mentioned in the parent post.
FossilOrigin-Name: 7c4db1cd2d06d9dc6c4b5eed5c4fc0fc5466128a169a5d4ba261e0cb17020ae1
2026-06-21 08:38:07 +00:00
stephan 97467fa8fa Fix a potential integer overflow when decoding a corrupt kvvfs block. Bug report [bugs:76acc88b57|2026-06-20T18:35:54Z].
FossilOrigin-Name: c36fc5df62c7eb8fca6a43cb0b3154a030b39a4cfade8fb04496120d4d339b97
2026-06-21 08:13:22 +00:00
drh fb41f57de4 Fix an incorrect assert() in check-in [984c9b181801c1de]
FossilOrigin-Name: 1d41c93b3636de63cc4b9ee49f73319429944f2255ab56d7556595f56434c17c
2026-06-20 21:54:18 +00:00
stephan 190034d268 Correct misuse of a loop control variable in writing of a kvvfs journal. Bug report [bugs:20e208fe17|2026-06-20T08:49:41Z]. Remove a snippet of dead code in the JS kvvfs side.
FossilOrigin-Name: a396d7c54c5f251daaaac1e68321c2a54d3b6969599027c29b7ca7abe7fb8c4e
2026-06-20 11:07:04 +00:00
drh ae3c30e318 Add the sqlite3_result_str() interface and use it to simplify the code.
FossilOrigin-Name: 8f8361edf82233d6cd53bf8cd2f7fbf0cb3552228c9202395ef1e3383ed559ff
2026-06-19 23:53:29 +00:00
drh 7644162026 Use SQLITE_FINISH in a few places in the core, to help ensure that path is
well tested.

FossilOrigin-Name: 7356bf3a813bcd9082a7fdef5e2cc38c7a0f142f0ef4c948f78e4dafa216c039
2026-06-19 22:57:44 +00:00
drh fa8e52021f Put the sqlite3OomStr singleton in "const" space to ensure that it is
never modified.  Doing so identified a long-standing bug.

FossilOrigin-Name: 2fe53e6d68c3f9f1c4b064fa40fe8efe12025179a973182f0bb256acb9b5d58d
2026-06-19 22:17:09 +00:00
drh ec4f18fed8 Additional changes based on Claude analysis.
FossilOrigin-Name: d4691a0db1e96b646d3094f183b1fc330411a2d2472b09f9b5fe0fb268b5ca09
2026-06-19 21:43:04 +00:00
drh 9487f6d441 Further refinements and uses for sqlite3_result_str().
FossilOrigin-Name: 974253a6058a7120354261b2134ed4803373031996957c7334161370b80bf428
2026-06-19 20:01:47 +00:00
drh 7b386a77ff Prototype implementation for a new sqlite3_result_str() API.
FossilOrigin-Name: cdbc62c36a37ad687589917c6f1e92ded6d99959c54eb8d79eaaef6fa57dacd3
2026-06-19 17:03:21 +00:00
drh 3a697a26de Fix the format() SQL function so that it returns an empty string not a
NULL if the first argument is an empty string.
[bugs:/info/2026-06-19T16:40:04Z|Bug 2026-06-19T16:40:04Z]

FossilOrigin-Name: ece7af98a8bf982567b489cf82a52519f46a1c9360c82a486dbe1cd0664b1555
2026-06-19 16:55:08 +00:00
dan 593b55cb78 Fix a cast in fts3_write so that it is applied as intended. Bug [bugs:/info/2026-06-19T07:56:23Z | 2026-06-19T07:56:23Z].
FossilOrigin-Name: d6a3272e5592bcfeecf8a06dd8330cce57ff6603b24994b533d1fdcd48b5dc66
2026-06-19 11:46:05 +00:00
dan 8c4a4acc02 Fix an fts5 problem causing attempts to create locale=1 tables with more than 115 columns to fail. Bug [bugs:/info/2026-06-19T05:19:08Z | 2026-06-19T05:19:08Z].
FossilOrigin-Name: 979229f720e63d0294be14dae3f9fad68f76e4126a0ad63e32573cdfecd0151e
2026-06-19 11:14:16 +00:00
drh 978b0abe4d Fix a memory size computation error on 32-bit platforms caused by
check-in [9a2a230464e43140].

FossilOrigin-Name: dc4763b14c421710f2a19c19c1cac455c1d0244b27303b6f328c778ac188bb02
2026-06-18 17:09:20 +00:00
drh e070f37183 Small parsing performance improvement by reducing the amount of the
Parse object that needs to be initialized.

FossilOrigin-Name: 0901b7c2dfb87707fa159f24ada5abb0a2914043c6f0571de4ce55c80edb663b
2026-06-17 20:11:26 +00:00
drh b5d0d980be Remove the unnecessary Parse.szOpAlloc field, for small size reduction
and performance improvement.

FossilOrigin-Name: 9a2a230464e4314033e67e602dbd9f554f50ec2eefc7b1a5f05b85249591f7b8
2026-06-17 19:28:17 +00:00
drh 3dbf444538 Small performance boost in the sqlite3VdbeResolveLabel() routine of the
code generator.

FossilOrigin-Name: f786f3643e410e862568777ea021afa47c924348e511a83e7e9000cf14bec534
2026-06-17 18:39:05 +00:00
drh 3f7bf4ef2f Safer conversion from double to 64-bit integer in two places.
FossilOrigin-Name: 17c444382979b70cdca78e51418366e802b2d41d1156774e5e9693b52542b84c
2026-06-17 16:57:19 +00:00
drh c9bffdb35e Additional refinements to the large floating-point handling in
generate_series().  Follow-up to [5aab8c2cde63f9db].

FossilOrigin-Name: 4247c5d9afb162a3e9f334b5121f0df2bfddb916054fa1e6fadb65b1983a7ed8
2026-06-17 14:53:14 +00:00
drh ffc14a20ad Fix CLI CSV test cases so that they suppress the CR on windows and thus
work cross-platform.

FossilOrigin-Name: 7a2c96405e365dd2efb3593e0973536d1f87f7183d5442f3bc98ca23310e5530
2026-06-17 13:52:55 +00:00
drh aa1579de80 Fix the OR-to-IN optimization so that it works in cases where there are
conflicting collation sequences on the equality constraints within the OR.
[bugs:/info/2026-06-17T05:04:48Z|Bug 2026-06-17T05:04:48Z].

FossilOrigin-Name: 984c9b181801c1de06782335eb049f32d1dc1d5739a7fb9c94630c22159a4f8c
2026-06-17 13:31:01 +00:00
drh 8227408b6f Typo fix in a comment used to generate documentation. No changes to code.
[forum:/info/2026-06-16T23:18:50Z|Forum 2026-06-16T23:18:50Z].

FossilOrigin-Name: 7386faef618acb006086d688fcea854a7c555ac1bcfcaa294ea86e964e4ce75f
2026-06-16 23:59:58 +00:00
drh 9fb225190c Limit VIEW recursion depth to SQLITE_LIMIT_EXPR_DEPTH to prevent
static overflow in malicious schemas with tens of thousands of
levels of recursive views.
[bugs:/info/2026-06-16T04:21:51Z|Bug 2026-06-16T04:21:51Z]

FossilOrigin-Name: 3f3fb9b638f59ad982beafb7c117f24ddd3da612e62c862510805fa672ffae06
2026-06-16 13:43:08 +00:00
dan b7c32f2f29 Fix instances of potential buffer overflow caused by loading the contents of a stat4 table with an absurd number of samples in a 32-bit build. Bug [bugs:/info/2026-06-16T11:30:52Z | 2026-06-16T11:30:52Z].
FossilOrigin-Name: 0b72246732fecd7909add28f2d95f1727e1c4dc6c8f3b8e6e3482f6d17c92d34
2026-06-16 11:53:19 +00:00
drh 09c84c70ee Fix a possible call to memcpy() with a NULL source pointer when the size
parameter is zero (which is technically undefined behavior but in practice
is completely harmless) in the sha1_query() extension function.
[bugs:/info/2026-06-16T07:42:23Z|Bug 2026-06-16T07:42:23Z].

FossilOrigin-Name: 2063926473adaf9619ca10fd47b273ef59b1f77136836d575e5db3cfd68987da
2026-06-16 09:53:23 +00:00
drh 9a5801af3a Consistent error messages for excess trigger nesting.
FossilOrigin-Name: 4fb9f2ffb4b45d81c70f561f45cf29a0d5872a612b948882c4a2a14629bcbe28
2026-06-15 17:39:46 +00:00
dan a0dc22438d Speed up SQL aggregate functions percentile() and median() by using quickselect to find the required values instead of fully sorting the array of values with quicksort.
FossilOrigin-Name: 0796d337f6a0ef02a460a24eadda20e33e8fb9ec64b696ae1addee69c1bfddeb
2026-06-15 17:27:05 +00:00
drh f0075cd2e4 New Windows makefile targets for common EXEs that omit the ".exe" suffix, so
that when muscle memory kicks in and we type "make sqlite3" on windows, it
still works.

FossilOrigin-Name: 1152463a66b47eed27b71e87533e8361b6077dc54ff55b8cd2ccde5cfa8199bd
2026-06-15 17:14:12 +00:00
dan b348459070 Improve comments in percentSort().
FossilOrigin-Name: 9b43500f51ae7b43f0e2cc805bb8c93907eddbd8caf21ee5b5a3d2e795962088
2026-06-15 17:13:40 +00:00
drh 458dfb94d0 Enhance SQLITE_LIMIT_TRIGGER_DEPTH so that it also limits a chain of
distinct triggers during code generation.
[bugs:/info/2026-06-15T06:44:07Z|Bug 2026-06-15T06:44:07Z].

FossilOrigin-Name: 0b5378678e3d095ef982bb3b5d5ad05dfb15ce4ee12170b8d0a83fa4b75404c0
2026-06-15 16:45:35 +00:00
stephan 91a3aa3646 Change the PACKAGE_BUGREPORT config option point to /bugs instead of /forum.
FossilOrigin-Name: ca15fedede9873b5f72f29f7cd33cba294cd49593999fc952670e2d5ce7ec86e
2026-06-15 15:48:40 +00:00
dan 1b5bd0edf1 Fix a problem sometimes causing an UPSERT to incorrectly convert an excluded.* column from type REAL to INT in cases where doing so does not cause data loss. Bug [bugs:/info/2026-06-15T09:08:12Z | 2026-06-15T09:08:12Z].
FossilOrigin-Name: 71334f7ec95edc91138b51ef6fe455a4a8c1db130484237eb241956bc549aa5c
2026-06-15 15:38:16 +00:00
drh a2fd301a6a Improvements to handling of inequality constraints on generate_series().value
against very large floating-point values.
[bugs:/info/2026-06-15T04:37:48Z|Bug 2026-06-15T04:37:48Z].

FossilOrigin-Name: 5aab8c2cde63f9db6b2346c86512efd6297937cad4e1306759b0f448815ad2e0
2026-06-15 15:27:26 +00:00
drh 53f419e2c8 Additional tweaks and test cases for generate_series() constraints
using very large floating-point numbers.

FossilOrigin-Name: 50d611404a444f23368c684dfa6dc34b057f8adb45aa058bcf3b2768e908eb3e
2026-06-15 15:24:37 +00:00
drh 0cdc6432f7 Better behavior for generate_series() in cases where constraints involve
floating point number that are near the minimum and maximum 64-bit integer
values.

FossilOrigin-Name: 236ef21789c4ebb67a8cf0a841341fab1477a6fe8e88b575e9f450a8f868e618
2026-06-15 14:16:13 +00:00
dan 667d1b15c1 Avoid a possible buffer overrun in 32-bit builds of fts5 that could occur when processing corrupt records. Bug [bugs:/info/2026-06-14T12:21:15Z | 2026-06-14T12:21:15Z].
FossilOrigin-Name: 0fa3345fe4464804f6846c2598774b9e700df39570e81e020de21e06e2ff044d
2026-06-15 13:39:20 +00:00
stephan b1bbff20a0 Revert the native impl of kvvfs's xOpen() (as distinct from the JS impl which the wasm build uses) to the historical db name restrictions of 'local' or 'session', failing with SQLITE_CANTOPEN if passed another name. [ec866b04d088e53b] overhauled support for kvvfs db names in JS but it turns out that the native impl still relies on those names in order to match journals to databases. Correct a related too-lenient assert() in the WASM pieces.
FossilOrigin-Name: 4b3ec30c63e3824163a2e6cacceb9630301b61f3ffd2b80f8a7b234f09bc251b
2026-06-15 12:36:24 +00:00
dan 36e9e015de Speed up SQL aggregate functions percentile() and median() by avoiding a full sort of the array of arguments.
FossilOrigin-Name: 9232b5f21d76dc702ccda5c689d61bcd0057fb1f2a4db6a70c607c25ad03a027
2026-06-13 20:16:54 +00:00
47 changed files with 925 additions and 301 deletions
+15
View File
@@ -2754,6 +2754,21 @@ THREADTEST3_SRC = \
threadtest3.exe: $(THREADTEST3_SRC) $(TOP)\src\test_multiplex.c $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) $(TOP)\test\threadtest3.c $(TOP)\src\test_multiplex.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
# Convenienced targets for common executables that omit
# the .exe suffix
#
sqldiff: sqldiff.exe
sqlite3_rsync: sqlite3_rsync.exe
fuzzcheck: fuzzcheck.exe
testfixture: testfixture.exe
sqlite3: $(SQLITE3EXE)
showdb: showdb.exe
LogEst: LogEst.exe
wordcount: wordcount.exe
speedtest1: speedtest1.exe
kvtest: kvtest.exe
jimsh0: jimsh0.exe
# Display key variables that control which version of TCL is to be used.
#
tcl-env:
+1 -1
View File
@@ -466,7 +466,7 @@ proc sqlite-configure {buildMode configScript} {
proc sqlite-configure-phase1 {buildMode} {
define PACKAGE_NAME sqlite
define PACKAGE_URL {https://sqlite.org}
define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/bugs
define PACKAGE_STRING "[get-define PACKAGE_NAME] [get-define PACKAGE_VERSION]"
proj-xfer-options-aliases {
# Carry values from hidden --flag aliases over to their canonical
+1 -1
View File
@@ -4359,7 +4359,7 @@ static int fts3IncrmergeLoad(
return FTS_CORRUPT_VTAB;
}
pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT;
pWriter->nLeafEst = (int)(((iEnd - iStart)+1)/FTS_MAX_APPENDABLE_HEIGHT);
pWriter->iStart = iStart;
pWriter->iEnd = iEnd;
pWriter->iAbsLevel = iAbsLevel;
+1 -1
View File
@@ -1166,7 +1166,7 @@ static int fts5StructureDecode(
i += fts5GetVarint32(&pData[i], nTotal);
if( nTotal<pLvl->nMerge ) rc = FTS5_CORRUPT;
pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(&rc,
nTotal * sizeof(Fts5StructureSegment)
(i64)nTotal * sizeof(Fts5StructureSegment)
);
nSegment -= nTotal;
}
+23 -26
View File
@@ -365,34 +365,31 @@ int sqlite3Fts5StorageOpen(
if( pConfig->eContent==FTS5_CONTENT_NORMAL
|| pConfig->eContent==FTS5_CONTENT_UNINDEXED
){
int nDefn = 32 + pConfig->nCol*10;
char *zDefn = sqlite3_malloc64(32 + (sqlite3_int64)pConfig->nCol * 20);
if( zDefn==0 ){
rc = SQLITE_NOMEM;
}else{
int i;
int iOff;
sqlite3_snprintf(nDefn, zDefn, "id INTEGER PRIMARY KEY");
iOff = (int)strlen(zDefn);
for(i=0; i<pConfig->nCol; i++){
if( pConfig->eContent==FTS5_CONTENT_NORMAL
|| pConfig->abUnindexed[i]
){
sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", c%d", i);
iOff += (int)strlen(&zDefn[iOff]);
}
int i = 0;
char *zDefn = 0;
sqlite3_str *pDefn = sqlite3_str_new(pConfig->db);
sqlite3_str_appendf(pDefn, "id INTEGER PRIMARY KEY");
for(i=0; i<pConfig->nCol; i++){
if( pConfig->eContent==FTS5_CONTENT_NORMAL || pConfig->abUnindexed[i] ){
sqlite3_str_appendf(pDefn, ", c%d", i);
}
if( pConfig->bLocale ){
for(i=0; i<pConfig->nCol; i++){
if( pConfig->abUnindexed[i]==0 ){
sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], ", l%d", i);
iOff += (int)strlen(&zDefn[iOff]);
}
}
}
rc = sqlite3Fts5CreateTable(pConfig, "content", zDefn, 0, pzErr);
}
sqlite3_free(zDefn);
if( pConfig->bLocale ){
for(i=0; i<pConfig->nCol; i++){
if( pConfig->abUnindexed[i]==0 ){
sqlite3_str_appendf(pDefn, ", l%d", i);
}
}
}
zDefn = sqlite3_str_finish(pDefn);
if( zDefn ){
rc = sqlite3Fts5CreateTable(pConfig, "content", zDefn, 0, pzErr);
sqlite3_free(zDefn);
}else{
rc = SQLITE_NOMEM;
}
}
if( rc==SQLITE_OK && pConfig->bColumnsize ){
+77
View File
@@ -2134,6 +2134,83 @@ do_catchsql_test 13.1 {
SELECT * FROM t('a:hello')
} {0 {{hello world} {foo bar}}}
#-------------------------------------------------------------------------
reset_db
#-------------------------------------------------------------------------
reset_db
do_test 14.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
.open --hexdb
| size 24576 pagesize 4096 filename vuln_001.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 03 00 00 00 06 .....@ ........
| 32: 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 ................
| 96: 00 2e 76 89 0d 00 00 00 06 0e 0a 00 0f c7 0f 74 ..v............t
| 112: 0f 0c 0e b8 0e 5f 0e 0a 00 00 00 00 00 00 00 00 ....._..........
| 3584: 00 00 00 00 00 00 00 00 00 00 53 06 06 17 1d 1d ..........S.....
| 3600: 01 7b 74 61 62 6c 65 74 5f 63 6f 6e 66 69 67 74 ..tablet_configt
| 3616: 5f 63 6f 6e 66 69 67 06 43 52 45 41 54 45 20 54 _config.CREATE T
| 3632: 41 42 4c 45 20 27 74 5f 63 6f 6e 66 69 67 27 28 ABLE 't_config'(
| 3648: 6b 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 k PRIMARY KEY, v
| 3664: 29 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 57 ) WITHOUT ROWIDW
| 3680: 05 06 17 1f 1f 01 7f 74 61 62 6c 65 74 5f 64 6f .......tablet_do
| 3696: 63 73 69 7a 65 74 5f 64 6f 63 73 69 7a 65 05 43 csizet_docsize.C
| 3712: 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 5f 64 REATE TABLE 't_d
| 3728: 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 54 45 47 ocsize'(id INTEG
| 3744: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 ER PRIMARY KEY,
| 3760: 73 7a 20 42 4c 4f 42 29 52 04 06 17 1f 1f 01 75 sz BLOB)R......u
| 3776: 74 61 62 6c 65 74 5f 63 6f 6e 74 65 6e 74 74 5f tablet_contentt_
| 3792: 63 6f 6e 74 65 6e 74 04 43 52 45 41 54 45 20 54 content.CREATE T
| 3808: 41 42 4c 45 20 27 74 5f 63 6f 6e 74 65 6e 74 27 ABLE 't_content'
| 3824: 28 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d (id INTEGER PRIM
| 3840: 41 52 59 20 4b 45 59 2c 20 63 30 29 66 03 07 17 ARY KEY, c0)f...
| 3856: 17 17 01 81 2b 74 61 62 6c 65 74 5f 69 64 78 74 ....+tablet_idxt
| 3872: 5f 69 64 78 03 43 52 45 41 54 45 20 54 41 42 4c _idx.CREATE TABL
| 3888: 45 20 27 74 5f 69 64 78 27 28 73 65 67 69 64 2c E 't_idx'(segid,
| 3904: 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 52 49 term, pgno, PRI
| 3920: 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64 2c 20 MARY KEY(segid,
| 3936: 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54 20 52 term)) WITHOUT R
| 3952: 4f 57 49 44 51 02 06 17 19 19 01 7f 74 61 62 6c OWIDQ.......tabl
| 3968: 65 74 5f 64 61 74 61 74 5f 64 61 74 61 02 43 52 et_datat_data.CR
| 3984: 45 41 54 45 20 54 41 42 4c 45 20 27 74 5f 64 61 EATE TABLE 't_da
| 4000: 74 61 27 28 69 64 20 49 4e 54 45 47 45 52 20 50 ta'(id INTEGER P
| 4016: 52 49 4d 41 52 59 20 4b 45 59 2c 20 62 6c 6f 63 RIMARY KEY, bloc
| 4032: 6b 20 42 4c 4f 42 29 37 01 06 17 0f 0f 08 61 74 k BLOB)7......at
| 4048: 61 62 6c 65 74 74 43 52 45 41 54 45 20 56 49 52 ablettCREATE VIR
| 4064: 54 55 41 4c 20 54 41 42 4c 45 20 74 20 55 53 49 TUAL TABLE t USI
| 4080: 4e 47 20 66 74 73 35 28 63 6f 6e 74 65 6e 74 29 NG fts5(content)
| page 2 offset 4096
| 0: 0d 0f ef 00 03 0f ac 00 0f e8 0f ac 0f c4 00 00 ................
| 4000: 00 00 00 00 00 00 00 00 00 00 00 00 16 0a 03 00 ................
| 4016: 32 01 00 00 00 01 01 01 00 d5 aa d5 2b 01 01 01 2...........+...
| 4032: 83 74 01 01 1d 84 80 80 80 80 01 03 00 40 00 00 .t...........@..
| 4048: 00 18 06 30 68 65 6c 6c 6f 01 02 02 01 05 77 6f ...0hello.....wo
| 4064: 72 6c 64 01 02 03 04 0a 05 01 03 00 10 01 02 00 rld.............
| 4080: 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
| page 3 offset 8192
| 0: 0a 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
| page 4 offset 12288
| 0: 0d 00 00 00 01 0f f0 00 0f f0 00 00 00 00 00 00 ................
| 4080: 0e 01 03 00 23 68 65 6c 6c 6f 20 77 6f 72 6c 64 ....#hello world
| page 5 offset 16384
| 0: 0d 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 04 01 03 00 0e 02 ................
| page 6 offset 20480
| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
| end vuln_001.db
}]} {}
do_catchsql_test 14.1 {
SELECT * FROM t('hello');
} {1 {out of memory}}
sqlite3_fts5_may_be_corrupt 0
finish_test
+13
View File
@@ -743,6 +743,19 @@ do_execsql_test 15.4 {
SELECT c, fts5_columnlocale(ft, 2) FROM ft
} {three {} three loc}
#-------------------------------------------------------------------------
#
set nMaxCol 500
set nStep 20
for {set ii $nStep} {$ii <= $nMaxCol} {incr ii $nStep} {
set C [list]
for {set iCol 0} {$iCol<$ii} {incr iCol} {
lappend C col$iCol
}
set ct "CREATE VIRTUAL TABLE t$ii USING fts5([join $C ,], locale=1)"
do_execsql_test 16.$ii $ct
}
finish_test
+29 -11
View File
@@ -400,6 +400,16 @@ static double seriesFloor(double r){
}
#endif
/* Convert a floating point value to its closest integer. Do so in
** a way that avoids 'outside the range of representable values' warnings
** from UBSAN.
*/
sqlite3_int64 seriesRealToI64(double r){
if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
if( r>+9223372036854774784.0 ) return LARGEST_INT64;
return (sqlite3_int64)r;
}
/*
** This method is called to "rewind" the series_cursor object back
** to the first row of output. This method is always called at least
@@ -522,7 +532,7 @@ static int seriesFilter(
&& r>=(double)SMALLEST_INT64
&& r<=(double)LARGEST_INT64
){
iMin = iMax = (sqlite3_int64)r;
iMin = iMax = seriesRealToI64(r);
}else{
goto series_no_rows;
}
@@ -530,15 +540,19 @@ static int seriesFilter(
iMin = iMax = sqlite3_value_int64(argv[iArg++]);
}
}else{
if( idxNum & 0x0300 ){ /* value>X or value>=X */
if( idxNum & 0x0300 ){ /* value>X (0x200) or value>=X (0x100) */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
if( r<(double)SMALLEST_INT64 ){
if( r<=(double)SMALLEST_INT64 ){
iMin = SMALLEST_INT64;
}else if( (idxNum & 0x0200)!=0 && r==seriesCeil(r) ){
iMin = (sqlite3_int64)seriesCeil(r)+1;
}else if( r>(double)LARGEST_INT64 ){
goto series_no_rows;
}else{
iMin = (sqlite3_int64)seriesCeil(r);
iMin = seriesRealToI64(seriesCeil(r));
if( (idxNum & 0x0200)!=0 && r==seriesCeil(r) ){
if( iMin==LARGEST_INT64 ) goto series_no_rows;
iMin++;
}
}
}else{
iMin = sqlite3_value_int64(argv[iArg++]);
@@ -551,15 +565,19 @@ static int seriesFilter(
}
}
}
if( idxNum & 0x3000 ){ /* value<X or value<=X */
if( idxNum & 0x3000 ){ /* value<X (0x2000) or value<=X (0x1000) */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
if( r>(double)LARGEST_INT64 ){
if( r>=(double)LARGEST_INT64 ){
iMax = LARGEST_INT64;
}else if( (idxNum & 0x2000)!=0 && r==seriesFloor(r) ){
iMax = ((sqlite3_int64)r)-1;
}else if( r<=(double)SMALLEST_INT64 ){
goto series_no_rows;
}else{
iMax = (sqlite3_int64)seriesFloor(r);
iMax = seriesRealToI64(seriesFloor(r));
if( (idxNum & 0x2000)!=0 && r==seriesFloor(r) ){
if( iMax==SMALLEST_INT64 ) goto series_no_rows;
iMax--;
}
}
}else{
iMax = sqlite3_value_int64(argv[iArg++]);
+1 -1
View File
@@ -175,7 +175,7 @@ static void hash_step(
}else{
i = 0;
}
(void)memcpy(&p->buffer[j], &data[i], len - i);
if( len-i>0 ) (void)memcpy(&p->buffer[j], &data[i], len - i);
}
/* Compute a string using sqlite3_vsnprintf() and hash it */
-4
View File
@@ -811,10 +811,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
xOpen: function(pProtoVfs,zName,pProtoFile,flags,pOutFlags){
cache.popError();
let zToFree /* alloc()'d memory for temp db name */;
if( 0 ){
/* tester1.js makes it a lot further if we do this. */
flags |= capi.SQLITE_OPEN_CREATE;
}
try{
if( !zName ){
zToFree = wasm.allocCString(""+pProtoFile+"."
+1 -1
View File
@@ -1557,7 +1557,7 @@ SQLITE_WASM_EXPORT2(int,sqlite3__wasm_posix_create_file,
SQLITE_WASM_EXPORT2(const char *,sqlite3__wasm_kvvfsMakeKey,
(const char *zClass, const char *zKeyIn)){
static char buf[SQLITE_KVOS_SZ+1] = {0};
assert(sqlite3KvvfsMethods.nKeySize>=32);
assert(sqlite3KvvfsMethods.nKeySize>32);
if( zClass && *zClass ){
kvrecordMakeKey(zClass, zKeyIn, buf);
return buf;
+26 -5
View File
@@ -3064,10 +3064,10 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const JDb = sqlite3.oo1.JsStorageDb;
const pVfs = capi.sqlite3_vfs_find('kvvfs');
T.assert(looksLikePtr(pVfs));
let x = sqlite3.kvvfs.internal.storageForZClass('session');
T.assert( 0 === x.files.length )
.assert( globalThis.sessionStorage===x.storage )
.assert( 'kvvfs-session-' === x.keyPrefix );
const pStorage = sqlite3.kvvfs.internal.storageForZClass('session');
T.assert( 0 === pStorage.files.length )
.assert( globalThis.sessionStorage===pStorage.storage )
.assert( 'kvvfs-session-' === pStorage.keyPrefix );
const filename = this.kvvfsDbFile = 'session';
const unlink = this.kvvfsUnlink = ()=>sqlite3.kvvfs.clear(filename);
unlink();
@@ -3085,9 +3085,30 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
db.exec('insert into kvvfs(a) values(4),(5),(6)');
T.assert(6 === db.selectValue('select count(*) from kvvfs'));
}finally{
if( db ) db.close();
if( db ){
db.close();
db = null;
}
}
//console.debug("sessionStorage",globalThis.sessionStorage);
const corruptJrnl = [
/* Test that it recovers properly from a bad journal:
https://sqlite.org/bugs/forumpost/20e208fe172cae4f */
pStorage.keyPrefix+'jrnl',
'cb d9d505f920a163d7ffffffffdeadbeef000000010000020000001000'
];
sessionStorage.setItem(...corruptJrnl);
//console.debug("sessionStorage",globalThis.sessionStorage);
T.assert( corruptJrnl[1] === sessionStorage.getItem(corruptJrnl[0]) );
try{
db = new JDb(filename);
T.assert(6 === db.selectValue('select count(*) from kvvfs'));
db.exec('insert into kvvfs(a) values(7),(8),(9)');
T.assert(9 === db.selectValue('select count(*) from kvvfs'));
T.assert( corruptJrnl[1] !== sessionStorage.getItem(corruptJrnl[0]) );
}finally{
if( db ) db.close();
}
}
}/*kvvfs sanity checks*/)
.t({
+49 -49
View File
@@ -1,5 +1,5 @@
C Revert\sthe\snative\simpl\sof\skvvfs's\sxOpen()\s(as\sdistinct\sfrom\sthe\sJS\simpl\swhich\sthe\swasm\sbuild\suses)\sto\sthe\shistorical\sdb\sname\srestrictions\sof\s'local'\sor\s'session',\sfailing\swith\sSQLITE_CANTOPEN\sif\spassed\sanother\sname.\s[ec866b04d088e53b]\soverhauled\ssupport\sfor\skvvfs\sdb\snames\sin\sJS\sbut\sit\sturns\sout\sthat\sthe\snative\simpl\sstill\srelies\son\sthose\snames\sin\sorder\sto\smatch\sjournals\sto\sdatabases.\sCorrect\sa\srelated\stoo-lenient\sassert()\sin\sthe\sWASM\spieces.
D 2026-06-15T12:22:06.262
C Correct\stest\sfrom\s[96a48a15760a]\s-\sthat\sjournal\swas\sindeed\scorrupt,\sbut\snot\sin\sthe\sintended\smanner.\sAdd\sa\sverification\sthat\sthe\sbad\sjournal\sgets\sreplaced\safter\sa\swrite.
D 2026-06-21T11:38:05.728
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -7,7 +7,7 @@ F AGENTS.md 44ddfb38ef23e277888bd70ae378e6cbf5f5cab0e2a4420bd21d89b6caff7a4a
F LICENSE.md 6bc480fc673fb4acbc4094e77edb326267dd460162d7723c7f30bee2d3d9e97d
F Makefile.in 5fda086f33b144da08119255da1d2557f983d0764a13707f05acf0159fd89ba5
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
F Makefile.msc 46ff6560f0046d92017ccafc91a3cd6cb2b54fbd25c56b2b6890cd84ed268159
F Makefile.msc ae6c8f8c39ed9cec7e3fc27390209117a943acd81941b5e81e8cd828b1875d93
F README.md f00091ffb5c6379b783afb57ca5f443a5742e119082f37c407f64a5e16c56346
F VERSION 99cf3be5f13d091183e4314b7fc2e0c0e69accfbe64608b45a313338bbdd7b62
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
@@ -48,7 +48,7 @@ F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1
F autosetup/jimsh0.c 740dc8cbfaedaff1f27b54b32e0015b22fa6c1a439492b9795968d61e56bab75
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl 67683f214977a416baafc4c1020f9940ff047a7306b2292c5872d6287460b7d5
F autosetup/sqlite-config.tcl 2205b8bcc193a5d46584ebc1cf44c7a93a977d155e20dc38b18dcce720e58074
F autosetup/sqlite-config.tcl a503f8b418547c2872348dbcb71abb09726f3970088625ec90d8000035b06b32
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
F autosetup/teaish/core.tcl e014dd95900c7f9a34e8e0f460f47e94841059827bce8b4c49668b0c7ae3f1a0
@@ -98,7 +98,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154
F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c b84f9808f6df7b19db34af2397d82a7c5db4d30486c428f4f296d286996cea02
F ext/fts3/fts3_write.c 3a78030f52747d53ef8c9bdff8ad137957834ce2ff7367db5de2b0fabdbefb5f
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674
@@ -114,9 +114,9 @@ F ext/fts5/fts5_buffer.c dcc3f0352339fe79c9d8abbc1c2009bc3469206467880bf43558447
F ext/fts5/fts5_config.c bfba970fe1e4eed18ee57c8d51458e226db9a960ddf775c5e50e3d76603a667e
F ext/fts5/fts5_expr.c b906c59e9e842805cc3eea4e131b822e586bb01260e542f67920c61798dcb53d
F ext/fts5/fts5_hash.c 341a08ad0153b397b819ef3d7a7959c1dc3c84a6988a431d93dece8bd62ae10e
F ext/fts5/fts5_index.c 96ccae2fa74b419b1ce56ae10523d681f74dba3c7b86fff6948cfa05c49e1e75
F ext/fts5/fts5_index.c 5a2ab65d170a4b3314a927c5861740ba9070aa5bf326717690de5dd90fbb7b54
F ext/fts5/fts5_main.c b0fed47b3b4420ba6810373480a75bc28a9c0b7d16478d19a396436fb3ff17d7
F ext/fts5/fts5_storage.c 19bc7c4cbe1e6a2dd9849ef7d84b5ca1fcbf194cefc3e386b901e00e08bf05c2
F ext/fts5/fts5_storage.c 46b0024fdd8002fbfba162230e5cc212c8f019ba4075396860354bfaf549a546
F ext/fts5/fts5_tcl.c 2be6cc14f9448f720fd4418339cd202961a0801ea9424cb3d9de946f8f5a051c
F ext/fts5/fts5_test_mi.c 4308d5658cb1f5eee5998dcbaac7d5bdf7a2ef43c8192ca6e0c843f856ccee26
F ext/fts5/fts5_test_tok.c 6021033bd4f4feffe8579efb6e1f58156ed462256bf99a2acdbd629246529204
@@ -166,7 +166,7 @@ F ext/fts5/test/fts5corrupt.test 237fce1c3261bb3a5bec333b0f0dbf5b105ec32627ef14c
F ext/fts5/test/fts5corrupt2.test 4a03a158c2cb617c9f76d26b35c1ef2534124bc0bbddcea38dfd5b170ebea27b
F ext/fts5/test/fts5corrupt3.test 121a8a7622dfe1be1bc55cbe70eddd6a3416f76a837dc8c06a11a32e781595a4
F ext/fts5/test/fts5corrupt4.test dc08d19f5b8943e95a7778a7d8da592042504faf18dd93f68f7d7a0d7d7dd733
F ext/fts5/test/fts5corrupt5.test b9085599389721b38f080f501660c931cd608f8ecbc93c23644344f74ef7aa21
F ext/fts5/test/fts5corrupt5.test 541dcee99eee8736f6b252d996a1262a778aa9fbe6344c781f9ea2becfae0bf5
F ext/fts5/test/fts5corrupt6.test 2d72db743db7b5d9c9a6d0cfef24d799ed1aa5e8192b66c40e871a37ed9eed06
F ext/fts5/test/fts5corrupt7.test 9664c15360e8b649ad76f457a0bbf5a7271b8eff1a8ee141ea039bc63240c934
F ext/fts5/test/fts5corrupt8.test 0b10750caf8aa23fa1c379ca4caf6130d41454505e4d5315590f4061eedcbe44
@@ -209,7 +209,7 @@ F ext/fts5/test/fts5join.test 3791e30d034050281191cd8141d969849f6c060135f1e3938f
F ext/fts5/test/fts5lastrowid.test f36298a1fb9f988bde060a274a7ce638faa9c38a31400f8d2d27ea9373e0c4a1
F ext/fts5/test/fts5leftjoin.test 1c14b51f4d1344a89e488160882f05a2246dd7e70c5cf077c8fb473e03c66338
F ext/fts5/test/fts5limits.test 8ab67cf5d311c124b6ceb0062d0297767176df4572d955fce79fa43004dff01c
F ext/fts5/test/fts5locale.test 83ba7ee12628b540d3098f39c39c1de0c0440eddff8f7512c8c698d0c4a3ae3c
F ext/fts5/test/fts5locale.test e662cc85b348d27247a7881409d1d1a5f910686c016591094be959d7a1b5a0ba
F ext/fts5/test/fts5matchinfo.test bc9e74157773db7f00aec1e85587f1145956ebdf1672c136f0f04323b2752aa0
F ext/fts5/test/fts5merge.test 088133e135ef7dcd6701753c95b8b10be3c52fa1a99507933e00756d6437489e
F ext/fts5/test/fts5merge2.test 3ebad1a59d6ad3fb66eff6523a09e95dc6367cbefb3cd73196801dea0425c8e2
@@ -395,8 +395,8 @@ F ext/misc/randomjson.c ef835fc64289e76ac4873b85fe12f9463a036168d7683cf2b773e36e
F ext/misc/regexp.c 378e6e84516952a4b9f3f4df88927f20e6538e2609f55b773ed78899dab8206e
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/series.c 496f43bac9bad2ee2cea63fb5212036f30ad3003b4cd317d5c2d6f3ad7c7d264
F ext/misc/sha1.c 9a11826db885e8afd997c0a1b28bb799a43e462ef770ac33f19e744887c9c6fa
F ext/misc/series.c ba66183ae4da6875e5cdafc065322118fd7f455a568ea2f22b45eff85f639f42
F ext/misc/sha1.c eed0ad67ad7c69798278183a74523d95623d4864821a3f4dd82b234568e307c1
F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F ext/misc/spellfix.c e9e951f9712b6c302e4ee84f5db5a7b18daab87aa229867c66f34684d2dfbb40
@@ -601,12 +601,12 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1fa34e9b0e3b90a8898e4f700d7125e44c818
F ext/wasm/api/sqlite3-license-version-header.js 98d90255a12d02214db634e041c8e7f2f133d9361a8ebf000ba9c9af4c6761cc
F ext/wasm/api/sqlite3-opfs-async-proxy.c-pp.js 25e31482b04293a33d7599f1459eb552b3eb36ca10c02c816122d3308bf80cb2
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js 27fb135ba3b805b66c90a7333b56080345bf1db79335c3e48b6d01ad7aa09607
F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js 96f79583dc12f836eadf3c6430a0beaed859306b67e8fd7b0fada8d22cc2393f
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 4325cb9a5ebfbff7cd3060e309b167116a2a1bcb9f8d69dd8e6d023dbdd783bb
F ext/wasm/api/sqlite3-vfs-opfs-wl.c-pp.js 3dbd918ef037cd8fa9c7b4dccb3c8637b228638654c429e7df6acab5981c75e2
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 3da8fe72dc9e76614a9c102b92e777ce03f81d788b607701c828d8fcbac44b06
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 366596d8ff73d4cefb938bbe95bc839d503c3fab6c8335ce4bf52f0d8a7dee81
F ext/wasm/api/sqlite3-wasm.c 67ea19a4a664abdec95bcff5ed87f2f0a7106e0f9cf382f12f70b4ebd7013c21
F ext/wasm/api/sqlite3-wasm.c 0bcc42b1faff0e4543bba1b595fe9cfde80e0c29e3abc475bce725f2a326a8e5
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46919740f8176c10f691431a81c769c35657e3b537e2ed2bde691f9017b0ee8a
F ext/wasm/api/sqlite3-worker1.c-pp.js 21b20d3b8d43471d1647123616a7e5435b1e4b6fa447714f91ffc7f950ea01e8
F ext/wasm/common/SqliteTestUtil.js dae753b95e72248c4395d8de8359e0d055cd9928488e8dd84aef89e46d23b32e
@@ -649,7 +649,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
F ext/wasm/tester1-worker.c-pp.html 7171022e7f4da8f46e5f50ea81dd6ce840b9235c47653a5deeb3764ccc2fe472
F ext/wasm/tester1.c-pp.html bd927ccf51ddd65e924660a0487add99e1b044afe03950e49d87ccf44efdddb6
F ext/wasm/tester1.c-pp.js 38beb509f2136851760db79becd41a1ec0abcaaec01de27749b0fafcb0372e54
F ext/wasm/tester1.c-pp.js 273f98ed9423c428e582e741b8097567fb6581c34f3c22427d7e02d400aa5743
F ext/wasm/tests/opfs/concurrency/index.html 706eab6308343c04ac2360aba6001af4ffaf46d8f33a0ccd02c64d93e3216a43
F ext/wasm/tests/opfs/concurrency/test.js 6919778fceaac1b7cc78caf41d796f545d2c4433b31188aa9689f05b5ad28828
F ext/wasm/tests/opfs/concurrency/worker.js 704d82c5e287e47f612349e027765943a58ad967dcf178fb5a1c3a8eaafb09af
@@ -670,8 +670,8 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 1b9c24374a85dfc7eb8fa7c4266ee0db4f9609cceecfc5481cd8307e5af04366
F sqlite3.pc.in e6dee284fba59ef500092fdc1843df3be8433323a3733c91da96690a50a5b398
F src/alter.c d7cbe4332a7a2c3a21ab58ee2609efade493f6ae78254613ada0759898629ee3
F src/analyze.c 03bcfc083fc0cccaa9ded93604e1d4244ea245c17285d463ef6a60425fcb247d
F src/alter.c da59ac700b52ba5d0e4dd099fb1818975cf8a79a546594da586b4e1eba3ae405
F src/analyze.c 73162482c656187823217f4c00758c9ee13a420c8745bc542129e0279b792287
F src/attach.c c58278c7d2d954785591c4fde81669ec3e4d52f348c453b028a19ae8adf4f338
F src/auth.c b5ece4e1edccad082c0332fa0087df225473bae0feea9269f824312201377185
F src/backup.c 6ebe22ccbedfcb92423833992130e8d65824be4e6599c3a03f540ab38fc7d13c
@@ -680,27 +680,27 @@ F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
F src/btree.c c9b13797b0b68e0c057ec796976b1ab1e8b4e766d1a7c7f919b2d8a1d2193a80
F src/btree.h e823c46d87f63d904d735a24b76146d19f51f04445ea561f71cc3382fd1307f0
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
F src/build.c 866e584cdf40fbc83f530af9fd4d0991582a6fdbd8a9911b7cdbbea5f26a4a9e
F src/build.c 09946336c3011c2ae2faccdf04e33336e1cd51fd836651be0cd7eb5814f7f6a0
F src/callback.c 3605bbf02bd7ed46c79cd48346db4a32fc51d67624400539c0532f4eead804ad
F src/carray.c 3efe3982d5fb323334c29328a4e189ccaef6b95612a6084ad5fa124fd5db1179
F src/complete.c f216b970ce99c5a657556cf1f17e7ddd494515d3beb63df426bf59ff43bd3d9a
F src/date.c 61e92f1f7e2e88e1cd91e91dc69eb2b2854e7877254470f9fabd776bfac922b8
F src/date.c 86d9530729eeb5b3d833e7403de495f4d4b79f3d5f7e74bcc8abda237f5aeafb
F src/dbpage.c c6a9de13b0a01f0bc94a41e16213ab1ecd15ccfe86df7255ced40fda9446257d
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 59eeca3fb88c29329afc41bb803ee568b120d9dd7470b5f38ab55cc38390b451
F src/expr.c e97dd9f6ada4c448764e225d8963091bf630b3efb2c92e4d0762571cca2a14e5
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 931f74cec1dc8038a0217ef340c91ce147dd1bbed08dc40c47ee0ec6edfffb08
F src/func.c 555d5f7686f9eef20fe3574889403f307a6cb16ada5b05cbc6a9288dcf75aaeb
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/func.c 7e049176003271095ba560bca90995c8cb7c1e944aee539513daba015b172a18
F src/global.c 7eea537ac0c113ac55cb2dd4d8fc2a6a91ae478be34231b4efaffc46817fee85
F src/hash.c 03c8c0f4be9e8bcb6de65aa26d34a61d48a9430747084a69f9469fbb00ea52ca
F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf
F src/hwtime.h 5cb15147c8583d0fc4748e1c12ea6f38c9deaeefa147a4d8d379fd9bc81fee9a
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 8dbc22f6ddcc5f0af3abf11daeb89b1978f00059cda15ebc61251fa7724fc7ee
F src/insert.c e6e9b574b4863649e2c433f2260f226183e697df1ab73fcb8da9a85d5abcd390
F src/json.c f058c449acb9fdb1d3d1bb9f7e97b225ba773f5b6fdcec4310d3f49980125ed4
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 78d5b06f18996ffa1203129b28fea043f63a87a4117539678f1d761c30b4ff65
F src/loadext.c 5cd4cd7ec6e1a46416806899086363fbf95eecd3bfb9a388b436c9a77243c902
F src/main.c efd782fadd65b8e67952f439d56d7605134582346573018a614a8e082e074bd7
F src/malloc.c 422f7e0498e1c9ef967f06283b6f2c0b16db6b905d8e06f6dbc8baaa3e4e6c5a
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
@@ -717,10 +717,10 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
F src/mutex_unix.c caec9862aeebad01f6c8997cf709a239abeb0715fcce1895720b87fe7e2ef42f
F src/mutex_w32.c d44e94c064f8ab39e0318fb6fa00171cf7e5645bd4241129b07d655a8ddbd44b
F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878
F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d
F src/os.c 9566966dd14376099fe8f715e744ab4fef204f55bd89126c5ddd06eb37df9457
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c a8f93adde10d74923f28dffb744162134599249c02d505f5043745dd1b4b917f
F src/os_kv.c 26ccc36ea963d328682fa685a106d7404617a2284ecdc7a35fb38d0c9242f440
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
F src/os_unix.c 83759942d1ea8d59daed50901c123016f845fada74caf3496b8a2537c9a08838
F src/os_win.c 68b1c31693a5aeeb8126f618c95f7b53fb39e254836f9a95fbf2733461a7e01d
@@ -732,17 +732,17 @@ F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 092b758d2c5e4dabb30eae46d8dfad77c0f70b16bf3ff1943f7a232b0fe0d4ba
F src/pcache1.c d7ee0f95992501a65379f620b3de1430b64e52e397769938668a9fd9dd1c8145
F src/pragma.c 789ef67117b74b5be0a2db6681f7f0c55e6913791b9da309aefd280de2c8a74d
F src/prepare.c 084a037fd3810cb7ffbfc001cd58c0ffac68ba36598a5084b55ea2a090014ebd
F src/printf.c 1b3d26ed8ea9a900317832625d5e83b833c7cf14640d7d98a2c235e172b6fefc
F src/prepare.c d055c59c23b917367ed199a52888132316aa9cb9f7653ca71f0c45bd267206fd
F src/printf.c 6916d50913c3271aefe96d3483701ceca8644331ec4c7b23a5aa54a9ba36230f
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c d0724113da9f5c0430d2052808ce59519f51ae7c4fbb1f5ef21fe3a832956086
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 5c3a5e3c1e6c3f8ccabeb414e18dce64e6f3e797de225ee93034f2c9e76f289c
F src/select.c 80ea6935f8470b97d1212bc1b759b7fadb28351797877f493d0cf598be1fef5e
F src/shell.c.in a4e83895cfa336065ad7f7a7dea8fc2a19d050f7ce7466621c67208acaac9e44
F src/sqlite.h.in 22674c0fc97b5ee21ace65b9bc1ed805dab35f433326d8022a642676c3b8a9d1
F src/sqlite.h.in 8c70db561507478176b942a3f88cac396e00993eafb827ed31d48c191f327408
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 9788c301f95370fa30e808861f1d2e6f022a816ddbe2a4f67486784c1b31db2e
F src/sqliteInt.h 5bec8cfdc8346a122b35312452eb6af33fc750a6c901f2c651a2f53eba0b979f
F src/sqlite3ext.h 0efd4723bad9124ea1f581d9f1ea0254ac1c6f3e5fb29e4f3dcf36c72485a456
F src/sqliteInt.h 92563b8edc673513b82d87bf6a8d7aeb554b2c7b7d5e30992fbca04010db79ac
F src/sqliteLimit.h c70656b67ab5b96741a8f1c812bdd80c81f2b1c1e443d0cc3ea8c33bb1f1a092
F src/status.c 7565d63a79aa2f326339a24a0461a60096d0bd2bce711fefb50b5c89335f3592
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -798,17 +798,17 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 85d8b9f05f78211c61e3739ab5db761d7118766d1916ae7f2764735106bc4e13
F src/tokenize.c e9d52d9f7374d82dadcd11726bea8a597d43709d6672704f3f0375bf1d726912
F src/treeview.c feaa59f14db4f7b5aacca9c5ad5aeb562c1f98262c1ffd74371f4186ade91fc5
F src/trigger.c 4bf3bfb3851d165e4404a9f9e69357345f3f7103378c07e07139fdd8aeb7bd20
F src/trigger.c 5028874dd1f4fd3085bacd55c30114b5ad651525508656f65af09adf227181d5
F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf
F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
F src/upsert.c dd9f0fcccbfb4f20e1026a21a7254ba3f2c08e9cfa92affaff5b5ec3b00ea549
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
F src/util.c 98cf12c8ba65623a76c1eb6e6afa98ff40107c9919bf79af42f4bfc70e654232
F src/vacuum.c d3d35d8ae893d419ade5fa196d761a83bddcbb62137a1a157ae751ef38b26e82
F src/vdbe.c 8ed6f274dff8b9fb961d050a9ab933e7f6509221718bec862e85729d171c1606
F src/vdbe.c 39658ee12b9d6bf5fc546e1ede20b307d86d9e988ae709c9b461249a8312513d
F src/vdbe.h 70e862ac8a11b590f8c1eaac17a0078429d42bc4ea3f757a9af0f451dd966a71
F src/vdbeInt.h c31ba4dc8d280c2b1dc89c6fcee68f2555e3813ab34279552c20b964c0e338b1
F src/vdbeapi.c 6cdcbe5c7afa754c998e73d2d5d2805556268362914b952811bdfb9c78a37cf1
F src/vdbeaux.c bd3aaf77593a5590f617ce173e8677a21eca18522eadc1c4bc81b53f6d1c7e19
F src/vdbeapi.c 15c55a4be8edc06055502e15f60f444c8fc5cb6134e38b8486742e89670d5e8f
F src/vdbeaux.c a052c43fcf342651f655e6771003c175d49b237a9473c3c4d79d44725f494dae
F src/vdbeblob.c b3f0640db9642fbdc88bd6ebcc83d6009514cafc98f062f675f2c8d505d82692
F src/vdbemem.c 6e7ad67507c9a8e625b46256a9c003929331d6a27b99bbe139b8f0dab636e1f2
F src/vdbesort.c b69220f4ea9ffea5fdef34d968c60305444eea909252a81933b54c296d9cca70
@@ -822,8 +822,8 @@ F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 33e4a6558ee69f33d6a4e7069e3a40a55959d14e5653a9a83926e70305d471f3
F src/whereInt.h 8d94cb116c9e06205c3d5ac87af065fc044f8cf08bfdccd94b6ea1c1308e65da
F src/wherecode.c bc39ccbe3648f01157038b16cc55bdbff128590972b7185521b5526dc2815765
F src/whereexpr.c a1e22cf9f6cb59770d9652c757dcf1924078ad2d48a9da89e254be9327677465
F src/window.c c0a38cd32473e8e8e7bc435039f914a36ca42465506dc491c65870c01ddac9fb
F src/whereexpr.c 00e778c829a6ac6bf2bb8899cd1e39ccc48670d665b5891e99632180a2768a15
F src/window.c 0d7dacdf2e84c6ee8ff498d5cc881dd245fcb2f14f6c5976e97e112ce96e90dc
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test 4d7a34d328e58ca2a2d78fd76c27614a41ca7ddf4312ded9c68c04f430b3b47d
F test/affinity3.test 9b7d1133e11d5edd7805573c4ab6f3ba73b0b74a1f280d5b130d4bf3506a93ff
@@ -1074,7 +1074,7 @@ F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 235c610f8bf8ec44513e222b9085c7e49fad65ad0c1975ac2577109dd06fd8fa
F test/e_dropview.test 74e405df7fa0f762e0c9445b166fe03955856532e2bb234c372f7c51228d75e7
F test/e_expr.test 9bdb347b78b9f4eff9153ea97797facc179a821898588471a70808b4471a69b0
F test/e_fkey.test feeba6238aeff9d809fb6236b351da8df4ae9bda89e088e54526b31a0cbfeec5
F test/e_fkey.test 2a4ad815372a4b57dad91cd37932e18e68bf545f6c946e9a4cb3e7bde92b8e84
F test/e_fts3.test 17ba7c373aba4d4f5696ba147ee23fd1a1ef70782af050e03e262ca187c5ee07
F test/e_insert.test f02f7f17852b2163732c6611d193f84fc67bc641fb4882c77a464076e5eba80e
F test/e_reindex.test 027bb13d2c7e9e865886eed6349f126a273f8037899b636bf5fb53c7fc815921
@@ -1170,7 +1170,7 @@ F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c788
F test/fts3corrupt3.test 0d5b69a0998b4adf868cc301fc78f3d0707745f1d984ce044c205cdb764b491f
F test/fts3corrupt4.test c7f414fe29b97a478d15c90382c4ae077a2bbd2283bf8c63bf66dadaaed3edb8
F test/fts3corrupt5.test 0549f85ec4bd22e992f645f13c59b99d652f2f5e643dac75568bfd23a6db7ed5
F test/fts3corrupt6.test f417c910254f32c0bc9ead7affa991a1d5aec35b3b32a183ffb05eea78289525
F test/fts3corrupt6.test 9ea944e3cd17a36c64451059022fabff53bd338a43356d1f49264ce8aa9477ad
F test/fts3corrupt7.test 8564d278801a7947d1c74d8819adee7dfed18b81574d0c42f8a1acc6759fc65a
F test/fts3cov.test 1e5ecea0e4c1394cea97adcfb9fd3d2d5998fd563dacf465f413e6c7fa5cffb3
F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f
@@ -1629,8 +1629,8 @@ F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8e
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell-prompt.sql 8a320a78812d75349bd5e1a95178f7ff1f2194bb4cceee572865d127c51684b3
F test/shell1.test 2795124bb812d84ae7995fbfda4e518328cd9f31874bc2e5eb2bfe44ac31fa16
F test/shell2.test dc541d2681503e55466a24d35a4cbf8ca5b90b8fcdef37fc4db07373a67d31d3
F test/shell1.test 72893bc7957ff6402552ce4e31aa98a94478fa91bf5c4009a458711ad2e6efac
F test/shell2.test e0842ea6a28f86f1ef235e117b3a381d16b999e7bdd9655b1de663026dd8ea27
F test/shell3.test 91efdd545097a61a1f72cf79c9ad5b49da080f3f10282eaf4c3c272cd1012db2
F test/shell4.test e25580a792b7b54560c3a76b6968bd8189261f38979fe28e6bc6312c5db280db
F test/shell5.test a0c43d82a811a463a5d07d6418c5a045ab01a072544db8aa31ae394e93845d8d
@@ -1709,7 +1709,7 @@ F test/sync.test a619e407ede58a7b6e3e44375328628559fc9695a9c24c47cb5690a866b0031
F test/sync2.test 06152269ed73128782c450c355988fe8dd794d305833af75e1a5e79edd4dae47
F test/syscall.test a067468b43b8cb2305e9f9fe414e5f40c875bb5d2cba5f00b8154396e95fcf37
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test 7827c2dfd57a094125b059f51a2200eaf04d417af6b1e720c34a8cbf54e8a14f
F test/tabfunc01.test 23d1f92fbbbaaef4cb3a1ee15fd5b44e70bde1f3ee1a6b9df9ce43b05cf0b630
F test/table.test e87294bf1c80bfd7792142b84ab32ea5beb4f3f71e535d7fb263a6b2068377bf
F test/tableapi.test e37c33e6be2276e3a96bb54b00eea7f321277115d10e5b30fdb52a112b432750
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@@ -1906,7 +1906,7 @@ F test/trigger8.test 30cb0530bd7c4728055420e3f739aa00412eafa4
F test/trigger9.test 1724b595661da3dd3c8d79f0ebae818132a39e65c241bad2049f66952b1dc29d
F test/triggerA.test 837be862d8721f903dba3f3ceff05b32e0bee5214cf6ea3da5fadf12d3650e9d
F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe
F test/triggerC.test 29f5a28d0fe39e6e2c01f6e1f53f08c0955170ae10a63ad023e33cb0a1682a51
F test/triggerC.test 1faacf5249a7abe8bdc44aafe170f2141a72cb2abcef300dc91e3d55c4158f41
F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650
F test/triggerE.test 612969cb57a4ef792059ad6d01af0117e1ae862c283753ffcc9a6428642b22ee
F test/triggerF.test 5d76f0a8c428ff87a4d5ed52da06f6096a2c787a1e21b846111dfac4123de3ad
@@ -1944,7 +1944,7 @@ F test/upsert1.test 77e3cbabd6b5c773056aca39bda7a690901f1dbd08b0a26ee3b5aec9e9e2
F test/upsert2.test 720e94d09f7362a282bc69b3c6b83d51daeaaf0440eb4920a08b86518b8c7496
F test/upsert3.test 88d7d590a1948a9cb6eac1b54b0642f67a9f35a1fc0f19b200e97d5d39e3179c
F test/upsert4.test 25d2a1da92f149331ae0c51ca6e3eee78189577585eab92de149900d62994fa5
F test/upsert5.test 9953b180d02d1369cdbb6c73c900834e5fef8cb78e98e07511c8762ec21cc176
F test/upsert5.test 8d0230b358965e0c11f7306b87ba1238970e44b8339e34609f44d0468c4ed458
F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
F test/uri.test 1250724af9beeed2d6c3716f5b990c483200c54f408d3c0ec9543a3c7961f8fc
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
@@ -1961,7 +1961,7 @@ F test/values.test 0e037c50789ac2a308746567d07b53b2f6026c1bb3a435d1b099424600e64
F test/valuesfault.test 2ef23ed965e3bd08e268cdc38a0d11653390ddbbe1e8e2e98d16f55edd30f6e8
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
F test/view.test 3c23d7a068e9e4a0c4e6907498042772adea725f0630c3d9638ffd4e5a08b92b
F test/view.test 79cfd77b29ce49c172fee2ed9ec98d34924e70bebc75c8edb65f6a9bcd80d569
F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679
F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456
F test/vt02.c c2faf56d74470d569cd00741acb3f1719ee95d668f84ef58acc3872635789680
@@ -2036,7 +2036,7 @@ F test/walslow.test 0c51843836c9dcf40a5ac05aa781bfb977b396ee2c872d92bd48b79d5dd9
F test/walthread.test d562f51a61191ccfab64940df7aa1cef87c902fa5ab742590ef7f859dfe6a44b
F test/walvfs.test e1a6ad0f3c78e98b55c3d5f0889cf366cc0d0a1cb2bccb44ac9ec67384adc4a1
F test/where.test 5087c72d26fd075a1644c8512be9fe18de9bf2d2b0754f7fd9b74a1c6540c4fc
F test/where2.test b73f8ee8f94b850764c429efe2d48171090628737dcc3df64a9f2214da02089f
F test/where2.test 3096dc7dc70dba52d974341f4a024e468c9ea3c1aa202a2e414a5413c0c5655c
F test/where3.test 4ccb156ae33de86414a52775a6f590a9d60ba2cbc7a93a24fa331b7bcf5b6030
F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
@@ -2208,8 +2208,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P 323d87541a63f0b2c64271c78ad6ebd5d04220da59aebfdfbc07caa691af816a
R 51cfc435247acd41a9fef55ac14421e5
P bd6bbd0e84226c90d864c28ac4d6acd908c4f06bfe63dcfd6fa6b8d17105b338
R 2de10755edf1cb1f73f8df94023358e4
U stephan
Z e2e94c5a7431ca24ffccdea8baf0e5ef
Z ab5ef0b4ce9e85fe36d53f715231baac
# Remove this line to create a well-formed Fossil manifest.
+2 -2
View File
@@ -1,2 +1,2 @@
branch mistake
tag mistake
branch trunk
tag trunk
+1 -1
View File
@@ -1 +1 @@
fabcad09176cce96cacdd55ef3dde3be5b8062f513ac13a70e3db874358e6be2
c9171221160f241b450d425f41bb53b42362dccfad4c3fdf64dd5c3562ed4096
+6 -9
View File
@@ -2661,9 +2661,8 @@ static void addConstraintFunc(
int iCol = sqlite3_value_int(argv[2]);
int iOff = 0;
int ii;
char *zNew = 0;
sqlite3_str *pNew;
int t = 0;
sqlite3 *db;
UNUSED_PARAMETER(NotUsed);
if( skipCreateTable(ctx, zSql, &iOff) ) return;
@@ -2683,13 +2682,11 @@ static void addConstraintFunc(
iOff += getWhitespace(&zSql[iOff]);
db = sqlite3_context_db_handle(ctx);
if( iCol<0 ){
zNew = sqlite3MPrintf(db, "%.*s, %s%s", iOff, zSql, zCons, &zSql[iOff]);
}else{
zNew = sqlite3MPrintf(db, "%.*s %s%s", iOff, zSql, zCons, &zSql[iOff]);
}
sqlite3_result_text(ctx, zNew, -1, SQLITE_DYNAMIC);
pNew = sqlite3_str_new(sqlite3_context_db_handle(ctx));
sqlite3_str_append(pNew, (const char*)zSql, iOff);
if( iCol<0 ) sqlite3_str_append(pNew, ",", 1);
sqlite3_str_appendf(pNew, " %s%s", zCons, &zSql[iOff]);
sqlite3_result_str(ctx, pNew, SQLITE_FINISH);
}
/*
+6 -6
View File
@@ -876,7 +876,7 @@ static void statGet(
assert( p->current.anEq[i] || p->nRow==0 );
#endif
}
sqlite3ResultStrAccum(context, &sStat);
sqlite3_result_str(context, &sStat, SQLITE_XFER);
}
#ifdef SQLITE_ENABLE_STAT4
else if( eCall==STAT_GET_ROWID ){
@@ -913,7 +913,7 @@ static void statGet(
sqlite3_str_appendf(&sStat, "%llu ", (u64)aCnt[i]);
}
if( sStat.nChar ) sStat.nChar--;
sqlite3ResultStrAccum(context, &sStat);
sqlite3_result_str(context, &sStat, SQLITE_XFER);
}
#endif /* SQLITE_ENABLE_STAT4 */
#ifndef SQLITE_DEBUG
@@ -1814,9 +1814,9 @@ static int loadStatTbl(
}
pIdx->nSampleCol = nIdxCol;
pIdx->mxSample = nSample;
nByte = ROUND8(sizeof(IndexSample) * nSample);
nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
nByte = ROUND8(sizeof64(IndexSample) * nSample);
nByte += sizeof64(tRowcnt) * nIdxCol * 3 * nSample;
nByte += nIdxCol * sizeof64(tRowcnt); /* Space for Index.aAvgEq[] */
pIdx->aSample = sqlite3DbMallocZero(db, nByte);
if( pIdx->aSample==0 ){
@@ -1824,7 +1824,7 @@ static int loadStatTbl(
return SQLITE_NOMEM_BKPT;
}
pPtr = (u8*)pIdx->aSample;
pPtr += ROUND8(nSample*sizeof(pIdx->aSample[0]));
pPtr += ROUND8(nSample*sizeof64(pIdx->aSample[0]));
pSpace = (tRowcnt*)pPtr;
assert( EIGHT_BYTE_ALIGNMENT( pSpace ) );
pIdx->aAvgEq = pSpace; pSpace += nIdxCol;
+3 -2
View File
@@ -70,6 +70,7 @@ static SQLITE_NOINLINE void lockTable(
assert( pToplevel->nTableLock < 0x7fff0000 );
nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1);
if( pToplevel->nTableLock==0 ) pToplevel->aTableLock = 0;
pToplevel->aTableLock =
sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes);
if( pToplevel->aTableLock ){
@@ -236,7 +237,7 @@ void sqlite3FinishCoding(Parse *pParse){
/* Initialize any AUTOINCREMENT data structures required.
*/
if( pParse->pAinc ) sqlite3AutoincrementBegin(pParse);
if( pParse->usesAinc ) sqlite3AutoincrementBegin(pParse);
/* Code constant expressions that were factored out of inner loops.
*/
@@ -269,7 +270,7 @@ void sqlite3FinishCoding(Parse *pParse){
if( pParse->nErr==0 ){
/* A minimum of one cursor is required if autoincrement is used
* See ticket [a696379c1f08866] */
assert( pParse->pAinc==0 || pParse->nTab>0 );
assert( pParse->usesAinc==0 || pParse->nTab>0 );
sqlite3VdbeMakeReady(v, pParse);
pParse->rc = SQLITE_DONE;
}else{
+31 -31
View File
@@ -1416,38 +1416,38 @@ static void strftimeFunc(
size_t i,j;
sqlite3 *db;
const char *zFmt;
sqlite3_str sRes;
sqlite3_str *pRes;
if( argc==0 ) return;
zFmt = (const char*)sqlite3_value_text(argv[0]);
if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
db = sqlite3_context_db_handle(context);
sqlite3StrAccumInit(&sRes, 0, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
pRes = sqlite3_str_new(db);
computeJD(&x);
computeYMD_HMS(&x);
for(i=j=0; zFmt[i]; i++){
char cf;
if( zFmt[i]!='%' ) continue;
if( j<i ) sqlite3_str_append(&sRes, zFmt+j, (int)(i-j));
if( j<i ) sqlite3_str_append(pRes, zFmt+j, (int)(i-j));
i++;
j = i + 1;
cf = zFmt[i];
switch( cf ){
case 'd': /* Fall thru */
case 'e': {
sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D);
sqlite3_str_appendf(pRes, cf=='d' ? "%02d" : "%2d", x.D);
break;
}
case 'f': { /* Fractional seconds. (Non-standard) */
double s = x.s;
if( NEVER(s>59.999) ) s = 59.999;
sqlite3_str_appendf(&sRes, "%06.3f", s);
sqlite3_str_appendf(pRes, "%06.3f", s);
break;
}
case 'F': {
sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D);
sqlite3_str_appendf(pRes, "%04d-%02d-%02d", x.Y, x.M, x.D);
break;
}
case 'G': /* Fall thru */
@@ -1459,15 +1459,15 @@ static void strftimeFunc(
y.validYMD = 0;
computeYMD(&y);
if( cf=='g' ){
sqlite3_str_appendf(&sRes, "%02d", y.Y%100);
sqlite3_str_appendf(pRes, "%02d", y.Y%100);
}else{
sqlite3_str_appendf(&sRes, "%04d", y.Y);
sqlite3_str_appendf(pRes, "%04d", y.Y);
}
break;
}
case 'H':
case 'k': {
sqlite3_str_appendf(&sRes, cf=='H' ? "%02d" : "%2d", x.h);
sqlite3_str_appendf(pRes, cf=='H' ? "%02d" : "%2d", x.h);
break;
}
case 'I': /* Fall thru */
@@ -1475,65 +1475,65 @@ static void strftimeFunc(
int h = x.h;
if( h>12 ) h -= 12;
if( h==0 ) h = 12;
sqlite3_str_appendf(&sRes, cf=='I' ? "%02d" : "%2d", h);
sqlite3_str_appendf(pRes, cf=='I' ? "%02d" : "%2d", h);
break;
}
case 'j': { /* Day of year. Jan01==1, Jan02==2, and so forth */
sqlite3_str_appendf(&sRes,"%03d",daysAfterJan01(&x)+1);
sqlite3_str_appendf(pRes,"%03d",daysAfterJan01(&x)+1);
break;
}
case 'J': { /* Julian day number. (Non-standard) */
sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0);
sqlite3_str_appendf(pRes,"%.16g",x.iJD/86400000.0);
break;
}
case 'm': {
sqlite3_str_appendf(&sRes,"%02d",x.M);
sqlite3_str_appendf(pRes,"%02d",x.M);
break;
}
case 'M': {
sqlite3_str_appendf(&sRes,"%02d",x.m);
sqlite3_str_appendf(pRes,"%02d",x.m);
break;
}
case 'p': /* Fall thru */
case 'P': {
if( x.h>=12 ){
sqlite3_str_append(&sRes, cf=='p' ? "PM" : "pm", 2);
sqlite3_str_append(pRes, cf=='p' ? "PM" : "pm", 2);
}else{
sqlite3_str_append(&sRes, cf=='p' ? "AM" : "am", 2);
sqlite3_str_append(pRes, cf=='p' ? "AM" : "am", 2);
}
break;
}
case 'R': {
sqlite3_str_appendf(&sRes, "%02d:%02d", x.h, x.m);
sqlite3_str_appendf(pRes, "%02d:%02d", x.h, x.m);
break;
}
case 's': {
if( x.useSubsec ){
sqlite3_str_appendf(&sRes,"%.3f",
sqlite3_str_appendf(pRes,"%.3f",
(x.iJD - 21086676*(i64)10000000)/1000.0);
}else{
i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
sqlite3_str_appendf(&sRes,"%lld",iS);
sqlite3_str_appendf(pRes,"%lld",iS);
}
break;
}
case 'S': {
sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
sqlite3_str_appendf(pRes,"%02d",(int)x.s);
break;
}
case 'T': {
sqlite3_str_appendf(&sRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s);
sqlite3_str_appendf(pRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s);
break;
}
case 'u': /* Day of week. 1 to 7. Monday==1, Sunday==7 */
case 'w': { /* Day of week. 0 to 6. Sunday==0, Monday==1 */
char c = (char)daysAfterSunday(&x) + '0';
if( c=='0' && cf=='u' ) c = '7';
sqlite3_str_appendchar(&sRes, 1, c);
sqlite3_str_appendchar(pRes, 1, c);
break;
}
case 'U': { /* Week num. 00-53. First Sun of the year is week 01 */
sqlite3_str_appendf(&sRes,"%02d",
sqlite3_str_appendf(pRes,"%02d",
(daysAfterJan01(&x)-daysAfterSunday(&x)+7)/7);
break;
}
@@ -1544,30 +1544,30 @@ static void strftimeFunc(
y.iJD += (3 - daysAfterMonday(&x))*86400000;
y.validYMD = 0;
computeYMD(&y);
sqlite3_str_appendf(&sRes,"%02d", daysAfterJan01(&y)/7+1);
sqlite3_str_appendf(pRes,"%02d", daysAfterJan01(&y)/7+1);
break;
}
case 'W': { /* Week num. 00-53. First Mon of the year is week 01 */
sqlite3_str_appendf(&sRes,"%02d",
sqlite3_str_appendf(pRes,"%02d",
(daysAfterJan01(&x)-daysAfterMonday(&x)+7)/7);
break;
}
case 'Y': {
sqlite3_str_appendf(&sRes,"%04d",x.Y);
sqlite3_str_appendf(pRes,"%04d",x.Y);
break;
}
case '%': {
sqlite3_str_appendchar(&sRes, 1, '%');
sqlite3_str_appendchar(pRes, 1, '%');
break;
}
default: {
sqlite3_str_reset(&sRes);
sqlite3_str_free(pRes);
return;
}
}
}
if( j<i ) sqlite3_str_append(&sRes, zFmt+j, (int)(i-j));
sqlite3ResultStrAccum(context, &sRes);
if( j<i ) sqlite3_str_append(pRes, zFmt+j, (int)(i-j));
sqlite3_result_str(context, pRes, SQLITE_FINISH);
}
/*
@@ -1703,7 +1703,7 @@ static void timediffFunc(
sqlite3StrAccumInit(&sRes, 0, 0, 0, 100);
sqlite3_str_appendf(&sRes, "%c%04d-%02d-%02d %02d:%02d:%06.3f",
sign, Y, M, d1.D-1, d1.h, d1.m, d1.s);
sqlite3ResultStrAccum(context, &sRes);
sqlite3_result_str(context, &sRes, SQLITE_XFER);
}
+61 -52
View File
@@ -320,7 +320,6 @@ static void printfFunc(
PrintfArguments x;
StrAccum str;
const char *zFormat;
int n;
sqlite3 *db = sqlite3_context_db_handle(context);
if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){
@@ -330,18 +329,7 @@ static void printfFunc(
sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
str.printfFlags = SQLITE_PRINTF_SQLFUNC;
sqlite3_str_appendf(&str, zFormat, &x);
if( str.accError==SQLITE_OK ){
n = str.nChar;
sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
SQLITE_DYNAMIC);
}else{
if( str.accError==SQLITE_NOMEM ){
sqlite3_result_error_nomem(context);
}else{
sqlite3_result_error_toobig(context);
}
sqlite3_str_reset(&str);
}
sqlite3_result_str(context, &str, SQLITE_XFER);
}
}
@@ -1288,12 +1276,7 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
UNUSED_PARAMETER(argc);
sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
sqlite3QuoteValue(&str,argv[0],SQLITE_PTR_TO_INT(sqlite3_user_data(context)));
sqlite3_result_text(context, sqlite3StrAccumFinish(&str), str.nChar,
SQLITE_DYNAMIC);
if( str.accError!=SQLITE_OK ){
sqlite3_result_null(context);
sqlite3_result_error_code(context, str.accError);
}
sqlite3_result_str(context, &str, SQLITE_XFER);
}
/*
@@ -2326,7 +2309,7 @@ static void groupConcatFinalize(sqlite3_context *context){
GroupConcatCtx *pGCC
= (GroupConcatCtx*)sqlite3_aggregate_context(context, 0);
if( pGCC ){
sqlite3ResultStrAccum(context, &pGCC->str);
sqlite3_result_str(context, &pGCC->str, SQLITE_XFER);
#ifndef SQLITE_OMIT_WINDOWFUNC
sqlite3_free(pGCC->pnSepLengths);
#endif
@@ -2336,18 +2319,8 @@ static void groupConcatFinalize(sqlite3_context *context){
static void groupConcatValue(sqlite3_context *context){
GroupConcatCtx *pGCC
= (GroupConcatCtx*)sqlite3_aggregate_context(context, 0);
if( pGCC ){
StrAccum *pAccum = &pGCC->str;
if( pAccum->accError==SQLITE_TOOBIG ){
sqlite3_result_error_toobig(context);
}else if( pAccum->accError==SQLITE_NOMEM ){
sqlite3_result_error_nomem(context);
}else if( pGCC->nAccum>0 && pAccum->nChar==0 ){
sqlite3_result_text(context, "", 1, SQLITE_STATIC);
}else{
const char *zText = sqlite3_str_value(pAccum);
sqlite3_result_text(context, zText, pAccum->nChar, SQLITE_TRANSIENT);
}
if( pGCC && pGCC->nAccum>0 ){
sqlite3_result_str(context, &pGCC->str, SQLITE_COPY);
}
}
#else
@@ -2967,8 +2940,17 @@ static void percentStep(sqlite3_context *pCtx, int argc, sqlite3_value **argv){
** (1) To avoid a dependency on qsort()
** (2) To avoid the function call to the comparison routine for each
** comparison.
**
** If parameter iReq is non-negative, then the caller will only access
** elements a[iReq] and a[iReq+1] (if it exists) of the sorted array and
** so it is not necessary to position any other elements. Or if iReq is
** negative, then the final array must be fully sorted.
*/
static void percentSort(double *a, unsigned int n){
static void percentSort(
double *a, /* Array to sort */
unsigned int n, /* Number of elements in array a[] */
int iReq /* Element caller cares about (or -ve) */
){
int iLt; /* Entries before a[iLt] are less than rPivot */
int iGt; /* Entries at or after a[iGt] are greater than rPivot */
int i; /* Loop counter */
@@ -3005,17 +2987,41 @@ static void percentSort(double *a, unsigned int n){
}
}while( i<iGt );
/* Recurse on the smaller partition only. The smaller partition
** will hold n/2 or fewer entries, which assures that the stack
** depth will not exceed O(log(n)), even for pathological cases.
** Loop without recursion for the larger partition. */
if( iLt>(int)(n/2) ){
if( n-iGt>=2 ) percentSort(a+iGt, n-iGt);
n = iLt;
assert( a[iLt]==rPivot );
assert( iGt>iLt );
if( iReq>=0 ){
/* In this case, the only elements that the caller requires sorted into
** the correct positions are elements a[iReq] and a[iReq+1]. At this
** point we know that element a[iLt] is in the correct position and
** all elements smaller than a[iLt] are in the left-hand partition.
** So if (iReq<iLt), then it is only necessary to sort the left
** partition.
**
** If (iReq>=iLt), then elements iReq and iReq+1 are either in the
** right partition or the equal partition (elements for which
** iLt<=iElem<iGt). Therefore it is always sufficient to sort only
** the right partition in this case. */
if( iReq<iLt ){
n = iLt;
}else{
a += iGt;
n -= iGt;
iReq = MAX(0, iReq-iGt);
}
}else{
if( iLt>=2 ) percentSort(a, iLt);
a += iGt;
n -= iGt;
/* Recurse on the smaller partition only. The smaller partition
** will hold n/2 or fewer entries, which assures that the stack
** depth will not exceed O(log(n)), even for pathological cases.
** Loop without recursion for the larger partition. */
if( iLt>(int)(n/2) ){
if( n-iGt>=2 ) percentSort(a+iGt, n-iGt, -1);
n = iLt;
}else{
if( iLt>=2 ) percentSort(a, iLt, -1);
a += iGt;
n -= iGt;
}
}
}while( n>=2 );
}
@@ -3052,7 +3058,7 @@ static void percentInverse(sqlite3_context *pCtx,int argc,sqlite3_value **argv){
}
if( p->bSorted==0 ){
assert( p->nUsed>1 );
percentSort(p->a, p->nUsed);
percentSort(p->a, p->nUsed, -1);
p->bSorted = 1;
}
p->bKeepSorted = 1;
@@ -3081,13 +3087,17 @@ static void percentCompute(sqlite3_context *pCtx, int bIsFinal){
if( p==0 ) return;
if( p->a==0 ) return;
if( p->nUsed ){
if( p->bSorted==0 ){
assert( p->nUsed>1 );
percentSort(p->a, p->nUsed);
p->bSorted = 1;
}
ix = p->rPct*(p->nUsed-1);
i1 = (unsigned)ix;
if( p->bSorted==0 ){
/* In cases where bIsFinal is non-zero, setting Percentile.bSorted
** after the percentSort() call here is not technically correct, as
** the array is not fully sorted. But in this case the object will be
** freed below anyway, so it doesn't matter. */
assert( p->nUsed>1 );
percentSort(p->a, p->nUsed, (bIsFinal ? (int)i1 : -1));
p->bSorted = 1;
}
if( settings & 1 ){
vx = p->a[i1];
}else{
@@ -3155,8 +3165,7 @@ static void filestatFunc(
if( rc ) sqlite3_str_append(pStr, "null", 4);
}
sqlite3_str_append(pStr, "}", 1);
sqlite3_result_text(context, sqlite3_str_finish(pStr), -1,
sqlite3_free);
sqlite3_result_str(context, pStr, SQLITE_FINISH);
}
sqlite3BtreeLeave(pBtree);
}else{
@@ -3272,8 +3281,8 @@ static void parseuriFunc(
}
}
}
sqlite3_result_text(ctx, sqlite3_str_finish(pResult), -1, sqlite3_free);
}
sqlite3_result_str(ctx, pResult, SQLITE_FINISH);
sqlite3_free_filename(zFile);
sqlite3_free(zErr);
}
+10
View File
@@ -308,6 +308,16 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
*/
FuncDefHash sqlite3BuiltinFunctions;
/*
** This singleton is an sqlite3_str object that is returned if
** sqlite3_malloc() fails to provide space for a real one. This
** sqlite3_str object accepts no new text and always returns
** an SQLITE_NOMEM error.
*/
const sqlite3_str sqlite3OomStr = {
0, 0, 0, 0, 0, SQLITE_NOMEM, 0
};
#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG)
/*
** Counter used for coverage testing. Does not come into play for
+7 -1
View File
@@ -433,6 +433,9 @@ static int autoIncBegin(
return 0;
}
if( pToplevel->usesAinc==0 ){
pToplevel->pAinc = 0;
}
pInfo = pToplevel->pAinc;
while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
if( pInfo==0 ){
@@ -442,6 +445,7 @@ static int autoIncBegin(
if( pParse->db->mallocFailed ) return 0;
pInfo->pNext = pToplevel->pAinc;
pToplevel->pAinc = pInfo;
pToplevel->usesAinc = 1;
pInfo->pTab = pTab;
pInfo->iDb = iDb;
pToplevel->nMem++; /* Register to hold name of table */
@@ -470,6 +474,7 @@ void sqlite3AutoincrementBegin(Parse *pParse){
assert( sqlite3IsToplevel(pParse) );
assert( v ); /* We failed long ago if this is not so */
assert( pParse->usesAinc );
for(p = pParse->pAinc; p; p = p->pNext){
static const int iLn = VDBE_OFFSET_LINENO(2);
static const VdbeOpList autoInc[] = {
@@ -537,6 +542,7 @@ static SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){
sqlite3 *db = pParse->db;
assert( v );
assert( pParse->usesAinc );
for(p = pParse->pAinc; p; p = p->pNext){
static const int iLn = VDBE_OFFSET_LINENO(2);
static const VdbeOpList autoIncEnd[] = {
@@ -569,7 +575,7 @@ static SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){
}
}
void sqlite3AutoincrementEnd(Parse *pParse){
if( pParse->pAinc ) autoIncrementEnd(pParse);
if( pParse->usesAinc ) autoIncrementEnd(pParse);
}
#else
/*
+3 -1
View File
@@ -533,7 +533,9 @@ static const sqlite3_api_routines sqlite3Apis = {
0,
0,
#endif
sqlite3_incomplete
/* Version 3.54.0 and later */
sqlite3_incomplete,
sqlite3_result_str
};
/* True if x is the directory separator character
+1 -1
View File
@@ -300,7 +300,7 @@ int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
}else{
double r;
rc = pVfs->xCurrentTime(pVfs, &r);
*pTimeOut = (sqlite3_int64)(r*86400000.0);
*pTimeOut = sqlite3RealToI64(r*86400000.0);
}
return rc;
}
+14 -9
View File
@@ -331,7 +331,7 @@ struct sqlite3_kvvfs_methods {
int (*xRcrdRead)(const char*, const char *zKey, char *zBuf, int nBuf);
int (*xRcrdWrite)(const char*, const char *zKey, const char *zData);
int (*xRcrdDelete)(const char*, const char *zKey);
const int nKeySize; /* Used by the JS bindings */
const int nKeySize;
const int nBufferSize;
#ifndef SQLITE_WASM
# define MAYBE_CONST const
@@ -468,16 +468,17 @@ int kvvfsDecode(const char *a, char *aOut, int nOut){
while( 1 ){
c = kvvfsHexValue[aIn[i]];
if( c<0 ){
int n = 0;
int mult = 1;
sqlite3_int64 n = 0;
sqlite3_int64 mult = 1;
c = aIn[i];
if( c==0 ) break;
while( c>='a' && c<='z' ){
n += (c - 'a')*mult;
if( n>nOut ) return -1 /* oversized/malformed input */;
mult *= 26;
c = aIn[++i];
}
if( j+n>nOut ) return -1;
if( j+n>nOut ) return -1 /* oversized/malformed input */;
memset(&aOut[j], 0, n);
j += n;
if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */
@@ -515,7 +516,7 @@ static void kvvfsDecodeJournal(
i = 0;
mult = 1;
while( (c = zTxt[i++])>='a' && c<='z' ){
n += (zTxt[i] - 'a')*mult;
n += (c - 'a')*mult;
mult *= 26;
}
sqlite3_free(pFile->aJrnl);
@@ -561,9 +562,7 @@ static int kvvfsClose(sqlite3_file *pProtoFile){
pFile->isJournal ? "journal" : "db"));
sqlite3_free(pFile->aJrnl);
sqlite3_free(pFile->aData);
#ifdef SQLITE_WASM
memset(pFile, 0, sizeof(*pFile));
#endif
return SQLITE_OK;
}
@@ -593,6 +592,7 @@ static int kvvfsReadJrnl(
aTxt, szTxt+1);
if( rc>=0 ){
kvvfsDecodeJournal(pFile, aTxt, szTxt);
rc = 0;
}
sqlite3_free(aTxt);
if( rc ) return rc;
@@ -914,13 +914,18 @@ static int kvvfsOpen(
pFile->base.pMethods = &kvvfs_db_io_methods;
}
if( !pFile->zClass ){
#ifdef SQLITE_WASM
if( strlen(zName) >= (KVRECORD_KEY_SZ
- 6 /* "kvvfs-" */
- 11 /* "-##########" */) ){
/* Historical naming restriction, lifted in the JS impl. */
return SQLITE_CANTOPEN;
}
#else
if( 0!=strcmp(zName, "local") && 0!=strcmp(zName, "session") ){
/* Historical naming restriction which journaling depends on. */
return SQLITE_CANTOPEN;
}
#endif
pFile->zClass = zName;
}
pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ);
+1 -1
View File
@@ -581,7 +581,7 @@ void sqlite3ParseObjectReset(Parse *pParse){
assert( db->pParse==pParse );
assert( pParse->nested==0 );
#ifndef SQLITE_OMIT_SHARED_CACHE
if( pParse->aTableLock ) sqlite3DbNNFreeNN(db, pParse->aTableLock);
if( pParse->nTableLock ) sqlite3DbNNFreeNN(db, pParse->aTableLock);
#endif
while( pParse->pCleanup ){
ParseCleanup *pCleanup = pParse->pCleanup;
+5 -29
View File
@@ -1322,37 +1322,11 @@ char *sqlite3StrAccumFinish(StrAccum *p){
return p->zText;
}
/*
** Use the content of the StrAccum passed as the second argument
** as the result of an SQL function.
*/
void sqlite3ResultStrAccum(sqlite3_context *pCtx, StrAccum *p){
if( p->accError ){
sqlite3_result_error_code(pCtx, p->accError);
sqlite3_str_reset(p);
}else if( isMalloced(p) ){
sqlite3_result_text(pCtx, p->zText, p->nChar, SQLITE_DYNAMIC);
}else{
sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC);
sqlite3_str_reset(p);
}
}
/*
** This singleton is an sqlite3_str object that is returned if
** sqlite3_malloc() fails to provide space for a real one. This
** sqlite3_str object accepts no new text and always returns
** an SQLITE_NOMEM error.
*/
static sqlite3_str sqlite3OomStr = {
0, 0, 0, 0, 0, SQLITE_NOMEM, 0
};
/* Finalize a string created using sqlite3_str_new().
*/
char *sqlite3_str_finish(sqlite3_str *p){
char *z;
if( p!=0 && p!=&sqlite3OomStr ){
if( p!=0 && p!=(sqlite3_str*)&sqlite3OomStr ){
z = sqlite3StrAccumFinish(p);
sqlite3_free(p);
}else{
@@ -1393,6 +1367,8 @@ void sqlite3_str_reset(StrAccum *p){
if( isMalloced(p) ){
sqlite3DbFree(p->db, p->zText);
p->printfFlags &= ~SQLITE_PRINTF_MALLOCED;
}else if( p==(sqlite3_str*)&sqlite3OomStr ){
return;
}
p->nAlloc = 0;
p->nChar = 0;
@@ -1404,7 +1380,7 @@ void sqlite3_str_reset(StrAccum *p){
** of its content, all in one call.
*/
void sqlite3_str_free(sqlite3_str *p){
if( p!=0 && p!=&sqlite3OomStr ){
if( p!=0 && p!=(sqlite3_str*)&sqlite3OomStr ){
sqlite3_str_reset(p);
sqlite3_free(p);
}
@@ -1441,7 +1417,7 @@ sqlite3_str *sqlite3_str_new(sqlite3 *db){
sqlite3StrAccumInit(p, 0, 0, 0,
db ? db->aLimit[SQLITE_LIMIT_LENGTH] : SQLITE_MAX_LENGTH);
}else{
p = &sqlite3OomStr;
p = (sqlite3_str*)&sqlite3OomStr;
}
return p;
}
+9
View File
@@ -2441,6 +2441,13 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){
sqlite3 *db = pParse->db;
u64 savedFlags;
pParse->nNestSel++;
#if SQLITE_MAX_EXPR_DEPTH>0
if( pParse->nNestSel >= db->aLimit[SQLITE_LIMIT_EXPR_DEPTH] ){
sqlite3ErrorMsg(pParse, "VIEWs and/or subqueries nested too deep");
return 0;
}
#endif
savedFlags = db->flags;
db->flags &= ~(u64)SQLITE_FullColNames;
db->flags |= SQLITE_ShortColNames;
@@ -2462,6 +2469,8 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect, char aff){
sqlite3DeleteTable(db, pTab);
return 0;
}
pParse->nNestSel--;
assert( pParse->nNestSel>=0 );
return pTab;
}
+48 -7
View File
@@ -3413,7 +3413,7 @@ void sqlite3_randomness(int N, void *P);
**
** ^The first parameter to the authorizer callback is a copy of the third
** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
** to the callback is an integer [SQLITE_COPY | action code] that specifies
** to the callback is an integer [SQLITE_READ | action code] that specifies
** the particular action to be authorized. ^The third through sixth parameters
** to the callback are either NULL pointers or zero-terminated strings
** that contain additional details about the action to be authorized.
@@ -3545,9 +3545,14 @@ int sqlite3_set_authorizer(
#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
#define SQLITE_FUNCTION 31 /* NULL Function Name */
#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
#define SQLITE_COPY 0 /* No longer used */
#define SQLITE_RECURSIVE 33 /* NULL NULL */
/*
** Note: The SQLITE_COPY macro (with value 0) used to be one of the
** action codes above. That macro has now been repurposed as a possible
** value to the 3rd argument to sqlite3_result_str().
*/
/*
** CAPI3REF: Deprecated Tracing And Profiling Functions
** DEPRECATED
@@ -4377,7 +4382,8 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
** or in an ORDER BY or GROUP BY clause.</dd>)^
**
** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
** <dd>The maximum depth of the parse tree on any expression.</dd>)^
** <dd>The maximum depth of the parse tree on any expression and
** the maximum nesting depth for subqueries and VIEWs</dd>)^
**
** [[SQLITE_LIMIT_PARSER_DEPTH]] ^(<dt>SQLITE_LIMIT_PARSER_DEPTH</dt>
** <dd>The maximum depth of the LALR(1) parser stack used to analyze
@@ -4408,7 +4414,8 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
** <dd>The maximum index number of any [parameter] in an SQL statement.)^
**
** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
** <dd>The maximum depth of recursion for triggers.</dd>)^
** <dd>The maximum depth of recursion for triggers, and the maximum
** nesting depth for separate triggers.</dd>)^
**
** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
** <dd>The maximum number of auxiliary worker threads that a single
@@ -5285,7 +5292,7 @@ const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** [prepared statement]. ^In the "v2" interface,
** the more specific error code is returned directly by sqlite3_step().
**
** [SQLITE_MISUSE] means that the this routine was called inappropriately.
** [SQLITE_MISUSE] means that this routine was called inappropriately.
** Perhaps it was called on a [prepared statement] that has
** already been [sqlite3_finalize | finalized] or on one that had
** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
@@ -8796,8 +8803,8 @@ int sqlite3_keyword_check(const char*,int);
** <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
** <li> ^Text is appended to the sqlite3_str object using various
** methods, such as [sqlite3_str_appendf()].
** <li> ^The sqlite3_str object is destroyed and the string it created
** is returned using the [sqlite3_str_finish()] interface.
** <li> The sqlite3_str object is destroyed and the string it created
** is returned using [sqlite3_str_finish()] or [sqlite3_result_str()].
** </ol>
*/
typedef struct sqlite3_str sqlite3_str;
@@ -8849,6 +8856,40 @@ sqlite3_str *sqlite3_str_new(sqlite3*);
char *sqlite3_str_finish(sqlite3_str*);
void sqlite3_str_free(sqlite3_str*);
/*
** CAPI3REF: Return A Dynamic String From an SQL Function
**
** The [sqlite3_result_str(C,S,F)] interface causes the
** [sqlite3_str|dynamic string] S to become the return value for the
** application-defined function or virtual table that uses
** [sqlite3_context] C. The F flag can be one of [SQLITE_COPY]
** or [SQLITE_XFER] or [SQLITE_FINISH].
**
** If the dynamic string is invalid or incomplete due to an out-of-memory
** or string-too-large error, then this routine transfers that error
** over to the SQL function.
**
** If the F argument is SQLITE_COPY, then a copy of the dynamic string
** content is made and the dynamic string object is unchanged.
** If the F argument is SQLITE_XFER, then ownership of the content
** in the dynamic is transferred to the SQL function (via a pointer copy
** rather than a string copy) and the dynamic string is reset to an
** empty string. The SQLITE_FINISH value for F works like SQLITE_RESET
** except that it also invokes the [sqlite3_str_free(S)] destructor
** on the dynamic string object.
*/
void sqlite3_result_str(sqlite3_context*, sqlite3_str*, int);
/*
** CAPI3REF: Control Flags For sqlite3_result_str()
**
** The following integers can be used as the third "F" argument
** to [sqlite3_result_str(C,S,F)].
*/
#define SQLITE_COPY 0 /* Results copied. Dynamic string unchanged */
#define SQLITE_XFER 1 /* Results transfered. Dynamic string reset */
#define SQLITE_FINISH 2 /* Like SQLITE_XFER, plus dynamic string freed */
/*
** CAPI3REF: Add Content To A Dynamic String
** METHOD: sqlite3_str
+2
View File
@@ -378,6 +378,7 @@ struct sqlite3_api_routines {
int (*carray_bind_v2)(sqlite3_stmt*,int,void*,int,int,void(*)(void*),void*);
/* Version 3.54.0 and later */
sqlite3_int64 (*incomplete)(const char*);
void (*result_str)(sqlite3_context*,sqlite3_str*,int);
};
/*
@@ -723,6 +724,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_carray_bind_v2 sqlite3_api->carray_bind_v2
/* Version 3.54.0 and later */
#define sqlite3_incomplete sqlite3_api->incomplete
#define sqlite3_result_str sqlite3_api->result_str
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
+17 -4
View File
@@ -767,6 +767,13 @@
# define offsetof(ST,M) ((size_t)((char*)&((ST*)0)->M - (char*)0))
#endif
/*
** sizeof64() is like sizeof(), but always returns a 64-bit value, even
** on 32-bit builds. This can help to avoid overflow by ensuring 64-bit
** arithmetic is used consistently in both 32-bit and 64-bit builds.
*/
#define sizeof64(X) ((sqlite3_int64)sizeof(X))
/*
** Work around C99 "flex-array" syntax for pre-C99 compilers, so as
** to avoid complaints from -fsanitize=strict-bounds.
@@ -3904,14 +3911,15 @@ struct Parse {
bft bHasWith :1; /* True if statement contains WITH */
bft okConstFactor:1; /* OK to factor out constants */
bft checkSchema :1; /* Causes schema cookie check after an error */
bft usesAinc :1; /* True if pAinc is valid */
int nRangeReg; /* Size of the temporary register block */
int iRangeReg; /* First register in temporary register block */
int nErr; /* Number of errors seen */
int nTab; /* Number of previously allocated VDBE cursors */
int nMem; /* Number of memory cells used so far */
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
int iSelfTab; /* Table associated with an index on expr, or negative
** of the base register during check-constraint eval */
int nNestSel; /* Number of nested SELECT statements and/or VIEWs */
int nLabel; /* The *negative* of the number of labels used */
int nLabelAlloc; /* Number of slots in aLabel */
int *aLabel; /* Space to hold the labels */
@@ -3927,9 +3935,7 @@ struct Parse {
#endif
#ifndef SQLITE_OMIT_SHARED_CACHE
int nTableLock; /* Number of locks in aTableLock */
TableLock *aTableLock; /* Required table locks for shared-cache mode */
#endif
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
@@ -3958,6 +3964,13 @@ struct Parse {
Returning *pReturning; /* The RETURNING clause */
} d;
} u1;
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters. Only
** valid if Parse.usesAinc is true */
#ifndef SQLITE_OMIT_SHARED_CACHE
TableLock *aTableLock; /* Required table locks for shared-cache mode. Only
** valid if Parse.nTableLock>0 */
#endif
/************************************************************************
** Above is constant between recursions. Below is reset before and after
@@ -5491,6 +5504,7 @@ extern const unsigned char *sqlite3aGTb;
extern const unsigned char sqlite3CtypeMap[];
extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
extern FuncDefHash sqlite3BuiltinFunctions;
extern const sqlite3_str sqlite3OomStr;
#ifndef SQLITE_OMIT_WSD
extern int sqlite3PendingByte;
#endif
@@ -5593,7 +5607,6 @@ int sqlite3StrAccumEnlarge(StrAccum*, i64);
int sqlite3StrAccumEnlargeIfNeeded(StrAccum*, i64);
char *sqlite3StrAccumFinish(StrAccum*);
void sqlite3StrAccumSetError(StrAccum*, u8);
void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
void sqlite3SelectDestInit(SelectDest*,int,int);
Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
void sqlite3RecordErrorByteOffset(sqlite3*,const char*);
+15 -1
View File
@@ -1234,7 +1234,7 @@ static TriggerPrg *codeRowTrigger(
Table *pTab, /* The table pTrigger is attached to */
int orconf /* ON CONFLICT policy to code trigger program with */
){
Parse *pTop = sqlite3ParseToplevel(pParse);
Parse *pTop; /* Top level Parse object */
sqlite3 *db = pParse->db; /* Database handle */
TriggerPrg *pPrg; /* Value to return */
Expr *pWhen = 0; /* Duplicate of trigger WHEN expression */
@@ -1243,10 +1243,24 @@ static TriggerPrg *codeRowTrigger(
SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */
int iEndTrigger = 0; /* Label to jump to if WHEN is false */
Parse sSubParse; /* Parse context for sub-vdbe */
int nDepth; /* Trigger depth */
/* Ensure that triggers are not chained too deep. This test is linear
** in the chaining depth, but sensible code ought not be chaining
** triggers excessively, so that shouldn't be a problem.
*/
pTop = pParse;
for(nDepth=0; pTop->pOuterParse; pTop = pTop->pOuterParse, nDepth++){}
if( nDepth>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
sqlite3ErrorMsg(pParse, "triggers nested too deep");
return 0;
}
pTop = sqlite3ParseToplevel(pParse);
assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
assert( pTop->pVdbe );
/* Allocate the TriggerPrg and SubProgram objects. To ensure that they
** are freed if an error occurs, link them into the Parse.pTriggerPrg
** list of the top-level Parse object sooner rather than later. */
+2 -1
View File
@@ -318,7 +318,8 @@ void sqlite3UpsertDoUpdate(
/* excluded.* columns of type REAL need to be converted to a hard real */
for(i=0; i<pTab->nCol; i++){
if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
sqlite3VdbeAddOp1(v, OP_RealAffinity, pTop->regData+i);
int iStorage = pTop->regData + sqlite3TableColumnToStorage(pTab, i);
sqlite3VdbeAddOp1(v, OP_RealAffinity, iStorage);
}
}
sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
+1 -1
View File
@@ -7560,7 +7560,7 @@ case OP_Program: { /* jump0 */
if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
rc = SQLITE_ERROR;
sqlite3VdbeError(p, "too many levels of trigger recursion");
sqlite3VdbeError(p, "triggers nested too deep");
goto abort_due_to_error;
}
+74 -9
View File
@@ -374,15 +374,18 @@ void sqlite3_value_free(sqlite3_value *pOld){
/**************************** sqlite3_result_ *******************************
** The following routines are used by user-defined functions to specify
** the function result.
** The following routines are used by application-defined SQL functions to
** specify the function return value. There are many variations on
** sqlite3_result_xxxx() for different types of return values.
**
** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the
** result as a string or blob. Appropriate errors are set if the string/blob
** is too big or if an OOM occurs.
** The setStrOrError() function is a helper function that invokes
** sqlite3VdbeMemSetStr() to store the result as a string or blob.
** Appropriate errors are set if the string/blob is too big or if
** an OOM occurs.
**
** The invokeValueDestructor(P,X) routine invokes destructor function X()
** on value P if P is not going to be used and need to be destroyed.
** The invokeValueDestructor(P,X) helper function invokes the destructor
** function X() on value P if P is not going to be used and need to
** be destroyed.
*/
static void setResultStrOrError(
sqlite3_context *pCtx, /* Function context */
@@ -695,7 +698,7 @@ void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
}
}
/* Force an SQLITE_TOOBIG error. */
/* Cause the SQL function to raise an SQLITE_TOOBIG error. */
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
#ifdef SQLITE_ENABLE_API_ARMOR
if( pCtx==0 ) return;
@@ -706,7 +709,7 @@ void sqlite3_result_error_toobig(sqlite3_context *pCtx){
SQLITE_UTF8, SQLITE_STATIC);
}
/* An SQLITE_NOMEM error. */
/* Cause the SQL function to raise an SQLITE_NOMEM error. */
void sqlite3_result_error_nomem(sqlite3_context *pCtx){
#ifdef SQLITE_ENABLE_API_ARMOR
if( pCtx==0 ) return;
@@ -717,6 +720,68 @@ void sqlite3_result_error_nomem(sqlite3_context *pCtx){
sqlite3OomFault(pCtx->pOut->db);
}
/* Make the return value of the SQL function or virtual table pCtx
** be the content of the sqlite3_str object pStr. The eOwn flag
** determines ownership of the sqlite3_str object and its content.
**
** eOwn Ownership transfer
** ------------- ------------------------------------------------
**
** SQLITE_COPY The SQL function returns a copy the sqlite3_str
** content and leaves the sqlite3_str object itself
** unchanged.
**
** SQLITE_XFER The content of the sqlite3_str is transferred to
** the SQL function and the SQL function takes
** responsibility for freeing that content when it is
** no longer needed. The sqlite3_str object is reset
** to an empty string.
**
** SQLITE_FINISH Like SQLITE_XFER except that the pStr is also
** freed using sqlite3_str_free().
*/
void sqlite3_result_str(sqlite3_context *pCtx, sqlite3_str *pStr, int eOwn){
#ifdef SQLITE_ENABLE_API_ARMOR
if( pCtx==0 ) return;
if( pStr==0 ) return;
#endif
if( pStr->accError==0 ){
if( pStr->nChar==0 ){
setResultStrOrError(pCtx, "", 0, SQLITE_UTF8_ZT, SQLITE_STATIC);
if( eOwn ) sqlite3_str_reset(pStr);
}else{
const char *zText = sqlite3_str_value(pStr);
/* Only internal code has the ability to capture a pointer to
** an sqlite3_str object that uses static buffer. And none of
** those internal use cases every invoke the sqlite3_result_str()
** interface on a static-buffer sqlite3_str. Should this change
** in the future, the following assert() will let us know. */
assert( isMalloced(pStr) );
if( eOwn==SQLITE_COPY ){
setResultStrOrError(pCtx, zText, pStr->nChar,
SQLITE_UTF8, SQLITE_TRANSIENT);
}else{
setResultStrOrError(pCtx, zText, pStr->nChar,
SQLITE_UTF8_ZT, SQLITE_DYNAMIC);
}
}
}else if( pStr->accError==SQLITE_NOMEM ){
sqlite3_result_error_nomem(pCtx);
}else{
assert( pStr->accError==SQLITE_TOOBIG );
sqlite3_result_error_toobig(pCtx);
}
if( eOwn ){
testcase( pStr==(sqlite3_str*)&sqlite3OomStr );
if( pStr->accError==0 ){
sqlite3StrAccumInit(pStr, pStr->db, 0, 0, pStr->mxAlloc);
}
if( eOwn==SQLITE_FINISH ){
sqlite3_str_free(pStr);
}
}
}
#ifndef SQLITE_UNTESTABLE
/* Force the INT64 value currently stored as the result to be
** a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL
+3 -5
View File
@@ -41,7 +41,6 @@ Vdbe *sqlite3VdbeCreate(Parse *pParse){
assert( pParse->aLabel==0 );
assert( pParse->nLabel==0 );
assert( p->nOpAlloc==0 );
assert( pParse->szOpAlloc==0 );
sqlite3VdbeAddOp2(p, OP_Init, 0, 1);
return p;
}
@@ -191,8 +190,7 @@ static int growOpArray(Vdbe *v, int nOp){
assert( nNew>=(v->nOpAlloc+nOp) );
pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
if( pNew ){
p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);
v->nOpAlloc = p->szOpAlloc/sizeof(Op);
v->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op);
v->aOp = pNew;
}
return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
@@ -627,7 +625,7 @@ int sqlite3VdbeMakeLabel(Parse *pParse){
** a prior call to sqlite3VdbeMakeLabel().
*/
static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){
int nNewSize = 10 - p->nLabel;
int nNewSize = 25 - p->nLabel;
p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
nNewSize*sizeof(p->aLabel[0]));
if( p->aLabel==0 ){
@@ -2695,7 +2693,7 @@ void sqlite3VdbeMakeReady(
n = ROUND8P(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
x.nFree = ROUNDDOWN8((p->nOpAlloc-p->nOp)*sizeof(Op)); /* Bytes unused mem */
assert( x.nFree>=0 );
assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
+37 -8
View File
@@ -907,29 +907,58 @@ static void exprAnalyzeOrTerm(
}
}
/* At this point, okToChngToIN is true if original pTerm satisfies
** case 1. In that case, construct a new virtual term that is
** pTerm converted into an IN operator.
/* At this point, okToChngToIN is true if original pTerm is a
** candidate to satisfy case 1, though we are not yet certain that
** the collating sequences are all compatible. Try to construct a
** new virtual term that is pTerm converted from an OR operator
** into an IN operator.
**
** During construction, verify that the collating sequences on all
** subterms of the OR are compatible. Omit the construction of the
** new IN operator if there are any collating sequence mismatches.
*/
if( okToChngToIN ){
Expr *pDup; /* A transient duplicate expression */
ExprList *pList = 0; /* The RHS of the IN operator */
Expr *pLeft = 0; /* The LHS of the IN operator */
CollSeq *pCollSeq = 0; /* Collating sequence to use */
Expr *pNew; /* The complete IN operator */
for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
Expr *pThis;
if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue;
assert( pOrTerm->eOperator & WO_EQ );
assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
assert( pOrTerm->leftCursor==iCursor );
assert( pOrTerm->u.x.leftColumn==iColumn );
pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);
pThis = pOrTerm->pExpr;
pDup = sqlite3ExprDup(db, pThis->pRight, 0);
pList = sqlite3ExprListAppend(pWInfo->pParse, pList, pDup);
pLeft = pOrTerm->pExpr->pLeft;
if( pLeft==0 ){
pLeft = pThis->pLeft;
pCollSeq = sqlite3ExprCompareCollSeq(pParse, pThis);
}else{
assert( 0==sqlite3ExprCompare(pParse,
sqlite3ExprSkipCollate(pThis->pLeft),
sqlite3ExprSkipCollate(pLeft), -1) );
if( pCollSeq!=sqlite3ExprCompareCollSeq(pParse, pThis) ){
pLeft = 0; /* Collating sequence mismatch */
break;
}
}
}
if( pLeft==0 ){
pNew = 0; /* Collating sequence mismatch */
}else{
pDup = sqlite3ExprDup(db, pLeft, 0);
if( sqlite3ExprCollSeq(pParse, pDup)!=pCollSeq
&& ALWAYS(pCollSeq!=0)
){
assert( pCollSeq->zName!=0 );
pDup = sqlite3ExprAddCollateString(pParse, pDup, pCollSeq->zName);
}
pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0);
}
assert( pLeft!=0 );
pDup = sqlite3ExprDup(db, pLeft, 0);
pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0);
if( pNew ){
int idxNew;
transferJoinMarkings(pNew, pExpr);
+1 -1
View File
@@ -222,7 +222,7 @@ static void nth_valueStepFunc(
break;
case SQLITE_FLOAT: {
double fVal = sqlite3_value_double(apArg[1]);
if( ((i64)fVal)!=fVal ) goto error_out;
if( sqlite3RealToI64(fVal)!=fVal ) goto error_out;
iVal = (i64)fVal;
break;
}
+4 -4
View File
@@ -2982,14 +2982,14 @@ if {[clang_sanitize_address]==0} {
} {0 0}
do_test e_fkey-63.1.2 {
test_on_delete_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test e_fkey-63.1.3 {
sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
test_on_delete_recursion 5
} {0 0}
do_test e_fkey-63.1.4 {
test_on_delete_recursion 6
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test e_fkey-63.1.5 {
sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
} {5}
@@ -2998,14 +2998,14 @@ if {[clang_sanitize_address]==0} {
} {0 0}
do_test e_fkey-63.2.2 {
test_on_update_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test e_fkey-63.2.3 {
sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
test_on_update_recursion 5
} {0 0}
do_test e_fkey-63.2.4 {
test_on_update_recursion 6
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test e_fkey-63.2.5 {
sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
} {5}
+38 -1
View File
@@ -64,7 +64,6 @@ do_execsql_test 2.1 {
#-------------------------------------------------------------------------
reset_db
breakpoint
do_catchsql_test 3.0 {
CREATE VIRTUAL TABLE main.Table0 USING fts3();
INSERT INTO Table0 VALUES (1), (printf('%8.1280000X') ), (1), (printf('%8.1280000X') ), (1) ;
@@ -75,5 +74,43 @@ do_catchsql_test 3.0 {
INSERT INTO Table0(Table0) VALUES('merge=6,8');
} {1 {database disk image is malformed}}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 4.0 {
CREATE VIRTUAL TABLE t USING fts4(c);
INSERT INTO t(t) VALUES('nodesize=200');
INSERT INTO t VALUES('alpha bravo charlie delta echo foxtrot golf hotel india juliet kilo lima mike november');
INSERT INTO t VALUES('oscar papa quebec romeo sierra tango uniform victor whiskey xray yankee zulu alpha bravo');
INSERT INTO t(t) VALUES('merge=16,4');
UPDATE t_segdir SET end_block = start_block + 2147483647 WHERE level=0;
INSERT OR REPLACE INTO t_segments(blockid,block)
SELECT start_block+2147483647, NULL FROM t_segdir WHERE level=0;
}
do_execsql_test 4.1 {
PRAGMA integrity_check
} {ok}
do_execsql_test 4.2 {
INSERT INTO t VALUES(
'mike november oscar papa quebec romeo
sierra tango uniform victor whiskey xray yankee'
);
INSERT INTO t VALUES(
'charlie delta echo foxtrot golf hotel india
juliet kilo lima mike november oscar papa'
);
INSERT INTO t(t) VALUES('merge=16,4');
SELECT blockid FROM t_segments ORDER BY blockid;
} {
2147483647 2147483648 2147483649 2147483775
}
do_execsql_test 4.3 {
PRAGMA integrity_check
} {ok}
set sqlite_fts3_enable_parentheses $saved_sqlite_fts3_enable_parentheses
finish_test
+3 -3
View File
@@ -124,16 +124,16 @@ do_test shell1-1.10.1 {
} {0 {}}
do_test shell1-1.10.2 {
catchcmd test.db "CREATE TABLE t1(a,b,c);INSERT INTO t1 VALUES(1,2,3),(4,5,6);"
catchcmd "-csv test.db" "SELECT * FROM t1"
catchcmd "-csv test.db" ".mode --rowsep \"\\012\"\nSELECT * FROM t1"
} {0 {1,2,3
4,5,6}}
do_test shell1-1.10.3 {
catchcmd "-header -csv test.db" "SELECT * FROM t1"
catchcmd "-header -csv test.db" ".mode --rowsep \"\\012\"\nSELECT * FROM t1"
} {0 {a,b,c
1,2,3
4,5,6}}
do_test shell1-1.10.4 {
catchcmd "-csv -header test.db" "SELECT * FROM t1"
catchcmd "-csv -header test.db" ".mode --rowsep \"\\012\"\nSELECT * FROM t1"
} {0 {a,b,c
1,2,3
4,5,6}}
+2 -2
View File
@@ -51,7 +51,7 @@ do_test shell2-1.2.1 {
# Test a problem reported on the mailing list. The shell was at one point
# returning the generic SQLITE_ERROR message ("SQL error or missing database")
# instead of the "too many levels..." message in the test below.
# instead of the "triggers nested too deep" message in the test below.
#
do_test shell2-1.3 {
catchcmd "-batch test.db" {
@@ -64,7 +64,7 @@ do_test shell2-1.3 {
UPDATE OR REPLACE t5 SET a = 4 WHERE a = 1;
}
} {1 {Error near line 9: too many levels of trigger recursion}}
} {1 {Error near line 9: triggers nested too deep}}
+84
View File
@@ -716,6 +716,90 @@ do_catchsql_test 1420 {
FROM t2 JOIN (t1 RIGHT JOIN generate_series(t2.y,5) AS value)
} {1 {no such column: t2.y}}
# Bug 2026-06-15T04:37:48Z
do_execsql_test 1500 {
SELECT value FROM generate_series(1) WHERE value>1e19 LIMIT 3;
} {}
do_execsql_test 1501 {
SELECT value FROM generate_series(1) WHERE value>=1e19 LIMIT 3;
} {}
do_execsql_test 1502 {
SELECT value FROM generate_series(1) WHERE value<-1e19 LIMIT 3;
} {}
do_execsql_test 1503 {
SELECT value FROM generate_series(1) WHERE value<=-1e19 LIMIT 3;
} {}
do_execsql_test 1504 {
SELECT value FROM generate_series(1,9223372036854775807)
WHERE value>=9223372036854775807.0
LIMIT 3;
} {9223372036854775807}
do_execsql_test 1505 {
SELECT value FROM generate_series(1,9223372036854775807)
WHERE value>9223372036854775807.0
LIMIT 3;
} {}
# NB: Large floating point values can not convert to integers exactly.
# This affects subsequent results.
#
do_execsql_test 1506 {
SELECT 9223372036854774784 = 9223372036854775000.0;
} {1}
do_execsql_test 1507 {
SELECT value FROM generate_series(1,9223372036854775807)
WHERE value>=9223372036854775000.0
LIMIT 3;
} {9223372036854774784 9223372036854774785 9223372036854774786}
do_execsql_test 1508 {
SELECT value FROM generate_series(1,9223372036854775807)
WHERE value>9223372036854775000.0
LIMIT 3;
} {9223372036854774785 9223372036854774786 9223372036854774787}
do_execsql_test 1510 {
SELECT value FROM generate_series(-9223372036854775808,1)
WHERE value>=-9223372036854775000.0
LIMIT 3;
} {-9223372036854774784 -9223372036854774783 -9223372036854774782}
do_execsql_test 1511 {
SELECT value FROM generate_series(-9223372036854775808,1)
WHERE value>-9223372036854775000.0
LIMIT 3;
} {-9223372036854774783 -9223372036854774782 -9223372036854774781}
do_execsql_test 1520 {
SELECT value FROM generate_series(9223372036854774784)
WHERE value<=9223372036854775000.0
LIMIT 3;
} {9223372036854774784}
do_execsql_test 1521 {
SELECT value FROM generate_series(9223372036854774784)
WHERE value<9223372036854775000.0
LIMIT 3;
} {}
do_execsql_test 1522 {
SELECT value FROM generate_series(9223372036854775805,9223372036854775807)
WHERE value<=9223372036854775807.0
LIMIT 3;
} {9223372036854775805 9223372036854775806 9223372036854775807}
do_execsql_test 1522ck {
SELECT value FROM generate_series(9223372036854775805,9223372036854775807)
WHERE +value<=9223372036854775807.0
LIMIT 3;
} {9223372036854775805 9223372036854775806 9223372036854775807}
do_execsql_test 1523 {
SELECT value FROM generate_series(9223372036854775805,9223372036854775807)
WHERE value<9223372036854775807.0
LIMIT 3;
} {9223372036854775805 9223372036854775806 9223372036854775807}
do_execsql_test 1523ck {
SELECT value FROM generate_series(9223372036854775805,9223372036854775807)
WHERE +value<9223372036854775807.0
LIMIT 3;
} {9223372036854775805 9223372036854775806 9223372036854775807}
# Free up memory allocations
intarray_addr
+47 -9
View File
@@ -132,7 +132,7 @@ do_test triggerC-1.11 {
} {}
do_test triggerC-1.12 {
catchsql { UPDATE OR REPLACE t5 SET a = 4 WHERE a = 1 }
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-1.13 {
execsql {
CREATE TABLE t6(a INTEGER PRIMARY KEY, b);
@@ -203,7 +203,7 @@ foreach {n tdefn rc} {
CREATE TRIGGER t2_trig BEFORE INSERT ON t2 BEGIN
INSERT INTO t2 VALUES(new.a - 1);
END;
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
6 {
CREATE TRIGGER t2_trig AFTER INSERT ON t2 WHEN (new.a>0) BEGIN
@@ -215,7 +215,7 @@ foreach {n tdefn rc} {
CREATE TRIGGER t2_trig BEFORE INSERT ON t2 WHEN (new.a>0) BEGIN
INSERT OR IGNORE INTO t2 VALUES(new.a);
END;
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
} {
do_test triggerC-2.1.$n {
catchsql { DROP TRIGGER t2_trig }
@@ -283,7 +283,7 @@ do_test triggerC-3.1.1 {
} {}
do_test triggerC-3.1.2 {
catchsql { INSERT INTO t3 VALUES(0,0) }
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-3.1.3 {
execsql { SELECT * FROM t3 }
} {}
@@ -298,7 +298,7 @@ do_test triggerC-3.2.1 {
catchsql {
INSERT INTO t3b VALUES(1);
}
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-3.2.2 {
db eval {SELECT * FROM t3b}
} {}
@@ -317,7 +317,7 @@ do_test triggerC-3.4.1 {
DELETE FROM t3b;
INSERT INTO t3b VALUES([expr $SQLITE_MAX_TRIGGER_DEPTH - 1]);
"
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-3.4.2 {
db eval {SELECT count(*), max(x), min(x) FROM t3b}
} {0 {} {}}
@@ -337,7 +337,7 @@ do_test triggerC-3.5.3 {
DELETE FROM t3b;
INSERT INTO t3b VALUES([expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - ($SQLITE_MAX_TRIGGER_DEPTH / 10)]);
"
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-3.5.4 {
db eval {SELECT count(*), max(x), min(x) FROM t3b}
} {0 {} {}}
@@ -357,7 +357,7 @@ do_test triggerC-3.6.3 {
DELETE FROM t3b;
INSERT INTO t3b VALUES([expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - 1]);
"
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
do_test triggerC-3.6.4 {
db eval {SELECT count(*), max(x), min(x) FROM t3b}
} {0 {} {}}
@@ -948,7 +948,7 @@ do_execsql_test triggerC-13.1 {
} {}
do_catchsql_test triggerC-13.2 {
UPDATE t12 SET a=a+1, b=b+1;
} {1 {too many levels of trigger recursion}}
} {1 {triggers nested too deep}}
#-------------------------------------------------------------------------
# The following tests seek to verify that constant values (i.e. literals)
@@ -1070,5 +1070,43 @@ do_catchsql_test 17.1 {
INSERT INTO xyz VALUES('hello', 2, 3);
} {1 {datatype mismatch}}
# Bug 2026-06-15T06:44:07Z
#
reset_db
execsql { PRAGMA recursive_triggers = on }
do_execsql_test 18.1 {
CREATE TABLE t1(a);
CREATE TABLE t2(b);
CREATE TABLE t3(c);
CREATE TABLE t4(d);
CREATE TABLE t5(e);
CREATE TABLE t6(f);
CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a);
END;
CREATE TRIGGER r2 AFTER INSERT ON t2 BEGIN
INSERT INTO t3 VALUES(new.b);
END;
CREATE TRIGGER r3 AFTER INSERT ON t3 BEGIN
INSERT INTO t4 VALUES(new.c);
END;
CREATE TRIGGER r4 AFTER INSERT ON t4 BEGIN
INSERT INTO t5 VALUES(new.d);
END;
CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN
INSERT INTO t6 VALUES(new.e);
END;
}
do_execsql_test 18.2 {
INSERT INTO t1(a) VALUES(1);
SELECT f FROM t6;
} {1}
sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 4
do_catchsql_test 18.3 {
INSERT INTO t1(a) VALUES(2);
} {1 {triggers nested too deep}}
finish_test
+46
View File
@@ -450,4 +450,50 @@ do_execsql_test 3.6 {
SELECT * FROM t1 INDEXED BY t1cc ORDER BY +aa;
} {10 21 32 11 44 55 12 23 34}
#-------------------------------------------------------------------------
reset_db
foreach {tn WO} {
1 ""
2 "WITHOUT ROWID"
} {
reset_db
do_execsql_test 4.$tn.0 "
CREATE TABLE t1(a, b, c REAL, d UNIQUE, e PRIMARY KEY) $WO ;
INSERT INTO t1 VALUES(555, 555, 555, 555, 555);
"
do_execsql_test 4.$tn.1 {
SELECT * FROM t1;
} {555 555 555.0 555 555}
do_execsql_test 4.$tn.2 {
INSERT INTO t1(c, d, e) VALUES(22, 555, 4)
ON CONFLICT(d) DO UPDATE SET b=excluded.c;
}
do_execsql_test 4.$tn.3 {
SELECT * FROM t1;
} {555 22.0 555.0 555 555}
}
do_execsql_test 4.3.0 {
CREATE TABLE t2(a, b GENERATED ALWAYS AS (a+1) VIRTUAL, c REAL, d UNIQUE);
INSERT INTO t2(a, c, d) VALUES(555, 555, 555);
}
do_execsql_test 4.3.1 {
SELECT * FROM t2
} {555 556 555.0 555}
do_execsql_test 4.3.2 {
INSERT INTO t2(c, d) VALUES(22, 555)
ON CONFLICT(d) DO UPDATE SET a = excluded.c;
}
do_execsql_test 4.3.3 {
SELECT * FROM t2
} {22.0 23.0 555.0 555}
finish_test
+30
View File
@@ -823,5 +823,35 @@ do_execsql_test view-31.2 {
WITH s AS ( VALUES(123), (456) ) SELECT * FROM t3 WHERE b IN s;
} {123 123}
# Bug 2026-06-16T04:21:51Z
#
reset_db
do_execsql_test view-32.1 {
CREATE TABLE t0(a);
INSERT INTO t0 VALUES(0);
CREATE VIEW v1(a) AS SELECT a+1 FROM t0;
CREATE VIEW v2(a) AS SELECT a+1 FROM v1;
CREATE VIEW v3(a) AS SELECT a+1 FROM v2;
CREATE VIEW v4(a) AS SELECT a+1 FROM v3;
CREATE VIEW v5(a) AS SELECT a+1 FROM v4;
CREATE VIEW v6(a) AS SELECT a+1 FROM v5;
CREATE VIEW v7(a) AS SELECT a+1 FROM v6;
}
if {[sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH -1]>0} {
sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH 7
do_catchsql_test view-32.2 {
SELECT * FROM v7;
} {1 {VIEWs and/or subqueries nested too deep}}
sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH 6
db cache flush
do_catchsql_test view-32.3 {
SELECT * FROM v7;
} {1 {VIEWs and/or subqueries nested too deep}}
sqlite3_limit db SQLITE_LIMIT_EXPR_DEPTH 8
db cache flush
}
do_execsql_test view-32.4 {
SELECT * FROM v7;
} 7
finish_test
+74
View File
@@ -456,6 +456,80 @@ ifcapable explain&&subquery {
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
}
# Bug 2026-06-17T05:04:48Z
#
do_execsql_test where2-6.14.1 {
CREATE TABLE t614a(a TEXT COLLATE NOCASE, b TEXT COLLATE NOCASE);
INSERT INTO t614a VALUES('AAA','BBB');
CREATE TABLE t614b(x,y,c TEXT);
INSERT INTO t614b(c) VALUES('aaa'),('bbb');
CREATE INDEX t614b_c ON t614b(c);
SELECT c FROM t614a, t614b WHERE a=c OR b=c;
} {aaa bbb}
do_execsql_test where2-6.14.2 {
SELECT c FROM t614a, t614b WHERE c=a OR c=b;
} {}
do_execsql_test where2-6.14.3 {
SELECT c FROM t614a, t614b WHERE c=a OR b=c;
} {bbb}
do_execsql_test where2-6.14.4 {
SELECT c FROM t614a, t614b WHERE a=c OR c=b;
} {aaa}
do_execsql_test where2-6.15.1 {
CREATE TABLE t615a(a TEXT, b TEXT);
INSERT INTO t615a VALUES('AAA','BBB');
CREATE TABLE t615b(x,y,c TEXT COLLATE NOCASE);
INSERT INTO t615b(c) VALUES('aaa'),('bbb');
CREATE INDEX t615b_c ON t615b(c);
SELECT c FROM t615a, t615b WHERE c=a OR c=b;
} {aaa bbb}
do_execsql_test where2-6.15.2 {
SELECT c FROM t615a, t615b WHERE a=c OR b=c;
} {}
do_execsql_test where2-6.15.3 {
SELECT c FROM t615a, t615b WHERE c=a OR b=c;
} {aaa}
do_execsql_test where2-6.15.4 {
SELECT c FROM t615a, t615b WHERE a=c OR c=b;
} {bbb}
do_execsql_test where2-6.16.1 {
CREATE TABLE t616a(a TEXT COLLATE NOCASE, b TEXT COLLATE NOCASE);
INSERT INTO t616a VALUES('AAA','BBB');
CREATE TABLE t616b(x,y,c TEXT COLLATE NOCASE);
INSERT INTO t616b(c) VALUES('aaa'),('bbb');
CREATE INDEX t616b_c ON t616b(c);
SELECT c FROM t616a, t616b WHERE c=a OR c=b;
} {aaa bbb}
do_execsql_test where2-6.16.2 {
SELECT c FROM t616a, t616b WHERE a=c OR b=c;
} {aaa bbb}
do_execsql_test where2-6.16.3 {
SELECT c FROM t616a, t616b WHERE c=a OR b=c;
} {aaa bbb}
do_execsql_test where2-6.16.4 {
SELECT c FROM t616a, t616b WHERE a=c OR c=b;
} {aaa bbb}
# Assertion faults added by check-in 2026-06-17T13:31:01.199Z and
# subsequently discovered by dbsqlfuzz.
#
do_execsql_test where2-6.17.1 {
CREATE TABLE t617_a(a INTEGER PRIMARY KEY, b TEXT);
CREATE TABLE t617_b(c INTEGER PRIMARY KEY, d TEXT);
CREATE VIEW t617 AS SELECT a, b FROM t617_a UNION ALL SELECT c, c FROM t617_b;
}
do_execsql_test where2-6.17.2 {
SELECT EXISTS(
SELECT 1
FROM (SELECT 1 FROM t617 WHERE a='two' OR b='i')
WHERE a='ex' OR b='iv'
) FROM t617;
} {}
do_execsql_test where2-6.17.3 {
SELECT * FROM t617 JOIN t617 USING(a,a,b) WHERE (b=0) OR a=10;
} {}
# Variations on the order of terms in a WHERE clause in order
# to make sure the OR optimizer can recognize them all.
do_test where2-6.20 {