Compare commits

..

1 Commits

Author SHA1 Message Date
drh e653f9dd63 A simpler fix to the problem described by
[forum:/forumpost/d1387c3979c7f557|forum thread d1387c3979c7f557].
See specifically [forum:/forumpost/2d2ddc5b70c31de5|post 2d2ddc5b70c31de5].
This approach is simpler, but it also runs a little slower.

FossilOrigin-Name: 334d22bc70916dfc36fbd2b8e45455b09c7d20d33855ce132797270267ee28fc
2023-02-24 01:37:57 +00:00
116 changed files with 1077 additions and 2984 deletions
+11 -32
View File
@@ -602,35 +602,17 @@ SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
FUZZERSHELL_OPT =
FUZZCHECK_OPT += -I$(TOP)/test
FUZZCHECK_OPT += -I$(TOP)/ext/recover
FUZZCHECK_OPT += \
-DSQLITE_OSS_FUZZ \
-DSQLITE_ENABLE_BYTECODE_VTAB \
-DSQLITE_ENABLE_DBPAGE_VTAB \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_BYTECODE_VTAB \
-DSQLITE_ENABLE_DESERIALIZE \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_MATH_FUNCTIONS \
-DSQLITE_ENABLE_MEMSYS5 \
-DSQLITE_ENABLE_NORMALIZE \
-DSQLITE_ENABLE_OFFSET_SQL_FUNC \
-DSQLITE_ENABLE_PREUPDATE_HOOK \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_SESSION \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
-DSQLITE_ENABLE_STAT4 \
-DSQLITE_ENABLE_STMT_SCANSTATUS \
-DSQLITE_MAX_MEMORY=50000000 \
-DSQLITE_MAX_MMAP_SIZE=0 \
-DSQLITE_OMIT_LOAD_EXTENSION \
-DSQLITE_PRINTF_PRECISION_LIMIT=1000 \
-DSQLITE_PRIVATE=""
FUZZCHECK_OPT += -DSQLITE_OMIT_LOAD_EXTENSION
FUZZCHECK_OPT += -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
FUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS3_PARENTHESIS
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS5
FUZZCHECK_OPT += -DSQLITE_ENABLE_RTREE
FUZZCHECK_OPT += -DSQLITE_ENABLE_GEOPOLY
FUZZCHECK_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
FUZZCHECK_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
FUZZCHECK_SRC += $(TOP)/test/fuzzcheck.c
FUZZCHECK_SRC += $(TOP)/test/ossfuzz.c
FUZZCHECK_SRC += $(TOP)/test/fuzzinvariants.c
@@ -697,9 +679,6 @@ fuzzershell$(TEXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
fuzzcheck$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS)
fuzzcheck-asan$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
$(LTLINK) -o $@ -fsanitize=address $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS)
ossshell$(TEXE): $(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h
$(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \
$(TOP)/test/ossfuzz.c sqlite3.c $(TLIBS)
+1 -31
View File
@@ -1526,7 +1526,7 @@ TESTSRC = \
$(TOP)\ext\fts3\fts3_term.c \
$(TOP)\ext\fts3\fts3_test.c \
$(TOP)\ext\rbu\test_rbu.c \
$(TOP)\ext\session\test_session.c
$(TOP)\ext\session\test_session.c
# Statically linked extensions.
#
@@ -1671,33 +1671,6 @@ FUZZERSHELL_COMPILE_OPTS =
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -I$(TOP)\test -I$(TOP)\ext\recover
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_OSS_FUZZ
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBPAGE_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBSTAT_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DESERIALIZE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS3_PARENTHESIS
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS4
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS5
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_GEOPOLY
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MATH_FUNCTIONS
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_NORMALIZE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_PREUPDATE_HOOK
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_SESSION
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_STMTVTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_STAT4
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_MAX_MEMORY=50000000
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_MAX_MMAP_SIZE=0
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_OMIT_LOAD_EXTENSION
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_PRINTF_PRECISION_LIMIT=1000
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_PRIVATE=""
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_MAX_MEMORY=50000000
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_PRINTF_PRECISION_LIMIT=1000
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_OMIT_LOAD_EXTENSION
@@ -1816,9 +1789,6 @@ dbfuzz.exe: $(TOP)\test\dbfuzz.c $(SQLITE3C) $(SQLITE3H)
fuzzcheck.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) $(FUZZCHECK_OPTS) $(FUZZCHECK_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
fuzzcheck-asan.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) /fsanitize=address $(FUZZCHECK_OPTS) $(FUZZCHECK_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
ossshell.exe: $(OSSSHELL_SRC) $(SQLITE3C) $(SQLITE3H)
$(LTLINK) $(NO_WARN) $(FUZZCHECK_OPTS) $(OSSSHELL_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
+1 -1
View File
@@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
# so that we create the export library with the dll.
#-----------------------------------------------------------------------
AC_INIT([sqlite],[3.42.0])
AC_INIT([sqlite],[3.41.0])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
+3 -5
View File
@@ -2667,18 +2667,16 @@ static int fts3MsrBufferData(
char *pList,
i64 nList
){
if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
if( nList>pMsr->nBuffer ){
char *pNew;
int nNew = nList*2 + FTS3_NODE_PADDING;
pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
pMsr->nBuffer = nList*2;
pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
if( !pNew ) return SQLITE_NOMEM;
pMsr->aBuffer = pNew;
pMsr->nBuffer = nNew;
}
assert( nList>0 );
memcpy(pMsr->aBuffer, pList, nList);
memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
return SQLITE_OK;
}
+3 -5
View File
@@ -163,7 +163,7 @@ static int fts5HighlightCb(
if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
iPos = p->iPos++;
if( p->iRangeEnd>=0 ){
if( p->iRangeEnd>0 ){
if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
}
@@ -175,7 +175,7 @@ static int fts5HighlightCb(
}
if( iPos==p->iter.iEnd ){
if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
fts5HighlightAppend(&rc, p, p->zOpen, -1);
}
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
@@ -186,7 +186,7 @@ static int fts5HighlightCb(
}
}
if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
p->iOff = iEndOff;
if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
@@ -221,7 +221,6 @@ static void fts5HighlightFunction(
memset(&ctx, 0, sizeof(HighlightContext));
ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
ctx.iRangeEnd = -1;
rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
if( ctx.zIn ){
@@ -407,7 +406,6 @@ static void fts5SnippetFunction(
iCol = sqlite3_value_int(apVal[0]);
ctx.zOpen = fts5ValueToText(apVal[1]);
ctx.zClose = fts5ValueToText(apVal[2]);
ctx.iRangeEnd = -1;
zEllips = fts5ValueToText(apVal[3]);
nToken = sqlite3_value_int(apVal[4]);
-30
View File
@@ -193,34 +193,4 @@ do_execsql_test 5.6 {
} ;# foreach_detail_mode
reset_db
do_execsql_test 6.0 {
CREATE VIRTUAL TABLE t1 USING fts5(colA, colB);
INSERT INTO t1 VALUES('A B C', 'D E F');
}
do_execsql_test 6.1 {
SELECT colA, colB, snippet(t1,0,'[', ']','...',1) FROM t1 WHERE t1 MATCH 'B';
} {{A B C} {D E F} ...[B]...}
breakpoint
do_execsql_test 6.2 {
SELECT colA, colB, snippet(t1, 1,'[',']','...',2) FROM t1 WHERE t1 MATCH 'B';
} {{A B C} {D E F} {D E...}}
do_execsql_test 6.3 {
SELECT colA, colB, snippet(t1, 1,'[',']','...',1) FROM t1 WHERE t1 MATCH 'B';
} {{A B C} {D E F} {D...}}
do_execsql_test 6.1 {
SELECT colA, colB, snippet(t1,0,'[', ']','...',1) FROM t1 WHERE t1 MATCH 'A';
} {{A B C} {D E F} [A]...}
breakpoint
do_execsql_test 6.2 {
SELECT colA, colB, snippet(t1, 1,'[',']','...',2) FROM t1 WHERE t1 MATCH 'A';
} {{A B C} {D E F} {D E...}}
do_execsql_test 6.3 {
SELECT colA, colB, snippet(t1, 1,'[',']','...',1) FROM t1 WHERE t1 MATCH 'A';
} {{A B C} {D E F} {D...}}
finish_test
+5 -10
View File
@@ -512,14 +512,10 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
if( rc!=SQLITE_OK ) return rc;
if( pCsr->aPage && pCsr->nPage>=256 ) break;
sqlite3_free(pCsr->aPage);
pCsr->aPage = 0;
if( pCsr->aPage ) break;
if( pCsr->bOnePage ) return SQLITE_OK;
pCsr->iPgno++;
}
assert( iOff+3+2<=pCsr->nPage );
pCsr->iCell = pTab->bPtr ? -2 : 0;
pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
}
@@ -754,7 +750,8 @@ static int dbdataGetEncoding(DbdataCursor *pCsr){
int nPg1 = 0;
u8 *aPg1 = 0;
rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
if( rc==SQLITE_OK && nPg1>=(56+4) ){
assert( rc!=SQLITE_OK || nPg1==0 || nPg1>=512 );
if( rc==SQLITE_OK && nPg1>0 ){
pCsr->enc = get_uint32(&aPg1[56]);
}
sqlite3_free(aPg1);
@@ -812,6 +809,8 @@ static int dbdataFilter(
}
if( rc==SQLITE_OK ){
rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
}else{
pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
}
/* Try to determine the encoding of the db by inspecting the header
@@ -820,10 +819,6 @@ static int dbdataFilter(
rc = dbdataGetEncoding(pCsr);
}
if( rc!=SQLITE_OK ){
pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
}
if( rc==SQLITE_OK ){
rc = dbdataNext(pCursor);
}
-42
View File
@@ -1,42 +0,0 @@
# 2023 February 28
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
source [file join [file dirname [info script]] recover_common.tcl]
set testprefix recoverbuild
# The following tests verify that if the recovery extension is used with
# a build that does not support the sqlite_dbpage table, the error message
# is "no such table: sqlite_dbpage", and not something more generic.
#
reset_db
create_null_module db sqlite_dbpage
do_execsql_test 1.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
INSERT INTO t1 VALUES(123, 'one hundred and twenty three');
}
forcedelete test.db2
do_test 1.1 {
set R [sqlite3_recover_init db main test.db2]
} {sqlite_recover1}
do_test 1.2 {
$R run
} {1}
do_test 1.3 {
list [catch { $R finish } msg] $msg
} {1 {no such table: sqlite_dbpage}}
finish_test
-2
View File
@@ -104,7 +104,6 @@ do_eqp_test rtree6.2.4.1 {
} {
QUERY PLAN
|--SCAN t1 VIRTUAL TABLE INDEX 2:C0E1
|--BLOOM FILTER ON t2 (v=?)
`--SEARCH t2 USING AUTOMATIC COVERING INDEX (v=?)
}
do_eqp_test rtree6.2.4.2 {
@@ -112,7 +111,6 @@ do_eqp_test rtree6.2.4.2 {
} {
QUERY PLAN
|--SCAN t1 VIRTUAL TABLE INDEX 2:C0E1
|--BLOOM FILTER ON t2 (v=?)
`--SEARCH t2 USING AUTOMATIC PARTIAL COVERING INDEX (v=?)
}
+2 -2
View File
@@ -191,7 +191,7 @@ do_common_sql {
}
foreach {tn sql} [string map {%T1% t1 %T2% t2 %T3% t3 %T4% t4} $set_of_tests] {
do_then_apply_sql -ignorenoop $sql
do_then_apply_sql $sql
do_test 2.$tn { compare_db db db2 } {}
}
@@ -598,7 +598,7 @@ do_common_sql {
INSERT INTO t1 SELECT NULL, 0, 0, 0, 0, 0 FROM s
}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET f=f+1 WHERE a=1;
UPDATE t1 SET e=e+1 WHERE a=2;
UPDATE t1 SET e=e+1, f=f+1 WHERE a=3;
+9 -9
View File
@@ -34,7 +34,7 @@ do_test 1.0 {
INSERT INTO t1 VALUES(2, 'two');
INSERT INTO t1 VALUES(3, 'three');
}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
DELETE FROM t1 WHERE a=1;
INSERT INTO t1 VALUES(4, 'one');
}
@@ -42,7 +42,7 @@ do_test 1.0 {
} {}
do_test 1.1 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
DELETE FROM t1 WHERE a=4;
INSERT INTO t1 VALUES(1, 'one');
}
@@ -51,7 +51,7 @@ do_test 1.1 {
do_test 1.2 {
execsql { INSERT INTO t1 VALUES(5, 'five') } db2
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t1 VALUES(11, 'eleven');
INSERT INTO t1 VALUES(12, 'five');
}
@@ -82,7 +82,7 @@ do_test 2.2.1 {
# It is not possible to apply the changeset generated by the following
# SQL, as none of the three updated rows may be updated as part of the
# first pass.
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET b=0 WHERE a=1;
UPDATE t1 SET b=1 WHERE a=2;
UPDATE t1 SET b=2 WHERE a=3;
@@ -109,7 +109,7 @@ do_test 3.1 {
} {}
do_test 3.3 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET b=4 WHERE a=3;
UPDATE t1 SET b=3 WHERE a=2;
UPDATE t1 SET b=2 WHERE a=1;
@@ -118,7 +118,7 @@ do_test 3.3 {
} {}
do_test 3.4 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET b=1 WHERE a=1;
UPDATE t1 SET b=2 WHERE a=2;
UPDATE t1 SET b=3 WHERE a=3;
@@ -148,7 +148,7 @@ do_test 4.1 {
} {}
do_test 4.2 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET b=4 WHERE a=3;
UPDATE t1 SET b=3 WHERE a=2;
UPDATE t1 SET b=2 WHERE a=1;
@@ -161,7 +161,7 @@ do_test 4.2 {
} {}
do_test 4.3 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t1 SET b=1 WHERE a=1;
UPDATE t1 SET b=2 WHERE a=2;
UPDATE t1 SET b=3 WHERE a=3;
@@ -191,7 +191,7 @@ do_execsql_test -db db2 5.0.2 {
}
do_test 5.1 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t1 VALUES(1, 2, 3);
INSERT INTO t2 VALUES(4, 5, 6);
INSERT INTO t3 VALUES(7, 8, 9);
+1 -1
View File
@@ -25,7 +25,7 @@ do_test 1.0 {
do_common_sql {
CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b));
}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
WITH s(i) AS (
VALUES(1) UNION ALL SELECT i+1 FROM s WHERe i<10000
)
+4 -36
View File
@@ -112,52 +112,20 @@ proc patchset_from_sql {sql {dbname main}} {
return $patchset
}
# Usage: do_then_apply_sql ?-ignorenoop? SQL ?DBNAME?
#
proc do_then_apply_sql {args} {
set bIgnoreNoop 0
set a1 [lindex $args 0]
if {[string length $a1]>1 && [string first $a1 -ignorenoop]==0} {
set bIgnoreNoop 1
set args [lrange $args 1 end]
}
if {[llength $args]!=1 && [llength $args]!=2} {
error "usage: do_then_apply_sql ?-ignorenoop? SQL ?DBNAME?"
}
set sql [lindex $args 0]
if {[llength $args]==1} {
set dbname main
} else {
set dbname [lindex $args 1]
}
set ::n_conflict 0
proc xConflict args { incr ::n_conflict ; return "OMIT" }
proc do_then_apply_sql {sql {dbname main}} {
proc xConflict args { return "OMIT" }
set rc [catch {
sqlite3session S db $dbname
db eval "SELECT name FROM $dbname.sqlite_master WHERE type = 'table'" {
S attach $name
}
db eval $sql
set ::changeset [S changeset]
sqlite3changeset_apply db2 $::changeset xConflict
sqlite3changeset_apply db2 [S changeset] xConflict
} msg]
catch { S delete }
if {$rc} {error $msg}
if {$bIgnoreNoop} {
set nSave $::n_conflict
set ::n_conflict 0
proc xConflict args { incr ::n_conflict ; return "OMIT" }
sqlite3changeset_apply_v2 -ignorenoop db2 $::changeset xConflict
if {$::n_conflict!=$nSave} {
error "-ignorenoop problem ($::n_conflict $nSave)..."
}
}
if {$rc} {error $msg}
}
proc do_iterator_test {tn tbl_list sql res} {
+6 -6
View File
@@ -110,7 +110,7 @@ eval [string map [list %WR% $trailing] {
CREATE TABLE t3(a, b, c DEFAULT 'D', PRIMARY KEY(b)) %WR%;
}
do_test $tn.3.2 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t3 VALUES(1, 2);
INSERT INTO t3 VALUES(3, 4);
INSERT INTO t3 VALUES(5, 6);
@@ -118,7 +118,7 @@ eval [string map [list %WR% $trailing] {
db2 eval {SELECT * FROM t3}
} {1 2 D 3 4 D 5 6 D}
do_test $tn.3.3 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t3 SET a=45 WHERE b=4;
DELETE FROM t3 WHERE a=5;
};
@@ -253,7 +253,7 @@ eval [string map [list %WR% $trailing] {
CREATE TABLE t8(a PRIMARY KEY, b, c, d DEFAULT 'D', e DEFAULT 'E');
}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t8 VALUES(1, 2, 3);
INSERT INTO t8 VALUES(4, 5, 6);
}
@@ -264,7 +264,7 @@ eval [string map [list %WR% $trailing] {
SELECT * FROM t8
} {1 2 3 D E 4 5 6 D E}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t8 SET c=45 WHERE a=4;
}
do_execsql_test $tn.7.3.1 {
@@ -282,7 +282,7 @@ eval [string map [list %WR% $trailing] {
do_execsql_test -db db2 $tn.8.1 {
CREATE TABLE t9(a PRIMARY KEY, b, c, d, e, f, g, h, i, j, k, l);
}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t9 VALUES(1, 2, 3, 4, 5, 6, 7, 8);
}
do_then_apply_sql {
@@ -291,7 +291,7 @@ eval [string map [list %WR% $trailing] {
do_execsql_test -db db2 $tn.8.2 {
SELECT * FROM t9
} {1 2 3 4 5 6 7 450 {} {} {} {}}
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
UPDATE t9 SET h=NULL
}
do_execsql_test -db db2 $tn.8.2 {
+2 -2
View File
@@ -43,7 +43,7 @@ do_execsql_test -db db2 1.1 {
}
do_test 1.2 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
@@ -71,7 +71,7 @@ do_test 1.3 {
do_test 1.4 {
set rc [catch {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
INSERT INTO t1(b) VALUES( zeroblob(100*1000*1000) );
+1 -1
View File
@@ -44,7 +44,7 @@ do_faultsim_test 1.1 -faults oom-* -prep {
faultsim_restore_and_reopen
sqlite3 db2 test.db2
} -body {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO t1 VALUES('a string value', 8, 9);
UPDATE t1 SET c = 10 WHERE a = 1;
DELETE FROM t1 WHERE a = 4;
+1 -1
View File
@@ -132,7 +132,7 @@ do_faultsim_test 1.1 -faults oom-* -prep {
faultsim_restore_and_reopen
sqlite3 db2 test.db2
} -body {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
INSERT INTO sqlite_stat1 VALUES('x', 'y', 45);
UPDATE sqlite_stat1 SET stat = 123 WHERE tbl='t1' AND idx='i1';
UPDATE sqlite_stat1 SET stat = 456 WHERE tbl='t2';
-180
View File
@@ -1,180 +0,0 @@
# 2011 March 07
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
if {![info exists testdir]} {
set testdir [file join [file dirname [info script]] .. .. test]
}
source [file join [file dirname [info script]] session_common.tcl]
source $testdir/tester.tcl
ifcapable !session {finish_test; return}
set testprefix sessionnoop
foreach {tn wo} {
1 ""
2 " WITHOUT ROWID "
} {
reset_db
eval [string map [list %WO% $wo] {
do_execsql_test $tn.1.0 {
CREATE TABLE t1(a PRIMARY KEY, b, c) %WO%;
INSERT INTO t1 VALUES('a', 'A', 'AAA');
INSERT INTO t1 VALUES('b', 'B', 'BBB');
INSERT INTO t1 VALUES('c', 'C', 'CCC');
INSERT INTO t1 VALUES('d', 'D', 'DDD');
INSERT INTO t1 VALUES('e', 'E', 'EEE');
}
forcedelete test.db2
sqlite3 db2 test.db2
do_execsql_test -db db2 $tn.1.1 {
CREATE TABLE t1(a PRIMARY KEY, b, c) %WO%;
INSERT INTO t1 VALUES('a', 'A', 'AAA');
INSERT INTO t1 VALUES('b', 'B', '123');
INSERT INTO t1 VALUES('c', 'C', 'CCC');
INSERT INTO t1 VALUES('e', 'E', 'EEE');
INSERT INTO t1 VALUES('f', 'F', 'FFF');
}
set C [changeset_from_sql {
UPDATE t1 SET c='123' WHERE a='b';
DELETE FROM t1 WHERE a='d';
INSERT INTO t1 VALUES('f', 'F', 'FFF');
}]
set ::conflict_list [list]
proc xConflict {args} {
lappend ::conflict_list $args
return "OMIT"
}
do_test $tn.1.2 {
sqlite3changeset_apply_v2 db2 $C xConflict
set ::conflict_list
} [list {*}{
{UPDATE t1 DATA {t b {} {} t BBB} {{} {} {} {} t 123} {t b t B t 123}}
{INSERT t1 CONFLICT {t f t F t FFF} {t f t F t FFF}}
{DELETE t1 NOTFOUND {t d t D t DDD}}
}]
do_test $tn.1.3 {
set ::conflict_list [list]
sqlite3changeset_apply_v2 db2 $C xConflict
set ::conflict_list
} [list {*}{
{UPDATE t1 DATA {t b {} {} t BBB} {{} {} {} {} t 123} {t b t B t 123}}
{INSERT t1 CONFLICT {t f t F t FFF} {t f t F t FFF}}
{DELETE t1 NOTFOUND {t d t D t DDD}}
}]
do_test $tn.1.4 {
set ::conflict_list [list]
sqlite3changeset_apply_v2 -ignorenoop db2 $C xConflict
set ::conflict_list
} {}
do_execsql_test -db db2 1.5 {
UPDATE t1 SET b='G' WHERE a='f';
UPDATE t1 SET c='456' WHERE a='b';
}
do_test $tn.1.6 {
set ::conflict_list [list]
sqlite3changeset_apply_v2 -ignorenoop db2 $C xConflict
set ::conflict_list
} [list {*}{
{UPDATE t1 DATA {t b {} {} t BBB} {{} {} {} {} t 123} {t b t B t 456}}
{INSERT t1 CONFLICT {t f t F t FFF} {t f t G t FFF}}
}]
db2 close
#--------------------------------------------------------------------------
reset_db
forcedelete test.db2
sqlite3 db2 test.db2
do_execsql_test $tn.2.0 {
CREATE TABLE t1(a PRIMARY KEY, b) %WO%;
}
do_execsql_test -db db2 $tn.2.1 {
CREATE TABLE t1(a PRIMARY KEY, b, c DEFAULT 'val') %WO%;
}
do_test $tn.2.2 {
do_then_apply_sql -ignorenoop {
INSERT INTO t1 VALUES(1, 2);
}
do_then_apply_sql -ignorenoop {
UPDATE t1 SET b=2 WHERE a=1
}
} {}
}]
}
db2 close
#-------------------------------------------------------------------------
reset_db
forcedelete test.db2
do_execsql_test 3.0 {
CREATE TABLE xyz(a, b, c, PRIMARY KEY(a, b), UNIQUE(c));
ANALYZE;
WITH s(i) AS (
VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100
)
INSERT INTO xyz SELECT i, i, i FROM s;
VACUUM INTO 'test.db2';
}
set C [changeset_from_sql { ANALYZE }]
sqlite3 db2 test.db2
set ::conflict_list [list]
proc xConflict {args} { lappend ::conflict_list $args ; return "OMIT" }
do_test 3.1 {
sqlite3changeset_apply_v2 db2 $C xConflict
set ::conflict_list
} {}
do_test 3.2 {
sqlite3changeset_apply_v2 -ignorenoop db2 $C xConflict
set ::conflict_list
} {}
do_test 3.3 {
sqlite3changeset_apply_v2 db2 $C xConflict
set ::conflict_list
} [list {*}{
{INSERT sqlite_stat1 CONFLICT {t xyz t sqlite_autoindex_xyz_1 t {100 1 1}} {t xyz t sqlite_autoindex_xyz_1 t {100 1 1}}}
{INSERT sqlite_stat1 CONFLICT {t xyz t sqlite_autoindex_xyz_2 t {100 1}} {t xyz t sqlite_autoindex_xyz_2 t {100 1}}}
}]
do_execsql_test -db db2 3.4 {
UPDATE sqlite_stat1 SET stat='200 1 1' WHERE idx='sqlite_autoindex_xyz_1';
}
do_test 3.5 {
set ::conflict_list [list]
sqlite3changeset_apply_v2 -ignorenoop db2 $C xConflict
set ::conflict_list
} [list {*}{
{INSERT sqlite_stat1 CONFLICT {t xyz t sqlite_autoindex_xyz_1 t {100 1 1}} {t xyz t sqlite_autoindex_xyz_1 t {200 1 1}}}
}]
finish_test
+6 -6
View File
@@ -82,7 +82,7 @@ do_test 2.0 {
} {}
do_test 2.1 {
do_then_apply_sql -ignorenoop {
do_then_apply_sql {
WITH s(i) AS (
SELECT 0 UNION ALL SELECT i+1 FROM s WHERE (i+1)<32
)
@@ -100,7 +100,7 @@ do_execsql_test -db db2 2.2 {
}
do_test 2.3 {
do_then_apply_sql -ignorenoop { DROP INDEX t1c }
do_then_apply_sql { DROP INDEX t1c }
} {}
do_execsql_test -db db2 2.4 {
@@ -111,7 +111,7 @@ do_execsql_test -db db2 2.4 {
}
do_test 2.3 {
do_then_apply_sql -ignorenoop { DROP TABLE t1 }
do_then_apply_sql { DROP TABLE t1 }
} {}
do_execsql_test -db db2 2.4 {
@@ -153,16 +153,16 @@ do_execsql_test 3.2 {
} {t1 null 4}
do_test 3.3 {
execsql { DELETE FROM sqlite_stat1 }
do_then_apply_sql -ignorenoop { ANALYZE }
do_then_apply_sql { ANALYZE }
execsql { SELECT * FROM sqlite_stat1 } db2
} {t1 null 4}
do_test 3.4 {
execsql { INSERT INTO t1 VALUES(5,5,5) }
do_then_apply_sql -ignorenoop { ANALYZE }
do_then_apply_sql { ANALYZE }
execsql { SELECT * FROM sqlite_stat1 } db2
} {t1 null 5}
do_test 3.5 {
do_then_apply_sql -ignorenoop { DROP TABLE t1 }
do_then_apply_sql { DROP TABLE t1 }
execsql { SELECT * FROM sqlite_stat1 } db2
} {}
+16 -115
View File
@@ -2113,10 +2113,9 @@ static void sessionAppendStr(
int *pRc
){
int nStr = sqlite3Strlen30(zStr);
if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
if( 0==sessionBufferGrow(p, nStr, pRc) ){
memcpy(&p->aBuf[p->nBuf], zStr, nStr);
p->nBuf += nStr;
p->aBuf[p->nBuf] = 0x00;
}
}
@@ -2138,27 +2137,6 @@ static void sessionAppendInteger(
sessionAppendStr(p, aBuf, pRc);
}
static void sessionAppendPrintf(
SessionBuffer *p, /* Buffer to append to */
int *pRc,
const char *zFmt,
...
){
if( *pRc==SQLITE_OK ){
char *zApp = 0;
va_list ap;
va_start(ap, zFmt);
zApp = sqlite3_vmprintf(zFmt, ap);
if( zApp==0 ){
*pRc = SQLITE_NOMEM;
}else{
sessionAppendStr(p, zApp, pRc);
}
va_end(ap);
sqlite3_free(zApp);
}
}
/*
** This function is a no-op if *pRc is other than SQLITE_OK when it is
** called. Otherwise, append the string zStr enclosed in quotes (") and
@@ -2173,7 +2151,7 @@ static void sessionAppendIdent(
const char *zStr, /* String to quote, escape and append */
int *pRc /* IN/OUT: Error code */
){
int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
if( 0==sessionBufferGrow(p, nStr, pRc) ){
char *zOut = (char *)&p->aBuf[p->nBuf];
const char *zIn = zStr;
@@ -2184,7 +2162,6 @@ static void sessionAppendIdent(
}
*zOut++ = '"';
p->nBuf = (int)((u8 *)zOut - p->aBuf);
p->aBuf[p->nBuf] = 0x00;
}
}
@@ -2409,17 +2386,10 @@ static int sessionAppendDelete(
** Formulate and prepare a SELECT statement to retrieve a row from table
** zTab in database zDb based on its primary key. i.e.
**
** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...)
**
** where <noop-test> is:
**
** 1 AND (?A OR ?1 IS <column>) AND ...
**
** for each non-pk <column>.
** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
*/
static int sessionSelectStmt(
sqlite3 *db, /* Database handle */
int bIgnoreNoop,
const char *zDb, /* Database name */
const char *zTab, /* Table name */
int nCol, /* Number of columns in table */
@@ -2429,51 +2399,8 @@ static int sessionSelectStmt(
){
int rc = SQLITE_OK;
char *zSql = 0;
const char *zSep = "";
const char *zCols = "*";
int nSql = -1;
int i;
SessionBuffer nooptest = {0, 0, 0};
SessionBuffer pkfield = {0, 0, 0};
SessionBuffer pkvar = {0, 0, 0};
sessionAppendStr(&nooptest, ", 1", &rc);
if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc);
sessionAppendStr(&pkfield, "tbl, idx", &rc);
sessionAppendStr(&pkvar,
"?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
);
zCols = "tbl, ?2, stat";
}else{
for(i=0; i<nCol; i++){
if( abPK[i] ){
sessionAppendStr(&pkfield, zSep, &rc);
sessionAppendStr(&pkvar, zSep, &rc);
zSep = ", ";
sessionAppendIdent(&pkfield, azCol[i], &rc);
sessionAppendPrintf(&pkvar, &rc, "?%d", i+1);
}else{
sessionAppendPrintf(&nooptest, &rc,
" AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i]
);
}
}
}
if( rc==SQLITE_OK ){
zSql = sqlite3_mprintf(
"SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
);
if( zSql==0 ) rc = SQLITE_NOMEM;
}
#if 0
if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
zSql = sqlite3_mprintf(
"SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
@@ -2481,6 +2408,7 @@ static int sessionSelectStmt(
);
if( zSql==0 ) rc = SQLITE_NOMEM;
}else{
int i;
const char *zSep = "";
SessionBuffer buf = {0, 0, 0};
@@ -2501,15 +2429,11 @@ static int sessionSelectStmt(
zSql = (char*)buf.aBuf;
nSql = buf.nBuf;
}
#endif
if( rc==SQLITE_OK ){
rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
}
sqlite3_free(zSql);
sqlite3_free(nooptest.aBuf);
sqlite3_free(pkfield.aBuf);
sqlite3_free(pkvar.aBuf);
return rc;
}
@@ -2669,8 +2593,7 @@ static int sessionGenerateChangeset(
/* Build and compile a statement to execute: */
if( rc==SQLITE_OK ){
rc = sessionSelectStmt(
db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
);
db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
}
nNoop = buf.nBuf;
@@ -3859,7 +3782,6 @@ struct SessionApplyCtx {
SessionBuffer rebase; /* Rebase information (if any) here */
u8 bRebaseStarted; /* If table header is already in rebase */
u8 bRebase; /* True to collect rebase information */
u8 bIgnoreNoop; /* True to ignore no-op conflicts */
};
/* Number of prepared UPDATE statements to cache. */
@@ -4110,9 +4032,8 @@ static int sessionSelectRow(
const char *zTab, /* Table name */
SessionApplyCtx *p /* Session changeset-apply context */
){
return sessionSelectStmt(db, p->bIgnoreNoop,
"main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect
);
return sessionSelectStmt(
db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
}
/*
@@ -4271,33 +4192,20 @@ static int sessionBindRow(
*/
static int sessionSeekToRow(
sqlite3_changeset_iter *pIter, /* Changeset iterator */
SessionApplyCtx *p
u8 *abPK, /* Primary key flags array */
sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
){
sqlite3_stmt *pSelect = p->pSelect;
int rc; /* Return code */
int nCol; /* Number of columns in table */
int op; /* Changset operation (SQLITE_UPDATE etc.) */
const char *zDummy; /* Unused */
sqlite3_clear_bindings(pSelect);
sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
rc = sessionBindRow(pIter,
op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
nCol, p->abPK, pSelect
nCol, abPK, pSelect
);
if( op!=SQLITE_DELETE && p->bIgnoreNoop ){
int ii;
for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){
if( p->abPK[ii]==0 ){
sqlite3_value *pVal = 0;
sqlite3changeset_new(pIter, ii, &pVal);
sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0));
if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal);
}
}
}
if( rc==SQLITE_OK ){
rc = sqlite3_step(pSelect);
if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
@@ -4412,22 +4320,16 @@ static int sessionConflictHandler(
/* Bind the new.* PRIMARY KEY values to the SELECT statement. */
if( pbReplace ){
rc = sessionSeekToRow(pIter, p);
rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
}else{
rc = SQLITE_OK;
}
if( rc==SQLITE_ROW ){
/* There exists another row with the new.* primary key. */
if( p->bIgnoreNoop
&& sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1)
){
res = SQLITE_CHANGESET_OMIT;
}else{
pIter->pConflict = p->pSelect;
res = xConflict(pCtx, eType, pIter);
pIter->pConflict = 0;
}
pIter->pConflict = p->pSelect;
res = xConflict(pCtx, eType, pIter);
pIter->pConflict = 0;
rc = sqlite3_reset(p->pSelect);
}else if( rc==SQLITE_OK ){
if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
@@ -4535,7 +4437,7 @@ static int sessionApplyOneOp(
sqlite3_step(p->pDelete);
rc = sqlite3_reset(p->pDelete);
if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
rc = sessionConflictHandler(
SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
);
@@ -4592,7 +4494,7 @@ static int sessionApplyOneOp(
/* Check if there is a conflicting row. For sqlite_stat1, this needs
** to be done using a SELECT, as there is no PRIMARY KEY in the
** database schema to throw an exception if a duplicate is inserted. */
rc = sessionSeekToRow(pIter, p);
rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
if( rc==SQLITE_ROW ){
rc = SQLITE_CONSTRAINT;
sqlite3_reset(p->pSelect);
@@ -4769,7 +4671,6 @@ static int sessionChangesetApply(
memset(&sApply, 0, sizeof(sApply));
sApply.bRebase = (ppRebase && pnRebase);
sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
sqlite3_mutex_enter(sqlite3_db_mutex(db));
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
-14
View File
@@ -1243,23 +1243,9 @@ int sqlite3changeset_apply_v2(
** Invert the changeset before applying it. This is equivalent to inverting
** a changeset using sqlite3changeset_invert() before applying it. It is
** an error to specify this flag with a patchset.
**
** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
** Do not invoke the conflict handler callback for any changes that
** would not actually modify the database even if they were applied.
** Specifically, this means that the conflict handler is not invoked
** for:
** <ul>
** <li>a delete change if the row being deleted cannot be found,
** <li>an update change if the modified fields are already set to
** their new values in the conflicting row, or
** <li>an insert change if all fields of the conflicting row match
** the row being inserted.
** </ul>
*/
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
/*
** CAPI3REF: Constants Passed To The Conflict Handler
+12 -11
View File
@@ -793,31 +793,32 @@ static int SQLITE_TCLAPI testSqlite3changesetApply(
memset(&sStr, 0, sizeof(sStr));
sStr.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR);
/* Check for the -nosavepoint, -invert or -ignorenoop switches */
/* Check for the -nosavepoint flag */
if( bV2 ){
while( objc>1 ){
if( objc>1 ){
const char *z1 = Tcl_GetString(objv[1]);
int n = strlen(z1);
if( n>1 && n<=12 && 0==sqlite3_strnicmp("-nosavepoint", z1, n) ){
flags |= SQLITE_CHANGESETAPPLY_NOSAVEPOINT;
objc--;
objv++;
}
else if( n>2 && n<=7 && 0==sqlite3_strnicmp("-invert", z1, n) ){
}
if( objc>1 ){
const char *z1 = Tcl_GetString(objv[1]);
int n = strlen(z1);
if( n>1 && n<=7 && 0==sqlite3_strnicmp("-invert", z1, n) ){
flags |= SQLITE_CHANGESETAPPLY_INVERT;
objc--;
objv++;
}
else if( n>2 && n<=11 && 0==sqlite3_strnicmp("-ignorenoop", z1, n) ){
flags |= SQLITE_CHANGESETAPPLY_IGNORENOOP;
}else{
break;
}
objc--;
objv++;
}
}
if( objc!=4 && objc!=5 ){
const char *zMsg;
if( bV2 ){
zMsg = "?-nosavepoint? ?-inverse? ?-ignorenoop? "
zMsg = "?-nosavepoint? ?-inverse? "
"DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?";
}else{
zMsg = "DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?";
+40 -129
View File
@@ -44,7 +44,7 @@
# 1) Consolidate the code generation for sqlite3*.*js into a script
# which generates the makefile code, rather than using $(call) and
# $(eval), or at least centralize the setup of the numerous vars
# related to each build variant $(JS_BUILD_MODES).
# related to each build variant (vanilla, esm, bundler-friendly).
#
SHELL := $(shell which bash 2>/dev/null)
MAKEFILE := $(lastword $(MAKEFILE_LIST))
@@ -52,9 +52,7 @@ CLEAN_FILES :=
DISTCLEAN_FILES := ./--dummy--
default: all
release: oz
# JS_BUILD_MODES exists solely to reduce repetition in documentation
# below.
JS_BUILD_MODES := vanilla esm bunder-friendly node
# Emscripten SDK home dir and related binaries...
EMSDK_HOME ?= $(word 1,$(wildcard $(HOME)/emsdk $(HOME)/src/emsdk))
emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell which emcc))
@@ -147,27 +145,8 @@ ifeq (,$(wildcard $(dir.tmp)))
dir._tmp := $(shell mkdir -p $(dir.tmp))
endif
########################################################################
# Set up sqlite3.c and sqlite3.h...
#
# To build with SEE (https://sqlite.org/see), either put sqlite3-see.c
# in the top of this build tree or pass
# sqlite3.c=PATH_TO_sqlite3-see.c to the build. Note that only
# encryption modules with no 3rd-party dependencies will currently
# work here: AES256-OFB, AES128-OFB, and AES128-CCM. Not
# coincidentally, those 3 modules are included in the sqlite3-see.c
# bundle.
#
# A custom sqlite3.c must not have any spaces in its name.
sqlite3.canonical.c := $(dir.top)/sqlite3.c
sqlite3.c ?= $(firstword $(wildcard $(dir.top)/sqlite3-see.c) $(sqlite3.canonical.c))
sqlite3.c := $(dir.top)/sqlite3.c
sqlite3.h := $(dir.top)/sqlite3.h
ifeq (,$(shell grep sqlite3_activate_see $(sqlite3.c) 2>/dev/null))
SQLITE_C_IS_SEE := 0
else
SQLITE_C_IS_SEE := 1
$(info This is an SEE build.)
endif
# Most SQLITE_OPT flags are set in sqlite3-wasm.c but we need them
# made explicit here for building speedtest1.c.
SQLITE_OPT = \
@@ -190,13 +169,10 @@ SQLITE_OPT = \
-DSQLITE_OS_KV_OPTIONAL=1 \
'-DSQLITE_DEFAULT_UNIX_VFS="unix-none"' \
-DSQLITE_USE_URI=1 \
-DSQLITE_WASM_ENABLE_C_TESTS \
-DSQLITE_C=$(sqlite3.c)
-DSQLITE_WASM_ENABLE_C_TESTS
.NOTPARALLEL: $(sqlite3.h)
$(sqlite3.h):
$(sqlite3.c) $(sqlite3.h):
$(MAKE) -C $(dir.top) sqlite3.c
$(sqlite3.c): $(sqlite3.h)
.PHONY: clean distclean
clean:
@@ -213,42 +189,13 @@ else
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
endif
########################################################################
# Adding custom C code via sqlite3_wasm_extra_init.c:
#
# If the canonical build process finds the file
# sqlite3_wasm_extra_init.c in the main wasm build directory, it
# arranges to include that file in the build of sqlite3.wasm and
# defines SQLITE_EXTRA_INIT=sqlite3_wasm_extra_init.
#
# sqlite3_wasm_extra_init() must be a function with this signature:
#
# int sqlite3_wasm_extra_init(const char *)
#
# and the sqlite3 library will call it with an argument of NULL one
# time during sqlite3_initialize(). If it returns non-0,
# initialization of the library will fail.
#
# The filename can be overridden with:
#
# make sqlite3_wasm_extra_init.c=my_custom_stuff.c
#
# See example_extra_init.c for an example implementation.
########################################################################
sqlite3_wasm_extra_init.c ?= $(wildcard sqlite3_wasm_extra_init.c)
cflags.wasm_extra_init :=
ifneq (,$(sqlite3_wasm_extra_init.c))
$(info Enabling SQLITE_EXTRA_INIT via $(sqlite3_wasm_extra_init.c).)
cflags.wasm_extra_init := -DSQLITE_WASM_EXTRA_INIT
endif
# bin.version-info = binary to output various sqlite3 version info for
# embedding in the JS files and in building the distribution zip file.
# It must NOT be in $(dir.tmp) because we need it to survive the
# cleanup process for the dist build to work properly.
bin.version-info := $(dir.wasm)/version-info
$(bin.version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE)
$(CC) -O0 -I$(dir $(sqlite3.c)) -o $@ $<
$(CC) -O0 -I$(dir.top) -o $@ $<
DISTCLEAN_FILES += $(bin.version-info)
# bin.stripcomments is used for stripping C/C++-style comments from JS
@@ -306,7 +253,7 @@ endef
########################################################################
# cflags.common = C compiler flags for all builds
cflags.common := -I. -I$(dir $(sqlite3.c))
cflags.common := -I. -I.. -I$(dir.top)
# emcc.WASM_BIGINT = 1 for BigInt (C int64) support, else 0. The API
# disables certain features if BigInt is not enabled and such builds
# _are not tested_ on any regular basis.
@@ -349,14 +296,10 @@ emcc_opt_full := $(emcc_opt) -g3
# EXPORTED_FUNCTIONS.* = files for use with Emscripten's
# -sEXPORTED_FUNCTION flag.
EXPORTED_FUNCTIONS.api.main := $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api)
EXPORTED_FUNCTIONS.api.in := $(EXPORTED_FUNCTIONS.api.main)
ifeq (1,$(SQLITE_C_IS_SEE))
EXPORTED_FUNCTIONS.api.in += $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-see)
endif
EXPORTED_FUNCTIONS.api.in := $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api)
EXPORTED_FUNCTIONS.api := $(dir.tmp)/EXPORTED_FUNCTIONS.api
$(EXPORTED_FUNCTIONS.api): $(EXPORTED_FUNCTIONS.api.in) $(sqlite3.c) $(MAKEFILE)
cat $(EXPORTED_FUNCTIONS.api.in) > $@
$(EXPORTED_FUNCTIONS.api): $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE)
cp $(EXPORTED_FUNCTIONS.api.in) $@
# sqlite3-license-version.js = generated JS file with the license
# header and version info.
@@ -463,16 +406,7 @@ emcc.jsflags += -sSTRICT_JS=0
# STRICT_JS disabled due to:
# https://github.com/emscripten-core/emscripten/issues/18610
# TL;DR: does not work with MODULARIZE or EXPORT_ES6 as of version 3.1.31.
# -sENVIRONMENT values for the various build modes:
emcc.environment.vanilla := web,worker
emcc.environment.bundler-friendly := $(emcc.environment.vanilla)
emcc.environment.esm := $(emcc.environment.vanilla)
emcc.environment.node := node
# Note that adding "node" to the list for the other builds causes
# Emscripten to generate code which confuses node: it cannot reliably
# determine whether the build is for a browser or for node.
emcc.environment := -sENVIRONMENT=web,worker
########################################################################
# -sINITIAL_MEMORY: How much memory we need to start with is governed
# at least in part by whether -sALLOW_MEMORY_GROWTH is enabled. If so,
@@ -485,9 +419,9 @@ emcc.environment.node := node
# such test results are inconsistent due to browser internals which
# are opaque to us.
emcc.jsflags += -sALLOW_MEMORY_GROWTH
emcc.INITIAL_MEMORY.128 := 134217728
emcc.INITIAL_MEMORY.128 := 13107200
emcc.INITIAL_MEMORY.96 := 100663296
emcc.INITIAL_MEMORY.64 := 67108864
emcc.INITIAL_MEMORY.64 := 64225280
emcc.INITIAL_MEMORY.32 := 33554432
emcc.INITIAL_MEMORY.16 := 16777216
emcc.INITIAL_MEMORY.8 := 8388608
@@ -504,8 +438,6 @@ emcc.jsflags += -sSTACK_SIZE=512KB
# ^^^ ACHTUNG: emsdk 3.1.27 reduced the default stack size from 5MB to
# a mere 64KB, which leads to silent memory corruption via the kvvfs
# VFS, which requires twice that for its xRead() and xWrite() methods.
# 2023-03: those methods have since been adapted to use a malloc()'d
# buffer.
########################################################################
# $(sqlite3.js.init-func) is the name Emscripten assigns our exported
# module init/load function. This symbol name is hard-coded in
@@ -574,7 +506,7 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
@echo "Making $@..."
@{ \
echo 'globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
echo -n ' sqlite3.version = '; \
$(bin.version-info) --json; \
echo ';'; \
@@ -616,11 +548,10 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE)
########################################################################
# call-make-pre-post is a $(call)able which creates rules for
# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf
# this pre-js is for (one of: sqlite3, sqlite3-wasmfs). $2 is the
# build mode: one of $(JS_BUILD_MODES). This
# sets up --[extern-][pre/post]-js flags in
# $(pre-post-$(1).flags.$(2)) and dependencies in
# $(pre-post-$(1).deps.$(2)).
# this pre-js is for (one of: sqlite3, sqlite3-wasmfs). $2 is the build
# mode: one of (vanilla, esm, bundler-friendly). This sets up
# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and
# dependencies in $(pre-post-$(1).deps.$(2)).
define call-make-pre-post
pre-post-$(1).flags.$(2) ?=
$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE)
@@ -645,7 +576,6 @@ endef
# https://github.com/emscripten-core/emscripten/issues/14383
sqlite3.wasm := $(dir.dout)/sqlite3.wasm
sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
sqlite3-wasm.cses := $(sqlite3-wasm.c) $(sqlite3_wasm_extra_init.c)
# sqlite3-wasm.o vs sqlite3-wasm.c: building against the latter
# (predictably) results in a slightly faster binary. We're close
# enough to the target speed requirements that the 500ms makes a
@@ -693,20 +623,18 @@ pre-post-common.flags := \
pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js)
########################################################################
# SETUP_LIB_BUILD_MODE is a $(call)'able which sets up numerous pieces
# for one of the build modes.
# for one of the build modes (vanilla, esm, bundler-friendly).
#
# $1 = build mode name: one of $(JS_BUILD_MODES)
# $1 = build mode name
# $2 = 1 for ESM build mode, else 0
# $3 = resulting sqlite-api JS/MJS file
# $4 = resulting JS/MJS file
# $5 = -D... flags for $(bin.c-pp)
# $6 = emcc -sXYZ flags (CURRENTLY UNUSED - was factored out)
#
# emcc.environment.$(1) must be set to a value for the -sENVIRONMENT flag.
# $6 = emcc -sXYZ flags
define SETUP_LIB_BUILD_MODE
$(info Setting up build [$(1)]: $(4))
c-pp.D.$(1) := $(5)
pre-js.js.$(1) := $$(dir.tmp)/pre-js.$(1).js
pre-js.js.$(1) := $$(dir.api)/pre-js.$(1).js
$$(eval $$(call C-PP.FILTER,$$(pre-js.js.in),$$(pre-js.js.$(1)),$$(c-pp.D.$(1))))
post-js.js.$(1) := $$(dir.tmp)/post-js.$(1).js
$$(eval $$(call C-PP.FILTER,$$(post-js.js.in),$$(post-js.js.$(1)),$$(c-pp.D.$(1))))
@@ -721,21 +649,19 @@ pre-post-jses.deps.$(1) := $$(pre-post-jses.deps.common) \
$$(eval $$(call call-make-pre-post,sqlite3,$(1)))
emcc.flags.sqlite3.$(1) := $(6)
$$(eval $$(call C-PP.FILTER, $$(sqlite3-api.js.in), $(3), $(5)))
$(4): $(3) $$(MAKEFILE) $$(sqlite3-wasm.cses) $$(EXPORTED_FUNCTIONS.api) $$(pre-post-sqlite3.deps.$(1))
$(4): $(3)
$(4): $(3) $$(MAKEFILE) $$(sqlite3-wasm.c) $$(EXPORTED_FUNCTIONS.api) $$(pre-post-sqlite3.deps.$(1))
@echo "Building $$@ ..."
$$(emcc.bin) -o $$@ $$(emcc_opt_full) $$(emcc.flags) \
$$(emcc.jsflags) \
-sENVIRONMENT=$$(emcc.environment.$(1)) \
$$(pre-post-sqlite3.flags.$(1)) $$(emcc.flags.sqlite3.$(1)) \
$$(cflags.common) $$(SQLITE_OPT) $$(cflags.wasm_extra_init) $$(sqlite3-wasm.cses)
$$(cflags.common) $$(SQLITE_OPT) $$(sqlite3-wasm.c)
@$$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2))
@case $(1) in \
bundler-friendly|node) \
echo "Patching $(3) for sqlite3.wasm..."; \
rm -f $$(dir.dout)/sqlite3-$(1).wasm; \
sed -i -e 's/sqlite3-$(1).wasm/sqlite3.wasm/g' $$@ || exit $$$$?; \
;; \
esac
@if [ bundler-friendly = $(1) ]; then \
echo "Patching $(3) for sqlite3.wasm..."; \
rm -f $$(dir.dout)/sqlite3-bundler-friendly.wasm; \
sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $$@ || exit $$$$?; \
fi
chmod -x $$(sqlite3.wasm)
$$(maybe-wasm-strip) $$(sqlite3.wasm)
@ls -la $@ $$(sqlite3.wasm)
@@ -751,8 +677,6 @@ sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs
sqlite3.mjs := $(dir.dout)/sqlite3.mjs
sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs
sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs
sqlite3-api-node.mjs := $(dir.dout)/sqlite3-api-node.mjs
sqlite3-node.mjs := $(dir.dout)/sqlite3-node.mjs
# Maintenance reminder: careful not to introduce spaces around args $1, $2
#$(info $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js)))
$(eval $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js)))
@@ -760,10 +684,7 @@ $(eval $(call SETUP_LIB_BUILD_MODE,esm,1, $(sqlite3-api.mjs), $(sqlite3.mjs), \
-Dtarget=es6-module, -sEXPORT_ES6 -sUSE_ES6_IMPORT_META))
$(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\
$(sqlite3-api-bundler-friendly.mjs),$(sqlite3-bundler-friendly.mjs),\
$(c-pp.D.esm) -Dtarget=es6-bundler-friendly))
$(eval $(call SETUP_LIB_BUILD_MODE,node,1,\
$(sqlite3-api-node.mjs),$(sqlite3-node.mjs),\
$(c-pp.D.bundler-friendly) -Dtarget=node))
$(c-pp.D.esm) -Dtarget=es6-bundler-friendly, $(emcc.flags.sqlite3.esm)))
# The various -D... values used by *.c-pp.js include:
#
# -Dtarget=es6-module: for all ESM module builds
@@ -775,26 +696,18 @@ $(eval $(call SETUP_LIB_BUILD_MODE,node,1,\
# as string literals so that bundlers' static-analysis tools can
# find those files and include them in their bundles.
#
# -Dtarget=es6-module -Dtarget=es6-bundler-friendly -Dtarget=node: is
# intended for use by node.js for node.js, as opposed to by
# node.js on behalf of a browser. Mixing -sENVIRONMENT=web and
# -sENVIRONMENT=node leads to ambiguity and confusion on node's
# part, as it's unable to reliably determine whether the target is
# a browser or node.
#
########################################################################
########################################################################
# We have to ensure that we do not build $(sqlite3*.*js) in parallel
# because they all result in the creation of $(sqlite3.wasm). We have
# no way to build just a .[m]js file without also building the .wasm
# file because the generated .[m]js file has to include info about the
# imports needed by the wasm file, so they have to be built
# We have to ensure that we do not build both $(sqlite3*.*js) in
# parallel because both result in the creation of $(sqlite3.wasm). We
# have no way to build just the .mjs file without also building the
# .wasm file because the generated .mjs file has to include info about
# the imports needed by the wasm file, so they have to be built
# together. i.e. we're building $(sqlite3.wasm) multiple times, but
# that's unavoidable (and harmless, just a waste of build time).
$(sqlite3.wasm): $(sqlite3.js)
$(sqlite3.mjs): $(sqlite3.js)
$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
$(sqlite3-node.mjs): $(sqlite3.mjs)
CLEAN_FILES += $(sqlite3.wasm)
########################################################################
@@ -807,7 +720,7 @@ sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js
sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js
sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js
sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js
sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.mjs
sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.js
sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js)))
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\
@@ -887,9 +800,9 @@ speedtest1.exit-runtime1 := -sEXIT_RUNTIME=1
# -sEXIT_RUNTIME=1 but we need EXIT_RUNTIME=0 for the worker-based app
# which runs speedtest1 multiple times.
$(EXPORTED_FUNCTIONS.speedtest1): $(EXPORTED_FUNCTIONS.api.main)
$(EXPORTED_FUNCTIONS.speedtest1): $(EXPORTED_FUNCTIONS.api)
@echo "Making $@ ..."
@{ echo _wasm_main; cat $(EXPORTED_FUNCTIONS.api.main); } > $@
@{ echo _wasm_main; cat $(EXPORTED_FUNCTIONS.api); } > $@
speedtest1.js := $(dir.dout)/speedtest1.js
speedtest1.wasm := $(dir.dout)/speedtest1.wasm
cflags.speedtest1 := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
@@ -900,11 +813,9 @@ $(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \
$(EXPORTED_FUNCTIONS.speedtest1)
@echo "Building $@ ..."
$(emcc.bin) \
$(emcc.speedtest1) -I$(dir $(sqlite3.canonical.c)) \
$(emcc.speedtest1.common) \
$(emcc.speedtest1) $(emcc.speedtest1.common) \
$(cflags.speedtest1) $(pre-post-speedtest1.flags.vanilla) \
$(SQLITE_OPT) \
-USQLITE_C -DSQLITE_C=$(sqlite3.canonical.c) \
$(speedtest1.exit-runtime0) \
-o $@ $(speedtest1.cses) -lm
$(maybe-wasm-strip) $(speedtest1.wasm)
@@ -1,5 +0,0 @@
_sqlite3_key
_sqlite3_key_v2
_sqlite3_rekey
_sqlite3_rekey_v2
_sqlite3_activate_see
+14 -16
View File
@@ -28,7 +28,7 @@ const toExportForESM =
for non-ES6 Module cases but wrong for ES6 modules because those
resolve this symbol differently. */ sqlite3InitModule;
if(!originalInit){
throw new Error("Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.");
throw new Error("Expecting self.sqlite3InitModule to be defined by the Emscripten build.");
}
/**
We need to add some state which our custom Module.locateFile()
@@ -41,13 +41,11 @@ const toExportForESM =
into the global scope and delete it when sqlite3InitModule()
is called.
*/
const initModuleState = globalThis.sqlite3InitModuleState = Object.assign(Object.create(null),{
moduleScript: globalThis?.document?.currentScript,
const initModuleState = self.sqlite3InitModuleState = Object.assign(Object.create(null),{
moduleScript: self?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: globalThis.location,
urlParams: globalThis?.location?.href
? new URL(globalThis.location.href).searchParams
: new URLSearchParams()
location: self.location,
urlParams: new URL(self.location.href).searchParams
});
initModuleState.debugModule =
initModuleState.urlParams.has('sqlite3.debugModule')
@@ -62,14 +60,14 @@ const toExportForESM =
initModuleState.sqlite3Dir = li.join('/') + '/';
}
globalThis.sqlite3InitModule = function ff(...args){
//console.warn("Using replaced sqlite3InitModule()",globalThis.location);
self.sqlite3InitModule = function ff(...args){
//console.warn("Using replaced sqlite3InitModule()",self.location);
return originalInit(...args).then((EmscriptenModule)=>{
if('undefined'!==typeof WorkerGlobalScope &&
if(self.window!==self &&
(EmscriptenModule['ENVIRONMENT_IS_PTHREAD']
|| EmscriptenModule['_pthread_self']
|| 'function'===typeof threadAlert
|| globalThis?.location?.pathname?.endsWith?.('.worker.js')
|| self.location.pathname.endsWith('.worker.js')
)){
/** Workaround for wasmfs-generated worker, which calls this
routine from each individual thread and requires that its
@@ -90,10 +88,10 @@ const toExportForESM =
throw e;
});
};
globalThis.sqlite3InitModule.ready = originalInit.ready;
self.sqlite3InitModule.ready = originalInit.ready;
if(globalThis.sqlite3InitModuleState.moduleScript){
const sim = globalThis.sqlite3InitModuleState;
if(self.sqlite3InitModuleState.moduleScript){
const sim = self.sqlite3InitModuleState;
let src = sim.moduleScript.src.split('/');
src.pop();
sim.scriptDir = src.join('/') + '/';
@@ -101,7 +99,7 @@ const toExportForESM =
initModuleState.debugModule('sqlite3InitModuleState =',initModuleState);
if(0){
console.warn("Replaced sqlite3InitModule()");
console.warn("globalThis.location.href =",globalThis.location.href);
console.warn("self.location.href =",self.location.href);
if('undefined' !== typeof document){
console.warn("document.currentScript.src =",
document?.currentScript?.src);
@@ -121,7 +119,7 @@ const toExportForESM =
/* AMD modules get injected in a way we cannot override,
so we can't handle those here. */
//#endif // !target=es6-module
return globalThis.sqlite3InitModule /* required for ESM */;
return self.sqlite3InitModule /* required for ESM */;
})();
//#if target=es6-module
export default toExportForESM;
+3 -3
View File
@@ -6,12 +6,12 @@
*/
// See notes in extern-post-js.js
const sqlite3InitModuleState = globalThis.sqlite3InitModuleState
const sqlite3InitModuleState = self.sqlite3InitModuleState
|| Object.assign(Object.create(null),{
debugModule: ()=>{}
});
delete globalThis.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('globalThis.location =',globalThis.location);
delete self.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('self.location =',self.location);
//#ifnot target=es6-bundler-friendly
/**
+8 -8
View File
@@ -25,7 +25,7 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
exports: Module['asm'],
memory: Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */
},
globalThis.sqlite3ApiConfig || {}
self.sqlite3ApiConfig || {}
);
/**
@@ -33,29 +33,29 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
sqlite3ApiBootstrap(). That decision will be revisited at some
point, as we really want client code to be able to call this to
configure certain parts. Clients may modify
globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default
self.sqlite3ApiBootstrap.defaultConfig to tweak the default
configuration used by a no-args call to sqlite3ApiBootstrap(),
but must have first loaded their WASM module in order to be
able to provide the necessary configuration state.
*/
//console.warn("globalThis.sqlite3ApiConfig = ",globalThis.sqlite3ApiConfig);
globalThis.sqlite3ApiConfig = SABC;
//console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig);
self.sqlite3ApiConfig = SABC;
let sqlite3;
try{
sqlite3 = globalThis.sqlite3ApiBootstrap();
sqlite3 = self.sqlite3ApiBootstrap();
}catch(e){
console.error("sqlite3ApiBootstrap() error:",e);
throw e;
}finally{
delete globalThis.sqlite3ApiBootstrap;
delete globalThis.sqlite3ApiConfig;
delete self.sqlite3ApiBootstrap;
delete self.sqlite3ApiConfig;
}
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
pass the sqlite3 object off to the client. */;
}else{
console.warn("This is not running in an Emscripten module context, so",
"globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack",
"self.sqlite3ApiBootstrap() is _not_ being called due to lack",
"of config info for the WASM environment.",
"It must be called manually.");
}
+5 -14
View File
@@ -16,13 +16,13 @@
initializes the main API pieces so that the downstream components
(e.g. sqlite3-api-oo1.js) have all that they need.
*/
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
'use strict';
const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = sqlite3.SQLite3Error.toss;
const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
globalThis.WhWasmUtilInstaller(wasm);
delete globalThis.WhWasmUtilInstaller;
self.WhWasmUtilInstaller(wasm);
delete self.WhWasmUtilInstaller;
if(0){
/**
@@ -327,15 +327,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
wasm.bindingSignatures.push(["sqlite3_normalized_sql", "string", "sqlite3_stmt*"]);
}
if(wasm.exports.sqlite3_activate_see instanceof Function){
wasm.bindingSignatures.push(
["sqlite3_key", "int", "sqlite3*", "string", "int"],
["sqlite3_key_v2","int","sqlite3*","string","*","int"],
["sqlite3_rekey", "int", "sqlite3*", "string", "int"],
["sqlite3_rekey_v2", "int", "sqlite3*", "string", "*", "int"],
["sqlite3_activate_see", undefined, "string"]
);
}
/**
Functions which require BigInt (int64) support are separated from
the others because we need to conditionally bind them or apply
@@ -614,7 +605,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
/**
Install JS<->C struct bindings for the non-opaque struct types we
need... */
sqlite3.StructBinder = globalThis.Jaccwabyt({
sqlite3.StructBinder = self.Jaccwabyt({
heap: 0 ? wasm.memory : wasm.heap8u,
alloc: wasm.alloc,
dealloc: wasm.dealloc,
@@ -622,7 +613,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
memberPrefix: /* Never change this: this prefix is baked into any
amount of code and client-facing docs. */ '$'
});
delete globalThis.Jaccwabyt;
delete self.Jaccwabyt;
{// wasm.xWrap() bindings...
+2 -2
View File
@@ -12,9 +12,9 @@
This file contains the so-called OO #1 API wrapper for the sqlite3
WASM build. It requires that sqlite3-api-glue.js has already run
and it installs its deliverable as globalThis.sqlite3.oo1.
and it installs its deliverable as self.sqlite3.oo1.
*/
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)};
+43 -41
View File
@@ -29,7 +29,7 @@
exposed by this API. It is intended to be called one time at the
end of the API amalgamation process, passed configuration details
for the current environment, and then optionally be removed from
the global object using `delete globalThis.sqlite3ApiBootstrap`.
the global object using `delete self.sqlite3ApiBootstrap`.
This function is not intended for client-level use. It is intended
for use in creating bundles configured for specific WASM
@@ -58,7 +58,7 @@
WASM-exported memory.
- `bigIntEnabled`: true if BigInt support is enabled. Defaults to
true if `globalThis.BigInt64Array` is available, else false. Some APIs
true if `self.BigInt64Array` is available, else false. Some APIs
will throw exceptions if called without BigInt support, as BigInt
is required for marshalling C-side int64 into and out of JS.
(Sidebar: it is technically possible to add int64 support via
@@ -100,8 +100,8 @@
*/
'use strict';
globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
apiConfig = (globalThis.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
apiConfig = (self.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
){
if(sqlite3ApiBootstrap.sqlite3){ /* already initalized */
console.warn("sqlite3ApiBootstrap() called multiple times.",
@@ -117,7 +117,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
-sWASM_BIGINT=1, else it will not. */
return !!Module.HEAPU64;
}
return !!globalThis.BigInt64Array;
return !!self.BigInt64Array;
})(),
debug: console.debug.bind(console),
warn: console.warn.bind(console),
@@ -772,7 +772,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
isBindableTypedArray,
isInt32, isSQLableTypedArray, isTypedArray,
typedArrayToString,
isUIThread: ()=>(globalThis.window===globalThis && !!globalThis.document),
isUIThread: ()=>(self.window===self && !!self.document),
// is this true for ESM?: 'undefined'===typeof WorkerGlobalScope
isSharedTypedArray,
toss: function(...args){throw new Error(args.join(' '))},
@@ -1203,9 +1203,9 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
console.error("sqlite3_wasmfs_opfs_dir() can no longer work due "+
"to incompatible WASMFS changes. It will be removed.");
if(!pdir
|| !globalThis.FileSystemHandle
|| !globalThis.FileSystemDirectoryHandle
|| !globalThis.FileSystemFileHandle){
|| !self.FileSystemHandle
|| !self.FileSystemDirectoryHandle
|| !self.FileSystemFileHandle){
return __wasmfsOpfsDir = "";
}
try{
@@ -1461,8 +1461,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
const rc = Object.create(null);
rc.prefix = 'kvvfs-'+which;
rc.stores = [];
if('session'===which || ""===which) rc.stores.push(globalThis.sessionStorage);
if('local'===which || ""===which) rc.stores.push(globalThis.localStorage);
if('session'===which || ""===which) rc.stores.push(self.sessionStorage);
if('local'===which || ""===which) rc.stores.push(self.localStorage);
return rc;
};
@@ -1538,7 +1538,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Returns capi.SQLITE_MISUSE if op is not a valid operation ID.
*/
capi.sqlite3_db_config = function(pDb, op, ...args){
capi.sqlite3_db_config = function f(pDb, op, ...args){
if(!this.s){
this.s = wasm.xWrap('sqlite3_wasm_db_config_s','int',
['sqlite3*', 'int', 'string:static']
@@ -1548,30 +1548,31 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
this.ip = wasm.xWrap('sqlite3_wasm_db_config_ip','int',
['sqlite3*', 'int', 'int','*']);
}
const c = capi;
switch(op){
case capi.SQLITE_DBCONFIG_ENABLE_FKEY:
case capi.SQLITE_DBCONFIG_ENABLE_TRIGGER:
case capi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER:
case capi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:
case capi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:
case capi.SQLITE_DBCONFIG_ENABLE_QPSG:
case capi.SQLITE_DBCONFIG_TRIGGER_EQP:
case capi.SQLITE_DBCONFIG_RESET_DATABASE:
case capi.SQLITE_DBCONFIG_DEFENSIVE:
case capi.SQLITE_DBCONFIG_WRITABLE_SCHEMA:
case capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:
case capi.SQLITE_DBCONFIG_DQS_DML:
case capi.SQLITE_DBCONFIG_DQS_DDL:
case capi.SQLITE_DBCONFIG_ENABLE_VIEW:
case capi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:
case capi.SQLITE_DBCONFIG_TRUSTED_SCHEMA:
case c.SQLITE_DBCONFIG_ENABLE_FKEY:
case c.SQLITE_DBCONFIG_ENABLE_TRIGGER:
case c.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER:
case c.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:
case c.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:
case c.SQLITE_DBCONFIG_ENABLE_QPSG:
case c.SQLITE_DBCONFIG_TRIGGER_EQP:
case c.SQLITE_DBCONFIG_RESET_DATABASE:
case c.SQLITE_DBCONFIG_DEFENSIVE:
case c.SQLITE_DBCONFIG_WRITABLE_SCHEMA:
case c.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:
case c.SQLITE_DBCONFIG_DQS_DML:
case c.SQLITE_DBCONFIG_DQS_DDL:
case c.SQLITE_DBCONFIG_ENABLE_VIEW:
case c.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:
case c.SQLITE_DBCONFIG_TRUSTED_SCHEMA:
return this.ip(pDb, op, args[0], args[1] || 0);
case capi.SQLITE_DBCONFIG_LOOKASIDE:
case c.SQLITE_DBCONFIG_LOOKASIDE:
return this.pii(pDb, op, args[0], args[1], args[2]);
case capi.SQLITE_DBCONFIG_MAINDBNAME:
case c.SQLITE_DBCONFIG_MAINDBNAME:
return this.s(pDb, op, args[0]);
default:
return capi.SQLITE_MISUSE;
return c.SQLITE_MISUSE;
}
}.bind(Object.create(null));
@@ -1961,7 +1962,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
return sqlite3;
}/*sqlite3ApiBootstrap()*/;
/**
globalThis.sqlite3ApiBootstrap.initializers is an internal detail used by
self.sqlite3ApiBootstrap.initializers is an internal detail used by
the various pieces of the sqlite3 API's amalgamation process. It
must not be modified by client code except when plugging such code
into the amalgamation process.
@@ -1979,14 +1980,14 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
utilized until the whwasmutil.js part is plugged in via
sqlite3-api-glue.js.
*/
globalThis.sqlite3ApiBootstrap.initializers = [];
self.sqlite3ApiBootstrap.initializers = [];
/**
globalThis.sqlite3ApiBootstrap.initializersAsync is an internal detail
self.sqlite3ApiBootstrap.initializersAsync is an internal detail
used by the sqlite3 API's amalgamation process. It must not be
modified by client code except when plugging such code into the
amalgamation process.
The counterpart of globalThis.sqlite3ApiBootstrap.initializers,
The counterpart of self.sqlite3ApiBootstrap.initializers,
specifically for initializers which are asynchronous. All entries in
this list must be either async functions, non-async functions which
return a Promise, or a Promise. Each function in the list is called
@@ -1998,10 +1999,10 @@ globalThis.sqlite3ApiBootstrap.initializers = [];
This list is not processed until the client calls
sqlite3.asyncPostInit(). This means, for example, that intializers
added to globalThis.sqlite3ApiBootstrap.initializers may push entries to
added to self.sqlite3ApiBootstrap.initializers may push entries to
this list.
*/
globalThis.sqlite3ApiBootstrap.initializersAsync = [];
self.sqlite3ApiBootstrap.initializersAsync = [];
/**
Client code may assign sqlite3ApiBootstrap.defaultConfig an
object-type value before calling sqlite3ApiBootstrap() (without
@@ -2011,12 +2012,13 @@ globalThis.sqlite3ApiBootstrap.initializersAsync = [];
an environment-suitable configuration without having to define a new
global-scope symbol.
*/
globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null);
self.sqlite3ApiBootstrap.defaultConfig = Object.create(null);
/**
Placeholder: gets installed by the first call to
globalThis.sqlite3ApiBootstrap(). However, it is recommended that the
self.sqlite3ApiBootstrap(). However, it is recommended that the
caller of sqlite3ApiBootstrap() capture its return value and delete
globalThis.sqlite3ApiBootstrap after calling it. It returns the same
self.sqlite3ApiBootstrap after calling it. It returns the same
value which will be stored here.
*/
globalThis.sqlite3ApiBootstrap.sqlite3 = undefined;
self.sqlite3ApiBootstrap.sqlite3 = undefined;
+6 -6
View File
@@ -313,11 +313,11 @@
options.columnNames may be populated by the call to db.exec().
*/
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3.initWorker1API = function(){
'use strict';
const toss = (...args)=>{throw new Error(args.join(' '))};
if(!(globalThis.WorkerGlobalScope instanceof Function)){
if('function' !== typeof importScripts){
toss("initWorker1API() must be run from a Worker thread.");
}
const self = this.self;
@@ -382,10 +382,10 @@ sqlite3.initWorker1API = function(){
*/
post: function(msg,xferList){
if(xferList && xferList.length){
globalThis.postMessage( msg, Array.from(xferList) );
self.postMessage( msg, Array.from(xferList) );
xferList.length = 0;
}else{
globalThis.postMessage(msg);
self.postMessage(msg);
}
},
/** Map of DB IDs to DBs. */
@@ -589,7 +589,7 @@ sqlite3.initWorker1API = function(){
}
}/*wMsgHandler*/;
globalThis.onmessage = async function(ev){
self.onmessage = async function(ev){
ev = ev.data;
let result, dbId = ev.dbId, evType = ev.type;
const arrivalTime = performance.now();
@@ -637,6 +637,6 @@ sqlite3.initWorker1API = function(){
result: result
}, wState.xfer);
};
globalThis.postMessage({type:'sqlite3-api',result:'worker1-ready'});
self.postMessage({type:'sqlite3-api',result:'worker1-ready'});
}.bind({self, sqlite3});
});
+12 -12
View File
@@ -50,10 +50,10 @@
const wPost = (type,...args)=>postMessage({type, payload:args});
const installAsyncProxy = function(self){
const toss = function(...args){throw new Error(args.join(' '))};
if(globalThis.window === globalThis){
if(self.window === self){
toss("This code cannot run from the main thread.",
"Load it as a Worker from a separate Worker.");
}else if(!navigator?.storage?.getDirectory){
}else if(!navigator.storage.getDirectory){
toss("This API requires navigator.storage.getDirectory.");
}
@@ -106,8 +106,8 @@ const installAsyncProxy = function(self){
w += m.wait;
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
}
console.log(globalThis?.location?.href,
"metrics for",globalThis?.location?.href,":\n",
console.log(self.location.href,
"metrics for",self.location.href,":\n",
metrics,
"\nTotal of",n,"op(s) for",t,"ms",
"approx",w,"ms spent waiting on OPFS APIs.");
@@ -843,7 +843,7 @@ const installAsyncProxy = function(self){
navigator.storage.getDirectory().then(function(d){
state.rootDir = d;
globalThis.onmessage = function({data}){
self.onmessage = function({data}){
switch(data.type){
case 'opfs-async-init':{
/* Receive shared state from synchronous partner */
@@ -880,17 +880,17 @@ const installAsyncProxy = function(self){
wPost('opfs-async-loaded');
}).catch((e)=>error("error initializing OPFS asyncer:",e));
}/*installAsyncProxy()*/;
if(!globalThis.SharedArrayBuffer){
if(!self.SharedArrayBuffer){
wPost('opfs-unavailable', "Missing SharedArrayBuffer API.",
"The server must emit the COOP/COEP response headers to enable that.");
}else if(!globalThis.Atomics){
}else if(!self.Atomics){
wPost('opfs-unavailable', "Missing Atomics API.",
"The server must emit the COOP/COEP response headers to enable that.");
}else if(!globalThis.FileSystemHandle ||
!globalThis.FileSystemDirectoryHandle ||
!globalThis.FileSystemFileHandle ||
!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle ||
!navigator?.storage?.getDirectory){
}else if(!self.FileSystemHandle ||
!self.FileSystemDirectoryHandle ||
!self.FileSystemFileHandle ||
!self.FileSystemFileHandle.prototype.createSyncAccessHandle ||
!navigator.storage.getDirectory){
wPost('opfs-unavailable',"Missing required OPFS APIs.");
}else{
installAsyncProxy(self);
+5 -8
View File
@@ -15,13 +15,10 @@
with its virtual table counterpart, sqlite3.vtab.
*/
'use strict';
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const wasm = sqlite3.wasm, capi = sqlite3.capi, toss = sqlite3.util.toss3;
const vfs = Object.create(null), vtab = Object.create(null);
const StructBinder = sqlite3.StructBinder
/* we require a local alias b/c StructBinder is removed from the sqlite3
object during the final steps of the API cleanup. */;
sqlite3.vfs = vfs;
sqlite3.vtab = vtab;
@@ -115,7 +112,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const installMethod = function callee(
tgt, name, func, applyArgcCheck = callee.installMethodArgcCheck
){
if(!(tgt instanceof StructBinder.StructType)){
if(!(tgt instanceof sqlite3.StructBinder.StructType)){
toss("Usage error: target object is-not-a StructType.");
}else if(!(func instanceof Function) && !wasm.isPtr(func)){
toss("Usage errror: expecting a Function or WASM pointer to one.");
@@ -135,7 +132,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
};
/* An ondispose() callback for use with
StructBinder-created types. */
sqlite3.StructBinder-created types. */
callee.removeFuncList = function(){
if(this.ondispose.__removeFuncList){
this.ondispose.__removeFuncList.forEach(
@@ -224,7 +221,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
and the first is an object, it's instead equivalent to calling
installMethods(this,...arguments).
*/
StructBinder.StructType.prototype.installMethod = function callee(
sqlite3.StructBinder.StructType.prototype.installMethod = function callee(
name, func, applyArgcCheck = installMethod.installMethodArgcCheck
){
return (arguments.length < 3 && name && 'object'===typeof name)
@@ -236,7 +233,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Equivalent to calling installMethods() with a first argument
of this object.
*/
StructBinder.StructType.prototype.installMethods = function(
sqlite3.StructBinder.StructType.prototype.installMethods = function(
methods, applyArgcCheck = installMethod.installMethodArgcCheck
){
return installMethods(this, methods, applyArgcCheck);
+21 -42
View File
@@ -18,7 +18,7 @@
after sqlite3-api-oo1.js and before sqlite3-api-cleanup.js.
*/
'use strict';
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
/**
installOpfsVfs() returns a Promise which, on success, installs an
sqlite3_vfs named "opfs", suitable for use with all sqlite3 APIs
@@ -76,23 +76,23 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
`opfs` property, containing several OPFS-specific utilities.
*/
const installOpfsVfs = function callee(options){
if(!globalThis.SharedArrayBuffer
|| !globalThis.Atomics){
if(!self.SharedArrayBuffer
|| !self.Atomics){
return Promise.reject(
new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. "+
"The server must emit the COOP/COEP response headers to enable those. "+
"See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep")
);
}else if('undefined'===typeof WorkerGlobalScope){
}else if(self.window===self && self.document){
return Promise.reject(
new Error("The OPFS sqlite3_vfs cannot run in the main thread "+
"because it requires Atomics.wait().")
);
}else if(!globalThis.FileSystemHandle ||
!globalThis.FileSystemDirectoryHandle ||
!globalThis.FileSystemFileHandle ||
!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle ||
!navigator?.storage?.getDirectory){
}else if(!self.FileSystemHandle ||
!self.FileSystemDirectoryHandle ||
!self.FileSystemFileHandle ||
!self.FileSystemFileHandle.prototype.createSyncAccessHandle ||
!navigator.storage.getDirectory){
return Promise.reject(
new Error("Missing required OPFS APIs.")
);
@@ -100,7 +100,7 @@ const installOpfsVfs = function callee(options){
if(!options || 'object'!==typeof options){
options = Object.create(null);
}
const urlParams = new URL(globalThis.location.href).searchParams;
const urlParams = new URL(self.location.href).searchParams;
if(undefined===options.verbose){
options.verbose = urlParams.has('opfs-verbose')
? (+urlParams.get('opfs-verbose') || 2) : 1;
@@ -112,12 +112,12 @@ const installOpfsVfs = function callee(options){
options.proxyUri = callee.defaultProxyUri;
}
//sqlite3.config.warn("OPFS options =",options,globalThis.location);
//sqlite3.config.warn("OPFS options =",options,self.location);
if('function' === typeof options.proxyUri){
options.proxyUri = options.proxyUri();
}
const thePromise = new Promise(function(promiseResolve_, promiseReject_){
const thePromise = new Promise(function(promiseResolve, promiseReject_){
const loggers = {
0:sqlite3.config.error,
1:sqlite3.config.warn,
@@ -149,11 +149,11 @@ const installOpfsVfs = function callee(options){
Returns true if _this_ thread has access to the OPFS APIs.
*/
const thisThreadHasOPFS = ()=>{
return globalThis.FileSystemHandle &&
globalThis.FileSystemDirectoryHandle &&
globalThis.FileSystemFileHandle &&
globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle &&
navigator?.storage?.getDirectory;
return self.FileSystemHandle &&
self.FileSystemDirectoryHandle &&
self.FileSystemFileHandle &&
self.FileSystemFileHandle.prototype.createSyncAccessHandle &&
navigator.storage.getDirectory;
};
/**
@@ -171,8 +171,8 @@ const installOpfsVfs = function callee(options){
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
m.avgWait = (m.count && m.wait) ? (m.wait / m.count) : 0;
}
sqlite3.config.log(globalThis.location.href,
"metrics for",globalThis.location.href,":",metrics,
sqlite3.config.log(self.location.href,
"metrics for",self.location.href,":",metrics,
"\nTotal of",n,"op(s) for",t,
"ms (incl. "+w+" ms of waiting on the async side)");
sqlite3.config.log("Serialization metrics:",metrics.s11n);
@@ -193,16 +193,10 @@ const installOpfsVfs = function callee(options){
}/*metrics*/;
const opfsVfs = new sqlite3_vfs();
const opfsIoMethods = new sqlite3_io_methods();
let promiseWasRejected = undefined;
const promiseReject = (err)=>{
promiseWasRejected = true;
const promiseReject = function(err){
opfsVfs.dispose();
return promiseReject_(err);
};
const promiseResolve = (value)=>{
promiseWasRejected = false;
return promiseResolve_(value);
};
const W =
//#if target=es6-bundler-friendly
new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url));
@@ -211,18 +205,6 @@ const installOpfsVfs = function callee(options){
//#else
new Worker(options.proxyUri);
//#endif
setTimeout(()=>{
/* At attempt to work around a browser-specific quirk in which
the Worker load is failing in such a way that we neither
resolve nor reject it. This workaround gives that resolve/reject
a time limit and rejects if that timer expires. Discussion:
https://sqlite.org/forum/forumpost/a708c98dcb3ef */
if(undefined===promiseWasRejected){
promiseReject(
new Error("Timeout while waiting for OPFS async proxy worker.")
);
}
}, 4000);
W._originalOnError = W.onerror /* will be restored later */;
W.onerror = function(err){
// The error object doesn't contain any useful info when the
@@ -1287,9 +1269,6 @@ const installOpfsVfs = function callee(options){
/*Indicates that the async partner has received the 'init'
and has finished initializing, so the real work can
begin...*/
if(true===promiseWasRejected){
break /* promise was already rejected via timer */;
}
try {
sqlite3.vfs.installVfs({
io: {struct: opfsIoMethods, methods: ioSyncWrappers},
@@ -1332,7 +1311,7 @@ const installOpfsVfs = function callee(options){
}/*installOpfsVfs()*/;
installOpfsVfs.defaultProxyUri =
"sqlite3-opfs-async-proxy.js";
globalThis.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
self.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
try{
let proxyJs = installOpfsVfs.defaultProxyUri;
if(sqlite3.scriptInfo.sqlite3Dir){
+48 -73
View File
@@ -163,14 +163,15 @@
# define SQLITE_USE_URI 1
#endif
#ifdef SQLITE_WASM_EXTRA_INIT
# define SQLITE_EXTRA_INIT sqlite3_wasm_extra_init
#include <assert.h>
#include "sqlite3.c" /* yes, .c instead of .h. */
#if defined(__EMSCRIPTEN__)
# include <emscripten/console.h>
#endif
#include <assert.h>
/*
** SQLITE_WASM_EXPORT is functionally identical to EMSCRIPTEN_KEEPALIVE
** SQLITE_WASM_KEEP is functionally identical to EMSCRIPTEN_KEEPALIVE
** but is not Emscripten-specific. It explicitly marks functions for
** export into the target wasm file without requiring explicit listing
** of those functions in Emscripten's -sEXPORTED_FUNCTIONS=... list
@@ -192,34 +193,10 @@
** this writing we are tied to Emscripten for various reasons
** and cannot test the library with other build environments.
*/
#define SQLITE_WASM_EXPORT __attribute__((used,visibility("default")))
#define SQLITE_WASM_KEEP __attribute__((used,visibility("default")))
// See also:
//__attribute__((export_name("theExportedName"), used, visibility("default")))
/*
** Which sqlite3.c we're using needs to be configurable to enable
** building against a custom copy, e.g. the SEE variant. Note that we
** #include the .c file, rather than the header, so that the WASM
** extensions have access to private API internals.
**
** The caveat here is that custom variants need to account for
** exporting any necessary symbols (e.g. sqlite3_activate_see()). We
** cannot export them from here using SQLITE_WASM_EXPORT because that
** attribute (apparently) has to be part of the function definition.
*/
#ifndef SQLITE_C
# define SQLITE_C sqlite3.c /* yes, .c instead of .h. */
#endif
#define INC__STRINGIFY_(f) #f
#define INC__STRINGIFY(f) INC__STRINGIFY_(f)
#include INC__STRINGIFY(SQLITE_C)
#undef INC__STRINGIFY_
#undef INC__STRINGIFY
#undef SQLITE_C
#if defined(__EMSCRIPTEN__)
# include <emscripten/console.h>
#endif
#if 0
/*
@@ -233,24 +210,24 @@
** Another option is to malloc() a chunk of our own and call that our
** "stack".
*/
SQLITE_WASM_EXPORT void * sqlite3_wasm_stack_end(void){
SQLITE_WASM_KEEP void * sqlite3_wasm_stack_end(void){
extern void __heap_base
/* see https://stackoverflow.com/questions/10038964 */;
return &__heap_base;
}
SQLITE_WASM_EXPORT void * sqlite3_wasm_stack_begin(void){
SQLITE_WASM_KEEP void * sqlite3_wasm_stack_begin(void){
extern void __data_end;
return &__data_end;
}
static void * pWasmStackPtr = 0;
SQLITE_WASM_EXPORT void * sqlite3_wasm_stack_ptr(void){
SQLITE_WASM_KEEP void * sqlite3_wasm_stack_ptr(void){
if(!pWasmStackPtr) pWasmStackPtr = sqlite3_wasm_stack_end();
return pWasmStackPtr;
}
SQLITE_WASM_EXPORT void sqlite3_wasm_stack_restore(void * p){
SQLITE_WASM_KEEP void sqlite3_wasm_stack_restore(void * p){
pWasmStackPtr = p;
}
SQLITE_WASM_EXPORT void * sqlite3_wasm_stack_alloc(int n){
SQLITE_WASM_KEEP void * sqlite3_wasm_stack_alloc(int n){
if(n<=0) return 0;
n = (n + 7) & ~7 /* align to 8-byte boundary */;
unsigned char * const p = (unsigned char *)sqlite3_wasm_stack_ptr();
@@ -286,14 +263,14 @@ static struct {
/*
** Returns the current pstack position.
*/
SQLITE_WASM_EXPORT void * sqlite3_wasm_pstack_ptr(void){
SQLITE_WASM_KEEP void * sqlite3_wasm_pstack_ptr(void){
return PStack.pPos;
}
/*
** Sets the pstack position poitner to p. Results are undefined if the
** given value did not come from sqlite3_wasm_pstack_ptr().
*/
SQLITE_WASM_EXPORT void sqlite3_wasm_pstack_restore(unsigned char * p){
SQLITE_WASM_KEEP void sqlite3_wasm_pstack_restore(unsigned char * p){
assert(p>=PStack.pBegin && p<=PStack.pEnd && p>=PStack.pPos);
assert(0==(p & 0x7));
if(p>=PStack.pBegin && p<=PStack.pEnd /*&& p>=PStack.pPos*/){
@@ -308,7 +285,7 @@ SQLITE_WASM_EXPORT void sqlite3_wasm_pstack_restore(unsigned char * p){
** JS code from having to do so, and most uses of the pstack will
** call for doing so).
*/
SQLITE_WASM_EXPORT void * sqlite3_wasm_pstack_alloc(int n){
SQLITE_WASM_KEEP void * sqlite3_wasm_pstack_alloc(int n){
if( n<=0 ) return 0;
//if( n & 0x7 ) n += 8 - (n & 0x7) /* align to 8-byte boundary */;
n = (n + 7) & ~7 /* align to 8-byte boundary */;
@@ -321,7 +298,7 @@ SQLITE_WASM_EXPORT void * sqlite3_wasm_pstack_alloc(int n){
** Return the number of bytes left which can be
** sqlite3_wasm_pstack_alloc()'d.
*/
SQLITE_WASM_EXPORT int sqlite3_wasm_pstack_remaining(void){
SQLITE_WASM_KEEP int sqlite3_wasm_pstack_remaining(void){
assert(PStack.pPos >= PStack.pBegin);
assert(PStack.pPos <= PStack.pEnd);
return (int)(PStack.pPos - PStack.pBegin);
@@ -332,7 +309,7 @@ SQLITE_WASM_EXPORT int sqlite3_wasm_pstack_remaining(void){
** any space which is currently allocated. This value is a
** compile-time constant.
*/
SQLITE_WASM_EXPORT int sqlite3_wasm_pstack_quota(void){
SQLITE_WASM_KEEP int sqlite3_wasm_pstack_quota(void){
return (int)(PStack.pEnd - PStack.pBegin);
}
@@ -350,7 +327,7 @@ SQLITE_WASM_EXPORT int sqlite3_wasm_pstack_quota(void){
**
** Returns err_code.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_error(sqlite3*db, int err_code, const char *zMsg){
if( db!=0 ){
if( 0!=zMsg ){
@@ -372,7 +349,7 @@ struct WasmTestStruct {
void (*xFunc)(void*);
};
typedef struct WasmTestStruct WasmTestStruct;
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
void sqlite3_wasm_test_struct(WasmTestStruct * s){
if(s){
s->v4 *= 2;
@@ -400,7 +377,7 @@ void sqlite3_wasm_test_struct(WasmTestStruct * s){
** buffer is not large enough for the generated JSON and needs to be
** increased. In debug builds that will trigger an assert().
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
const char * sqlite3_wasm_enum_json(void){
static char aBuffer[1024 * 20] = {0} /* where the JSON goes */;
int n = 0, nChildren = 0, nStruct = 0
@@ -495,7 +472,6 @@ const char * sqlite3_wasm_enum_json(void){
DefInt(SQLITE_CHANGESETSTART_INVERT);
DefInt(SQLITE_CHANGESETAPPLY_NOSAVEPOINT);
DefInt(SQLITE_CHANGESETAPPLY_INVERT);
DefInt(SQLITE_CHANGESETAPPLY_IGNORENOOP);
DefInt(SQLITE_CHANGESET_DATA);
DefInt(SQLITE_CHANGESET_NOTFOUND);
@@ -638,7 +614,6 @@ const char * sqlite3_wasm_enum_json(void){
DefInt(SQLITE_FCNTL_CKPT_START);
DefInt(SQLITE_FCNTL_EXTERNAL_READER);
DefInt(SQLITE_FCNTL_CKSM_FILE);
DefInt(SQLITE_FCNTL_RESET_CACHE);
} _DefGroup;
DefGroup(flock) {
@@ -1207,7 +1182,7 @@ const char * sqlite3_wasm_enum_json(void){
** method, SQLITE_MISUSE is returned, else the result of the xDelete()
** call is returned.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_vfs_unlink(sqlite3_vfs *pVfs, const char *zName){
int rc = SQLITE_MISUSE /* ??? */;
if( 0==pVfs && 0!=zName ) pVfs = sqlite3_vfs_find(0);
@@ -1225,7 +1200,7 @@ int sqlite3_wasm_vfs_unlink(sqlite3_vfs *pVfs, const char *zName){
** defaulting to "main" if zDbName is 0. Returns 0 if no db with the
** given name is open.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
sqlite3_vfs * sqlite3_wasm_db_vfs(sqlite3 *pDb, const char *zDbName){
sqlite3_vfs * pVfs = 0;
sqlite3_file_control(pDb, zDbName ? zDbName : "main",
@@ -1248,7 +1223,7 @@ sqlite3_vfs * sqlite3_wasm_db_vfs(sqlite3 *pDb, const char *zDbName){
** Returns 0 on success, an SQLITE_xxx code on error. Returns
** SQLITE_MISUSE if pDb is NULL.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_reset(sqlite3 *pDb){
int rc = SQLITE_MISUSE;
if( pDb ){
@@ -1279,7 +1254,7 @@ int sqlite3_wasm_db_reset(sqlite3 *pDb){
** sqlite3_wasm_db_serialize() is arguably the better way to achieve
** this.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_export_chunked( sqlite3* pDb,
int (*xCallback)(unsigned const char *zOut, int n) ){
sqlite3_int64 nSize = 0;
@@ -1330,7 +1305,7 @@ int sqlite3_wasm_db_export_chunked( sqlite3* pDb,
** If `*pOut` is not NULL, the caller is responsible for passing it to
** sqlite3_free() to free it.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_serialize( sqlite3 *pDb, const char *zSchema,
unsigned char **pOut,
sqlite3_int64 *nOut, unsigned int mFlags ){
@@ -1387,7 +1362,7 @@ int sqlite3_wasm_db_serialize( sqlite3 *pDb, const char *zSchema,
** portability, so that the API can still work in builds where BigInt
** support is disabled or unavailable.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_vfs_create_file( sqlite3_vfs *pVfs,
const char *zFilename,
const unsigned char * pData,
@@ -1471,7 +1446,7 @@ int sqlite3_wasm_vfs_create_file( sqlite3_vfs *pVfs,
** NUL-terminated pointer to that string. It is up to the caller to
** use sqlite3_wasm_pstack_restore() to free the returned pointer.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
char * sqlite3_wasm_kvvfsMakeKeyOnPstack(const char *zClass,
const char *zKeyIn){
assert(sqlite3KvvfsMethods.nKeySize>24);
@@ -1490,7 +1465,7 @@ char * sqlite3_wasm_kvvfsMakeKeyOnPstack(const char *zClass,
** Returns the pointer to the singleton object which holds the kvvfs
** I/O methods and associated state.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
sqlite3_kvvfs_methods * sqlite3_wasm_kvvfs_methods(void){
return &sqlite3KvvfsMethods;
}
@@ -1505,7 +1480,7 @@ sqlite3_kvvfs_methods * sqlite3_wasm_kvvfs_methods(void){
** sqlite3_vtab_config(), or SQLITE_MISUSE if the 2nd arg is not a
** valid value.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_vtab_config(sqlite3 *pDb, int op, int arg){
switch(op){
case SQLITE_VTAB_DIRECTONLY:
@@ -1525,7 +1500,7 @@ int sqlite3_wasm_vtab_config(sqlite3 *pDb, int op, int arg){
** Wrapper for the variants of sqlite3_db_config() which take
** (int,int*) variadic args.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_config_ip(sqlite3 *pDb, int op, int arg1, int* pArg2){
switch(op){
case SQLITE_DBCONFIG_ENABLE_FKEY:
@@ -1556,7 +1531,7 @@ int sqlite3_wasm_db_config_ip(sqlite3 *pDb, int op, int arg1, int* pArg2){
** Wrapper for the variants of sqlite3_db_config() which take
** (void*,int,int) variadic args.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_config_pii(sqlite3 *pDb, int op, void * pArg1, int arg2, int arg3){
switch(op){
case SQLITE_DBCONFIG_LOOKASIDE:
@@ -1572,7 +1547,7 @@ int sqlite3_wasm_db_config_pii(sqlite3 *pDb, int op, void * pArg1, int arg2, int
** Wrapper for the variants of sqlite3_db_config() which take
** (const char *) variadic args.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_db_config_s(sqlite3 *pDb, int op, const char *zArg){
switch(op){
case SQLITE_DBCONFIG_MAINDBNAME:
@@ -1589,7 +1564,7 @@ int sqlite3_wasm_db_config_s(sqlite3 *pDb, int op, const char *zArg){
** Binding for combinations of sqlite3_config() arguments which take
** a single integer argument.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_config_i(int op, int arg){
return sqlite3_config(op, arg);
}
@@ -1601,7 +1576,7 @@ int sqlite3_wasm_config_i(int op, int arg){
** Binding for combinations of sqlite3_config() arguments which take
** two int arguments.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_config_ii(int op, int arg1, int arg2){
return sqlite3_config(op, arg1, arg2);
}
@@ -1613,7 +1588,7 @@ int sqlite3_wasm_config_ii(int op, int arg1, int arg2){
** Binding for combinations of sqlite3_config() arguments which take
** a single i64 argument.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_config_j(int op, sqlite3_int64 arg){
return sqlite3_config(op, arg);
}
@@ -1642,7 +1617,7 @@ int sqlite3_wasm_config_j(int op, sqlite3_int64 arg){
** Safari-specific quirk covered at
** https://sqlite.org/forum/info/e5b20e1feb37a19a.
**/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
void * sqlite3_wasm_ptr_to_sqlite3_free(void){
return (void*)sqlite3_free;
}
@@ -1672,7 +1647,7 @@ void * sqlite3_wasm_ptr_to_sqlite3_free(void){
** the virtual FS fails. In builds compiled without SQLITE_ENABLE_WASMFS
** defined, SQLITE_NOTFOUND is returned without side effects.
*/
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_init_wasmfs(const char *zMountPoint){
static backend_t pOpfs = 0;
if( !zMountPoint || !*zMountPoint ) zMountPoint = "/opfs";
@@ -1692,7 +1667,7 @@ int sqlite3_wasm_init_wasmfs(const char *zMountPoint){
return pOpfs ? 0 : SQLITE_NOMEM;
}
#else
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_init_wasmfs(const char *zUnused){
//emscripten_console_warn("WASMFS OPFS is not compiled in.");
if(zUnused){/*unused*/}
@@ -1702,51 +1677,51 @@ int sqlite3_wasm_init_wasmfs(const char *zUnused){
#if SQLITE_WASM_TESTS
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int sqlite3_wasm_test_intptr(int * p){
return *p = *p * 2;
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
void * sqlite3_wasm_test_voidptr(void * p){
return p;
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int64_t sqlite3_wasm_test_int64_max(void){
return (int64_t)0x7fffffffffffffff;
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int64_t sqlite3_wasm_test_int64_min(void){
return ~sqlite3_wasm_test_int64_max();
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int64_t sqlite3_wasm_test_int64_times2(int64_t x){
return x * 2;
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
void sqlite3_wasm_test_int64_minmax(int64_t * min, int64_t *max){
*max = sqlite3_wasm_test_int64_max();
*min = sqlite3_wasm_test_int64_min();
/*printf("minmax: min=%lld, max=%lld\n", *min, *max);*/
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
int64_t sqlite3_wasm_test_int64ptr(int64_t * p){
/*printf("sqlite3_wasm_test_int64ptr( @%lld = 0x%llx )\n", (int64_t)p, *p);*/
return *p = *p * 2;
}
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
void sqlite3_wasm_test_stack_overflow(int recurse){
if(recurse) sqlite3_wasm_test_stack_overflow(recurse);
}
/* For testing the 'string:dealloc' whwasmutil.xWrap() conversion. */
SQLITE_WASM_EXPORT
SQLITE_WASM_KEEP
char * sqlite3_wasm_test_str_hello(int fail){
char * s = fail ? 0 : (char *)sqlite3_malloc(6);
if(s){
@@ -1757,4 +1732,4 @@ char * sqlite3_wasm_test_str_hello(int fail){
}
#endif /* SQLITE_WASM_TESTS */
#undef SQLITE_WASM_EXPORT
#undef SQLITE_WASM_KEEP
+10 -22
View File
@@ -114,7 +114,7 @@
by all client code except that which tests this API. The `row`
property contains the row result in the form implied by the
`rowMode` option (defaulting to `'array'`). The `rowNumber` is a
1-based integer value incremented by 1 on each call into the
1-based integer value incremented by 1 on each call into th
callback.
At the end of the result set, the same event is fired with
@@ -122,17 +122,8 @@
the end of the result set has been reached. Note that the rows
arrive via worker-posted messages, with all the implications
of that.
Notable shortcomings:
- This API was not designed with ES6 modules in mind. Neither Firefox
nor Safari support, as of March 2023, the {type:"module"} flag to the
Worker constructor, so that particular usage is not something we're going
to target for the time being:
https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
*/
globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
// Inspired by: https://stackoverflow.com/a/52439530
if(1===arguments.length && 'function'===typeof arguments[0]){
const f = config;
@@ -169,7 +160,7 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
if(msgHandler && msgHandler.onrow){
msgHandler.onrow(ev);
return;
}
}
if(config.onunhandled) config.onunhandled(arguments[0]);
else err("sqlite3Worker1Promiser() unhandled worker message:",ev);
return;
@@ -245,13 +236,10 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
return p;
};
}/*sqlite3Worker1Promiser()*/;
globalThis.sqlite3Worker1Promiser.defaultConfig = {
self.sqlite3Worker1Promiser.defaultConfig = {
worker: function(){
//#if target=es6-bundler-friendly
return new Worker("sqlite3-worker1-bundler-friendly.mjs",{
type: 'module' /* Noting that neither Firefox nor Safari suppor this,
as of this writing. */
});
return new Worker("sqlite3-worker1.js");
//#else
let theJs = "sqlite3-worker1.js";
if(this.currentScript){
@@ -259,17 +247,17 @@ globalThis.sqlite3Worker1Promiser.defaultConfig = {
src.pop();
theJs = src.join('/')+'/' + theJs;
//sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs);
}else if(globalThis.location){
//sqlite3.config.warn("promiser globalThis.location =",globalThis.location);
const urlParams = new URL(globalThis.location.href).searchParams;
}else{
//sqlite3.config.warn("promiser self.location =",self.location);
const urlParams = new URL(self.location.href).searchParams;
if(urlParams.has('sqlite3.dir')){
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
}
}
return new Worker(theJs + globalThis.location.search);
return new Worker(theJs + self.location.search);
//#endif
}.bind({
currentScript: globalThis?.document?.currentScript
currentScript: self?.document?.currentScript
}),
onerror: (...args)=>console.error('worker1 promiser error',...args)
};
+9 -9
View File
@@ -31,20 +31,20 @@
- `sqlite3.dir`, if set, treats the given directory name as the
directory from which `sqlite3.js` will be loaded.
*/
//#if target=es6-bundler-friendly
import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
//#else
"use strict";
{
const urlParams = globalThis.location
? new URL(self.location.href).searchParams
: new URLSearchParams();
(()=>{
//#if target=es6-bundler-friendly
importScripts('sqlite3.js');
//#else
const urlParams = new URL(self.location.href).searchParams;
let theJs = 'sqlite3.js';
if(urlParams.has('sqlite3.dir')){
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
}
//console.warn("worker1 theJs =",theJs);
importScripts(theJs);
}
//#endif
sqlite3InitModule().then(sqlite3 => sqlite3.initWorker1API());
sqlite3InitModule().then((sqlite3)=>{
sqlite3.initWorker1API();
});
})();
+5 -5
View File
@@ -45,8 +45,8 @@
Intended usage:
```
globalThis.WhWasmUtilInstaller(appObject);
delete globalThis.WhWasmUtilInstaller;
self.WhWasmUtilInstaller(appObject);
delete self.WhWasmUtilInstaller;
```
Its global-scope symbol is intended only to provide an easy way to
@@ -171,7 +171,7 @@
https://fossil.wanderinghorse.net/r/jaccwabbyt/file/common/whwasmutil.js
*/
globalThis.WhWasmUtilInstaller = function(target){
self.WhWasmUtilInstaller = function(target){
'use strict';
if(undefined===target.bigIntEnabled){
target.bigIntEnabled = !!self['BigInt64Array'];
@@ -2194,7 +2194,7 @@ globalThis.WhWasmUtilInstaller = function(target){
Error handling is up to the caller, who may attach a `catch()` call
to the promise.
*/
globalThis.WhWasmUtilInstaller.yawl = function(config){
self.WhWasmUtilInstaller.yawl = function(config){
const wfetch = ()=>fetch(config.uri, {credentials: 'same-origin'});
const wui = this;
const finalThen = function(arg){
@@ -2240,4 +2240,4 @@ globalThis.WhWasmUtilInstaller.yawl = function(config){
.then(finalThen);
};
return loadWasm;
}.bind(globalThis.WhWasmUtilInstaller)/*yawl()*/;
}.bind(self.WhWasmUtilInstaller)/*yawl()*/;
+2 -2
View File
@@ -9,7 +9,7 @@
* May you share freely, never taking more than you give.
***********************************************************************
Demonstration of the sqlite3 Worker API #1 Promiser: a Promise-based
proxy for for the sqlite3 Worker #1 API.
*/
@@ -81,7 +81,7 @@
});
logHtml('',
"Sending 'open' message and waiting for its response before continuing...");
await wtest('open', {
filename: dbFilename,
simulateError: 0 /* if true, fail the 'open' */,
+2 -2
View File
@@ -62,7 +62,7 @@
return this.queue.shift();
}
};
const testCount = ()=>{
logHtml("","Total test count:",T.counter+". Total time =",(performance.now() - startTime),"ms");
};
@@ -74,7 +74,7 @@
(ev.workerRespondTime - ev.workerReceivedTime),"ms.",
"Round-trip event time =",
(performance.now() - ev.departureTime),"ms.",
(evd.errorClass ? evd.message : "")//, JSON.stringify(evd)
(evd.errorClass ? ev.message : "")//, JSON.stringify(evd)
);
};
+1 -2
View File
@@ -70,8 +70,7 @@ STRIP_K1.js := $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) \
$(sqlite3-worker1-bundler-friendly.js) $(sqlite3-worker1-promiser-bundler-friendly.js)
# STRIP_K2.js = list of JS files which need to be passed through
# $(bin.stripcomments) with two -k flags.
STRIP_K2.js := $(sqlite3.js) $(sqlite3.mjs) \
$(sqlite3-bundler-friendly.mjs) $(sqlite3-node.mjs)
STRIP_K2.js := $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs)
########################################################################
# dist: create the end-user deliverable archive.
#
-23
View File
@@ -1,23 +0,0 @@
/*
** If the canonical build process finds the file
** sqlite3_wasm_extra_init.c in the main wasm build directory, it
** arranges to include that file in the build of sqlite3.wasm and
** defines SQLITE_EXTRA_INIT=sqlite3_wasm_extra_init.
**
** The C file must define the function sqlite3_wasm_extra_init() with
** this signature:
**
** int sqlite3_wasm_extra_init(const char *)
**
** and the sqlite3 library will call it with an argument of NULL one
** time during sqlite3_initialize(). If it returns non-0,
** initialization of the library will fail.
*/
#include "sqlite3.h"
#include <stdio.h>
int sqlite3_wasm_extra_init(const char *z){
fprintf(stderr,"%s: %s()\n", __FILE__, __func__);
return 0;
}
+1 -1
View File
@@ -19,7 +19,7 @@
*/
'use strict';
globalThis.Jaccwabyt = function StructBinderFactory(config){
self.Jaccwabyt = function StructBinderFactory(config){
/* ^^^^ it is recommended that clients move that object into wherever
they'd like to have it and delete the self-held copy ("self" being
the global window or worker object). This API does not require the
+11 -12
View File
@@ -1189,6 +1189,17 @@ self.sqlite3InitModule = sqlite3InitModule;
const stack = wasm.pstack.pointer;
try {
const [pCur, pHi] = wasm.pstack.allocChunks(2,'i64');
rc = capi.sqlite3_db_status(this.db, capi.SQLITE_DBSTATUS_LOOKASIDE_USED,
pCur, pHi, 0);
T.assert(0===rc);
if(!wasm.peek32(pCur)){
rc = capi.sqlite3_db_config(this.db, capi.SQLITE_DBCONFIG_LOOKASIDE,
0, 4096, 12);
T.assert(0 === rc);
}else{
console.debug("Cannot test db_config(SQLITE_DBCONFIG_LOOKASIDE)",
"while lookaside memory is in use.");
}
wasm.poke32([pCur, pHi], 0);
let [vCur, vHi] = wasm.peek32(pCur, pHi);
T.assert(0===vCur).assert(0===vHi);
@@ -1452,18 +1463,6 @@ self.sqlite3InitModule = sqlite3InitModule;
T.assert(e instanceof sqlite3.SQLite3Error)
.assert(0==e.message.indexOf('Cannot prepare empty'));
}
counter = 0;
db.exec({
// Check for https://sqlite.org/forum/forumpost/895425b49a
sql: "pragma table_info('t')",
rowMode: 'object',
callback: function(row){
++counter;
T.assert(row.name==='a' || row.name==='b');
}
});
T.assert(2===counter);
})/*setup table T*/
////////////////////////////////////////////////////////////////////
+116 -121
View File
@@ -1,11 +1,11 @@
C Modify\sthe\sOP_IsType\sopcode\sso\sthat\sit\sdoes\snot\sneed\sto\sdistinguish\sbetween\nNaN\sand\sother\sfloating\spoint\svalues.
D 2023-03-29T00:05:54.101
C A\ssimpler\sfix\sto\sthe\sproblem\sdescribed\sby\n[forum:/forumpost/d1387c3979c7f557|forum\sthread\sd1387c3979c7f557].\nSee\sspecifically\s[forum:/forumpost/2d2ddc5b70c31de5|post\s2d2ddc5b70c31de5].\nThis\sapproach\sis\ssimpler,\sbut\sit\salso\sruns\sa\slittle\sslower.
D 2023-02-24T01:37:57.650
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in 764f2e3e8fb4ae1c8dfe03e65b2b3b01bd1fc57edf78ec2cab3a1301e90e1905
F Makefile.in 594f07f8829020a45d825234edf14046544b5bf6bc0057a9d5b83b58686b1c46
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc ada3466f8f0112a8baead4d6cc2a99bf544d228958baae12ca35a3ee5755c806
F Makefile.msc b0026b61d1242add00c28dbe169271a763fffcb3af6762bcdbeb20c3efe6a69f
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
F VERSION 17f95ae2fdf21f0e9575eb0b0511ea63f15d71dfff431b21c2b4adbfa70cfbbf
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -22,7 +22,7 @@ F autoconf/configure.ac ec7fa914c5e74ff212fe879f9bb6918e1234497e05facfb641f30c4d
F autoconf/tea/Makefile.in 106a96f2f745d41a0f6193f1de98d7355830b65d45032c18cd7c90295ec24196
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
F autoconf/tea/configure.ac e6a7f2abf7a94b5dae00713ad6b3bebc59b878e2705607589830792c61d2ca38
F autoconf/tea/configure.ac d1eaa72f4d202ca106f4b2762733709d3f89a877da2e385a57881c4ad0427be7
F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb
F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523
F autoconf/tea/pkgIndex.tcl.in b9eb6dd37f64e08e637d576b3c83259814b9cddd78bec4af2e5abfc6c5c750ce
@@ -76,7 +76,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154
F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c 33d2d0db4dd4e7a7a7e9a7f790414293277f9e7682a2fd9d61c713bfc37cd8b6
F ext/fts3/fts3_write.c 4fb644df0ff840267e47a724286c7a1fa5540273a7ce15756dd5913a101ec302
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674
@@ -87,7 +87,7 @@ F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a0
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
F ext/fts5/fts5.h c132a9323f22a972c4c93a8d5a3d901113a6e612faf30ca8e695788438c5ca2a
F ext/fts5/fts5Int.h c0d46e399e345e35985b72a1c1af025973bfaa5b1e3563b0ce3bb0ce144a7ca3
F ext/fts5/fts5_aux.c 572d5ec92ba7301df2fea3258576332f2f4d2dfd66d8263afd157d9deceac480
F ext/fts5/fts5_aux.c f558e1fb9f0f86a4f7489e258c162e1f947de5ff2709087fbb465fddb7092f98
F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b729225eeaf6a5
F ext/fts5/fts5_config.c 501e7d3566bc92766b0e11c0109a7c5a6146bc41144195459af5422f6c2078aa
F ext/fts5/fts5_expr.c 48e8e45261c6030cf5c77f606217a22722b1a4d0b34e2ba6cbfc386581627989
@@ -110,7 +110,7 @@ F ext/fts5/test/fts5ab.test 9205c839332c908aaad2b01ab8670ece8b161e8f2ec8a9fabf18
F ext/fts5/test/fts5ac.test a7aa7e1fefc6e1918aa4d3111d5c44a09177168e962c5fd2cca9620de8a7ed6d
F ext/fts5/test/fts5ad.test e8cf959dfcd57c8e46d6f5f25665686f3b6627130a9a981371dafdf6482790de
F ext/fts5/test/fts5ae.test 1142d16d9cc193894dc13cc8f9c7a8a21411ac61b5567a878514df6f9f0d7bb7
F ext/fts5/test/fts5af.test 2329b6c6e6e9243371022dd9439892ff1850b590ae9ce073e3a83eefaf993a81
F ext/fts5/test/fts5af.test bea75184c0e63631b552c20ebe4a631699f357e00a2059c92538f7aeece8291e
F ext/fts5/test/fts5ag.test 7816f25a0707578f08145ab539fc0ca025f8951e788b28a6a18a06b2099469dd
F ext/fts5/test/fts5ah.test 2f047dfe89dc8611fa53e3d8bfc453b79cff037aa423c8d171e91e645745aa2c
F ext/fts5/test/fts5ai.test bc97e4758cc93e06bf851d61c98fdf4e8b8f8315ee28a84fb15f916360856414
@@ -365,10 +365,9 @@ F ext/rbu/rbuvacuum4.test ffccd22f67e2d0b380d2889685742159dfe0d19a3880ca3d2d1d69
F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac9659c15ea
F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304
F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055
F ext/recover/dbdata.c 501227169803bfafb34cd8ec7fffda6e64c1a282ac33315d3a096076c5928feb
F ext/recover/dbdata.c dc25628e405c86936c597e28f3e6f56a257029c3034c5ef7f6b10f7c02f41018
F ext/recover/recover1.test 2072993624d5e32fef20ae03b17fc06c02bcb344421fe17bb329b24d2a51e647
F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a272ce4c229cefd85a
F ext/recover/recoverbuild.test a6f05273ff5fe517afd166444597c70cb97033e7f58496433a4428a1ecb5d79f
F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e
F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49
F ext/recover/recovercorrupt2.test 74bef7dd2d7dd4856f3da21be6e213d27da44827e0f5f0946ca0325b46d163ed
@@ -400,7 +399,7 @@ F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e130
F ext/rtree/rtree3.test 272594f88c344e973864008bbe4c71fd3a41a264c097d568593ee7886d83d409
F ext/rtree/rtree4.test 304de65d484540111b896827e4261815e5dca4ce28eeecd58be648cd73452c4b
F ext/rtree/rtree5.test 49c9041d713d54560b315c2c7ef7207ee287eba1b20f8266968a06f2e55d3142
F ext/rtree/rtree6.test 2f5ffc69670395c1a84fad7924e2d49e82a25460c5293fb1e54e1aa906f04945
F ext/rtree/rtree6.test 9ce3691c1aac43070a9f194f0ebf54372db346c5a82241fd11b525ed53ce9f3f
F ext/rtree/rtree7.test c8fb2e555b128dd0f0bdb520c61380014f497f8a23c40f2e820acc9f9e4fdce5
F ext/rtree/rtree8.test 2d99006a1386663978c9e1df167554671e4f711c419175b39f332719deb1ce0e
F ext/rtree/rtree9.test fd3c9384ef8aabbc127b3878764070398f136eebc551cd20484b570f2cc1956a
@@ -432,7 +431,7 @@ F ext/session/changeset.c 7a1e6a14c7e92d36ca177e92e88b5281acd709f3b726298dc34ec0
F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8fac9cd8b0b24aa
F ext/session/changesetfuzz1.test 2e1b90d888fbf0eea5e1bd2f1e527a48cc85f8e0ff75df1ec4e320b21f580b3a
F ext/session/session1.test e94f764fbfb672147c0ef7026b195988133b371dc8cf9e52423eba6cad69717e
F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f
F ext/session/session2.test 7f53d755d921e0baf815c4258348e0ed460dfd8a772351bca5ad3ccbb1dc786e
F ext/session/session3.test ce9ce3dfa489473987f899e9f6a0f2db9bde3479
F ext/session/session4.test 6778997065b44d99c51ff9cece047ff9244a32856b328735ae27ddef68979c40
F ext/session/session5.test 716bc6fafd625ce60dfa62ae128971628c1a1169
@@ -445,73 +444,70 @@ F ext/session/sessionC.test f8a5508bc059ae646e5ec9bdbca66ad24bc92fe99fda5790ac57
F ext/session/sessionD.test 4f91d0ca8afc4c3969c72c9f0b5ea9527e21de29039937d0d973f821e8470724
F ext/session/sessionE.test b2010949c9d7415306f64e3c2072ddabc4b8250c98478d3c0c4d064bce83111d
F ext/session/sessionF.test d37ed800881e742c208df443537bf29aa49fd56eac520d0f0c6df3e6320f3401
F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d085eb8efdad0a
F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859
F ext/session/session_common.tcl db0dda567c75950604072251744e9a6ad5795a3009963c44eb8510f23a8cda64
F ext/session/sessionG.test 3828b944cd1285f4379340fd36f8b64c464fc84df6ff3ccbc95578fd87140b9c
F ext/session/sessionH.test b17afdbd3b8f17e9bab91e235acf167cf35485db2ab2df0ea8893fbb914741a4
F ext/session/session_common.tcl f613174665456b2d916ae8df3e5735092a1c1712f36f46840172e9a01e8cc53e
F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3
F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee
F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf
F ext/session/sessionat.test 46fd847f6ed194ebb7ebef9fe68b2e2ec88d9c2383a6846cddc5604b35f1d4ae
F ext/session/sessionbig.test 890ade19e3f80f3d3a3e83821ff79c5e2af906a67ecb5450879f0015cadf101e
F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec
F ext/session/sessionfault.test 573bf027fb870d57bd4e7cf50822a3e4b17b2b923407438747aaa918dec57a09
F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576dc79ed344c46fbf41c
F ext/session/sessionfault.test da273f2712b6411e85e71465a1733b8501dbf6f7
F ext/session/sessionfault2.test dd593f80b6b4786f7adfe83c5939620bc505559770cc181332da26f29cddd7bb
F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25
F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09
F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7
F ext/session/sessionnoop2.test 5c9a882219e54711c98dccd2fd81392f189a59325e4fb5d8ed25e33a0c2f0ba2
F ext/session/sessionrebase.test ccfa716b23bd1d3b03217ee58cfd90c78d4b99f53e6a9a2f05e82363b9142810
F ext/session/sessionsize.test 6f644aff31c7f1e4871e9ff3542766e18da68fc7e587b83a347ea9820a002dd8
F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c
F ext/session/sessionstat1.test 218d351cf9fcd6648f125a26b607b140310160184723c2666091b54450a68fb5
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3session.c 1795263b72c1a17e48e95a131a69543af3fa31aa8e81271c7c5cb0911f063604
F ext/session/sqlite3session.h c367c3043dbb57f69cca35258ebbeadb24e8738980b1a1ae1e281c1b0fac3989
F ext/session/test_session.c b55a669a2150eb7c491b8b42c69a3eed9bc895cf5fea371a2c813b9618f72163
F ext/session/sqlite3session.c 13bdc093416cd284d4075328dd8599eb59bcedc23a21d561a15d78805c5866bf
F ext/session/sqlite3session.h 0907de79bc13a2e3af30a6dc29acc60792a3eaf7d33d44cf52500d0f3c2b2171
F ext/session/test_session.c 2de472b4d7e62e85ca1992094612725e2450a77dbf7523db64de94197812462e
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 38700d5074af690f004e4e5f3533164ab49693b9d0832929c4ecf97a0bc09494
F ext/wasm/GNUmakefile 5a8dc82f5384a3deaaee777ed7eefd3c8cbcd0efe797a66925537d2b975af305
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54
F ext/wasm/api/extern-post-js.c-pp.js 393ab78b807da94096eae1a68bfddb999a2299936a185d910162fe87a57a9a3a
F ext/wasm/api/extern-post-js.c-pp.js 44a3a169f55a8dba42cf688954b2625b9b9e6174f2ff02d4918a2ca8c3beab7f
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
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-prologue.js 461ffa5a95f4c1935b3970a58790d3cdca62b16e9b9a6a8d993a2a47d7561f51
F ext/wasm/api/sqlite3-api-worker1.js 40a5b1813fcbe789f23ae196c833432c8c83e7054d660194ddfc51eab1c5b9bf
F ext/wasm/api/pre-js.c-pp.js 9ece5de1bb0509f0a8a360712fcc9c1291b9516c0be5bd66acedd6edbcec37a1
F ext/wasm/api/sqlite3-api-cleanup.js 2d63eb84267a1d15ce002e083d6396a521471da8af3afa76846d50f39a54d65e
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js 9b50c188513c70438a497914089cfeac79b6ac2d73501775538f9e467325ea15
F ext/wasm/api/sqlite3-api-prologue.js 5cc817b67a774bfa3c47d4c2fa484b10b24b5529a66094b35546f3ebba1ef646
F ext/wasm/api/sqlite3-api-worker1.js 9551f04cdfcde354e5a6ccb48951e007d618abb4e95758297b7fd44ccffdf89f
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js 70914ae97784d3028150bbf252e07a423056c42cc345903c81b5fae661ce512f
F ext/wasm/api/sqlite3-v-helper.js e5c202a9ecde9ef818536d3f5faf26c03a1a9f5192b1ddea8bdabf30d75ef487
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 5cb63f847737ded723d0bdf9b3313e8f7deb0bbfd0082dedde540991edde155b
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 0dfddd0fcd354817c3d5887decebb8a293cbb926c2639ba09b995a524f1085fb
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c e04e863be7c3a58aa144a463770c1b68ce69f7cfc9e1a5d6397a67877acaf006
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 2710a06a59620c6bf7ce298ab1fb6c9ce825b9f9379728b74c486db6613beecc
F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75
F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js c5ac33e39f21a3481812d7333ca6e18853640d423a01960ca8dbc6e7c5c3c21c
F ext/wasm/api/sqlite3-worker1.c-pp.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0
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/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
F ext/wasm/common/whwasmutil.js 749a1f81f85835e9a384e9706f2a955a7158f2b8cc9da33f41105cac7775a305
F ext/wasm/common/whwasmutil.js cad510071533dbe47787bce53f2e0dcab5b05d2dde1dbe477d8fb04e00d4e8c4
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e
F ext/wasm/demo-jsstorage.js 44e3ae7ec2483b6c511384c3c290beb6f305c721186bcf5398ca4e00004a06b8
F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98ab22f5786620b3354ed15f
F ext/wasm/demo-worker1-promiser.js 51b02509a109e82f623fb4c900c8b48b9a77cc13fbd038396f9a083b86593ae3
F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/demo-worker1.js 2c7794d8bc4ab9ecf9cdc2c15de940b11a006942226e441ea41edd458dfc0a26
F ext/wasm/dist.make 451fb1b732257849f6e898d2a862512a0401500ed369ef53bdfeddf9c77bc3b9
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa
F ext/wasm/dist.make f55f9c9e1980ea11a59964e59535c66175a17f004d1c2e274522c3366b3a084a
F ext/wasm/fiddle.make dbe36b90b8907ae28ecb9c0e9fd8389dbdaecf117ea4fb2ea33864bdfa498a94
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js 163d6139a93fab4bcb72064923df050d4e7c0ff0d8aa061ce8776a6e75da8a10
@@ -519,7 +515,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 06f2ef1ad640c26c593def3d960336e9bb789819b920516480895c38ed5f58fa
F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb
F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
@@ -535,7 +531,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html 258d08f1ba9cc2d455958751e26be833893cf9ff7853e9436e593e1f778a386b
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
F ext/wasm/tester1.c-pp.js 587a18db0f794c594eb0fade37c92af3e2370501576bb08dafd8ed7d009b6516
F ext/wasm/tester1.c-pp.js 9844c675bd1f2353deabd7847d10c4fa55ff78a5c773073a239197d186123de7
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
@@ -558,37 +554,37 @@ F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2
F src/alter.c 3ca2f449c890f8b86ec9e06f0c4fccf0648941c3308a16904cb2852227db83f7
F src/analyze.c 8230fc1f3ddcf5492d258f28afcd36026c0de2f35cbbee22a41eed4baaf26148
F src/analyze.c b597c382f23b19cce563211181e84b7e8edddd6871d5f630bbadedb57e562806
F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39
F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca
F src/btree.c 47def1b43b10fcffd927ef6e17c9382a39c898af9eb98318460253ddb5e4a07f
F src/btree.c 2f012aea074de6319c191cbf5c45034de79bf1c762826e381b1cf75421d8d831
F src/btree.h aa354b9bad4120af71e214666b35132712b8f2ec11869cb2315c52c81fad45cc
F src/btreeInt.h 06bb2c1a07172d5a1cd27a2a5d617b93b1e976c5873709c31964786f86365a6e
F src/build.c 8357d6ca9a8c9afc297c431df28bc2af407b47f3ef2311875276c944b30c4d54
F src/build.c c55ab6d1b089ceef57160e840f05f692955ac90944c3d04fcf01d97fd7bfd08d
F src/callback.c 4cd7225b26a97f7de5fee5ae10464bed5a78f2adefe19534cc2095b3a8ca484a
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 20507cc0b0a6c19cd882fcd0eaeda32ae6a4229fb4b024cfdf3183043d9b703d
F src/date.c f21815ca7172ce073db3163ac54c8d9f2841077165c1a6123b4d1c376a0c7ec7
F src/dbpage.c d47549716549311f79dc39fe5c8fb19390a6eb2c960f8e37c89a9c4de0c1052e
F src/dbstat.c ec92074baa61d883de58c945162d9e666c13cd7cf3a23bc38b4d1c4d0b2c2bef
F src/delete.c a9c6d3f51c0a31e9b831e0a0580a98d702904b42d216fee530940e40dec34873
F src/expr.c 98ba98271bbe55661d8630cc60083344b2c1713553e46b69afd7ff9f85a30e29
F src/delete.c 86573edae75e3d3e9a8b590d87db8e47222103029df4f3e11fa56044459b514e
F src/expr.c 2e5e67e800c9416996df52409746a2f3c7dadf5d38b5a367ce379b239e3f40c8
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 722f20779f5342a787922deded3628d8c74b5249cab04098cf17ee2f2aaff002
F src/func.c d187be57a886ddf4e6b7ef584a494361899be3df5eee6d4a747b68ff4aff4122
F src/global.c 428d2580a1cdf5dbe1f356d1feab83710ae0cc862ece0fb57bc8259e43838c74
F src/global.c e06ff8e0acd85aec13563c9ecb44fbbf38232ccf73594998fd880b92d619594b
F src/hash.c c6af5f96a7a76d000f07c5402c48c318c2566beecdee9e78b9d9f60ce7119565
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
F src/hwtime.h b638809e083b601b618df877b2e89cb87c2a47a01f4def10be4c4ebb54664ac7
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c a8de1db43335fc4946370a7a7e47d89975ad678ddb15078a150e993ba2fb37d4
F src/json.c 9e3a6acf9e4fa8bb6c84a38538ed9c2f9ad09f106910ef0e9cc68e19c8dc4fc8
F src/insert.c 1b11a2e33ee52db93c02fddac67e39d00161d61b69fac2675b82f2aa68c1b61c
F src/json.c c85ed6fce06f43d414b0d7fff64749d43a0dbd1067123ee407bd3a0752454161
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c be5af440f3192c58681b5d43167dbca3ccbfce394d89faa22378a14264781136
F src/main.c 09bc5191f75dc48fc4dfddda143cb864c0c3dbc3297eb9a9c8e01fea58ff847d
F src/loadext.c b04eb648cedc45efe4298e1ef439ac4f0096ae27b5f01accb0a1f49d57789128
F src/main.c f5ed7b748d7e54b96ac577a9d87af9461f13f092bbe684d473448010333402dc
F src/malloc.c 47b82c5daad557d9b963e3873e99c22570fb470719082c6658bf64e3012f7d23
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -614,28 +610,28 @@ F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 39af8ff7c73a991f61f4d1e3a6f8f98b1c8e29144723507822774cac5e6ee0b5
F src/pager.h f82e9844166e1585f5786837ddc7709966138ced17f568c16af7ccf946c2baa3
F src/parse.y 424e49ed8fc6c907920db9be5a13a75ed43811e1ea8dd21b0fa9ef97f083dc6b
F src/pcache.c 842410539b544e12d5fccfcf29890782f46a58f227a77bc0bd76243799662c0c
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/parse.y 960d2da92a23f8ba2ca22748a51bd75ee2c575564f2cbc59f119640e7f5b4c5d
F src/pcache.c f4268f7f73c6a3db12ce22fd25bc68dc42315d19599414ab1207d7cf32f79197
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c dee95e3cd2b61e6512dc814c5ab76d5eb36f0bfc9441dbb4260fccc0d12bbddc
F src/pragma.c 2e3413d4509bbae184c0489ef5855267e7a0c1f2c7bc1986b44daf550614adc8
F src/pragma.c 82d5090a35eac75876d3b41f48d06b2370553c9576bf2942233c462e03eb94c9
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c ce87a08cfddd45a147150db34190b1986f2d4a0e0828858cb6bd908c78fb02e3
F src/printf.c 7eac1a9896a80697e03e08963e210830532ae2ff610e16c193e95af007ca5623
F src/printf.c 91836661dfe93303389bbb5a9c41488bba528e0e93ba89df1b8581fcb92aa205
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
F src/resolve.c d62c5665279cc7485f9d45b5e20911cc7b19c203f268321a90d05d74f4725750
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 83812448cf5a645f37d79c43fa92d38d7a9f7790d95f7ac09ac02b4064810bd2
F src/shell.c.in d80b53a9ec0a43ac0157fc54d667cb49fb6dd2229558135530feab2fc04b909d
F src/sqlite.h.in f01033703156615566bb329144d736a37fc35a278049db91127782a9c799b938
F src/select.c a6a5cc0bbb97be616a2608cb5d063b6635b920ecd6b7b3445cde88597daf3542
F src/shell.c.in 6f36f5ca05f1bebf74935a7fcf2dce983016e807a09cbd752a673583ad7da087
F src/sqlite.h.in 662a2fa083d093896b92560c871dea6d86792b49dc4bf7b4e8dbeca8e7171488
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
F src/sqliteInt.h 2a3331b16b70b0b56c65574bf3e4f749ccf493787ca6550a29dc389cad28bb34
F src/sqliteInt.h 25f38ade2d93828231d6cd8614f635c0b084bee004360d970542861ad2e3e3d8
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 8522a04fb9c84faa1d80354430ae0ee9349727a3a4b32e3cfe39b9be8324cabd
F src/test1.c 74d87bbc29954c239fdcd7c0c3dd472c0eb9761c7289b85389f322233932780a
F src/test1.c 29ab8aca939818a61bf791e4ff5d45df6da30940c0980dcf502562b925de4e05
F src/test2.c 827446e259a3b7ab949da1542953edda7b5117982576d3e6f1c24a0dd20a5cef
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F src/test4.c 4533b76419e7feb41b40582554663ed3cd77aaa54e135cf76b3205098cd6e664
@@ -689,31 +685,31 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b
F src/treeview.c fccf3b8c517c1f55cb380c1522febe6921fcb2bd800c16c78cab571d0eb0ccbd
F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0
F src/update.c 3f4fb5ad7c9b48d7911974d6579192bb3a6c27f46140b6cbb9139cc8a77b8691
F src/trigger.c 5e68b790f022b8dafbfb0eb244786512a95c9575fc198719d2557d73e5795858
F src/update.c f118e51768d2c1309e3c81e9f91141b22b8a1339cbc5969b1b2d810feaa25b22
F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c 3ff7bc2b48dd425b1448304bb86273b05da1621f136d51dbb9789f8803559a1f
F src/vacuum.c 84ce7f01f8a7a08748e107a441db83bcec13970190ddcb0c9ff522adbc1c23fd
F src/vdbe.c 2fb5cace3431d56e866ae5abbbba2700a18e15b57abc0f38f9d6e59fb2107d4f
F src/vdbe.c 0bf4804f6e9cae872502aa4533a62ba3f6e97ee28523302deb27f9c990b5f44f
F src/vdbe.h 73b904a6b3bb27f308c6cc287a5751ebc7f1f89456be0ed068a12b92844c6e8c
F src/vdbeInt.h a4147a4ddf613cb1bcb555ace9e9e74a9c099d65facd88155f191b1fb4d74cfb
F src/vdbeapi.c 40c47b1528d308a322203de21d2e0d711753257ed9771771b6129214b1d65932
F src/vdbeaux.c 0f5201346a83a35a08e833c3a03abe626119c07b7361c28bc6a259b98540f1d6
F src/vdbeaux.c 3f9e3b6585e7434aa11300169dd66ddf0fc963a0c6f7940bdc058335dadeb353
F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd
F src/vdbemem.c cbd2305d6444dc0aa3ab0dbe8f45ca5166da6f5a9bb6402be9739b6443a83fd0
F src/vdbemem.c 0388576b7cf0be13ce14b9e3b8aa90b8a1b923b60321d0242131ae0b5732b43b
F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac
F src/vtab.c 4516e9fecff8d4f353132be0468bc6424b102937c50c52e01fd9a0a9e9e34ca5
F src/vtab.c a39f6ed161f16a84ff445af9dba4776b2cf0898be08a33bee8e1128a66c0074b
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
F src/where.c 2bafa1b7d1969d28135e4e7978f578a550d0a5b9005bc5a9180146a3de126880
F src/where.c 38c36bb654b4172148aef3b295bbbc1342b52078cf20174f771c746caa98f69a
F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
F src/wherecode.c 9919e5a22f4b24dd96c49b8981484cbe6bbfcf466ff73ac40a06e1356aa8bf87
F src/whereexpr.c 1dfda1695e4480c24248157df55bb4d66c732dc8d14ac16b4f076bb15de93d63
F src/wherecode.c b82d0d33315e1526904b95155e55e61149c4462147668e1cc4567c812735eff1
F src/whereexpr.c a60a1f88650c561eded95c5affbe846cda71fac35033e1280f28e47934df33c8
F src/window.c 76a27cff9ea2ded0c2c3527187029259440fabcc4cc4c07b11d942c78494a614
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
@@ -753,7 +749,7 @@ F test/analyze8.test 29ef237d8a59b39cc31c3310134fefe96a690b195e3deed5ecb65283908
F test/analyze9.test 30e1cb99336045a384a11d97900720184333c88174b3b89bc07444ea39e7df19
F test/analyzeC.test 1111830ad355d29a294a5dda654dd5f6a8622c6a223a4f7b7b3d091df7a7a42b
F test/analyzeD.test 485f621cfd2ef0a8f8ac79672586651bfa495bd899db50461bb4b558400ab3c1
F test/analyzeE.test d2ec7921c162cdc33ac8e7eb01f9ebf78100610af7c94c8552bbf551de1fb397
F test/analyzeE.test 69d130f9ba78c9853dcd5a18317e81f462a72d704cec0c4c30afb220213acd29
F test/analyzeF.test 40b5cc3ad7b10e81020d7ca86f1417647ecfae7477cfd88acc5aa7ae1068f949
F test/analyzeG.test 623be33038c49648872746c8dd8b23b5792c08fef173c55e82f1b12fca259852
F test/analyzer1.test 459fa02c445ddbf0101a3bad47b34290a35f2e49
@@ -776,9 +772,9 @@ F test/auth2.test 9eb7fce9f34bf1f50d3f366fb3e606be5a2000a1
F test/auth3.test 76d20a7fa136d63bcfcf8bcb65c0b1455ed71078d81f22bcd0550d3eb18594ab
F test/autoanalyze1.test b9cc3f32a990fa56669b668d237c6d53e983554ae80c0604992e18869a0b2dec
F test/autoinc.test 997d6f185f138229dc4251583a1d04816423dddc2fc034871a01aeb1d728cb39
F test/autoindex1.test d34caffb0384003ee28eae87679214c029e9be4b332d9649a79e0b94ab70502c
F test/autoindex1.test cdc336e80cfd586c0e09426d58bec412db7527ca22dfabe88eab690e3acbb406
F test/autoindex2.test 12ef578928102baaa0dc23ad397601a2f4ecb0df
F test/autoindex3.test dcd6b2f8bed2be67b131e2e671f892e971d934e24fd00988952d0e0a67e24aa7
F test/autoindex3.test 2d13958a5617e987624a428d7aed91bf51f322b49b476e3573fadec697ce6da5
F test/autoindex4.test 5df39313526b6f22a26bd119bbd97ca69f28386ab3c671fc10568d921c41eb08
F test/autoindex5.test 2ee94f033b87ca0160e08d81034c507aff8e230df2627f0304fa309b2fee19a3
F test/autovacuum.test 00671369bbf96c6a49989a9425f5b78b94075d6a4b031e5e00000c2c32f365df
@@ -818,7 +814,7 @@ F test/bind2.test 918bc35135f4141809ead7585909cde57d44db90a7a62aef540127148f91aa
F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0
F test/bitvec.test 75894a880520164d73b1305c1c3f96882615e142
F test/blob.test e7ac6c7d3a985cc4678c64f325292529a69ae252
F test/bloom1.test cf613a27054bbaf61c5bfc440a5cfd3ff76798d0695f3fc5e5d1bbc819b8dab1
F test/bloom1.test 2785a190fcc2a5e170e5d38b08aca8ff0f3e3b4a74d47453d6ac1bd355180a6a
F test/boundary1.tcl 6421b2d920d8b09539503a8673339d32f7609eb1
F test/boundary1.test 66d7f4706ccdb42d58eafdb081de07b0eb42d77b
F test/boundary2.tcl e34ef4e930cf1083150d4d2c603e146bd3b76bcb
@@ -890,12 +886,12 @@ F test/corruptH.test 79801d97ec5c2f9f3c87739aa1ec2eb786f96454
F test/corruptI.test a17bbf54fdde78d43cf3cc34b0057719fd4a173a3d824285b67dc5257c064c7b
F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4
F test/corruptK.test 5b4212fe346699831c5ad559a62c54e11c0611bdde1ea8423a091f9c01aa32af
F test/corruptL.test b42978028afc5eefc8b51d8d7cd6a9344ba7362d7ed4511ee2070f56e06d5a1c
F test/corruptL.test 9d1a0055c8db19baccd12f22ac36a33ec7d63afb59e82eb30835aea8f89b94df
F test/corruptM.test 7d574320e08c1b36caa3e47262061f186367d593a7e305d35f15289cc2c3e067
F test/corruptN.test 7c099d153a554001b4fb829c799b01f2ea6276cbc32479131e0db0da4efd9cc4
F test/cost.test b11cdbf9f11ffe8ef99c9881bf390e61fe92baf2182bad1dbe6de59a7295c576
F test/count.test cd4bd531066e8d77ef8fe1e3fc8253d042072e117ccab214b290cf83f1602249
F test/countofview.test f9025dba8a9bb673a1f3ce25405900f630f81592c226546242df1ef1e62d0192
F test/countofview.test e17d6e6688cf74f22783c9ec6e788c0790ee4fbbaee713affd00b1ac0bb39b86
F test/coveridxscan.test f35c7208dedc4f98e471c569df64c0f95a49f6e072d8dc7c8f99bdee2697de1b
F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
@@ -911,7 +907,7 @@ F test/createtab.test 85cdfdae5c3de331cd888d6c66e1aba575b47c2e3c3cc4a1d6f5414069
F test/cse.test 00b3aea44b16828833c94fbe92475fd6977583fcb064ae0bc590986812b38d0c
F test/csv01.test 2ab5514005fd308995c8910bc313e47f0368b94213b9d6c27f9a2da78796a091
F test/ctime.test 340f362f41f92972bbd71f44e10569a5cc694062b692231bd08aa6fe6c1c4773
F test/cursorhint.test 12e7d03262be8705798fe7b5719956bcda14989f10296a5e8fdc13466b7b75fc
F test/cursorhint.test 0175e4404181ace3ceca8b114eb0a98eae600d565aa4e2705abbe6614c7fe201
F test/cursorhint2.test 6f3aa9cb19e7418967a10ec6905209bcbb5968054da855fc36c8beee9ae9c42f
F test/dataversion1.test 6e5e86ac681f0782e766ebcb56c019ae001522d114e0e111e5ebf68ccf2a7bb8
F test/date.test 118e04db8c8b4efeb885542b4918c7b869a34c460a6bebbfe927dfd75706b80d
@@ -928,7 +924,7 @@ F test/dbstatus.test 4a4221a883025ffd39696b3d1b3910b928fb097d77e671351acb35f3aed
F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef
F test/decimal.test fcf403fd5585f47342234e153c4a4338cd737b8e0884ac66fc484df47dbcf1a7
F test/default.test 9687cfb16717e4b8238c191697c98be88c0b16e568dd5368cd9284154097ef50
F test/delete.test 2686e1c98d552ef37d79ad55b17b93fe96fad9737786917ce3839767f734c48f
F test/delete.test 31832b0c45ecb51a54348c68db173be462985901e6ed7f403d6d7a8f70ab4ef0
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
F test/delete4.test 51fafebe9503a40796d1aae1565c60524cada720e50eecac01b7fd0419d9ea0b
@@ -937,8 +933,8 @@ F test/descidx1.test edc8adee58d491b06c7157c50364eaf1c3605c9c19f8093cb1ea2b6184f
F test/descidx2.test a0ba347037ff3b811f4c6ceca5fd0f9d5d72e74e59f2d9de346a9d2f6ad78298
F test/descidx3.test 953c831df7ea219c73826dfbf2f6ee02d95040725aa88ccb4fa43d1a1999b926
F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e
F test/distinct.test 691c9e850b0d0b56b66e7e235453198cb4cf0760e324b7403d3c5abbeab0a014
F test/distinct2.test bb71cc7b5e58e895787f9910a788c254f679928d324732d063fe9bc202ecbe71
F test/distinct.test a7687c2fb50c93f6a486936c51439a93221c6e1188f9bc7b27b3ec26f9c58b1e
F test/distinct2.test cd1d15a4a2abf579298f7161e821ed50c0119136fe0424db85c52cf0adc230d1
F test/distinctagg.test 14ec5026e684eddd414c61c08692b43773e224ac92efbed6ec08c6994bc39723
F test/e_blobbytes.test 4c01dfe4f12087b92b20705a3fdfded45dc4ed16d5a211fed4e1d2786ba68a52
F test/e_blobclose.test 692fc02a058476c2222a63d97e3f3b2b809c1842e5525ded7f854d540ac2e075
@@ -1085,7 +1081,7 @@ F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45
F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
F test/fts3fuzz001.test e3c7b0ce9b04cc02281dcc96812a277f02df03cd7dc082055d87e11eb18aaf56
F test/fts3join.test 1a4d786539b2b79a41c28ef2ac22cacd92a8ee830249b68a7dee4a020848e3bb
F test/fts3join.test ee25def5e763ea8879c19e74f862d5191410ccc7259338887a3685e97f512662
F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6
F test/fts3matchinfo.test aa66cc50615578b30f6df9984819ae5b702511cf8a94251ec7c594096a703a4a
F test/fts3matchinfo2.test 00144e841704b8debfcdf6097969cd9f2a1cf759e2203cda42583648f2e6bf58
@@ -1135,7 +1131,6 @@ F test/func4.test 2285fb5792d593fef442358763f0fd9de806eda47dbc7a5934df57ffdc484c
F test/func5.test 863e6d1bd0013d09c17236f8a13ea34008dd857d87d85a13a673960e4c25d82a
F test/func6.test 9cc9b1f43b435af34fe1416eb1e318c8920448ea7a6962f2121972f5215cb9b0
F test/func7.test adbfc910385a6ffd15dc47be3c619ef070c542fcb7488964badb17b2d9a4d080
F test/func8.test c4e2ecacf9f16e47a245e7a25fbabcc7e78f9c7c41a80f158527cdfdc6dd299d
F test/fuzz-oss1.test 514dcabb24687818ea949fa6760229eaacad74ca70157743ef36d35bbe01ffb0
F test/fuzz.test 4608c1310cff4c3014a84bcced6278139743e080046e5f6784b0de7b069371d8
F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
@@ -1143,7 +1138,7 @@ F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c
F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
F test/fuzz_common.tcl b7197de6ed1ee8250a4f82d67876f4561b42ee8cbbfc6160dcb66331bad3f830
F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
F test/fuzzcheck.c a3d4967ba9a56b13e097f613409178cfb20796d291ad1d7d532c6677fd5909b9
F test/fuzzcheck.c 0b8543d29c6f529cb73937607c8649f685510838e40c6287f06df083433c93b6
F test/fuzzdata1.db 3e86d9cf5aea68ddb8e27c02d7dfdaa226347426c7eb814918e4d95475bf8517
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -1155,9 +1150,9 @@ F test/fuzzdata8.db f6c2f2af4deaaae0ddb3310d509c2659990794aa653dc501b80a0534c349
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
F test/fuzzinvariants.c b34530e8431f2cf3591eff588fc7684d6fdef466916fb46141c8c5374a3d8099
F test/fuzzinvariants.c a153253600b2b33a7d5710d40e89b2ac1373a1912517867fb995a45b2d67dcb8
F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c
F test/gencol1.test aef8b0670abd4b1ae4cae786b15a43758d86f6cd9f12b381d45d96bb51e597c9
F test/gencol1.test cc0dbb0ee116e5602e18ea7d47f2a0f76b26e09a823b7c36ef254370c2b0f3c1
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
F test/having.test a89236dd8d55aa50c4805f82ac9daf64d477a44d712d8209c118978d0ca21ec9
F test/hexlit.test 4a6a5f46e3c65c4bf1fa06f5dd5a9507a5627751
@@ -1195,7 +1190,7 @@ F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a91
F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997
F test/indexedby.test f21eca4f7a6ffe14c8500a7ad6cd53166666c99e5ccd311842a28bc94a195fe0
F test/indexexpr1.test b2a15637dcbae7fd8d7e2fc51f74ac4feaf5510130ee2089a5ec5bd1ef7270e1
F test/indexexpr2.test 8a4cf83e12b041334c5ef36b9a3932451808378352c24d65049b31f3737a82b9
F test/indexexpr2.test 2c7abe3c48f8aaa5a448615ab4d13df3662185d28419c00999670834a3f0b484
F test/indexfault.test 98d78a8ff1f5335628b62f886a1cb7c7dac1ef6d48fa39c51ec871c87dce9811
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
F test/insert.test 4e3f0de67aac3c5be1f4aaedbcea11638f1b5cdc9a3115be14d19aa9db7623c6
@@ -1219,14 +1214,14 @@ F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9
F test/join.test ed1daf99958fed1b9f017e56bae2bb6b49339a1ec0b70b9e8f7259960c6bf387
F test/join2.test 8561fe82ce434ac96de91544072e578dc2cadddf2d9bc9cd802f866a9b92502e
F test/join.test e32cb9b1491eed682489e2cde33a22a4eb7611fe5aa3b0aa4b275fe27ab3f3ac
F test/join2.test 466b07233820f5deee66a6c3bf6e4500c8bbf7b83649e67606f5f649c07928c0
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 91f1f4c7d81fd87b58e9ba7cf4a2b5d39e3583b4f8e498a162722a60259c5208
F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c
F test/join7.test 2268dcbb54b724391dda3748ea95c60d960607ffeed67885675998e7117697f6
F test/join8.test d384d63985e3991c404afccadaf3efd1cdf9cd72680167f80e3cb80b95c18c68
F test/join8.test 40bdf5612444e986187edc5fd5ea9094cb7975b78cac563a97f1f7aefde34ba6
F test/join9.test 9056ddd3b0c0f4f9d658f4521038d9a37dc23ead8ca9a505d0b0db2b6a471e05
F test/joinA.test 7eab225dc1c1ab258a5e62513a4ed7cabbd3db971d59d5d92f4fb6fa14c12f6a
F test/joinB.test 1b2ba3fc8568b49411787fccbf540570c148e9b6a53a30f80691cb6268098ded
@@ -1241,7 +1236,7 @@ F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ff
F test/jrnlmode.test 9b5bc01dac22223cb60ec2d5f97acf568d73820794386de5634dcadbea9e1946
F test/jrnlmode2.test 8759a1d4657c064637f8b079592651530db738419e1d649c6df7048cd724363d
F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
F test/json101.test c7707ee623c57a24845ef260d4388a6fade1eb294e450caadd7f1d9ced19dea7
F test/json101.test 9f6337e7423d2c1774d1d485c919fc4e11c8f7e423a2f8831f73471983432108
F test/json102.test 327e77275f338c028faefa2da5164daf6b142a165e3015ff2a6e4251ddc6a0ac
F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
F test/json104.test a502dc01853aada95d721b3b275afbe2dc18fffdac1fea6e96fb20c13586bbb5
@@ -1338,7 +1333,7 @@ F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
F test/notify3.test 796c7b7157f55c93b4e672b724e9c923a6fc6aa72ac419379a623e2350472e22
F test/notnull.test a37b663d5bb728d66fc182016613fb8e4a0a4bbf3d75b8876a7527f7d4ed3f18
F test/notnull2.test 1ee4acbd614d3cf5f1c4a52f5af7fc771b82352f1a51a86afeaa02c9df1d82ef
F test/notnull2.test 8e1aa4f311df37f9d2cd4f5563eea955b8028c692151404e9cc896420a01a3dc
F test/notnullfault.test fc4bb7845582a2b3db376001ef49118393b1b11abe0d24adb03db057ee2b73d5
F test/null.test b7ff206a1c60fe01aa2abd33ef9ea83c93727d993ca8a613de86e925c9f2bc6f
F test/nulls1.test 7a5e4346ee4285034100b4cd20e6784f16a9d6c927e44ecdf10034086bbee9c9
@@ -1379,14 +1374,14 @@ F test/pendingrace.test cbdf0f74bc939fb43cebad64dda7a0b5a3941a10b7e9cc2b596ff3e4
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 8bd6b6db541e2a7f9bb894be99ef5c00526b23762c4a00c574e1cba697495125
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test d21ae02249f2a1813f016efebe616a1916b3f9abd71867da6211a50bfea373ba
F test/pragma.test aeefa47ba5ebbf4ffc6addc223568d2a95dc7ec3ba3e3c4a26b199e805f94514
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31
F test/pragma4.test ca5e4dfc46adfe490f75d73734f70349d95a199e6510973899e502eef2c8b1f8
F test/pragma5.test 7b33fc43e2e41abf17f35fb73f71b49671a380ea92a6c94b6ce530a25f8d9102
F test/pragmafault.test 275edaf3161771d37de60e5c2b412627ac94cef11739236bec12ed1258b240f8
F test/prefixes.test b524a1c44bffec225b9aec98bd728480352aa8532ac4c15771fb85e8beef65d9
F test/printf.test 931381fede4f901d5f76275959339502f7d3312492c8df129972487951ff9fd1
F test/printf.test 390d0d7fcffc3c4ea3c1bb4cbb267444e32b33b048ae21895f23a291844fe1da
F test/printf2.test 3f55c1871a5a65507416076f6eb97e738d5210aeda7595a74ee895f2224cce60
F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
@@ -1409,7 +1404,7 @@ F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2
F test/releasetest_data.tcl b550dd1b122a9c969df794d05ea272df535f10ff1a245062e7ba080822378016
F test/resetdb.test 54c06f18bc832ac6d6319e5ab23d5c8dd49fdbeec7c696d791682a8006bd5fc3
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/returning1.test db532cde29d6aebbc48c6ddc3149b30476f8e69ca7a2c4b53986c7635e6fd8ec
F test/returning1.test 3ef7b264598b3292be0cdb028e4acb7524c5fd409b33b78449f894dfd68db334
F test/returningfault.test ae4c4b5e8745813287a359d9ccdb9d5c883c2e68afb18fb0767937d5de5692a4
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
F test/rollback2.test 3f3a4e20401825017df7e7671e9f31b6de5fae5620c2b9b49917f52f8c160a8f
@@ -1439,8 +1434,8 @@ F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7
F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa
F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2
F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e
F test/scanstatus2.test b77de449be6ffd7a913a06dd84276dc6eb3517d479126e00ac51cd409c0a0af5
F test/scanstatus.test 74391c2c0926994bf0962db6c04c9ff5b95d15a41d2e076fe011b73f92815e70
F test/scanstatus2.test ca6c258425977e5935f0ff3a8670d9b5d813dd5b83cf0bbe39acfc0fd2b5a0b1
F test/schema.test 5dd11c96ba64744de955315d2e4f8992e447533690153b93377dffb2a5ef5431
F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
F test/schema3.test 8ed4ae66e082cdd8b1b1f22d8549e1e7a0db4527a8e6ee8b6193053ee1e5c9ce
@@ -1467,7 +1462,7 @@ F test/selectD.test 6d1909b49970bf92f45ce657505befcef5fc7cbc13544e18103a316d3218
F test/selectE.test a8730ca330fcf40ace158f134f4fe0eb00c7edbf
F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3
F test/selectG.test 089f7d3d7e6db91566f00b036cb353107a2cca6220eb1cb264085a836dae8840
F test/selectH.test 88237ded5925adfb3f27fdafb5428c2ffc4d61e313bceb854e225ffc3ef0d206
F test/selectH.test a1fed72a83a68ed858db6fcf6d8ddccc4a368645c0ef48dc3ac331d41efe34de
F test/session.test 78fa2365e93d3663a6e933f86e7afc395adf18be
F test/sessionfuzz-data1.db 1f8d5def831f19b1c74571037f0d53a588ea49a6c4ca2a028fc0c27ef896dbcb
F test/sessionfuzz.c 5eef09af01eeff6f20250ae4c0112c2e576e4d2f2026cc9a49dc5be6886fa6ee
@@ -1483,7 +1478,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21
F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test 291c5c4b313adbe44d847af78b730a3bbfa1598c450e09ffe5601170bf7f28e7
F test/shell1.test ab88e763854ea4734796067e20e258589b4d5bb9e77d70d8c4c8e99cf77c8b64
F test/shell2.test 35c0c19d3198ee7669a748c1aedcce27a776ee575cc76128f8fcf665b79672f7
F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a
F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f
@@ -1496,7 +1491,7 @@ F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
F test/shrink.test 2668e607dcdfa19c52828c09b69685b38da793856582ae31debf79d90c7bbbdc
F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329
F test/skipscan1.test e03ba5b977da6fd71662a4b0a668f04053bda4b187ff3214db7533e28c732279
F test/skipscan1.test 1a9972e1dc15ca3887f306d3cd9a29679afb382eca0f3539f3b746f3c2ccaf68
F test/skipscan2.test b032ed3e0ba5caa4df6c43ef22c31566aac67783bc031869155989a7ccdb5bd5
F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5
F test/skipscan5.test 0672103fd2c8f96bd114133f356192b35ece45c794fe3677e1d9e5e3104a608e
@@ -1524,7 +1519,7 @@ F test/speed3.test 694affeb9100526007436334cf7d08f3d74b85ef
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c
F test/speedtest1.c 4a883fe277c289161f84f8c805a38f78bfbd9515eb417071f9bce817c2ca8756
F test/speedtest1.c 645dbf022337116fcef60ac2579e8d25c94e4475109e2c6f48005f302efe7b09
F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
@@ -1544,7 +1539,7 @@ F test/subquery.test 3a1a5b600b8d4f504d2a2c61f33db820983dba94a0ef3e4aedca8f0165e
F test/subquery2.test 90cf944b9de8204569cf656028391e4af1ccc8c0cc02d4ef38ee3be8de1ffb12
F test/subselect.test 0966aa8e720224dbd6a5e769a3ec2a723e332303
F test/substr.test a673e3763e247e9b5e497a6cacbaf3da2bd8ec8921c0677145c109f2e633f36b
F test/subtype1.test 7a9c55ed84d4ce551203d18046f925e293d75f69da81bff71aaf2696e4a2a748
F test/subtype1.test 45c85632abd38f7ea9b33f17448d966d67550f552e0822bab74576814d0d1718
F test/superlock.test ec94f0556b6488d97f71c79f9061ae08d9ab8f12
F test/swarmvtab.test 250231404fcac88f61a6c147bb0e3a118ed879278cd3ccb0ae2d3a729e1e8e26
F test/swarmvtab2.test c948cb2fdfc5b01d85e8f6d6504854202dc1a0782ab2a0ed61538f27cbd0aa5c
@@ -1556,7 +1551,7 @@ F test/sync.test 89539f4973c010eda5638407e71ca7fddbcd8e0594f4c9980229f804d433309
F test/sync2.test 8f9f7d4f6d5be8ca8941a8dadcc4299e558cb6a1ff653a9469146c7a76ef2039
F test/syscall.test a39d9a36f852ae6e4800f861bc2f2e83f68bbc2112d9399931ecfadeabd2d69d
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test 668e5e39108ce84b2f24e402f9382daecc0417edb9c78c6c8f58170584e80c91
F test/tabfunc01.test 241425ce3998687ab24adba09cb95e8012e17499b84a0ed47e128ab45e588bef
F test/table.test eb3463b7add9f16a5bb836badf118cf391b809d09fdccd1f79684600d07ec132
F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@@ -1568,8 +1563,8 @@ F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d1631311a16
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 68454ef88508c196d19e8694daa27bff7107a91857799eaa12f417188ae53ede
F test/testrunner.tcl 59490f189cac99b16b0376d0cc0a7ecfb753a84b89c9f4c361af337d88db53ac
F test/tester.tcl 8d54d40a55e12554b4509bc12078b201b233c8e842a7543629094a21b1ba956d
F test/testrunner.tcl e0b36a732956c69ce19370611b8dc69b44e627d5ea8ec2a5455ca3e8a170ddaa
F test/testrunner_data.tcl 8169c68654ac8906833b8a6aadca973358a441ebf88270dd05c153e5f96f76b8
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
@@ -1618,7 +1613,7 @@ F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223
F test/tkt-99378177930f87bd.test 28530bf9903dcd7743185ce78b1c02b1f9ba09fe4fa77a70ecbd0af83fe3353c
F test/tkt-99378177930f87bd.test 2f07020a82ed1c56bdad60a8a6ef508b2f8a1fb056300b7ec650cbd9975b46bf
F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667
F test/tkt-9d68c883.test 16f7cb96781ba579bc2e19bb14b4ad609d9774b6
F test/tkt-9f2eb3abac.test cb6123ac695a08b4454c3792fbe85108f67fabf8
@@ -1775,7 +1770,7 @@ F test/unique.test 93f8b2ef5ea51b9495f8d6493429b1fd0f465264
F test/unique2.test 3674e9f2a3f1fbbfd4772ac74b7a97090d0f77d2
F test/unixexcl.test d936ba2b06794018e136418addd59a2354eeae97
F test/unordered.test 0edaf3411d300693bca595897c5201421c6c5ec787990a1dfe2f7f60ae93f1e2
F test/update.test 90772ede84cfc779fc3d31884a84ec4c74deb501eeb09a1c6c91c03d8e94c0d8
F test/update.test eb7f4eb172ce270e51bb67d7867521f33a63635bb671e261bbafccaef3bd6db2
F test/update2.test 67455bc61fcbcf96923c45b3bc4f87bc72be7d67575ad35f134906148c7b06d3
F test/upfrom1.tcl 8859d9d437f03b44174c4524a7a734a391fd4526fcff65be08285dafc9dc9041
F test/upfrom1.test 8cb06689e99cd707d884faa16da0e8eb26ff658bb01c47ddf72fadade666e6e1
@@ -1901,7 +1896,7 @@ F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2
F test/win32lock.test e0924eb8daac02bf80e9da88930747bd44dd9b230b7759fed927b1655b467c9c
F test/win32longpath.test 4baffc3acb2e5188a5e3a895b2b543ed09e62f7c72d713c1feebf76222fe9976
F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc
F test/window1.test 67aaef6e01e8d8fb3f89aa440e8c8045dbfd3c6f21628a6d7bad2b786c310d9b
F test/window1.test 08bac934238ff66987635ea3367c5aed5b4c088c414441beaba426e68a8257c1
F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476
F test/window2.test e466a88bd626d66edc3d352d7d7e1d5531e0079b549ba44efb029d1fbff9fd3c
F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03
@@ -1926,10 +1921,10 @@ F test/windowfault.test 15094c1529424e62f798bc679e3fe9dfab6e8ba2f7dfe8c923b6248c
F test/windowpushd.test d8895d08870b7226f7693665bd292eb177e62ca06799184957b3ca7dc03067df
F test/with1.test b93833890e5d2a368e78747f124503a0159aa029b98e9ed4795ebf630b2efd3d
F test/with2.test a1df41b987198383b9b70bf5e5fda390582e46398653858dbc6ceb24253b28df
F test/with3.test fe15975c0b53c9098a757902a908e3f8d6d80ce47c5363ac600f28a79ef8c0ca
F test/with3.test e7bf809bf75c1f44f98bca78bc331dbf542002c5227bf53c1261144db4e824c8
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8
F test/with6.test e097a03e5c898a8cd8f3a2d6a994ec510ea4376b5d484c2b669a41001e7758c8
F test/with6.test 7afab289442bd0a023c18deef854642932294fa63cdb885a4b4db69e28c5fbf9
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
F test/without_rowid1.test a5210b8770dc4736bca4e74bc96588f43025ad03ad6a80f885afd36d9890e217
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
@@ -2008,7 +2003,7 @@ F tool/showstat4.c 0682ebea7abf4d3657f53c4a243f2e7eab48eab344ed36a94bb75dcd19a5c
F tool/showwal.c 4699048f68b6dd7b451011abfff404b8890d5a0b7dab78d2ad50d018116239d5
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
F tool/spaceanal.tcl 1b5be34c6223cb1af06da2a10fb77863eb869b1962d055820b0a11cf2336ab45
F tool/speed-check.sh c24c30cddd0ecb6d1d0775411d22f7619f55fa696a305487645e27b1b8fc05a2
F tool/speed-check.sh 9b27e158330a6587e92214b2344cc6fadde514996c0648fc0de7955ef7a79d77
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
@@ -2051,11 +2046,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P c34fd9fe1b76e0a5943f014f46141cbe55d41bb1e6980adf9bcb6785a03e7883
R d40ca8a393cdc77a3a8c6e0ac8d14846
T *branch * istype-opcode-refactor
T *sym-istype-opcode-refactor *
P de6c5c6bb49a0beca793cdc0462da2c17bb05f3292e08dd815be29b45b59a8fb
R 5fa9578574fba5a8667a76b65d53fb9e
T *branch * fp-conversion-simpler
T *sym-fp-conversion-simpler *
T -sym-trunk *
U drh
Z c3941d4e38d885dcc893fe5f74a5950c
Z 34fe21e03e6feeb814c51c1776e25371
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
242cb36c3bd0192208d948214b510348f561e0fe56f1c77b4a5e4fd84bd42cca
334d22bc70916dfc36fbd2b8e45455b09c7d20d33855ce132797270267ee28fc
+4 -37
View File
@@ -994,15 +994,11 @@ static void analyzeOneTable(
int regIdxname = iMem++; /* Register containing index name */
int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
int regPrev = iMem; /* MUST BE LAST (see below) */
#ifdef SQLITE_ENABLE_STAT4
int doOnce = 1; /* Flag for a one-time computation */
#endif
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
Table *pStat1 = 0;
Table *pStat1 = 0;
#endif
sqlite3TouchRegister(pParse, iMem);
assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
pParse->nMem = MAX(pParse->nMem, iMem);
v = sqlite3GetVdbe(pParse);
if( v==0 || NEVER(pTab==0) ){
return;
@@ -1108,7 +1104,7 @@ static void analyzeOneTable(
** the regPrev array and a trailing rowid (the rowid slot is required
** when building a record to insert into the sample column of
** the sqlite_stat4 table. */
sqlite3TouchRegister(pParse, regPrev+nColTest);
pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
/* Open a read-only cursor on the index being analyzed. */
assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
@@ -1280,35 +1276,7 @@ static void analyzeOneTable(
int addrIsNull;
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
if( doOnce ){
int mxCol = nCol;
Index *pX;
/* Compute the maximum number of columns in any index */
for(pX=pTab->pIndex; pX; pX=pX->pNext){
int nColX; /* Number of columns in pX */
if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){
nColX = pX->nKeyCol;
}else{
nColX = pX->nColumn;
}
if( nColX>mxCol ) mxCol = nColX;
}
/* Allocate space to compute results for the largest index */
sqlite3TouchRegister(pParse, regCol+mxCol);
doOnce = 0;
#ifdef SQLITE_DEBUG
/* Verify that the call to sqlite3ClearTempRegCache() below
** really is needed.
** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
*/
testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
#endif
sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */
assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
}
assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) );
pParse->nMem = MAX(pParse->nMem, regCol+nCol);
addrNext = sqlite3VdbeCurrentAddr(v);
callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
@@ -1389,7 +1357,6 @@ static void analyzeDatabase(Parse *pParse, int iDb){
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
Table *pTab = (Table*)sqliteHashData(k);
analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
iMem = sqlite3FirstAvailableRegister(pParse, iMem);
}
loadAnalysis(pParse, iDb);
}
+16 -65
View File
@@ -1231,31 +1231,27 @@ static void btreeParseCellPtr(
iKey = *pIter;
if( iKey>=0x80 ){
u8 x;
iKey = (iKey<<7) ^ (x = *++pIter);
iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ (x = *++pIter);
iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
if( x>=0x80 ){
iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
iKey = (iKey<<8) | (*++pIter);
}
}
}
}
}
}else{
iKey ^= 0x204000;
}
}else{
iKey ^= 0x4000;
}
}
pIter++;
@@ -1332,11 +1328,10 @@ static void btreeParseCell(
**
** cellSizePtrNoPayload() => table internal nodes
** cellSizePtrTableLeaf() => table leaf nodes
** cellSizePtr() => index internal nodes
** cellSizeIdxLeaf() => index leaf nodes
** cellSizePtr() => all index nodes & table leaf nodes
*/
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
u8 *pEnd; /* End mark for a varint */
u32 nSize; /* Size value to return */
@@ -1349,49 +1344,6 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
pPage->xParseCell(pPage, pCell, &debuginfo);
#endif
assert( pPage->childPtrSize==4 );
nSize = *pIter;
if( nSize>=0x80 ){
pEnd = &pIter[8];
nSize &= 0x7f;
do{
nSize = (nSize<<7) | (*++pIter & 0x7f);
}while( *(pIter)>=0x80 && pIter<pEnd );
}
pIter++;
testcase( nSize==pPage->maxLocal );
testcase( nSize==(u32)pPage->maxLocal+1 );
if( nSize<=pPage->maxLocal ){
nSize += (u32)(pIter - pCell);
assert( nSize>4 );
}else{
int minLocal = pPage->minLocal;
nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
testcase( nSize==pPage->maxLocal );
testcase( nSize==(u32)pPage->maxLocal+1 );
if( nSize>pPage->maxLocal ){
nSize = minLocal;
}
nSize += 4 + (u16)(pIter - pCell);
}
assert( nSize==debuginfo.nSize || CORRUPT_DB );
return (u16)nSize;
}
static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
u8 *pIter = pCell; /* For looping over bytes of pCell */
u8 *pEnd; /* End mark for a varint */
u32 nSize; /* Size value to return */
#ifdef SQLITE_DEBUG
/* The value returned by this function should always be the same as
** the (CellInfo.nSize) value found by doing a full parse of the
** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
** this function verifies that this invariant is not violated. */
CellInfo debuginfo;
pPage->xParseCell(pPage, pCell, &debuginfo);
#endif
assert( pPage->childPtrSize==0 );
nSize = *pIter;
if( nSize>=0x80 ){
pEnd = &pIter[8];
@@ -1628,10 +1580,10 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
/* These conditions have already been verified in btreeInitPage()
** if PRAGMA cell_size_check=ON.
*/
if( pc>iCellLast ){
if( pc<iCellStart || pc>iCellLast ){
return SQLITE_CORRUPT_PAGE(pPage);
}
assert( pc>=0 && pc<=iCellLast );
assert( pc>=iCellStart && pc<=iCellLast );
size = pPage->xCellSize(pPage, &src[pc]);
cbrk -= size;
if( cbrk<iCellStart || pc+size>usableSize ){
@@ -1973,14 +1925,14 @@ static int decodeFlags(MemPage *pPage, int flagByte){
}else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
pPage->intKey = 0;
pPage->intKeyLeaf = 0;
pPage->xCellSize = cellSizePtrIdxLeaf;
pPage->xCellSize = cellSizePtr;
pPage->xParseCell = btreeParseCellPtrIndex;
pPage->maxLocal = pBt->maxLocal;
pPage->minLocal = pBt->minLocal;
}else{
pPage->intKey = 0;
pPage->intKeyLeaf = 0;
pPage->xCellSize = cellSizePtrIdxLeaf;
pPage->xCellSize = cellSizePtr;
pPage->xParseCell = btreeParseCellPtrIndex;
return SQLITE_CORRUPT_PAGE(pPage);
}
@@ -6132,8 +6084,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
pPage = pCur->pPage;
idx = ++pCur->ix;
if( sqlite3FaultSim(412) ) pPage->isInit = 0;
if( !pPage->isInit ){
if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
return SQLITE_CORRUPT_BKPT;
}
@@ -9262,7 +9213,6 @@ int sqlite3BtreeInsert(
assert( szNew==pPage->xCellSize(pPage, newCell) );
assert( szNew <= MX_CELL_SIZE(p->pBt) );
idx = pCur->ix;
pCur->info.nSize = 0;
if( loc==0 ){
CellInfo info;
assert( idx>=0 );
@@ -9335,6 +9285,7 @@ int sqlite3BtreeInsert(
** larger than the largest existing key, it is possible to insert the
** row without seeking the cursor. This can be a big performance boost.
*/
pCur->info.nSize = 0;
if( pPage->nOverflow ){
assert( rc==SQLITE_OK );
pCur->curFlags &= ~(BTCF_ValidNKey);
+2 -4
View File
@@ -1451,7 +1451,7 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){
if( pParse->pNewTrigger ){
sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
}else{
assert( pParse->bReturning==0 || pParse->ifNotExists );
assert( pParse->bReturning==0 );
}
pParse->bReturning = 1;
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
@@ -1477,8 +1477,7 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){
pRet->retTStep.pTrig = &pRet->retTrig;
pRet->retTStep.pExprList = pList;
pHash = &(db->aDb[1].pSchema->trigHash);
assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
|| pParse->nErr || pParse->ifNotExists );
assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
==&pRet->retTrig ){
sqlite3OomFault(db);
@@ -2013,7 +2012,6 @@ void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){
** turn it into one by adding a unary "+" operator. */
pExpr = sqlite3PExpr(pParse, TK_UPLUS, pExpr, 0);
}
if( pExpr && pExpr->op!=TK_RAISE ) pExpr->affExpr = pCol->affinity;
sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
pExpr = 0;
goto generated_done;
+4 -6
View File
@@ -114,15 +114,13 @@ static int tabIsReadOnly(Parse *pParse, Table *pTab){
** If pTab is writable but other errors have occurred -> return 1.
** If pTab is writable and no prior errors -> return 0;
*/
int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
if( tabIsReadOnly(pParse, pTab) ){
sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
return 1;
}
#ifndef SQLITE_OMIT_VIEW
if( IsView(pTab)
&& (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
){
if( !viewOk && IsView(pTab) ){
sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
return 1;
}
@@ -376,7 +374,7 @@ void sqlite3DeleteFrom(
goto delete_from_cleanup;
}
if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
goto delete_from_cleanup;
}
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
@@ -485,7 +483,7 @@ void sqlite3DeleteFrom(
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
{
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
if( HasRowid(pTab) ){
/* For a rowid table, initialize the RowSet to an empty set */
+31 -96
View File
@@ -2650,7 +2650,7 @@ int sqlite3IsRowid(const char *z){
** pX is the RHS of an IN operator. If pX is a SELECT statement
** that can be simplified to a direct table access, then return
** a pointer to the SELECT statement. If pX is not a SELECT statement,
** or if the SELECT statement needs to be materialized into a transient
** or if the SELECT statement needs to be manifested into a transient
** table, then return NULL.
*/
#ifndef SQLITE_OMIT_SUBQUERY
@@ -3839,10 +3839,9 @@ void sqlite3ExprCodeGeneratedColumn(
){
int iAddr;
Vdbe *v = pParse->pVdbe;
int nErr = pParse->nErr;
assert( v!=0 );
assert( pParse->iSelfTab!=0 );
if( pParse->iSelfTab>0 ){
if( pParse->iSelfTab>0 ){
iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
}else{
iAddr = 0;
@@ -3852,7 +3851,6 @@ void sqlite3ExprCodeGeneratedColumn(
sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
}
if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
}
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
@@ -3869,7 +3867,6 @@ void sqlite3ExprCodeGetColumnOfTable(
Column *pCol;
assert( v!=0 );
assert( pTab!=0 );
assert( iCol!=XN_EXPR );
if( iCol<0 || iCol==pTab->iPKey ){
sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
VdbeComment((v, "%s.rowid", pTab->zName));
@@ -4136,7 +4133,6 @@ static SQLITE_NOINLINE int sqlite3IndexedExprLookup(
IndexedExpr *p;
Vdbe *v;
for(p=pParse->pIdxEpr; p; p=p->pIENext){
u8 exprAff;
int iDataCur = p->iDataCur;
if( iDataCur<0 ) continue;
if( pParse->iSelfTab ){
@@ -4144,16 +4140,6 @@ static SQLITE_NOINLINE int sqlite3IndexedExprLookup(
iDataCur = -1;
}
if( sqlite3ExprCompare(0, pExpr, p->pExpr, iDataCur)!=0 ) continue;
assert( p->aff>=SQLITE_AFF_BLOB && p->aff<=SQLITE_AFF_NUMERIC );
exprAff = sqlite3ExprAffinity(pExpr);
if( (exprAff<=SQLITE_AFF_BLOB && p->aff!=SQLITE_AFF_BLOB)
|| (exprAff==SQLITE_AFF_TEXT && p->aff!=SQLITE_AFF_TEXT)
|| (exprAff>=SQLITE_AFF_NUMERIC && p->aff!=SQLITE_AFF_NUMERIC)
){
/* Affinity mismatch on a generated column */
continue;
}
v = pParse->pVdbe;
assert( v!=0 );
if( p->bMaybeNullRow ){
@@ -4222,19 +4208,7 @@ expr_code_doover:
AggInfo *pAggInfo = pExpr->pAggInfo;
struct AggInfo_col *pCol;
assert( pAggInfo!=0 );
assert( pExpr->iAgg>=0 );
if( pExpr->iAgg>=pAggInfo->nColumn ){
/* Happens when the left table of a RIGHT JOIN is null and
** is using an expression index */
sqlite3VdbeAddOp2(v, OP_Null, 0, target);
#ifdef SQLITE_VDBE_COVERAGE
/* Verify that the OP_Null above is exercised by tests
** tag-20230325-2 */
sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
VdbeCoverageNeverTaken(v);
#endif
break;
}
assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
pCol = &pAggInfo->aCol[pExpr->iAgg];
if( !pAggInfo->directMode ){
return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
@@ -4409,8 +4383,11 @@ expr_code_doover:
#ifndef SQLITE_OMIT_CAST
case TK_CAST: {
/* Expressions of the form: CAST(pLeft AS token) */
sqlite3ExprCode(pParse, pExpr->pLeft, target);
assert( inReg==target );
inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
if( inReg!=target ){
sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
inReg = target;
}
assert( !ExprHasProperty(pExpr, EP_IntValue) );
sqlite3VdbeAddOp2(v, OP_Cast, target,
sqlite3AffinityType(pExpr->u.zToken, 0));
@@ -4742,16 +4719,17 @@ expr_code_doover:
return target;
}
case TK_COLLATE: {
if( !ExprHasProperty(pExpr, EP_Collate) ){
/* A TK_COLLATE Expr node without the EP_Collate tag is a so-called
** "SOFT-COLLATE" that is added to constraints that are pushed down
** from outer queries into sub-queries by the push-down optimization.
** Clear subtypes as subtypes may not cross a subquery boundary.
*/
assert( pExpr->pLeft );
sqlite3ExprCode(pParse, pExpr->pLeft, target);
sqlite3VdbeAddOp1(v, OP_ClrSubtype, target);
return target;
if( !ExprHasProperty(pExpr, EP_Collate)
&& ALWAYS(pExpr->pLeft)
&& pExpr->pLeft->op==TK_FUNCTION
){
inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
if( inReg!=target ){
sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
inReg = target;
}
sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
return inReg;
}else{
pExpr = pExpr->pLeft;
goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
@@ -4852,19 +4830,16 @@ expr_code_doover:
break;
}
}
addrINR = sqlite3VdbeAddOp3(v, OP_IfNullRow, pExpr->iTable, 0, target);
/* The OP_IfNullRow opcode above can overwrite the result register with
** NULL. So we have to ensure that the result register is not a value
** that is suppose to be a constant. Two defenses are needed:
** (1) Temporarily disable factoring of constant expressions
** (2) Make sure the computed value really is stored in register
** "target" and not someplace else.
*/
pParse->okConstFactor = 0; /* note (1) above */
sqlite3ExprCode(pParse, pExpr->pLeft, target);
assert( target==inReg );
addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
/* Temporarily disable factoring of constant expressions, since
** even though expressions may appear to be constant, they are not
** really constant because they originate from the right-hand side
** of a LEFT JOIN. */
pParse->okConstFactor = 0;
inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
pParse->okConstFactor = okConstFactor;
sqlite3VdbeJumpHere(v, addrINR);
sqlite3VdbeChangeP3(v, addrINR, inReg);
break;
}
@@ -6286,11 +6261,9 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
int iAgg = pExpr->iAgg;
Parse *pParse = pWalker->pParse;
sqlite3 *db = pParse->db;
assert( iAgg>=0 );
if( pExpr->op!=TK_AGG_FUNCTION ){
if( iAgg<pAggInfo->nColumn
&& pAggInfo->aCol[iAgg].pCExpr==pExpr
){
assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
pExpr = sqlite3ExprDup(db, pExpr, 0);
if( pExpr ){
pAggInfo->aCol[iAgg].pCExpr = pExpr;
@@ -6299,9 +6272,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){
}
}else{
assert( pExpr->op==TK_AGG_FUNCTION );
if( ALWAYS(iAgg<pAggInfo->nFunc)
&& pAggInfo->aFunc[iAgg].pFExpr==pExpr
){
assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
pExpr = sqlite3ExprDup(db, pExpr, 0);
if( pExpr ){
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
@@ -6638,35 +6610,6 @@ void sqlite3ClearTempRegCache(Parse *pParse){
pParse->nRangeReg = 0;
}
/*
** Make sure sufficient registers have been allocated so that
** iReg is a valid register number.
*/
void sqlite3TouchRegister(Parse *pParse, int iReg){
if( pParse->nMem<iReg ) pParse->nMem = iReg;
}
/*
** Return the latest reusable register in the set of all registers.
** The value returned is no less than iMin. If any register iMin or
** greater is in permanent use, then return one more than that last
** permanent register.
*/
int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){
const ExprList *pList = pParse->pConstExpr;
if( pList ){
int i;
for(i=0; i<pList->nExpr; i++){
if( pList->a[i].u.iConstExprReg>=iMin ){
iMin = pList->a[i].u.iConstExprReg + 1;
}
}
}
pParse->nTempReg = 0;
pParse->nRangeReg = 0;
return iMin;
}
/*
** Validate that no temporary register falls within the range of
** iFirst..iLast, inclusive. This routine is only call from within assert()
@@ -6686,14 +6629,6 @@ int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){
return 0;
}
}
if( pParse->pConstExpr ){
ExprList *pList = pParse->pConstExpr;
for(i=0; i<pList->nExpr; i++){
int iReg = pList->a[i].u.iConstExprReg;
if( iReg==0 ) continue;
if( iReg>=iFirst && iReg<=iLast ) return 0;
}
}
return 1;
}
#endif /* SQLITE_DEBUG */
+1 -1
View File
@@ -291,7 +291,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
0, /* iPrngSeed */
#ifdef SQLITE_DEBUG
{0,0,0,0,0,0}, /* aTune */
{0,0,0,0,0,0} /* aTune */
#endif
};
+38 -40
View File
@@ -70,48 +70,46 @@ void sqlite3OpenTable(
** is managed along with the rest of the Index structure. It will be
** released when sqlite3DeleteIndex() is called.
*/
static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){
/* The first time a column affinity string for a particular index is
** required, it is allocated and populated here. It is then stored as
** a member of the Index structure for subsequent use.
**
** The column affinity string will eventually be deleted by
** sqliteDeleteIndex() when the Index structure itself is cleaned
** up.
*/
int n;
Table *pTab = pIdx->pTable;
pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
if( !pIdx->zColAff ){
sqlite3OomFault(db);
return 0;
}
for(n=0; n<pIdx->nColumn; n++){
i16 x = pIdx->aiColumn[n];
char aff;
if( x>=0 ){
aff = pTab->aCol[x].affinity;
}else if( x==XN_ROWID ){
aff = SQLITE_AFF_INTEGER;
}else{
assert( x==XN_EXPR );
assert( pIdx->bHasExpr );
assert( pIdx->aColExpr!=0 );
aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
}
if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
pIdx->zColAff[n] = aff;
}
pIdx->zColAff[n] = 0;
return pIdx->zColAff;
}
const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx);
if( !pIdx->zColAff ){
/* The first time a column affinity string for a particular index is
** required, it is allocated and populated here. It is then stored as
** a member of the Index structure for subsequent use.
**
** The column affinity string will eventually be deleted by
** sqliteDeleteIndex() when the Index structure itself is cleaned
** up.
*/
int n;
Table *pTab = pIdx->pTable;
pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
if( !pIdx->zColAff ){
sqlite3OomFault(db);
return 0;
}
for(n=0; n<pIdx->nColumn; n++){
i16 x = pIdx->aiColumn[n];
char aff;
if( x>=0 ){
aff = pTab->aCol[x].affinity;
}else if( x==XN_ROWID ){
aff = SQLITE_AFF_INTEGER;
}else{
assert( x==XN_EXPR );
assert( pIdx->bHasExpr );
assert( pIdx->aColExpr!=0 );
aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
}
if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
pIdx->zColAff[n] = aff;
}
pIdx->zColAff[n] = 0;
}
return pIdx->zColAff;
}
/*
** Compute an affinity string for a table. Space is obtained
** from sqlite3DbMalloc(). The caller is responsible for freeing
@@ -796,7 +794,7 @@ void sqlite3Insert(
/* Cannot insert into a read-only table.
*/
if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
goto insert_cleanup;
}
@@ -1243,7 +1241,7 @@ void sqlite3Insert(
}
/* Copy the new data already generated. */
assert( pTab->nNVCol>0 || pParse->nErr>0 );
assert( pTab->nNVCol>0 );
sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
+1 -4
View File
@@ -307,11 +307,8 @@ static void jsonAppendValue(
jsonAppendRaw(p, "null", 4);
break;
}
case SQLITE_INTEGER:
case SQLITE_FLOAT: {
jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
break;
}
case SQLITE_INTEGER: {
const char *z = (const char*)sqlite3_value_text(pValue);
u32 n = (u32)sqlite3_value_bytes(pValue);
jsonAppendRaw(p, z, n);
+2 -8
View File
@@ -585,11 +585,7 @@ static int sqlite3LoadExtension(
/* tag-20210611-1. Some dlopen() implementations will segfault if given
** an oversize filename. Most filesystems have a pathname limit of 4K,
** so limit the extension filename length to about twice that.
** https://sqlite.org/forum/forumpost/08a0d6d9bf
**
** Later (2023-03-25): Save an extra 6 bytes for the filename suffix.
** See https://sqlite.org/forum/forumpost/24083b579d.
*/
** https://sqlite.org/forum/forumpost/08a0d6d9bf */
if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
handle = sqlite3OsDlOpen(pVfs, zFile);
@@ -597,9 +593,7 @@ static int sqlite3LoadExtension(
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
handle = sqlite3OsDlOpen(pVfs, zAltFile);
}
handle = sqlite3OsDlOpen(pVfs, zAltFile);
sqlite3_free(zAltFile);
}
#endif
+9 -30
View File
@@ -430,21 +430,9 @@ int sqlite3_config(int op, ...){
va_list ap;
int rc = SQLITE_OK;
/* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while
** the SQLite library is in use. Except, a few selected opcodes
** are allowed.
*/
if( sqlite3GlobalConfig.isInit ){
static const u64 mAnytimeConfigOption = 0
| MASKBIT64( SQLITE_CONFIG_LOG )
| MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ )
;
if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){
return SQLITE_MISUSE_BKPT;
}
testcase( op==SQLITE_CONFIG_LOG );
testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ );
}
/* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
** the SQLite library is in use. */
if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
va_start(ap, op);
switch( op ){
@@ -513,7 +501,6 @@ int sqlite3_config(int op, ...){
break;
}
case SQLITE_CONFIG_MEMSTATUS: {
assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
/* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
** single argument of type int, interpreted as a boolean, which enables
** or disables the collection of memory allocation statistics. */
@@ -637,10 +624,8 @@ int sqlite3_config(int op, ...){
** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
*/
typedef void(*LOGFUNC_t)(void*,int,const char*);
LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t);
void *pLogArg = va_arg(ap, void*);
AtomicStore(&sqlite3GlobalConfig.xLog, xLog);
AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg);
sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
break;
}
@@ -654,8 +639,7 @@ int sqlite3_config(int op, ...){
** argument of type int. If non-zero, then URI handling is globally
** enabled. If the parameter is zero, then URI handling is globally
** disabled. */
int bOpenUri = va_arg(ap, int);
AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
break;
}
@@ -970,8 +954,6 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
{ SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
{ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
{ SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
{ SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
};
unsigned int i;
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
@@ -2957,9 +2939,9 @@ int sqlite3ParseUri(
assert( *pzErrMsg==0 );
if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
|| AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */
&& nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
|| sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
&& nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
){
char *zOpt;
int eState; /* Parser state when parsing URI */
@@ -3365,9 +3347,6 @@ static int openDatabase(
#endif
#if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
| SQLITE_LegacyAlter
#endif
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
| SQLITE_StmtScanStatus
#endif
;
sqlite3HashInit(&db->aCollSeq);
+9 -10
View File
@@ -296,19 +296,17 @@ columnname(A) ::= nm(A) typetoken(Y). {sqlite3AddColumn(pParse,A,Y);}
//
%token_class id ID|INDEXED.
// And "ids" is an identifer-or-string.
//
%token_class ids ID|STRING.
// An identifier or a join-keyword
//
%token_class idj ID|INDEXED|JOIN_KW.
// The name of a column or table can be any of the following:
//
%type nm {Token}
nm(A) ::= idj(A).
nm(A) ::= id(A).
nm(A) ::= STRING(A).
nm(A) ::= JOIN_KW(A).
// A typetoken is really zero or more tokens that form a type name such
// as can be found after the column name in a CREATE TABLE statement.
@@ -1086,7 +1084,8 @@ idlist(A) ::= nm(Y).
expr(A) ::= term(A).
expr(A) ::= LP expr(X) RP. {A = X;}
expr(A) ::= idj(X). {A=tokenExpr(pParse,TK_ID,X); /*A-overwrites-X*/}
expr(A) ::= id(X). {A=tokenExpr(pParse,TK_ID,X); /*A-overwrites-X*/}
expr(A) ::= JOIN_KW(X). {A=tokenExpr(pParse,TK_ID,X); /*A-overwrites-X*/}
expr(A) ::= nm(X) DOT nm(Y). {
Expr *temp1 = tokenExpr(pParse,TK_ID,X);
Expr *temp2 = tokenExpr(pParse,TK_ID,Y);
@@ -1139,19 +1138,19 @@ expr(A) ::= CAST LP expr(E) AS typetoken(T) RP. {
%endif SQLITE_OMIT_CAST
expr(A) ::= idj(X) LP distinct(D) exprlist(Y) RP. {
expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP. {
A = sqlite3ExprFunction(pParse, Y, &X, D);
}
expr(A) ::= idj(X) LP STAR RP. {
expr(A) ::= id(X) LP STAR RP. {
A = sqlite3ExprFunction(pParse, 0, &X, 0);
}
%ifndef SQLITE_OMIT_WINDOWFUNC
expr(A) ::= idj(X) LP distinct(D) exprlist(Y) RP filter_over(Z). {
expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP filter_over(Z). {
A = sqlite3ExprFunction(pParse, Y, &X, D);
sqlite3WindowAttach(pParse, A, Z);
}
expr(A) ::= idj(X) LP STAR RP filter_over(Z). {
expr(A) ::= id(X) LP STAR RP filter_over(Z). {
A = sqlite3ExprFunction(pParse, 0, &X, 0);
sqlite3WindowAttach(pParse, A, Z);
}
+4 -4
View File
@@ -41,7 +41,7 @@
struct PCache {
PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
PgHdr *pSynced; /* Last synced page in dirty page list */
i64 nRefSum; /* Sum of ref counts over all pages */
int nRefSum; /* Sum of ref counts over all pages */
int szCache; /* Configured cache size */
int szSpill; /* Size before spilling occurs */
int szPage; /* Size of every page in this cache */
@@ -71,7 +71,7 @@ struct PCache {
unsigned char *a;
int j;
pPg = (PgHdr*)pLower->pExtra;
printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
a = (unsigned char *)pLower->pBuf;
for(j=0; j<12; j++) printf("%02x", a[j]);
printf(" ptr %p\n", pPg);
@@ -815,14 +815,14 @@ PgHdr *sqlite3PcacheDirtyList(PCache *pCache){
** This is not the total number of pages referenced, but the sum of the
** reference count for all pages.
*/
i64 sqlite3PcacheRefCount(PCache *pCache){
int sqlite3PcacheRefCount(PCache *pCache){
return pCache->nRefSum;
}
/*
** Return the number of references to the page supplied as an argument.
*/
i64 sqlite3PcachePageRefcount(PgHdr *p){
int sqlite3PcachePageRefcount(PgHdr *p){
return p->nRef;
}
+3 -3
View File
@@ -40,7 +40,7 @@ struct PgHdr {
** private to pcache.c and should not be accessed by other modules.
** pCache is grouped with the public elements for efficiency.
*/
i64 nRef; /* Number of users of this page */
i16 nRef; /* Number of users of this page */
PgHdr *pDirtyNext; /* Next element in list of dirty pages */
PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
/* NB: pDirtyNext and pDirtyPrev are undefined if the
@@ -121,12 +121,12 @@ void sqlite3PcacheClearSyncFlags(PCache *);
void sqlite3PcacheClear(PCache*);
/* Return the total number of outstanding page references */
i64 sqlite3PcacheRefCount(PCache*);
int sqlite3PcacheRefCount(PCache*);
/* Increment the reference count of an existing page */
void sqlite3PcacheRef(PgHdr*);
i64 sqlite3PcachePageRefcount(PgHdr*);
int sqlite3PcachePageRefcount(PgHdr*);
/* Return the total number of pages stored in the cache */
int sqlite3PcachePagecount(PCache*);
+14 -57
View File
@@ -346,36 +346,6 @@ static void pragmaFunclistLine(
}
}
/*
** Generate a sequence of opcodes to test the type of a value.
**
** The byte code sequence might be either OP_Column, OP_IsType
** or it might be just OP_IsType. In either case, the address
** returned is the opcode of the OP_IsType.
**
** This subroutine assumes that register 3 is available as a
** temporary register. Hence, this subroutine can really only
** be used by PRAGMA integrity_check.
*/
static int generateIsTypeOpcode(
Vdbe *v, /* VDBE under construction */
int p1, /* Cursor holding the value to check. -1 means none */
int p2, /* Jump here if P1.P3 is correct */
int p3, /* Column to examine */
int p4, /* Default type of P1.P3 if does not exist */
int p5 /* Bitmask of allowed types */
){
int addr;
if( p1<0 ){
addr = sqlite3VdbeAddOp4Int(v, OP_IsType, p5, p2, p3, p4);
}else{
sqlite3VdbeAddOp4Int(v, OP_Column, p1, p3, 3, p4);
sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
addr = sqlite3VdbeAddOp3(v, OP_IsType, p5, p2, 3);
}
return addr;
}
/*
** Helper subroutine for PRAGMA integrity_check:
@@ -1554,7 +1524,7 @@ void sqlite3Pragma(
zDb = db->aDb[iDb].zDbSName;
sqlite3CodeVerifySchema(pParse, iDb);
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
sqlite3TouchRegister(pParse, pTab->nCol+regRow);
if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
sqlite3VdbeLoadString(v, regResult, pTab->zName);
assert( IsOrdinaryTable(pTab) );
@@ -1595,7 +1565,7 @@ void sqlite3Pragma(
** regRow..regRow+n. If any of the child key values are NULL, this
** row cannot cause an FK violation. Jump directly to addrOk in
** this case. */
sqlite3TouchRegister(pParse, regRow + pFK->nCol);
if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
for(j=0; j<pFK->nCol; j++){
int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
@@ -1724,7 +1694,6 @@ void sqlite3Pragma(
if( iDb>=0 && i!=iDb ) continue;
sqlite3CodeVerifySchema(pParse, i);
pParse->okConstFactor = 0; /* tag-20230327-1 */
/* Do an integrity check of the B-Tree
**
@@ -1760,7 +1729,7 @@ void sqlite3Pragma(
aRoot[0] = cnt;
/* Make sure sufficient number of registers have been allocated */
sqlite3TouchRegister(pParse, 8+mxIdx);
pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
sqlite3ClearTempRegCache(pParse);
/* Do the b-tree integrity checks */
@@ -1910,7 +1879,8 @@ void sqlite3Pragma(
labelOk = sqlite3VdbeMakeLabel(pParse);
if( pCol->notNull ){
/* (1) NOT NULL columns may not contain a NULL */
int jmp2 = generateIsTypeOpcode(v, p1, labelOk, p3, p4, 0x0f);
int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
sqlite3VdbeChangeP5(v, 0x0f);
VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
pCol->zCnName);
@@ -1932,8 +1902,9 @@ void sqlite3Pragma(
0x13, /* REAL */
0x14 /* TEXT */
};
generateIsTypeOpcode(v, p1, labelOk, p3, p4,
aStdTypeMask[pCol->eCType-1]);
sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
assert( pCol->eCType>=1 && pCol->eCType<=sizeof(aStdTypeMask) );
sqlite3VdbeChangeP5(v, aStdTypeMask[pCol->eCType-1]);
VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "non-%s value in %s.%s",
sqlite3StdType[pCol->eCType-1],
@@ -1942,7 +1913,8 @@ void sqlite3Pragma(
}else if( !bStrict && pCol->affinity==SQLITE_AFF_TEXT ){
/* (3) Datatype for TEXT columns in non-STRICT tables must be
** NULL, TEXT, or BLOB. */
generateIsTypeOpcode(v, p1, labelOk, p3, p4, 0x1c);
sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
sqlite3VdbeChangeP5(v, 0x1c); /* NULL, TEXT, or BLOB */
VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "NUMERIC value in %s.%s",
pTab->zName, pTab->aCol[j].zCnName);
@@ -1950,13 +1922,15 @@ void sqlite3Pragma(
}else if( !bStrict && pCol->affinity>=SQLITE_AFF_NUMERIC ){
/* (4) Datatype for numeric columns in non-STRICT tables must not
** be a TEXT value that can be converted to numeric. */
generateIsTypeOpcode(v, p1, labelOk, p3, p4, 0x1b);
sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
sqlite3VdbeChangeP5(v, 0x1b); /* NULL, INT, FLOAT, or BLOB */
VdbeCoverage(v);
if( p1>=0 ){
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
}
sqlite3VdbeAddOp4(v, OP_Affinity, 3, 1, 0, "C", P4_STATIC);
generateIsTypeOpcode(v, -1, labelOk, 3, p4, 0x1c);
sqlite3VdbeAddOp4Int(v, OP_IsType, -1, labelOk, 3, p4);
sqlite3VdbeChangeP5(v, 0x1c); /* NULL, TEXT, or BLOB */
VdbeCoverage(v);
zErr = sqlite3MPrintf(db, "TEXT value in %s.%s",
pTab->zName, pTab->aCol[j].zCnName);
@@ -2013,23 +1987,6 @@ void sqlite3Pragma(
jmp4 = integrityCheckResultRow(v);
sqlite3VdbeJumpHere(v, jmp2);
/* The OP_IdxRowid opcode is an optimized version of OP_Column
** that extracts the rowid off the end of the index record.
** But it only works correctly if index record does not have
** any extra bytes at the end. Verify that this is the case. */
if( HasRowid(pTab) ){
int jmp7;
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
VdbeCoverageNeverNull(v);
sqlite3VdbeLoadString(v, 3,
"rowid not at end-of-record for row ");
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
sqlite3VdbeLoadString(v, 4, " of index ");
sqlite3VdbeGoto(v, jmp5-1);
sqlite3VdbeJumpHere(v, jmp7);
}
/* Any indexed columns with non-BINARY collations must still hold
** the exact same text value as the table. */
label6 = 0;
+44 -107
View File
@@ -137,25 +137,11 @@ static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
digit = (int)*val;
d = digit;
digit += '0';
*val = (*val - d)*10.0;
*val = *val*10.0 - d*10.0;
return (char)digit;
}
#endif /* SQLITE_OMIT_FLOATING_POINT */
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** "*val" is a u64. *msd is a divisor used to extract the
** most significant digit of *val. Extract that most significant
** digit and return it.
*/
static char et_getdigit_int(u64 *val, u64 *msd){
u64 x = (*val)/(*msd);
*val -= x*(*msd);
if( *msd>=10 ) *msd /= 10;
return '0' + (char)(x & 15);
}
#endif /* SQLITE_OMIT_FLOATING_POINT */
/*
** Set the StrAccum object to an error mode.
*/
@@ -248,8 +234,6 @@ void sqlite3_str_vappendf(
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
sqlite_uint64 longvalue; /* Value for integer types */
LONGDOUBLE_TYPE realvalue; /* Value for real types */
sqlite_uint64 msd; /* Divisor to get most-significant-digit
** of longvalue */
const et_info *infop; /* Pointer to the appropriate info structure */
char *zOut; /* Rendering buffer */
int nOut; /* Size of the rendering buffer */
@@ -556,78 +540,52 @@ void sqlite3_str_vappendf(
}else{
prefix = flag_prefix;
}
exp = 0;
if( xtype==etGENERIC && precision>0 ) precision--;
testcase( precision>0xfff );
if( realvalue<1.0e+16
&& realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue)
){
/* Number is a pure integer that can be represented as u64 */
for(msd=1; msd*10<=longvalue; msd *= 10, exp++){}
if( exp>precision && xtype!=etFLOAT ){
u64 rnd = msd/2;
int kk = precision;
while( kk-- > 0 ){ rnd /= 10; }
longvalue += rnd;
}
}else{
msd = 0;
longvalue = 0; /* To prevent a compiler warning */
idx = precision & 0xfff;
rounder = arRound[idx%10];
while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
if( xtype==etFLOAT ){
double rx = (double)realvalue;
sqlite3_uint64 u;
int ex;
memcpy(&u, &rx, sizeof(u));
ex = -1023 + (int)((u>>52)&0x7ff);
if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
realvalue += rounder;
}
if( sqlite3IsNaN((double)realvalue) ){
if( flag_zeropad ){
bufpt = "null";
length = 4;
}else{
bufpt = "NaN";
length = 3;
}
idx = precision & 0xfff;
rounder = arRound[idx%10];
while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
if( xtype==etFLOAT ){
double rx = (double)realvalue;
sqlite3_uint64 u;
int ex;
memcpy(&u, &rx, sizeof(u));
ex = -1023 + (int)((u>>52)&0x7ff);
if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
realvalue += rounder;
}
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
exp = 0;
if( sqlite3IsNaN((double)realvalue) ){
bufpt = "NaN";
length = 3;
break;
}
if( realvalue>0.0 ){
LONGDOUBLE_TYPE scale = 1.0;
while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
realvalue /= scale;
while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
if( exp>350 ){
bufpt = buf;
buf[0] = prefix;
memcpy(buf+(prefix!=0),"Inf",4);
length = 3+(prefix!=0);
break;
}
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
if( ALWAYS(realvalue>0.0) ){
LONGDOUBLE_TYPE scale = 1.0;
while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;}
while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; }
while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
realvalue /= scale;
while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
if( exp>350 ){
if( flag_zeropad ){
realvalue = 9.0;
exp = 999;
}else{
bufpt = buf;
buf[0] = prefix;
memcpy(buf+(prefix!=0),"Inf",4);
length = 3+(prefix!=0);
break;
}
}
if( xtype!=etFLOAT ){
realvalue += rounder;
if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
}
}
}
bufpt = buf;
/*
** If the field type is etGENERIC, then convert to either etEXP
** or etFLOAT, as appropriate.
*/
if( xtype!=etFLOAT ){
realvalue += rounder;
if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
}
if( xtype==etGENERIC ){
flag_rtz = !flag_alternateform;
if( exp<-4 || exp>precision ){
@@ -644,8 +602,6 @@ void sqlite3_str_vappendf(
}else{
e2 = exp;
}
nsd = 16 + flag_altform2*10;
bufpt = buf;
{
i64 szBufNeeded; /* Size of a temporary buffer needed */
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
@@ -655,6 +611,7 @@ void sqlite3_str_vappendf(
}
}
zOut = bufpt;
nsd = 16 + flag_altform2*10;
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
/* The sign in front of the number */
if( prefix ){
@@ -663,10 +620,6 @@ void sqlite3_str_vappendf(
/* Digits prior to the decimal point */
if( e2<0 ){
*(bufpt++) = '0';
}else if( msd>0 ){
for(; e2>=0; e2--){
*(bufpt++) = et_getdigit_int(&longvalue,&msd);
}
}else{
for(; e2>=0; e2--){
*(bufpt++) = et_getdigit(&realvalue,&nsd);
@@ -683,14 +636,8 @@ void sqlite3_str_vappendf(
*(bufpt++) = '0';
}
/* Significant digits after the decimal point */
if( msd>0 ){
while( (precision--)>0 ){
*(bufpt++) = et_getdigit_int(&longvalue,&msd);
}
}else{
while( (precision--)>0 ){
*(bufpt++) = et_getdigit(&realvalue,&nsd);
}
while( (precision--)>0 ){
*(bufpt++) = et_getdigit(&realvalue,&nsd);
}
/* Remove trailing zeros and the "." if no digits follow the "." */
if( flag_rtz && flag_dp ){
@@ -1371,22 +1318,12 @@ char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
return zBuf;
}
char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
StrAccum acc;
char *z;
va_list ap;
if( n<=0 ) return zBuf;
#ifdef SQLITE_ENABLE_API_ARMOR
if( zBuf==0 || zFormat==0 ) {
(void)SQLITE_MISUSE_BKPT;
if( zBuf ) zBuf[0] = 0;
return zBuf;
}
#endif
sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
va_start(ap,zFormat);
sqlite3_str_vappendf(&acc, zFormat, ap);
z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
va_end(ap);
zBuf[acc.nChar] = 0;
return zBuf;
return z;
}
/*
+10 -7
View File
@@ -467,8 +467,7 @@ static int lookupName(
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
if( pParse->bReturning ){
if( (pNC->ncFlags & NC_UBaseReg)!=0
&& ALWAYS(zTab==0
|| sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
&& (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
){
pExpr->iTable = op!=TK_DELETE;
pTab = pParse->pTriggerTab;
@@ -948,10 +947,14 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
testcase( ExprHasProperty(pExpr, EP_OuterON) );
assert( !ExprHasProperty(pExpr, EP_IntValue) );
pExpr->u.iValue = (pExpr->op==TK_NOTNULL);
pExpr->flags |= EP_IntValue;
pExpr->op = TK_INTEGER;
if( pExpr->op==TK_NOTNULL ){
pExpr->u.zToken = "true";
ExprSetProperty(pExpr, EP_IsTrue);
}else{
pExpr->u.zToken = "false";
ExprSetProperty(pExpr, EP_IsFalse);
}
pExpr->op = TK_TRUEFALSE;
for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
p->nRef = anRef[i];
}
@@ -1253,8 +1256,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( pNC->nRef>=nRef );
if( nRef!=pNC->nRef ){
ExprSetProperty(pExpr, EP_VarSelect);
pNC->ncFlags |= NC_VarSelect;
}
pNC->ncFlags |= NC_Subquery;
}
break;
}
+6 -15
View File
@@ -2332,6 +2332,8 @@ void sqlite3SubqueryColumnTypes(
pCol->affinity = sqlite3ExprAffinity(p);
if( pCol->affinity<=SQLITE_AFF_NONE ){
pCol->affinity = aff;
}else if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
pCol->affinity = SQLITE_AFF_FLEXNUM;
}
if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){
int m = 0;
@@ -2345,9 +2347,6 @@ void sqlite3SubqueryColumnTypes(
if( pCol->affinity>=SQLITE_AFF_NUMERIC && (m&0x02)!=0 ){
pCol->affinity = SQLITE_AFF_BLOB;
}
if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){
pCol->affinity = SQLITE_AFF_FLEXNUM;
}
}
zType = columnType(&sNC, p, 0, 0, 0);
if( zType==0 || pCol->affinity!=sqlite3AffinityType(zType, 0) ){
@@ -3862,9 +3861,7 @@ static Expr *substExpr(
sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
}else{
sqlite3 *db = pSubst->pParse->db;
if( pSubst->isOuterJoin
&& (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
){
if( pSubst->isOuterJoin && pCopy->op!=TK_COLUMN ){
memset(&ifNullRow, 0, sizeof(ifNullRow));
ifNullRow.op = TK_IF_NULL_ROW;
ifNullRow.pLeft = pCopy;
@@ -5291,7 +5288,6 @@ static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
Expr *pY = pX->pEList->a[j].pExpr;
if( pY->op==TK_NULL ) continue;
pY->op = TK_NULL;
ExprClearProperty(pY, EP_Skip|EP_Unlikely);
pX->selFlags |= SF_PushDown;
nChng++;
}
@@ -6442,12 +6438,10 @@ static void optimizeAggregateUseOfIndexedExpr(
NameContext *pNC /* Name context used to resolve agg-func args */
){
assert( pAggInfo->iFirstReg==0 );
assert( pSelect!=0 );
assert( pSelect->pGroupBy!=0 );
pAggInfo->nColumn = pAggInfo->nAccumulator;
if( ALWAYS(pAggInfo->nSortingColumn>0) ){
if( pAggInfo->nColumn==0 ){
pAggInfo->nSortingColumn = pSelect->pGroupBy->nExpr;
pAggInfo->nSortingColumn = 0;
}else{
pAggInfo->nSortingColumn =
pAggInfo->aCol[pAggInfo->nColumn-1].iSorterColumn+1;
@@ -6485,8 +6479,7 @@ static int aggregateIdxEprRefToColCallback(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
pAggInfo = pExpr->pAggInfo;
if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue;
assert( pExpr->iAgg>=0 );
assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
pCol = &pAggInfo->aCol[pExpr->iAgg];
pExpr->op = TK_AGG_COLUMN;
pExpr->iTable = pCol->iTable;
@@ -6872,7 +6865,6 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
if( p->pWhere ) return 0;
if( p->pGroupBy ) return 0;
if( p->pOrderBy ) return 0;
pExpr = p->pEList->a[0].pExpr;
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
assert( ExprUseUToken(pExpr) );
@@ -6883,8 +6875,7 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
if( ExprHasProperty(pExpr, EP_WinFunc) ) return 0;/* Not a window function */
pSub = p->pSrc->a[0].pSelect;
if( pSub==0 ) return 0; /* The FROM is a subquery */
if( pSub->pPrior==0 ) return 0; /* Must be a compound */
if( pSub->selFlags & SF_CopyCte ) return 0; /* Not a CTE */
if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
do{
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
if( pSub->pWhere ) return 0; /* No WHERE clause */
+177 -86
View File
@@ -99,7 +99,6 @@ typedef unsigned short int u16;
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "sqlite3.h"
typedef sqlite3_int64 i64;
typedef sqlite3_uint64 u64;
@@ -2089,7 +2088,6 @@ static void printSchemaLine(FILE *out, const char *z, const char *zTail){
int i;
for(i=0; i<ArraySize(azTerm); i++){
char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
shell_check_oom(zNew);
if( sqlite3_complete(zNew) ){
size_t n = strlen(zNew);
zNew[n-1] = 0;
@@ -2524,9 +2522,9 @@ static int shell_callback(
sqlite3_uint64 ur;
memcpy(&ur,&r,sizeof(r));
if( ur==0x7ff0000000000000LL ){
raw_printf(p->out, "9.0e+999");
raw_printf(p->out, "1e999");
}else if( ur==0xfff0000000000000LL ){
raw_printf(p->out, "-9.0e+999");
raw_printf(p->out, "-1e999");
}else{
sqlite3_int64 ir = (sqlite3_int64)r;
if( r==(double)ir ){
@@ -2570,9 +2568,9 @@ static int shell_callback(
sqlite3_uint64 ur;
memcpy(&ur,&r,sizeof(r));
if( ur==0x7ff0000000000000LL ){
raw_printf(p->out, "9.0e+999");
raw_printf(p->out, "1e999");
}else if( ur==0xfff0000000000000LL ){
raw_printf(p->out, "-9.0e+999");
raw_printf(p->out, "-1e999");
}else{
sqlite3_snprintf(50,z,"%!.20g", r);
raw_printf(p->out, "%s", z);
@@ -2776,7 +2774,6 @@ static char *shell_error_context(const char *zSql, sqlite3 *db){
if( db==0
|| zSql==0
|| (iOffset = sqlite3_error_offset(db))<0
|| iOffset>=strlen(zSql)
){
return sqlite3_mprintf("");
}
@@ -3389,13 +3386,12 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
if( nVar==0 ) return; /* Nothing to do */
if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
"key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
rc = SQLITE_NOTFOUND;
pQ = 0;
}else{
rc = sqlite3_prepare_v2(pArg->db,
"SELECT value FROM temp.sqlite_parameters"
" WHERE key=?1", -1, &pQ, 0);
return; /* Parameter table does not exist */
}
rc = sqlite3_prepare_v2(pArg->db,
"SELECT value FROM temp.sqlite_parameters"
" WHERE key=?1", -1, &pQ, 0);
if( rc || pQ==0 ) return;
for(i=1; i<=nVar; i++){
char zNum[30];
const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
@@ -3404,12 +3400,8 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
zVar = zNum;
}
sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
if( sqlite3_step(pQ)==SQLITE_ROW ){
sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
}else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
sqlite3_bind_double(pStmt, i, NAN);
}else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
sqlite3_bind_double(pStmt, i, INFINITY);
}else{
sqlite3_bind_null(pStmt, i);
}
@@ -4631,10 +4623,8 @@ static const char *(azHelp[]) = {
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
".load FILE ?ENTRY? Load an extension library",
#endif
#if !defined(SQLITE_SHELL_FIDDLE)
".log FILE|on|off Turn logging on or off. FILE can be stderr/stdout",
#else
".log on|off Turn logging on or off.",
#ifndef SQLITE_SHELL_FIDDLE
".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
#endif
".mode MODE ?OPTIONS? Set output mode",
" MODE is one of:",
@@ -4902,27 +4892,16 @@ static char *readFile(const char *zName, int *pnByte){
long nIn;
size_t nRead;
char *pBuf;
int rc;
if( in==0 ) return 0;
rc = fseek(in, 0, SEEK_END);
if( rc!=0 ){
raw_printf(stderr, "Error: '%s' not seekable\n", zName);
fclose(in);
return 0;
}
fseek(in, 0, SEEK_END);
nIn = ftell(in);
rewind(in);
pBuf = sqlite3_malloc64( nIn+1 );
if( pBuf==0 ){
raw_printf(stderr, "Error: out of memory\n");
fclose(in);
return 0;
}
if( pBuf==0 ){ fclose(in); return 0; }
nRead = fread(pBuf, nIn, 1, in);
fclose(in);
if( nRead!=1 ){
sqlite3_free(pBuf);
raw_printf(stderr, "Error: cannot read '%s'\n", zName);
return 0;
}
pBuf[nIn] = 0;
@@ -5111,6 +5090,53 @@ readHexDb_error:
}
#endif /* SQLITE_OMIT_DESERIALIZE */
/*
** Scalar function "shell_int32". The first argument to this function
** must be a blob. The second a non-negative integer. This function
** reads and returns a 32-bit big-endian integer from byte
** offset (4*<arg2>) of the blob.
*/
static void shellInt32(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *pBlob;
int nBlob;
int iInt;
UNUSED_PARAMETER(argc);
nBlob = sqlite3_value_bytes(argv[0]);
pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
iInt = sqlite3_value_int(argv[1]);
if( iInt>=0 && (iInt+1)*4<=nBlob ){
const unsigned char *a = &pBlob[iInt*4];
sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
+ ((sqlite3_int64)a[1]<<16)
+ ((sqlite3_int64)a[2]<< 8)
+ ((sqlite3_int64)a[3]<< 0);
sqlite3_result_int64(context, iVal);
}
}
/*
** Scalar function "shell_idquote(X)" returns string X quoted as an identifier,
** using "..." with internal double-quote characters doubled.
*/
static void shellIdQuote(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zName = (const char*)sqlite3_value_text(argv[0]);
UNUSED_PARAMETER(argc);
if( zName ){
char *z = sqlite3_mprintf("\"%w\"", zName);
sqlite3_result_text(context, z, -1, sqlite3_free);
}
}
/*
** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
*/
@@ -5125,6 +5151,97 @@ static void shellUSleepFunc(
sqlite3_result_int(context, sleep);
}
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
** function quote(). If the first character of the input is "'",
** indicating that the value passed to quote() was a text value,
** then this function searches the input for "\n" and "\r" characters
** and adds a wrapper similar to the following:
**
** replace(replace(<input>, '\n', char(10), '\r', char(13));
**
** Or, if the first character of the input is not "'", then a copy
** of the input is returned.
*/
static void shellEscapeCrnl(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zText = (const char*)sqlite3_value_text(argv[0]);
UNUSED_PARAMETER(argc);
if( zText && zText[0]=='\'' ){
i64 nText = sqlite3_value_bytes(argv[0]);
i64 i;
char zBuf1[20];
char zBuf2[20];
const char *zNL = 0;
const char *zCR = 0;
i64 nCR = 0;
i64 nNL = 0;
for(i=0; zText[i]; i++){
if( zNL==0 && zText[i]=='\n' ){
zNL = unused_string(zText, "\\n", "\\012", zBuf1);
nNL = strlen(zNL);
}
if( zCR==0 && zText[i]=='\r' ){
zCR = unused_string(zText, "\\r", "\\015", zBuf2);
nCR = strlen(zCR);
}
}
if( zNL || zCR ){
i64 iOut = 0;
i64 nMax = (nNL > nCR) ? nNL : nCR;
i64 nAlloc = nMax * nText + (nMax+64)*2;
char *zOut = (char*)sqlite3_malloc64(nAlloc);
if( zOut==0 ){
sqlite3_result_error_nomem(context);
return;
}
if( zNL && zCR ){
memcpy(&zOut[iOut], "replace(replace(", 16);
iOut += 16;
}else{
memcpy(&zOut[iOut], "replace(", 8);
iOut += 8;
}
for(i=0; zText[i]; i++){
if( zText[i]=='\n' ){
memcpy(&zOut[iOut], zNL, nNL);
iOut += nNL;
}else if( zText[i]=='\r' ){
memcpy(&zOut[iOut], zCR, nCR);
iOut += nCR;
}else{
zOut[iOut] = zText[i];
iOut++;
}
}
if( zNL ){
memcpy(&zOut[iOut], ",'", 2); iOut += 2;
memcpy(&zOut[iOut], zNL, nNL); iOut += nNL;
memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12;
}
if( zCR ){
memcpy(&zOut[iOut], ",'", 2); iOut += 2;
memcpy(&zOut[iOut], zCR, nCR); iOut += nCR;
memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12;
}
sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT);
sqlite3_free(zOut);
return;
}
}
sqlite3_result_value(context, argv[0]);
}
/* Flags for open_db().
**
** The default behavior of open_db() is to exit(1) if the database fails to
@@ -5190,7 +5307,6 @@ static void open_db(ShellState *p, int openFlags){
}
exit(1);
}
sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
sqlite3_enable_load_extension(p->db, 1);
@@ -5207,6 +5323,9 @@ static void open_db(ShellState *p, int openFlags){
sqlite3_fileio_init(p->db, 0, 0);
sqlite3_completion_init(p->db, 0, 0);
#endif
#if SQLITE_SHELL_HAVE_RECOVER
sqlite3_dbdata_init(p->db, 0, 0);
#endif
#ifdef SQLITE_HAVE_ZLIB
if( !p->bSafeModePersist ){
sqlite3_zipfile_init(p->db, 0, 0);
@@ -5247,6 +5366,12 @@ static void open_db(ShellState *p, int openFlags){
shellModuleSchema, 0, 0);
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
shellPutsFunc, 0, 0);
sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
shellEscapeCrnl, 0, 0);
sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
shellInt32, 0, 0);
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
shellIdQuote, 0, 0);
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
shellUSleepFunc, 0, 0);
#ifndef SQLITE_NOHAVE_SYSTEM
@@ -5273,9 +5398,9 @@ static void open_db(ShellState *p, int openFlags){
aData = (unsigned char*)readFile(zDbFilename, &nData);
}else{
aData = readHexDb(p, &nData);
}
if( aData==0 ){
return;
if( aData==0 ){
return;
}
}
rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
SQLITE_DESERIALIZE_RESIZEABLE |
@@ -5289,13 +5414,8 @@ static void open_db(ShellState *p, int openFlags){
}
#endif
}
if( p->db!=0 ){
if( p->bSafeModePersist ){
sqlite3_set_authorizer(p->db, safeModeAuth, p);
}
sqlite3_db_config(
p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
);
if( p->bSafeModePersist && p->db!=0 ){
sqlite3_set_authorizer(p->db, safeModeAuth, p);
}
}
@@ -7914,6 +8034,7 @@ static int do_meta_command(char *zLine, ShellState *p){
raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
rc = 2;
}else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
rc = 2;
}else if( testcase_glob(azArg[1],zRes)==0 ){
utf8_printf(stderr,
@@ -8043,8 +8164,6 @@ static int do_meta_command(char *zLine, ShellState *p){
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
{ "reverse_scanorder", SQLITE_DBCONFIG_REVERSE_SCANORDER },
{ "stmt_scanstatus", SQLITE_DBCONFIG_STMT_SCANSTATUS },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
@@ -8994,25 +9113,19 @@ static int do_meta_command(char *zLine, ShellState *p){
}else
#endif
#ifndef SQLITE_SHELL_FIDDLE
if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
failIfSafeMode(p, "cannot run .log in safe mode");
if( nArg!=2 ){
raw_printf(stderr, "Usage: .log FILENAME\n");
rc = 1;
}else{
const char *zFile = azArg[1];
if( p->bSafeMode
&& cli_strcmp(zFile,"on")!=0
&& cli_strcmp(zFile,"off")!=0
){
raw_printf(stdout, "cannot set .log to anything other "
"than \"on\" or \"off\"\n");
zFile = "off";
}
output_file_close(p->pLog);
if( cli_strcmp(zFile,"on")==0 ) zFile = "stdout";
p->pLog = output_file_open(zFile, 0);
}
}else
#endif
if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
const char *zMode = 0;
@@ -9648,9 +9761,6 @@ static int do_meta_command(char *zLine, ShellState *p){
}else{
p->scanstatsOn = (u8)booleanValue(azArg[1]);
}
sqlite3_db_config(
p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
);
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
#endif
@@ -11531,7 +11641,6 @@ static void process_sqliterc(
** Show available command line options
*/
static const char zOptions[] =
" -- treat no subsequent arguments as options\n"
#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
" -A ARGS... run \".archive ARGS\" and exit\n"
#endif
@@ -11594,9 +11703,9 @@ static const char zOptions[] =
;
static void usage(int showDetail){
utf8_printf(stderr,
"Usage: %s [OPTIONS] [FILENAME [SQL]]\n"
"Usage: %s [OPTIONS] FILENAME [SQL]\n"
"FILENAME is the name of an SQLite database. A new database is created\n"
"if the file does not previously exist. Defaults to :memory:.\n", Argv0);
"if the file does not previously exist.\n", Argv0);
if( showDetail ){
utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
}else{
@@ -11628,11 +11737,9 @@ static void main_init(ShellState *data) {
memcpy(data->rowSeparator,SEP_Row, 2);
data->showHeader = 0;
data->shellFlgs = SHFLG_Lookaside;
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
#if !defined(SQLITE_SHELL_FIDDLE)
verify_uninitialized();
#endif
sqlite3_config(SQLITE_CONFIG_URI, 1);
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
@@ -11709,7 +11816,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
int warnInmemoryDb = 0;
int readStdin = 1;
int nCmd = 0;
int nOptsEnd = argc;
char **azCmd = 0;
const char *zVfs = 0; /* Value of -vfs command-line option */
#if !SQLITE_SHELL_IS_UTF8
@@ -11813,13 +11919,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
** the size of the alternative malloc heap,
** and the first command to execute.
*/
#ifndef SQLITE_SHELL_FIDDLE
verify_uninitialized();
#endif
for(i=1; i<argc; i++){
char *z;
z = argv[i];
if( z[0]!='-' || i>nOptsEnd ){
if( z[0]!='-' ){
if( data.aAuxDb->zDbFilename==0 ){
data.aAuxDb->zDbFilename = z;
}else{
@@ -11831,13 +11935,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
shell_check_oom(azCmd);
azCmd[nCmd-1] = z;
}
continue;
}
if( z[1]=='-' ) z++;
if( cli_strcmp(z, "-")==0 ){
nOptsEnd = i;
continue;
}else if( cli_strcmp(z,"-separator")==0
if( cli_strcmp(z,"-separator")==0
|| cli_strcmp(z,"-nullvalue")==0
|| cli_strcmp(z,"-newline")==0
|| cli_strcmp(z,"-cmd")==0
@@ -11859,7 +11959,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
zSize = cmdline_option_value(argc, argv, ++i);
szHeap = integerValue(zSize);
if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
verify_uninitialized();
sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
#else
(void)cmdline_option_value(argc, argv, ++i);
@@ -11873,7 +11972,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
n = 0xffffffffffffLL/sz;
}
verify_uninitialized();
sqlite3_config(SQLITE_CONFIG_PAGECACHE,
(n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
data.shellFlgs |= SHFLG_Pagecache;
@@ -11883,13 +11981,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
if( sz<0 ) sz = 0;
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
if( n<0 ) n = 0;
verify_uninitialized();
sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
}else if( cli_strcmp(z,"-threadsafe")==0 ){
int n;
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
verify_uninitialized();
switch( n ){
case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
@@ -11913,12 +12009,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}else if( cli_strcmp(z,"-mmap")==0 ){
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
verify_uninitialized();
sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
#if defined(SQLITE_ENABLE_SORTER_REFERENCES)
#ifdef SQLITE_ENABLE_SORTER_REFERENCES
}else if( cli_strcmp(z,"-sorterref")==0 ){
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
verify_uninitialized();
sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
#endif
}else if( cli_strcmp(z,"-vfs")==0 ){
@@ -11956,9 +12050,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
/* no-op - catch this on the second pass */
}
}
#ifndef SQLITE_SHELL_FIDDLE
verify_uninitialized();
#endif
#ifdef SQLITE_SHELL_INIT_PROC
@@ -12022,7 +12114,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
*/
for(i=1; i<argc; i++){
char *z = argv[i];
if( z[0]!='-' || i>=nOptsEnd ) continue;
if( z[0]!='-' ) continue;
if( z[1]=='-' ){ z++; }
if( cli_strcmp(z,"-init")==0 ){
i++;
@@ -12206,7 +12298,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
}
}else{
open_db(&data, 0);
echo_group_input(&data, azCmd[i]);
rc = shell_exec(&data, azCmd[i], &zErrMsg);
if( zErrMsg || rc ){
if( zErrMsg!=0 ){
+9 -51
View File
@@ -1655,23 +1655,20 @@ int sqlite3_os_end(void);
** must ensure that no other SQLite interfaces are invoked by other
** threads while sqlite3_config() is running.</b>
**
** The sqlite3_config() interface
** may only be invoked prior to library initialization using
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
** Note, however, that ^sqlite3_config() can be called as part of the
** implementation of an application-defined [sqlite3_os_init()].
**
** The first argument to sqlite3_config() is an integer
** [configuration option] that determines
** what property of SQLite is to be configured. Subsequent arguments
** vary depending on the [configuration option]
** in the first argument.
**
** For most configuration options, the sqlite3_config() interface
** may only be invoked prior to library initialization using
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
** The exceptional configuration options that may be invoked at any time
** are called "anytime configuration options".
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
** [sqlite3_shutdown()] with a first argument that is not an anytime
** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
** Note, however, that ^sqlite3_config() can be called as part of the
** implementation of an application-defined [sqlite3_os_init()].
**
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
** ^If the option is unknown or SQLite is unable to set the option
** then this routine returns a non-zero [error code].
@@ -1779,23 +1776,6 @@ struct sqlite3_mem_methods {
** These constants are the available integer configuration options that
** can be passed as the first argument to the [sqlite3_config()] interface.
**
** Most of the configuration options for sqlite3_config()
** will only work if invoked prior to [sqlite3_initialize()] or after
** [sqlite3_shutdown()]. The few exceptions to this rule are called
** "anytime configuration options".
** ^Calling [sqlite3_config()] with a first argument that is not an
** anytime configuration option in between calls to [sqlite3_initialize()] and
** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
**
** The set of anytime configuration options can change (by insertions
** and/or deletions) from one release of SQLite to the next.
** As of SQLite version 3.42.0, the complete set of anytime configuration
** options is:
** <ul>
** <li> SQLITE_CONFIG_LOG
** <li> SQLITE_CONFIG_PCACHE_HDRSZ
** </ul>
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued. Applications
** should check the return code from [sqlite3_config()] to make sure that
@@ -2456,26 +2436,6 @@ struct sqlite3_mem_methods {
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
** either generated columns or decending indexes.
** </dd>
**
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
** statistics. For statistics to be collected, the flag must be set on
** the database handle both when the SQL statement is prepared and when it
** is stepped. The flag is set (collection of statistics is enabled)
** by default.</dd>
**
** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
** in which tables and indexes are scanned so that the scans start at the end
** and work toward the beginning rather than starting at the beginning and
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
** is useful for application testing.</dd>
**
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2496,9 +2456,7 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1080 /* int int* */
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
+5 -18
View File
@@ -224,8 +224,8 @@
#endif
/*
** A few places in the code require atomic load/store of aligned
** integer values.
** WAL mode depends on atomic aligned 32-bit loads and stores in a few
** places. The following macros try to make this explicit.
*/
#ifndef __has_extension
# define __has_extension(x) 0 /* compatibility with non-clang compilers */
@@ -1757,7 +1757,7 @@ struct sqlite3 {
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
/* result set is empty */
#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
#define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
@@ -1783,7 +1783,6 @@ struct sqlite3 {
/* DELETE, or UPDATE and return */
/* the count using a callback. */
#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
/* Flags used only if debugging */
#ifdef SQLITE_DEBUG
@@ -3343,7 +3342,7 @@ struct NameContext {
#define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
#define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
#define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
#define NC_Subquery 0x000040 /* A subquery has been seen */
#define NC_VarSelect 0x000040 /* A correlated subquery has been seen */
#define NC_UEList 0x000080 /* True if uNC.pEList is used */
#define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
#define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
@@ -3662,7 +3661,6 @@ struct IndexedExpr {
int iIdxCur; /* The index cursor */
int iIdxCol; /* The index column that contains value of pExpr */
u8 bMaybeNullRow; /* True if we need an OP_IfNullRow check */
u8 aff; /* Affinity of the pExpr expression */
IndexedExpr *pIENext; /* Next in a list of all indexed expressions */
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
const char *zIdxName; /* Name of index, used only for bytecode comments */
@@ -3714,9 +3712,6 @@ struct Parse {
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
#endif
#ifdef SQLITE_DEBUG
u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
#endif
int nRangeReg; /* Size of the temporary register block */
int iRangeReg; /* First register in temporary register block */
@@ -4649,8 +4644,6 @@ void sqlite3ReleaseTempReg(Parse*,int);
int sqlite3GetTempRange(Parse*,int);
void sqlite3ReleaseTempRange(Parse*,int,int);
void sqlite3ClearTempRegCache(Parse*);
void sqlite3TouchRegister(Parse*,int);
int sqlite3FirstAvailableRegister(Parse*,int);
#ifdef SQLITE_DEBUG
int sqlite3NoTempsInRange(Parse*,int,int);
#endif
@@ -4801,7 +4794,7 @@ Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
Expr*,ExprList*,u32,Expr*);
void sqlite3SelectDelete(sqlite3*, Select*);
Table *sqlite3SrcListLookup(Parse*, SrcList*);
int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
int sqlite3IsReadOnly(Parse*, Table*, int);
void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
@@ -5588,10 +5581,4 @@ int sqlite3KvvfsInit(void);
sqlite3_uint64 sqlite3Hwtime(void);
#endif
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
# define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
#else
# define IS_STMT_SCANSTATUS(db) 0
#endif
#endif /* SQLITEINT_H */
-67
View File
@@ -16,13 +16,6 @@
#include "sqliteInt.h"
#if SQLITE_OS_WIN
# include "os_win.h"
# include <windows.h>
#else
# include <unistd.h>
# if defined(__APPLE__)
# include <sys/param.h>
# include <sys/sysctl.h>
# endif
#endif
#include "vdbeInt.h"
@@ -2391,29 +2384,6 @@ static int SQLITE_TCLAPI vfsCurrentTimeInt64(
return TCL_OK;
}
/*
** Usage: create_null_module DB NAME
*/
static int SQLITE_TCLAPI test_create_null_module(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
sqlite3 *db;
char *zName;
if( objc!=3 ){
Tcl_WrongNumArgs(interp, 1, objv, "DB DBNAME");
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
zName = Tcl_GetString(objv[2]);
sqlite3_create_module(db, zName, 0, 0);
return TCL_OK;
}
#ifdef SQLITE_ENABLE_SNAPSHOT
/*
** Usage: sqlite3_snapshot_get DB DBNAME
@@ -8313,7 +8283,6 @@ static int SQLITE_TCLAPI test_sqlite3_db_config(
{ "DQS_DML", SQLITE_DBCONFIG_DQS_DML },
{ "DQS_DDL", SQLITE_DBCONFIG_DQS_DDL },
{ "LEGACY_FILE_FORMAT", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
{ "STMT_SCANSTATUS", SQLITE_DBCONFIG_STMT_SCANSTATUS },
};
int i;
int v = 0;
@@ -8670,40 +8639,6 @@ static int SQLITE_TCLAPI test_autovacuum_pages(
return TCL_OK;
}
/*
** Usage: number_of_cores
**
** Return a guess at the number of available cores available on the
** processor on which this process is running.
*/
static int SQLITE_TCLAPI guess_number_of_cores(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
unsigned int nCore = 1;
#if SQLITE_OS_WIN
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
nCore = (unsigned int)sysinfo.dwNumberOfProcessors;
#elif defined(__APPLE__)
int nm[2];
size_t len = 4;
nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
sysctl(nm, 2, &nCore, &len, NULL, 0);
if( nCore<1 ){
nm[1] = HW_NCPU;
sysctl(nm, 2, &nCore, &len, NULL, 0);
}
#else
nCore = sysconf(_SC_NPROCESSORS_ONLN);
#endif
if( nCore<=0 ) nCore = 1;
Tcl_SetObjResult(interp, Tcl_NewIntObj((int)nCore));
return SQLITE_OK;
}
/*
** Register commands with the TCL interpreter.
@@ -9004,8 +8939,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "test_write_db", test_write_db, 0 },
{ "sqlite3_register_cksumvfs", test_register_cksumvfs, 0 },
{ "sqlite3_unregister_cksumvfs", test_unregister_cksumvfs, 0 },
{ "number_of_cores", guess_number_of_cores, 0 },
{ "create_null_module", test_create_null_module, 0 },
};
static int bitmask_size = sizeof(Bitmask)*8;
static int longdouble_size = sizeof(LONGDOUBLE_TYPE);
+1 -5
View File
@@ -202,7 +202,6 @@ void sqlite3BeginTrigger(
}else{
assert( !db->init.busy );
sqlite3CodeVerifySchema(pParse, iDb);
VVA_ONLY( pParse->ifNotExists = 1; )
}
goto trigger_cleanup;
}
@@ -984,7 +983,7 @@ static void codeReturningTrigger(
}
sqlite3ExprListDelete(db, sSelect.pEList);
pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
if( pParse->nErr==0 ){
if( !db->mallocFailed ){
NameContext sNC;
memset(&sNC, 0, sizeof(sNC));
if( pReturning->nRetCol==0 ){
@@ -1453,9 +1452,6 @@ u32 sqlite3TriggerColmask(
Trigger *p;
assert( isNew==1 || isNew==0 );
if( IsView(pTab) ){
return 0xffffffff;
}
for(p=pTrigger; p; p=p->pNext){
if( p->op==op
&& (tr_tm&p->tr_tm)
+6 -16
View File
@@ -408,7 +408,7 @@ void sqlite3Update(
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
goto update_cleanup;
}
if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
goto update_cleanup;
}
@@ -727,22 +727,12 @@ void sqlite3Update(
/* Begin the database scan.
**
** Do not consider a single-pass strategy for a multi-row update if
** there is anything that might disrupt the cursor being used to do
** the UPDATE:
** (1) This is a nested UPDATE
** (2) There are triggers
** (3) There are FOREIGN KEY constraints
** (4) There are REPLACE conflict handlers
** (5) There are subqueries in the WHERE clause
*/
** there are any triggers or foreign keys to process, or rows may
** be deleted as a result of REPLACE conflict handling. Any of these
** things might disturb a cursor being used to scan through the table
** or index, causing a single-pass approach to malfunction. */
flags = WHERE_ONEPASS_DESIRED;
if( !pParse->nested
&& !pTrigger
&& !hasFK
&& !chngKey
&& !bReplace
&& (sNC.ncFlags & NC_Subquery)==0
){
if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
flags |= WHERE_ONEPASS_MULTIROW;
}
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
+80 -52
View File
@@ -683,10 +683,8 @@ static u64 filterHash(const Mem *aMem, const Op *pOp){
}else if( p->flags & MEM_Real ){
h += sqlite3VdbeIntValue(p);
}else if( p->flags & (MEM_Str|MEM_Blob) ){
/* All strings have the same hash and all blobs have the same hash,
** though, at least, those hashes are different from each other and
** from NULL. */
h += 4093 + (p->flags & (MEM_Str|MEM_Blob));
h += p->n;
if( p->flags & MEM_Zero ) h += p->u.nZero;
}
}
return h;
@@ -736,7 +734,6 @@ int sqlite3VdbeExec(
Mem *pOut = 0; /* Output operand */
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
u64 *pnCycle = 0;
int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0;
#endif
/*** INSERT STACK UNION HERE ***/
@@ -801,17 +798,13 @@ int sqlite3VdbeExec(
assert( pOp>=aOp && pOp<&aOp[p->nOp]);
nVmStep++;
#if defined(VDBE_PROFILE)
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
pOp->nExec++;
pnCycle = &pOp->nCycle;
if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime();
#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
if( bStmtScanStatus ){
pOp->nExec++;
pnCycle = &pOp->nCycle;
# ifdef VDBE_PROFILE
if( sqlite3NProfileCnt==0 )
# endif
*pnCycle -= sqlite3Hwtime();
}
#endif
/* Only allow tracing if SQLITE_DEBUG is defined.
@@ -2606,34 +2599,88 @@ case OP_IsNull: { /* same as TK_ISNULL, jump, in1 */
break;
}
/* Opcode: IsType P1 P2 P3 * *
** Synopsis: if typeof(P3) in P1 goto P2
/* Opcode: IsType P1 P2 P3 P4 P5
** Synopsis: if typeof(P1.P3) in P5 goto P2
**
** Jump to P2 if register P3 has one of the datatypes specified
** by the P1 bitmask.
** Jump to P2 if the type of a column in a btree is one of the types specified
** by the P5 bitmask.
**
** P1 is a bitmask of data types. SQLITE_INTEGER is the least significant
** P1 is normally a cursor on a btree for which the row decode cache is
** valid through at least column P3. In other words, there should have been
** a prior OP_Column for column P3 or greater. If the cursor is not valid,
** then this opcode might give spurious results.
** The the btree row has fewer than P3 columns, then use P4 as the
** datatype.
**
** If P1 is -1, then P3 is a register number and the datatype is taken
** from the value in that register.
**
** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
**
** Take the jump to address P2 if and only if the datatype of the
** value determined by P1 and P3 corresponds to one of the bits in P1.
** value determined by P1 and P3 corresponds to one of the bits in the
** P5 bitmask.
**
*/
case OP_IsType: { /* jump */
VdbeCursor *pC;
u16 typeMask;
u32 serialType;
assert( (pOp->p1 & 0x1f)==pOp->p1 );
assert( pOp->p3>=0 && pOp->p3<(p->nMem+1 - p->nCursor) );
assert( memIsValid(&aMem[pOp->p3]) );
typeMask = 1 << (sqlite3_value_type((sqlite3_value*)&aMem[pOp->p3])-1);
testcase( typeMask==0x01 );
testcase( typeMask==0x02 );
testcase( typeMask==0x04 );
testcase( typeMask==0x08 );
testcase( typeMask==0x10 );
VdbeBranchTaken( (typeMask & pOp->p1)!=0, 2);
if( typeMask & pOp->p1 ){
assert( pOp->p1>=(-1) && pOp->p1<p->nCursor );
assert( pOp->p1>=0 || (pOp->p3>=0 && pOp->p3<=(p->nMem+1 - p->nCursor)) );
if( pOp->p1>=0 ){
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
assert( pOp->p3>=0 );
if( pOp->p3<pC->nHdrParsed ){
serialType = pC->aType[pOp->p3];
if( serialType>=12 ){
if( serialType&1 ){
typeMask = 0x04; /* SQLITE_TEXT */
}else{
typeMask = 0x08; /* SQLITE_BLOB */
}
}else{
static const unsigned char aMask[] = {
0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x2,
0x01, 0x01, 0x10, 0x10
};
testcase( serialType==0 );
testcase( serialType==1 );
testcase( serialType==2 );
testcase( serialType==3 );
testcase( serialType==4 );
testcase( serialType==5 );
testcase( serialType==6 );
testcase( serialType==7 );
testcase( serialType==8 );
testcase( serialType==9 );
testcase( serialType==10 );
testcase( serialType==11 );
typeMask = aMask[serialType];
}
}else{
typeMask = 1 << (pOp->p4.i - 1);
testcase( typeMask==0x01 );
testcase( typeMask==0x02 );
testcase( typeMask==0x04 );
testcase( typeMask==0x08 );
testcase( typeMask==0x10 );
}
}else{
assert( memIsValid(&aMem[pOp->p3]) );
typeMask = 1 << (sqlite3_value_type((sqlite3_value*)&aMem[pOp->p3])-1);
testcase( typeMask==0x01 );
testcase( typeMask==0x02 );
testcase( typeMask==0x04 );
testcase( typeMask==0x08 );
testcase( typeMask==0x10 );
}
VdbeBranchTaken( (typeMask & pOp->p5)!=0, 2);
if( typeMask & pOp->p5 ){
goto jump_to_p2;
}
break;
@@ -2743,8 +2790,7 @@ case OP_Offset: { /* out3 */
**
** If the record contains fewer than P2 fields, then extract a NULL. Or,
** if the P4 argument is a P4_MEM use the value of the P4 argument as
** the result. If the P4 argument is P4_INT32 than P4 determines the
** datatype of a constructed element that becomes the result.
** the result.
**
** If the OPFLAG_LENGTHARG bit is set in P5 then the result is guaranteed
** to only be used by the length() function or the equivalent. The content
@@ -2950,20 +2996,6 @@ op_column_restart:
sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);
}else{
sqlite3VdbeMemSetNull(pDest);
if( pOp->p4type==P4_INT32 ){
static unsigned char aType[] = {
0,
MEM_Int,
MEM_Real,
MEM_Str,
MEM_Blob,
MEM_Null
};
assert( pOp->p4.i>=SQLITE_INTEGER );
assert( pOp->p4.i<=SQLITE_NULL );
sqlite3VdbeMemSetZeroBlob(pDest, 0);
pDest->flags = aType[pOp->p4.i];
}
}
goto op_column_out;
}
@@ -4934,7 +4966,6 @@ case OP_SeekScan: { /* ncycle */
break;
}
nStep--;
pC->cacheStatus = CACHE_STALE;
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
if( rc ){
if( rc==SQLITE_DONE ){
@@ -7587,7 +7618,6 @@ case OP_AggFinal: {
}
sqlite3VdbeChangeEncoding(pMem, encoding);
UPDATE_MAX_BLOBSIZE(pMem);
REGISTER_TRACE((int)(pMem-aMem), pMem);
break;
}
@@ -8726,10 +8756,8 @@ default: { /* This is really OP_Noop, OP_Explain */
*pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
pnCycle = 0;
#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
if( pnCycle ){
*pnCycle += sqlite3Hwtime();
pnCycle = 0;
}
*pnCycle += sqlite3Hwtime();
pnCycle = 0;
#endif
/* The following code adds nothing to the actual functionality
+39 -45
View File
@@ -443,10 +443,10 @@ void sqlite3ExplainBreakpoint(const char *z1, const char *z2){
*/
int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
int addr = 0;
#if !defined(SQLITE_DEBUG)
#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
/* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
** But omit them (for performance) during production builds */
if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
if( pParse->explain==2 )
#endif
{
char *zMsg;
@@ -1122,20 +1122,18 @@ void sqlite3VdbeScanStatus(
LogEst nEst, /* Estimated number of output rows */
const char *zName /* Name of table or index being scanned */
){
if( IS_STMT_SCANSTATUS(p->db) ){
sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
ScanStatus *aNew;
aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
if( aNew ){
ScanStatus *pNew = &aNew[p->nScan++];
memset(pNew, 0, sizeof(ScanStatus));
pNew->addrExplain = addrExplain;
pNew->addrLoop = addrLoop;
pNew->addrVisit = addrVisit;
pNew->nEst = nEst;
pNew->zName = sqlite3DbStrDup(p->db, zName);
p->aScan = aNew;
}
sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
ScanStatus *aNew;
aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
if( aNew ){
ScanStatus *pNew = &aNew[p->nScan++];
memset(pNew, 0, sizeof(ScanStatus));
pNew->addrExplain = addrExplain;
pNew->addrLoop = addrLoop;
pNew->addrVisit = addrVisit;
pNew->nEst = nEst;
pNew->zName = sqlite3DbStrDup(p->db, zName);
p->aScan = aNew;
}
}
@@ -1152,22 +1150,20 @@ void sqlite3VdbeScanStatusRange(
int addrStart,
int addrEnd
){
if( IS_STMT_SCANSTATUS(p->db) ){
ScanStatus *pScan = 0;
int ii;
for(ii=p->nScan-1; ii>=0; ii--){
pScan = &p->aScan[ii];
if( pScan->addrExplain==addrExplain ) break;
pScan = 0;
}
if( pScan ){
if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
if( pScan->aAddrRange[ii]==0 ){
pScan->aAddrRange[ii] = addrStart;
pScan->aAddrRange[ii+1] = addrEnd;
break;
}
ScanStatus *pScan = 0;
int ii;
for(ii=p->nScan-1; ii>=0; ii--){
pScan = &p->aScan[ii];
if( pScan->addrExplain==addrExplain ) break;
pScan = 0;
}
if( pScan ){
if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
if( pScan->aAddrRange[ii]==0 ){
pScan->aAddrRange[ii] = addrStart;
pScan->aAddrRange[ii+1] = addrEnd;
break;
}
}
}
@@ -1184,21 +1180,19 @@ void sqlite3VdbeScanStatusCounters(
int addrLoop,
int addrVisit
){
if( IS_STMT_SCANSTATUS(p->db) ){
ScanStatus *pScan = 0;
int ii;
for(ii=p->nScan-1; ii>=0; ii--){
pScan = &p->aScan[ii];
if( pScan->addrExplain==addrExplain ) break;
pScan = 0;
}
if( pScan ){
pScan->addrLoop = addrLoop;
pScan->addrVisit = addrVisit;
}
ScanStatus *pScan = 0;
int ii;
for(ii=p->nScan-1; ii>=0; ii--){
pScan = &p->aScan[ii];
if( pScan->addrExplain==addrExplain ) break;
pScan = 0;
}
if( pScan ){
pScan->addrLoop = addrLoop;
pScan->addrVisit = addrVisit;
}
}
#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
#endif
/*
+6 -2
View File
@@ -1519,11 +1519,16 @@ static int valueFromFunction(
}else{
sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
assert( rc==SQLITE_OK );
assert( enc==pVal->enc
|| (pVal->flags & MEM_Str)==0
|| db->mallocFailed );
#if 0 /* Not reachable except after a prior failure */
rc = sqlite3VdbeChangeEncoding(pVal, enc);
if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
rc = SQLITE_TOOBIG;
pCtx->pParse->nErr++;
}
#endif
}
value_from_function_out:
@@ -1587,7 +1592,6 @@ static int valueFromExpr(
rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
testcase( rc!=SQLITE_OK );
if( *ppVal ){
rc = ExpandBlob(*ppVal);
sqlite3VdbeMemCast(*ppVal, aff, enc);
sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
}
-2
View File
@@ -610,9 +610,7 @@ static int vtabCallConstructor(
sCtx.pPrior = db->pVtabCtx;
sCtx.bDeclared = 0;
db->pVtabCtx = &sCtx;
pTab->nTabRef++;
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
sqlite3DeleteTable(db, pTab);
db->pVtabCtx = sCtx.pPrior;
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
assert( sCtx.pTab==pTab );
+8 -41
View File
@@ -831,7 +831,7 @@ static void explainAutomaticIndex(
int bPartial, /* True if pIdx is a partial index */
int *pAddrExplain /* OUT: Address of OP_Explain */
){
if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
if( pParse->explain!=2 ){
Table *pTab = pIdx->pTable;
const char *zSep = "";
char *zText = 0;
@@ -892,8 +892,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warning has been issued */
u8 useBloomFilter = 0; /* True to also add a Bloom filter */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
SrcItem *pTabItem; /* FROM clause term being indexed */
@@ -963,11 +962,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
if( IsView(pTable) ){
extraCols = ALLBITS;
}else{
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
}
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
@@ -1003,16 +998,6 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
if( ALWAYS(pX->pLeft!=0)
&& sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT
){
/* TUNING: only use a Bloom filter on an automatic index
** if one or more key columns has the ability to hold numeric
** values, since strings all have the same hash in the Bloom
** filter implementation and hence a Bloom filter on a text column
** is not usually helpful. */
useBloomFilter = 1;
}
}
}
}
@@ -1045,8 +1030,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
pLevel->regFilter = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
}
@@ -1139,10 +1123,6 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
Vdbe *v = pParse->pVdbe; /* VDBE under construction */
WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
int iCur; /* Cursor for table getting the filter */
IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */
saved_pIdxEpr = pParse->pIdxEpr;
pParse->pIdxEpr = 0;
assert( pLoop!=0 );
assert( v!=0 );
@@ -1199,8 +1179,9 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
int r1 = sqlite3GetTempRange(pParse, n);
int jj;
for(jj=0; jj<n; jj++){
int iCol = pIdx->aiColumn[jj];
assert( pIdx->pTable==pItem->pTab );
sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
}
sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
sqlite3ReleaseTempRange(pParse, r1, n);
@@ -1231,7 +1212,6 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
}
}while( iLevel < pWInfo->nLevel );
sqlite3VdbeJumpHere(v, addrOnce);
pParse->pIdxEpr = saved_pIdxEpr;
}
@@ -1530,7 +1510,6 @@ static int whereKeyStats(
assert( pRec!=0 );
assert( pIdx->nSample>0 );
assert( pRec->nField>0 );
/* Do a binary search to find the first sample greater than or equal
** to pRec. If pRec contains a single field, the set of samples to search
@@ -1576,12 +1555,7 @@ static int whereKeyStats(
** it is extended to two fields. The duplicates that this creates do not
** cause any problems.
*/
if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
nField = pIdx->nKeyCol;
}else{
nField = pIdx->nColumn;
}
nField = MIN(pRec->nField, nField);
nField = MIN(pRec->nField, pIdx->nSample);
iCol = 0;
iSample = pIdx->nSample * nField;
do{
@@ -5309,10 +5283,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
}
if( pWInfo->pSelect->pOrderBy
&& pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
}
}else{
pWInfo->revMask = pFrom->revLoop;
if( pWInfo->nOBSat<=0 ){
@@ -5724,9 +5694,6 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
p->iIdxCur = iIdxCur;
p->iIdxCol = i;
p->bMaybeNullRow = bMaybeNullRow;
if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){
p->aff = pIdx->zColAff[i];
}
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
p->zIdxName = pIdx->zName;
#endif
@@ -6242,7 +6209,7 @@ WhereInfo *sqlite3WhereBegin(
assert( n<=pTab->nCol );
}
#ifdef SQLITE_ENABLE_CURSOR_HINTS
if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
if( pLoop->u.btree.pIndex!=0 ){
sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
}else
#endif
+24 -26
View File
@@ -111,9 +111,9 @@ static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){
/*
** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
** was defined at compile-time. If it is not a no-op, a single OP_Explain
** opcode is added to the output to describe the table scan strategy in pLevel.
** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
** is added to the output to describe the table scan strategy in pLevel.
**
** If an OP_Explain opcode is added to the VM, its address is returned.
** Otherwise, if no OP_Explain is coded, zero is returned.
@@ -125,8 +125,8 @@ int sqlite3WhereExplainOneScan(
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
){
int ret = 0;
#if !defined(SQLITE_DEBUG)
if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
if( sqlite3ParseToplevel(pParse)->explain==2 )
#endif
{
SrcItem *pItem = &pTabList->a[pLevel->iFrom];
@@ -292,29 +292,27 @@ void sqlite3WhereAddScanStatus(
WhereLevel *pLvl, /* Level to add scanstatus() entry for */
int addrExplain /* Address of OP_Explain (or 0) */
){
if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){
const char *zObj = 0;
WhereLoop *pLoop = pLvl->pWLoop;
int wsFlags = pLoop->wsFlags;
int viaCoroutine = 0;
const char *zObj = 0;
WhereLoop *pLoop = pLvl->pWLoop;
int wsFlags = pLoop->wsFlags;
int viaCoroutine = 0;
if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
zObj = pLoop->u.btree.pIndex->zName;
}else{
zObj = pSrclist->a[pLvl->iFrom].zName;
viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
zObj = pLoop->u.btree.pIndex->zName;
}else{
zObj = pSrclist->a[pLvl->iFrom].zName;
viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
}
sqlite3VdbeScanStatus(
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
);
if( viaCoroutine==0 ){
if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
}
sqlite3VdbeScanStatus(
v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
);
if( viaCoroutine==0 ){
if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
}
if( wsFlags & WHERE_INDEXED ){
sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
}
if( wsFlags & WHERE_INDEXED ){
sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
}
}
}
+1 -4
View File
@@ -1856,12 +1856,9 @@ void sqlite3WhereTabFuncArgs(
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){
testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */
testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */
if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ) ){
joinType = EP_OuterON;
}else{
testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
joinType = EP_InnerON;
}
sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
-52
View File
@@ -239,56 +239,4 @@ do_execsql_test analyzeE-4.11 {
SELECT * FROM t1 WHERE a<1900 AND c=123
} {/SCAN t1/}
# 2023-03-23 https://sqlite.org/forum/forumpost/dc4854437b
#
reset_db
do_execsql_test analyzeE-5.0 {
PRAGMA encoding = 'UTF-16';
CREATE TABLE t0 (c1 TEXT);
INSERT INTO t0 VALUES ('');
CREATE INDEX i0 ON t0(c1);
ANALYZE;
SELECT * FROM t0 WHERE t0.c1 BETWEEN '' AND (ABS(''));
} {{}}
# 2023-03-24 https://sqlite.org/forum/forumpost/bc39e531e5
#
reset_db
do_execsql_test analyzeE-6.0 {
CREATE TABLE t1(x);
CREATE INDEX i1 ON t1(x,x,x,x,x||2);
CREATE INDEX i2 ON t1(1<2);
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000)
INSERT INTO t1(x) SELECT x FROM c;
ANALYZE;
} {}
do_execsql_test analyzeE-6.1 {
SELECT count(*)>1 FROM sqlite_stat4 WHERE idx='i2' AND neq='1000 1';
} 1
do_execsql_test analyzeE-6.2 {
SELECT count(*) FROM sqlite_stat4 WHERE idx='i2' AND neq<>'1000 1';
} 0
do_execsql_test analyzeE-6.3 {
SELECT count(*)>1 FROM sqlite_stat4 WHERE idx='i1' AND neq='1 1 1 1 1 1';
} 1
do_execsql_test analyzeE-6.4 {
SELECT count(*) FROM sqlite_stat4 WHERE idx='i1' AND neq<>'1 1 1 1 1 1';
} 0
# 2023-03-25 https://sqlite.org/forum/forumpost/5275207102
# Correctly expand zeroblobs while processing STAT4 information
# during query planning.
#
reset_db
do_execsql_test analyzeE-7.0 {
CREATE TABLE t1(a TEXT COLLATE binary);
CREATE INDEX t1x ON t1(a);
INSERT INTO t1(a) VALUES(0),('apple'),(NULL),(''),('banana');
ANALYZE;
SELECT format('(%s)',a) FROM t1 WHERE t1.a > CAST(zeroblob(5) AS TEXT);
} {(0) (apple) (banana)}
do_execsql_test analyzeE-7.1 {
SELECT format('(%s)',a) FROM t1 WHERE t1.a <= CAST(zeroblob(5) AS TEXT);
} {()}
finish_test
-1
View File
@@ -194,7 +194,6 @@ do_eqp_test autoindex1-501 {
QUERY PLAN
|--SCAN t501
`--CORRELATED LIST SUBQUERY xxxxxx
|--BLOOM FILTER ON t502 (y=?)
`--SEARCH t502 USING AUTOMATIC COVERING INDEX (y=?)
}
do_eqp_test autoindex1-502 {
-1
View File
@@ -86,7 +86,6 @@ do_eqp_test 220 {
} {
QUERY PLAN
|--SEARCH v USING INDEX ve (e>?)
|--BLOOM FILTER ON u (b=?)
`--SEARCH u USING AUTOMATIC COVERING INDEX (b=?)
}
+1 -85
View File
@@ -99,90 +99,6 @@ do_eqp_test 2.1 {
| |--SCAN transit
| `--SEARCH objs USING COVERING INDEX objs_cspo (o=? AND p=?)
`--SCAN transit
}
# 2023-02-28
# https://sqlite.org/forum/forumpost/0846211821
#
# Bloom filter gives an incorrect result if the collating sequence is
# anything other than binary.
#
reset_db
do_execsql_test 3.1 {
CREATE TABLE t0(x TEXT COLLATE rtrim);
INSERT INTO t0(x) VALUES ('a'), ('b'), ('c');
CREATE VIEW v0(y) AS SELECT DISTINCT x FROM t0;
SELECT count(*) FROM t0, v0 WHERE x='b ';
} 3
do_eqp_test 3.2 {
SELECT count(*) FROM t0, v0 WHERE x='b ';
} {
QUERY PLAN
|--CO-ROUTINE v0
| |--SCAN t0
| `--USE TEMP B-TREE FOR DISTINCT
|--SCAN v0
`--SEARCH t0 USING AUTOMATIC PARTIAL COVERING INDEX (x=?)
}
# ^^^^^--- The key feature in the previous result is that no Bloom filter
# is used. In the following, a Bloom filter is used because the data type
# is INT instead of TEXT.
do_execsql_test 3.3 {
CREATE TABLE t1(x INT COLLATE rtrim);
INSERT INTO t1(x) VALUES ('a'), ('b'), ('c');
CREATE VIEW v1(y) AS SELECT DISTINCT x FROM t1;
SELECT count(*) FROM t1, v1 WHERE x='b ';
} 3
do_eqp_test 3.4 {
SELECT count(*) FROM t1, v1 WHERE x='b ';
} {
QUERY PLAN
|--CO-ROUTINE v1
| |--SCAN t1
| `--USE TEMP B-TREE FOR DISTINCT
|--SCAN v1
|--BLOOM FILTER ON t1 (x=?)
`--SEARCH t1 USING AUTOMATIC PARTIAL COVERING INDEX (x=?)
}
# 2023-03-14
# https://sqlite.org/forum/forumpost/d47a0e8e3a
# https://sqlite.org/forum/forumpost/2e427099d5
#
# Both reports are for the same problem - using a Bloom filter on an
# expression index can cause issues.
#
reset_db
do_execsql_test 4.1 {
CREATE TABLE t1(x TEXT, y INT, z TEXT);
INSERT INTO t1(rowid,x,y,z) VALUES(12,'aa','bb','aa');
CREATE INDEX i1x ON t1(1 IS true,z);
CREATE TABLE t0(x TEXT);
INSERT INTO t0(rowid,x) VALUES(4,'aa');
ANALYZE sqlite_schema;
INSERT INTO sqlite_stat1 VALUES('t0',NULL,'20');
INSERT INTO sqlite_stat1 VALUES('t1','i1x','18 18 2');
ANALYZE sqlite_schema;
}
do_execsql_test 4.2 {
SELECT * FROM t0 NATURAL JOIN t1 WHERE z=t1.x;
} {aa bb aa}
do_execsql_test 4.3 {
DROP TABLE t0;
CREATE TABLE t0(a TEXT);
INSERT INTO t0 VALUES ('xyz');
CREATE INDEX t0x ON t0(a IS FALSE) WHERE false;
DROP TABLE t1;
CREATE TABLE t1(b INT);
INSERT INTO t1 VALUES('aaa'),('bbb'),('ccc'),('ddd'),(NULL);
CREATE TABLE t2(c REAL);
INSERT INTO t2 VALUES(7);
ANALYZE;
CREATE INDEX t2x ON t2(true IN ());
}
do_execsql_test 4.4 {
SELECT * FROM t0 LEFT JOIN t1 LEFT JOIN t2 ON (b NOTNULL)==(c IN ()) WHERE c;
} {xyz {} 7.0}
}
finish_test
+2 -5
View File
@@ -1269,14 +1269,11 @@ do_test 15.0 {
}]} {}
extra_schema_checks 0
do_catchsql_test 15.1 {
do_execsql_test 15.1 {
PRAGMA cell_size_check = 0;
UPDATE c1 SET c= NOT EXISTS(SELECT 1 FROM c1 ORDER BY (SELECT 1 FROM c1 ORDER BY a)) +10 WHERE d BETWEEN 4 AND 7;
} {1 {database disk image is malformed}}
} {}
extra_schema_checks 1
do_execsql_test 15.2 {
PRAGMA integrity_check;
} {/in database main/}
#-------------------------------------------------------------------------
reset_db
-23
View File
@@ -51,29 +51,6 @@ do_execsql_test 2.1 {
SELECT count(*) FROM v1 GROUP BY y;
} {3 3}
# 2023-03-01 dbsqlfuzz ef8623915d843b150c159166ee4548c78cc6895a
# count-of-view should not apply to CTEs.
#
ifcapable progress {
proc progress_stop args {return 1}
db progress 1000 progress_stop
do_catchsql_test 3.1 {
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c)
SELECT count(*) FROM c;
} {1 interrupted}
}
# 2023-03-07 dbsqlfuzz 23d782160b71c3f8f535ccb2da313dfc8eb8c631
#
do_execsql_test 4.1 {
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
INSERT INTO t1 VALUES(4,'four');
CREATE TABLE t2(c INTEGER PRIMARY KEY, d TEXT);
CREATE VIEW t3 AS SELECT a, b FROM t1 UNION ALL SELECT c, d FROM t2;
SELECT count(*) FROM t3 ORDER BY sum(a);
} 1
finish_test
-21
View File
@@ -159,25 +159,4 @@ do_test 4.6desc {
}
} {AND(AND(EQ(c0,22),GE(c1,10)),LE(c1,20))}
# 2023-03-24 https://sqlite.org/forum/forumpost/591006b1cc
#
reset_db
do_execsql_test 5.0 {
CREATE TABLE t1(x TEXT PRIMARY KEY) WITHOUT ROWID;
CREATE VIEW t2 AS SELECT 0 FROM t1 WHERE x>='a' OR x='1';
SELECT * FROM t2 RIGHT JOIN t1 ON true;
}
# Additional test case from https://sqlite.org/forum/forumpost/d34ad68c36?t=c
# which is a different way to acces the same problem.
#
do_execsql_test 5.1 {
CREATE TABLE v1 (c1, PRIMARY KEY( c1 )) WITHOUT ROWID;
CREATE VIEW v2 AS SELECT 0 FROM v1 WHERE c1 IS '' OR c1 > '';
CREATE VIEW v3 AS SELECT 0 FROM v2 JOIN (v2 RIGHT JOIN v1);
CREATE VIEW v4 AS SELECT 0 FROM v3, v3;
SELECT * FROM v3 JOIN v3 AS a0, v4 AS a1, v4 AS a2, v3 AS a3,
v3 AS a4, v4 AS a5
ORDER BY 1;
}
finish_test
-24
View File
@@ -416,28 +416,4 @@ do_execsql_test delete-11.1 {
} {6 2 12 4 18 6 19 23 20 40}
# 2023-03-15
# https://sqlite.org/forum/forumpost/e61252062c9d286d
#
# When the WHERE clause of a DELETE statement contains a subquery
# which uses the table that is being deleted from and there is a
# short-circuit operator of some kind in the WHERE clause such that
# the subquery might not run right away, then the subquery might
# run after one or more rows have been deleted, which can change
# the result of the subquery, and result in the wrong answer.
#
# Similar problem for UPDATE tested by update-21.4
# https://sqlite.org/forum/forumpost/0007d1fdb1
#
reset_db
do_execsql_test delete-12.0 {
CREATE TABLE t0(vkey INTEGER, pkey INTEGER,c1 INTEGER);
INSERT INTO t0 VALUES(2,1,-20),(2,2,NULL),(2,3,0),(8,4,95);
DELETE FROM t0 WHERE NOT (
(t0.vkey <= t0.c1) AND
(t0.vkey <> (SELECT vkey FROM t0 ORDER BY vkey LIMIT 1 OFFSET 2))
);
SELECT * FROM t0;
} {8 4 95}
finish_test
-56
View File
@@ -348,61 +348,5 @@ foreach {tn idx} {
}
}
# 2023-03-16
# https://sqlite.org/forum/forumpost/16ce2bb7a639e29b
# ticket c36cdb4afd504dc1
# ticket 4051a7f931d9ba24
# ticket d6fd512f50513ab7
#
do_execsql_test 10.1 {
SELECT DISTINCT
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
ORDER BY
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x';
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1}
do_execsql_test 10.2 {
EXPLAIN
SELECT DISTINCT
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
ORDER BY
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x','x','x','x','x','x','x',
'x','x','x','x';
} {/0 Init 0 /}
do_execsql_test 10.3 {
EXPLAIN CREATE TABLE t2 AS SELECT DISTINCT ':memory:', 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ORDER BY '%J%j%w%s', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', '%J%j%w%s', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 42e-300, 'unixepoch', 'unixepoch', 'unixepoch' LIMIT 0xda;
} {/0 Init 0/}
do_execsql_test 10.4 {
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 AS SELECT DISTINCT 0xda, 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 0xda-0xda-42e-300, 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0', 'lit0' ORDER BY '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%Y-%m-%d', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', 'lit0', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', 'auto', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', ':memory:', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '%%', '';
SELECT count(*) FROM t0;
} {1}
do_execsql_test 10.5 {
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 AS SELECT DISTINCT ':memory:', 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0.0*7/0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 ORDER BY '%J%j%w%s', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', '%J%j%w%s', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 'unixepoch', 42e-300, 'unixepoch', 'unixepoch', 'unixepoch' LIMIT 0xda;
SELECT count(*) FROM t2;
} {1}
finish_test
-12
View File
@@ -301,16 +301,4 @@ do_execsql_test 3030 {
{} 1 a
}
#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 4010 {
CREATE TABLE t1(a, b COLLATE RTRIM);
INSERT INTO t1 VALUES(1, ''), (2, ' '), (3, ' ');
}
do_execsql_test 4020 {
SELECT b FROM t1 UNION SELECT 1;
} {1 { }}
finish_test
-1
View File
@@ -100,7 +100,6 @@ do_eqp_test 4.2 {
|--MATERIALIZE rr
| `--SCAN ft4 VIRTUAL TABLE INDEX 3:
|--SCAN t4
|--BLOOM FILTER ON rr (docid=?)
`--SEARCH rr USING AUTOMATIC COVERING INDEX (docid=?) LEFT-JOIN
}
-64
View File
@@ -1,64 +0,0 @@
# 2023-03-17
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
#
# Test cases for SQL functions with names that are the same as join
# keywords: CROSS FULL INNER LEFT NATURAL OUTER RIGHT
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
proc joinx {args} {return [join $args -]}
db func cross {joinx cross}
db func full {joinx full}
db func inner {joinx inner}
db func left {joinx left}
db func natural {joinx natural}
db func outer {joinx outer}
db func right {joinx right}
do_execsql_test func8-100 {
CREATE TABLE cross(cross,full,inner,left,natural,outer,right);
CREATE TABLE full(cross,full,inner,left,natural,outer,right);
CREATE TABLE inner(cross,full,inner,left,natural,outer,right);
CREATE TABLE left(cross,full,inner,left,natural,outer,right);
CREATE TABLE natural(cross,full,inner,left,natural,outer,right);
CREATE TABLE outer(cross,full,inner,left,natural,outer,right);
CREATE TABLE right(cross,full,inner,left,natural,outer,right);
INSERT INTO cross VALUES(1,2,3,4,5,6,7);
INSERT INTO full VALUES(1,2,3,4,5,6,7);
INSERT INTO inner VALUES(1,2,3,4,5,6,7);
INSERT INTO left VALUES(1,2,3,4,5,6,7);
INSERT INTO natural VALUES(1,2,3,4,5,6,7);
INSERT INTO outer VALUES(1,2,3,4,5,6,7);
INSERT INTO right VALUES(1,2,3,4,5,6,7);
}
do_execsql_test func8-110 {
SELECT cross(cross,full,inner,left,natural,outer,right) FROM cross;
} cross-1-2-3-4-5-6-7
do_execsql_test func8-120 {
SELECT full(cross,full,inner,left,natural,outer,right) FROM full;
} full-1-2-3-4-5-6-7
do_execsql_test func8-130 {
SELECT inner(cross,full,inner,left,natural,outer,right) FROM inner;
} inner-1-2-3-4-5-6-7
do_execsql_test func8-140 {
SELECT left(cross,full,inner,left,natural,outer,right) FROM left;
} left-1-2-3-4-5-6-7
do_execsql_test func8-150 {
SELECT natural(cross,full,inner,left,natural,outer,right) FROM natural;
} natural-1-2-3-4-5-6-7
do_execsql_test func8-160 {
SELECT outer(cross,full,inner,left,natural,outer,right) FROM outer;
} outer-1-2-3-4-5-6-7
do_execsql_test func8-170 {
SELECT right(cross,full,inner,left,natural,outer,right) FROM right;
} right-1-2-3-4-5-6-7
finish_test
+2 -5
View File
@@ -1001,14 +1001,12 @@ static int recoverSqlCb(void *pCtx, const char *zSql){
*/
static int recoverDatabase(sqlite3 *db){
int rc; /* Return code from this routine */
const char *zRecoveryDb = ""; /* Name of "recovery" database */
const char *zLAF = "lost_and_found"; /* Name of "lost_and_found" table */
int bFreelist = 1; /* True to scan the freelist */
int bRowids = 1; /* True to restore ROWID values */
sqlite3_recover *p = 0; /* The recovery object */
sqlite3_recover *p; /* The recovery object */
p = sqlite3_recover_init_sql(db, "main", recoverSqlCb, 0);
sqlite3_recover_config(p, 789, (void*)zRecoveryDb);
sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
@@ -1040,7 +1038,7 @@ static int runDbSql(sqlite3 *db, const char *zSql, unsigned int *pBtsFlags){
printf("RUNNING-SQL: [%s]\n", zSql);
fflush(stdout);
}
(*pBtsFlags) &= BTS_BADPRAGMA;
(*pBtsFlags) &= ~BTS_BADPRAGMA;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
if( rc==SQLITE_OK ){
int nRow = 0;
@@ -1183,7 +1181,6 @@ int runCombinedDbSqlInput(
sqlite3_free(aDb);
return 1;
}
sqlite3_db_config(cx.db, SQLITE_DBCONFIG_STMT_SCANSTATUS, 1, 0);
if( bVdbeDebug ){
sqlite3_exec(cx.db, "PRAGMA vdbe_debug=ON", 0, 0, 0);
}
+22 -42
View File
@@ -103,7 +103,7 @@ int fuzz_invariant(
}
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pTestStmt);
printf("invariant-sql row=%d #%d:\n%s\n", iRow, iCnt, zSql);
printf("invariant-sql #%d:\n%s\n", iCnt, zSql);
sqlite3_free(zSql);
}
while( (rc = sqlite3_step(pTestStmt))==SQLITE_ROW ){
@@ -115,8 +115,6 @@ int fuzz_invariant(
if( rc==SQLITE_DONE ){
/* No matching output row found */
sqlite3_stmt *pCk = 0;
int iOrigRSO;
/* This is not a fault if the database file is corrupt, because anything
** can happen with a corrupt database file */
@@ -126,12 +124,6 @@ int fuzz_invariant(
sqlite3_finalize(pTestStmt);
return rc;
}
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pCk);
printf("invariant-validity-check #1:\n%s\n", zSql);
sqlite3_free(zSql);
}
rc = sqlite3_step(pCk);
if( rc!=SQLITE_ROW
|| sqlite3_column_text(pCk, 0)==0
@@ -144,29 +136,28 @@ int fuzz_invariant(
}
sqlite3_finalize(pCk);
/*
** If inverting the scan order also results in a miss, assume that the
** query is ambiguous and do not report a fault.
*/
sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, -1, &iOrigRSO);
sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, !iOrigRSO, 0);
sqlite3_prepare_v2(db, sqlite3_sql(pStmt), -1, &pCk, 0);
sqlite3_db_config(db, SQLITE_DBCONFIG_REVERSE_SCANORDER, iOrigRSO, 0);
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pCk);
printf("invariant-validity-check #2:\n%s\n", zSql);
sqlite3_free(zSql);
if( sqlite3_strlike("%group%by%",sqlite3_sql(pStmt),0)==0 ){
/*
** If there is a GROUP BY clause, it might not cover every term in the
** output. And then non-covered terms can take on a value from any
** row in the result set. This can cause differing answers.
*/
goto not_a_fault;
}
while( (rc = sqlite3_step(pCk))==SQLITE_ROW ){
for(i=0; i<nCol; i++){
if( !sameValue(pStmt, i, pTestStmt, i, 0) ) break;
}
if( i>=nCol ) break;
}
sqlite3_finalize(pCk);
if( rc==SQLITE_DONE ){
sqlite3_finalize(pTestStmt);
return SQLITE_DONE;
if( sqlite3_strlike("%limit%)%order%by%", sqlite3_sql(pTestStmt),0)==0 ){
/* crash-89bd6a6f8c6166e9a4c5f47b3e70b225f69b76c6
** Original statement is:
**
** SELECT a,b,c* FROM t1 LIMIT 1%5<4
**
** When running:
**
** SELECT * FROM (...) ORDER BY 1
**
** A different subset of the rows come out
*/
goto not_a_fault;
}
/* The original sameValue() comparison assumed a collating sequence
@@ -178,12 +169,6 @@ int fuzz_invariant(
"SELECT ?1=?2 OR ?1=?2 COLLATE nocase OR ?1=?2 COLLATE rtrim",
-1, &pCk, 0);
if( rc==SQLITE_OK ){
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pCk);
printf("invariant-validity-check #3:\n%s\n", zSql);
sqlite3_free(zSql);
}
sqlite3_reset(pTestStmt);
while( (rc = sqlite3_step(pTestStmt))==SQLITE_ROW ){
for(i=0; i<nCol; i++){
@@ -202,11 +187,6 @@ int fuzz_invariant(
rc = sqlite3_prepare_v2(db,
"SELECT 1 FROM bytecode(?1) WHERE opcode='VOpen'", -1, &pCk, 0);
if( rc==SQLITE_OK ){
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pCk);
printf("invariant-validity-check #4:\n%s\n", zSql);
sqlite3_free(zSql);
}
sqlite3_bind_pointer(pCk, 1, pStmt, "stmt-pointer", 0);
rc = sqlite3_step(pCk);
}
-54
View File
@@ -615,58 +615,4 @@ do_execsql_test gencol1-22.1 {
AND (y.a=2 OR (x.b LIKE '2*' AND y.a=x.b));
} {2 2 2 2}
# 2023-03-02 dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83
#
set typelist {ANY INT REAL BLOB TEXT {}}
set cnt 0
foreach t1 $typelist {
foreach t2 $typelist {
incr cnt
db eval "
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(
x $t1,
a $t2 AS (x) VIRTUAL,
b BLOB AS (x) VIRTUAL
);
CREATE INDEX x2 ON t1(a);
INSERT INTO t1(x) VALUES(NULL),('1'),(2),(3.5),('xyz');
"
set x1 [lsort [db eval {SELECT typeof(b) FROM t1}]]
do_test gencol1-23.1.$cnt {
lsort [db eval {SELECT typeof(b) FROM t1 INDEXED BY x2}]
} $x1
}
}
do_execsql_test gencol1-23.2 {
DROP TABLE t1;
CREATE TABLE t1(
x,
a INT AS (x) VIRTUAL,
b BLOB AS (x) VIRTUAL
);
CREATE INDEX x2 ON t1(a);
INSERT INTO t1(x) VALUES(NULL),('1'),('xyz'),(2),(3.5);
SELECT quote(a) FROM t1 INDEXED BY x2;
} {NULL 1 2 3.5 'xyz'}
do_execsql_test gencol1-23.3 {
EXPLAIN SELECT a FROM t1 INDEXED BY x2;
} {~/Column 0/}
# ^^^^^^^^---- verfies that x2 acts like a covering index
do_execsql_test gencol1-23.4 {
EXPLAIN SELECT b FROM t1 INDEXED BY x2;
} {/Column 0/}
# ^^^^^^^^^^--- Must reference the original table in this case because
# of the different datatype on column b.
# 2023-03-07 https://sqlite.org/forum/forumpost/b312e075b5
#
do_execsql_test gencol1-23.5 {
CREATE TABLE v0(c1 INT, c2 AS (RAISE(IGNORE)));
}
do_catchsql_test gencol1-23.6 {
SELECT * FROM v0;
} {1 {RAISE() may only be used within a trigger-program}}
finish_test
-14
View File
@@ -372,18 +372,4 @@ foreach {tn expr} {
" {1 1}
}
# 2023-03-24 https://sqlite.org/forum/forumpost/79cf371080
#
reset_db
do_execsql_test 9.0 {
CREATE TABLE t1(a INT, b INT);
CREATE INDEX t1x ON t1(a, abs(b));
CREATE TABLE t2(c INT, d INT);
INSERT INTO t1(a,b) VALUES(4,4),(5,-5),(5,20),(6,6);
INSERT INTO t2(c,d) VALUES(100,1),(200,1),(300,2);
SELECT *,
(SELECT max(c+abs(b)) FROM t2 GROUP BY d ORDER BY d LIMIT 1) AS subq
FROM t1 WHERE a=5;
} {5 -5 205 5 20 220}
finish_test
+9 -47
View File
@@ -1038,56 +1038,18 @@ do_execsql_test join-22.10 {
} {11}
# 2019-12-22 ticket 7929c1efb2d67e98
# Verification of testtag-20230227a
#
# 2023-02-27 https://sqlite.org/forum/forumpost/422e635f3beafbf6
# Verification of testtag-20230227a, testtag-20230227b, and testtag-20230227c
#
reset_db
ifcapable vtab {
do_execsql_test join-23.10 {
CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES(123);
CREATE VIEW v0(c0) AS SELECT 0 GROUP BY 1;
SELECT t0.c0, v0.c0, vt0.name
FROM v0, t0 LEFT JOIN pragma_table_info('t0') AS vt0
ON vt0.name LIKE 'c0'
WHERE v0.c0 == 0;
} {123 0 c0}
do_execsql_test join-23.20 {
CREATE TABLE a(value TEXT);
INSERT INTO a(value) SELECT value FROM json_each('["a", "b", null]');
CREATE TABLE b(value TEXT);
INSERT INTO b(value) SELECT value FROM json_each('["a", "c", null]');
SELECT a.value, b.value FROM a RIGHT JOIN b ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.21 {
SELECT a.value, b.value FROM b LEFT JOIN a ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.22 {
SELECT a.value, b.value
FROM json_each('["a", "c", null]') AS b
LEFT JOIN
json_each('["a", "b", null]') AS a ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.23 {
SELECT a.value, b.value
FROM json_each('["a", "b", null]') AS a
RIGHT JOIN
json_each('["a", "c", null]') AS b ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.24 {
SELECT a.value, b.value
FROM json_each('["a", "b", null]') AS a
RIGHT JOIN
b ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.25 {
SELECT a.value, b.value
FROM a
RIGHT JOIN
json_each('["a", "c", null]') AS b ON a.value = b.value;
} {a a {} c {} {}}
do_execsql_test join-23.10 {
CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES(123);
CREATE VIEW v0(c0) AS SELECT 0 GROUP BY 1;
SELECT t0.c0, v0.c0, vt0.name
FROM v0, t0 LEFT JOIN pragma_table_info('t0') AS vt0
ON vt0.name LIKE 'c0'
WHERE v0.c0 == 0;
} {123 0 c0}
}
#-------------------------------------------------------------------------
-73
View File
@@ -354,78 +354,5 @@ do_execsql_test 9.11 {
SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2;
} {{} 1}
# 2023-03-01 https://sqlite.org/forum/forumpost/26387ea7ef
# When flattening a VIEW which is the RHS of a LEFT JOIN, always put
# an TK_IF_NULL_ROW operator on all accesses, even TK_COLUMN nodes, since
# the TK_COLUMN might reference an outer subquery.
#
reset_db
db null NULL
do_execsql_test 10.1 {
CREATE TABLE t1 (x INTEGER);
INSERT INTO t1 VALUES(1); -- Some true value
CREATE TABLE t2 (z TEXT);
INSERT INTO t2 VALUES('some value');
CREATE TABLE t3(w TEXT);
INSERT INTO t3 VALUES('some other value');
}
do_execsql_test 10.2 {
SELECT (
SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v OR FALSE)
) FROM t1;
} NULL
do_execsql_test 10.3 {
SELECT (
SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v)
) FROM t1;
} NULL
optimization_control db all 0
do_execsql_test 10.4 {
SELECT (
SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v OR FALSE)
) FROM t1;
} NULL
# 2023-03-02 https://sqlite.org/forum/forumpost/402f05296d
#
# The TK_IF_NULL_ROW expression node must ensure that it does not overwrite
# the result register of an OP_Once subroutine.
#
optimization_control db all 1
do_execsql_test 11.1 {
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
CREATE TABLE t1(x TEXT, y INTEGER);
INSERT INTO t1(x,y) VALUES(NULL,-2),(NULL,1),('0',2);
CREATE TABLE t2(z INTEGER);
INSERT INTO t2(z) VALUES(2),(-2);
CREATE VIEW t3 AS SELECT z, (SELECT count(*) FROM t1) AS w FROM t2;
SELECT * FROM t1 LEFT JOIN t3 ON y=z;
} {NULL -2 -2 3 NULL 1 NULL NULL 0 2 2 3}
# 2023-03-11 https://sqlite.org/forum/forumpost/b405033490fa56d9
# The fix that test 11.1 above checks also caused a performance regression.
# This test case verifies that the performance regression has been resolved.
#
do_execsql_test 12.1 {
DROP TABLE t1;
DROP TABLE t2;
DROP VIEW t3;
CREATE TABLE t1(a INTEGER PRIMARY KEY);
WITH RECURSIVE c(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c WHERE n<100)
INSERT INTO t1(a) SELECT n FROM c;
CREATE VIEW t2(b) AS SELECT a FROM t1;
}
do_vmstep_test 12.2 {
SELECT * FROM t1 LEFT JOIN t2 ON a=b LIMIT 10 OFFSET 98;
} 2000 {99 99 100 100}
do_eqp_test 12.3 {
SELECT * FROM t1 LEFT JOIN t2 ON a=b LIMIT 10 OFFSET 98;
} {
QUERY PLAN
|--SCAN t1
`--SEARCH t1 USING INTEGER PRIMARY KEY (rowid=?) LEFT-JOIN
}
finish_test
-11
View File
@@ -159,7 +159,6 @@ do_catchsql_test join8-5000 {
} {0 {- -}}
# 2022-04-29 dbsqlfuzz 19f1102a70cf966ab249de56d944fc20dbebcfcf
# Verification of testtag-20230227b and testtag-20230227c
#
reset_db
do_execsql_test join8-6000 {
@@ -182,16 +181,6 @@ do_execsql_test join8-6020 {
SELECT value, t1.* FROM json_each('17') NATURAL RIGHT JOIN t1
WHERE (a,b) IN (SELECT rowid, b FROM t1);
} {17 1 2}
do_execsql_test join8-6021 {
SELECT value, t1.* FROM json_each('null') NATURAL RIGHT JOIN t1
WHERE (a,b) IN (SELECT rowid, b FROM t1);
} {{} 1 2}
do_execsql_test join8-6022 {
CREATE TABLE a(key TEXT);
INSERT INTO a(key) VALUES('a'),('b');
SELECT quote(a.key), b.value
FROM a RIGHT JOIN json_each('["a","c"]') AS b ON a.key=b.value;
} {'a' a NULL c}
# Bloom filter usage by RIGHT and FULL JOIN
#
-12
View File
@@ -885,16 +885,4 @@ do_execsql_test json-19.3 {
SELECT * FROM t1;
} {}
# 2023-03-17 positive and negative infinities
#
do_execsql_test json-20.1 {
SELECT json_object('a',2e370,'b',-3e380);
} {{{"a":9.0e+999,"b":-9.0e+999}}}
do_execsql_test json-20.2 {
SELECT json_object('a',2e370,'b',-3e380)->>'a';
} Inf
do_execsql_test json-20.3 {
SELECT json_object('a',2e370,'b',-3e380)->>'b';
} {-Inf}
finish_test
+18
View File
@@ -28,6 +28,24 @@ do_execsql_test 1.0 {
INSERT INTO t2 SELECT * FROM t1;
}
proc do_vmstep_test {tn sql nstep {res {}}} {
uplevel [list do_execsql_test $tn.0 $sql $res]
set vmstep [db status vmstep]
if {[string range $nstep 0 0]=="+"} {
set body "if {$vmstep<$nstep} {
error \"got $vmstep, expected more than [string range $nstep 1 end]\"
}"
} else {
set body "if {$vmstep>$nstep} {
error \"got $vmstep, expected less than $nstep\"
}"
}
# set name "$tn.vmstep=$vmstep,expect=$nstep"
set name "$tn.1"
uplevel [list do_test $name $body {}]
}
do_vmstep_test 1.1.1 {
SELECT * FROM t1 LEFT JOIN t2 WHERE a=c AND d IS NULL;
-13
View File
@@ -2060,17 +2060,4 @@ ifcapable !has_codec {
} {0 {{database disk image is malformed}}}
}
database_never_corrupt
# 2023-03-27. Register allocation issue in integrity_check discovered
# by new assert() statements added in [6f8b97f31a4c8552].
# dbsqlfuzz dc9ab26037cf5ef797d28cd1ae0855ade584216d
# tag-20230327-1
#
reset_db
do_execsql_test 25.0 {
CREATE TABLE t1(a INT, b AS (a*2) NOT NULL);
CREATE TEMP TABLE t2(a PRIMARY KEY, b, c UNIQUE) WITHOUT ROWID;
CREATE UNIQUE INDEX t2x ON t2(c,b);
PRAGMA integrity_check;
} ok
finish_test
-38
View File
@@ -3786,42 +3786,4 @@ do_execsql_test printf-16.1 {
SELECT printf('%.*g',2147483647,0.01);
} {0.01}
# 2023-02-23 https://sqlite.org/forum/forumpost/d1387c3979c7f557
# Loss of precision when doing floating-point to decimal
# conversions on values that have no factional part.
#
do_execsql_test printf-17.1 {
SELECT format('%!.20g', 13.0);
} 13.0
do_execsql_test printf-17.2 {
SELECT format('%.3e', 199990000.0);
} 2.000e+08
do_execsql_test printf-17.3 {
SELECT format('%.3f', 199990000.0);
} 199990000.000
do_execsql_test printf-17.4 {
SELECT format('%.3g', 199990000.0);
} 2e+08
do_execsql_test printf-17.5 {
SELECT format('%.4e', 199990000.0);
} 1.9999e+08
do_execsql_test printf-17.6 {
SELECT format('%.4f', 199990000.0);
} 199990000.0000
do_execsql_test printf-17.7 {
SELECT format('%.4g', 199990000.0);
} 2e+08
do_execsql_test printf-17.8 {
SELECT format('%.5e', 199990000.0);
} 1.99990e+08
do_execsql_test printf-17.9 {
SELECT format('%.5f', 199990000.0);
} 199990000.00000
do_execsql_test printf-17.10 {
SELECT format('%.5g', 199990000.0);
} 1.9999e+08
do_execsql_test printf-17.11 {
SELECT format('%.30f',1.0000000000000000076e-50);
} 0.000000000000000000000000000000
finish_test
+4 -35
View File
@@ -212,13 +212,13 @@ do_execsql_test 10.2 {
END;
}
do_catchsql_test 10.3a {
do_catchsql_test 10.3 {
INSERT INTO t1(a, b) VALUES(1234, 5678) RETURNING rowid;
} {1 {no such column: new.rowid}}
} {1 {no such column: rowid}}
do_catchsql_test 10.3b {
do_catchsql_test 10.3 {
UPDATE t1 SET a='z' WHERE b='y' RETURNING rowid;
} {1 {no such column: new.rowid}}
} {1 {no such column: rowid}}
do_execsql_test 10.4 {
SELECT * FROM log;
@@ -408,35 +408,4 @@ do_execsql_test 17.0 {
UPDATE bug SET x=NULL WHERE id = 20 RETURNING quote(x), x IS NULL;
} {NULL 1}
# 2023-03-08 https://sqlite.org/forum/forumpost/f5a2b1db87
# NULL pointer dereference following an error.
#
do_execsql_test 18.0 {
CREATE TABLE v0(c1 INT);
CREATE VIEW view_2(c1) AS SELECT CASE WHEN c1 COLLATE TRUE THEN TRUE ELSE TRUE END FROM v0;
CREATE TRIGGER x1 INSTEAD OF INSERT ON view_2 BEGIN SELECT true; END;
}
do_catchsql_test 18.1 {
INSERT INTO view_2 DEFAULT VALUES RETURNING *;
} {1 {no such collation sequence: TRUE}}
# 2023-03-16
# https://sqlite.org/forum/forumpost/c99d6e0329
# ticket d15b3a4ea901ef0d
# ticket 89d259d45b855a0d
#
# A RETURNING clause on an IF NOT EXISTS trigger does not generate
# an error if the trigger already exists.
#
do_execsql_test 19.0 {
DROP TABLE IF EXISTS t1;CREATE TABLE t1(a);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN VALUES(0); END;
} {}
do_catchsql_test 19.1 {
CREATE TRIGGER IF NOT EXISTS r1 AFTER DELETE ON t1 BEGIN
INSERT INTO t1(a) VALUES (1) RETURNING FALSE;
INSERT INTO t1(a) VALUES (2) RETURNING TRUE;
END;
} {0 {}}
finish_test

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