Compare commits

...

29 Commits

Author SHA1 Message Date
drh bfe2964c5d Version 3.42.1
FossilOrigin-Name: 4a8bf3c146c24759709eec55cdb0a9d2153c3a40e6645727c55c0404a99b5b4a
2025-08-06 11:05:53 +00:00
drh bb0afc2818 Fix the same potential integer overflow problem of [5508b56fd24016c1] in
a different and much simpler way.  No error is raised but memory errors are
avoided.

FossilOrigin-Name: 6f4a6e564b49bed1b31fe698c358c5944c6a1272e6d4fc6f6d98f56051bdba28
2025-08-05 21:04:04 +00:00
drh 48b12598cb Fix a couple of potential integer overflow problems in FTS5.
FossilOrigin-Name: 1f479ee3b7fa02fc7dad7fd78177137f5092caca04fa20a0bd2e6e8d9a6ee1ee
2025-08-05 20:33:14 +00:00
drh e25813cd12 Fix a buffer overread in the sessions extension that could occur when
processing a corrupt changeset.

FossilOrigin-Name: 5833174c9df7df2307718c2d01c3c766deef24290f34f8b8016952b9604fc31e
2025-08-05 19:36:05 +00:00
dan 015830dced Fix a problem with an fts5 secure-delete on a rowid/term pair that follows a legacy delete of the same pair.
FossilOrigin-Name: f5913e763290043cb0243fc4a9a6c1f56520f291f05e072fd86ceab560985958
2023-10-12 20:03:26 +00:00
dan 81a18232ed Fix a problem with fts5 secure-delete mode causing fts5 to corrupt its records.
FossilOrigin-Name: cc0f82a480a400c670ae1d4193007640056bd545aed75613c088d5869a3fc817
2023-09-08 19:32:48 +00:00
larrybr d01c7c421d Fix CLI .sha3sum error message for keyword identifiers, reported in [forum:/forumpost/7cbe081746dd|forum post 7cbe081746dd].
FossilOrigin-Name: bc27bda164b86892b9dce1b5b6fe3513e6615e4fac6b55e69c828183eefec58d
2023-06-26 17:23:53 +00:00
stephan 177479fb16 Replace some JS 'self' references with 'globalThis', as reported via the npm subproject.
FossilOrigin-Name: b6ae84915f364f47f7cb66361dd3cb27f49d6617011077e3a4a669241a4e9dcb
2023-06-26 07:20:21 +00:00
drh 1549472fb9 Fix a buffer over-read that could occur as part of an fts5 secure-delete operation on a database containing corrupt fts5 records.
dbsqlfuzz a463eac437783bcd246cc675b87842618a569cae

FossilOrigin-Name: 44fdc798de2798870373f881124fd9b8ca58448a8162eabada4d6fe1e2922959
2023-06-12 14:16:19 +00:00
drh db7f2f8b5f Make sure temporary sqlite3_value objects used by STAT4 are reset to NULL prior
to being reused, to prevent a memory leak associated with
the custom xDel string value destructor.
dbsqlfuzz 65209ab5d5730e4fd14fff9d024325a77239036e.

FossilOrigin-Name: 2cf197a28b4bb3442329c418579d18d307e2b9aed0973e4bca3a44b8c03235c0
2023-06-12 14:12:50 +00:00
drh cfa35c0c2d Defer setting the BTS_PAGESIZE_FIXED flag until after we are certain there
are no errors and the page size has been set.
[forum:/forumpost/b901808856|Forum post b901808856].

FossilOrigin-Name: cefaf128d2f1361c7853e4e4679bb3237c6e3a80c19cb71a453033846c3e1211
2023-06-12 14:09:11 +00:00
drh 8c3ea529fd Extra space to prevent a buffer overread on corrupt STAT4 records.
dbsqlfuzz 7128d1b41ce9df2c007f9c24c1e89e2f1b2590ca.

FossilOrigin-Name: 566c4c14dd0ff0b68ef20968b0bbaee92f88374ee969ee6251dc3764ce935267
2023-06-12 14:03:20 +00:00
drh 575d823095 Simplify a memcpy() in defragmentPage(). It now might copy more content than
is strictly necessary, but runs faster and uses less code space.  Possible
reasons for the improved performance:
(1) the copy is now always 8-byte aligned,
(2) fewer intermediate results are required which means less register
pressure which helps the compiler to optimize the subroutine.

FossilOrigin-Name: 1292d676ea68b9347e3b65b9945749deb45f07bf4c83aa5386c3efcade346932
2023-06-12 13:57:42 +00:00
drh f7d02ca6fa Fix CLI fault on missing -nonce reported by [forum:/info/f8c14a1134|forum post f8c14a1134].
FossilOrigin-Name: 67cf7c40961f6d181577783e1c656abb56c4848d087794b6fc98f4d42aba48ea
2023-06-12 13:53:48 +00:00
drh 38657ffcad Fix a problem causing an infinite loop in the recovery extension when processing a corrupt free-block list.
FossilOrigin-Name: d21c06b73dc4e472950fb27e589e951601b642501b0200fd14685174d90d8f7b
2023-06-12 13:46:26 +00:00
drh 6e0d6e0cc1 Fix an issue with sqldiff reported by
[forum:/info/9bd2155bdfae25a7|forum post 9bd2155bdfae25a7].

FossilOrigin-Name: 50721074f70d19128c9ae048a6d9f7608f8c54c42e6b3ae45dfd0939448233bf
2023-06-12 13:43:38 +00:00
drh 1409791d96 Avoid performing aggregate processing more than once for a single expression.
FossilOrigin-Name: 1bc549716c8a96a6db579d48027fde7388e1fdad22e39f223984cdb1321fe6b2
2023-05-23 17:43:24 +00:00
drh 51aa802a4a When converting an aggregate expression to AGG_COLUMN, be sure to remove
the EP_Unlikely flag if it is present.

FossilOrigin-Name: 20c8a9247be2f0c1606e2c79910f28593898054b99adf505b32ac6352ce8e89e
2023-05-23 15:22:25 +00:00
stephan eeec597f9b Extend detection of the INSERT...RETURNING locking case to the DB.selectValue(s)/selectArray/selectObject() family of functions. Add tests for INSERT/UPDATE...RETURNING with those functions.
FossilOrigin-Name: 58be212d56d7601e270eb11c77c8371db7507a0a19d4febf1d6c0cd87c0b1016
2023-05-19 18:26:47 +00:00
stephan 303ba6ca1b oo1.Stmt.finalize() no longer throws, but instead returns the same as the C API. oo1.DB.exec() now triggers the INSERT...RETURNING locking failure as an exception via reset() instead of finalize(). Some code-adjacent internal API renaming for clarity's sake.
FossilOrigin-Name: 15f105c78268fb68a4713da444452f5d7b038019b21024302beebb6b26ff2244
2023-05-19 17:52:24 +00:00
stephan 1c1dfc1d46 sqlite3.oo1.Stmt.reset() and finalize() now throw if their underlying C-level APIs return non-0, in order to avoid silent failure in certain locking-related cases.
FossilOrigin-Name: db36a9ef5958cd761ca5bde697cc7cd83328dcc24d818023b813f6f860052754
2023-05-19 16:39:02 +00:00
stephan 10f6cdd308 Correct typo in an 'extern' decl name, reported in [forum:1d4342156439233b|forum post 1d4342156439233b].
FossilOrigin-Name: 3bb1d7b376b740c1a7bca82a8908840a9e6e9c1474c4f0fedf3d7eb917305b99
2023-05-19 12:46:38 +00:00
drh f1343a7532 Fix incorrect b-tree root page reports from the enhanced PRAGMA integrity_check
output introduced in version 3.42.0.

FossilOrigin-Name: 0a0b7a2d3178f1aa650acd1d729566c889e27c9714463437a7f17c08e992ffd3
2023-05-18 23:28:33 +00:00
drh 7a68f807d4 Avoid an assert() failure that could occur in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds when a WITH clause attached to an UPDATE or DELETE statement created a CTE of the same name as the table being modified.
FossilOrigin-Name: 60f03e3245089ce24020105a4dbe4c9ac3de4c4978ec87b62538c1a3929e11b3
2023-05-17 11:45:25 +00:00
stephan 2997f03826 Resolve the JS-side corner case reported in [forum:7774b773937cbe0a | forum post 7774b773937cbe0a] by not caching oo1.Stmt.columnCount.
FossilOrigin-Name: adee1440bdca6ef9ab4096abf6cb59b30cd801055f6158b153dfcd512abdd8bb
2023-05-17 00:47:03 +00:00
drh 09d3f5df07 Increase the version number to 3.42.1
FossilOrigin-Name: da0c662b31ae8bf721de5bd57aaed1fa1844cd8eb721c54da005b4c2d1d3ff5e
2023-05-17 00:32:45 +00:00
drh 27052c3e6f Fix two assert() statements that failed to take into account
the likely() built-in function.  This does not impact production code.

FossilOrigin-Name: 634fe4c2386d42fac8bc6c4633ea95e8af61c1b0e8bf11a89b49d8dcbcfeee31
2023-05-17 00:29:46 +00:00
stephan 0c7bcf4c0e Doc typo fix. No code changes.
FossilOrigin-Name: e841b142f583e49350c7cdd14dc4da72434cc67c7b521ae741e03e37e785d7e0
2023-05-10 21:08:01 +00:00
stephan 161f742856 Resolve the JS-side corner case reported in [forum:7774b773937cbe0a | forum post 7774b773937cbe0a] by not caching oo1.Stmt.columnCount.
FossilOrigin-Name: c3d25c3a25e79e01c4ad0cf11f7dc3b0fb1932f3bcd04935a728ef62f7e07cf1
2023-05-10 21:06:02 +00:00
36 changed files with 863 additions and 286 deletions
+1 -1
View File
@@ -1 +1 @@
3.42.0
3.42.1
Vendored
+9 -9
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.42.0.
# Generated by GNU Autoconf 2.69 for sqlite 3.42.1.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.42.0'
PACKAGE_STRING='sqlite 3.42.0'
PACKAGE_VERSION='3.42.1'
PACKAGE_STRING='sqlite 3.42.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1470,7 +1470,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.42.0 to adapt to many kinds of systems.
\`configure' configures sqlite 3.42.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1535,7 +1535,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.42.0:";;
short | recursive ) echo "Configuration of sqlite 3.42.1:";;
esac
cat <<\_ACEOF
@@ -1665,7 +1665,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.42.0
sqlite configure 3.42.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2084,7 +2084,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.42.0, which was
It was created by sqlite $as_me 3.42.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -12457,7 +12457,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.42.0, which was
This file was extended by sqlite $as_me 3.42.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12523,7 +12523,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sqlite config.status 3.42.0
sqlite config.status 3.42.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+50 -41
View File
@@ -1349,9 +1349,9 @@ static int fts5DlidxLvlNext(Fts5DlidxLvl *pLvl){
}
if( iOff<pData->nn ){
i64 iVal;
u64 iVal;
pLvl->iLeafPgno += (iOff - pLvl->iOff) + 1;
iOff += fts5GetVarint(&pData->p[iOff], (u64*)&iVal);
iOff += fts5GetVarint(&pData->p[iOff], &iVal);
pLvl->iRowid += iVal;
pLvl->iOff = iOff;
}else{
@@ -2691,7 +2691,6 @@ static int fts5MultiIterDoCompare(Fts5Iter *pIter, int iOut){
assert_nc( i2!=0 );
pRes->bTermEq = 1;
if( p1->iRowid==p2->iRowid ){
p1->bDel = p2->bDel;
return i2;
}
res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : +1;
@@ -3911,7 +3910,7 @@ static void fts5WriteDlidxAppend(
}
if( pDlidx->bPrevValid ){
iVal = iRowid - pDlidx->iPrev;
iVal = (u64)iRowid - (u64)pDlidx->iPrev;
}else{
i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno);
assert( pDlidx->buf.n==0 );
@@ -4711,7 +4710,6 @@ static void fts5DoSecureDelete(
int iIdx = 0;
int iStart = 0;
int iKeyOff = 0;
int iPrevKeyOff = 0;
int iDelKeyOff = 0; /* Offset of deleted key, if any */
nIdx = nPg-iPgIdx;
@@ -4775,28 +4773,33 @@ static void fts5DoSecureDelete(
}
iOff = iStart;
if( iNextOff>=iPgIdx ){
int pgno = pSeg->iLeafPgno+1;
fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
iNextOff = iPgIdx;
}else{
/* Set bLastInDoclist to true if the entry being removed is the last
** in its doclist. */
for(iIdx=0, iKeyOff=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0;
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
iKeyOff += iVal;
if( iKeyOff==iNextOff ){
bLastInDoclist = 1;
if( pSeg->bDel==0 ){
if( iNextOff>=iPgIdx ){
int pgno = pSeg->iLeafPgno+1;
fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
iNextOff = iPgIdx;
}else{
/* Set bLastInDoclist to true if the entry being removed is the last
** in its doclist. */
for(iIdx=0, iKeyOff=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0;
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
iKeyOff += iVal;
if( iKeyOff==iNextOff ){
bLastInDoclist = 1;
}
}
}
if( fts5GetU16(&aPg[0])==iStart && (bLastInDoclist||iNextOff==iPgIdx) ){
fts5PutU16(&aPg[0], 0);
}
}
if( fts5GetU16(&aPg[0])==iStart && (bLastInDoclist||iNextOff==iPgIdx) ){
fts5PutU16(&aPg[0], 0);
}
if( bLastInDoclist==0 ){
if( pSeg->bDel ){
iOff += sqlite3Fts5PutVarint(&aPg[iOff], iDelta);
aPg[iOff++] = 0x01;
}else if( bLastInDoclist==0 ){
if( iNextOff!=iPgIdx ){
iNextOff += fts5GetVarint(&aPg[iNextOff], &iNextDelta);
iOff += sqlite3Fts5PutVarint(&aPg[iOff], iDelta + iNextDelta);
@@ -4840,7 +4843,9 @@ static void fts5DoSecureDelete(
iOff += sqlite3Fts5PutVarint(&aPg[iOff], nPrefix);
}
iOff += sqlite3Fts5PutVarint(&aPg[iOff], nSuffix);
if( nPrefix2>nPrefix ){
if( nPrefix2>pSeg->term.n ){
p->rc = FTS5_CORRUPT;
}else if( nPrefix2>nPrefix ){
memcpy(&aPg[iOff], &pSeg->term.p[nPrefix], nPrefix2-nPrefix);
iOff += (nPrefix2-nPrefix);
}
@@ -4893,26 +4898,24 @@ static void fts5DoSecureDelete(
}
if( p->rc==SQLITE_OK ){
const int nMove = nPg - iNextOff;
int nShift = 0;
const int nMove = nPg - iNextOff; /* Number of bytes to move */
int nShift = iNextOff - iOff; /* Distance to move them */
int iPrevKeyOut = 0;
int iKeyIn = 0;
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
iPgIdx -= (iNextOff - iOff);
iPgIdx -= nShift;
nPg = iPgIdx;
fts5PutU16(&aPg[2], iPgIdx);
nShift = iNextOff - iOff;
for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
for(iIdx=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0;
iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
iKeyOff += iVal;
if( iKeyOff!=iDelKeyOff ){
if( iKeyOff>iOff ){
iKeyOff -= nShift;
nShift = 0;
}
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
iPrevKeyOff = iKeyOff;
iKeyIn += iVal;
if( iKeyIn!=iDelKeyOff ){
int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
iPrevKeyOut = iKeyOut;
}
}
@@ -5091,10 +5094,16 @@ static void fts5FlushOneHash(Fts5Index *p){
fts5WriteFlushLeaf(p, &writer);
}
}else{
int bDummy;
int nPos;
int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy);
nCopy += nPos;
int bDel = 0;
int nPos = 0;
int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDel);
if( bDel && bSecureDelete ){
fts5BufferAppendVarint(&p->rc, pBuf, nPos*2);
iOff += nCopy;
nCopy = nPos;
}else{
nCopy += nPos;
}
if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){
/* The entire poslist will fit on the current leaf. So copy
** it in one go. */
+29
View File
@@ -96,4 +96,33 @@ set r 137438953475
db close
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
BEGIN;
INSERT INTO t1 VALUES('abc');
INSERT INTO t1 VALUES('b d d d');
COMMIT;
INSERT INTO t1(t1, rank) VALUES('secure-delete', 1);
}
execsql_pp {
SELECT id, quote(block) FROM t1_data
}
do_execsql_test 2.1 {
SELECT quote(block) FROM t1_data WHERE id > 10;
} {X'0000001A04306162630102020101620202020101640206030303040806'}
do_execsql_test 2.2 {
UPDATE t1_data SET
block=X'0000001A04306162630102025501620202020101640206030303040806'
WHERE id>10
}
do_catchsql_test 2.3 {
DELETE FROM t1 WHERE rowid = 1
} {1 {database disk image is malformed}}
finish_test
+13
View File
@@ -273,6 +273,19 @@ do_execsql_test 5.3 {
do_execsql_test 5.4 { SELECT rowid FROM t1('abc'); } 2
do_execsql_test 5.5 { SELECT rowid FROM t1('aa'); } 2
#-------------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE VIRTUAL TABLE fts USING fts5(content);
INSERT INTO fts(fts, rank) VALUES ('secure-delete', 1);
INSERT INTO fts(rowid, content) VALUES
(3407, 'profile profile profile profile profile profile profile profile pull pulling pulling really');
DELETE FROM fts WHERE rowid IS 3407;
INSERT INTO fts(fts) VALUES ('integrity-check');
}
finish_test
+67 -62
View File
@@ -86,71 +86,76 @@ do_execsql_test 2.8 {
# Tests with large/small rowid values.
#
reset_db
expr srand(0)
set vocab {
Popper Poppins Popsicle Porfirio Porrima Porsche
Porter Portia Portland Portsmouth Portugal Portuguese
Poseidon Post PostgreSQL Potemkin Potomac Potsdam
Pottawatomie Potter Potts Pound Poussin Powell
PowerPC PowerPoint Powers Powhatan Poznan Prada
Prado Praetorian Prague Praia Prakrit Pratchett
Pratt Pravda Praxiteles Preakness Precambrian Preminger
Premyslid Prensa Prentice Pres Presbyterian Presbyterianism
}
proc newdoc {} {
for {set i 0} {$i<8} {incr i} {
lappend ret [lindex $::vocab [expr int(abs(rand()) * [llength $::vocab])]]
foreach {tn cfg} {
1 ""
2 "INSERT INTO fff(fff, rank) VALUES('secure-delete', 1)"
} {
reset_db
expr srand(0)
set vocab {
Popper Poppins Popsicle Porfirio Porrima Porsche
Porter Portia Portland Portsmouth Portugal Portuguese
Poseidon Post PostgreSQL Potemkin Potomac Potsdam
Pottawatomie Potter Potts Pound Poussin Powell
PowerPC PowerPoint Powers Powhatan Poznan Prada
Prado Praetorian Prague Praia Prakrit Pratchett
Pratt Pravda Praxiteles Preakness Precambrian Preminger
Premyslid Prensa Prentice Pres Presbyterian Presbyterianism
}
set ret
}
db func newdoc newdoc
do_execsql_test 3.0 {
CREATE VIRTUAL TABLE fff USING fts5(y);
INSERT INTO fff(fff, rank) VALUES('pgsz', 64);
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
INSERT INTO fff(fff, rank) VALUES('secure-delete', 1);
}
proc lshuffle {in} {
set out [list]
while {[llength $in]>0} {
set idx [expr int(abs(rand()) * [llength $in])]
lappend out [lindex $in $idx]
set in [lreplace $in $idx $idx]
}
set out
}
#dump fff
set iTest 1
foreach ii [lshuffle [db eval {SELECT rowid FROM fff}]] {
#if {$iTest==1} { dump fff }
#if {$iTest==1} { breakpoint }
do_execsql_test 3.1.$iTest.$ii {
DELETE FROM fff WHERE rowid=$ii;
}
#if {$iTest==1} { dump fff }
if {($iTest % 20)==0} {
do_execsql_test 3.1.$iTest.$ii.ic {
INSERT INTO fff(fff) VALUES('integrity-check');
proc newdoc {} {
for {set i 0} {$i<8} {incr i} {
lappend ret [lindex $::vocab [expr int(abs(rand()) * [llength $::vocab])]]
}
set ret
}
db func newdoc newdoc
do_execsql_test 3.$tn.0 {
CREATE VIRTUAL TABLE fff USING fts5(y);
INSERT INTO fff(fff, rank) VALUES('pgsz', 64);
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 )
INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s;
}
execsql $cfg
proc lshuffle {in} {
set out [list]
while {[llength $in]>0} {
set idx [expr int(abs(rand()) * [llength $in])]
lappend out [lindex $in $idx]
set in [lreplace $in $idx $idx]
}
set out
}
#dump fff
set iTest 1
foreach ii [lshuffle [db eval {SELECT rowid FROM fff}]] {
#if {$iTest==1} { dump fff }
#if {$iTest==1} { breakpoint }
do_execsql_test 3.$tn.1.$iTest.$ii {
DELETE FROM fff WHERE rowid=$ii;
}
#if {$iTest==1} { dump fff }
if {($iTest % 20)==0} {
do_execsql_test 3.$tn.1.$iTest.$ii.ic {
INSERT INTO fff(fff) VALUES('integrity-check');
}
}
#if {$iTest==1} { break }
incr iTest
}
#if {$iTest==1} { break }
incr iTest
}
#execsql_pp { SELECT rowid FROM fff('post') ORDER BY rowid ASC }
+99 -1
View File
@@ -18,7 +18,7 @@ db progress 1 progress_handler
set ::PHC 0
proc progress_handler {args} {
incr ::PHC
if {($::PHC % 100000)==0} breakpoint
# if {($::PHC % 100000)==0} breakpoint
return 0
}
@@ -50,6 +50,104 @@ do_test 1.3 {
expr $phc(1)*5 < $phc(2)
} {1}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
}
do_execsql_test 2.1 {
BEGIN;
INSERT INTO t1(rowid, x) VALUES(-100000, 'abc def ghi');
INSERT INTO t1(rowid, x) VALUES(-99999, 'abc def ghi');
INSERT INTO t1(rowid, x) VALUES(9223372036854775800, 'abc def ghi');
COMMIT;
}
do_execsql_test 2.2 {
SELECT rowid FROM t1('def')
} {-100000 -99999 9223372036854775800}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
}
do_execsql_test 2.1 {
BEGIN;
INSERT INTO t1(rowid, x)
VALUES(51869, 'when whenever where weress what turn'),
(51871, 'to were');
COMMIT;
}
do_execsql_test 3.2 {
DELETE FROM t1 WHERE rowid=51871;
INSERT INTO t1(t1) VALUES('integrity-check');
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
}
do_execsql_test 2.1 {
BEGIN;
INSERT INTO t1(rowid, x) VALUES(-100000, 'abc def ghi');
INSERT INTO t1(rowid, x) VALUES(-99999, 'abc def ghi');
INSERT INTO t1(rowid, x) VALUES(9223372036854775800, 'abc def ghi');
COMMIT;
}
do_execsql_test 2.2 {
SELECT rowid FROM t1('def')
} {-100000 -99999 9223372036854775800}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 3.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
}
do_execsql_test 3.1 {
BEGIN;
INSERT INTO t1(rowid, x)
VALUES(51869, 'when whenever where weress what turn'),
(51871, 'to were');
COMMIT;
}
do_execsql_test 3.2 {
DELETE FROM t1 WHERE rowid=51871;
INSERT INTO t1(t1) VALUES('integrity-check');
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 4.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
INSERT INTO t1(rowid, x) VALUES(10, 'one two');
}
do_execsql_test 4.1 {
UPDATE t1 SET x = 'one three' WHERE rowid=10;
INSERT INTO t1(t1, rank) VALUES('secure-delete', 1);
}
do_execsql_test 4.2 {
DELETE FROM t1 WHERE rowid=10;
}
do_execsql_test 4.3 {
INSERT INTO t1(t1) VALUES('integrity-check');
}
finish_test
+182
View File
@@ -285,5 +285,187 @@ do_test 5.1 {
list [catch { $R finish } msg] $msg
} {0 {}}
reset_db
breakpoint
do_test 7.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 4108 pagesize 4096 filename x1.db
| page 1 offset 0
| 0: 02 01 00 00 00 00 14 15 40 00 00 00 00 00 00 00 ........@.......
| 16: 33 3a 6d 65 6d 6f 72 79 3a 02 02 02 02 02 02 02 3:memory:.......
| 32: 02 02 02 02 02 02 12 02 02 02 63 6f 6c 6f 72 20 ..........color
| 48: 73 70 61 63 00 f3 a0 81 a1 00 00 a0 02 02 02 02 spac............
| 64: 69 95 73 6f 36 00 ff 0d 00 97 8c 90 3f 0a 70 02 i.so6.......?.p.
| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 01 00 00 ................
| 96: 06 02 02 02 02 5f 02 02 02 2c 02 02 02 02 02 02 ....._...,......
| 112: 02 02 02 02 02 02 02 02 02 12 02 02 02 63 6f 6c .............col
| 128: 6f 72 20 73 70 61 63 00 f3 a0 81 a1 00 00 a0 02 or spac.........
| 144: 02 02 02 69 95 73 6f 36 00 ff 0d 00 97 8c 90 3f ...i.so6.......?
| 160: 0a 70 02 02 02 02 02 02 02 02 02 02 02 02 02 02 .p..............
| 176: 01 00 00 06 02 02 02 02 5f 02 02 02 2c 02 02 00 ........_...,...
| 192: 00 01 00 01 00 00 00 01 00 02 fe 00 00 03 00 01 ................
| 208: 00 00 00 01 c5 04 00 00 00 01 00 01 00 00 00 01 ................
| 224: 00 fa 02 00 00 00 03 00 01 00 00 00 81 00 04 00 ................
| 240: 00 00 01 00 01 00 00 00 01 00 02 00 fe 00 03 00 ................
| 256: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 272: 01 00 02 00 00 00 03 00 01 00 00 00 01 00 04 00 ................
| 288: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 304: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 320: 01 00 02 00 00 00 03 00 01 00 00 00 40 00 84 00 ............@...
| 336: 84 00 84 00 01 00 00 00 09 00 06 00 f5 00 01 00 ................
| 352: 08 01 03 00 03 00 62 00 62 00 23 00 01 00 62 00 ......b.b.#...b.
| 368: 04 00 1e 00 62 00 62 00 62 00 01 00 00 00 0a 00 ....b.b.b.......
| 384: 01 00 03 00 01 00 03 00 04 00 02 00 01 00 01 00 ................
| 400: 08 00 01 00 31 c6 00 03 00 0c 00 12 00 18 00 02 ....1...........
| 416: 00 05 00 08 00 02 00 06 00 08 00 02 00 07 00 08 ................
| 432: 00 02 00 01 00 01 00 08 00 01 00 0c 00 03 00 16 ................
| 448: 00 1c 00 22 00 01 00 03 00 05 00 06 00 07 00 02 ................
| 464: 00 05 00 09 00 02 00 06 00 09 00 02 00 07 00 09 ................
| 480: 00 00 00 00 01 00 05 00 00 00 01 00 01 00 00 00 ................
| 496: 01 00 02 00 00 00 03 00 01 00 00 00 01 00 04 00 ................
| 512: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 528: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 544: 01 00 02 00 00 f6 03 00 00 02 00 00 01 00 04 00 ................
| 560: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 576: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 592: 01 00 02 00 00 00 03 00 01 00 00 00 01 00 04 00 ................
| 608: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 624: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 640: 01 3d 02 00 00 00 03 00 06 00 00 00 01 00 01 00 .=..............
| 656: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 672: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 688: 01 00 02 00 00 00 55 52 4c 52 65 71 75 65 73 74 ......URLRequest
| 704: 43 6f 6e 00 00 00 01 01 0e d4 00 04 00 00 00 01 Con.............
| 720: 0e f8 00 04 00 00 00 01 0f 1c 00 04 00 00 00 01 ................
| 736: 0f 00 00 01 00 00 00 01 0f 86 00 01 00 00 00 01 ................
| 752: 0f 84 00 01 00 00 00 01 00 00 01 0f c0 00 01 00 ................
| 768: 00 00 01 0f e8 00 d6 0f 00 01 6f 00 02 0f d6 00 ..........o.....
| 784: 02 34 03 03 03 00 01 00 00 00 01 00 05 00 00 00 .4..............
| 800: 01 00 01 00 00 00 01 00 02 00 00 00 03 00 01 00 ................
| 816: 00 00 01 00 04 00 00 00 01 00 01 00 00 00 01 00 ................
| 832: 02 00 00 00 03 00 01 00 10 00 01 00 04 00 00 00 ................
| 848: 01 00 01 00 00 00 01 00 02 00 00 00 03 00 00 02 ................
| 864: 00 00 01 40 04 00 00 03 01 00 01 00 00 00 01 00 ...@............
| 880: 02 00 00 00 03 00 01 00 00 00 00 00 01 0e f8 00 ................
| 896: 04 77 4f 46 32 73 40 23 70 00 00 00 70 00 1f 00 .wOF2s@#p...p...
| 912: 00 00 d8 00 00 00 ff ff 00 00 00 00 43 00 00 00 ............C...
| 928: 00 00 ff ff ff ff ff 00 00 a8 00 00 0c 00 00 00 ................
| 1024: 00 00 00 00 00 00 00 00 00 00 10 22 00 22 0f 00 ................
| 1040: 00 00 00 00 00 00 10 22 00 00 70 00 1f 00 00 0f ..........p.....
| 1056: d8 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 ................
| 1072: 00 01 00 00 00 3f 23 70 00 00 00 01 0f 1c 00 04 .....?#p........
| 1088: 00 00 00 01 0f 40 00 01 00 00 00 01 0f 86 00 01 .....@..........
| 1104: 00 00 00 01 0f 84 00 01 00 00 00 01 00 00 01 0f ................
| 1120: c0 00 01 00 00 00 01 0f e8 00 01 0f d6 00 6f 00 ..............o.
| 1136: 02 0f d6 00 03 02 31 03 2b 03 2a f2 00 0f d4 00 ......1.+.*.....
| 1152: 01 00 08 00 01 00 04 03 2b 00 02 02 32 00 01 0f ........+...2...
| 1168: c8 01 15 00 02 20 c8 00 02 12 ad 02 00 24 06 c0 ..... .......$..
| 1184: 00 00 00 03 00 00 01 24 00 2a 06 e4 00 00 00 03 .......$.*......
| 1200: 00 00 01 25 00 38 07 0e 00 00 00 03 00 00 01 26 ...%.8.........&
| 1216: 00 34 07 46 00 00 00 03 00 00 01 27 00 1c 07 7a .4.F.......'...z
| 1232: 00 00 00 03 00 00 01 28 00 2a 07 96 00 00 00 03 .......(.*......
| 1248: 00 e5 01 29 00 34 07 c0 00 00 00 03 00 00 01 2a ...).4.........*
| 1264: 67 34 07 f4 00 00 00 03 00 00 01 2b 00 22 08 28 g4.........+...(
| 1280: 00 00 00 00 01 00 01 00 00 00 01 00 02 00 00 00 ................
| 1296: 03 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 ................
| 1312: 01 00 00 00 01 00 02 00 00 00 03 00 00 02 00 00 ................
| 1328: 01 00 04 00 00 00 01 00 01 00 00 00 01 00 02 00 ................
| 1344: 00 00 03 00 01 00 00 00 01 00 04 00 00 00 01 00 ................
| 1360: 01 00 00 00 01 00 02 00 00 00 03 00 01 00 00 21 ...............!
| 1376: 04 00 01 00 00 00 00 00 01 00 00 00 01 00 02 00 ................
| 1392: 00 00 03 00 01 00 00 00 01 00 04 00 00 00 01 00 ................
| 1408: 01 00 00 00 01 00 02 00 00 00 03 00 01 00 00 00 ................
| 1424: 01 00 05 00 00 00 01 00 01 00 00 01 00 02 02 02 ................
| 1440: 12 02 02 02 63 6f 6c 6f 72 20 73 70 61 63 00 f3 ....color spac..
| 1456: a0 81 a1 00 00 a0 02 02 02 02 69 95 73 6f 36 00 ..........i.so6.
| 1472: ff 0d 00 97 8c 90 3f 0a 70 02 02 02 02 02 02 02 ......?.p.......
| 1488: 02 02 02 02 02 02 02 01 00 00 06 02 02 02 02 5f ..............._
| 1504: 02 02 02 2c 02 02 00 00 01 00 01 00 00 00 01 00 ...,............
| 1520: 02 fe 00 00 03 00 01 00 00 00 01 c5 04 00 00 00 ................
| 1536: 01 00 01 00 00 00 01 00 02 00 00 00 03 00 01 00 ................
| 1552: 00 00 81 00 04 00 00 00 01 00 01 00 00 00 01 00 ................
| 1568: 02 00 fe 00 03 00 01 00 00 00 01 00 04 00 00 00 ................
| 1584: 01 00 01 00 00 00 01 00 02 00 00 00 03 00 01 00 ................
| 1600: 00 00 01 00 04 00 00 00 01 00 01 00 00 00 01 00 ................
| 1616: 02 00 00 00 03 00 01 00 00 00 01 00 04 00 00 00 ................
| 1632: 01 00 01 00 00 00 01 00 02 00 00 00 03 00 01 00 ................
| 1648: 00 00 40 00 84 00 84 00 84 00 01 00 00 00 09 00 ..@.............
| 1664: 06 00 f5 00 01 00 08 01 03 15 15 15 15 15 15 15 ................
| 1680: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ................
| 1696: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ................
| 1712: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ................
| 1728: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ................
| 1744: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ................
| 1760: 15 15 15 15 15 15 15 15 15 15 15 00 03 00 62 00 ..............b.
| 1776: 62 00 23 00 01 00 62 00 04 00 1e 00 62 00 62 00 b.#...b.....b.b.
| 1792: 62 00 01 00 00 00 0a 00 01 00 03 00 01 00 03 00 b...............
| 1808: 04 00 02 00 01 00 01 00 08 00 01 00 31 c6 00 03 ............1...
| 1824: 00 0c 00 12 00 18 00 02 00 05 00 08 00 02 00 06 ................
| 1840: 00 08 00 02 00 07 00 08 00 02 00 01 00 01 00 08 ................
| 1856: 00 01 00 0c 00 03 00 16 00 1c 00 22 00 01 00 03 ................
| 1872: 00 05 00 06 00 07 00 02 00 05 00 09 00 02 00 06 ................
| 1888: 00 09 00 02 00 07 00 09 00 00 00 00 01 00 05 00 ................
| 1904: 00 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 ................
| 1920: 01 00 00 00 01 00 04 00 00 00 01 00 01 00 00 00 ................
| 1936: 01 00 02 00 00 00 03 00 01 00 00 00 01 00 04 00 ................
| 1952: 00 00 01 0f d6 00 02 34 03 03 03 00 01 00 00 00 .......4........
| 1968: 01 00 05 00 00 00 01 00 01 00 00 00 01 00 02 00 ................
| 1984: 00 00 03 00 01 00 00 00 01 00 04 00 00 00 01 00 ................
| 2000: 01 00 00 00 01 00 02 fc 42 dc 19 5c 74 23 18 cd ........B...t#..
| 2016: b3 a5 a8 7a 90 40 1d 66 12 5d e5 4f 85 00 68 f4 ...z.@.f.].O..h.
| 2032: 05 98 86 25 24 dd bc c2 f6 f6 4e a3 e2 61 d2 c6 ...%$.....N..a..
| 2048: aa c1 56 50 d4 80 82 35 f1 e2 59 41 50 a6 da 51 ..VP...5..YAP..Q
| 2064: d4 62 9c 19 94 58 aa 31 30 8a 22 c2 5f 33 2b c9 .b...X.10..._3+.
| 2080: b6 e6 b4 11 4e 51 82 c4 d8 b6 d8 b4 06 04 fb 68 ....NQ.........h
| 2096: f4 d2 6f e7 cb 8a a8 82 d5 74 00 00 00 00 00 00 ..o......t......
| 2368: 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 ................
| 2432: 00 00 00 00 00 03 00 01 00 10 00 01 00 04 00 00 ................
| 2448: 00 01 00 01 00 00 00 01 00 02 00 00 00 03 00 00 ................
| 2464: 02 00 00 01 40 04 00 00 03 01 00 01 00 00 00 01 ....@...........
| 2480: 00 02 00 00 00 03 00 01 00 00 00 00 00 01 0e f8 ................
| 2496: 00 04 77 4f 46 32 73 40 23 70 00 00 00 70 00 1f ..wOF2s@#p...p..
| 2512: 00 00 00 d8 00 00 00 ff ff 00 00 00 00 43 00 00 .............C..
| 2528: 00 00 00 ff ff ff ff ff 00 00 a8 00 00 0c 00 00 ................
| 2624: 00 00 00 00 00 00 00 00 00 00 00 10 22 00 22 0f ................
| 2640: 00 00 00 00 00 00 00 10 22 00 00 70 00 1f 00 00 ...........p....
| 2656: 0f d8 00 00 00 00 00 00 00 00 00 03 00 00 00 00 ................
| 2672: 00 00 01 00 00 00 3f 23 70 00 00 00 01 0f 1c 00 ......?#p.......
| 2688: 04 00 00 00 01 0f 40 00 01 00 00 00 01 0f 86 00 ......@.........
| 2704: 01 00 00 00 01 0f 84 00 01 00 00 00 01 00 00 01 ................
| 2720: 0f c0 00 01 00 00 00 01 0f e8 00 01 0f d6 00 6f ...............o
| 2736: 00 02 0f d6 00 03 02 31 03 2b 03 2a f2 00 0f d4 .......1.+.*....
| 2752: 00 01 00 08 00 01 00 04 03 2b 00 02 02 32 00 01 .........+...2..
| 2768: 0f c8 01 15 00 02 20 c8 00 02 12 ad 02 00 24 06 ...... .......$.
| 2784: c0 00 00 5a 03 00 00 01 24 00 2a 06 e4 00 00 00 ...Z....$.*.....
| 2800: 03 00 00 01 25 00 38 07 0e 00 00 00 03 00 00 01 ....%.8.........
| 2816: 26 00 34 07 46 00 00 00 03 00 00 01 27 00 1c 07 &.4.F.......'...
| 2832: 7a 00 00 00 03 00 00 01 28 00 2a 07 96 00 00 00 z.......(.*.....
| 2848: 03 00 e5 01 29 00 34 07 c0 00 00 00 03 00 00 01 ....).4.........
| 2864: 2a 67 34 07 f4 00 00 00 03 00 00 01 2b 00 22 08 *g4.........+...
| 2880: 28 00 00 00 00 01 00 01 00 00 00 01 00 02 00 00 (...............
| 2896: 00 03 00 01 00 00 00 01 00 00 00 01 00 00 00 01 ................
| 2912: 00 01 00 00 00 01 00 02 00 00 00 03 00 00 02 00 ................
| 2928: 00 01 00 04 00 00 00 01 00 01 00 00 00 00 00 00 ................
| 2992: 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .H..............
| 3504: 00 00 00 00 00 00 00 00 00 00 00 97 00 00 00 00 ................
| 3904: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 ................
| 3920: 03 fe 00 00 01 36 00 3c 0a 38 00 00 00 03 00 00 .....6.<.8......
| 3936: 01 37 00 20 0a 74 00 00 00 fb ff ff 00 38 00 2a .7. .t.......8.*
| 3952: 0a 94 00 00 00 03 00 00 01 39 4f 54 54 4f 00 0e .........9OTTO..
| 3968: 00 80 00 03 00 60 43 46 46 20 e3 ae 89 2a 00 00 .....`CFF ...*..
| 3984: 02 b0 00 00 02 76 42 50 4f 53 00 15 00 0a 00 00 .....vBPOS......
| 4000: 05 28 00 00 00 0c 54 53 55 42 c9 70 c3 06 00 00 .(....TSUB.p....
| 4016: 05 34 1f 00 40 00 48 00 00 00 00 00 00 00 00 00 .4..@.H.........
| 4064: 00 00 00 00 00 08 00 01 00 01 00 01 00 01 00 06 ................
| 4080: 00 02 00 08 00 01 00 01 00 01 00 01 00 00 00 00 ................
| end x1.db
}]} {}
do_test 7.1 {
set R [sqlite3_recover_init db main test.db2]
catch { $R run }
list [catch { $R finish } msg] $msg
} {1 {file is not a database}}
finish_test
+1 -1
View File
@@ -2103,7 +2103,7 @@ static int recoverIsValidPage(u8 *aTmp, const u8 *a, int n){
if( iFree>(n-4) ) return 0;
iNext = recoverGetU16(&a[iFree]);
nByte = recoverGetU16(&a[iFree+2]);
if( iFree+nByte>n ) return 0;
if( iFree+nByte>n || nByte<4 ) return 0;
if( iNext && iNext<iFree+nByte ) return 0;
memset(&aUsed[iFree], 0xFF, nByte);
iFree = iNext;
+11 -7
View File
@@ -3235,15 +3235,19 @@ static int sessionReadRecord(
}
}
if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
sqlite3_int64 v = sessionGetI64(aVal);
if( eType==SQLITE_INTEGER ){
sqlite3VdbeMemSetInt64(apOut[i], v);
if( (pIn->nData-pIn->iNext)<8 ){
rc = SQLITE_CORRUPT_BKPT;
}else{
double d;
memcpy(&d, &v, 8);
sqlite3VdbeMemSetDouble(apOut[i], d);
sqlite3_int64 v = sessionGetI64(aVal);
if( eType==SQLITE_INTEGER ){
sqlite3VdbeMemSetInt64(apOut[i], v);
}else{
double d;
memcpy(&d, &v, 8);
sqlite3VdbeMemSetDouble(apOut[i], d);
}
pIn->iNext += 8;
}
pIn->iNext += 8;
}
}
}
+142 -75
View File
@@ -55,6 +55,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(sqliteResultCode){
if(dbPtr instanceof DB) dbPtr = dbPtr.pointer;
toss3(
sqliteResultCode,
"sqlite3 result code",sqliteResultCode+":",
(dbPtr
? capi.sqlite3_errmsg(dbPtr)
@@ -330,10 +331,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
- `db`: the DB object which created the statement.
- `columnCount`: the number of result columns in the query, or 0 for
queries which cannot return results.
- `columnCount`: the number of result columns in the query, or 0
for queries which cannot return results. This property is a proxy
for sqlite3_column_count() and its use in loops should be avoided
because of the call overhead associated with that. The
`columnCount` is not cached when the Stmt is created because a
schema change made via a separate db connection between this
statement's preparation and when it is stepped may invalidate it.
- `parameterCount`: the number of bindable paramters in the query.
- `parameterCount`: the number of bindable parameters in the query.
*/
const Stmt = function(){
if(BindTypes!==arguments[2]){
@@ -341,7 +347,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
this.db = arguments[0];
__ptrMap.set(this, arguments[1]);
this.columnCount = capi.sqlite3_column_count(this.pointer);
this.parameterCount = capi.sqlite3_bind_parameter_count(this.pointer);
};
@@ -473,7 +478,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const __selectFirstRow = (db, sql, bind, ...getArgs)=>{
const stmt = db.prepare(sql);
try {
return stmt.bind(bind).step() ? stmt.get(...getArgs) : undefined;
const rc = stmt.bind(bind).step() ? stmt.get(...getArgs) : undefined;
stmt.reset(/*for INSERT...RETURNING locking case*/);
return rc;
}finally{
stmt.finalize();
}
@@ -499,6 +506,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
"Not an error." The various non-0 non-error codes need to be
checked for in client code where they are expected.
The thrown exception's `resultCode` property will be the value of
the second argument to this function.
If it does not throw, it returns its first argument.
*/
DB.checkRc = (db,resultCode)=>checkSqlite3Rc(db,resultCode);
@@ -546,7 +556,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
const pDb = this.pointer;
Object.keys(__stmtMap.get(this)).forEach((k,s)=>{
if(s && s.pointer) s.finalize();
if(s && s.pointer){
try{s.finalize()}
catch(e){/*ignore*/}
}
});
__ptrMap.delete(this);
__stmtMap.delete(this);
@@ -701,18 +714,18 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
with identical names.
- `callback` = a function which gets called for each row of the
result set, but only if that statement has any result
_rows_. The callback's "this" is the options object, noting
that this function synthesizes one if the caller does not pass
one to exec(). The second argument passed to the callback is
always the current Stmt object, as it's needed if the caller
wants to fetch the column names or some such (noting that they
could also be fetched via `this.columnNames`, if the client
provides the `columnNames` option). If the callback returns a
literal `false` (as opposed to any other falsy value, e.g. an
implicit `undefined` return), any ongoing statement-`step()`
iteration stops without an error. The return value of the
callback is otherwise ignored.
result set, but only if that statement has any result rows. The
callback's "this" is the options object, noting that this
function synthesizes one if the caller does not pass one to
exec(). The second argument passed to the callback is always
the current Stmt object, as it's needed if the caller wants to
fetch the column names or some such (noting that they could
also be fetched via `this.columnNames`, if the client provides
the `columnNames` option). If the callback returns a literal
`false` (as opposed to any other falsy value, e.g. an implicit
`undefined` return), any ongoing statement-`step()` iteration
stops without an error. The return value of the callback is
otherwise ignored.
ACHTUNG: The callback MUST NOT modify the Stmt object. Calling
any of the Stmt.get() variants, Stmt.getColumnName(), or
@@ -733,7 +746,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
A.1) `'array'` (the default) causes the results of
`stmt.get([])` to be passed to the `callback` and/or appended
to `resultRows`
to `resultRows`.
A.2) `'object'` causes the results of
`stmt.get(Object.create(null))` to be passed to the
@@ -744,8 +757,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
A.3) `'stmt'` causes the current Stmt to be passed to the
callback, but this mode will trigger an exception if
`resultRows` is an array because appending the statement to
the array would be downright unhelpful.
`resultRows` is an array because appending the transient
statement to the array would be downright unhelpful.
B) An integer, indicating a zero-based column in the result
row. Only that one single value will be passed on.
@@ -775,7 +788,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
should return:
A) The default value is (usually) `"this"`, meaning that the
DB object itself should be returned. The exceptions is if
DB object itself should be returned. The exception is if
the caller passes neither of `callback` nor `returnValue`
but does pass an explicit `rowMode` then the default
`returnValue` is `"resultRows"`, described below.
@@ -857,38 +870,53 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
bind = null;
}
if(evalFirstResult && stmt.columnCount){
/* Only forward SELECT results for the FIRST query
/* Only forward SELECT-style results for the FIRST query
in the SQL which potentially has them. */
let gotColNames = Array.isArray(
opt.columnNames
/* As reported in
https://sqlite.org/forum/forumpost/7774b773937cbe0a
we need to delay fetching of the column names until
after the first step() (if we step() at all) because
a schema change between the prepare() and step(), via
another connection, may invalidate the column count
and names. */) ? 0 : 1;
evalFirstResult = false;
if(Array.isArray(opt.columnNames)){
stmt.getColumnNames(opt.columnNames);
}
if(arg.cbArg || resultRows){
for(; stmt.step(); stmt._isLocked = false){
stmt._isLocked = true;
for(; stmt.step(); stmt._lockedByExec = false){
if(0===gotColNames++) stmt.getColumnNames(opt.columnNames);
stmt._lockedByExec = true;
const row = arg.cbArg(stmt);
if(resultRows) resultRows.push(row);
if(callback && false === callback.call(opt, row, stmt)){
break;
}
}
stmt._isLocked = false;
stmt._lockedByExec = false;
}
if(0===gotColNames){
/* opt.columnNames was provided but we visited no result rows */
stmt.getColumnNames(opt.columnNames);
}
}else{
stmt.step();
}
stmt.finalize();
stmt.reset(
/* In order to trigger an exception in the
INSERT...RETURNING locking scenario:
https://sqlite.org/forum/forumpost/36f7a2e7494897df
*/).finalize();
stmt = null;
}
}/*prepare() loop*/
}/*catch(e){
sqlite3.config.warn("DB.exec() is propagating exception",opt,e);
throw e;
}*/finally{
wasm.scopedAllocPop(stack);
if(stmt){
delete stmt._isLocked;
delete stmt._lockedByExec;
stmt.finalize();
}
wasm.scopedAllocPop(stack);
}
return arg.returnVal();
}/*exec()*/,
@@ -1107,6 +1135,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
try {
stmt.bind(bind);
while(stmt.step()) rc.push(stmt.get(0,asType));
stmt.reset(/*for INSERT...RETURNING locking case*/);
}finally{
stmt.finalize();
}
@@ -1241,7 +1270,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
not throw, it returns this object.
*/
checkRc: function(resultCode){
return DB.checkRc(this, resultCode);
return checkSqlite3Rc(this, resultCode);
}
}/*DB.prototype*/;
@@ -1302,15 +1331,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
};
/**
If stmt._isLocked is truthy, this throws an exception
If stmt._lockedByExec is truthy, this throws an exception
complaining that the 2nd argument (an operation name,
e.g. "bind()") is not legal while the statement is "locked".
Locking happens before an exec()-like callback is passed a
statement, to ensure that the callback does not mutate or
finalize the statement. If it does not throw, it returns stmt.
*/
const affirmUnlocked = function(stmt,currentOpName){
if(stmt._isLocked){
const affirmNotLockedByExec = function(stmt,currentOpName){
if(stmt._lockedByExec){
toss3("Operation is illegal when statement is locked:",currentOpName);
}
return stmt;
@@ -1323,14 +1352,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
success.
*/
const bindOne = function f(stmt,ndx,bindType,val){
affirmUnlocked(affirmStmtOpen(stmt), 'bind()');
affirmNotLockedByExec(affirmStmtOpen(stmt), 'bind()');
if(!f._){
f._tooBigInt = (v)=>toss3(
"BigInt value is too big to store without precision loss:", v
);
/* Reminder: when not in BigInt mode, it's impossible for
JS to represent a number out of the range we can bind,
so we have no range checking. */
f._ = {
string: function(stmt, ndx, val, asBlob){
const [pStr, n] = wasm.allocCString(val, true);
@@ -1404,46 +1430,67 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Stmt.prototype = {
/**
"Finalizes" this statement. This is a no-op if the
statement has already been finalizes. Returns
undefined. Most methods in this class will throw if called
after this is.
"Finalizes" this statement. This is a no-op if the statement
has already been finalized. Returns the result of
sqlite3_finalize() (0 on success, non-0 on error), or the
undefined value if the statement has already been
finalized. Regardless of success or failure, most methods in
this class will throw if called after this is.
This method always throws if called when it is illegal to do
so. Namely, when triggered via a per-row callback handler of a
DB.exec() call.
*/
finalize: function(){
if(this.pointer){
affirmUnlocked(this,'finalize()');
affirmNotLockedByExec(this,'finalize()');
const rc = capi.sqlite3_finalize(this.pointer);
delete __stmtMap.get(this.db)[this.pointer];
capi.sqlite3_finalize(this.pointer);
__ptrMap.delete(this);
delete this._mayGet;
delete this.columnCount;
delete this.parameterCount;
delete this._lockedByExec;
delete this.db;
delete this._isLocked;
return rc;
}
},
/** Clears all bound values. Returns this object.
Throws if this statement has been finalized. */
/**
Clears all bound values. Returns this object. Throws if this
statement has been finalized or if modification of the
statement is currently illegal (e.g. in the per-row callback of
a DB.exec() call).
*/
clearBindings: function(){
affirmUnlocked(affirmStmtOpen(this), 'clearBindings()')
affirmNotLockedByExec(affirmStmtOpen(this), 'clearBindings()')
capi.sqlite3_clear_bindings(this.pointer);
this._mayGet = false;
return this;
},
/**
Resets this statement so that it may be step()ed again
from the beginning. Returns this object. Throws if this
statement has been finalized.
Resets this statement so that it may be step()ed again from the
beginning. Returns this object. Throws if this statement has
been finalized, if it may not legally be reset because it is
currently being used from a DB.exec() callback, or if the
underlying call to sqlite3_reset() returns non-0.
If passed a truthy argument then this.clearBindings() is
also called, otherwise any existing bindings, along with
any memory allocated for them, are retained.
In verions 3.42.0 and earlier, this function did not throw if
sqlite3_reset() returns non-0, but it was discovered that
throwing (or significant extra client-side code) is necessary
in order to avoid certain silent failure scenarios, as
discussed at:
https://sqlite.org/forum/forumpost/36f7a2e7494897df
*/
reset: function(alsoClearBinds){
affirmUnlocked(this,'reset()');
affirmNotLockedByExec(this,'reset()');
if(alsoClearBinds) this.clearBindings();
capi.sqlite3_reset(affirmStmtOpen(this).pointer);
const rc = capi.sqlite3_reset(affirmStmtOpen(this).pointer);
this._mayGet = false;
checkSqlite3Rc(this.db, rc);
return this;
},
/**
@@ -1592,7 +1639,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
value is returned. Throws on error.
*/
step: function(){
affirmUnlocked(this, 'step()');
affirmNotLockedByExec(this, 'step()');
const rc = capi.sqlite3_step(affirmStmtOpen(this).pointer);
switch(rc){
case capi.SQLITE_DONE: return this._mayGet = false;
@@ -1627,11 +1674,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
return this.reset();
},
/**
Functions like step() except that it finalizes this statement
immediately after stepping unless the step cannot be performed
because the statement is locked. Throws on error, but any error
other than the statement-is-locked case will also trigger
finalization of this statement.
Functions like step() except that it calls finalize() on this
statement immediately after stepping, even if the step() call
throws.
On success, it returns true if the step indicated that a row of
data was available, else it returns false.
@@ -1643,9 +1688,14 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
```
*/
stepFinalize: function(){
const rc = this.step();
this.finalize();
return rc;
try{
const rc = this.step();
this.reset(/*for INSERT...RETURNING locking case*/);
return rc;
}finally{
try{this.finalize()}
catch(e){/*ignored*/}
}
},
/**
Fetches the value from the given 0-based column index of
@@ -1686,13 +1736,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
if(Array.isArray(ndx)){
let i = 0;
while(i<this.columnCount){
const n = this.columnCount;
while(i<n){
ndx[i] = this.get(i++);
}
return ndx;
}else if(ndx && 'object'===typeof ndx){
let i = 0;
while(i<this.columnCount){
const n = this.columnCount;
while(i<n){
ndx[capi.sqlite3_column_name(this.pointer,i)] = this.get(i++);
}
return ndx;
@@ -1790,16 +1842,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
);
},
/**
If this statement potentially has result columns, this
function returns an array of all such names. If passed an
array, it is used as the target and all names are appended
to it. Returns the target array. Throws if this statement
cannot have result columns. This object's columnCount member
holds the number of columns.
If this statement potentially has result columns, this function
returns an array of all such names. If passed an array, it is
used as the target and all names are appended to it. Returns
the target array. Throws if this statement cannot have result
columns. This object's columnCount property holds the number of
columns.
*/
getColumnNames: function(tgt=[]){
affirmColIndex(affirmStmtOpen(this),0);
for(let i = 0; i < this.columnCount; ++i){
const n = this.columnCount;
for(let i = 0; i < n; ++i){
tgt.push(capi.sqlite3_column_name(this.pointer, i));
}
return tgt;
@@ -1826,6 +1879,20 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Object.defineProperty(Stmt.prototype, 'pointer', prop);
Object.defineProperty(DB.prototype, 'pointer', prop);
}
/**
Stmt.columnCount is an interceptor for sqlite3_column_count().
This requires an unfortunate performance hit compared to caching
columnCount when the Stmt is created/prepared (as was done in
SQLite <=3.42.0), but is necessary in order to handle certain
corner cases, as described in
https://sqlite.org/forum/forumpost/7774b773937cbe0a.
*/
Object.defineProperty(Stmt.prototype, 'columnCount', {
enumerable: false,
get: function(){return capi.sqlite3_column_count(this.pointer)},
set: ()=>toss3("The columnCount property is read-only.")
});
/** The OO API's public namespace. */
sqlite3.oo1 = {
-1
View File
@@ -156,7 +156,6 @@
}
};
/**
This is a module object for use with the emscripten-installed
sqlite3InitModule() factory function.
+3 -3
View File
@@ -174,7 +174,7 @@
globalThis.WhWasmUtilInstaller = function(target){
'use strict';
if(undefined===target.bigIntEnabled){
target.bigIntEnabled = !!self['BigInt64Array'];
target.bigIntEnabled = !!globalThis['BigInt64Array'];
}
/** Throws a new Error, the message of which is the concatenation of
@@ -355,8 +355,8 @@ globalThis.WhWasmUtilInstaller = function(target){
break;
default:
if(target.bigIntEnabled){
if(n===self['BigUint64Array']) return c.HEAP64U;
else if(n===self['BigInt64Array']) return c.HEAP64;
if(n===globalThis['BigUint64Array']) return c.HEAP64U;
else if(n===globalThis['BigInt64Array']) return c.HEAP64;
break;
}
}
+3 -3
View File
@@ -60,9 +60,9 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
memberPrefix = (config.memberPrefix || ""),
memberSuffix = (config.memberSuffix || ""),
bigIntEnabled = (undefined===config.bigIntEnabled
? !!self['BigInt64Array'] : !!config.bigIntEnabled),
BigInt = self['BigInt'],
BigInt64Array = self['BigInt64Array'],
? !!globalThis['BigInt64Array'] : !!config.bigIntEnabled),
BigInt = globalThis['BigInt'],
BigInt64Array = globalThis['BigInt64Array'],
/* Undocumented (on purpose) config options: */
ptrSizeof = config.ptrSizeof || 4,
ptrIR = config.ptrIR || 'i32'
+1 -1
View File
@@ -45,7 +45,7 @@
if(urlParams.has('esm')){
logHtml('warning',"Attempting to run an ES6 Worker Module, "+
"which is not supported by all browsers! "+
"e.g. Firefox (as of 2022-12) cannot do this.");
"e.g. Firefox (as of 2023-05) cannot do this.");
workerArgs.push("tester1.mjs",{type:"module"});
document.querySelectorAll('title,#color-target').forEach((e)=>{
e.innerText = "sqlite3 tester #1: ES6 Worker Module";
+48 -12
View File
@@ -1166,7 +1166,8 @@ self.sqlite3InitModule = sqlite3InitModule;
try{db.checkRc(rc)}
catch(e){ex = e}
T.assert(ex instanceof sqlite3.SQLite3Error)
.assert(0===ex.message.indexOf("sqlite3 result code"))
.assert(capi.SQLITE_MISUSE===ex.resultCode)
.assert(0===ex.message.indexOf("SQLITE_MISUSE: sqlite3 result code"))
.assert(ex.message.indexOf("Invalid SQL")>0);
T.assert(db === db.checkRc(0))
.assert(db === sqlite3.oo1.DB.checkRc(db,0))
@@ -1219,6 +1220,7 @@ self.sqlite3InitModule = sqlite3InitModule;
);
//debug("statement =",st);
this.progressHandlerCount = 0;
let rc;
try {
T.assert(wasm.isPtr(st.pointer))
.mustThrowMatching(()=>st.pointer=1, /read-only/)
@@ -1229,6 +1231,8 @@ self.sqlite3InitModule = sqlite3InitModule;
) === 0)
.assert(!st._mayGet)
.assert('a' === st.getColumnName(0))
.mustThrowMatching(()=>st.columnCount=2,
/columnCount property is read-only/)
.assert(1===st.columnCount)
.assert(0===st.parameterCount)
.mustThrow(()=>st.bind(1,null))
@@ -1264,10 +1268,11 @@ self.sqlite3InitModule = sqlite3InitModule;
assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)).
assert(0!==capi.sqlite3_strlike("%.txt", "foo.xtx", 0));
}finally{
st.finalize();
rc = st.finalize();
}
T.assert(!st.pointer)
.assert(0===this.db.openStatementCount());
.assert(0===this.db.openStatementCount())
.assert(0===rc);
T.mustThrowMatching(()=>new sqlite3.oo1.Stmt("hi"), function(err){
return (err instanceof sqlite3.SQLite3Error)
@@ -1332,8 +1337,8 @@ self.sqlite3InitModule = sqlite3InitModule;
sql:['CREATE TABLE t(a,b);',
// ^^^ using TEMP TABLE breaks the db export test
"INSERT INTO t(a,b) VALUES(1,2),(3,4),",
"(?,?),('blob',X'6869')"/*intentionally missing semicolon to test for
off-by-one bug in string-to-WASM conversion*/],
"(?,?)"/*intentionally missing semicolon to test for
off-by-one bug in string-to-WASM conversion*/],
saveSql: list,
bind: [5,6]
});
@@ -1341,12 +1346,20 @@ self.sqlite3InitModule = sqlite3InitModule;
T.assert(rc === db)
.assert(2 === list.length)
.assert('string'===typeof list[1])
.assert(4===db.changes())
.assert(3===db.changes())
.assert(this.progressHandlerCount > 0,
"Expecting progress callback.")
if(wasm.bigIntEnabled){
T.assert(4n===db.changes(false,true));
T.assert(3n===db.changes(false,true));
}
rc = db.exec({
sql: "INSERT INTO t(a,b) values('blob',X'6869') RETURNING 13",
rowMode: 0
});
T.assert(Array.isArray(rc))
.assert(1===rc.length)
.assert(13 === rc[0])
.assert(1===db.changes());
let vals = db.selectValues('select a from t order by a limit 2');
T.assert( 2 === vals.length )
@@ -1373,10 +1386,10 @@ self.sqlite3InitModule = sqlite3InitModule;
T.assert(
3 === this._myState
/* Recall that "this" is the options object. */
).assert(
this.columnNames===colNames
).assert(
this.columnNames[0]==='a' && this.columnNames[1]==='b'
/* options.columnNames is filled out before the first
Stmt.step(). */
).assert(
(row.a%2 && row.a<6) || 'blob'===row.a
);
@@ -1386,6 +1399,14 @@ self.sqlite3InitModule = sqlite3InitModule;
.assert('a' === colNames[0])
.assert(4 === counter)
.assert(4 === list.length);
colNames = [];
db.exec({
/* Ensure that columnNames is populated for empty result sets. */
sql: "SELECT a a, b B FROM t WHERE 0",
columnNames: colNames
});
T.assert(2===colNames.length)
.assert('a'===colNames[0] && 'B'===colNames[1]);
list.length = 0;
db.exec("SELECT a a, b b FROM t",{
rowMode: 'array',
@@ -1438,11 +1459,14 @@ self.sqlite3InitModule = sqlite3InitModule;
let st = db.prepare("update t set b=:b where a='blob'");
try {
T.assert(0===st.columnCount);
const ndx = st.getParamIndex(':b');
T.assert(1===ndx);
st.bindAsBlob(ndx, "ima blob").reset(true);
st.bindAsBlob(ndx, "ima blob")
/*step() skipped intentionally*/.reset(true);
} finally {
st.finalize();
T.assert(0===st.finalize())
.assert(undefined===st.finalize());
}
try {
@@ -1604,7 +1628,19 @@ self.sqlite3InitModule = sqlite3InitModule;
.assert(3===rc[1].a)
.assert(4===rc[1].b);
})
////////////////////////////////////////////////////////////////////////
.t('selectArray/Object/Values() via INSERT/UPDATE...RETURNING', function(sqlite3){
let rc = this.db.selectObject("INSERT INTO t(a,b) VALUES(83,84) RETURNING a as AA");
T.assert(83===rc.AA);
rc = this.db.selectArray("UPDATE T set a=85 WHERE a=83 RETURNING b as BB");
T.assert(Array.isArray(rc)).assert(84===rc[0]);
//log("select * from t:",this.db.selectObjects("select * from t order by a"));
rc = this.db.selectValues("UPDATE T set a=a*1 RETURNING a");
T.assert(Array.isArray(rc))
.assert(5 === rc.length)
.assert('number'===typeof rc[0])
.assert(rc[0]|0 === rc[0] /* is small integer */);
})
////////////////////////////////////////////////////////////////////////
.t({
name: 'sqlite3_js_db_export()',
+40 -41
View File
@@ -1,5 +1,5 @@
C Version\s3.42.0
D 2023-05-16T12:36:15.536
C Version\s3.42.1
D 2025-08-06T11:05:53.478
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -7,7 +7,7 @@ F Makefile.in 764f2e3e8fb4ae1c8dfe03e65b2b3b01bd1fc57edf78ec2cab3a1301e90e1905
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc ce7bea7931e1ef96b0f44c0362074a8bb62e61a0e7cfdb05afebd928adaacc2b
F README.md e05bd8fcb45da04ab045c37f79a98654e8aa3b3b8f302cfbba80a0d510df75f7
F VERSION 17f95ae2fdf21f0e9575eb0b0511ea63f15d71dfff431b21c2b4adbfa70cfbbf
F VERSION a965e2eadbfaaf0fb67e20b52e49b96a9927b3f4a9b8fc9be228c87aee67e9cf
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
@@ -33,7 +33,7 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034
F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6
F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559
F configure 2f2c090e0a1d051bb53741f0c961f5ebb24507a4f599d686ad6d7ff236144609 x
F configure c57ec9c375edc1443a8cd22efc8bf6186db7ebbab78b184b64f5510f22b2d6e8 x
F configure.ac 4654d32ac0a0d0b48f1e1e79bdc3d777b723cf2f63c33eb1d7c4ed8b435938e8
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
@@ -92,7 +92,7 @@ F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b7292
F ext/fts5/fts5_config.c 051056a9052f5d3a4d1c695f996fd364f920e341f136c60ab2c04aa7e267113f
F ext/fts5/fts5_expr.c 58fb8ceddfb1cefcd54510f9f2f33c220ef9d1b3fa77462111f5ae2a825ab7b1
F ext/fts5/fts5_hash.c d4fb70940359f2120ccd1de7ffe64cc3efe65de9e8995b822cd536ff64c96982
F ext/fts5/fts5_index.c de3cdae2e0056594aad97a728be5c43b6d7a6cdc7e9cc16f197892b2d8689c21
F ext/fts5/fts5_index.c 2c2d778fabfb3e6a876b0c81e3333e0da5e88c638711d9b5b3e9a64270de8053
F ext/fts5/fts5_main.c b4dba04a36aaf9b8e8cef0100b6dbb422cc74753eacc11d6401cac7a87c0f38d
F ext/fts5/fts5_storage.c 76c6085239eb44424004c022e9da17a5ecd5aaec859fba90ad47d3b08f4c8082
F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae
@@ -137,7 +137,7 @@ F ext/fts5/test/fts5corrupt3.test 7da9895dafa404efd20728f66ff4b94399788bdc042c36
F ext/fts5/test/fts5corrupt4.test f4c08e2182a48d8b70975fd869ee5391855c06d8a0ff87b6a2529e7c5a88a1d3
F ext/fts5/test/fts5corrupt5.test 550d0884c14424f9acad051a741f1dd99ec9342277d938e91ff3daf9123d1209
F ext/fts5/test/fts5corrupt6.test bf8eeae07825b088b9665d9d8e4accbd8dc9bf3cb85b6c64cf6c9e18ccc420a4
F ext/fts5/test/fts5corrupt7.test f3e68673af2514e31dd67a2ed163f7f597252ab683dec155b8db0cdc0b668342
F ext/fts5/test/fts5corrupt7.test 80ad7f683a8bda2404731bb77e8c3dbbb620c1f6cc583cca8239f6accd6338c0
F ext/fts5/test/fts5delete.test 619295b20dbc1d840b403ee07c878f52378849c3c02e44f2ee143b3e978a0aa7
F ext/fts5/test/fts5detail.test 54015e9c43ec4ba542cfb93268abdf280e0300f350efd08ee411284b03595cc4
F ext/fts5/test/fts5determin.test 1b77879b2ae818b5b71c859e534ee334dac088b7cf3ff3bf76a2c82b1c788d11
@@ -189,12 +189,12 @@ F ext/fts5/test/fts5rebuild.test 55d6f17715cddbf825680dd6551efbc72ed916d8cf1cde4
F ext/fts5/test/fts5restart.test 835ecc8f449e3919f72509ab58056d0cedca40d1fe04108ccf8ac4c2ba41f415
F ext/fts5/test/fts5rowid.test b8790ec170a8dc1942a15aef3db926a5f3061b1ff171013003d8297203a20ad6
F ext/fts5/test/fts5savepoint.test fc02929f238d02a22df4172625704e029f7c1e0e92e332d654375690f8e6e43f
F ext/fts5/test/fts5secure.test 214a561519d1b1817f146efd1057e2a97cc896e75c2accc77157d874154bda64
F ext/fts5/test/fts5secure.test 833f987e6902a9ab20fabbaa7ca0662c6187fa368cbc7a8082fdf2bf22ee0304
F ext/fts5/test/fts5secure2.test 2e961d7eef939f294c56b5d895cac7f1c3a60b934ee2cfd5e5e620bdf1ba6bbc
F ext/fts5/test/fts5secure3.test c7e1080a6912f2a3ac68f2e05b88b72a99de38543509b2bbf427cac5c9c1c610
F ext/fts5/test/fts5secure3.test 6d066828d225b0dbe5db818d4d6165df7bb70210e68a577e858e8762400d5a23
F ext/fts5/test/fts5secure4.test 0d10a80590c07891478700af7793b232962042677432b9846cf7fc8337b67c97
F ext/fts5/test/fts5secure5.test c07a68ced5951567ac116c22f2d2aafae497e47fe9fcb6a335c22f9c7a4f2c3a
F ext/fts5/test/fts5secure6.test 7a959d834be6725c641b3c3b38ef86570ea671216ad803e054e4fdff33a72ce2
F ext/fts5/test/fts5secure6.test 48995e4a181dbe0a55e384c90b944db11699219bedafec773c93f36ff80d270c
F ext/fts5/test/fts5securefault.test dbca2b6a1c16700017f5051138991b705410889933f2a37c57ae8a23b296b10b
F ext/fts5/test/fts5simple.test a298670508c1458b88ce6030440f26a30673931884eb5f4094ac1773b3ba217b
F ext/fts5/test/fts5simple2.test 258a1b0c590409bfa5271e872c79572b319d2a56554d0585f68f146a0da603f0
@@ -381,7 +381,7 @@ F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a
F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3
F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e
F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49
F ext/recover/recovercorrupt2.test 74bef7dd2d7dd4856f3da21be6e213d27da44827e0f5f0946ca0325b46d163ed
F ext/recover/recovercorrupt2.test 392e4543311e961d4be24b434f1a4171fa8723db64d3094b7648b7652324dbd4
F ext/recover/recoverfault.test 9d9f88eeb222615a25e7514f234c950d46bee20d24cd8db49d8fff8d650dcfe1
F ext/recover/recoverfault2.test 730e7371bcda769554d15460cb23126abba1be8eca9539ccabf63623e7bb7e09
F ext/recover/recoverold.test 68db3d6f85dd2b98e785b6c4da4f5eea4bbe52ccf6674d9a94c7506dc92596aa
@@ -389,7 +389,7 @@ F ext/recover/recoverpgsz.test 3658ab8e68475b1bb87d6af88baa04551c84b73280a566a1b
F ext/recover/recoverrowid.test f948bf4024a5f41b0e21b8af80c60564c5b5d78c05a8d64fc00787715ff9f45f
F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a3a21030057bfd81411
F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486
F ext/recover/sqlite3recover.c b3813090c97df34858bab8ece4e8c49d9e2f56ba2b9bb019f57f44bc234b3c6d
F ext/recover/sqlite3recover.c e6eb20c469bcdb96f297f2241860bccabf9f036bfa7f3d47bcc6ca1191b108dc
F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959
F ext/recover/test_recover.c 1a34e2d04533d919a30ae4d5caeb1643f6684e9ccd7597ca27721d8af81f4ade
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
@@ -473,7 +473,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a
F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795
F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3session.c e50a9218ee360db0a25298adc6614162d80ebe65d3f6a5b0a021e0902f6536a1
F ext/session/sqlite3session.c 85cef207b58ac8ec014394e970ff1d177446523a9f829fce74157bbbdd3e6ebf
F ext/session/sqlite3session.h 653e9d49c4edae231df8a4c8d69c2145195aedb32462d4b44229dbee7d2680fb
F ext/session/test_session.c 5285482f83cd92b4c1fe12fcf88210566a18312f4f2aa110f6399dae46aeccbb
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
@@ -494,7 +494,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b
F ext/wasm/api/pre-js.c-pp.js ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057afb08161d7511219
F ext/wasm/api/sqlite3-api-cleanup.js cc21e3486da748463e02bbe51e2464c6ac136587cdfd5aa00cd0b5385f6ca808
F ext/wasm/api/sqlite3-api-glue.js f1b2dcb944de5138bb5bd9a1559d2e76a4f3ec25260963d709e8237476688803
F ext/wasm/api/sqlite3-api-oo1.js 2691a34a741015127b210954a1b9586764d3ff0c8a20f00fd15c00f339ecc79f
F ext/wasm/api/sqlite3-api-oo1.js d40f38ad5fe94844b618358651e7671e086c2c01835429686cc560c67dc52d92
F ext/wasm/api/sqlite3-api-prologue.js 17f4ec398ba34c5c666fea8e8c4eb82064a35b302f2f2eb355283cd8d3f68ed5
F ext/wasm/api/sqlite3-api-worker1.js 40a5b1813fcbe789f23ae196c833432c8c83e7054d660194ddfc51eab1c5b9bf
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
@@ -508,10 +508,10 @@ F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
F ext/wasm/common/whwasmutil.js 749a1f81f85835e9a384e9706f2a955a7158f2b8cc9da33f41105cac7775a305
F ext/wasm/common/whwasmutil.js 03407d7b61b817fd135c82401987e56688a45ee4d6b9c0eced160c0000d6e4c2
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
@@ -530,7 +530,7 @@ F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
F ext/wasm/index-dist.html 22379774f0ad4edcaaa8cf9c674c82e794cc557719a8addabed74eb8069d412e
F ext/wasm/index.html dd900891844caebd9cadbddd704f66bd841d7c12fd69ce5af490e2c10fb49f45
F ext/wasm/jaccwabyt/jaccwabyt.js 8287c0537fa0750414edbe75ce64668a81c8716df5ec4c3e6bb4f11bd1c36031
F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54
F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb
F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
@@ -544,9 +544,9 @@ F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d826
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html 258d08f1ba9cc2d455958751e26be833893cf9ff7853e9436e593e1f778a386b
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
F ext/wasm/tester1.c-pp.js 587a18db0f794c594eb0fade37c92af3e2370501576bb08dafd8ed7d009b6516
F ext/wasm/tester1.c-pp.js 0c2df45b3bd2f193b862c491f6cc440d2a6f6bd1237d0c2d1f3272ea185f02b8
F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@@ -569,13 +569,13 @@ F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2
F src/alter.c 482c534877fbb543f8295992cde925df55443febac5db5438d5aaba6f78c4940
F src/analyze.c a1f3061af16c99f73aed0362160176c31a6452de1b02ada1d68f6839f2a37df0
F src/analyze.c d4cc28738c29e009640ec20ebb6936ba6fcefff0d11aa93398d9bb9a5ead6c1f
F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39
F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca
F src/btree.c ecaaf8d57cd8b5f4e3167bd59cf61cef031b4b2ee606e6afa11b96a60a14f9ef
F src/btree.c 76290c756bb51c80b6f3f5a27dd41015c692bfb4d042926dc6c08e299a52d9ad
F src/btree.h aa354b9bad4120af71e214666b35132712b8f2ec11869cb2315c52c81fad45cc
F src/btreeInt.h b900603c8956bdeb313841f9b67bdeceef32c64d962d35477c07ec25e8cf0f9b
F src/build.c 7a7217f75f202eff03617ca447bb9c3bc07d5af49da1d3cff2b1a88e8e394686
@@ -585,8 +585,8 @@ F src/ctime.c 20507cc0b0a6c19cd882fcd0eaeda32ae6a4229fb4b024cfdf3183043d9b703d
F src/date.c aca9e0c08b400b21238b609aea7c09585396cd770985cf8f475560f69222dad3
F src/dbpage.c f3eea5f7ec47e09ee7da40f42b25092ecbe961fc59566b8e5f705f34335b2387
F src/dbstat.c ec92074baa61d883de58c945162d9e666c13cd7cf3a23bc38b4d1c4d0b2c2bef
F src/delete.c a9c6d3f51c0a31e9b831e0a0580a98d702904b42d216fee530940e40dec34873
F src/expr.c 941fe758212c6cf0007c6d7daf5368e11c199376ace9b3018494296e18a27eac
F src/delete.c cf07b5585823e3fd4d89e6ff49f6e705bf25b62366e69a5c9f1b23482e005aa3
F src/expr.c 36b9c10c23d519c52ac42a202104e1914d73c57ceb9fc79f96455a7c491d4184
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 03c134cc8bffe54835f742ddea0b72ebfc8f6b32773d175c71b8afeea6cb5c83
F src/func.c 03e6b501f3056d0ba398bda17df938b2b566aa0b3ca7e1942a3cd1925d04ec36
@@ -636,8 +636,8 @@ F src/printf.c b9320cdbeca0b336c3f139fd36dd121e4167dd62b35fbe9ccaa9bab44c0af38d
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 738c3a3d6929f8be66c319bad17f6b297bd60a4eb14006075c48a28487dc7786
F src/shell.c.in 52836b4002a2cad8095b451f0c39a6542c23a231eb0ed5e39387bc8b1f7aaa9e
F src/select.c acb558bb719fc141532ece116fecefeb896e5f4986ed70fbbe1acda4294a4c5f
F src/shell.c.in bac6e64e85f22a6c96b8dc3d7fdf076715fe82f393c828bca4f4ac345748b191
F src/sqlite.h.in c14a4471fcd897a03631ac7ad3d05505e895e7b6419ec5b96cae9bc4df7a9fc6
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
@@ -699,9 +699,9 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b
F src/treeview.c fccf3b8c517c1f55cb380c1522febe6921fcb2bd800c16c78cab571d0eb0ccbd
F src/treeview.c 1d52fbc4e97161e65858d36e3424ea6e3fc045dd8a679c82b4b9593dc30de3bd
F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0
F src/update.c 3f4fb5ad7c9b48d7911974d6579192bb3a6c27f46140b6cbb9139cc8a77b8691
F src/update.c 88f30d38409ddcd2d583bef1a1265a3e8c701e232096505183680b2027439a00
F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c d4bcb560471cd94e6e17d448311f8d5bf81a7e5276295a53501058ef1b95dd1a
@@ -710,9 +710,9 @@ F src/vdbe.c fedd2dfa5165256c8e372f2ae9454c4a82cf60ce79a04dff80a86ab2116ea15a
F src/vdbe.h 637ae853b7d42ae3951034cc63ab7c8af837861f79504cdb5399552fcd89a884
F src/vdbeInt.h a4147a4ddf613cb1bcb555ace9e9e74a9c099d65facd88155f191b1fb4d74cfb
F src/vdbeapi.c b4982cde547054c4f7341198db3c3008a48e1eb028f757601bf5bf2fc026cbcf
F src/vdbeaux.c 6ee48db408d4c297a363f1e31145c09793a580e7c508bb36063dd017d67117a2
F src/vdbeaux.c f247001fd9f4f873121289b27ee367d4f88f46d73b2405dfe3bde96c7e1e9982
F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2ce
F src/vdbemem.c 1cac4028c0dabbf1f3259f107440e2780e05ac9fe419e9709e6eb4e166ba714b
F src/vdbemem.c 710119a8e35e47813681c48703d65a80ba22792192de90bc51dc0d6366f2a79e
F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac
@@ -755,7 +755,7 @@ F test/altertab2.test 62597b6fd08feaba1b6bfe7d31dac6117c67e06dc9ce9c478a3abe75b5
F test/altertab3.test 6c432fbb9963e0bd6549bf1422f6861d744ee5a80cb3298564e81e556481df16
F test/altertrig.test fb5951d21a2c954be3b8a8cf8e10b5c0fa20687c53fd67d63cea88d08dd058d5
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 547bb700f903107b38611b014ca645d6b5bb819f5210d7bf39c40802aafeb7d7
F test/analyze.test 2fb21d7d64748636384e6cb8998dbf83968caf644c07fcb4f76c18f2e7ede94b
F test/analyze3.test 03f4b3d794760cf15da2d85a52df9bae300e51c8fefe9c36cfae1f86dc10d23f
F test/analyze4.test 68bd069f3ac7ac1e652ddd9f04f57d5606ddb4208450f5297005db7aa0dd707d
F test/analyze5.test fa5131952303ac4146aba101b116b9c8cb89e2637531c334a6df7f7d19dddc0d
@@ -883,7 +883,7 @@ F test/conflict2.test 5557909ce683b1073982f5d1b61dfb1d41e369533bfdaf003180c5bc87
F test/conflict3.test 81865d9599609aca394fb3b9cd5f561d4729ea5b176bece3644f6ecb540f88ac
F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4
F test/corrupt.test d7cb0300e4a297147b6a05e92a1684bc8973635c3bcaa3d66e983c9cbdbf47a3
F test/corrupt2.test 6e0c1e1c2ff4bedde4bc73f16250d74ae5b3d9ece086640ce88b9a94620ba993
F test/corrupt2.test 9745c55b3ff2d84d9b6dc4f7365f91a99e70d90f3127ebc97ff0549c418e4d3d
F test/corrupt3.test 6a982535d52c8165654cbc79a043cfd0bf02495a5efbf4754295e056fc548539
F test/corrupt4.test b5ae41607e8d17d9c1f3e94fdb572ce061ed3beeebdb46fb3a348181b8c8a097
F test/corrupt5.test 387be3250795e2a86e6234745558b80efb248a357d0cd8e53bce75c7463f545d
@@ -1502,7 +1502,7 @@ F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8e
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test 300b77328aaafb9f3e7a53a26e4162fbf92181d92251d259ff105a2275ff998d
F test/shell2.test 09a202f57e7cd99788537f763e0845796a173fcea06a0d199a08d69446fe1daf
F test/shell2.test 35226c070a8c7f64fd016dfac2a0db2a40f709b3131f61daacd9dad61536c9cb
F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a
F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f
F test/shell5.test c8b6c54f26ec537f8558273d7ed293ca3725ef42e6b12b8f151718628bd1473b
@@ -1547,7 +1547,7 @@ F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
F test/spellfix4.test 51c7c26514ade169855c66bcf130bd5acfb4d7fd090cc624645ab275ae6a41fb
F test/sqldiff1.test 182058e09c7082de5c6a470ff9c291337bbeb650052c2cc68fbb3d7e25861d91
F test/sqldiff1.test 1b7ab4f312442c5cc6b3a5f299fa8ca051416d1dd173cb1126fd51bf64f2c3fb
F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996fd413ac4
F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a
F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805
@@ -1800,7 +1800,7 @@ F test/upfrom1.tcl 8859d9d437f03b44174c4524a7a734a391fd4526fcff65be08285dafc9dc9
F test/upfrom1.test 8cb06689e99cd707d884faa16da0e8eb26ff658bb01c47ddf72fadade666e6e1
F test/upfrom2.test 66f3ebf721b3cebd922faee5c386bf244f816d416b57c000753ff51af62328a1
F test/upfrom3.test 6130f24ebf97f5ea865e5d2a14a2d543fe5428a62e87cc60f62d875e45c1f5f0
F test/upfrom4.test 1cd82e9423e02b1f63d069e8665c6c3932ec424fd0043d033cc0ba99abf33236
F test/upfrom4.test 78f742a6577c91a7a55c64edb8811004e7c6aa99b8d57b2320f70a918c357807
F test/upfromfault.test 3a10075a0043f0c4fad6614b2c371f88a8ba5a4acab68b907438413865d6a8d6
F test/upsert1.test b0ae2f58680c5205b4bc1cdeed3c3d444057c506f6c44494fa3eac60731d68a2
F test/upsert2.test 720e94d09f7362a282bc69b3c6b83d51daeaaf0440eb4920a08b86518b8c7496
@@ -1914,13 +1914,13 @@ F test/whereM.test 0dbc9998783458ddcf3cc078ca7c2951d8b2677d472ecf0028f449ed327c0
F test/wherefault.test 6cf2a9c5712952d463d3f45ebee7f6caf400984df51a195d884cfb7eb0e837a7
F test/wherelfault.test 9012e4ef5259058b771606616bd007af5d154e64cc25fa9fd4170f6411db44e3
F test/wherelimit.test afb46397c6d7e964e6e294ba3569864a0c570fe3807afc634236c2b752372f31
F test/wherelimit2.test 657a3f24aadee62d058c5091ea682dc4af4b95ffe32f137155be49799a58e721
F test/wherelimit2.test b9e4bfe7b4d7c2f85f99cf2bd2c51369378d04b1f3d1b60557423752003bfd90
F test/widetab1.test c296a98e123762de79917350e45fa33fdf88577a2571eb3a64c8bf7e44ef74d1
F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2aeee74
F test/win32lock.test e0924eb8daac02bf80e9da88930747bd44dd9b230b7759fed927b1655b467c9c
F test/win32longpath.test 4baffc3acb2e5188a5e3a895b2b543ed09e62f7c72d713c1feebf76222fe9976
F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc
F test/window1.test 5ba48e9d33231e6ef16f21426bade9ccc52abf65a10587bff90a6c14fe174594
F test/window1.test 1e7e13d36235b9a08fcb9790f2b05383f2f8c9538532b027f455766686926114
F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476
F test/window2.test e466a88bd626d66edc3d352d7d7e1d5531e0079b549ba44efb029d1fbff9fd3c
F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03
@@ -2034,7 +2034,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd
F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60
F tool/sqldiff.c 4f967c199c5f93eec64978e3a625d6c07fb1162212b1d48f65740d9eb4607eee
F tool/sqldiff.c 2a693b4e7c1818c23f871f82f0c3fe67d80b67e3f087893089d33da29c1e387e
F tool/sqlite3_analyzer.c.in f88615bf33098945e0a42f17733f472083d150b58bdaaa5555a7129d0a51621c
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
@@ -2070,10 +2070,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 4254f086419892634c80b0b915e14edea365adc6a45bcc75eecba889da274ac3
R 5363a07f3e1462ec2f4570a33edb7167
T +sym-release *
T +sym-version-3.42.0 *
P 6f4a6e564b49bed1b31fe698c358c5944c6a1272e6d4fc6f6d98f56051bdba28
R cd3646fd8f662f821a5204ff5a207439
T +sym-version-3.42.1 *
U drh
Z 0ee8e0816fa6ac728bed7565aed4ec35
Z 6c9f85d5eafe7611858216c68008e439
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0
4a8bf3c146c24759709eec55cdb0a9d2153c3a40e6645727c55c0404a99b5b4a
+4 -3
View File
@@ -1849,14 +1849,15 @@ static int loadStatTbl(
decodeIntArray((char*)sqlite3_column_text(pStmt,2),nCol,pSample->anLt,0,0);
decodeIntArray((char*)sqlite3_column_text(pStmt,3),nCol,pSample->anDLt,0,0);
/* Take a copy of the sample. Add two 0x00 bytes the end of the buffer.
/* Take a copy of the sample. Add 8 extra 0x00 bytes the end of the buffer.
** This is in case the sample record is corrupted. In that case, the
** sqlite3VdbeRecordCompare() may read up to two varints past the
** end of the allocated buffer before it realizes it is dealing with
** a corrupt record. Adding the two 0x00 bytes prevents this from causing
** a corrupt record. Or it might try to read a large integer from the
** buffer. In any case, eight 0x00 bytes prevents this from causing
** a buffer overread. */
pSample->n = sqlite3_column_bytes(pStmt, 4);
pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);
pSample->p = sqlite3DbMallocZero(db, pSample->n + 8);
if( pSample->p==0 ){
sqlite3_finalize(pStmt);
return SQLITE_NOMEM_BKPT;
+5 -3
View File
@@ -1634,7 +1634,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
iCellStart = get2byte(&data[hdr+5]);
if( nCell>0 ){
temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
memcpy(&temp[iCellStart], &data[iCellStart], usableSize - iCellStart);
memcpy(temp, data, usableSize);
src = temp;
for(i=0; i<nCell; i++){
u8 *pAddr; /* The i-th cell pointer */
@@ -3338,7 +3338,6 @@ static int lockBtree(BtShared *pBt){
){
goto page1_init_failed;
}
pBt->btsFlags |= BTS_PAGESIZE_FIXED;
assert( (pageSize & 7)==0 );
/* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte
** integer at offset 20 is the number of bytes of space at the end of
@@ -3358,6 +3357,7 @@ static int lockBtree(BtShared *pBt){
releasePageOne(pPage1);
pBt->usableSize = usableSize;
pBt->pageSize = pageSize;
pBt->btsFlags |= BTS_PAGESIZE_FIXED;
freeTempSpace(pBt);
rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,
pageSize-usableSize);
@@ -3377,6 +3377,7 @@ static int lockBtree(BtShared *pBt){
if( usableSize<480 ){
goto page1_init_failed;
}
pBt->btsFlags |= BTS_PAGESIZE_FIXED;
pBt->pageSize = pageSize;
pBt->usableSize = usableSize;
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -10662,7 +10663,7 @@ static int checkTreePage(
if( iPage==0 ) return 0;
if( checkRef(pCheck, iPage) ) return 0;
pCheck->zPfx = "Tree %u page %u: ";
pCheck->v0 = pCheck->v1 = iPage;
pCheck->v1 = iPage;
if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
checkAppendMsg(pCheck,
"unable to get the page. error code=%d", rc);
@@ -10999,6 +11000,7 @@ int sqlite3BtreeIntegrityCheck(
checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0);
}
#endif
sCheck.v0 = aRoot[i];
checkTreePage(&sCheck, aRoot[i], &notUsed, LARGEST_INT64);
}
pBt->db->flags = savedDbFlags;
+1
View File
@@ -35,6 +35,7 @@ Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
pTab = sqlite3LocateTableItem(pParse, 0, pItem);
sqlite3DeleteTable(pParse->db, pItem->pTab);
pItem->pTab = pTab;
pItem->fg.notCte = 1;
if( pTab ){
pTab->nTabRef++;
if( pItem->fg.isIndexedBy && sqlite3IndexedByLookup(pParse, pItem) ){
+3 -2
View File
@@ -2191,7 +2191,7 @@ int sqlite3ExprIdToTrueFalse(Expr *pExpr){
** and 0 if it is FALSE.
*/
int sqlite3ExprTruthValue(const Expr *pExpr){
pExpr = sqlite3ExprSkipCollate((Expr*)pExpr);
pExpr = sqlite3ExprSkipCollateAndLikely((Expr*)pExpr);
assert( pExpr->op==TK_TRUEFALSE );
assert( !ExprHasProperty(pExpr, EP_IntValue) );
assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0
@@ -6413,6 +6413,7 @@ static void findOrCreateAggInfoColumn(
assert( pAggInfo->iFirstReg==0 );
pCol = pAggInfo->aCol;
for(k=0; k<pAggInfo->nColumn; k++, pCol++){
if( pCol->pCExpr==pExpr ) return;
if( pCol->iTable==pExpr->iTable
&& pCol->iColumn==pExpr->iColumn
&& pExpr->op!=TK_IF_NULL_ROW
@@ -6459,7 +6460,7 @@ fix_up_expr:
if( pExpr->op==TK_COLUMN ){
pExpr->op = TK_AGG_COLUMN;
}
pExpr->iAgg = (i16)k;
pExpr->iAgg = (i16)(k&0x7fff);
}
/*
+1 -1
View File
@@ -6534,7 +6534,7 @@ static int aggregateIdxEprRefToColCallback(Walker *pWalker, Expr *pExpr){
pExpr->op = TK_AGG_COLUMN;
pExpr->iTable = pCol->iTable;
pExpr->iColumn = pCol->iColumn;
ExprClearProperty(pExpr, EP_Skip|EP_Collate);
ExprClearProperty(pExpr, EP_Skip|EP_Collate|EP_Unlikely);
return WRC_Prune;
}
+4 -3
View File
@@ -10530,7 +10530,8 @@ static int do_meta_command(char *zLine, ShellState *p){
"with tabcols as materialized(\n"
"select tname, cname\n"
"from ("
" select ss.tname as tname, ti.name as cname\n"
" select printf('\"%%w\"',ss.tname) as tname,"
" printf('\"%%w\"',ti.name) as cname\n"
" from (%z) ss\n inner join pragma_table_info(tname) ti))\n"
"select 'SELECT total(bad_text_count) AS bad_text_count\n"
"FROM ('||group_concat(query, ' UNION ALL ')||')' as btc_query\n"
@@ -12177,7 +12178,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
#ifdef SQLITE_ENABLE_MULTIPLEX
}else if( cli_strcmp(z,"-multiplex")==0 ){
extern int sqlite3_multiple_initialize(const char*,int);
extern int sqlite3_multiplex_initialize(const char*,int);
sqlite3_multiplex_initialize(0, 1);
#endif
}else if( cli_strcmp(z,"-mmap")==0 ){
@@ -12220,7 +12221,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
bail_on_error = 1;
}else if( cli_strcmp(z,"-nonce")==0 ){
free(data.zNonce);
data.zNonce = strdup(argv[++i]);
data.zNonce = strdup(cmdline_option_value(argc, argv, ++i));
}else if( cli_strcmp(z,"-unsafe-testing")==0 ){
ShellSetFlag(&data,SHFLG_TestingMode);
}else if( cli_strcmp(z,"-safe")==0 ){
+2 -1
View File
@@ -643,7 +643,8 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
};
assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
assert( pExpr->pRight );
assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE );
assert( sqlite3ExprSkipCollateAndLikely(pExpr->pRight)->op
== TK_TRUEFALSE );
x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
zUniOp = azOp[x];
break;
+1 -1
View File
@@ -224,7 +224,7 @@ static void updateFromSelect(
assert( pTabList->nSrc>1 );
if( pSrc ){
pSrc->a[0].fg.notCte = 1;
assert( pSrc->a[0].fg.notCte );
pSrc->a[0].iCursor = -1;
pSrc->a[0].pTab->nTabRef--;
pSrc->a[0].pTab = 0;
+9
View File
@@ -4231,6 +4231,15 @@ static int vdbeRecordCompareDebug(
if( d1+(u64)serial_type1+2>(u64)nKey1
&& d1+(u64)sqlite3VdbeSerialTypeLen(serial_type1)>(u64)nKey1
){
if( serial_type1>=1
&& serial_type1<=7
&& d1+(u64)sqlite3VdbeSerialTypeLen(serial_type1)<=(u64)nKey1+8
&& CORRUPT_DB
){
return 1; /* corrupt record not detected by
** sqlite3VdbeRecordCompareWithSkip(). Return true
** to avoid firing the assert() */
}
break;
}
+1
View File
@@ -1431,6 +1431,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
}
pRec->nField = p->iVal+1;
sqlite3VdbeMemSetNull(&pRec->aMem[p->iVal]);
return &pRec->aMem[p->iVal];
}
#else
+19
View File
@@ -377,4 +377,23 @@ do_execsql_test analyze-6.1 {
SELECT tbl FROM sqlite_stat1 WHERE idx IS NULL ORDER BY tbl;
} {SQLiteDemo2 sqliteDemo t1}
# The following caused a small buffer overread in STAT4 processing prior
# to check-in [b99135288b157044].
#
ifcapable stat4 {
reset_db
database_may_be_corrupt
do_execsql_test analyze-7.1 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b INTEGER);
INSERT INTO t1 VALUES(1, 7223372036854775);
INSERT INTO t1 VALUES(2, 7223372036854776);
INSERT INTO t1 VALUES(3, 7223372036854777);
CREATE INDEX i1 ON t1(b);
ANALYZE;
UPDATE sqlite_stat4 SET sample = substr(sample, 0, 4);
ANALYZE sqlite_schema;
SELECT * FROM t1 WHERE b>7223372036854775
} {2 7223372036854776 3 7223372036854777}
}
finish_test
+1 -1
View File
@@ -248,7 +248,7 @@ do_test corrupt2-5.1 {
}
set result
} {{*** in database main ***
Tree 11 page 2 cell 0: 2nd reference to page 10
Tree 2 page 2 cell 0: 2nd reference to page 10
Page 4: never used}}
db2 close
+9
View File
@@ -262,5 +262,14 @@ do_test shell2-1.4.11 {
SELECT count(*) FROM t;}]]
} {0 1}
# Bug from forum post 7cbe081746dd3803
# Keywords as column names were producing an error message.
do_test shell2-1.4.12 {
set res [catchcmd :memory: [string trim {
CREATE TABLE "group"("order" text);
INSERT INTO "group" VALUES ('ABC');
.sha3sum}]]
} {0 ca08bc02b7e95c7df431a3a4b1cc0f8d8743914793473f55b5558e03}
finish_test
+22
View File
@@ -63,4 +63,26 @@ CREATE TABLE t3(a,b,c);
INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333);
DROP TABLE t4;}
db close
forcedelete test.db test2.db
sqlite3 db test.db
do_test sqldiff-2.0 {
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY);
}
db close
sqlite3 db test2.db
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
}
db close
set line "exec $PROG test.db test2.db"
unset -nocomplain ::MSG
catch {eval $line} ::MSG
} {0}
do_test sqldiff-2.1 {
set ::MSG
} {ALTER TABLE t1 ADD COLUMN b;}
finish_test
+26
View File
@@ -127,4 +127,30 @@ do_execsql_test 400 {
1000 - - -
}
# Forum post https://sqlite.org/forum/forumpost/36ff78b2a3
#
ifcapable update_delete_limit {
reset_db
do_execsql_test 500 {
CREATE TABLE t1(abc INT, def INT);
INSERT INTO t1 VALUES(0,0);
INSERT INTO t1 VALUES(0,0);
INSERT INTO t1 VALUES(0,0);
CREATE TABLE dual(dummy TEXT);
INSERT INTO dual(dummy) VALUES('X');
} {}
do_execsql_test 510 {
UPDATE t1
SET (abc, def)=(SELECT x, 123)
FROM dual LEFT JOIN (SELECT 789 AS 'x' FROM dual) AS d2
LIMIT 2
}
do_execsql_test 520 {
SELECT * FROM t1
} {789 123 789 123 0 0}
}
finish_test
+30
View File
@@ -299,5 +299,35 @@ do_test 5.5 {
set ::log
} {ax a bx b cx c dx d ex a}
#-----------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE TABLE t2(x);
INSERT INTO t2(x) VALUES(1),(2),(3),(5),(8),(13);
} {}
do_execsql_test 6.1 {
WITH t2 AS MATERIALIZED (VALUES(5))
DELETE FROM t2 ORDER BY rank()OVER() LIMIT 2;
}
do_execsql_test 6.2 {
SELECT * FROM t2;
} {3 5 8 13}
#-------------------------------------------------------------------------
do_execsql_test 7.0 {
CREATE TABLE t1(a INT); INSERT INTO t1(a) VALUES(0);
} {}
do_execsql_test 7.1 {
WITH t1(b) AS (SELECT * FROM (SELECT * FROM (VALUES(2))))
UPDATE t1 SET a=3 LIMIT 1;
}
do_execsql_test 7.2 {
SELECT * FROM t1;
} {3}
finish_test
+13
View File
@@ -2363,4 +2363,17 @@ do_execsql_test 76.5 {
SELECT (SELECT max(y)+sum(0) OVER ()) FROM t3 LEFT JOIN t4 ON x=y GROUP BY x;
} {100 {} 400}
# 2023-05-23 https://sqlite.org/forum/forumpost/fbfe330a20
#
reset_db
do_execsql_test 77.1 {
CREATE TABLE t1(x INT);
CREATE INDEX t1x ON t1(likely(x));
INSERT INTO t1 VALUES(1),(2),(4),(8);
}
do_execsql_test 77.2 {
SELECT max(~likely(x)) FILTER (WHERE true) FROM t1 INDEXED BY t1x GROUP BY x;
} {-2 -3 -5 -9}
finish_test
+12 -12
View File
@@ -605,18 +605,18 @@ static void diff_one_table(const char *zTab, FILE *out){
strPrintf(&sql, "%sB.%s", zSep, az[i]);
zSep = ", ";
}
strPrintf(&sql, ", 1%s -- changed row\n", nPk==n ? "" : ",");
strPrintf(&sql, ", 1 /* changed row */");
while( az[i] ){
strPrintf(&sql, " A.%s IS NOT B.%s, B.%s%s\n",
az[i], az2[i], az2[i], az2[i+1]==0 ? "" : ",");
strPrintf(&sql, ", A.%s IS NOT B.%s, B.%s",
az[i], az2[i], az2[i]);
i++;
}
while( az2[i] ){
strPrintf(&sql, " B.%s IS NOT NULL, B.%s%s\n",
az2[i], az2[i], az2[i+1]==0 ? "" : ",");
strPrintf(&sql, ", B.%s IS NOT NULL, B.%s",
az2[i], az2[i]);
i++;
}
strPrintf(&sql, " FROM main.%s A, aux.%s B\n", zId, zId);
strPrintf(&sql, "\n FROM main.%s A, aux.%s B\n", zId, zId);
zSep = " WHERE";
for(i=0; i<nPk; i++){
strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]);
@@ -642,12 +642,12 @@ static void diff_one_table(const char *zTab, FILE *out){
strPrintf(&sql, "%sA.%s", zSep, az[i]);
zSep = ", ";
}
strPrintf(&sql, ", 2%s -- deleted row\n", nPk==n ? "" : ",");
strPrintf(&sql, ", 2 /* deleted row */");
while( az2[i] ){
strPrintf(&sql, " NULL, NULL%s\n", i==n2-1 ? "" : ",");
strPrintf(&sql, ", NULL, NULL");
i++;
}
strPrintf(&sql, " FROM main.%s A\n", zId);
strPrintf(&sql, "\n FROM main.%s A\n", zId);
strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM aux.%s B\n", zId);
zSep = " WHERE";
for(i=0; i<nPk; i++){
@@ -660,12 +660,12 @@ static void diff_one_table(const char *zTab, FILE *out){
strPrintf(&sql, "%sB.%s", zSep, az[i]);
zSep = ", ";
}
strPrintf(&sql, ", 3%s -- inserted row\n", nPk==n ? "" : ",");
strPrintf(&sql, ", 3 /* inserted row */");
while( az2[i] ){
strPrintf(&sql, " 1, B.%s%s\n", az2[i], az2[i+1]==0 ? "" : ",");
strPrintf(&sql, ", 1, B.%s", az2[i]);
i++;
}
strPrintf(&sql, " FROM aux.%s B\n", zId);
strPrintf(&sql, "\n FROM aux.%s B\n", zId);
strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM main.%s A\n", zId);
zSep = " WHERE";
for(i=0; i<nPk; i++){