Compare commits
120 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32888c2b30 | |||
| f79b0bdcbf | |||
| 7c6433cfff | |||
| 09e1900cdc | |||
| 1103eb423e | |||
| f286ad9211 | |||
| afeec79847 | |||
| dfd991c3b9 | |||
| 7598e7d70e | |||
| 9c59c87448 | |||
| ee299cc7d4 | |||
| 645f21f15b | |||
| b088e892a0 | |||
| 5956d1d942 | |||
| 1545243368 | |||
| f7ad684c5a | |||
| 0b8c3126f4 | |||
| 639db50a02 | |||
| 9591a9f069 | |||
| 6a00f707e8 | |||
| b783f56c58 | |||
| b2897c221d | |||
| ebd99d5708 | |||
| eb715f022f | |||
| cfcb3b9208 | |||
| 626d619218 | |||
| 21eda699d7 | |||
| b468e68322 | |||
| 4b2eeb289b | |||
| 68d92c4ad3 | |||
| 4189c44cff | |||
| ae71fa5d59 | |||
| a1507a3fa0 | |||
| ebea8458e2 | |||
| 9a28311b6a | |||
| 74b0aad09f | |||
| f40da9226d | |||
| cfc62ceefd | |||
| e7bdb2172c | |||
| 6c6356f7f2 | |||
| 9f34a05e98 | |||
| e0a9935be1 | |||
| d43e7adca7 | |||
| 99a94a124c | |||
| 42eb6a91cd | |||
| 6161cdd446 | |||
| 837efb4cbe | |||
| 4dd59fd997 | |||
| fd2500f98b | |||
| 816f677c1c | |||
| 9d00aba895 | |||
| 5e5831a760 | |||
| 95b5295f52 | |||
| 54eb54c7de | |||
| 8e821c251d | |||
| 98a8ffb3b3 | |||
| 38e0492b91 | |||
| 84dea8264b | |||
| b29047838d | |||
| 18b6019cdd | |||
| 3c5a810646 | |||
| ece3567aec | |||
| 589c407f12 | |||
| 25e172d429 | |||
| 0f777cd622 | |||
| 722bd1fe89 | |||
| 204b41955e | |||
| 71cdea8f5f | |||
| 8babc01892 | |||
| 72c7bb3e1a | |||
| db9cc74c9c | |||
| 5e922865aa | |||
| 8e4d004ba1 | |||
| 21ded98df5 | |||
| 7d3cd38034 | |||
| 0009d40325 | |||
| 7718c866e1 | |||
| 3ab9c021ff | |||
| 7d6f33046f | |||
| 50f9caf270 | |||
| 3a32690a55 | |||
| 09768559b6 | |||
| adea051707 | |||
| 64b76c0ed4 | |||
| 1d09f4d018 | |||
| d87299cece | |||
| ed0a614c21 | |||
| d844e0a1c4 | |||
| 744581d3d6 | |||
| 9486178f39 | |||
| c24f53635c | |||
| b202a452ad | |||
| 91981fe74e | |||
| af3824d5fa | |||
| 581bf002ce | |||
| 7f9a1ff3f2 | |||
| 3fc7a34efc | |||
| 4c11a5251a | |||
| 5b480ead99 | |||
| d921533954 | |||
| 052f0a95d0 | |||
| 21bdfe5884 | |||
| 48e899a86e | |||
| ad2689fe4e | |||
| 7659ce22c5 | |||
| 3467698000 | |||
| 51f652de10 | |||
| 82bf13796a | |||
| 539085ddf5 | |||
| 4821b15dca | |||
| fa079680f1 | |||
| bcf3df0192 | |||
| 1ff9a7bc8d | |||
| 5ff513c16e | |||
| 91cee17d83 | |||
| 727b35cbfc | |||
| a67d63b481 | |||
| 45cf8ad02a | |||
| 2065a9b730 | |||
| 87ac2b043a |
+6
-2
@@ -418,6 +418,8 @@ TESTSRC = \
|
||||
$(TOP)/ext/recover/sqlite3recover.c \
|
||||
$(TOP)/ext/recover/dbdata.c \
|
||||
$(TOP)/ext/recover/test_recover.c \
|
||||
$(TOP)/ext/intck/test_intck.c \
|
||||
$(TOP)/ext/intck/sqlite3intck.c \
|
||||
$(TOP)/ext/rbu/test_rbu.c
|
||||
|
||||
# Statically linked extensions
|
||||
@@ -815,7 +817,8 @@ has_tclsh85:
|
||||
touch .target_source
|
||||
|
||||
sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify has_tclsh84
|
||||
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS)
|
||||
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) \
|
||||
$(EXTRA_SRC)
|
||||
cp tsrc/sqlite3ext.h .
|
||||
cp $(TOP)/ext/session/sqlite3session.h .
|
||||
|
||||
@@ -826,7 +829,8 @@ sqlite3r.c: sqlite3.c sqlite3r.h has_tclsh84
|
||||
cp $(TOP)/ext/recover/sqlite3recover.c tsrc/
|
||||
cp $(TOP)/ext/recover/sqlite3recover.h tsrc/
|
||||
cp $(TOP)/ext/recover/dbdata.c tsrc/
|
||||
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl --enable-recover $(AMALGAMATION_LINE_MACROS)
|
||||
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl --enable-recover \
|
||||
$(AMALGAMATION_LINE_MACROS) $(EXTRA_SRC)
|
||||
|
||||
sqlite3ext.h: .target_source
|
||||
cp tsrc/sqlite3ext.h .
|
||||
|
||||
+7
-1
@@ -16,6 +16,10 @@ TOP = .
|
||||
!IFNDEF USE_AMALGAMATION
|
||||
USE_AMALGAMATION = 1
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF EXTRA_SRC
|
||||
EXTRA_SRC =
|
||||
!ENDIF
|
||||
# <</mark>>
|
||||
|
||||
# Set this non-0 to enable full warnings (-W4, etc) when compiling.
|
||||
@@ -1595,6 +1599,8 @@ TESTEXT = \
|
||||
$(TOP)\ext\rtree\test_rtreedoc.c \
|
||||
$(TOP)\ext\recover\sqlite3recover.c \
|
||||
$(TOP)\ext\recover\test_recover.c \
|
||||
$(TOP)\ext\intck\test_intck.c \
|
||||
$(TOP)\ext\intck\sqlite3intck.c \
|
||||
$(TOP)\ext\recover\dbdata.c
|
||||
|
||||
# If use of zlib is enabled, add the "zipfile.c" source file.
|
||||
@@ -1913,7 +1919,7 @@ mptest: mptester.exe
|
||||
echo > .target_source
|
||||
|
||||
sqlite3.c: .target_source sqlite3ext.h sqlite3session.h $(MKSQLITE3C_TOOL) src-verify.exe
|
||||
$(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS)
|
||||
$(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS) $(EXTRA_SRC)
|
||||
|
||||
sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl
|
||||
$(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -683,6 +683,7 @@ other than that, the order of directives in Lemon is arbitrary.</p>
|
||||
<li><tt><a href='#pifdef'>%endif</a></tt>
|
||||
<li><tt><a href='#extraarg'>%extra_argument</a></tt>
|
||||
<li><tt><a href='#pfallback'>%fallback</a></tt>
|
||||
<li><tt><a href='#reallc'>%free</a></tt>
|
||||
<li><tt><a href='#pifdef'>%if</a></tt>
|
||||
<li><tt><a href='#pifdef'>%ifdef</a></tt>
|
||||
<li><tt><a href='#pifdef'>%ifndef</a></tt>
|
||||
@@ -693,6 +694,7 @@ other than that, the order of directives in Lemon is arbitrary.</p>
|
||||
<li><tt><a href='#parse_accept'>%parse_accept</a></tt>
|
||||
<li><tt><a href='#parse_failure'>%parse_failure</a></tt>
|
||||
<li><tt><a href='#pright'>%right</a></tt>
|
||||
<li><tt><a href='#reallc'>%realloc</a></tt>
|
||||
<li><tt><a href='#stack_overflow'>%stack_overflow</a></tt>
|
||||
<li><tt><a href='#stack_size'>%stack_size</a></tt>
|
||||
<li><tt><a href='#start_symbol'>%start_symbol</a></tt>
|
||||
@@ -1200,6 +1202,21 @@ match any input token.</p>
|
||||
the wildcard token and some other token, the other token is always used.
|
||||
The wildcard token is only matched if there are no alternatives.</p>
|
||||
|
||||
<a id='reallc'></a>
|
||||
<h4>4.4.26 The <tt>%realloc</tt> and <tt>%free</tt> directives</h4>
|
||||
|
||||
<p>The <tt>%realloc</tt> and <tt>%free</tt> directives defines function
|
||||
that allocate and free heap memory. The signatures of these functions
|
||||
should be the same as the realloc() and free() functions from the standard
|
||||
C library.
|
||||
|
||||
<p>If both of these functions are defined
|
||||
then these functions are used to allocate and free
|
||||
memory for supplemental parser stack space, if the initial
|
||||
parse stack space is exceeded. The initial parser stack size
|
||||
is specified by either <tt>%stack_size</tt> or the
|
||||
-DYYSTACKDEPTH compile-time flag.
|
||||
|
||||
<a id='errors'></a>
|
||||
<h2>5.0 Error Processing</h2>
|
||||
|
||||
@@ -1224,6 +1241,7 @@ to begin parsing a new file. This is what will happen at the very
|
||||
first syntax error, of course, if there are no instances of the
|
||||
"error" non-terminal in your grammar.</p>
|
||||
|
||||
|
||||
<a id='history'></a>
|
||||
<h2>6.0 History of Lemon</h2>
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#ifndef HAVE_CONSOLE_IO_H
|
||||
# include "console_io.h"
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable : 4204)
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
# if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT
|
||||
@@ -127,6 +130,10 @@ static short streamOfConsole(FILE *pf, /* out */ PerStreamTags *ppst){
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
# define ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
|
||||
# endif
|
||||
|
||||
# if CIO_WIN_WC_XLATE
|
||||
/* Define console modes for use with the Windows Console API. */
|
||||
# define SHELL_CONI_MODE \
|
||||
@@ -677,4 +684,8 @@ SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
|
||||
}
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(default : 4204)
|
||||
#endif
|
||||
|
||||
#undef SHELL_INVALID_FILE_PTR
|
||||
|
||||
+7
-5
@@ -4014,22 +4014,24 @@ static int fts3IntegrityMethod(
|
||||
char **pzErr /* Write error message here */
|
||||
){
|
||||
Fts3Table *p = (Fts3Table*)pVtab;
|
||||
int rc;
|
||||
int rc = SQLITE_OK;
|
||||
int bOk = 0;
|
||||
|
||||
UNUSED_PARAMETER(isQuick);
|
||||
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
|
||||
assert( rc!=SQLITE_CORRUPT_VTAB || bOk==0 );
|
||||
if( rc!=SQLITE_OK && rc!=SQLITE_CORRUPT_VTAB ){
|
||||
assert( rc!=SQLITE_CORRUPT_VTAB );
|
||||
if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
|
||||
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
|
||||
" FTS%d table %s.%s: %s",
|
||||
p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
|
||||
}else if( bOk==0 ){
|
||||
if( *pzErr ) rc = SQLITE_OK;
|
||||
}else if( rc==SQLITE_OK && bOk==0 ){
|
||||
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
|
||||
p->bFts4 ? 4 : 3, zSchema, zTabname);
|
||||
if( *pzErr==0 ) rc = SQLITE_NOMEM;
|
||||
}
|
||||
sqlite3Fts3SegmentsClose(p);
|
||||
return SQLITE_OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5372,7 +5372,12 @@ int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
||||
sqlite3_finalize(pStmt);
|
||||
}
|
||||
|
||||
*pbOk = (rc==SQLITE_OK && cksum1==cksum2);
|
||||
if( rc==SQLITE_CORRUPT_VTAB ){
|
||||
rc = SQLITE_OK;
|
||||
*pbOk = 0;
|
||||
}else{
|
||||
*pbOk = (rc==SQLITE_OK && cksum1==cksum2);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -6837,23 +6837,26 @@ static void fts5IterSetOutputsTokendata(Fts5Iter *pIter){
|
||||
static void fts5TokendataIterNext(Fts5Iter *pIter, int bFrom, i64 iFrom){
|
||||
int ii;
|
||||
Fts5TokenDataIter *pT = pIter->pTokenDataIter;
|
||||
Fts5Index *pIndex = pIter->pIndex;
|
||||
|
||||
for(ii=0; ii<pT->nIter; ii++){
|
||||
Fts5Iter *p = pT->apIter[ii];
|
||||
if( p->base.bEof==0
|
||||
&& (p->base.iRowid==pIter->base.iRowid || (bFrom && p->base.iRowid<iFrom))
|
||||
){
|
||||
fts5MultiIterNext(p->pIndex, p, bFrom, iFrom);
|
||||
fts5MultiIterNext(pIndex, p, bFrom, iFrom);
|
||||
while( bFrom && p->base.bEof==0
|
||||
&& p->base.iRowid<iFrom
|
||||
&& p->pIndex->rc==SQLITE_OK
|
||||
&& pIndex->rc==SQLITE_OK
|
||||
){
|
||||
fts5MultiIterNext(p->pIndex, p, 0, 0);
|
||||
fts5MultiIterNext(pIndex, p, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fts5IterSetOutputsTokendata(pIter);
|
||||
if( pIndex->rc==SQLITE_OK ){
|
||||
fts5IterSetOutputsTokendata(pIter);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2979,6 +2979,7 @@ static int fts5IntegrityMethod(
|
||||
if( (rc&0xff)==SQLITE_CORRUPT ){
|
||||
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
|
||||
zSchema, zTabname);
|
||||
rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM;
|
||||
}else if( rc!=SQLITE_OK ){
|
||||
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
|
||||
" FTS5 table %s.%s: %s",
|
||||
@@ -2986,7 +2987,7 @@ static int fts5IntegrityMethod(
|
||||
}
|
||||
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
|
||||
|
||||
return SQLITE_OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int fts5Init(sqlite3 *db){
|
||||
|
||||
+1
-1
@@ -1169,7 +1169,7 @@ struct OriginTextTokenizer {
|
||||
*/
|
||||
static void f5tOrigintextTokenizerDelete(void *pCtx){
|
||||
OriginTextCtx *p = (OriginTextCtx*)pCtx;
|
||||
ckfree(p);
|
||||
ckfree((char*)p);
|
||||
}
|
||||
|
||||
static int f5tOrigintextCreate(
|
||||
|
||||
@@ -57,7 +57,6 @@ foreach_detail_mode $testprefix {
|
||||
|
||||
} ;# foreach_detail_mode...
|
||||
|
||||
|
||||
do_execsql_test 4.0 {
|
||||
CREATE VIRTUAL TABLE x2 USING fts5(a);
|
||||
INSERT INTO x2(x2, rank) VALUES('crisismerge', 2);
|
||||
@@ -80,5 +79,18 @@ do_faultsim_test 4 -faults oom-* -prep {
|
||||
faultsim_test_result {0 {}} {1 SQLITE_NOMEM}
|
||||
}
|
||||
|
||||
set TMPDBERROR {1 {unable to open a temporary database file for storing temporary tables}}
|
||||
|
||||
do_faultsim_test 5 -faults oom-t* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql { PRAGMA temp_store = memory }
|
||||
} -body {
|
||||
execsql { PRAGMA integrity_check }
|
||||
} -test {
|
||||
if {[string match {*error code=7*} $testresult]==0} {
|
||||
faultsim_test_result {0 ok} {1 SQLITE_NOMEM} $::TMPDBERROR
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -127,7 +127,7 @@ do_execsql_test 3.0 {
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
do_faultsim_test 3 -faults oom* -prep {
|
||||
do_faultsim_test 3.1 -faults oom* -prep {
|
||||
} -body {
|
||||
execsql {
|
||||
SELECT rowid FROM t1('BBB AND AAA');
|
||||
@@ -136,6 +136,15 @@ do_faultsim_test 3 -faults oom* -prep {
|
||||
faultsim_integrity_check
|
||||
faultsim_test_result {0 {10 35}}
|
||||
}
|
||||
do_faultsim_test 3.2 -faults oom* -prep {
|
||||
} -body {
|
||||
execsql {
|
||||
SELECT count(*) FROM t1('BBB');
|
||||
}
|
||||
} -test {
|
||||
faultsim_integrity_check
|
||||
faultsim_test_result {0 27}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
# 2008 Feb 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The focus of this file is testing the incremental integrity check
|
||||
# (intck) extension.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] intck_common.tcl]
|
||||
set testprefix intck1
|
||||
|
||||
foreach {tn sql} {
|
||||
1 "CREATE TABLE t1(a PRIMARY KEY, b)"
|
||||
2 "CREATE TABLE t2(a PRIMARY KEY, b) WITHOUT ROWID "
|
||||
3 "CREATE TABLE t3(a PRIMARY KEY, b) WITHOUT rowID;"
|
||||
4 "CREATE TABLE t4(a PRIMARY KEY, ROWID)"
|
||||
5 {CREATE TABLE t5(a PRIMARY KEY, ROWID) WITHOUT ROWID
|
||||
}
|
||||
} {
|
||||
do_test 1.1.$tn {
|
||||
db eval $sql
|
||||
set {} {}
|
||||
} {}
|
||||
}
|
||||
|
||||
set space " \n\v\t\r\f"
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
SELECT name, (rtrim(sql, $space) LIKE '%rowid')
|
||||
FROM sqlite_schema WHERE type='table'
|
||||
ORDER BY 1
|
||||
} {
|
||||
t1 0
|
||||
t2 1
|
||||
t3 1
|
||||
t4 0
|
||||
t5 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
CREATE TABLE x1(a COLLATE nocase, b INTEGER, c BLOB);
|
||||
INSERT INTO x1 VALUES('lEtTeRs', 1234, 1234);
|
||||
}
|
||||
do_execsql_test 1.3.1 {
|
||||
WITH wrapper(c1, c2, c3) AS (
|
||||
SELECT a, b, c FROM x1
|
||||
)
|
||||
SELECT * FROM wrapper WHERE c1='letters';
|
||||
} {lEtTeRs 1234 1234}
|
||||
do_execsql_test 1.3.2 {
|
||||
WITH wrapper(c1, c2, c3) AS (
|
||||
SELECT a, b, c FROM x1
|
||||
)
|
||||
SELECT * FROM wrapper WHERE c2='1234';
|
||||
} {lEtTeRs 1234 1234}
|
||||
do_execsql_test 1.3.2 {
|
||||
WITH wrapper(c1, c2, c3) AS (
|
||||
SELECT a, b, c FROM x1
|
||||
)
|
||||
SELECT * FROM wrapper WHERE c3='1234';
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
CREATE TABLE z1(a, b);
|
||||
CREATE INDEX z1ab ON z1(a+b COLLATE nocase);
|
||||
}
|
||||
do_execsql_test 1.4.1 {
|
||||
SELECT * FROM z1 INDEXED BY z1ab
|
||||
}
|
||||
|
||||
do_catchsql_test 1.5.1 {
|
||||
CREATE INDEX z1b ON z1(b ASC NULLS LAST);
|
||||
} {1 {unsupported use of NULLS LAST}}
|
||||
do_catchsql_test 1.5.2 {
|
||||
CREATE INDEX z1b ON z1(b DESC NULLS LAST);
|
||||
} {1 {unsupported use of NULLS LAST}}
|
||||
do_catchsql_test 1.5.3 {
|
||||
CREATE INDEX z1b ON z1(b ASC NULLS FIRST);
|
||||
} {1 {unsupported use of NULLS FIRST}}
|
||||
do_catchsql_test 1.5.4 {
|
||||
CREATE INDEX z1b ON z1(b DESC NULLS FIRST);
|
||||
} {1 {unsupported use of NULLS FIRST}}
|
||||
|
||||
|
||||
reset_db
|
||||
do_execsql_test 1.6.1 {
|
||||
CREATE TABLE t1(i INTEGER PRIMARY KEY, b, c);
|
||||
CREATE INDEX i1 ON t1(b);
|
||||
ANALYZE;
|
||||
INSERT INTO sqlite_stat1 VALUES('t1', 'i1', '10000 10000');
|
||||
ANALYZE sqlite_schema;
|
||||
} {}
|
||||
do_eqp_test 1.6.2 {
|
||||
SELECT 1 FROM t1 INDEXED BY i1 WHERE (b, i) IS (?, ?);
|
||||
} {SEARCH}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_test 2.0 {
|
||||
set ic [sqlite3_intck db main]
|
||||
$ic close
|
||||
} {}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
INSERT INTO t1 VALUES(3, 4);
|
||||
|
||||
CREATE INDEX i1 ON t1(a COLLATE nocase);
|
||||
CREATE INDEX i2 ON t1(b, a);
|
||||
CREATE INDEX i3 ON t1(b + a COLLATE nocase) WHERE a!=1;
|
||||
}
|
||||
|
||||
do_intck_test 2.2 {
|
||||
}
|
||||
|
||||
# Delete a row from each of the i1 and i2 indexes using the imposter
|
||||
# table interface.
|
||||
#
|
||||
do_test 2.3 {
|
||||
db eval {SELECT name, rootpage FROM sqlite_schema} {
|
||||
set R($name) $rootpage
|
||||
}
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 1 $R(i1)
|
||||
db eval { CREATE TABLE imp1(a PRIMARY KEY, rowid) WITHOUT ROWID; }
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 1 $R(i2)
|
||||
db eval { CREATE TABLE imp2(b, a, rowid, PRIMARY KEY(b, a)) WITHOUT ROWID; }
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
|
||||
|
||||
db eval {
|
||||
DELETE FROM imp1 WHERE rowid=1;
|
||||
DELETE FROM imp2 WHERE rowid=2;
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
} {}
|
||||
|
||||
do_intck_test 2.4 {
|
||||
{entry (1,1) missing from index i1}
|
||||
{entry (4,3,2) missing from index i2}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
CREATE TABLE x1(a, b, c, PRIMARY KEY(c, b)) WITHOUT ROWID;
|
||||
CREATE INDEX x1a ON x1(a COLLATE nocase);
|
||||
|
||||
INSERT INTO x1 VALUES(1, 2, 'three');
|
||||
INSERT INTO x1 VALUES(4, 5, 'six');
|
||||
INSERT INTO x1 VALUES(7, 8, 'nine');
|
||||
}
|
||||
|
||||
do_intck_test 3.1 { }
|
||||
|
||||
do_test 3.2 {
|
||||
db eval {SELECT name, rootpage FROM sqlite_schema} {
|
||||
set R($name) $rootpage
|
||||
}
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 1 $R(x1a)
|
||||
db eval { CREATE TABLE imp1(c, b, a, PRIMARY KEY(c, b)) WITHOUT ROWID }
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
|
||||
|
||||
db eval {
|
||||
DELETE FROM imp1 WHERE a=5;
|
||||
}
|
||||
execsql_pp {
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
} {}
|
||||
|
||||
do_intck_test 3.3 {
|
||||
{entry (4,'six',5) missing from index x1a}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 4.0 {
|
||||
CREATE TABLE www(x, y, z);
|
||||
CREATE INDEX w1 ON www( (x+1), z );
|
||||
INSERT INTO www VALUES(1, 1, 1), (2, 2, 2);
|
||||
}
|
||||
|
||||
do_intck_test 4.1 { }
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 5.0 {
|
||||
CREATE TABLE t1(a, b);
|
||||
CREATE INDEX i1 ON t1(a COLLATE NOCASE);
|
||||
INSERT INTO t1 VALUES(1, 1);
|
||||
INSERT INTO t1 VALUES(2, 2);
|
||||
}
|
||||
|
||||
do_test 5.1 {
|
||||
set ic [sqlite3_intck db nosuchdb]
|
||||
$ic step
|
||||
} {SQLITE_ERROR}
|
||||
|
||||
do_test 5.2 {
|
||||
$ic close
|
||||
set ic [sqlite3_intck db {}]
|
||||
while {[$ic step]=="SQLITE_OK"} {}
|
||||
set res [$ic error]
|
||||
$ic close
|
||||
set res
|
||||
} {SQLITE_OK {}}
|
||||
|
||||
do_test 5.3 { test_do_intck db "main" } {}
|
||||
|
||||
do_test 5.4 {
|
||||
set ret {}
|
||||
set ic [sqlite3_intck db main]
|
||||
db eval [$ic test_sql t1] {
|
||||
if {$error_message!=""} { lappend ret $error_message }
|
||||
}
|
||||
$ic close
|
||||
set ret
|
||||
} {}
|
||||
|
||||
do_test 5.5 {
|
||||
set ret {}
|
||||
set ic [sqlite3_intck db main]
|
||||
db eval [$ic test_sql {}] {
|
||||
if {$error_message!=""} { lappend ret $error_message }
|
||||
}
|
||||
$ic close
|
||||
set ret
|
||||
} {}
|
||||
|
||||
db cache flush
|
||||
|
||||
do_test 5.6 {
|
||||
set ret {}
|
||||
set ic [sqlite3_intck db main]
|
||||
$ic step
|
||||
db eval [$ic test_sql {}] {
|
||||
if {$error_message!=""} { lappend ret $error_message }
|
||||
}
|
||||
$ic close
|
||||
set ret
|
||||
} {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 6.0 {
|
||||
CREATE TABLE t1(x, y, PRIMARY KEY(x)) WITHOUT ROWID;
|
||||
CREATE INDEX i1 ON t1(y, x);
|
||||
INSERT INTO t1 VALUES(X'0000', X'1111');
|
||||
}
|
||||
|
||||
do_intck_test 6.1 {}
|
||||
|
||||
do_execsql_test 6.2.1 {
|
||||
PRAGMA writable_schema = 1;
|
||||
UPDATE sqlite_schema SET sql = 'CREATE INDEX i1' WHERE name='i1';
|
||||
} {}
|
||||
do_intck_test 6.2.2 {}
|
||||
|
||||
do_execsql_test 6.3.1 {
|
||||
UPDATE sqlite_schema SET sql = 'CREATE INDEX i1(y' WHERE name='i1';
|
||||
} {}
|
||||
do_intck_test 6.3.2 {}
|
||||
|
||||
do_execsql_test 6.4.1 {
|
||||
UPDATE sqlite_schema
|
||||
SET sql = 'CREATE INDEX i1(y) hello world'
|
||||
WHERE name='i1';
|
||||
} {}
|
||||
do_intck_test 6.4.2 {}
|
||||
|
||||
do_execsql_test 6.5.1 {
|
||||
UPDATE sqlite_schema
|
||||
SET sql = 'CREATE INDEX i1(y, x) WHERE 1 '
|
||||
WHERE name='i1';
|
||||
} {}
|
||||
do_intck_test 6.5.2 {}
|
||||
|
||||
do_execsql_test 6.6.1 {
|
||||
UPDATE sqlite_schema
|
||||
SET sql = 'CREATE INDEX i1( , ) WHERE 1 '
|
||||
WHERE name='i1';
|
||||
} {}
|
||||
|
||||
do_test 6.7.2 {
|
||||
set ic [sqlite3_intck db main]
|
||||
$ic step
|
||||
} {SQLITE_ERROR}
|
||||
do_test 6.5.3 {
|
||||
$ic error
|
||||
} {SQLITE_ERROR {near "AS": syntax error}}
|
||||
$ic close
|
||||
|
||||
do_execsql_test 6.6.1 {
|
||||
UPDATE sqlite_schema
|
||||
SET sql = 'CREATE INDEX i1([y'
|
||||
WHERE name='i1';
|
||||
} {}
|
||||
do_intck_test 6.6.2 {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 7.0 {
|
||||
CREATE TABLE x1("1", "22", "3333", four);
|
||||
CREATE INDEX i1 ON x1( "1" , "22", NULL);
|
||||
INSERT INTO x1 VALUES(1, 22, 3333, NULL);
|
||||
INSERT INTO x1 VALUES(1, 22, 3333, NULL);
|
||||
}
|
||||
do_execsql_test 7.1 " CREATE INDEX i2 ON x1( \"1\"\r\n\t ) "
|
||||
do_execsql_test 7.2 { CREATE INDEX i3 ON x1( "22" || 'abc''def' || `1` ) }
|
||||
do_execsql_test 7.3 { CREATE INDEX i4 ON x1( [22] + [1] ) }
|
||||
do_execsql_test 7.4 { CREATE INDEX i5 ON x1( four||'hello' ) }
|
||||
|
||||
do_intck_test 7.5 {}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,176 @@
|
||||
# 2024 Feb 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The focus of this file is testing the incremental integrity check
|
||||
# (intck) extension.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] intck_common.tcl]
|
||||
set testprefix intck2
|
||||
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
|
||||
INSERT INTO t1 VALUES(1, 'one');
|
||||
INSERT INTO t1 VALUES(2, 'two');
|
||||
INSERT INTO t1 VALUES(3, 'three');
|
||||
CREATE INDEX i1 ON t1(b);
|
||||
}
|
||||
|
||||
proc imposter_edit {obj create sql} {
|
||||
sqlite3 xdb test.db
|
||||
set pgno [xdb one {SELECT rootpage FROM sqlite_schema WHERE name=$obj}]
|
||||
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER xdb main 1 $pgno
|
||||
xdb eval $create
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER xdb main 0 0
|
||||
xdb eval $sql
|
||||
xdb close
|
||||
}
|
||||
|
||||
imposter_edit i1 {
|
||||
CREATE TABLE imp(b, a, PRIMARY KEY(b)) WITHOUT ROWID;
|
||||
} {
|
||||
DELETE FROM imp WHERE b='two';
|
||||
INSERT INTO imp(b, a) VALUES('four', 4);
|
||||
}
|
||||
|
||||
do_intck_test 1.1 {
|
||||
{surplus entry ('four',4) in index i1}
|
||||
{entry ('two',2) missing from index i1}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE x1(a, b, "c d");
|
||||
CREATE INDEX x1a ON x1(a COLLATE nocase DESC , b ASC);
|
||||
CREATE INDEX x1b ON x1( a || b || ' "''" ' COLLATE binary ASC );
|
||||
CREATE INDEX x1c ON x1( format('%s', a)ASC, format('%d', "c d" ) );
|
||||
INSERT INTO x1 VALUES('one', 2, 3);
|
||||
INSERT INTO x1 VALUES('One', 4, 5);
|
||||
INSERT INTO x1 VALUES('ONE', 6, 7);
|
||||
INSERT INTO x1 VALUES(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
do_intck_test 2.1 {}
|
||||
|
||||
imposter_edit x1 {
|
||||
CREATE TABLE imp(a, b, c);
|
||||
} {
|
||||
DELETE FROM imp WHERE c=7;
|
||||
}
|
||||
do_intck_test 2.2 {
|
||||
{surplus entry ('ONE',6,3) in index x1a}
|
||||
{surplus entry ('ONE6 "''" ',3) in index x1b}
|
||||
{surplus entry ('ONE','7',3) in index x1c}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
CREATE TABLE x1(a, b, c);
|
||||
CREATE INDEX x1all ON x1(a DESC, b ASC, c DESC);
|
||||
INSERT INTO x1 VALUES(2, 1, 2);
|
||||
INSERT INTO x1 VALUES(2, 1, 1);
|
||||
INSERT INTO x1 VALUES(2, 2, 2);
|
||||
INSERT INTO x1 VALUES(2, 2, 1);
|
||||
INSERT INTO x1 VALUES(1, 1, 2);
|
||||
INSERT INTO x1 VALUES(1, 1, 1);
|
||||
INSERT INTO x1 VALUES(1, 2, 2);
|
||||
INSERT INTO x1 VALUES(1, 2, 1);
|
||||
}
|
||||
|
||||
do_intck_test 3.1 {
|
||||
}
|
||||
|
||||
imposter_edit x1 {
|
||||
CREATE TABLE imp(a, b, c);
|
||||
} {
|
||||
DELETE FROM imp WHERE 1;
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
|
||||
do_intck_test 3.2 {
|
||||
{surplus entry (2,1,2,1) in index x1all}
|
||||
{surplus entry (2,1,1,2) in index x1all}
|
||||
{surplus entry (2,2,2,3) in index x1all}
|
||||
{surplus entry (2,2,1,4) in index x1all}
|
||||
{surplus entry (1,1,2,5) in index x1all}
|
||||
{surplus entry (1,1,1,6) in index x1all}
|
||||
{surplus entry (1,2,2,7) in index x1all}
|
||||
{surplus entry (1,2,1,8) in index x1all}
|
||||
}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
DELETE FROM x1;
|
||||
INSERT INTO x1 VALUES(NULL, NULL, NULL);
|
||||
INSERT INTO x1 VALUES(NULL, NULL, NULL);
|
||||
INSERT INTO x1 VALUES(NULL, NULL, NULL);
|
||||
INSERT INTO x1 VALUES(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
do_intck_test 3.4 {
|
||||
}
|
||||
|
||||
imposter_edit x1 {
|
||||
CREATE TABLE imp(a, b, c);
|
||||
} {
|
||||
DELETE FROM imp WHERE 1;
|
||||
INSERT INTO imp(rowid) VALUES(-123);
|
||||
INSERT INTO imp(rowid) VALUES(456);
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
|
||||
do_intck_test 3.5 {
|
||||
{entry (NULL,NULL,NULL,-123) missing from index x1all}
|
||||
{entry (NULL,NULL,NULL,456) missing from index x1all}
|
||||
{surplus entry (NULL,NULL,NULL,1) in index x1all}
|
||||
{surplus entry (NULL,NULL,NULL,2) in index x1all}
|
||||
{surplus entry (NULL,NULL,NULL,3) in index x1all}
|
||||
{surplus entry (NULL,NULL,NULL,4) in index x1all}
|
||||
}
|
||||
|
||||
reset_db
|
||||
|
||||
do_execsql_test 3.6 {
|
||||
CREATE TABLE w1(a PRIMARY KEY, b, c);
|
||||
INSERT INTO w1 VALUES(1.0, NULL, NULL);
|
||||
INSERT INTO w1 VALUES(33.0, NULL, NULL);
|
||||
INSERT INTO w1 VALUES(100.0, NULL, NULL);
|
||||
CREATE INDEX w1bc ON w1(b, c);
|
||||
}
|
||||
|
||||
do_intck_test 3.7 {
|
||||
}
|
||||
|
||||
imposter_edit w1 {
|
||||
CREATE TABLE imp(a, b, c);
|
||||
} {
|
||||
DELETE FROM imp WHERE a=33;
|
||||
INSERT INTO imp(a) VALUES(1234.5);
|
||||
INSERT INTO imp(a) VALUES(-1234.5);
|
||||
}
|
||||
|
||||
do_intck_test 3.8 {
|
||||
{surplus entry (33.0,2) in index sqlite_autoindex_w1_1}
|
||||
{entry (1234.5,4) missing from index sqlite_autoindex_w1_1}
|
||||
{entry (NULL,NULL,4) missing from index w1bc}
|
||||
{entry (-1234.5,5) missing from index sqlite_autoindex_w1_1}
|
||||
{entry (NULL,NULL,5) missing from index w1bc}
|
||||
{surplus entry (NULL,NULL,2) in index w1bc}
|
||||
}
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,56 @@
|
||||
# 2024 Feb 18
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
if {![info exists testdir]} {
|
||||
set testdir [file join [file dirname [info script]] .. .. test]
|
||||
}
|
||||
source $testdir/tester.tcl
|
||||
|
||||
proc do_intck {db {bSuspend 0}} {
|
||||
set ic [sqlite3_intck $db main]
|
||||
|
||||
set ret [list]
|
||||
while {"SQLITE_OK"==[$ic step]} {
|
||||
set msg [$ic message]
|
||||
if {$msg!=""} {
|
||||
lappend ret $msg
|
||||
}
|
||||
if {$bSuspend} {
|
||||
$ic unlock
|
||||
#puts "SQL: [$ic test_sql {}]"
|
||||
#execsql_pp "EXPLAIN query plan [$ic test_sql {}]"
|
||||
#explain_i [$ic test_sql {}]
|
||||
}
|
||||
}
|
||||
|
||||
set err [$ic error]
|
||||
if {[lindex $err 0]!="SQLITE_OK"} {
|
||||
error $err
|
||||
}
|
||||
$ic close
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc intck_sql {db tbl} {
|
||||
set ic [sqlite3_intck $db main]
|
||||
set sql [$ic test_sql $tbl]
|
||||
$ic close
|
||||
return $sql
|
||||
}
|
||||
|
||||
proc do_intck_test {tn expect} {
|
||||
uplevel [list do_test $tn.a [list do_intck db] [list {*}$expect]]
|
||||
uplevel [list do_test $tn.b [list do_intck db 1] [list {*}$expect]]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# 2024 February 24
|
||||
#
|
||||
# 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]] intck_common.tcl]
|
||||
set testprefix intckbusy
|
||||
|
||||
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||
INSERT INTO t1 VALUES(1, 2, 3);
|
||||
INSERT INTO t1 VALUES(2, 'two', 'three');
|
||||
INSERT INTO t1 VALUES(3, NULL, NULL);
|
||||
CREATE INDEX i1 ON t1(b, c);
|
||||
}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
|
||||
do_execsql_test -db db2 1.1 {
|
||||
BEGIN EXCLUSIVE;
|
||||
INSERT INTO t1 VALUES(4, 5, 6);
|
||||
}
|
||||
|
||||
do_test 1.2 {
|
||||
set ic [sqlite3_intck db main]
|
||||
$ic step
|
||||
} {SQLITE_BUSY}
|
||||
do_test 1.3 {
|
||||
$ic unlock
|
||||
} {SQLITE_BUSY}
|
||||
do_test 1.4 {
|
||||
$ic error
|
||||
} {SQLITE_BUSY {database is locked}}
|
||||
do_test 1.4 {
|
||||
$ic close
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
# 2024 Feb 21
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The focus of this file is testing the intck extensions response
|
||||
# to corruption at the b-tree level.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] intck_common.tcl]
|
||||
set testprefix intckcorrupt
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_test 1.0 {
|
||||
sqlite3 db {}
|
||||
db deserialize [decode_hexdb {
|
||||
| size 356352 pagesize 4096 filename crash-acaae0347204ae.db
|
||||
| page 1 offset 0
|
||||
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
|
||||
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 d0 00 00 00 .....@ ........
|
||||
| 32: 40 00 ea 00 00 00 00 00 00 40 00 00 00 40 00 00 @........@...@..
|
||||
| 96: 00 00 00 00 0d 00 00 00 04 0e 9c 00 0f ad 0f 4f ...............O
|
||||
| 112: 0e fc 0e 9c 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
| 3728: 00 00 00 00 00 00 00 00 00 00 00 00 5e 04 07 17 ............^...
|
||||
| 3744: 1f 1f 01 81 0b 74 61 62 6c 65 74 31 5f 70 61 72 .....tablet1_par
|
||||
| 3760: 65 6e 74 74 31 5f 70 61 72 65 6e 74 04 43 52 45 entt1_parent.CRE
|
||||
| 3776: 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 70 61 ATE TABLE .t1_pa
|
||||
| 3792: 72 65 6e 74 22 28 6e 6f 64 65 6e 6f 20 49 4e 54 rent.(nodeno INT
|
||||
| 3808: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 EGER PRIMARY KEY
|
||||
| 3824: 2c 70 61 72 65 6e 74 6e 6f 64 65 29 51 03 06 17 ,parentnode)Q...
|
||||
| 3840: 1b 1b 01 7b 74 61 62 6c 65 74 31 5f 6e 6f 64 65 ....tablet1_node
|
||||
| 3856: 74 31 5f 6e 6f 64 65 03 43 52 45 41 54 45 20 54 t1_node.CREATE T
|
||||
| 3872: 41 42 4c 45 20 22 74 31 5f 6e 6f 64 65 22 28 6e ABLE .t1_node.(n
|
||||
| 3888: 6f 64 65 6e 6f 20 49 4e 54 45 47 45 52 20 50 52 odeno INTEGER PR
|
||||
| 3904: 49 4d 41 52 59 20 4b 45 59 2c 64 61 74 61 29 5c IMARY KEY,data).
|
||||
| 3920: 02 07 17 1d 1d 01 81 0b 74 61 62 6c 65 74 31 5f ........tablet1_
|
||||
| 3936: 72 6f 77 69 64 74 31 5f 72 6f 77 69 64 02 43 52 rowidt1_rowid.CR
|
||||
| 3952: 45 41 54 45 20 54 41 42 4c 45 20 22 74 31 5f 72 EATE TABLE .t1_r
|
||||
| 3968: 6f 77 69 64 22 28 72 6f 77 69 64 20 49 4e 54 45 owid.(rowid INTE
|
||||
| 3984: 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c GER PRIMARY KEY,
|
||||
| 4000: 6e 6f 64 65 6e 6f 2c 61 30 2c 61 31 29 51 01 07 nodeno,a0,a1)Q..
|
||||
| 4016: 17 11 11 08 81 0f 74 61 62 6c 65 74 31 74 31 43 ......tablet1t1C
|
||||
| 4032: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
|
||||
| 4048: 42 4c 45 20 74 31 20 55 53 49 4e 47 20 72 74 72 BLE t1 USING rtr
|
||||
| 4064: 65 65 28 69 64 2c 78 30 20 50 52 49 4d 41 52 59 ee(id,x0 PRIMARY
|
||||
| 4080: 20 4b 45 59 2c 70 61 72 65 6e 74 6e 6f 64 65 29 KEY,parentnode)
|
||||
| page 2 offset 4096
|
||||
| 0: 51 03 06 17 1b 1b 01 7b 74 61 62 6c 65 74 31 5f Q.......tablet1_
|
||||
| 16: 6e 6f 64 65 74 31 5f 6e 6f 64 65 03 43 52 45 41 nodet1_node.CREA
|
||||
| 32: 54 45 20 54 41 42 4c 45 20 22 74 31 5f 6e 6f 64 TE TABLE .t1_nod
|
||||
| 48: 65 22 28 6e 6f 64 65 6e 6f 20 49 4e 54 45 47 45 e.(nodeno INTEGE
|
||||
| 64: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 64 61 R PRIMARY KEY,da
|
||||
| 80: 74 61 29 5c 02 07 17 1d 1d 01 81 0b 74 61 62 6c ta).........tabl
|
||||
| 96: 65 74 31 5f 72 6f 77 69 64 74 31 5f 72 6f 77 69 et1_rowidt1_rowi
|
||||
| 112: 64 02 43 52 45 41 54 45 20 54 41 42 4c 45 00 00 d.CREATE TABLE..
|
||||
| 128: 01 0a 02 00 00 00 01 0e 0d 00 00 00 00 24 0e 0d .............$..
|
||||
| 144: 0c 1a 06 85 50 46 60 27 70 08 00 00 00 00 00 00 ....PF`'p.......
|
||||
| 3824: 00 00 00 00 00 00 00 0d 0e 05 00 09 1d 00 74 6f ..............to
|
||||
| 3840: 79 20 68 61 6c 66 10 0d 05 00 09 23 00 62 6f 74 y half.....#.bot
|
||||
| 3856: 74 6f 6d 20 68 61 6c 66 0f 0c 05 00 09 21 00 72 tom half.....!.r
|
||||
| 3872: 69 67 68 74 20 68 61 6c 66 0e 0b 05 00 09 1f 00 ight half.......
|
||||
| 3888: 6c 65 66 74 20 43 15 f6 e6 f6 46 50 34 35 24 54 left C....FP45$T
|
||||
| 3904: 15 44 52 05 44 14 24 c4 52 02 27 43 15 f6 e6 f6 .DR.D.$.R.'C....
|
||||
| 3920: 46 52 22 8e 6f 64 65 6e 6f 20 49 4e 54 45 47 45 FR..odeno INTEGE
|
||||
| 3936: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 64 61 R PRIMARY KEY,da
|
||||
| 3952: 74 61 29 5c 02 07 17 1d 1d 01 81 0b 74 61 62 6c ta).........tabl
|
||||
| 3968: 65 74 31 5f 72 6f 74 74 6f 6d 20 65 64 67 65 0f et1_rottom edge.
|
||||
| 3984: 07 05 00 09 21 00 72 69 67 68 74 20 65 64 67 65 ....!.right edge
|
||||
| 4000: 0e 06 05 00 09 1f 00 6c 65 66 74 20 65 64 67 65 .......left edge
|
||||
| 4016: 0b 05 05 00 09 19 00 63 65 6e 74 65 72 17 04 05 .......center...
|
||||
| 4032: 00 09 31 00 75 70 70 65 72 2d 72 69 67 68 74 20 ..1.upper-right
|
||||
| 4048: 63 6f 72 6e 65 72 17 03 05 00 09 31 00 6c 6f 77 corner.....1.low
|
||||
| 4064: 65 72 2d 72 69 67 68 74 20 63 6f 72 6e 65 72 16 er-right corner.
|
||||
| 4080: 02 05 00 09 2f 00 75 70 70 65 72 2d 6c 65 66 74 ..../.upper-left
|
||||
| page 3 offset 8192
|
||||
| 0: 20 63 6f 72 6e 65 72 16 01 05 00 09 2f 01 8c 6f corner...../..o
|
||||
| 16: 77 65 72 2d 6c 53 51 4c 69 74 65 20 66 6f 72 6d wer-lSQLite form
|
||||
| 32: 61 74 20 33 00 10 00 01 01 00 40 20 20 00 00 00 at 3......@ ...
|
||||
| 48: 00 00 00 00 2f 00 00 0d eb 13 00 00 00 03 00 00 ..../...........
|
||||
| 64: 00 04 00 00 00 00 00 00 00 06 00 00 00 01 00 00 ................
|
||||
| 80: 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 ................
|
||||
| page 6 offset 20480
|
||||
| 128: 00 00 00 00 00 00 00 00 97 3d 04 ae 7c 01 00 00 .........=..|...
|
||||
| 624: 00 00 00 00 00 00 21 97 3d 04 ae 7c 01 00 00 00 ......!.=..|....
|
||||
| 1120: 00 00 00 00 00 20 97 3d 04 ae 7c 01 00 00 00 00 ..... .=..|.....
|
||||
| 1616: 00 00 00 00 1f 97 3d 04 ae 7c 01 00 00 00 00 00 ......=..|......
|
||||
| 2112: 00 00 00 1e 97 3d 04 ae 7c 01 00 00 00 00 00 00 .....=..|.......
|
||||
| 2608: 00 00 1d 97 d3 d0 4a e7 c0 00 00 00 00 00 00 00 ......J.........
|
||||
| 3088: 00 00 00 00 00 00 00 00 00 00 00 00 01 f3 00 00 ................
|
||||
| 3600: 23 97 3d 04 ae 7c 01 00 00 00 00 00 00 00 00 00 #.=..|..........
|
||||
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 26 ...............&
|
||||
| page 8 offset 28672
|
||||
| 0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00 ......0..0......
|
||||
| 1072: 97 4d 1e 14 00 ae 7c 00 00 00 00 00 00 00 00 00 .M....|.........
|
||||
| 1088: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 ................
|
||||
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 ................
|
||||
| page 10 offset 36864
|
||||
| 0: 0d 00 00 00 01 04 30 00 04 30 00 00 00 00 00 00 ......0..0......
|
||||
| 1072: 9a ee c1 80 fd 78 1f ce 1b ae eb b4 00 00 00 00 .....x..........
|
||||
| 1088: 13 20 ff 20 00 70 00 00 00 60 50 00 00 00 11 e0 . . .p...`P.....
|
||||
| 1104: 00 00 00 70 00 00 00 60 50 05 35 14 c6 97 46 52 ...p...`P.5...FR
|
||||
| 1120: 06 66 f7 26 d6 17 42 03 30 01 00 00 10 10 04 02 .f.&..B.0.......
|
||||
| 1136: 02 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 .........@......
|
||||
| 1152: 00 00 00 00 00 40 00 00 00 40 00 00 00 00 00 00 .....@...@......
|
||||
| 4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 ................
|
||||
| page 12 offset 45056
|
||||
| 0: 0d 00 00 00 01 04 30 00 04 30 e1 b4 30 97 4d 46 ......0..0..0.MF
|
||||
| 16: 14 00 ae 7c 00 00 00 00 00 00 00 03 00 00 43 00 ...|..........C.
|
||||
| page 47 offset 188416
|
||||
| 2512: 00 00 00 00 00 00 00 00 be 00 00 00 00 00 00 00 ................
|
||||
| page 87 offset 352256
|
||||
| 2512: 00 00 00 00 00 00 00 00 aa 00 00 00 00 00 00 00 ................
|
||||
| end crash-acaae0347204ae.db
|
||||
}]} {}
|
||||
|
||||
do_intck_test 1.1 {
|
||||
{corruption found while reading database schema}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_test 2.0 {
|
||||
sqlite3 db {}
|
||||
db deserialize [decode_hexdb {
|
||||
| size 28672 pagesize 4096 filename crash-3afa1ca9e9c1bd.db
|
||||
| page 1 offset 0
|
||||
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
|
||||
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 07 .....@ ........
|
||||
| 32: 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 04 ................
|
||||
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
|
||||
| 96: 00 00 00 00 0d 00 00 00 06 0e 88 00 0f b8 0f 6d ...............m
|
||||
| 112: 0f 3a 0f 0b 0e d5 0e 88 01 00 00 00 00 00 00 00 .:..............
|
||||
| 3712: 00 00 00 00 00 00 00 00 4b 06 06 17 25 25 01 5b ........K...%%.[
|
||||
| 3728: 74 61 62 6c 65 73 71 6c 69 74 65 5f 73 74 61 74 tablesqlite_stat
|
||||
| 3744: 31 73 71 6c 69 74 65 5f 73 74 61 74 31 07 43 52 1sqlite_stat1.CR
|
||||
| 3760: 45 41 54 45 20 54 41 42 4c 45 20 73 71 6c 69 74 EATE TABLE sqlit
|
||||
| 3776: 65 5f 73 74 61 74 31 28 74 62 6c 2c 69 64 78 2c e_stat1(tbl,idx,
|
||||
| 3792: 73 74 61 74 29 34 05 06 17 13 11 01 53 69 6e 64 stat)4......Sind
|
||||
| 3808: 65 78 63 31 63 63 31 06 43 52 45 41 54 45 20 55 exc1cc1.CREATE U
|
||||
| 3824: 4e 49 51 55 45 20 49 4e 44 45 58 20 63 31 63 20 NIQUE INDEX c1c
|
||||
| 3840: 4f 4e 20 63 31 28 63 2c 20 62 29 2d 04 06 17 13 ON c1(c, b)-....
|
||||
| 3856: 11 01 45 69 6e 64 65 78 63 31 64 63 31 05 43 52 ..Eindexc1dc1.CR
|
||||
| 3872: 45 41 54 45 20 49 4e 44 45 58 20 63 31 64 20 4f EATE INDEX c1d O
|
||||
| 3888: 4e 20 63 31 28 64 2c 20 62 29 31 03 06 17 13 11 N c1(d, b)1.....
|
||||
| 3904: 01 4d 69 6e 64 65 78 62 31 63 62 31 05 43 52 45 .Mindexb1cb1.CRE
|
||||
| 3920: 41 54 45 20 55 4e 49 51 55 45 20 49 4e 44 45 58 ATE UNIQUE INDEX
|
||||
| 3936: 20 62 31 63 20 4f 4e 20 62 31 28 63 29 49 02 06 b1c ON b1(c)I..
|
||||
| 3952: 17 11 11 0f 7f 74 61 62 6c 65 63 31 63 31 03 43 .....tablec1c1.C
|
||||
| 3968: 52 45 41 54 45 20 54 41 42 4c 45 20 63 31 28 61 REATE TABLE c1(a
|
||||
| 3984: 20 49 4e 54 20 50 52 49 4d 41 52 59 20 4b 45 59 INT PRIMARY KEY
|
||||
| 4000: 2c 20 62 2c 20 63 2c 20 64 29 20 57 49 54 48 4f , b, c, d) WITHO
|
||||
| 4016: 55 54 20 52 4f 57 49 44 46 01 06 17 11 11 01 79 UT ROWIDF......y
|
||||
| 4032: 74 61 62 6c 65 62 31 62 31 02 43 52 45 41 54 45 tableb1b1.CREATE
|
||||
| 4048: 20 54 41 42 4c 45 20 62 31 28 61 20 49 4e 54 20 TABLE b1(a INT
|
||||
| 4064: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 62 2c 20 PRIMARY KEY, b,
|
||||
| 4080: 63 29 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 c) WITHOUT ROWID
|
||||
| page 2 offset 4096
|
||||
| 0: 0a 00 00 00 07 0f ca 00 0f fa 0f f2 0f ea 0f e2 ................
|
||||
| 16: 0f da 00 00 00 01 00 00 00 00 00 00 00 00 00 00 ................
|
||||
| 4032: 00 00 00 00 00 00 00 00 00 00 07 04 01 0f 01 06 ................
|
||||
| 4048: 67 07 07 04 01 0f 01 06 66 06 07 04 01 0f 01 05 g.......f.......
|
||||
| 4064: 65 05 07 04 01 0f 01 04 64 04 07 04 01 0f 01 03 e.......d.......
|
||||
| 4080: 63 03 07 04 01 0f 01 02 62 0f 05 04 09 0f 09 61 c.......b......a
|
||||
| page 3 offset 8192
|
||||
| 0: 0a 00 00 00 07 0f bd 00 0f f9 0f ef 0f e5 0f db ................
|
||||
| 16: 0f d1 0f c7 0f bd 00 00 00 00 01 00 00 00 00 00 ................
|
||||
| 4016: 00 00 00 00 00 00 00 00 00 00 00 00 00 09 05 01 ................
|
||||
| 4032: 0f 01 01 07 61 07 07 09 05 01 0f 01 01 06 61 06 ....a.........a.
|
||||
| 4048: 06 09 05 01 0f 01 01 05 61 05 05 09 05 01 0f 01 ........a.......
|
||||
| 4064: 01 04 61 04 04 09 05 01 0f 01 01 03 61 03 03 09 ..a.........a...
|
||||
| 4080: 05 01 0f 01 01 02 61 0f 02 06 05 09 0f 09 09 61 ......a........a
|
||||
| page 4 offset 12288
|
||||
| 0: 0a 00 00 00 07 0f d8 00 0f fc 0f f0 0f ea 0f e4 ................
|
||||
| 16: 0f de 0f d8 0f f6 00 00 00 00 00 00 00 00 00 00 ................
|
||||
| 4048: 00 00 00 00 00 00 00 00 05 03 01 01 07 07 05 03 ................
|
||||
| 4064: 01 01 06 06 05 03 01 01 05 05 05 03 01 01 04 04 ................
|
||||
| 4080: 05 03 01 01 03 03 05 03 01 01 0f 02 03 03 09 09 ................
|
||||
| page 5 offset 16384
|
||||
| 0: 0a 00 00 00 07 0f ca 00 0f fa 0f f2 0f ea 0f 00 ................
|
||||
| 4032: 00 00 00 00 00 00 00 00 00 00 07 04 01 0f 01 07 ................
|
||||
| 4048: 61 07 07 04 01 0f 01 06 61 06 07 04 01 0f 01 05 a.......a.......
|
||||
| 4064: 61 05 07 04 01 1f 01 04 61 04 07 04 01 0f 01 03 a.......a.......
|
||||
| 4080: 61 03 07 04 01 0f 01 02 61 02 05 04 09 0f 09 61 a.......a......a
|
||||
| page 6 offset 20480
|
||||
| 0: 0a 00 00 00 07 0f ca 00 0f fa 0f ea 0f e2 00 00 ................
|
||||
| 4032: 00 00 00 00 00 00 00 00 00 00 07 04 01 0f 01 07 ................
|
||||
| 4048: 61 07 07 04 01 0f 01 06 61 06 07 04 01 0f 01 05 a.......a.......
|
||||
| 4064: 61 05 07 04 01 0f 01 04 61 04 07 04 01 0f 01 03 a.......a.......
|
||||
| 4080: 61 03 07 04 01 0f 01 0f 61 02 05 04 09 0f 09 61 a.......a......a
|
||||
| page 7 offset 24576
|
||||
| 0: 0d 00 00 00 05 0f 1c 00 0f f0 0f e0 0f d3 0f c5 ................
|
||||
| 16: 0f b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
| 4016: 00 00 00 00 00 00 00 00 0b 05 04 11 11 13 62 31 ..............b1
|
||||
| 4032: 62 31 37 20 31 0c 04 04 11 13 13 62 31 62 31 63 b17 1......b1b1c
|
||||
| 4048: 37 20 31 0b 03 04 11 11 13 63 31 63 31 37 20 31 7 1......c1c17 1
|
||||
| 4064: 0e 02 04 11 13 07 63 31 63 31 64 37 20 31 20 31 ......c1c1d7 1 1
|
||||
| 4080: 0e 01 04 11 13 17 63 31 63 31 63 37 20 31 00 00 ......c1c1c7 1..
|
||||
| end crash-3afa1ca9e9c1bd.db
|
||||
}]} {}
|
||||
|
||||
do_intck_test 2.1 {
|
||||
{corruption found while reading database schema}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(a, b);
|
||||
CREATE INDEX i1 ON t1(a);
|
||||
INSERT INTO t1 VALUES(1, 1), (2, 2), (3, 3);
|
||||
}
|
||||
|
||||
do_test 3.1 {
|
||||
set pgno [db one {SELECT rootpage FROM sqlite_schema WHERE name='t1'}]
|
||||
db close
|
||||
hexio_write test.db [expr ($pgno-1)*1024] 0000
|
||||
} {2}
|
||||
|
||||
sqlite3 db test.db
|
||||
do_intck_test 3.2 {
|
||||
{corruption found while scanning database object i1}
|
||||
{corruption found while scanning database object t1}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# 2024 February 24
|
||||
#
|
||||
# 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]] intck_common.tcl]
|
||||
set testprefix intckfault
|
||||
|
||||
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||
INSERT INTO t1 VALUES(1, 2, 3);
|
||||
INSERT INTO t1 VALUES(2, 'two', 'three');
|
||||
INSERT INTO t1 VALUES(3, NULL, NULL);
|
||||
CREATE INDEX i1 ON t1(b, c);
|
||||
}
|
||||
|
||||
do_faultsim_test 1 -faults oom-t* -prep {
|
||||
} -body {
|
||||
set ::ic [sqlite3_intck db main]
|
||||
set nStep 0
|
||||
while {"SQLITE_OK"==[$::ic step]} {
|
||||
incr nStep
|
||||
if {$nStep==3} { $::ic unlock }
|
||||
}
|
||||
set res [$::ic error]
|
||||
$::ic close
|
||||
set res
|
||||
} -test {
|
||||
catch { $::ic close }
|
||||
puts $testresult
|
||||
puts $testnfail
|
||||
faultsim_test_result {0 {SQLITE_OK {}}} {0 {SQLITE_NOMEM {}}} {0 {SQLITE_NOMEM {out of memory}}}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,941 @@
|
||||
/*
|
||||
** 2024-02-08
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#include "sqlite3intck.h"
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
** nKeyVal:
|
||||
** The number of values that make up the 'key' for the current pCheck
|
||||
** statement.
|
||||
**
|
||||
** rc:
|
||||
** Error code returned by most recent sqlite3_intck_step() or
|
||||
** sqlite3_intck_unlock() call. This is set to SQLITE_DONE when
|
||||
** the integrity-check operation is finished.
|
||||
**
|
||||
** zErr:
|
||||
** If the object has entered the error state, this is the error message.
|
||||
** Is freed using sqlite3_free() when the object is deleted.
|
||||
**
|
||||
** zTestSql:
|
||||
** The value returned by the most recent call to sqlite3_intck_testsql().
|
||||
** Each call to testsql() frees the previous zTestSql value (using
|
||||
** sqlite3_free()) and replaces it with the new value it will return.
|
||||
*/
|
||||
struct sqlite3_intck {
|
||||
sqlite3 *db;
|
||||
const char *zDb; /* Copy of zDb parameter to _open() */
|
||||
char *zObj; /* Current object. Or NULL. */
|
||||
|
||||
sqlite3_stmt *pCheck; /* Current check statement */
|
||||
char *zKey;
|
||||
int nKeyVal;
|
||||
|
||||
char *zMessage;
|
||||
int bCorruptSchema;
|
||||
|
||||
int rc; /* Error code */
|
||||
char *zErr; /* Error message */
|
||||
char *zTestSql; /* Returned by sqlite3_intck_test_sql() */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** Some error has occurred while using database p->db. Save the error message
|
||||
** and error code currently held by the database handle in p->rc and p->zErr.
|
||||
*/
|
||||
static void intckSaveErrmsg(sqlite3_intck *p){
|
||||
p->rc = sqlite3_errcode(p->db);
|
||||
sqlite3_free(p->zErr);
|
||||
p->zErr = sqlite3_mprintf("%s", sqlite3_errmsg(p->db));
|
||||
}
|
||||
|
||||
/*
|
||||
** If the handle passed as the first argument is already in the error state,
|
||||
** then this function is a no-op (returns NULL immediately). Otherwise, if an
|
||||
** error occurs within this function, it leaves an error in said handle.
|
||||
**
|
||||
** Otherwise, this function attempts to prepare SQL statement zSql and
|
||||
** return the resulting statement handle to the user.
|
||||
*/
|
||||
static sqlite3_stmt *intckPrepare(sqlite3_intck *p, const char *zSql){
|
||||
sqlite3_stmt *pRet = 0;
|
||||
if( p->rc==SQLITE_OK ){
|
||||
p->rc = sqlite3_prepare_v2(p->db, zSql, -1, &pRet, 0);
|
||||
if( p->rc!=SQLITE_OK ){
|
||||
intckSaveErrmsg(p);
|
||||
assert( pRet==0 );
|
||||
}
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the handle passed as the first argument is already in the error state,
|
||||
** then this function is a no-op (returns NULL immediately). Otherwise, if an
|
||||
** error occurs within this function, it leaves an error in said handle.
|
||||
**
|
||||
** Otherwise, this function treats argument zFmt as a printf() style format
|
||||
** string. It formats it according to the trailing arguments and then
|
||||
** attempts to prepare the results and return the resulting prepared
|
||||
** statement.
|
||||
*/
|
||||
static sqlite3_stmt *intckPrepareFmt(sqlite3_intck *p, const char *zFmt, ...){
|
||||
sqlite3_stmt *pRet = 0;
|
||||
va_list ap;
|
||||
char *zSql = 0;
|
||||
va_start(ap, zFmt);
|
||||
zSql = sqlite3_vmprintf(zFmt, ap);
|
||||
if( p->rc==SQLITE_OK && zSql==0 ){
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
pRet = intckPrepare(p, zSql);
|
||||
sqlite3_free(zSql);
|
||||
va_end(ap);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Finalize SQL statement pStmt. If an error occurs and the handle passed
|
||||
** as the first argument does not already contain an error, store the
|
||||
** error in the handle.
|
||||
*/
|
||||
static void intckFinalize(sqlite3_intck *p, sqlite3_stmt *pStmt){
|
||||
int rc = sqlite3_finalize(pStmt);
|
||||
if( p->rc==SQLITE_OK && rc!=SQLITE_OK ){
|
||||
intckSaveErrmsg(p);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** If there is already an error in handle p, return it. Otherwise, call
|
||||
** sqlite3_step() on the statement handle and return that value.
|
||||
*/
|
||||
static int intckStep(sqlite3_intck *p, sqlite3_stmt *pStmt){
|
||||
if( p->rc ) return p->rc;
|
||||
return sqlite3_step(pStmt);
|
||||
}
|
||||
|
||||
/*
|
||||
** Execute SQL statement zSql. There is no way to obtain any results
|
||||
** returned by the statement. This function uses the sqlite3_intck error
|
||||
** code convention.
|
||||
*/
|
||||
static void intckExec(sqlite3_intck *p, const char *zSql){
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
pStmt = intckPrepare(p, zSql);
|
||||
intckStep(p, pStmt);
|
||||
intckFinalize(p, pStmt);
|
||||
}
|
||||
|
||||
/*
|
||||
** A wrapper around sqlite3_mprintf() that uses the sqlite3_intck error
|
||||
** code convention.
|
||||
*/
|
||||
static char *intckMprintf(sqlite3_intck *p, const char *zFmt, ...){
|
||||
va_list ap;
|
||||
char *zRet = 0;
|
||||
va_start(ap, zFmt);
|
||||
zRet = sqlite3_vmprintf(zFmt, ap);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( zRet==0 ){
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
}else{
|
||||
sqlite3_free(zRet);
|
||||
zRet = 0;
|
||||
}
|
||||
return zRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** This is used by sqlite3_intck_unlock() to save the vector key value
|
||||
** required to restart the current pCheck query as a nul-terminated string
|
||||
** in p->zKey.
|
||||
*/
|
||||
static void intckSaveKey(sqlite3_intck *p){
|
||||
int ii;
|
||||
char *zSql = 0;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
sqlite3_stmt *pXinfo = 0;
|
||||
const char *zDir = 0;
|
||||
|
||||
assert( p->pCheck );
|
||||
assert( p->zKey==0 );
|
||||
|
||||
pXinfo = intckPrepareFmt(p,
|
||||
"SELECT group_concat(desc, '') FROM %Q.sqlite_schema s, "
|
||||
"pragma_index_xinfo(%Q, %Q) "
|
||||
"WHERE s.type='index' AND s.name=%Q",
|
||||
p->zDb, p->zObj, p->zDb, p->zObj
|
||||
);
|
||||
if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXinfo) ){
|
||||
zDir = (const char*)sqlite3_column_text(pXinfo, 0);
|
||||
}
|
||||
|
||||
if( zDir==0 ){
|
||||
/* Object is a table, not an index. This is the easy case,as there are
|
||||
** no DESC columns or NULL values in a primary key. */
|
||||
const char *zSep = "SELECT '(' || ";
|
||||
for(ii=0; ii<p->nKeyVal; ii++){
|
||||
zSql = intckMprintf(p, "%z%squote(?)", zSql, zSep);
|
||||
zSep = " || ', ' || ";
|
||||
}
|
||||
zSql = intckMprintf(p, "%z || ')'", zSql);
|
||||
}else{
|
||||
|
||||
/* Object is an index. */
|
||||
assert( p->nKeyVal>1 );
|
||||
for(ii=p->nKeyVal; ii>0; ii--){
|
||||
int bLastIsDesc = zDir[ii-1]=='1';
|
||||
int bLastIsNull = sqlite3_column_type(p->pCheck, ii)==SQLITE_NULL;
|
||||
const char *zLast = sqlite3_column_name(p->pCheck, ii);
|
||||
char *zLhs = 0;
|
||||
char *zRhs = 0;
|
||||
char *zWhere = 0;
|
||||
|
||||
if( bLastIsNull ){
|
||||
if( bLastIsDesc ) continue;
|
||||
zWhere = intckMprintf(p, "'%s IS NOT NULL'", zLast);
|
||||
}else{
|
||||
const char *zOp = bLastIsDesc ? "<" : ">";
|
||||
zWhere = intckMprintf(p, "'%s %s ' || quote(?%d)", zLast, zOp, ii);
|
||||
}
|
||||
|
||||
if( ii>1 ){
|
||||
const char *zLhsSep = "";
|
||||
const char *zRhsSep = "";
|
||||
int jj;
|
||||
for(jj=0; jj<ii-1; jj++){
|
||||
const char *zAlias = (const char*)sqlite3_column_name(p->pCheck,jj+1);
|
||||
zLhs = intckMprintf(p, "%z%s%s", zLhs, zLhsSep, zAlias);
|
||||
zRhs = intckMprintf(p, "%z%squote(?%d)", zRhs, zRhsSep, jj+1);
|
||||
zLhsSep = ",";
|
||||
zRhsSep = " || ',' || ";
|
||||
}
|
||||
|
||||
zWhere = intckMprintf(p,
|
||||
"'(%z) IS (' || %z || ') AND ' || %z",
|
||||
zLhs, zRhs, zWhere);
|
||||
}
|
||||
zWhere = intckMprintf(p, "'WHERE ' || %z", zWhere);
|
||||
|
||||
zSql = intckMprintf(p, "%z%s(quote( %z ) )",
|
||||
zSql,
|
||||
(zSql==0 ? "VALUES" : ",\n "),
|
||||
zWhere
|
||||
);
|
||||
}
|
||||
zSql = intckMprintf(p,
|
||||
"WITH wc(q) AS (\n%z\n)"
|
||||
"SELECT 'VALUES' || group_concat('(' || q || ')', ',\n ') FROM wc"
|
||||
, zSql
|
||||
);
|
||||
}
|
||||
|
||||
pStmt = intckPrepare(p, zSql);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
for(ii=0; ii<p->nKeyVal; ii++){
|
||||
sqlite3_bind_value(pStmt, ii+1, sqlite3_column_value(p->pCheck, ii+1));
|
||||
}
|
||||
if( SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
p->zKey = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0));
|
||||
}
|
||||
intckFinalize(p, pStmt);
|
||||
}
|
||||
|
||||
sqlite3_free(zSql);
|
||||
intckFinalize(p, pXinfo);
|
||||
}
|
||||
|
||||
/*
|
||||
** Find the next database object (table or index) to check. If successful,
|
||||
** set sqlite3_intck.zObj to point to a nul-terminated buffer containing
|
||||
** the object's name before returning.
|
||||
*/
|
||||
static void intckFindObject(sqlite3_intck *p){
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
char *zPrev = p->zObj;
|
||||
p->zObj = 0;
|
||||
|
||||
assert( p->rc==SQLITE_OK );
|
||||
assert( p->pCheck==0 );
|
||||
|
||||
pStmt = intckPrepareFmt(p,
|
||||
"WITH tables(table_name) AS ("
|
||||
" SELECT name"
|
||||
" FROM %Q.sqlite_schema WHERE (type='table' OR type='index') AND rootpage"
|
||||
" UNION ALL "
|
||||
" SELECT 'sqlite_schema'"
|
||||
")"
|
||||
"SELECT table_name FROM tables "
|
||||
"WHERE ?1 IS NULL OR table_name%s?1 "
|
||||
"ORDER BY 1"
|
||||
, p->zDb, (p->zKey ? ">=" : ">")
|
||||
);
|
||||
|
||||
if( p->rc==SQLITE_OK ){
|
||||
sqlite3_bind_text(pStmt, 1, zPrev, -1, SQLITE_TRANSIENT);
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
p->zObj = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0));
|
||||
}
|
||||
}
|
||||
intckFinalize(p, pStmt);
|
||||
|
||||
/* If this is a new object, ensure the previous key value is cleared. */
|
||||
if( sqlite3_stricmp(p->zObj, zPrev) ){
|
||||
sqlite3_free(p->zKey);
|
||||
p->zKey = 0;
|
||||
}
|
||||
|
||||
sqlite3_free(zPrev);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the size in bytes of the first token in nul-terminated buffer z.
|
||||
** For the purposes of this call, a token is either:
|
||||
**
|
||||
** * a quoted SQL string,
|
||||
* * a contiguous series of ascii alphabet characters, or
|
||||
* * any other single byte.
|
||||
*/
|
||||
static int intckGetToken(const char *z){
|
||||
char c = z[0];
|
||||
int iRet = 1;
|
||||
if( c=='\'' || c=='"' || c=='`' ){
|
||||
while( 1 ){
|
||||
if( z[iRet]==c ){
|
||||
iRet++;
|
||||
if( z[iRet]!=c ) break;
|
||||
}
|
||||
iRet++;
|
||||
}
|
||||
}
|
||||
else if( c=='[' ){
|
||||
while( z[iRet++]!=']' && z[iRet] );
|
||||
}
|
||||
else if( (c>='A' && c<='Z') || (c>='a' && c<='z') ){
|
||||
while( (z[iRet]>='A' && z[iRet]<='Z') || (z[iRet]>='a' && z[iRet]<='z') ){
|
||||
iRet++;
|
||||
}
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if argument c is an ascii whitespace character.
|
||||
*/
|
||||
static int intckIsSpace(char c){
|
||||
return (c==' ' || c=='\t' || c=='\n' || c=='\r');
|
||||
}
|
||||
|
||||
/*
|
||||
** Argument z points to the text of a CREATE INDEX statement. This function
|
||||
** identifies the part of the text that contains either the index WHERE
|
||||
** clause (if iCol<0) or the iCol'th column of the index.
|
||||
**
|
||||
** If (iCol<0), the identified fragment does not include the "WHERE" keyword,
|
||||
** only the expression that follows it. If (iCol>=0) then the identified
|
||||
** fragment does not include any trailing sort-order keywords - "ASC" or
|
||||
** "DESC".
|
||||
**
|
||||
** If the CREATE INDEX statement does not contain the requested field or
|
||||
** clause, NULL is returned and (*pnByte) is set to 0. Otherwise, a pointer to
|
||||
** the identified fragment is returned and output parameter (*pnByte) set
|
||||
** to its size in bytes.
|
||||
*/
|
||||
static const char *intckParseCreateIndex(const char *z, int iCol, int *pnByte){
|
||||
int iOff = 0;
|
||||
int iThisCol = 0;
|
||||
int iStart = 0;
|
||||
int nOpen = 0;
|
||||
|
||||
const char *zRet = 0;
|
||||
int nRet = 0;
|
||||
|
||||
int iEndOfCol = 0;
|
||||
|
||||
/* Skip forward until the first "(" token */
|
||||
while( z[iOff]!='(' ){
|
||||
iOff += intckGetToken(&z[iOff]);
|
||||
if( z[iOff]=='\0' ) return 0;
|
||||
}
|
||||
assert( z[iOff]=='(' );
|
||||
|
||||
nOpen = 1;
|
||||
iOff++;
|
||||
iStart = iOff;
|
||||
while( z[iOff] ){
|
||||
const char *zToken = &z[iOff];
|
||||
int nToken = 0;
|
||||
|
||||
/* Check if this is the end of the current column - either a "," or ")"
|
||||
** when nOpen==1. */
|
||||
if( nOpen==1 ){
|
||||
if( z[iOff]==',' || z[iOff]==')' ){
|
||||
if( iCol==iThisCol ){
|
||||
int iEnd = iEndOfCol ? iEndOfCol : iOff;
|
||||
nRet = (iEnd - iStart);
|
||||
zRet = &z[iStart];
|
||||
break;
|
||||
}
|
||||
iStart = iOff+1;
|
||||
while( intckIsSpace(z[iStart]) ) iStart++;
|
||||
iThisCol++;
|
||||
}
|
||||
if( z[iOff]==')' ) break;
|
||||
}
|
||||
if( z[iOff]=='(' ) nOpen++;
|
||||
if( z[iOff]==')' ) nOpen--;
|
||||
nToken = intckGetToken(zToken);
|
||||
|
||||
if( (nToken==3 && 0==sqlite3_strnicmp(zToken, "ASC", nToken))
|
||||
|| (nToken==4 && 0==sqlite3_strnicmp(zToken, "DESC", nToken))
|
||||
){
|
||||
iEndOfCol = iOff;
|
||||
}else if( 0==intckIsSpace(zToken[0]) ){
|
||||
iEndOfCol = 0;
|
||||
}
|
||||
|
||||
iOff += nToken;
|
||||
}
|
||||
|
||||
/* iStart is now the byte offset of 1 byte passed the final ')' in the
|
||||
** CREATE INDEX statement. Try to find a WHERE clause to return. */
|
||||
while( zRet==0 && z[iOff] ){
|
||||
int n = intckGetToken(&z[iOff]);
|
||||
if( n==5 && 0==sqlite3_strnicmp(&z[iOff], "where", 5) ){
|
||||
zRet = &z[iOff+5];
|
||||
nRet = strlen(zRet);
|
||||
}
|
||||
iOff += n;
|
||||
}
|
||||
|
||||
/* Trim any whitespace from the start and end of the returned string. */
|
||||
if( zRet ){
|
||||
while( intckIsSpace(zRet[0]) ){
|
||||
nRet--;
|
||||
zRet++;
|
||||
}
|
||||
while( nRet>0 && intckIsSpace(zRet[nRet-1]) ) nRet--;
|
||||
}
|
||||
|
||||
*pnByte = nRet;
|
||||
return zRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** User-defined SQL function wrapper for intckParseCreateIndex():
|
||||
**
|
||||
** SELECT parse_create_index(<sql>, <icol>);
|
||||
*/
|
||||
static void intckParseCreateIndexFunc(
|
||||
sqlite3_context *pCtx,
|
||||
int nVal,
|
||||
sqlite3_value **apVal
|
||||
){
|
||||
const char *zSql = (const char*)sqlite3_value_text(apVal[0]);
|
||||
int idx = sqlite3_value_int(apVal[1]);
|
||||
const char *zRes = 0;
|
||||
int nRes = 0;
|
||||
|
||||
assert( nVal==2 );
|
||||
if( zSql ){
|
||||
zRes = intckParseCreateIndex(zSql, idx, &nRes);
|
||||
}
|
||||
sqlite3_result_text(pCtx, zRes, nRes, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if sqlite3_intck.db has automatic indexes enabled, false
|
||||
** otherwise.
|
||||
*/
|
||||
static int intckGetAutoIndex(sqlite3_intck *p){
|
||||
int bRet = 0;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
pStmt = intckPrepare(p, "PRAGMA automatic_index");
|
||||
if( SQLITE_ROW==intckStep(p, pStmt) ){
|
||||
bRet = sqlite3_column_int(pStmt, 0);
|
||||
}
|
||||
intckFinalize(p, pStmt);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if zObj is an index, or false otherwise.
|
||||
*/
|
||||
static int intckIsIndex(sqlite3_intck *p, const char *zObj){
|
||||
int bRet = 0;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
pStmt = intckPrepareFmt(p,
|
||||
"SELECT 1 FROM %Q.sqlite_schema WHERE name=%Q AND type='index'",
|
||||
p->zDb, zObj
|
||||
);
|
||||
if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
bRet = 1;
|
||||
}
|
||||
intckFinalize(p, pStmt);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a pointer to a nul-terminated buffer containing the SQL statement
|
||||
** used to check database object zObj (a table or index) for corruption.
|
||||
** If parameter zPrev is not NULL, then it must be a string containing the
|
||||
** vector key required to restart the check where it left off last time.
|
||||
** If pnKeyVal is not NULL, then (*pnKeyVal) is set to the number of
|
||||
** columns in the vector key value for the specified object.
|
||||
**
|
||||
** This function uses the sqlite3_intck error code convention.
|
||||
*/
|
||||
static char *intckCheckObjectSql(
|
||||
sqlite3_intck *p, /* Integrity check object */
|
||||
const char *zObj, /* Object (table or index) to scan */
|
||||
const char *zPrev, /* Restart key vector, if any */
|
||||
int *pnKeyVal /* OUT: Number of key-values for this scan */
|
||||
){
|
||||
char *zRet = 0;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
int bAutoIndex = 0;
|
||||
int bIsIndex = 0;
|
||||
|
||||
const char *zCommon =
|
||||
/* Relation without_rowid also contains just one row. Column "b" is
|
||||
** set to true if the table being examined is a WITHOUT ROWID table,
|
||||
** or false otherwise. */
|
||||
", without_rowid(b) AS ("
|
||||
" SELECT EXISTS ("
|
||||
" SELECT 1 FROM tabname, pragma_index_list(tab, db) AS l"
|
||||
" WHERE origin='pk' "
|
||||
" AND NOT EXISTS (SELECT 1 FROM sqlite_schema WHERE name=l.name)"
|
||||
" )"
|
||||
")"
|
||||
""
|
||||
/* Table idx_cols contains 1 row for each column in each index on the
|
||||
** table being checked. Columns are:
|
||||
**
|
||||
** idx_name: Name of the index.
|
||||
** idx_ispk: True if this index is the PK of a WITHOUT ROWID table.
|
||||
** col_name: Name of indexed column, or NULL for index on expression.
|
||||
** col_expr: Indexed expression, including COLLATE clause.
|
||||
** col_alias: Alias used for column in 'intck_wrapper' table.
|
||||
*/
|
||||
", idx_cols(idx_name, idx_ispk, col_name, col_expr, col_alias) AS ("
|
||||
" SELECT l.name, (l.origin=='pk' AND w.b), i.name, COALESCE(("
|
||||
" SELECT parse_create_index(sql, i.seqno) FROM "
|
||||
" sqlite_schema WHERE name = l.name"
|
||||
" ), format('\"%w\"', i.name) || ' COLLATE ' || quote(i.coll)),"
|
||||
" 'c' || row_number() OVER ()"
|
||||
" FROM "
|
||||
" tabname t,"
|
||||
" without_rowid w,"
|
||||
" pragma_index_list(t.tab, t.db) l,"
|
||||
" pragma_index_xinfo(l.name) i"
|
||||
" WHERE i.key"
|
||||
" UNION ALL"
|
||||
" SELECT '', 1, '_rowid_', '_rowid_', 'r1' FROM without_rowid WHERE b=0"
|
||||
")"
|
||||
""
|
||||
""
|
||||
/*
|
||||
** For a PK declared as "PRIMARY KEY(a, b) ... WITHOUT ROWID", where
|
||||
** the intck_wrapper aliases of "a" and "b" are "c1" and "c2":
|
||||
**
|
||||
** o_pk: "o.c1, o.c2"
|
||||
** i_pk: "i.'a', i.'b'"
|
||||
** ...
|
||||
** n_pk: 2
|
||||
*/
|
||||
", tabpk(db, tab, idx, o_pk, i_pk, q_pk, eq_pk, ps_pk, pk_pk, n_pk) AS ("
|
||||
" WITH pkfields(f, a) AS ("
|
||||
" SELECT i.col_name, i.col_alias FROM idx_cols i WHERE i.idx_ispk"
|
||||
" )"
|
||||
" SELECT t.db, t.tab, t.idx, "
|
||||
" group_concat(a, ', '), "
|
||||
" group_concat('i.'||quote(f), ', '), "
|
||||
" group_concat('quote(o.'||a||')', ' || '','' || '), "
|
||||
" format('(%s)==(%s)',"
|
||||
" group_concat('o.'||a, ', '), "
|
||||
" group_concat(format('\"%w\"', f), ', ')"
|
||||
" ),"
|
||||
" group_concat('%s', ','),"
|
||||
" group_concat('quote('||a||')', ', '), "
|
||||
" count(*)"
|
||||
" FROM tabname t, pkfields"
|
||||
")"
|
||||
""
|
||||
", idx(name, match_expr, partial, partial_alias, idx_ps, idx_idx) AS ("
|
||||
" SELECT idx_name,"
|
||||
" format('(%s,%s) IS (%s,%s)', "
|
||||
" group_concat(i.col_expr, ', '), i_pk,"
|
||||
" group_concat('o.'||i.col_alias, ', '), o_pk"
|
||||
" ), "
|
||||
" parse_create_index("
|
||||
" (SELECT sql FROM sqlite_schema WHERE name=idx_name), -1"
|
||||
" ),"
|
||||
" 'cond' || row_number() OVER ()"
|
||||
" , group_concat('%s', ',')"
|
||||
" , group_concat('quote('||i.col_alias||')', ', ')"
|
||||
" FROM tabpk t, "
|
||||
" without_rowid w,"
|
||||
" idx_cols i"
|
||||
" WHERE i.idx_ispk==0 "
|
||||
" GROUP BY idx_name"
|
||||
")"
|
||||
""
|
||||
", wrapper_with(s) AS ("
|
||||
" SELECT 'intck_wrapper AS (\n SELECT\n ' || ("
|
||||
" WITH f(a, b) AS ("
|
||||
" SELECT col_expr, col_alias FROM idx_cols"
|
||||
" UNION ALL "
|
||||
" SELECT partial, partial_alias FROM idx WHERE partial IS NOT NULL"
|
||||
" )"
|
||||
" SELECT group_concat(format('%s AS %s', a, b), ',\n ') FROM f"
|
||||
" )"
|
||||
" || format('\n FROM %Q.%Q ', t.db, t.tab)"
|
||||
/* If the object being checked is a table, append "NOT INDEXED".
|
||||
** Otherwise, append "INDEXED BY <index>", and then, if the index
|
||||
** is a partial index " WHERE <condition>". */
|
||||
" || CASE WHEN t.idx IS NULL THEN "
|
||||
" 'NOT INDEXED'"
|
||||
" ELSE"
|
||||
" format('INDEXED BY %Q%s', t.idx, ' WHERE '||i.partial)"
|
||||
" END"
|
||||
" || '\n)'"
|
||||
" FROM tabname t LEFT JOIN idx i ON (i.name=t.idx)"
|
||||
")"
|
||||
""
|
||||
;
|
||||
|
||||
bAutoIndex = intckGetAutoIndex(p);
|
||||
if( bAutoIndex ) intckExec(p, "PRAGMA automatic_index = 0");
|
||||
|
||||
bIsIndex = intckIsIndex(p, zObj);
|
||||
if( bIsIndex ){
|
||||
pStmt = intckPrepareFmt(p,
|
||||
/* Table idxname contains a single row. The first column, "db", contains
|
||||
** the name of the db containing the table (e.g. "main") and the second,
|
||||
** "tab", the name of the table itself. */
|
||||
"WITH tabname(db, tab, idx) AS ("
|
||||
" SELECT %Q, (SELECT tbl_name FROM %Q.sqlite_schema WHERE name=%Q), %Q "
|
||||
")"
|
||||
""
|
||||
", whereclause(w_c) AS (%s)"
|
||||
""
|
||||
"%s" /* zCommon */
|
||||
""
|
||||
", case_statement(c) AS ("
|
||||
" SELECT "
|
||||
" 'CASE WHEN (' || group_concat(col_alias, ', ') || ', 1) IS (\n' "
|
||||
" || ' SELECT ' || group_concat(col_expr, ', ') || ', 1 FROM '"
|
||||
" || format('%%Q.%%Q NOT INDEXED WHERE %%s\n', t.db, t.tab, p.eq_pk)"
|
||||
" || ' )\n THEN NULL\n '"
|
||||
" || 'ELSE format(''surplus entry ('"
|
||||
" || group_concat('%%s', ',') || ',' || p.ps_pk"
|
||||
" || ') in index ' || t.idx || ''', ' "
|
||||
" || group_concat('quote('||i.col_alias||')', ', ') || ', ' || p.pk_pk"
|
||||
" || ')'"
|
||||
" || '\n END AS error_message'"
|
||||
" FROM tabname t, tabpk p, idx_cols i WHERE i.idx_name=t.idx"
|
||||
")"
|
||||
""
|
||||
", thiskey(k, n) AS ("
|
||||
" SELECT group_concat(i.col_alias, ', ') || ', ' || p.o_pk, "
|
||||
" count(*) + p.n_pk "
|
||||
" FROM tabpk p, idx_cols i WHERE i.idx_name=p.idx"
|
||||
")"
|
||||
""
|
||||
", main_select(m, n) AS ("
|
||||
" SELECT format("
|
||||
" 'WITH %%s\n' ||"
|
||||
" ', idx_checker AS (\n' ||"
|
||||
" ' SELECT %%s,\n' ||"
|
||||
" ' %%s\n' || "
|
||||
" ' FROM intck_wrapper AS o\n' ||"
|
||||
" ')\n',"
|
||||
" ww.s, c, t.k"
|
||||
" ), t.n"
|
||||
" FROM case_statement, wrapper_with ww, thiskey t"
|
||||
")"
|
||||
|
||||
"SELECT m || "
|
||||
" group_concat('SELECT * FROM idx_checker ' || w_c, ' UNION ALL '), n"
|
||||
" FROM "
|
||||
"main_select, whereclause "
|
||||
, p->zDb, p->zDb, zObj, zObj
|
||||
, zPrev ? zPrev : "VALUES('')", zCommon
|
||||
);
|
||||
}else{
|
||||
pStmt = intckPrepareFmt(p,
|
||||
/* Table tabname contains a single row. The first column, "db", contains
|
||||
** the name of the db containing the table (e.g. "main") and the second,
|
||||
** "tab", the name of the table itself. */
|
||||
"WITH tabname(db, tab, idx, prev) AS (SELECT %Q, %Q, NULL, %Q)"
|
||||
""
|
||||
"%s" /* zCommon */
|
||||
|
||||
/* expr(e) contains one row for each index on table zObj. Value e
|
||||
** is set to an expression that evaluates to NULL if the required
|
||||
** entry is present in the index, or an error message otherwise. */
|
||||
", expr(e, p) AS ("
|
||||
" SELECT format('CASE WHEN EXISTS \n"
|
||||
" (SELECT 1 FROM %%Q.%%Q AS i INDEXED BY %%Q WHERE %%s%%s)\n"
|
||||
" THEN NULL\n"
|
||||
" ELSE format(''entry (%%s,%%s) missing from index %%s'', %%s, %%s)\n"
|
||||
" END\n'"
|
||||
" , t.db, t.tab, i.name, i.match_expr, ' AND (' || partial || ')',"
|
||||
" i.idx_ps, t.ps_pk, i.name, i.idx_idx, t.pk_pk),"
|
||||
" CASE WHEN partial IS NULL THEN NULL ELSE i.partial_alias END"
|
||||
" FROM tabpk t, idx i"
|
||||
")"
|
||||
|
||||
", numbered(ii, cond, e) AS ("
|
||||
" SELECT 0, 'n.ii=0', 'NULL'"
|
||||
" UNION ALL "
|
||||
" SELECT row_number() OVER (),"
|
||||
" '(n.ii='||row_number() OVER ()||COALESCE(' AND '||p||')', ')'), e"
|
||||
" FROM expr"
|
||||
")"
|
||||
|
||||
", counter_with(w) AS ("
|
||||
" SELECT 'WITH intck_counter(ii) AS (\n ' || "
|
||||
" group_concat('SELECT '||ii, ' UNION ALL\n ') "
|
||||
" || '\n)' FROM numbered"
|
||||
")"
|
||||
""
|
||||
", case_statement(c) AS ("
|
||||
" SELECT 'CASE ' || "
|
||||
" group_concat(format('\n WHEN %%s THEN (%%s)', cond, e), '') ||"
|
||||
" '\nEND AS error_message'"
|
||||
" FROM numbered"
|
||||
")"
|
||||
""
|
||||
|
||||
/* This table contains a single row consisting of a single value -
|
||||
** the text of an SQL expression that may be used by the main SQL
|
||||
** statement to output an SQL literal that can be used to resume
|
||||
** the scan if it is suspended. e.g. for a rowid table, an expression
|
||||
** like:
|
||||
**
|
||||
** format('(%d,%d)', _rowid_, n.ii)
|
||||
*/
|
||||
", thiskey(k, n) AS ("
|
||||
" SELECT o_pk || ', ii', n_pk+1 FROM tabpk"
|
||||
")"
|
||||
""
|
||||
", whereclause(w_c) AS ("
|
||||
" SELECT CASE WHEN prev!='' THEN "
|
||||
" '\nWHERE (' || o_pk ||', n.ii) > ' || prev"
|
||||
" ELSE ''"
|
||||
" END"
|
||||
" FROM tabpk, tabname"
|
||||
")"
|
||||
""
|
||||
", main_select(m, n) AS ("
|
||||
" SELECT format("
|
||||
" '%%s, %%s\nSELECT %%s,\n%%s\nFROM intck_wrapper AS o"
|
||||
", intck_counter AS n%%s\nORDER BY %%s', "
|
||||
" w, ww.s, c, thiskey.k, whereclause.w_c, t.o_pk"
|
||||
" ), thiskey.n"
|
||||
" FROM case_statement, tabpk t, counter_with, "
|
||||
" wrapper_with ww, thiskey, whereclause"
|
||||
")"
|
||||
|
||||
"SELECT m, n FROM main_select",
|
||||
p->zDb, zObj, zPrev, zCommon
|
||||
);
|
||||
}
|
||||
|
||||
while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
zRet = intckMprintf(p, "%s", (const char*)sqlite3_column_text(pStmt, 0));
|
||||
if( pnKeyVal ){
|
||||
*pnKeyVal = sqlite3_column_int(pStmt, 1);
|
||||
}
|
||||
}
|
||||
intckFinalize(p, pStmt);
|
||||
|
||||
if( bAutoIndex ) intckExec(p, "PRAGMA automatic_index = 1");
|
||||
return zRet;
|
||||
}
|
||||
|
||||
/*
|
||||
** Open a new integrity-check object.
|
||||
*/
|
||||
int sqlite3_intck_open(
|
||||
sqlite3 *db, /* Database handle to operate on */
|
||||
const char *zDbArg, /* "main", "temp" etc. */
|
||||
sqlite3_intck **ppOut /* OUT: New integrity-check handle */
|
||||
){
|
||||
sqlite3_intck *pNew = 0;
|
||||
int rc = SQLITE_OK;
|
||||
const char *zDb = zDbArg ? zDbArg : "main";
|
||||
int nDb = strlen(zDb);
|
||||
|
||||
pNew = (sqlite3_intck*)sqlite3_malloc(sizeof(*pNew) + nDb + 1);
|
||||
if( pNew==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
memset(pNew, 0, sizeof(*pNew));
|
||||
pNew->db = db;
|
||||
pNew->zDb = (const char*)&pNew[1];
|
||||
memcpy(&pNew[1], zDb, nDb+1);
|
||||
rc = sqlite3_create_function(db, "parse_create_index",
|
||||
2, SQLITE_UTF8, 0, intckParseCreateIndexFunc, 0, 0
|
||||
);
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_intck_close(pNew);
|
||||
pNew = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*ppOut = pNew;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Free the integrity-check object.
|
||||
*/
|
||||
void sqlite3_intck_close(sqlite3_intck *p){
|
||||
if( p ){
|
||||
sqlite3_finalize(p->pCheck);
|
||||
sqlite3_create_function(
|
||||
p->db, "parse_create_index", 1, SQLITE_UTF8, 0, 0, 0, 0
|
||||
);
|
||||
sqlite3_free(p->zObj);
|
||||
sqlite3_free(p->zKey);
|
||||
sqlite3_free(p->zTestSql);
|
||||
sqlite3_free(p->zErr);
|
||||
sqlite3_free(p->zMessage);
|
||||
sqlite3_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Step the integrity-check object.
|
||||
*/
|
||||
int sqlite3_intck_step(sqlite3_intck *p){
|
||||
if( p->rc==SQLITE_OK ){
|
||||
|
||||
if( p->zMessage ){
|
||||
sqlite3_free(p->zMessage);
|
||||
p->zMessage = 0;
|
||||
}
|
||||
|
||||
if( p->bCorruptSchema ){
|
||||
p->rc = SQLITE_DONE;
|
||||
}else
|
||||
if( p->pCheck==0 ){
|
||||
intckFindObject(p);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( p->zObj ){
|
||||
char *zSql = 0;
|
||||
zSql = intckCheckObjectSql(p, p->zObj, p->zKey, &p->nKeyVal);
|
||||
p->pCheck = intckPrepare(p, zSql);
|
||||
sqlite3_free(zSql);
|
||||
sqlite3_free(p->zKey);
|
||||
p->zKey = 0;
|
||||
}else{
|
||||
p->rc = SQLITE_DONE;
|
||||
}
|
||||
}else if( p->rc==SQLITE_CORRUPT ){
|
||||
p->rc = SQLITE_OK;
|
||||
p->zMessage = intckMprintf(p, "%s",
|
||||
"corruption found while reading database schema"
|
||||
);
|
||||
p->bCorruptSchema = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( p->pCheck ){
|
||||
assert( p->rc==SQLITE_OK );
|
||||
if( sqlite3_step(p->pCheck)==SQLITE_ROW ){
|
||||
/* Normal case, do nothing. */
|
||||
}else{
|
||||
intckFinalize(p, p->pCheck);
|
||||
p->pCheck = 0;
|
||||
p->nKeyVal = 0;
|
||||
if( p->rc==SQLITE_CORRUPT ){
|
||||
p->rc = SQLITE_OK;
|
||||
p->zMessage = intckMprintf(p,
|
||||
"corruption found while scanning database object %s", p->zObj
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return p->rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a message describing the corruption encountered by the most recent
|
||||
** call to sqlite3_intck_step(), or NULL if no corruption was encountered.
|
||||
*/
|
||||
const char *sqlite3_intck_message(sqlite3_intck *p){
|
||||
assert( p->pCheck==0 || p->zMessage==0 );
|
||||
if( p->zMessage ){
|
||||
return p->zMessage;
|
||||
}
|
||||
if( p->pCheck ){
|
||||
return (const char*)sqlite3_column_text(p->pCheck, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the error code and message.
|
||||
*/
|
||||
int sqlite3_intck_error(sqlite3_intck *p, const char **pzErr){
|
||||
if( pzErr ) *pzErr = p->zErr;
|
||||
return (p->rc==SQLITE_DONE ? SQLITE_OK : p->rc);
|
||||
}
|
||||
|
||||
/*
|
||||
** Close any read transaction the integrity-check object is holding open
|
||||
** on the database.
|
||||
*/
|
||||
int sqlite3_intck_unlock(sqlite3_intck *p){
|
||||
if( p->rc==SQLITE_OK && p->pCheck ){
|
||||
assert( p->zKey==0 && p->nKeyVal>0 );
|
||||
intckSaveKey(p);
|
||||
intckFinalize(p, p->pCheck);
|
||||
p->pCheck = 0;
|
||||
}
|
||||
return p->rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the SQL statement used to check object zObj. Or, if zObj is
|
||||
** NULL, the current SQL statement.
|
||||
*/
|
||||
const char *sqlite3_intck_test_sql(sqlite3_intck *p, const char *zObj){
|
||||
sqlite3_free(p->zTestSql);
|
||||
if( zObj ){
|
||||
p->zTestSql = intckCheckObjectSql(p, zObj, 0, 0);
|
||||
}else{
|
||||
if( p->zObj ){
|
||||
p->zTestSql = intckCheckObjectSql(p, p->zObj, p->zKey, 0);
|
||||
}else{
|
||||
sqlite3_free(p->zTestSql);
|
||||
p->zTestSql = 0;
|
||||
}
|
||||
}
|
||||
return p->zTestSql;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
** 2024-02-08
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
** Incremental Integrity-Check Extension
|
||||
** -------------------------------------
|
||||
**
|
||||
** This module contains code to check whether or not an SQLite database
|
||||
** is well-formed or corrupt. This is the same task as performed by SQLite's
|
||||
** built-in "PRAGMA integrity_check" command. This module differs from
|
||||
** "PRAGMA integrity_check" in that:
|
||||
**
|
||||
** + It is less thorough - this module does not detect certain types
|
||||
** of corruption that are detected by the PRAGMA command. However,
|
||||
** it does detect all kinds of corruption that are likely to cause
|
||||
** errors in SQLite applications.
|
||||
**
|
||||
** + It is slower. Sometimes up to three times slower.
|
||||
**
|
||||
** + It allows integrity-check operations to be split into multiple
|
||||
** transactions, so that the database does not need to be read-locked
|
||||
** for the duration of the integrity-check.
|
||||
**
|
||||
** One way to use the API to run integrity-check on the "main" database
|
||||
** of handle db is:
|
||||
**
|
||||
** int rc = SQLITE_OK;
|
||||
** sqlite3_intck *p = 0;
|
||||
**
|
||||
** sqlite3_intck_open(db, "main", &p);
|
||||
** while( SQLITE_OK==sqlite3_intck_step(p) ){
|
||||
** const char *zMsg = sqlite3_intck_message(p);
|
||||
** if( zMsg ) printf("corruption: %s\n", zMsg);
|
||||
** }
|
||||
** rc = sqlite3_intck_error(p, &zErr);
|
||||
** if( rc!=SQLITE_OK ){
|
||||
** printf("error occured (rc=%d), (errmsg=%s)\n", rc, zErr);
|
||||
** }
|
||||
** sqlite3_intck_close(p);
|
||||
**
|
||||
** Usually, the sqlite3_intck object opens a read transaction within the
|
||||
** first call to sqlite3_intck_step() and holds it open until the
|
||||
** integrity-check is complete. However, if sqlite3_intck_unlock() is
|
||||
** called, the read transaction is ended and a new read transaction opened
|
||||
** by the subsequent call to sqlite3_intck_step().
|
||||
*/
|
||||
|
||||
#ifndef _SQLITE_INTCK_H
|
||||
#define _SQLITE_INTCK_H
|
||||
|
||||
#include "sqlite3.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** An ongoing incremental integrity-check operation is represented by an
|
||||
** opaque pointer of the following type.
|
||||
*/
|
||||
typedef struct sqlite3_intck sqlite3_intck;
|
||||
|
||||
/*
|
||||
** Open a new incremental integrity-check object. If successful, populate
|
||||
** output variable (*ppOut) with the new object handle and return SQLITE_OK.
|
||||
** Or, if an error occurs, set (*ppOut) to NULL and return an SQLite error
|
||||
** code (e.g. SQLITE_NOMEM).
|
||||
**
|
||||
** The integrity-check will be conducted on database zDb (which must be "main",
|
||||
** "temp", or the name of an attached database) of database handle db. Once
|
||||
** this function has been called successfully, the caller should not use
|
||||
** database handle db until the integrity-check object has been destroyed
|
||||
** using sqlite3_intck_close().
|
||||
*/
|
||||
int sqlite3_intck_open(
|
||||
sqlite3 *db, /* Database handle */
|
||||
const char *zDb, /* Database name ("main", "temp" etc.) */
|
||||
sqlite3_intck **ppOut /* OUT: New sqlite3_intck handle */
|
||||
);
|
||||
|
||||
/*
|
||||
** Close and release all resources associated with a handle opened by an
|
||||
** earlier call to sqlite3_intck_open(). The results of using an
|
||||
** integrity-check handle after it has been passed to this function are
|
||||
** undefined.
|
||||
*/
|
||||
void sqlite3_intck_close(sqlite3_intck *pCk);
|
||||
|
||||
/*
|
||||
** Do the next step of the integrity-check operation specified by the handle
|
||||
** passed as the only argument. This function returns SQLITE_DONE if the
|
||||
** integrity-check operation is finished, or an SQLite error code if
|
||||
** an error occurs, or SQLITE_OK if no error occurs but the integrity-check
|
||||
** is not finished. It is not considered an error if database corruption
|
||||
** is encountered.
|
||||
**
|
||||
** Following a successful call to sqlite3_intck_step() (one that returns
|
||||
** SQLITE_OK), sqlite3_intck_message() returns a non-NULL value if
|
||||
** corruption was detected in the db.
|
||||
**
|
||||
** If an error occurs and a value other than SQLITE_OK or SQLITE_DONE is
|
||||
** returned, then the integrity-check handle is placed in an error state.
|
||||
** In this state all subsequent calls to sqlite3_intck_step() or
|
||||
** sqlite3_intck_unlock() will immediately return the same error. The
|
||||
** sqlite3_intck_error() method may be used to obtain an English language
|
||||
** error message in this case.
|
||||
*/
|
||||
int sqlite3_intck_step(sqlite3_intck *pCk);
|
||||
|
||||
/*
|
||||
** If the previous call to sqlite3_intck_step() encountered corruption
|
||||
** within the database, then this function returns a pointer to a buffer
|
||||
** containing a nul-terminated string describing the corruption in
|
||||
** English. If the previous call to sqlite3_intck_step() did not encounter
|
||||
** corruption, or if there was no previous call, this function returns
|
||||
** NULL.
|
||||
*/
|
||||
const char *sqlite3_intck_message(sqlite3_intck *pCk);
|
||||
|
||||
/*
|
||||
** Close any read-transaction opened by an earlier call to
|
||||
** sqlite3_intck_step(). Any subsequent call to sqlite3_intck_step() will
|
||||
** open a new transaction. Return SQLITE_OK if successful, or an SQLite error
|
||||
** code otherwise.
|
||||
**
|
||||
** If an error occurs, then the integrity-check handle is placed in an error
|
||||
** state. In this state all subsequent calls to sqlite3_intck_step() or
|
||||
** sqlite3_intck_unlock() will immediately return the same error. The
|
||||
** sqlite3_intck_error() method may be used to obtain an English language
|
||||
** error message in this case.
|
||||
*/
|
||||
int sqlite3_intck_unlock(sqlite3_intck *pCk);
|
||||
|
||||
/*
|
||||
** If an error has occurred in an earlier call to sqlite3_intck_step()
|
||||
** or sqlite3_intck_unlock(), then this method returns the associated
|
||||
** SQLite error code. Additionally, if pzErr is not NULL, then (*pzErr)
|
||||
** may be set to point to a nul-terminated string containing an English
|
||||
** language error message. Or, if no error message is available, to
|
||||
** NULL.
|
||||
**
|
||||
** If no error has occurred within sqlite3_intck_step() or
|
||||
** sqlite_intck_unlock() calls on the handle passed as the first argument,
|
||||
** then SQLITE_OK is returned and (*pzErr) set to NULL.
|
||||
*/
|
||||
int sqlite3_intck_error(sqlite3_intck *pCk, const char **pzErr);
|
||||
|
||||
/*
|
||||
** This API is used for testing only. It returns the full-text of an SQL
|
||||
** statement used to test object zObj, which may be a table or index.
|
||||
** The returned buffer is valid until the next call to either this function
|
||||
** or sqlite3_intck_close() on the same sqlite3_intck handle.
|
||||
*/
|
||||
const char *sqlite3_intck_test_sql(sqlite3_intck *pCk, const char *zObj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of the 'extern "C"' block */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef _SQLITE_INTCK_H */
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
** 2010 August 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.
|
||||
**
|
||||
*************************************************************************
|
||||
** Code for testing all sorts of SQLite interfaces. This code
|
||||
** is not included in the SQLite library.
|
||||
*/
|
||||
|
||||
#include "sqlite3.h"
|
||||
#include "sqlite3intck.h"
|
||||
|
||||
#if defined(INCLUDE_SQLITE_TCL_H)
|
||||
# include "sqlite_tcl.h"
|
||||
#else
|
||||
# include "tcl.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* In test1.c */
|
||||
int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);
|
||||
const char *sqlite3ErrName(int);
|
||||
|
||||
typedef struct TestIntck TestIntck;
|
||||
struct TestIntck {
|
||||
sqlite3_intck *intck;
|
||||
};
|
||||
|
||||
static int testIntckCmd(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
struct Subcmd {
|
||||
const char *zName;
|
||||
int nArg;
|
||||
const char *zExpect;
|
||||
} aCmd[] = {
|
||||
{"close", 0, ""}, /* 0 */
|
||||
{"step", 0, ""}, /* 1 */
|
||||
{"message", 0, ""}, /* 2 */
|
||||
{"error", 0, ""}, /* 3 */
|
||||
{"unlock", 0, ""}, /* 4 */
|
||||
{"test_sql", 1, ""}, /* 5 */
|
||||
{0 , 0}
|
||||
};
|
||||
int rc = TCL_OK;
|
||||
int iIdx = -1;
|
||||
TestIntck *p = (TestIntck*)clientData;
|
||||
|
||||
if( objc<2 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "SUB-COMMAND ...");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
rc = Tcl_GetIndexFromObjStruct(
|
||||
interp, objv[1], aCmd, sizeof(aCmd[0]), "SUB-COMMAND", 0, &iIdx
|
||||
);
|
||||
if( rc ) return rc;
|
||||
|
||||
if( objc!=2+aCmd[iIdx].nArg ){
|
||||
Tcl_WrongNumArgs(interp, 2, objv, aCmd[iIdx].zExpect);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
switch( iIdx ){
|
||||
case 0: assert( 0==strcmp("close", aCmd[iIdx].zName) ); {
|
||||
Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], 0));
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: assert( 0==strcmp("step", aCmd[iIdx].zName) ); {
|
||||
int rc = sqlite3_intck_step(p->intck);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: assert( 0==strcmp("message", aCmd[iIdx].zName) ); {
|
||||
const char *z = sqlite3_intck_message(p->intck);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(z ? z : "", -1));
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: assert( 0==strcmp("error", aCmd[iIdx].zName) ); {
|
||||
const char *zErr = 0;
|
||||
int rc = sqlite3_intck_error(p->intck, 0);
|
||||
Tcl_Obj *pRes = Tcl_NewObj();
|
||||
Tcl_ListObjAppendElement(
|
||||
interp, pRes, Tcl_NewStringObj(sqlite3ErrName(rc), -1)
|
||||
);
|
||||
sqlite3_intck_error(p->intck, &zErr);
|
||||
Tcl_ListObjAppendElement(
|
||||
interp, pRes, Tcl_NewStringObj(zErr ? zErr : 0, -1)
|
||||
);
|
||||
Tcl_SetObjResult(interp, pRes);
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: assert( 0==strcmp("unlock", aCmd[iIdx].zName) ); {
|
||||
int rc = sqlite3_intck_unlock(p->intck);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: assert( 0==strcmp("test_sql", aCmd[iIdx].zName) ); {
|
||||
const char *zObj = Tcl_GetString(objv[2]);
|
||||
const char *zSql = sqlite3_intck_test_sql(p->intck, zObj[0] ? zObj : 0);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(zSql, -1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destructor for commands created by test_sqlite3_intck().
|
||||
*/
|
||||
static void testIntckFree(void *clientData){
|
||||
TestIntck *p = (TestIntck*)clientData;
|
||||
sqlite3_intck_close(p->intck);
|
||||
ckfree(p);
|
||||
}
|
||||
|
||||
/*
|
||||
** tclcmd: sqlite3_intck DB DBNAME
|
||||
*/
|
||||
static int test_sqlite3_intck(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
char zName[64];
|
||||
int iName = 0;
|
||||
Tcl_CmdInfo info;
|
||||
TestIntck *p = 0;
|
||||
sqlite3 *db = 0;
|
||||
const char *zDb = 0;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
if( objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB DBNAME");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
p = (TestIntck*)ckalloc(sizeof(TestIntck));
|
||||
memset(p, 0, sizeof(TestIntck));
|
||||
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zDb = Tcl_GetString(objv[2]);
|
||||
if( zDb[0]=='\0' ) zDb = 0;
|
||||
|
||||
rc = sqlite3_intck_open(db, zDb, &p->intck);
|
||||
if( rc!=SQLITE_OK ){
|
||||
ckfree(p);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errstr(rc), -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
do {
|
||||
sprintf(zName, "intck%d", iName++);
|
||||
}while( Tcl_GetCommandInfo(interp, zName, &info)!=0 );
|
||||
Tcl_CreateObjCommand(interp, zName, testIntckCmd, (void*)p, testIntckFree);
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(zName, -1));
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** tclcmd: test_do_intck DB DBNAME
|
||||
*/
|
||||
static int test_do_intck(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
sqlite3 *db = 0;
|
||||
const char *zDb = 0;
|
||||
int rc = SQLITE_OK;
|
||||
sqlite3_intck *pCk = 0;
|
||||
Tcl_Obj *pRet = 0;
|
||||
const char *zErr = 0;
|
||||
|
||||
if( objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB DBNAME");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zDb = Tcl_GetString(objv[2]);
|
||||
|
||||
pRet = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pRet);
|
||||
|
||||
rc = sqlite3_intck_open(db, zDb, &pCk);
|
||||
if( rc==SQLITE_OK ){
|
||||
while( sqlite3_intck_step(pCk)==SQLITE_OK ){
|
||||
const char *zMsg = sqlite3_intck_message(pCk);
|
||||
if( zMsg ){
|
||||
Tcl_ListObjAppendElement(interp, pRet, Tcl_NewStringObj(zMsg, -1));
|
||||
}
|
||||
}
|
||||
rc = sqlite3_intck_error(pCk, &zErr);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( zErr ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1));
|
||||
}else{
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
}
|
||||
}else{
|
||||
Tcl_SetObjResult(interp, pRet);
|
||||
}
|
||||
Tcl_DecrRefCount(pRet);
|
||||
sqlite3_intck_close(pCk);
|
||||
sqlite3_intck_close(0);
|
||||
return rc ? TCL_ERROR : TCL_OK;
|
||||
}
|
||||
|
||||
int Sqlitetestintck_Init(Tcl_Interp *interp){
|
||||
Tcl_CreateObjCommand(interp, "sqlite3_intck", test_sqlite3_intck, 0, 0);
|
||||
Tcl_CreateObjCommand(interp, "test_do_intck", test_do_intck, 0, 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ static int test_sqlite3_recover_init(
|
||||
zDb = Tcl_GetString(objv[2]);
|
||||
if( zDb[0]=='\0' ) zDb = 0;
|
||||
|
||||
pNew = ckalloc(sizeof(TestRecover));
|
||||
pNew = (TestRecover*)ckalloc(sizeof(TestRecover));
|
||||
if( bSql==0 ){
|
||||
zUri = Tcl_GetString(objv[3]);
|
||||
pNew->p = sqlite3_recover_init(db, zDb, zUri);
|
||||
|
||||
+19
-10
@@ -694,11 +694,9 @@ static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){
|
||||
** Clear the Rtree.pNodeBlob object
|
||||
*/
|
||||
static void nodeBlobReset(Rtree *pRtree){
|
||||
if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
|
||||
sqlite3_blob *pBlob = pRtree->pNodeBlob;
|
||||
pRtree->pNodeBlob = 0;
|
||||
sqlite3_blob_close(pBlob);
|
||||
}
|
||||
sqlite3_blob *pBlob = pRtree->pNodeBlob;
|
||||
pRtree->pNodeBlob = 0;
|
||||
sqlite3_blob_close(pBlob);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -742,7 +740,6 @@ static int nodeAcquire(
|
||||
&pRtree->pNodeBlob);
|
||||
}
|
||||
if( rc ){
|
||||
nodeBlobReset(pRtree);
|
||||
*ppNode = 0;
|
||||
/* If unable to open an sqlite3_blob on the desired row, that can only
|
||||
** be because the shadow tables hold erroneous data. */
|
||||
@@ -802,6 +799,7 @@ static int nodeAcquire(
|
||||
}
|
||||
*ppNode = pNode;
|
||||
}else{
|
||||
nodeBlobReset(pRtree);
|
||||
if( pNode ){
|
||||
pRtree->nNodeRef--;
|
||||
sqlite3_free(pNode);
|
||||
@@ -946,6 +944,7 @@ static void nodeGetCoord(
|
||||
int iCoord, /* Which coordinate to extract */
|
||||
RtreeCoord *pCoord /* OUT: Space to write result to */
|
||||
){
|
||||
assert( iCell<NCELL(pNode) );
|
||||
readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);
|
||||
}
|
||||
|
||||
@@ -1135,7 +1134,9 @@ static int rtreeClose(sqlite3_vtab_cursor *cur){
|
||||
sqlite3_finalize(pCsr->pReadAux);
|
||||
sqlite3_free(pCsr);
|
||||
pRtree->nCursor--;
|
||||
nodeBlobReset(pRtree);
|
||||
if( pRtree->nCursor==0 && pRtree->inWrTrans==0 ){
|
||||
nodeBlobReset(pRtree);
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -1720,7 +1721,11 @@ static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){
|
||||
int rc = SQLITE_OK;
|
||||
RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc);
|
||||
if( rc==SQLITE_OK && ALWAYS(p) ){
|
||||
*pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell);
|
||||
if( p->iCell>=NCELL(pNode) ){
|
||||
rc = SQLITE_ABORT;
|
||||
}else{
|
||||
*pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -1738,6 +1743,7 @@ static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
|
||||
|
||||
if( rc ) return rc;
|
||||
if( NEVER(p==0) ) return SQLITE_OK;
|
||||
if( p->iCell>=NCELL(pNode) ) return SQLITE_ABORT;
|
||||
if( i==0 ){
|
||||
sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell));
|
||||
}else if( i<=pRtree->nDim2 ){
|
||||
@@ -3220,7 +3226,7 @@ constraint:
|
||||
static int rtreeBeginTransaction(sqlite3_vtab *pVtab){
|
||||
Rtree *pRtree = (Rtree *)pVtab;
|
||||
assert( pRtree->inWrTrans==0 );
|
||||
pRtree->inWrTrans++;
|
||||
pRtree->inWrTrans = 1;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -3234,6 +3240,9 @@ static int rtreeEndTransaction(sqlite3_vtab *pVtab){
|
||||
nodeBlobReset(pRtree);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
static int rtreeRollback(sqlite3_vtab *pVtab){
|
||||
return rtreeEndTransaction(pVtab);
|
||||
}
|
||||
|
||||
/*
|
||||
** The xRename method for rtree module virtual tables.
|
||||
@@ -3352,7 +3361,7 @@ static sqlite3_module rtreeModule = {
|
||||
rtreeBeginTransaction, /* xBegin - begin transaction */
|
||||
rtreeEndTransaction, /* xSync - sync transaction */
|
||||
rtreeEndTransaction, /* xCommit - commit transaction */
|
||||
rtreeEndTransaction, /* xRollback - rollback transaction */
|
||||
rtreeRollback, /* xRollback - rollback transaction */
|
||||
0, /* xFindFunction - function overloading */
|
||||
rtreeRename, /* xRename - rename the table */
|
||||
rtreeSavepoint, /* xSavepoint */
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
# 2024-02-03
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# ROLLBACK in the middle of an RTREE query
|
||||
#
|
||||
if {![info exists testdir]} {
|
||||
set testdir [file join [file dirname [info script]] .. .. test]
|
||||
}
|
||||
source $testdir/tester.tcl
|
||||
set testprefix rtreeJ
|
||||
ifcapable !rtree { finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2);
|
||||
INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2);
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
SELECT * FROM t1
|
||||
} {1 1.0 1.0 2 2.0 2.0}
|
||||
|
||||
# If a ROLLBACK occurs that backs out changes to the RTREE, then
|
||||
# all pending queries to the RTREE are aborted.
|
||||
#
|
||||
do_test 1.2 {
|
||||
db eval {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(3, 3, 3);
|
||||
INSERT INTO t1 VALUES(4, 4, 4);
|
||||
}
|
||||
set rc [catch {
|
||||
db eval { SELECT * FROM t1 } {
|
||||
if {$id==1} {
|
||||
db eval { ROLLBACK }
|
||||
}
|
||||
lappend res $id $x1 $x2
|
||||
}
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {1 {query aborted}}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0 2 2.0 2.0}
|
||||
|
||||
# A COMMIT of changes to the RTREE does not affect pending queries
|
||||
#
|
||||
do_test 1.4 {
|
||||
set res {}
|
||||
db eval {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(5, 5, 5);
|
||||
INSERT INTO t1 VALUES(6, 6, 6);
|
||||
}
|
||||
db eval { SELECT * FROM t1 } {
|
||||
if {$id==1} {
|
||||
db eval { COMMIT }
|
||||
}
|
||||
lappend res $id $x1 $x2
|
||||
}
|
||||
set res
|
||||
} {1 1.0 1.0 2 2.0 2.0 5 5.0 5.0 6 6.0 6.0}
|
||||
|
||||
do_execsql_test 1.5 {
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0 2 2.0 2.0 5 5.0 5.0 6 6.0 6.0}
|
||||
|
||||
do_execsql_test 1.6 {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,2),(3,3,3),(4,4,4);
|
||||
CREATE TABLE t2(x);
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0 2 2.0 2.0 3 3.0 3.0 4 4.0 4.0}
|
||||
|
||||
# A rollback that does not affect the rtree table because
|
||||
# the rtree table has not been written to does not cause
|
||||
# a query abort.
|
||||
#
|
||||
do_test 1.7 {
|
||||
set res {}
|
||||
db eval {
|
||||
BEGIN;
|
||||
INSERT INTO t2(x) VALUES(12345);
|
||||
}
|
||||
db eval { SELECT * FROM t1 } {
|
||||
if {$id==1} {
|
||||
db eval { ROLLBACK }
|
||||
}
|
||||
lappend res $id $x1 $x2
|
||||
}
|
||||
set res
|
||||
} {1 1.0 1.0 2 2.0 2.0 3 3.0 3.0 4 4.0 4.0}
|
||||
|
||||
# ROLLBACK TO that affects the RTREE does cause a query abort.
|
||||
#
|
||||
do_test 1.8 {
|
||||
db eval {
|
||||
DELETE FROM t1 WHERE rowid>1;
|
||||
BEGIN;
|
||||
DELETE FROM t2;
|
||||
INSERT INTO t2(x) VALUES(23456);
|
||||
SAVEPOINT 'one';
|
||||
INSERT INTO t1 VALUES(2,2,2),(3,3,3);
|
||||
}
|
||||
set rc [catch {
|
||||
db eval { SELECT * FROM t1 } {
|
||||
if {$id==1} {
|
||||
db eval { ROLLBACK TO 'one'; }
|
||||
}
|
||||
lappend res $id $x1 $x2
|
||||
}
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {1 {query aborted}}
|
||||
|
||||
do_execsql_test 1.9 {
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0}
|
||||
|
||||
# ROLLBACK TO that does not affect the RTREE does not cause a query abort.
|
||||
#
|
||||
do_execsql_test 1.10 {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,2),(3,3,3);
|
||||
BEGIN;
|
||||
DELETE FROM t2;
|
||||
INSERT INTO t2(x) VALUES(34567);
|
||||
SAVEPOINT 'one';
|
||||
INSERT INTO t2(x) VALUES('a string');
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0 2 2.0 2.0 3 3.0 3.0}
|
||||
do_test 1.11 {
|
||||
set rc [catch {
|
||||
set res {}
|
||||
db eval { SELECT * FROM t1 } {
|
||||
if {$id==2} {
|
||||
# db eval { ROLLBACK TO 'one'; }
|
||||
}
|
||||
lappend res $id $x1 $x2
|
||||
}
|
||||
set res
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {0 {1 1.0 1.0 2 2.0 2.0 3 3.0 3.0}}
|
||||
|
||||
do_execsql_test 1.12 {
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
} {1 1.0 1.0 2 2.0 2.0 3 3.0 3.0}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2);
|
||||
INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2);
|
||||
CREATE TABLE t2(x);
|
||||
} {}
|
||||
|
||||
do_test 2.1 {
|
||||
db eval {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(3, 3, 3);
|
||||
PRAGMA writable_schema = RESET;
|
||||
}
|
||||
|
||||
set rc [catch {
|
||||
db eval { SELECT x1, x2 FROM t1 } {
|
||||
if {$x1==1} {
|
||||
db eval { ROLLBACK }
|
||||
}
|
||||
lappend res $x1 $x2
|
||||
}
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {1 {query aborted}}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
CREATE TABLE bak_node(nodeno, data);
|
||||
CREATE TABLE bak_parent(nodeno, parentnode);
|
||||
CREATE TABLE bak_rowid(rowid, nodeno);
|
||||
}
|
||||
proc save_t1 {} {
|
||||
db eval {
|
||||
DELETE FROM bak_node;
|
||||
DELETE FROM bak_parent;
|
||||
DELETE FROM bak_rowid;
|
||||
INSERT INTO bak_node SELECT * FROM t1_node;
|
||||
INSERT INTO bak_parent SELECT * FROM t1_parent;
|
||||
INSERT INTO bak_rowid SELECT * FROM t1_rowid;
|
||||
}
|
||||
}
|
||||
proc restore_t1 {} {
|
||||
db eval {
|
||||
DELETE FROM t1_node;
|
||||
DELETE FROM t1_parent;
|
||||
DELETE FROM t1_rowid;
|
||||
INSERT INTO t1_node SELECT * FROM bak_node;
|
||||
INSERT INTO t1_parent SELECT * FROM bak_parent;
|
||||
INSERT INTO t1_rowid SELECT * FROM bak_rowid;
|
||||
}
|
||||
}
|
||||
|
||||
do_test 2.3 {
|
||||
save_t1
|
||||
db eval {
|
||||
INSERT INTO t1 VALUES(3, 3, 3);
|
||||
}
|
||||
set rc [catch {
|
||||
db eval { SELECT rowid, x1, x2 FROM t1 } {
|
||||
if {$x1==1} {
|
||||
restore_t1
|
||||
}
|
||||
lappend res $x1 $x2
|
||||
}
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {1 {query aborted}}
|
||||
do_execsql_test 2.4 {
|
||||
SELECT * FROM t1
|
||||
} {1 1.0 1.0 2 2.0 2.0}
|
||||
|
||||
do_test 2.5 {
|
||||
save_t1
|
||||
db eval {
|
||||
INSERT INTO t1 VALUES(3, 3, 3);
|
||||
}
|
||||
set rc [catch {
|
||||
db eval { SELECT x1 FROM t1 } {
|
||||
if {$x1==1} {
|
||||
restore_t1
|
||||
}
|
||||
lappend res $x1 $x2
|
||||
}
|
||||
} msg]
|
||||
list $rc $msg
|
||||
} {1 {query aborted}}
|
||||
do_execsql_test 2.6 {
|
||||
SELECT * FROM t1
|
||||
} {1 1.0 1.0 2 2.0 2.0}
|
||||
|
||||
do_test 2.7 {
|
||||
save_t1
|
||||
db eval {
|
||||
INSERT INTO t1 VALUES(3, 3, 3);
|
||||
}
|
||||
set ::res [list]
|
||||
set rc [catch {
|
||||
db eval { SELECT 'abc' FROM t1 } {
|
||||
if {$::res==[list]} {
|
||||
restore_t1
|
||||
set ::bDone 1
|
||||
}
|
||||
lappend res abc
|
||||
}
|
||||
} msg]
|
||||
set res
|
||||
} {abc abc abc}
|
||||
do_execsql_test 2.6 {
|
||||
SELECT * FROM t1
|
||||
} {1 1.0 1.0 2 2.0 2.0}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -92,7 +92,7 @@ do_test 2.1 {
|
||||
} {}
|
||||
|
||||
do_execsql_test -db db2 2.2 {
|
||||
SELECT * FROM sqlite_stat1
|
||||
SELECT * FROM sqlite_stat1 ORDER BY tbl, idx
|
||||
} {
|
||||
t1 sqlite_autoindex_t1_1 {32 1}
|
||||
t1 t1b {32 4}
|
||||
@@ -104,7 +104,7 @@ do_test 2.3 {
|
||||
} {}
|
||||
|
||||
do_execsql_test -db db2 2.4 {
|
||||
SELECT * FROM sqlite_stat1
|
||||
SELECT * FROM sqlite_stat1 ORDER BY tbl, idx;
|
||||
} {
|
||||
t1 sqlite_autoindex_t1_1 {32 1}
|
||||
t1 t1b {32 4}
|
||||
|
||||
@@ -981,6 +981,9 @@ emcc.speedtest1.common += -sABORTING_MALLOC
|
||||
emcc.speedtest1.common += -sSTRICT_JS=0
|
||||
emcc.speedtest1.common += -sMODULARIZE
|
||||
emcc.speedtest1.common += -Wno-limited-postlink-optimizations
|
||||
emcc.speedtest1.common += -Wno-unused-main
|
||||
# ^^^^ -Wno-unused-main is for emcc 3.1.52+. speedtest1 has a wasm_main() which is
|
||||
# exported and called by the JS code.
|
||||
EXPORTED_FUNCTIONS.speedtest1 := $(abspath $(dir.tmp)/EXPORTED_FUNCTIONS.speedtest1)
|
||||
emcc.speedtest1.common += -sSTACK_SIZE=512KB
|
||||
emcc.speedtest1.common += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
|
||||
@@ -174,11 +174,17 @@ const Rx = newObj({
|
||||
squiggly: /[{}]/
|
||||
});
|
||||
|
||||
|
||||
|
||||
const Util = newObj({
|
||||
toss,
|
||||
|
||||
unlink: function(fn){
|
||||
return 0==sqlite3.wasm.sqlite3_wasm_vfs_unlink(0,fn);
|
||||
unlink: function f(fn){
|
||||
if(!f.unlink){
|
||||
f.unlink = sqlite3.wasm.xWrap('sqlite3__wasm_vfs_unlink','int',
|
||||
['*','string']);
|
||||
}
|
||||
return 0==f.unlink(0,fn);
|
||||
},
|
||||
|
||||
argvToString: (list)=>{
|
||||
@@ -197,7 +203,7 @@ const Util = newObj({
|
||||
|
||||
utf8Encode: (str)=>__utf8Encoder.encode(str),
|
||||
|
||||
strglob: sqlite3.wasm.xWrap('sqlite3_wasm_SQLTester_strglob','int',
|
||||
strglob: sqlite3.wasm.xWrap('sqlite3__wasm_SQLTester_strglob','int',
|
||||
['string','string'])
|
||||
})/*Util*/;
|
||||
|
||||
|
||||
@@ -1137,8 +1137,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
existing content. Throws if the pool has no available file slots,
|
||||
on I/O error, or if the input does not appear to be a
|
||||
database. In the latter case, only a cursory examination is made.
|
||||
Note that this routine is _only_ for importing database files,
|
||||
not arbitrary files, the reason being that this VFS will
|
||||
Results are undefined if the given db name refers to an opened
|
||||
db. Note that this routine is _only_ for importing database
|
||||
files, not arbitrary files, the reason being that this VFS will
|
||||
automatically clean up any non-database files so importing them
|
||||
is pointless.
|
||||
|
||||
|
||||
@@ -1193,16 +1193,18 @@ const installOpfsVfs = function callee(options){
|
||||
Asynchronously imports the given bytes (a byte array or
|
||||
ArrayBuffer) into the given database file.
|
||||
|
||||
Results are undefined if the given db name refers to an opened
|
||||
db.
|
||||
|
||||
If passed a function for its second argument, its behaviour
|
||||
changes to async and it imports its data in chunks fed to it by
|
||||
the given callback function. It calls the callback (which may
|
||||
be async) repeatedly, expecting either a Uint8Array or
|
||||
ArrayBuffer (to denote new input) or undefined (to denote
|
||||
EOF). For so long as the callback continues to return
|
||||
non-undefined, it will append incoming data to the given
|
||||
VFS-hosted database file. When called this way, the resolved
|
||||
value of the returned Promise is the number of bytes written to
|
||||
the target file.
|
||||
changes: imports its data in chunks fed to it by the given
|
||||
callback function. It calls the callback (which may be async)
|
||||
repeatedly, expecting either a Uint8Array or ArrayBuffer (to
|
||||
denote new input) or undefined (to denote EOF). For so long as
|
||||
the callback continues to return non-undefined, it will append
|
||||
incoming data to the given VFS-hosted database file. When
|
||||
called this way, the resolved value of the returned Promise is
|
||||
the number of bytes written to the target file.
|
||||
|
||||
It very specifically requires the input to be an SQLite3
|
||||
database and throws if that's not the case. It does so in
|
||||
|
||||
@@ -156,6 +156,7 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
|
||||
if(!config.worker) config.worker = callee.defaultConfig.worker;
|
||||
if('function'===typeof config.worker) config.worker = config.worker();
|
||||
let dbId;
|
||||
let promiserFunc;
|
||||
config.worker.onmessage = function(ev){
|
||||
ev = ev.data;
|
||||
debug('worker1.onmessage',ev);
|
||||
@@ -163,7 +164,7 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
|
||||
if(!msgHandler){
|
||||
if(ev && 'sqlite3-api'===ev.type && 'worker1-ready'===ev.result) {
|
||||
/*fired one time when the Worker1 API initializes*/
|
||||
if(config.onready) config.onready();
|
||||
if(config.onready) config.onready(promiserFunc);
|
||||
return;
|
||||
}
|
||||
msgHandler = handlerMap[ev.type] /* check for exec per-row callback */;
|
||||
@@ -192,7 +193,7 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
|
||||
try {msgHandler.resolve(ev)}
|
||||
catch(e){msgHandler.reject(e)}
|
||||
}/*worker.onmessage()*/;
|
||||
return function(/*(msgType, msgArgs) || (msgEnvelope)*/){
|
||||
return promiserFunc = function(/*(msgType, msgArgs) || (msgEnvelope)*/){
|
||||
let msg;
|
||||
if(1===arguments.length){
|
||||
msg = arguments[0];
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
error("Unhandled worker message:",ev.data);
|
||||
},
|
||||
onready: function(){
|
||||
T.affirm(arguments[0] === workerPromise
|
||||
/* as of version 3.46. Prior to that this callback had no arguments */);
|
||||
self.sqlite3TestModule.setStatus(null)/*hide the HTML-side is-loading spinner*/;
|
||||
runTests();
|
||||
},
|
||||
|
||||
@@ -230,7 +230,6 @@ SRC += \
|
||||
SRC += \
|
||||
$(TOP)/ext/misc/stmt.c
|
||||
|
||||
|
||||
# FTS5 things
|
||||
#
|
||||
FTS5_HDR = \
|
||||
@@ -375,7 +374,9 @@ TESTSRC += \
|
||||
$(TOP)/ext/rtree/test_rtreedoc.c \
|
||||
$(TOP)/ext/recover/sqlite3recover.c \
|
||||
$(TOP)/ext/recover/dbdata.c \
|
||||
$(TOP)/ext/recover/test_recover.c
|
||||
$(TOP)/ext/recover/test_recover.c \
|
||||
$(TOP)/ext/intck/test_intck.c \
|
||||
$(TOP)/ext/intck/sqlite3intck.c
|
||||
|
||||
|
||||
#TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
|
||||
@@ -659,7 +660,7 @@ target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c
|
||||
touch target_source
|
||||
|
||||
sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl src-verify
|
||||
tclsh $(TOP)/tool/mksqlite3c.tcl
|
||||
tclsh $(TOP)/tool/mksqlite3c.tcl $(EXTRA_SRC)
|
||||
cp tsrc/sqlite3ext.h .
|
||||
cp $(TOP)/ext/session/sqlite3session.h .
|
||||
echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
|
||||
@@ -671,7 +672,7 @@ sqlite3ext.h: target_source
|
||||
cp tsrc/sqlite3ext.h .
|
||||
|
||||
sqlite3.c-debug: target_source $(TOP)/tool/mksqlite3c.tcl src-verify
|
||||
tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros=1
|
||||
tclsh $(TOP)/tool/mksqlite3c.tcl --linemacros=1 $(EXTRA_SRC)
|
||||
echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c
|
||||
cat sqlite3.c >>tclsqlite3.c
|
||||
echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
C Fix\stypo\sin\sthe\stag-20240123-a\sin\sa\scomment.
|
||||
D 2024-01-23T13:28:21.325
|
||||
C Bring\sthe\sextra-src\sbranch\sup\sto\sdate\swith\sthe\strunk.
|
||||
D 2024-02-27T00:58:51.735
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
F Makefile.in 24be65ae641c5727bbc247d60286a15ecc24fb80f14f8fb2d32533bf0ec96e79
|
||||
F Makefile.in 3c4f4879b2301e5486939f68cc64f84430861d246ac11430ff1a1d7347ed5b8c
|
||||
F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6
|
||||
F Makefile.msc df56c06ef05add5ebcdcc9d4823fb2ec66ac16b06acb6971a7420859025886fa
|
||||
F Makefile.msc 108f24dc3b1801795de7550870c47e6aeb205707dc298660fd46091c8ff06eb0
|
||||
F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3
|
||||
F VERSION c84541c6a9e8426462176fbb1f9ecb5cfd7d1bb56228053ff7eeba8841673eb6
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
|
||||
F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d87031
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
@@ -40,7 +42,7 @@ F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
|
||||
F doc/compile-for-windows.md 50b27d77be96195c66031a3181cb8684ed822327ea834e07f9c014213e5e3bcf
|
||||
F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f
|
||||
F doc/jsonb.md 5fab4b8613aa9153fbeb6259297bd4697988af8b3d23900deba588fa7841456b
|
||||
F doc/lemon.html 44a53a1d2b42d7751f7b2f478efb23c978e258d794bfd172442307a755b9fa44
|
||||
F doc/lemon.html 8b266ff711d2ec7f867c3dca37634963f48a630329908cc282beebfa8c708706
|
||||
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
|
||||
F doc/testrunner.md 8d36ec692cf4994bb66d84a4645b9afa1ce9d47dc12cbf8d437c5a5fb6ddeedb
|
||||
F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d358c3e8a
|
||||
@@ -51,7 +53,7 @@ F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
|
||||
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
|
||||
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
|
||||
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
|
||||
F ext/consio/console_io.c e1be639e79e54264b3ae97ca291728987a9aa82e6a4526458e6400f5e083e524 x
|
||||
F ext/consio/console_io.c f32b757c9ee7fdf68e7586bee306f8368759e7cd12febb2a6839199b1c1af395 x
|
||||
F ext/consio/console_io.h 0548b83d7c4b7270ad544a67f2bb90cebc519637fa39b1838df4744cf0d87646
|
||||
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
||||
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
|
||||
@@ -63,7 +65,7 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c
|
||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||
F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d
|
||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||
F ext/fts3/fts3.c fd64a588471ce00b19da08acb0d6f904277a21ac1d15141d5913c83591afa027
|
||||
F ext/fts3/fts3.c c922380b62bd15bce953dae3350337acbd0fff07c10cdc805819409791eb480a
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h 968f7d7cae541a6926146e9fd3fb2b2ccbd3845b7890a8ed03de0c06ac776682
|
||||
F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3
|
||||
@@ -81,7 +83,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 c2d7a8dfb6e7a00c6c88ce626785cf4c50ed18eba34b5fbd53cacd60af96d0f2
|
||||
F ext/fts3/fts3_write.c 81cd8f7e8003e427a1801e04842776b731af26dd93af206e4e66ea5ae319cad1
|
||||
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
||||
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
|
||||
F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674
|
||||
@@ -97,10 +99,10 @@ F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70
|
||||
F ext/fts5/fts5_config.c 8072a207034b51ae9b7694121d1b5715c794e94b275e088f70ae532378ca5cdf
|
||||
F ext/fts5/fts5_expr.c e91156ebdcc08d837f4f324168f69f3c0d7fdef0e521fd561efb48ef3297b696
|
||||
F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1
|
||||
F ext/fts5/fts5_index.c bb1965c3965f6fe5f64160bf1c0694a9684a790a783f293a76da1d38d319b258
|
||||
F ext/fts5/fts5_main.c cd56ed9619e9bc55ae603ecafd5965c3684bb4c1de7dd00893c307ddf98afe88
|
||||
F ext/fts5/fts5_index.c ee0f4d50bc0c58a7c5ef7d645e7e38e1e59315b8ea9d722ae00c5f949ee65379
|
||||
F ext/fts5/fts5_main.c d68bd9533d5a638b7f6fae61c3cb0a15257dcdcccedaf3d0b3c9f55940c85048
|
||||
F ext/fts5/fts5_storage.c f9e31b0d155e9b2c92d5d3a09ad7a56b937fbf1c7f962e10f4ca6281349f3934
|
||||
F ext/fts5/fts5_tcl.c cf0fd0dbe64ec272491b749e0d594f563cda03336aeb60900129e6d18b0aefb8
|
||||
F ext/fts5/fts5_tcl.c fdf7e2bb9a9186cfcaf2d2ce11d338309342b7a7593c2812bc54455db53da5d2
|
||||
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
|
||||
F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b
|
||||
F ext/fts5/fts5_tokenize.c 83cfcede3898001cab84432a36ce1503e3080cf9b1c682b022ec82e267ea4c13
|
||||
@@ -163,7 +165,7 @@ F ext/fts5/test/fts5fault4.test 87a10d0caee57da587c7588b0c8d25d2930197399b4812ad
|
||||
F ext/fts5/test/fts5fault5.test a336e4e11847de24c9497f80cce18e00bb3fab7fb11f97d04eb9af898900a762
|
||||
F ext/fts5/test/fts5fault6.test a0fc0a8f99e4b16500c31dfc7e38e1defe0f1693ac47650517ac7b723b1956f8
|
||||
F ext/fts5/test/fts5fault7.test 0acbec416edb24b8881f154e99c31e9ccf73f539cfcd164090be139e9e97ed4c
|
||||
F ext/fts5/test/fts5fault8.test 318238659d35f82ad215ecb57ca4c87486ea85d45dbeedaee42f148ff5105ee2
|
||||
F ext/fts5/test/fts5fault8.test 9353fe6a2a993c3231e09c49b0f4a12c8d306319555ff2ca6672b5b86fe9b0dd
|
||||
F ext/fts5/test/fts5fault9.test 098e6b894bbdf9b2192f994a30f4043673fb3f338b6b8ab1624c704422f39119
|
||||
F ext/fts5/test/fts5faultA.test be4487576bff8c22cee6597d1893b312f306504a8c6ccd3c53ca85af12290c8c
|
||||
F ext/fts5/test/fts5faultB.test d606bdb8e81aaeb6f41de3fc9fc7ae315733f0903fbff05cf54f5b045b729ab5
|
||||
@@ -171,7 +173,7 @@ F ext/fts5/test/fts5faultD.test e7ed7895abfe6bc98a5e853826f6b74956e7ba7f594f1860
|
||||
F ext/fts5/test/fts5faultE.test 844586ce71dab4be85bb86880e87b624d089f851654cd22e4710c77eb8ce7075
|
||||
F ext/fts5/test/fts5faultF.test 4abef99f86e99d9f0c6460dd68c586a766b6b9f1f660ada55bf2e8266bd1bbc1
|
||||
F ext/fts5/test/fts5faultG.test d2e5a4d9a34e08dcaadcaeafef74d10cbc2abdd11aa2659a18af0294bf2812d3
|
||||
F ext/fts5/test/fts5faultH.test 57f53c87ffd59be0265840f2b54a16811f9cb9012db86aad9b41d0d14d85dfe3
|
||||
F ext/fts5/test/fts5faultH.test b5c3b62642b7d321504a0a4f424eb80b4f6927969173334c8ca20df388557622
|
||||
F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079
|
||||
F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717
|
||||
F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e
|
||||
@@ -248,6 +250,15 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
|
||||
F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9
|
||||
F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
|
||||
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
|
||||
F ext/intck/intck1.test 8a879640c90fdff5e91e6c2c41d509485ee634e8077fe0ca9f76be4cbd441fa3
|
||||
F ext/intck/intck2.test 47afb44681d13d11072cd8906e6aa877c967e65be788b01f6139922fd91474ef
|
||||
F ext/intck/intck_common.tcl 9e51458126576783f11051ac0fd25bea3f6b17f570a55884223737f3200b214b
|
||||
F ext/intck/intckbusy.test 0732fe3efbb9e0a53ffdcc240073f6ff2777ea82c3e08812b16494f650763fe1
|
||||
F ext/intck/intckcorrupt.test 3211ef68ac53e83951b6c8f6a8d2396506d123fe5898f97f848a25837744ec56
|
||||
F ext/intck/intckfault.test ba0213c9c8dce08d519d5251268a3bab076a184b4d07acdea23b65e89c9ae03c
|
||||
F ext/intck/sqlite3intck.c 52381a627637504a49e93400814b36e99afa0b972a9a24ef1732b8268bb27fa8
|
||||
F ext/intck/sqlite3intck.h 2b40c38e7063ab822c974c0bd4aed97dabb579ccfe2e180a4639bb3bbef0f1c9
|
||||
F ext/intck/test_intck.c d63f1707432802f5db125ee40b794923af77d4686869bd8d3a7eb43332344267
|
||||
F ext/jni/GNUmakefile 59eb05f2a363bdfac8d15d66bed624bfe1ff289229184f3861b95f98a19cf4b2
|
||||
F ext/jni/README.md d899789a9082a07b99bf30b1bbb6204ae57c060efcaa634536fa669323918f42
|
||||
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
|
||||
@@ -257,53 +268,53 @@ F ext/jni/src/org/sqlite/jni/annotation/Experimental.java 8603498634e41d0f7c70f6
|
||||
F ext/jni/src/org/sqlite/jni/annotation/NotNull.java 38e7e58a69b26dc100e458b31dfa3b2a7d67bc36d051325526ef1987d5bc8a24
|
||||
F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 56e3dee1f3f703a545dfdeddc1c3d64d1581172b1ad01ffcae95c18547fafd90
|
||||
F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca
|
||||
F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c
|
||||
F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63418129656daa9a9f30e7e7be982bd5ab394b1dbd0
|
||||
F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a
|
||||
F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759
|
||||
F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca
|
||||
F ext/jni/src/org/sqlite/jni/capi/CApi.java 27bbd944ea8c147afd25b93f17dc397f3627611ebe2878944a32ffeffc98e99e
|
||||
F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab
|
||||
F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 482f53dfec9e3ac2a9070d3fceebd56250932aaaf7c4f5bc8de29fc011416e0c
|
||||
F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c w ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63418129656daa9a9f30e7e7be982bd5ab394b1dbd0 w ext/jni/src/org/sqlite/jni/AggregateFunction.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a w ext/jni/src/org/sqlite/jni/AuthorizerCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 w ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca w ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/CApi.java 27bbd944ea8c147afd25b93f17dc397f3627611ebe2878944a32ffeffc98e99e w ext/jni/src/org/sqlite/jni/SQLite3Jni.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b w ext/jni/src/org/sqlite/jni/SQLite3CallbackProxy.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a w ext/jni/src/org/sqlite/jni/CollationCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab w ext/jni/src/org/sqlite/jni/CollationNeededCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 482f53dfec9e3ac2a9070d3fceebd56250932aaaf7c4f5bc8de29fc011416e0c w ext/jni/src/org/sqlite/jni/CommitHookCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4
|
||||
F ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java e5723900b6458bc6288f52187090a78ebe0a20f403ac7c887ec9061dfe51aba7
|
||||
F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61
|
||||
F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 246b0e66c4603f41c567105a21189d138aaf8c58203ecd4928802333da553e7c
|
||||
F ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java e5723900b6458bc6288f52187090a78ebe0a20f403ac7c887ec9061dfe51aba7 w ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 w ext/jni/src/org/sqlite/jni/NativePointerHolder.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 246b0e66c4603f41c567105a21189d138aaf8c58203ecd4928802333da553e7c w ext/jni/src/org/sqlite/jni/OutputPointer.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java 97352091abd7556167f4799076396279a51749fdae2b72a6ba61cd39b3df0359
|
||||
F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java efcf57545c5e282d1dd332fa63329b3b218d98f356ef107a9dbe3979be82213a
|
||||
F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b
|
||||
F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f
|
||||
F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java e172210a2080e851ebb694c70e9f0bf89284237795e38710a7f5f1b61e3f6787
|
||||
F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385155fa3b8011a5cca0bb3c28468c7131c1a5
|
||||
F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1
|
||||
F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615
|
||||
F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java efcf57545c5e282d1dd332fa63329b3b218d98f356ef107a9dbe3979be82213a w ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b w ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f w ext/jni/src/org/sqlite/jni/ResultCode.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java e172210a2080e851ebb694c70e9f0bf89284237795e38710a7f5f1b61e3f6787 w ext/jni/src/org/sqlite/jni/RollbackHookCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385155fa3b8011a5cca0bb3c28468c7131c1a5 w ext/jni/src/org/sqlite/jni/SQLFunction.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 w ext/jni/src/org/sqlite/jni/tester/SQLTester.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 w ext/jni/src/org/sqlite/jni/ScalarFunction.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f
|
||||
F ext/jni/src/org/sqlite/jni/capi/Tester1.java e5fa17301b7266c1cbe4bcce67788e08e45871c7c72c153d515abb37e501de0a
|
||||
F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723
|
||||
F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56
|
||||
F ext/jni/src/org/sqlite/jni/capi/Tester1.java e5fa17301b7266c1cbe4bcce67788e08e45871c7c72c153d515abb37e501de0a w ext/jni/src/org/sqlite/jni/Tester1.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 w ext/jni/src/org/sqlite/jni/TraceV2Callback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56 w ext/jni/src/org/sqlite/jni/UpdateHookCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 2ce069f3e007fdbbe1f4e507a5a407fc9679da31a0aa40985e6317ed4d5ec7b5
|
||||
F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e
|
||||
F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d
|
||||
F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3.java c6a5c555d163d76663534f2b2cce7cab15325b9852d0f58c6688a85e73ae52f0
|
||||
F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e w ext/jni/src/org/sqlite/jni/WindowFunction.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d w ext/jni/src/org/sqlite/jni/XDestroyCallback.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e w ext/jni/src/org/sqlite/jni/package-info.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3.java c6a5c555d163d76663534f2b2cce7cab15325b9852d0f58c6688a85e73ae52f0 w ext/jni/src/org/sqlite/jni/sqlite3.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java 59e26ca5254cd4771f467237bcfe2d8deed30a77152fabcd4574fd406c301d63
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java 293b5fa7d5b5724c87de544654aca1103d76f3092bc2c8f4360102a65ba25dff
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 338637e6e5a2cc385d962b220f3c1f475cc371d12ae43d18ef27327b6e6225f7
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java 7da0fbb5728f7c056a43e6407f13dd0c7c9c445221267786a109b987f5fc8a9d
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 28045042d593a1f1b9b80d54ec77cbf1d8a1bc95e442eceefa9a3a6f56600b0e
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java 3c8f677ffb85b8782f865d6fcbc16200b3375d0e3c29ed541a494fde3011bf49
|
||||
F ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java 51e16bf9050af7cb246d17d6a19c001cfc916bf20f425c96625aaccaf74688e8
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22 w ext/jni/src/org/sqlite/jni/sqlite3_context.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java 293b5fa7d5b5724c87de544654aca1103d76f3092bc2c8f4360102a65ba25dff w ext/jni/src/org/sqlite/jni/sqlite3_stmt.java
|
||||
F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049 w ext/jni/src/org/sqlite/jni/sqlite3_value.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41 w ext/jni/src/org/sqlite/jni/Fts5.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 338637e6e5a2cc385d962b220f3c1f475cc371d12ae43d18ef27327b6e6225f7 w ext/jni/src/org/sqlite/jni/Fts5Context.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java 7da0fbb5728f7c056a43e6407f13dd0c7c9c445221267786a109b987f5fc8a9d w ext/jni/src/org/sqlite/jni/Fts5ExtensionApi.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 28045042d593a1f1b9b80d54ec77cbf1d8a1bc95e442eceefa9a3a6f56600b0e w ext/jni/src/org/sqlite/jni/Fts5PhraseIter.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java 3c8f677ffb85b8782f865d6fcbc16200b3375d0e3c29ed541a494fde3011bf49 w ext/jni/src/org/sqlite/jni/Fts5Tokenizer.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java 51e16bf9050af7cb246d17d6a19c001cfc916bf20f425c96625aaccaf74688e8 w ext/jni/src/org/sqlite/jni/TesterFts5.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/XTokenizeCallback.java 1efd1220ea328a32f2d2a1b16c735864159e929480f71daad4de9d5944839167
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653fead88f8f4953376178d9c7385b197ea
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90
|
||||
F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653fead88f8f4953376178d9c7385b197ea w ext/jni/src/org/sqlite/jni/fts5_api.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 w ext/jni/src/org/sqlite/jni/fts5_extension_function.java
|
||||
F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 w ext/jni/src/org/sqlite/jni/fts5_tokenizer.java
|
||||
F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e w ext/jni/src/org/sqlite/jni/tester/test-script-interpreter.md
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03
|
||||
F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 27b141f5914c7cb0e40e90a301d5e05b77f3bd42236834a68031b7086381fafd
|
||||
@@ -483,7 +494,7 @@ F ext/recover/recoverslowidx.test 5205a9742dd9490ee99950dabb622307355ef1662dea6a
|
||||
F ext/recover/recoversql.test e66d01f95302a223bcd3fd42b5ee58dc2b53d70afa90b0d00e41e4b8eab20486
|
||||
F ext/recover/sqlite3recover.c e6eb20c469bcdb96f297f2241860bccabf9f036bfa7f3d47bcc6ca1191b108dc
|
||||
F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0e24ff9c74820959
|
||||
F ext/recover/test_recover.c 1a34e2d04533d919a30ae4d5caeb1643f6684e9ccd7597ca27721d8af81f4ade
|
||||
F ext/recover/test_recover.c fd871a40f2238022bedcbdf3cb493b91225edaa94d6ae8892af97a10e7ccc4ba
|
||||
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
|
||||
F ext/repair/checkfreelist.c e21f06995ff4efdc1622dcceaea4dcba2caa83ca2f31a1607b98a8509168a996
|
||||
F ext/repair/checkindex.c af5c66463f51462d8a6f796b2c44ef8cfa1116bbdc35a15da07c67a705388bfd
|
||||
@@ -495,7 +506,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350
|
||||
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca
|
||||
F ext/rtree/rtree.c d0134bb75bc92b18a1dc011ec10419642f055c67af8ff44fc4a07c5fa9f189cb
|
||||
F ext/rtree/rtree.c 1baf9f6aa7251ddecdb019d914df4db46eb227720c00f89c485c66dbfdc7863d
|
||||
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
|
||||
F ext/rtree/rtree1.test 2b5b8c719c6a4abe377f57766f428a49af36a93061cb146cccfdc3b30000c0a4
|
||||
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
|
||||
@@ -515,6 +526,7 @@ F ext/rtree/rtreeF.test 81ffa7ef51c4e4618d497a57328c265bf576990c7070633b623b23cd
|
||||
F ext/rtree/rtreeG.test 1b9ca6e3effb48f4161edaa463ddeaa8fca4b2526d084f9cbf5dbe4e0184939c
|
||||
F ext/rtree/rtreeH.test 0885151ee8429242625600ae47142cca935332c70a06737f35af53a7bd7aaf90
|
||||
F ext/rtree/rtreeI.test 608e77f7fde9be5a12eae316baef640fffaafcfa90a3d67443e78123e19c4ca4
|
||||
F ext/rtree/rtreeJ.test 93227ccd4d6c328f5ac46a902b8880041509dd2d68f6ce71560f0d8ab5bb507a
|
||||
F ext/rtree/rtree_perf.tcl 6c18c1f23cd48e0f948930c98dfdd37dfccb5195
|
||||
F ext/rtree/rtree_util.tcl 202ca70df1f0645ef9d5a2170e62d378a28098d9407f0569e85c9c1cf1bd020a
|
||||
F ext/rtree/rtreecheck.test 934546ad9b563e090ee0c5cbdc69ad014189ad76e5df7320526797a9a345661f
|
||||
@@ -566,7 +578,7 @@ F ext/session/sessionnoop2.test de4672dce88464396ec9f30ed08c6c01643a69c53ae540fa
|
||||
F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2
|
||||
F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a80600a44396f7363
|
||||
F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795
|
||||
F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c
|
||||
F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec
|
||||
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
|
||||
F ext/session/sqlite3session.c 829d468f0f3d2710aace56b0116a7ca3f414683ce78e3125ae5e21547a895078
|
||||
F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e
|
||||
@@ -575,11 +587,11 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
|
||||
F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
|
||||
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
||||
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
||||
F ext/wasm/GNUmakefile 867c903a27fa0d53a3bf1b01d8c7bb713456f87e0939c3cac9f07faa68f58734
|
||||
F ext/wasm/GNUmakefile 316349101671037a30311fbb40bd0b8702d9a223b5205a6a5eae8bac7b8dc1a0
|
||||
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
|
||||
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
|
||||
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
|
||||
F ext/wasm/SQLTester/SQLTester.mjs ec2f6ba63a0f2f0562941a0fb8e46b7dc55589711513f1952349785966edfe50
|
||||
F ext/wasm/SQLTester/SQLTester.mjs ce765c0ad7d57f93553d12ef4dca574deb00300134a26d472daacab49031e1fb
|
||||
F ext/wasm/SQLTester/SQLTester.run.mjs c72b7fe2072d05992f7a3d8c6a1d34e95712513ceabe40849784e24e41c84638
|
||||
F ext/wasm/SQLTester/index.html 3f8a016df0776be76605abf20e815ecaafbe055abac0e1fe5ea080e7846b760d
|
||||
F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
|
||||
@@ -599,12 +611,12 @@ F ext/wasm/api/sqlite3-api-prologue.js fffcee629bf020a8ccf5c367fbe6a169f5d5d73df
|
||||
F ext/wasm/api/sqlite3-api-worker1.js 8d9c0562831f62218170a3373468d8a0b7a6503b5985e309b69bf71187b525cf
|
||||
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
|
||||
F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379
|
||||
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
|
||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 595953994aa3ae2287c889c4da39ab3d6f17b6461ecf4bec334b7a3faafddb02
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js ebf6c7e997cd8948b35b3afc550b0503dd53febd9d2b56354efd11d985e5f0f2
|
||||
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d w ext/wasm/api/sqlite3-v-helper.js
|
||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 5a430874906ff3f4a6ca69aadf0c2aaedc1bb45489b8365bff7e955a83a8d42a
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js fe427645e1499618f5fa7bc670af850577d8bcc132df982078690c9bf8400baa
|
||||
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js a2fcbc3fecdd0eea229283584ebc122f29d98194083675dbe5cb2cf3a17fe309
|
||||
F ext/wasm/api/sqlite3-wasm.c d33a16495ca871781e78812d3a18fed78b797468fffee657b8d7199b277ff359
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f234191fe6bf41a5a1e59c9f43ed816e74a522b3d60d3f556f66c3085c448503
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js e8135b44a568badfe197e2379f6b42899f2240b5c3a77fa044331110f7ce8e50
|
||||
F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5
|
||||
F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7
|
||||
F ext/wasm/batch-runner-sahpool.js 54a3ac228e6c4703fe72fb65c897e19156263a51fe9b7e21d2834a45e876aabd
|
||||
@@ -621,7 +633,7 @@ F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32
|
||||
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 5e5c7d7c91cd7aae9cc733afd02569ba9c6928292db413b550e8b842f4b75e87
|
||||
F ext/wasm/demo-worker1-promiser.js 786ae8a3214c2a29f6fb2c80eb4f90cc401fcc5b524d95c35fdc66a454e32bad
|
||||
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
|
||||
F ext/wasm/demo-worker1.js 836bece8615b17b1b572584f7b15912236a5947fe8c68b98d2737d7e287447ef
|
||||
F ext/wasm/dist.make 3a851858aad72e246a5d9c5aaf6b6a144305f1bf898ac1846760ea7bab95c9a3
|
||||
@@ -658,7 +670,7 @@ F ext/wasm/wasmfs.make 8a4955882aaa0783b3f60a9484a1f0f3d8b6f775c0fcd17c082f31966
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
|
||||
F main.mk ef8d6b0e76b27d2b32d7b71ea30a2b2626b668f998a4f32f6171c9623a310a53
|
||||
F main.mk 2c8b556ba7a4a15f5440663f7b05da221355d1921d5c75298bb50e2bb8081d79
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
|
||||
@@ -671,16 +683,16 @@ F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2
|
||||
F src/alter.c 30c2333b8bb3af71e4eb9adeadee8aa20edb15917ed44b8422e5cd15f3dfcddc
|
||||
F src/analyze.c 0f15753308c3bca7674f31fa7e0807ffcb8b120c36eef7d00b62b33079ddc854
|
||||
F src/analyze.c dacc8f062bbda02c8ed3bbca0ab6122de010d094101d568df266a7b0d665d74f
|
||||
F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39
|
||||
F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4
|
||||
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
|
||||
F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645
|
||||
F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
|
||||
F src/btree.c dee25e097b749275333b55d64a5ffc079249576f8e88a2ee476468cf67510f4b
|
||||
F src/btree.c 5e86e2b4c4ddb094c4a5e782b79d5fde5d52a7b516182494787e4edd01e86435
|
||||
F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240
|
||||
F src/btreeInt.h 3e2589726c4f105e653461814f65857465da68be1fac688de340c43b873f4062
|
||||
F src/build.c 05c9eb387638982092988d2ef4c00a91b0c29baa1b85923f082ce0cf2903ea7e
|
||||
F src/build.c 04f1bcee189f045ab086d84fee95db42cb49df82ff8e84af8136309ff3c8a75f
|
||||
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b
|
||||
@@ -691,18 +703,18 @@ F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500
|
||||
F src/expr.c 3381ee4c9aa7ccde22a2a7f35ce343925a7a25d96bdc943649131f9decdebad2
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00
|
||||
F src/func.c c71b81223e165722cd81fa71fb869a235de5998c4c5142a5dfa2725d6331f539
|
||||
F src/func.c 4204c56196847faefef57fa14e43b8e4d65eb8d7e65318abe463472e3fd148cb
|
||||
F src/global.c 765a0656d6cbf043cb272ff0ae38f39cc46713539ffe6793258ed3eb4b188b52
|
||||
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
|
||||
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
||||
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
||||
F src/json.c b2189995bb2f5eeac20a0282983cc82198fc77f9429708468ba360bbacb6fa80
|
||||
F src/json.c 3b4e2778d95d923d6d77e8a5efd51a6265017b466782d597303f5f094fcd68af
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
|
||||
F src/main.c 438b95162acfa17b7d218f586f5bde11d6ae82bcf030c9611fc537556870ad6b
|
||||
F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc
|
||||
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
|
||||
F src/mem2.c c8bfc9446fd0798bddd495eb5d9dbafa7d4b7287d8c22d50a83ac9daa26d8a75
|
||||
@@ -722,28 +734,28 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
|
||||
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
|
||||
F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a
|
||||
F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
|
||||
F src/os_unix.c 5dc41030cd5dfd99b907976b1725a4ed695566405d33744e4824c3d6aff245a3
|
||||
F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8
|
||||
F src/os_unix.c 8d7533b3b4d0d2d6ddd34d1ebc92f50a91f04e722a3a9295a000bc3c25128e2f
|
||||
F src/os_win.c 6ff43bac175bd9ed79e7c0f96840b139f2f51d01689a638fd05128becf94908a
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c ff60e98138d2499082ac6230f01ac508aba545315debccfca2fd6042f5f10fcd
|
||||
F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a
|
||||
F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec
|
||||
F src/parse.y bfd6da46fc895cd8237400ff485d04ab0b32e47eb56de20982bb7f53e56c1f42
|
||||
F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75
|
||||
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
|
||||
F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00
|
||||
F src/pragma.c b5b4cff830575e6188cd56a295a57448d2b9dbc53f0dae58e22b97354cda3781
|
||||
F src/pragma.c 65ec09bbe7322ebbe2ca3a77405ae8df3c85d2c58c122f544a173813940ce3fc
|
||||
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
|
||||
F src/prepare.c 371f6115cb69286ebc12c6f2d7511279c2e47d9f54f475d46a554d687a3b312c
|
||||
F src/printf.c 18fbdf028345c8fbe6044f5f5bfda5a10d48d6287afef088cc21b0ca57985640
|
||||
F src/printf.c 10e8bad30042f8bd6114a013b4afc229ec8ad255ab27518d7d9f52e8cbc5cd0a
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c e25f51a473a5f30a0d978e4df2aaa98aeec84eac29ecae1ad4708a6c3e669345
|
||||
F src/resolve.c d77c6160bc8f249c2196fdd3e75f66a1dd70e37aa25c39aedc7b1f93c42b7c6d
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c f1a81ff4f8e9e76c224e2ab3a4baa799add0db22158c7fcede65d8cc4a6fa2da
|
||||
F src/shell.c.in 5ea8c6b0057bfe3bcdff31949fe72aa231ae429047c421ea1b168af6825a4890
|
||||
F src/sqlite.h.in 61a60b4ea04db8ead15e1579b20b64cb56e9f55d52c5f9f9694de630110593a3
|
||||
F src/select.c 43fabfc01bf87addd15e39f112f1e2ade15b19594835ab8a9e5bd50839d4e1b1
|
||||
F src/shell.c.in 0c13f7cc3bb8c31190efbd96f5c1d8f2fafdbcad549424b7e7850cb5617b115a
|
||||
F src/sqlite.h.in 19a2db3995a699bd7f6dfb423856242bfceb7ec849a93c91d241d19fc28d9f0f
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||
F src/sqliteInt.h 03e64e4a973f56035772421e94be7bf092ceceeb3dc91a74a2147030a822c392
|
||||
F src/sqliteInt.h 2f3a38c3e0470b6152ec14f698e6f3310831e3c09b6e56f046a12c3e3bdd5cd4
|
||||
F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728
|
||||
F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@@ -789,7 +801,7 @@ F src/test_schema.c cbfd7a9a9b6b40d4377d0c76a6c5b2a58387385977f26edab4e77eb5f90a
|
||||
F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
|
||||
F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
|
||||
F src/test_syscall.c 9fdb13b1df05e639808d44fcb8f6064aaded32b6565c00b215cfd05a060d1aca
|
||||
F src/test_tclsh.c 3ff5d188a72f00807425954ea3b493dfd3a4b890ecc6700ea83bad2fd1332ecf
|
||||
F src/test_tclsh.c aaf0d1de4a518a8db5ad38e5262be3e48b4a74ad1909f2dba753cecb30979d5d
|
||||
F src/test_tclvar.c 3273f9d59395b336e381b53cfc68ec6ebdaada4e93106a2e976ffb0550504e1c
|
||||
F src/test_thread.c 7ddcf0c8b79fa3c1d172f82f322302c963d923cdb503c6171f3c8081586d0b01
|
||||
F src/test_vdbecov.c f60c6f135ec42c0de013a1d5136777aa328a776d33277f92abac648930453d43
|
||||
@@ -806,24 +818,24 @@ F src/trigger.c 0905b96b04bb6658509f711a8207287f1315cdbc3df1a1b13ba6483c8e341c81
|
||||
F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92
|
||||
F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242
|
||||
F src/utf.c f23165685a67b4caf8ec08fb274cb3f319103decfb2a980b7cfd55d18dfa855e
|
||||
F src/util.c 078f040366d5bd5f47658d045f901c768c1c636c6eaea121f3a1cbd63c3edb5b
|
||||
F src/util.c 3ed7ded64ecc8670acdcbb72e8df9b0a58845cb0c36639573eb0d5155121901a
|
||||
F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104
|
||||
F src/vdbe.c 92910d536e0b77505599cd6ae5d9d449e4a5d31ada61da4c0bb84f6ccb2c3189
|
||||
F src/vdbe.c 805af8bec9cae76a873b0ec4c91c3d1bd49b38e86c1c533ed87ec7a07a5042a5
|
||||
F src/vdbe.h 88e19a982df9027ec1c177c793d1a5d34dc23d8f06e3b2d997f43688b05ee0eb
|
||||
F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c
|
||||
F src/vdbeapi.c 8f57d60c89da0b60e6d4e272358c511f6bae4e24330bdb11f8b42f986d1bf21b
|
||||
F src/vdbeaux.c c5a471b34e9c4cfc0295a3e10734fd197670ffaebcb742f284c8e17e8026ceea
|
||||
F src/vdbeaux.c 66161ba75c4a2d86aab124fe3cbcc2a752d8e4b1fc8c1fc6e00625db4798168c
|
||||
F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5
|
||||
F src/vdbemem.c 3e37dab421b74e9ce55c1e88fbc7bc6fead590b5ab258bc684f8b70abb1d6e71
|
||||
F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547
|
||||
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
|
||||
F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7
|
||||
F src/vtab.c 11948e105f56e84099ca17f1f434b1944539ea84de26d0d767eadfbc670ce1ea
|
||||
F src/vtab.c 38fcf63832f7e606755fa47b028c2eb6d6cd5facb40e280d66fbda4ed9a52188
|
||||
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89
|
||||
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
|
||||
F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
|
||||
F src/where.c 217fe82a26c0fb6a3c7fd01865d821e752f9c01fb72f114af3f0b77ce234d1fb
|
||||
F src/where.c 33eaaeef3aef10c2b9e82096e70a174d6636e35cb0b180321b8ddf804590e5cd
|
||||
F src/whereInt.h 82a13766f13d1a53b05387c2e60726289ef26404bc7b9b1f7770204d97357fb8
|
||||
F src/wherecode.c 5d77db30a2a3dd532492ae882de114edba2fae672622056b1c7fd61f5917a8f1
|
||||
F src/whereexpr.c dc5096eca5ed503999be3bdee8a90c51361289a678d396a220912e9cb73b3c00
|
||||
@@ -946,7 +958,7 @@ F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
|
||||
F test/btree01.test fef17d9e999ac4f04095948e3438fbe674f4e07bb2c63bb1cad41d87baee077f
|
||||
F test/btree02.test 7555a5440453d900410160a52554fe6478af4faf53098f7235f1f443d5a1d6cc
|
||||
F test/btreefault.test a82a23b0578bc587afbf9a622c8f54a54f63762f062ba8a35613cfee38ab42f9
|
||||
F test/busy.test 510dc6daaad18bcbbc085bcc6217d6dc418def5e73f72ce1475eea0cb7834727
|
||||
F test/busy.test caff7164c16ce06a53af51f9e4c2753d4cc64250e00790a5e48b9c4f4be37597
|
||||
F test/busy2.test 20823a5d7c42fb257d9f108c66312d90b1bb4ec3d80ba6b4e371073727560f98
|
||||
F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
|
||||
F test/cacheflush.test af25bb1509df04c1da10e38d8f322d66eceedf61
|
||||
@@ -1056,7 +1068,7 @@ F test/descidx3.test 953c831df7ea219c73826dfbf2f6ee02d95040725aa88ccb4fa43d1a199
|
||||
F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e
|
||||
F test/distinct.test 691c9e850b0d0b56b66e7e235453198cb4cf0760e324b7403d3c5abbeab0a014
|
||||
F test/distinct2.test bb71cc7b5e58e895787f9910a788c254f679928d324732d063fe9bc202ecbe71
|
||||
F test/distinctagg.test ad2b4cf1483cd4cf24867dfafbfa0abb61184d92085fcc9784cea0592b278d64
|
||||
F test/distinctagg.test 40d7169ae5846caaf62c6e307d2ca3c333daf9b6f7cde888956a339a97afe85f
|
||||
F test/e_blobbytes.test 4c01dfe4f12087b92b20705a3fdfded45dc4ed16d5a211fed4e1d2786ba68a52
|
||||
F test/e_blobclose.test 692fc02a058476c2222a63d97e3f3b2b809c1842e5525ded7f854d540ac2e075
|
||||
F test/e_blobopen.test 29f6055ee453b8e679fe9570c4d3acfedbef821622c5dad16875148c5952ef50
|
||||
@@ -1168,7 +1180,7 @@ F test/fts3expr5.test a5b9a053becbdb8e973fbf4d6d3abaabeb42d511d1848bd57931f3e0a1
|
||||
F test/fts3f.test 8c438d5e1cab526b0021988fb1dc70cf3597b006a33ffd6c955ee89929077fe3
|
||||
F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45c5df45
|
||||
F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec
|
||||
F test/fts3fault3.test 4a39a1618546776255dc1de306213b600aef87eca589ca8428a70c00fd11961b
|
||||
F test/fts3fault3.test ccdd2292dd2d4e21e30fc5f4c8e064f79e516087eec5ff57ab6bc4f6a7714097
|
||||
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
|
||||
F test/fts3fuzz001.test c78afcd8ad712ea0b8d2ed50851a8aab3bc9dc52c64a536291e07112f519357c
|
||||
F test/fts3integrity.test 0c6fe7353d7b24d78862f4272ee9df4da2f32b3ff30fa3396945cda8119580a8
|
||||
@@ -1216,7 +1228,7 @@ F test/fts4umlaut.test fcaca4471de7e78c9d1f7e8976e3e8704d7d8ad979d57a739d00f3f75
|
||||
F test/fts4unicode.test 82a9c16b68ba2f358a856226bb2ee02f81583797bc4744061c54401bf1a0f4c9
|
||||
F test/fts4upfrom.test f25835162c989dffd5e2ef91ec24c4848cc9973093e2d492d1c7b32afac1b49d
|
||||
F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
|
||||
F test/func.test da1332f6ab70338b83f5e2d594e72c7aa438c9b68406915e5a54618d601c09ee
|
||||
F test/func.test 504d202650c7940b5aa98364dd68f242df87f39f829e51074a55d79fc7bc7414
|
||||
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
|
||||
F test/func3.test 600a632c305a88f3946d38f9a51efe145c989b2e13bd2b2a488db47fe76bab6a
|
||||
F test/func4.test e8ef9b2bd6a192a213cbd5cf31a3b35e25cd6ff2fdaeea0b58d63be31b03d220
|
||||
@@ -1336,16 +1348,16 @@ F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd286
|
||||
F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307
|
||||
F test/json/json-speed-check.sh 912ee03e700a65c827ee0c7b4752c21ec5ef69cf7679d2f482ca817042bead52 x
|
||||
F test/json/jsonb-q1.txt 1e180fe6491efab307e318b22879e3a736ac9a96539bbde7911a13ee5b33abc7
|
||||
F test/json101.test 70587d7d35ef9e2126364ba70f0c951f70827cfbd28649d779ff3df7e8f87547
|
||||
F test/json101.test 30db5b055b103ccabc53a29cfe6cda3345d07e171aeb25403dafa04f19e98b19
|
||||
F test/json102.test 557a46e16df1aa9bdbc4076a71a45814ea0e7503d6621d87d42a8c04cbc2b0ef
|
||||
F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
|
||||
F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1
|
||||
F test/json105.test 043838b56e68f3252a0dcf5be1689016f6f3f05056f8dcfcdc9d074f4d932988
|
||||
F test/json106.test 1d46a9294e2ced35c7f87cebbcb9626d01abab04f1969d7ded7b6f6a1d9be0f2
|
||||
F test/json107.test 59054e815c8f6b67d634d44ace421cf975828fb5651c4460aa66015c8e19d562
|
||||
F test/json501.test ab168a12eb6eb14d479f8c1cdae3ac062fd5a4679f17f976e96f1af518408330
|
||||
F test/json501.test b95e2d14988b682a5cadf079dd6162f0f85fb74cd59c6b1f1624110104a974eb
|
||||
F test/json502.test 84634d3dbb521d2814e43624025b760c6198456c8197bbec6c977c0236648f5b
|
||||
F test/jsonb01.test cace70765b36a36aec9a85a41ea65667d3bbf647d4400ddc3ac76f8fe7d94f90
|
||||
F test/jsonb01.test f4cdfb4cf5a0c940091b17675ed9583f45add0c938f07d65b0de0e19d3a9a101
|
||||
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
|
||||
F test/kvtest.c 6e0228409ea7ca0497dad503fbd109badb5e59545d131014b6aaac68b56f484a
|
||||
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
|
||||
@@ -1397,7 +1409,7 @@ F test/malloctraceviewer.tcl 3e3ddf11e30d2b20f53aa16aa6615082fb24a100bea61cca721
|
||||
F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e
|
||||
F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f
|
||||
F test/memdb.test c1f2a343ad14398d5d6debda6ea33e80d0dafcc7
|
||||
F test/memdb1.test cd6b6b1632cf2f76c8a6f35be013f4011f3ab2c8d74d3d1424576f29bfa4a9a1
|
||||
F test/memdb1.test 2fb27d5dadd4e7784d2229e570f6368b059fc0b7fe88ca25e46e17150ba8ad4c
|
||||
F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4
|
||||
F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c
|
||||
F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e
|
||||
@@ -1413,16 +1425,17 @@ F test/misc1.test 8d138a4926ab90617c1aa29ce26e7785ae2b83a4d3a195d543b7374e05589d
|
||||
F test/misc2.test 71e746af479119386ac2ed7ab7d81d99970e75b49ffd3e8efffee100b4b5f350
|
||||
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
||||
F test/misc4.test 10cd6addb2fa9093df4751a1b92b50440175dd5468a6ec84d0386e78f087db0e
|
||||
F test/misc5.test c4aeaa0fa28faa08f2485309c38db4719e6cd1364215d5687a5b96d340a3fa58
|
||||
F test/misc5.test 027cf0ac10314ea534173f335a33bb4059907ddabbac2c16786766d6f26c8923
|
||||
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||
F test/misc7.test d912f3d45c2989191b797504a220ca225d6be80b21acad22ba0d35f4a9ee4579
|
||||
F test/misc8.test 4db9f8be59834cea08c87e9658014080efa02678ef54a088f84fa5647e81fee0
|
||||
F test/misuse.test 9e7f78402005e833af71dcab32d048003869eca5abcaccc985d4f8dc1d86bcc7
|
||||
F test/mjournal.test 28a08d5cb5fb5b5702a46e19176e45e964e0800d1f894677169e79f34030e152
|
||||
F test/mmap1.test 5c1f768828094b0dd94e55ae7f10489a1ded74772682be2c4c78679d0acaf7ef
|
||||
F test/mmap1.test 18de3fd7b70a777af6004ca2feecfcdd3d0be17fa04058e808baf530c94b1a1d
|
||||
F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022
|
||||
F test/mmap3.test b3c297e78e6a8520aafcc1a8f140535594c9086e
|
||||
F test/mmap4.test 2e2b4e32555b58da15176e6fe750f17c9dcf7f93
|
||||
F test/mmapcorrupt.test 0d89724591f22a376019f3df60d075b838dd2ba6dae6effb0be465c49cf86d4a
|
||||
F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3
|
||||
F test/mmapwarm.test 2272005969cd17a910077bd5082f70bc1fefad9a875afec7fc9af483898ecaf3
|
||||
F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4dac1f08
|
||||
@@ -1478,16 +1491,16 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/pendingrace.test 6aa33756b950c4529f79c4f3817a9a1e4025bd0d9961571a05c0279bd183d9c6
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test f7caf8dd5c7b1da74842a48df116f7f193399c656d4ffc805cd0d9658568c675
|
||||
F test/permutations.test 405542f1d659942994a6b38a9e024cf5cfd23eaa68c806aeb24a72d7c9186e80
|
||||
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
|
||||
F test/pragma.test 57a36226218c03cfb381019fe43234b2cefbd8a1f12825514f906a17ccf7991e
|
||||
F test/pragma.test cddd4b534d7fb5cf113d1308dea4231f3548e8a7f3a65d7d1cf4810c87090b5a
|
||||
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 512152dca7f2f578f045a5a732e7bee08e4f47a8a212f83ce46791b518eba70f
|
||||
F test/printf.test 685fec5a0c5af2490ab0632775a301554361d674211d690f5bee0a97b05333de
|
||||
F test/printf2.test 3f55c1871a5a65507416076f6eb97e738d5210aeda7595a74ee895f2224cce60
|
||||
F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb
|
||||
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
||||
@@ -1498,7 +1511,7 @@ F test/quickcheck.test a4b7e878cd97e46108291c409b0bf8214f29e18fddd68a42bc5c1375a
|
||||
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
|
||||
F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a
|
||||
F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8
|
||||
F test/quote.test ffb40f0eb7a25c1d8cfe11ee2fe67f8e85fbf3fed348810834114be1fdada142
|
||||
F test/quote.test 7b01b2a261bc26d9821aea9f4941ce1e08191d62fc55ba8862440fb3a59197a4
|
||||
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
||||
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
||||
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
|
||||
@@ -1631,7 +1644,7 @@ F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
|
||||
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
|
||||
F test/spellfix4.test 51c7c26514ade169855c66bcf130bd5acfb4d7fd090cc624645ab275ae6a41fb
|
||||
F test/sqldiff1.test 1b7ab4f312442c5cc6b3a5f299fa8ca051416d1dd173cb1126fd51bf64f2c3fb
|
||||
F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996fd413ac4
|
||||
F test/sqllimits1.test 5880a2f107185744ba4d93637f44c78d17706a9899a38b694d50f209735c81cc
|
||||
F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a
|
||||
F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805
|
||||
F test/stat.test 123212a20ceb496893d5254a5f6c76442ce549fdc08d1702d8288a2bbaac8408
|
||||
@@ -2071,8 +2084,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
|
||||
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
||||
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
|
||||
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
|
||||
F tool/lemon.c 19e368bc8e97ff4071115119a7911ca3b0c56eba7926d8ada8b4a86fcc69a176
|
||||
F tool/lempar.c 57478ea48420da05faa873c6d1616321caa5464644588c97fbe8e0ea04450748
|
||||
F tool/lemon.c 7f264d5d06450f929a20fa63a1b7e8f2df47dfaa6d7f80e4afef3639157497a4
|
||||
F tool/lempar.c e6b649778e5c027c8365ff01d7ef39297cd7285fa1f881cce31792689541e79f
|
||||
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
|
||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||
F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669
|
||||
@@ -2091,7 +2104,7 @@ F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971
|
||||
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
|
||||
F tool/mksqlite3c.tcl 2c760ab786cb509b47f00c96fea82994866cb99f5e046df81c768288f57897b4
|
||||
F tool/mksqlite3c.tcl c6acfdf4e4ef93478ff3ce3cd593e17abb03f446036ce710c3156bcfa18665e0
|
||||
F tool/mksqlite3h.tcl d391cff7cad0a372ee1406faee9ccc7dad9cb80a0c95cae0f73d10dd26e06762
|
||||
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
||||
F tool/mktoolzip.tcl c7a9b685f5131d755e7d941cec50cee7f34178b9e34c9a89811eeb08617f8423
|
||||
@@ -2160,8 +2173,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d79a37690ce7ebb91df203170d73511da44546328043c2b3fe1786b2f0087093
|
||||
R daf98ef3cd5515173b41dfefd789b29a
|
||||
U drh
|
||||
Z 73f4e47cde19088f6970a061f009bfef
|
||||
P 44f3d7d054055fab4cca0ba753e75e237ca159ae868ffd1d13ed45a874a772f2 85dd79a6edecfc8c6307c6d215998f76dab086aa14528ddc64eb9955501becfd
|
||||
R 80d4ad79d9a78fa9f0de62d1574b5434
|
||||
U stephan
|
||||
Z 135136d2573db3fdaa7f02d94a8dab93
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1f09541eb4203ccce476f6040ff134353850f22f07fb84f96a1d2c27b304a91b
|
||||
12ff5c5c4162951a29b638a5bc6cffa50e057c5a5e8f5e9c627af5f4ab1e4cdb
|
||||
+43
-31
@@ -872,7 +872,7 @@ static void statGet(
|
||||
if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1;
|
||||
sqlite3_str_appendf(&sStat, " %llu", iVal);
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
assert( p->current.anEq[i] );
|
||||
assert( p->current.anEq[i] || p->nRow==0 );
|
||||
#endif
|
||||
}
|
||||
sqlite3ResultStrAccum(context, &sStat);
|
||||
@@ -1057,7 +1057,7 @@ static void analyzeOneTable(
|
||||
|
||||
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
||||
int nCol; /* Number of columns in pIdx. "N" */
|
||||
int addrRewind; /* Address of "OP_Rewind iIdxCur" */
|
||||
int addrGotoEnd; /* Address of "OP_Rewind iIdxCur" */
|
||||
int addrNextRow; /* Address of "next_row:" */
|
||||
const char *zIdxName; /* Name of the index */
|
||||
int nColTest; /* Number of columns to test for changes */
|
||||
@@ -1081,9 +1081,14 @@ static void analyzeOneTable(
|
||||
/*
|
||||
** Pseudo-code for loop that calls stat_push():
|
||||
**
|
||||
** Rewind csr
|
||||
** if eof(csr) goto end_of_scan;
|
||||
** regChng = 0
|
||||
** Rewind csr
|
||||
** if eof(csr){
|
||||
** stat_init() with count = 0;
|
||||
** goto end_of_scan;
|
||||
** }
|
||||
** count()
|
||||
** stat_init()
|
||||
** goto chng_addr_0;
|
||||
**
|
||||
** next_row:
|
||||
@@ -1122,41 +1127,36 @@ static void analyzeOneTable(
|
||||
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
|
||||
VdbeComment((v, "%s", pIdx->zName));
|
||||
|
||||
/* Invoke the stat_init() function. The arguments are:
|
||||
**
|
||||
/* Implementation of the following:
|
||||
**
|
||||
** regChng = 0
|
||||
** Rewind csr
|
||||
** if eof(csr){
|
||||
** stat_init() with count = 0;
|
||||
** goto end_of_scan;
|
||||
** }
|
||||
** count()
|
||||
** stat_init()
|
||||
** goto chng_addr_0;
|
||||
*/
|
||||
assert( regTemp2==regStat+4 );
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2);
|
||||
|
||||
/* Arguments to stat_init():
|
||||
** (1) the number of columns in the index including the rowid
|
||||
** (or for a WITHOUT ROWID table, the number of PK columns),
|
||||
** (2) the number of columns in the key without the rowid/pk
|
||||
** (3) estimated number of rows in the index,
|
||||
*/
|
||||
** (3) estimated number of rows in the index. */
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat+1);
|
||||
assert( regRowid==regStat+2 );
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regRowid);
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
if( OptimizationEnabled(db, SQLITE_Stat4) ){
|
||||
sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regTemp);
|
||||
addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
|
||||
VdbeCoverage(v);
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, 1);
|
||||
}
|
||||
assert( regTemp2==regStat+4 );
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2);
|
||||
sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp,
|
||||
OptimizationDisabled(db, SQLITE_Stat4));
|
||||
sqlite3VdbeAddFunctionCall(pParse, 0, regStat+1, regStat, 4,
|
||||
&statInitFuncdef, 0);
|
||||
addrGotoEnd = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
|
||||
VdbeCoverage(v);
|
||||
|
||||
/* Implementation of the following:
|
||||
**
|
||||
** Rewind csr
|
||||
** if eof(csr) goto end_of_scan;
|
||||
** regChng = 0
|
||||
** goto next_push_0;
|
||||
**
|
||||
*/
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng);
|
||||
addrNextRow = sqlite3VdbeCurrentAddr(v);
|
||||
|
||||
@@ -1263,6 +1263,12 @@ static void analyzeOneTable(
|
||||
}
|
||||
|
||||
/* Add the entry to the stat1 table. */
|
||||
if( pIdx->pPartIdxWhere ){
|
||||
/* Partial indexes might get a zero-entry in sqlite_stat1. But
|
||||
** an empty table is omitted from sqlite_stat1. */
|
||||
sqlite3VdbeJumpHere(v, addrGotoEnd);
|
||||
addrGotoEnd = 0;
|
||||
}
|
||||
callStatGet(pParse, regStat, STAT_GET_STAT1, regStat1);
|
||||
assert( "BBB"[0]==SQLITE_AFF_TEXT );
|
||||
sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0);
|
||||
@@ -1286,6 +1292,12 @@ static void analyzeOneTable(
|
||||
int addrIsNull;
|
||||
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
|
||||
|
||||
/* No STAT4 data is generated if the number of rows is zero */
|
||||
if( addrGotoEnd==0 ){
|
||||
sqlite3VdbeAddOp2(v, OP_Cast, regStat1, SQLITE_AFF_INTEGER);
|
||||
addrGotoEnd = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1);
|
||||
}
|
||||
|
||||
if( doOnce ){
|
||||
int mxCol = nCol;
|
||||
Index *pX;
|
||||
@@ -1338,7 +1350,7 @@ static void analyzeOneTable(
|
||||
#endif /* SQLITE_ENABLE_STAT4 */
|
||||
|
||||
/* End of analysis */
|
||||
sqlite3VdbeJumpHere(v, addrRewind);
|
||||
if( addrGotoEnd ) sqlite3VdbeJumpHere(v, addrGotoEnd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+93
-33
@@ -151,8 +151,47 @@ int corruptPageError(int lineno, MemPage *p){
|
||||
# define SQLITE_CORRUPT_PAGE(pMemPage) SQLITE_CORRUPT_PGNO(pMemPage->pgno)
|
||||
#endif
|
||||
|
||||
/* Default value for SHARED_LOCK_TRACE macro if shared-cache is disabled
|
||||
** or if the lock tracking is disabled. This is always the value for
|
||||
** release builds.
|
||||
*/
|
||||
#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) /*no-op*/
|
||||
|
||||
#ifndef SQLITE_OMIT_SHARED_CACHE
|
||||
|
||||
#if 0
|
||||
/* ^---- Change to 1 and recompile to enable shared-lock tracing
|
||||
** for debugging purposes.
|
||||
**
|
||||
** Print all shared-cache locks on a BtShared. Debugging use only.
|
||||
*/
|
||||
static void sharedLockTrace(
|
||||
BtShared *pBt,
|
||||
const char *zMsg,
|
||||
int iRoot,
|
||||
int eLockType
|
||||
){
|
||||
BtLock *pLock;
|
||||
if( iRoot>0 ){
|
||||
printf("%s-%p %u%s:", zMsg, pBt, iRoot, eLockType==READ_LOCK?"R":"W");
|
||||
}else{
|
||||
printf("%s-%p:", zMsg, pBt);
|
||||
}
|
||||
for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
|
||||
printf(" %p/%u%s", pLock->pBtree, pLock->iTable,
|
||||
pLock->eLock==READ_LOCK ? "R" : "W");
|
||||
while( pLock->pNext && pLock->pBtree==pLock->pNext->pBtree ){
|
||||
pLock = pLock->pNext;
|
||||
printf(",%u%s", pLock->iTable, pLock->eLock==READ_LOCK ? "R" : "W");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
#undef SHARED_LOCK_TRACE
|
||||
#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) sharedLockTrace(X,MSG,TAB,TYPE)
|
||||
#endif /* Shared-lock tracing */
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/*
|
||||
**** This function is only used as part of an assert() statement. ***
|
||||
@@ -229,6 +268,8 @@ static int hasSharedCacheTableLock(
|
||||
iTab = iRoot;
|
||||
}
|
||||
|
||||
SHARED_LOCK_TRACE(pBtree->pBt,"hasLock",iRoot,eLockType);
|
||||
|
||||
/* Search for the required lock. Either a write-lock on root-page iTab, a
|
||||
** write-lock on the schema table, or (if the client is reading) a
|
||||
** read-lock on iTab will suffice. Return 1 if any of these are found. */
|
||||
@@ -362,6 +403,8 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
|
||||
BtLock *pLock = 0;
|
||||
BtLock *pIter;
|
||||
|
||||
SHARED_LOCK_TRACE(pBt,"setLock", iTable, eLock);
|
||||
|
||||
assert( sqlite3BtreeHoldsMutex(p) );
|
||||
assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
|
||||
assert( p->db!=0 );
|
||||
@@ -429,6 +472,8 @@ static void clearAllSharedCacheTableLocks(Btree *p){
|
||||
assert( p->sharable || 0==*ppIter );
|
||||
assert( p->inTrans>0 );
|
||||
|
||||
SHARED_LOCK_TRACE(pBt, "clearAllLocks", 0, 0);
|
||||
|
||||
while( *ppIter ){
|
||||
BtLock *pLock = *ppIter;
|
||||
assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
|
||||
@@ -467,6 +512,9 @@ static void clearAllSharedCacheTableLocks(Btree *p){
|
||||
*/
|
||||
static void downgradeAllSharedCacheTableLocks(Btree *p){
|
||||
BtShared *pBt = p->pBt;
|
||||
|
||||
SHARED_LOCK_TRACE(pBt, "downgradeLocks", 0, 0);
|
||||
|
||||
if( pBt->pWriter==p ){
|
||||
BtLock *pLock;
|
||||
pBt->pWriter = 0;
|
||||
@@ -5080,9 +5128,12 @@ static int accessPayload(
|
||||
if( pCur->aOverflow==0
|
||||
|| nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow)
|
||||
){
|
||||
Pgno *aNew = (Pgno*)sqlite3Realloc(
|
||||
pCur->aOverflow, nOvfl*2*sizeof(Pgno)
|
||||
);
|
||||
Pgno *aNew;
|
||||
if( sqlite3FaultSim(413) ){
|
||||
aNew = 0;
|
||||
}else{
|
||||
aNew = (Pgno*)sqlite3Realloc(pCur->aOverflow, nOvfl*2*sizeof(Pgno));
|
||||
}
|
||||
if( aNew==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
}else{
|
||||
@@ -6131,10 +6182,10 @@ i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
|
||||
assert( cursorOwnsBtShared(pCur) );
|
||||
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
|
||||
|
||||
/* Currently this interface is only called by the OP_IfSmaller
|
||||
** opcode, and it that case the cursor will always be valid and
|
||||
** will always point to a leaf node. */
|
||||
if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
|
||||
/* Currently this interface is only called by the OP_IfSizeBetween
|
||||
** opcode and the OP_Count opcode with P3=1. In either case,
|
||||
** the cursor will always be valid unless the btree is empty. */
|
||||
if( pCur->eState!=CURSOR_VALID ) return 0;
|
||||
if( NEVER(pCur->pPage->leaf==0) ) return -1;
|
||||
|
||||
n = pCur->pPage->nCell;
|
||||
@@ -6280,7 +6331,10 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
|
||||
}
|
||||
|
||||
pPage = pCur->pPage;
|
||||
assert( pPage->isInit );
|
||||
if( sqlite3FaultSim(412) ) pPage->isInit = 0;
|
||||
if( !pPage->isInit ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
if( !pPage->leaf ){
|
||||
int idx = pCur->ix;
|
||||
rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
|
||||
@@ -6953,7 +7007,10 @@ static int fillInCell(
|
||||
n = nHeader + nPayload;
|
||||
testcase( n==3 );
|
||||
testcase( n==4 );
|
||||
if( n<4 ) n = 4;
|
||||
if( n<4 ){
|
||||
n = 4;
|
||||
pPayload[nPayload] = 0;
|
||||
}
|
||||
*pnSize = n;
|
||||
assert( nSrc<=nPayload );
|
||||
testcase( nSrc<nPayload );
|
||||
@@ -8259,7 +8316,7 @@ static int balance_nonroot(
|
||||
** table-interior, index-leaf, or index-interior).
|
||||
*/
|
||||
if( pOld->aData[0]!=apOld[0]->aData[0] ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pOld);
|
||||
goto balance_cleanup;
|
||||
}
|
||||
|
||||
@@ -8283,7 +8340,7 @@ static int balance_nonroot(
|
||||
memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));
|
||||
if( pOld->nOverflow>0 ){
|
||||
if( NEVER(limit<pOld->aiOvfl[0]) ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pOld);
|
||||
goto balance_cleanup;
|
||||
}
|
||||
limit = pOld->aiOvfl[0];
|
||||
@@ -8926,7 +8983,7 @@ static int anotherValidCursor(BtCursor *pCur){
|
||||
&& pOther->eState==CURSOR_VALID
|
||||
&& pOther->pPage==pCur->pPage
|
||||
){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pCur->pPage);
|
||||
}
|
||||
}
|
||||
return SQLITE_OK;
|
||||
@@ -8986,7 +9043,7 @@ static int balance(BtCursor *pCur){
|
||||
/* The page being written is not a root page, and there is currently
|
||||
** more than one reference to it. This only happens if the page is one
|
||||
** of its own ancestor pages. Corruption. */
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pPage);
|
||||
}else{
|
||||
MemPage * const pParent = pCur->apPage[iPage-1];
|
||||
int const iIdx = pCur->aiIdx[iPage-1];
|
||||
@@ -9150,7 +9207,7 @@ static SQLITE_NOINLINE int btreeOverwriteOverflowCell(
|
||||
rc = btreeGetPage(pBt, ovflPgno, &pPage, 0);
|
||||
if( rc ) return rc;
|
||||
if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pPage);
|
||||
}else{
|
||||
if( iOffset+ovflPageSize<(u32)nTotal ){
|
||||
ovflPgno = get4byte(pPage->aData);
|
||||
@@ -9178,7 +9235,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
|
||||
if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd
|
||||
|| pCur->info.pPayload < pPage->aData + pPage->cellOffset
|
||||
){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
if( pCur->info.nLocal==nTotal ){
|
||||
/* The entire cell is local */
|
||||
@@ -9259,7 +9316,7 @@ int sqlite3BtreeInsert(
|
||||
** Which can only happen if the SQLITE_NoSchemaError flag was set when
|
||||
** the schema was loaded. This cannot be asserted though, as a user might
|
||||
** set the flag, load the schema, and then unset the flag. */
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9382,7 +9439,7 @@ int sqlite3BtreeInsert(
|
||||
if( pPage->nFree<0 ){
|
||||
if( NEVER(pCur->eState>CURSOR_INVALID) ){
|
||||
/* ^^^^^--- due to the moveToRoot() call above */
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pPage);
|
||||
}else{
|
||||
rc = btreeComputeFreeSpace(pPage);
|
||||
}
|
||||
@@ -9399,7 +9456,10 @@ int sqlite3BtreeInsert(
|
||||
if( flags & BTREE_PREFORMAT ){
|
||||
rc = SQLITE_OK;
|
||||
szNew = p->pBt->nPreformatSize;
|
||||
if( szNew<4 ) szNew = 4;
|
||||
if( szNew<4 ){
|
||||
szNew = 4;
|
||||
newCell[3] = 0;
|
||||
}
|
||||
if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){
|
||||
CellInfo info;
|
||||
pPage->xParseCell(pPage, newCell, &info);
|
||||
@@ -9421,7 +9481,7 @@ int sqlite3BtreeInsert(
|
||||
CellInfo info;
|
||||
assert( idx>=0 );
|
||||
if( idx>=pPage->nCell ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
rc = sqlite3PagerWrite(pPage->pDbPage);
|
||||
if( rc ){
|
||||
@@ -9448,10 +9508,10 @@ int sqlite3BtreeInsert(
|
||||
** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */
|
||||
assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
|
||||
if( oldCell < pPage->aData+pPage->hdrOffset+10 ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
if( oldCell+szNew > pPage->aDataEnd ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
memcpy(oldCell, newCell, szNew);
|
||||
return SQLITE_OK;
|
||||
@@ -9553,7 +9613,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
|
||||
nIn = pSrc->info.nLocal;
|
||||
aIn = pSrc->info.pPayload;
|
||||
if( aIn+nIn>pSrc->pPage->aDataEnd ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pSrc->pPage);
|
||||
}
|
||||
nRem = pSrc->info.nPayload;
|
||||
if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
|
||||
@@ -9578,7 +9638,7 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
|
||||
|
||||
if( nRem>nIn ){
|
||||
if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pSrc->pPage);
|
||||
}
|
||||
ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
|
||||
}
|
||||
@@ -9674,7 +9734,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
|
||||
assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID );
|
||||
if( rc || pCur->eState!=CURSOR_VALID ) return rc;
|
||||
}else{
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
|
||||
}
|
||||
}
|
||||
assert( pCur->eState==CURSOR_VALID );
|
||||
@@ -9683,14 +9743,14 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
|
||||
iCellIdx = pCur->ix;
|
||||
pPage = pCur->pPage;
|
||||
if( pPage->nCell<=iCellIdx ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
pCell = findCell(pPage, iCellIdx);
|
||||
if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
if( pCell<&pPage->aCellIdx[pPage->nCell] ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
|
||||
/* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
|
||||
@@ -9781,7 +9841,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
|
||||
n = pCur->pPage->pgno;
|
||||
}
|
||||
pCell = findCell(pLeaf, pLeaf->nCell-1);
|
||||
if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;
|
||||
if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_PAGE(pLeaf);
|
||||
nCell = pLeaf->xCellSize(pLeaf, pCell);
|
||||
assert( MX_CELL_SIZE(pBt) >= nCell );
|
||||
pTmp = pBt->pTmpSpace;
|
||||
@@ -9897,7 +9957,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
|
||||
*/
|
||||
sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);
|
||||
if( pgnoRoot>btreePagecount(pBt) ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PGNO(pgnoRoot);
|
||||
}
|
||||
pgnoRoot++;
|
||||
|
||||
@@ -9945,7 +10005,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
|
||||
}
|
||||
rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
|
||||
if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PGNO(pgnoRoot);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
releasePage(pRoot);
|
||||
@@ -10035,14 +10095,14 @@ static int clearDatabasePage(
|
||||
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
if( pgno>btreePagecount(pBt) ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PGNO(pgno);
|
||||
}
|
||||
rc = getAndInitPage(pBt, pgno, &pPage, 0);
|
||||
if( rc ) return rc;
|
||||
if( (pBt->openFlags & BTREE_SINGLE)==0
|
||||
&& sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1))
|
||||
){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
rc = SQLITE_CORRUPT_PAGE(pPage);
|
||||
goto cleardatabasepage_out;
|
||||
}
|
||||
hdr = pPage->hdrOffset;
|
||||
@@ -10146,7 +10206,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
|
||||
assert( p->inTrans==TRANS_WRITE );
|
||||
assert( iTable>=2 );
|
||||
if( iTable>btreePagecount(pBt) ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
return SQLITE_CORRUPT_PGNO(iTable);
|
||||
}
|
||||
|
||||
rc = sqlite3BtreeClearTable(p, iTable, 0);
|
||||
|
||||
+2
-2
@@ -2923,11 +2923,11 @@ void sqlite3EndTable(
|
||||
/* Test for cycles in generated columns and illegal expressions
|
||||
** in CHECK constraints and in DEFAULT clauses. */
|
||||
if( p->tabFlags & TF_HasGenerated ){
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0,
|
||||
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"",
|
||||
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
|
||||
}
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0,
|
||||
sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)",
|
||||
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1101,13 +1101,13 @@ void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){
|
||||
double r1, r2;
|
||||
const char *zVal;
|
||||
r1 = sqlite3_value_double(pValue);
|
||||
sqlite3_str_appendf(pStr, "%!.15g", r1);
|
||||
sqlite3_str_appendf(pStr, "%!0.15g", r1);
|
||||
zVal = sqlite3_str_value(pStr);
|
||||
if( zVal ){
|
||||
sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8);
|
||||
if( r1!=r2 ){
|
||||
sqlite3_str_reset(pStr);
|
||||
sqlite3_str_appendf(pStr, "%!.20e", r1);
|
||||
sqlite3_str_appendf(pStr, "%!0.20e", r1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+80
-37
@@ -621,6 +621,40 @@ static void jsonAppendSeparator(JsonString *p){
|
||||
jsonAppendChar(p, ',');
|
||||
}
|
||||
|
||||
/* c is a control character. Append the canonical JSON representation
|
||||
** of that control character to p.
|
||||
**
|
||||
** This routine assumes that the output buffer has already been enlarged
|
||||
** sufficiently to hold the worst-case encoding plus a nul terminator.
|
||||
*/
|
||||
static void jsonAppendControlChar(JsonString *p, u8 c){
|
||||
static const char aSpecial[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
assert( sizeof(aSpecial)==32 );
|
||||
assert( aSpecial['\b']=='b' );
|
||||
assert( aSpecial['\f']=='f' );
|
||||
assert( aSpecial['\n']=='n' );
|
||||
assert( aSpecial['\r']=='r' );
|
||||
assert( aSpecial['\t']=='t' );
|
||||
assert( c>=0 && c<sizeof(aSpecial) );
|
||||
assert( p->nUsed+7 <= p->nAlloc );
|
||||
if( aSpecial[c] ){
|
||||
p->zBuf[p->nUsed] = '\\';
|
||||
p->zBuf[p->nUsed+1] = aSpecial[c];
|
||||
p->nUsed += 2;
|
||||
}else{
|
||||
p->zBuf[p->nUsed] = '\\';
|
||||
p->zBuf[p->nUsed+1] = 'u';
|
||||
p->zBuf[p->nUsed+2] = '0';
|
||||
p->zBuf[p->nUsed+3] = '0';
|
||||
p->zBuf[p->nUsed+4] = "0123456789abcdef"[c>>4];
|
||||
p->zBuf[p->nUsed+5] = "0123456789abcdef"[c&0xf];
|
||||
p->nUsed += 6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Append the N-byte string in zIn to the end of the JsonString string
|
||||
** under construction. Enclose the string in double-quotes ("...") and
|
||||
** escape any double-quotes or backslash characters contained within the
|
||||
@@ -680,35 +714,14 @@ static void jsonAppendString(JsonString *p, const char *zIn, u32 N){
|
||||
}
|
||||
c = z[0];
|
||||
if( c=='"' || c=='\\' ){
|
||||
json_simple_escape:
|
||||
if( (p->nUsed+N+3 > p->nAlloc) && jsonStringGrow(p,N+3)!=0 ) return;
|
||||
p->zBuf[p->nUsed++] = '\\';
|
||||
p->zBuf[p->nUsed++] = c;
|
||||
}else if( c=='\'' ){
|
||||
p->zBuf[p->nUsed++] = c;
|
||||
}else{
|
||||
static const char aSpecial[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
assert( sizeof(aSpecial)==32 );
|
||||
assert( aSpecial['\b']=='b' );
|
||||
assert( aSpecial['\f']=='f' );
|
||||
assert( aSpecial['\n']=='n' );
|
||||
assert( aSpecial['\r']=='r' );
|
||||
assert( aSpecial['\t']=='t' );
|
||||
assert( c>=0 && c<sizeof(aSpecial) );
|
||||
if( aSpecial[c] ){
|
||||
c = aSpecial[c];
|
||||
goto json_simple_escape;
|
||||
}
|
||||
if( (p->nUsed+N+7 > p->nAlloc) && jsonStringGrow(p,N+7)!=0 ) return;
|
||||
p->zBuf[p->nUsed++] = '\\';
|
||||
p->zBuf[p->nUsed++] = 'u';
|
||||
p->zBuf[p->nUsed++] = '0';
|
||||
p->zBuf[p->nUsed++] = '0';
|
||||
p->zBuf[p->nUsed++] = "0123456789abcdef"[c>>4];
|
||||
p->zBuf[p->nUsed++] = "0123456789abcdef"[c&0xf];
|
||||
jsonAppendControlChar(p, c);
|
||||
}
|
||||
z++;
|
||||
N--;
|
||||
@@ -1409,7 +1422,10 @@ static u32 jsonbValidityCheck(
|
||||
if( !jsonIsOk[z[j]] && z[j]!='\'' ){
|
||||
if( z[j]=='"' ){
|
||||
if( x==JSONB_TEXTJ ) return j+1;
|
||||
}else if( z[j]!='\\' || j+1>=k ){
|
||||
}else if( z[j]<=0x1f ){
|
||||
/* Control characters in JSON5 string literals are ok */
|
||||
if( x==JSONB_TEXTJ ) return j+1;
|
||||
}else if( NEVER(z[j]!='\\') || j+1>=k ){
|
||||
return j+1;
|
||||
}else if( strchr("\"\\/bfnrt",z[j+1])!=0 ){
|
||||
j++;
|
||||
@@ -1607,6 +1623,7 @@ json_parse_restart:
|
||||
case '[': {
|
||||
/* Parse array */
|
||||
iThis = pParse->nBlob;
|
||||
assert( i<=(u32)pParse->nJson );
|
||||
jsonBlobAppendNode(pParse, JSONB_ARRAY, pParse->nJson - i, 0);
|
||||
iStart = pParse->nBlob;
|
||||
if( pParse->oom ) return -1;
|
||||
@@ -1703,9 +1720,14 @@ json_parse_restart:
|
||||
return -1;
|
||||
}
|
||||
}else if( c<=0x1f ){
|
||||
/* Control characters are not allowed in strings */
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
if( c==0 ){
|
||||
pParse->iErr = j;
|
||||
return -1;
|
||||
}
|
||||
/* Control characters are not allowed in canonical JSON string
|
||||
** literals, but are allowed in JSON5 string literals. */
|
||||
opcode = JSONB_TEXT5;
|
||||
pParse->hasNonstd = 1;
|
||||
}else if( c=='"' ){
|
||||
opcode = JSONB_TEXT5;
|
||||
}
|
||||
@@ -2006,6 +2028,10 @@ static void jsonReturnStringAsBlob(JsonString *pStr){
|
||||
JsonParse px;
|
||||
memset(&px, 0, sizeof(px));
|
||||
jsonStringTerminate(pStr);
|
||||
if( pStr->eErr ){
|
||||
sqlite3_result_error_nomem(pStr->pCtx);
|
||||
return;
|
||||
}
|
||||
px.zJson = pStr->zBuf;
|
||||
px.nJson = pStr->nUsed;
|
||||
px.db = sqlite3_context_db_handle(pStr->pCtx);
|
||||
@@ -2073,8 +2099,8 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){
|
||||
(pParse->aBlob[i+7]<<8) + pParse->aBlob[i+8];
|
||||
n = 9;
|
||||
}
|
||||
if( i+sz+n > pParse->nBlob
|
||||
&& i+sz+n > pParse->nBlob-pParse->delta
|
||||
if( (i64)i+sz+n > pParse->nBlob
|
||||
&& (i64)i+sz+n > pParse->nBlob-pParse->delta
|
||||
){
|
||||
sz = 0;
|
||||
n = 0;
|
||||
@@ -2124,6 +2150,7 @@ static u32 jsonTranslateBlobToText(
|
||||
}
|
||||
case JSONB_INT:
|
||||
case JSONB_FLOAT: {
|
||||
if( sz==0 ) goto malformed_jsonb;
|
||||
jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz);
|
||||
break;
|
||||
}
|
||||
@@ -2132,6 +2159,7 @@ static u32 jsonTranslateBlobToText(
|
||||
sqlite3_uint64 u = 0;
|
||||
const char *zIn = (const char*)&pParse->aBlob[i+n];
|
||||
int bOverflow = 0;
|
||||
if( sz==0 ) goto malformed_jsonb;
|
||||
if( zIn[0]=='-' ){
|
||||
jsonAppendChar(pOut, '-');
|
||||
k++;
|
||||
@@ -2154,6 +2182,7 @@ static u32 jsonTranslateBlobToText(
|
||||
case JSONB_FLOAT5: { /* Float literal missing digits beside "." */
|
||||
u32 k = 0;
|
||||
const char *zIn = (const char*)&pParse->aBlob[i+n];
|
||||
if( sz==0 ) goto malformed_jsonb;
|
||||
if( zIn[0]=='-' ){
|
||||
jsonAppendChar(pOut, '-');
|
||||
k++;
|
||||
@@ -2183,7 +2212,7 @@ static u32 jsonTranslateBlobToText(
|
||||
zIn = (const char*)&pParse->aBlob[i+n];
|
||||
jsonAppendChar(pOut, '"');
|
||||
while( sz2>0 ){
|
||||
for(k=0; k<sz2 && zIn[k]!='\\' && zIn[k]!='"'; k++){}
|
||||
for(k=0; k<sz2 && (jsonIsOk[(u8)zIn[k]] || zIn[k]=='\''); k++){}
|
||||
if( k>0 ){
|
||||
jsonAppendRawNZ(pOut, zIn, k);
|
||||
if( k>=sz2 ){
|
||||
@@ -2198,6 +2227,13 @@ static u32 jsonTranslateBlobToText(
|
||||
sz2--;
|
||||
continue;
|
||||
}
|
||||
if( zIn[0]<=0x1f ){
|
||||
if( pOut->nUsed+7>pOut->nAlloc && jsonStringGrow(pOut,7) ) break;
|
||||
jsonAppendControlChar(pOut, zIn[0]);
|
||||
zIn++;
|
||||
sz2--;
|
||||
continue;
|
||||
}
|
||||
assert( zIn[0]=='\\' );
|
||||
assert( sz2>=1 );
|
||||
if( sz2<2 ){
|
||||
@@ -2267,10 +2303,11 @@ static u32 jsonTranslateBlobToText(
|
||||
jsonAppendChar(pOut, '[');
|
||||
j = i+n;
|
||||
iEnd = j+sz;
|
||||
while( j<iEnd ){
|
||||
while( j<iEnd && pOut->eErr==0 ){
|
||||
j = jsonTranslateBlobToText(pParse, j, pOut);
|
||||
jsonAppendChar(pOut, ',');
|
||||
}
|
||||
if( j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
|
||||
if( sz>0 ) jsonStringTrimOneChar(pOut);
|
||||
jsonAppendChar(pOut, ']');
|
||||
break;
|
||||
@@ -2280,17 +2317,18 @@ static u32 jsonTranslateBlobToText(
|
||||
jsonAppendChar(pOut, '{');
|
||||
j = i+n;
|
||||
iEnd = j+sz;
|
||||
while( j<iEnd ){
|
||||
while( j<iEnd && pOut->eErr==0 ){
|
||||
j = jsonTranslateBlobToText(pParse, j, pOut);
|
||||
jsonAppendChar(pOut, (x++ & 1) ? ',' : ':');
|
||||
}
|
||||
if( x & 1 ) pOut->eErr |= JSTRING_MALFORMED;
|
||||
if( (x & 1)!=0 || j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
|
||||
if( sz>0 ) jsonStringTrimOneChar(pOut);
|
||||
jsonAppendChar(pOut, '}');
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
malformed_jsonb:
|
||||
pOut->eErr |= JSTRING_MALFORMED;
|
||||
break;
|
||||
}
|
||||
@@ -3326,8 +3364,9 @@ rebuild_from_cache:
|
||||
}
|
||||
p->zJson = (char*)sqlite3_value_text(pArg);
|
||||
p->nJson = sqlite3_value_bytes(pArg);
|
||||
if( db->mallocFailed ) goto json_pfa_oom;
|
||||
if( p->nJson==0 ) goto json_pfa_malformed;
|
||||
if( NEVER(p->zJson==0) ) goto json_pfa_oom;
|
||||
assert( p->zJson!=0 );
|
||||
if( jsonConvertTextToBlob(p, (flgs & JSON_KEEPERROR) ? 0 : ctx) ){
|
||||
if( flgs & JSON_KEEPERROR ){
|
||||
p->nErr = 1;
|
||||
@@ -3493,10 +3532,10 @@ static void jsonDebugPrintBlob(
|
||||
if( sz==0 && x<=JSONB_FALSE ){
|
||||
sqlite3_str_append(pOut, "\n", 1);
|
||||
}else{
|
||||
u32 i;
|
||||
u32 j;
|
||||
sqlite3_str_appendall(pOut, ": \"");
|
||||
for(i=iStart+n; i<iStart+n+sz; i++){
|
||||
u8 c = pParse->aBlob[i];
|
||||
for(j=iStart+n; j<iStart+n+sz; j++){
|
||||
u8 c = pParse->aBlob[j];
|
||||
if( c<0x20 || c>=0x7f ) c = '.';
|
||||
sqlite3_str_append(pOut, (char*)&c, 1);
|
||||
}
|
||||
@@ -3547,11 +3586,12 @@ static void jsonParseFunc(
|
||||
if( p==0 ) return;
|
||||
if( argc==1 ){
|
||||
jsonDebugPrintBlob(p, 0, p->nBlob, 0, &out);
|
||||
sqlite3_result_text64(ctx, out.zText, out.nChar, SQLITE_DYNAMIC, SQLITE_UTF8);
|
||||
sqlite3_result_text64(ctx,out.zText,out.nChar,SQLITE_TRANSIENT,SQLITE_UTF8);
|
||||
}else{
|
||||
jsonShowParse(p);
|
||||
}
|
||||
jsonParseFree(p);
|
||||
sqlite3_str_reset(&out);
|
||||
}
|
||||
#endif /* SQLITE_DEBUG */
|
||||
|
||||
@@ -4904,6 +4944,9 @@ static int jsonEachColumn(
|
||||
case JEACH_VALUE: {
|
||||
u32 i = jsonSkipLabel(p);
|
||||
jsonReturnFromBlob(&p->sParse, i, ctx, 1);
|
||||
if( (p->sParse.aBlob[i] & 0x0f)>=JSONB_ARRAY ){
|
||||
sqlite3_result_subtype(ctx, JSON_SUBTYPE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JEACH_TYPE: {
|
||||
|
||||
@@ -221,6 +221,24 @@ static void sqlite3MallocAlarm(int nByte){
|
||||
sqlite3_mutex_enter(mem0.mutex);
|
||||
}
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/*
|
||||
** This routine is called whenever an out-of-memory condition is seen,
|
||||
** It's only purpose to to serve as a breakpoint for gdb or similar
|
||||
** code debuggers when working on out-of-memory conditions, for example
|
||||
** caused by PRAGMA hard_heap_limit=N.
|
||||
*/
|
||||
static SQLITE_NOINLINE void test_oom_breakpoint(u64 n){
|
||||
static u64 nOomFault = 0;
|
||||
nOomFault += n;
|
||||
/* The assert() is never reached in a human lifetime. It is here mostly
|
||||
** to prevent code optimizers from optimizing out this function. */
|
||||
assert( (nOomFault>>32) < 0xffffffff );
|
||||
}
|
||||
#else
|
||||
# define test_oom_breakpoint(X) /* No-op for production builds */
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Do a memory allocation with statistics and alarms. Assume the
|
||||
** lock is already held.
|
||||
@@ -247,6 +265,7 @@ static void mallocWithAlarm(int n, void **pp){
|
||||
if( mem0.hardLimit ){
|
||||
nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
|
||||
if( nUsed >= mem0.hardLimit - nFull ){
|
||||
test_oom_breakpoint(1);
|
||||
*pp = 0;
|
||||
return;
|
||||
}
|
||||
@@ -535,6 +554,7 @@ void *sqlite3Realloc(void *pOld, u64 nBytes){
|
||||
sqlite3MallocAlarm(nDiff);
|
||||
if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){
|
||||
sqlite3_mutex_leave(mem0.mutex);
|
||||
test_oom_breakpoint(1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -1295,8 +1295,12 @@ static int unixLogErrorAtLine(
|
||||
** available, the error message will often be an empty string. Not a
|
||||
** huge problem. Incorrectly concluding that the GNU version is available
|
||||
** could lead to a segfault though.
|
||||
**
|
||||
** Forum post 3f13857fa4062301 reports that the Android SDK may use
|
||||
** int-type return, depending on its version.
|
||||
*/
|
||||
#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)
|
||||
#if (defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)) \
|
||||
&& !defined(ANDROID) && !defined(__ANDROID__)
|
||||
zErr =
|
||||
# endif
|
||||
strerror_r(iErrno, aErr, sizeof(aErr)-1);
|
||||
@@ -5441,11 +5445,16 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
||||
|
||||
#if SQLITE_MAX_MMAP_SIZE>0
|
||||
if( pFd->mmapSizeMax>0 ){
|
||||
/* Ensure that there is always at least a 256 byte buffer of addressable
|
||||
** memory following the returned page. If the database is corrupt,
|
||||
** SQLite may overread the page slightly (in practice only a few bytes,
|
||||
** but 256 is safe, round, number). */
|
||||
const int nEofBuffer = 256;
|
||||
if( pFd->pMapRegion==0 ){
|
||||
int rc = unixMapfile(pFd, -1);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
if( pFd->mmapSize >= iOff+nAmt ){
|
||||
if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
|
||||
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
||||
pFd->nFetchOut++;
|
||||
}
|
||||
|
||||
+6
-1
@@ -4521,6 +4521,11 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
||||
|
||||
#if SQLITE_MAX_MMAP_SIZE>0
|
||||
if( pFd->mmapSizeMax>0 ){
|
||||
/* Ensure that there is always at least a 256 byte buffer of addressable
|
||||
** memory following the returned page. If the database is corrupt,
|
||||
** SQLite may overread the page slightly (in practice only a few bytes,
|
||||
** but 256 is safe, round, number). */
|
||||
const int nEofBuffer = 256;
|
||||
if( pFd->pMapRegion==0 ){
|
||||
int rc = winMapfile(pFd, -1);
|
||||
if( rc!=SQLITE_OK ){
|
||||
@@ -4529,7 +4534,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
if( pFd->mmapSize >= iOff+nAmt ){
|
||||
if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
|
||||
assert( pFd->pMapRegion!=0 );
|
||||
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
||||
pFd->nFetchOut++;
|
||||
|
||||
+13
-1
@@ -21,6 +21,10 @@
|
||||
*/
|
||||
}
|
||||
|
||||
// Function used to enlarge the parser stack, if needed
|
||||
%realloc parserStackRealloc
|
||||
%free sqlite3_free
|
||||
|
||||
// All token codes are small integers with #defines that begin with "TK_"
|
||||
%token_prefix TK_
|
||||
|
||||
@@ -45,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
%stack_overflow {
|
||||
sqlite3ErrorMsg(pParse, "parser stack overflow");
|
||||
sqlite3OomFault(pParse->db);
|
||||
}
|
||||
|
||||
// The name of the generated procedure that implements the parser
|
||||
@@ -547,6 +551,14 @@ cmd ::= select(X). {
|
||||
}
|
||||
return pSelect;
|
||||
}
|
||||
|
||||
/* Memory allocator for parser stack resizing. This is a thin wrapper around
|
||||
** sqlite3_realloc() that includes a call to sqlite3FaultSim() to facilitate
|
||||
** testing.
|
||||
*/
|
||||
static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
|
||||
return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
|
||||
}
|
||||
}
|
||||
|
||||
%ifndef SQLITE_OMIT_CTE
|
||||
|
||||
+184
-62
@@ -30,6 +30,34 @@
|
||||
** ../tool/mkpragmatab.tcl. */
|
||||
#include "pragma.h"
|
||||
|
||||
/*
|
||||
** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
|
||||
** will be run with an analysis_limit set to the lessor of the value of
|
||||
** the following macro or to the actual analysis_limit if it is non-zero,
|
||||
** in order to prevent PRAGMA optimize from running for too long.
|
||||
**
|
||||
** The value of 2000 is chosen emperically so that the worst-case run-time
|
||||
** for PRAGMA optimize does not exceed 100 milliseconds against a variety
|
||||
** of test databases on a RaspberryPI-4 compiled using -Os and without
|
||||
** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of
|
||||
** this paragraph, "worst-case" means that ANALYZE ends up being
|
||||
** run on every table in the database. The worst case typically only
|
||||
** happens if PRAGMA optimize is run on a database file for which ANALYZE
|
||||
** has not been previously run and the 0x10000 flag is included so that
|
||||
** all tables are analyzed. The usual case for PRAGMA optimize is that
|
||||
** no ANALYZE commands will be run at all, or if any ANALYZE happens it
|
||||
** will be against a single table, so that expected timing for PRAGMA
|
||||
** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000
|
||||
** flag or less than 100 microseconds without the 0x10000 flag.
|
||||
**
|
||||
** An analysis limit of 2000 is almost always sufficient for the query
|
||||
** planner to fully characterize an index. The additional accuracy from
|
||||
** a larger analysis is not usually helpful.
|
||||
*/
|
||||
#ifndef SQLITE_DEFAULT_OPTIMIZE_LIMIT
|
||||
# define SQLITE_DEFAULT_OPTIMIZE_LIMIT 2000
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Interpret the given string as a safety level. Return 0 for OFF,
|
||||
** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
|
||||
@@ -1762,31 +1790,7 @@ void sqlite3Pragma(
|
||||
int mxCol; /* Maximum non-virtual column number */
|
||||
|
||||
if( pObjTab && pObjTab!=pTab ) continue;
|
||||
if( !IsOrdinaryTable(pTab) ){
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
sqlite3_vtab *pVTab;
|
||||
int a1;
|
||||
if( !IsVirtual(pTab) ) continue;
|
||||
if( pTab->nCol<=0 ){
|
||||
const char *zMod = pTab->u.vtab.azArg[0];
|
||||
if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue;
|
||||
}
|
||||
sqlite3ViewGetColumnNames(pParse, pTab);
|
||||
if( pTab->u.vtab.p==0 ) continue;
|
||||
pVTab = pTab->u.vtab.p->pVtab;
|
||||
if( NEVER(pVTab==0) ) continue;
|
||||
if( NEVER(pVTab->pModule==0) ) continue;
|
||||
if( pVTab->pModule->iVersion<4 ) continue;
|
||||
if( pVTab->pModule->xIntegrity==0 ) continue;
|
||||
sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick);
|
||||
pTab->nTabRef++;
|
||||
sqlite3VdbeAppendP4(v, pTab, P4_TABLEREF);
|
||||
a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, a1);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if( !IsOrdinaryTable(pTab) ) continue;
|
||||
if( isQuick || HasRowid(pTab) ){
|
||||
pPk = 0;
|
||||
r2 = 0;
|
||||
@@ -1921,6 +1925,7 @@ void sqlite3Pragma(
|
||||
** is REAL, we have to load the actual data using OP_Column
|
||||
** to reliably determine if the value is a NULL. */
|
||||
sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
|
||||
sqlite3ColumnDefault(v, pTab, j, 3);
|
||||
jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
@@ -2111,6 +2116,38 @@ void sqlite3Pragma(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/* Second pass to invoke the xIntegrity method on all virtual
|
||||
** tables.
|
||||
*/
|
||||
for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
|
||||
Table *pTab = sqliteHashData(x);
|
||||
sqlite3_vtab *pVTab;
|
||||
int a1;
|
||||
if( pObjTab && pObjTab!=pTab ) continue;
|
||||
if( IsOrdinaryTable(pTab) ) continue;
|
||||
if( !IsVirtual(pTab) ) continue;
|
||||
if( pTab->nCol<=0 ){
|
||||
const char *zMod = pTab->u.vtab.azArg[0];
|
||||
if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue;
|
||||
}
|
||||
sqlite3ViewGetColumnNames(pParse, pTab);
|
||||
if( pTab->u.vtab.p==0 ) continue;
|
||||
pVTab = pTab->u.vtab.p->pVtab;
|
||||
if( NEVER(pVTab==0) ) continue;
|
||||
if( NEVER(pVTab->pModule==0) ) continue;
|
||||
if( pVTab->pModule->iVersion<4 ) continue;
|
||||
if( pVTab->pModule->xIntegrity==0 ) continue;
|
||||
sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick);
|
||||
pTab->nTabRef++;
|
||||
sqlite3VdbeAppendP4(v, pTab, P4_TABLEREF);
|
||||
a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, a1);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
{
|
||||
static const int iLn = VDBE_OFFSET_LINENO(2);
|
||||
@@ -2374,44 +2411,63 @@ void sqlite3Pragma(
|
||||
**
|
||||
** The optional argument is a bitmask of optimizations to perform:
|
||||
**
|
||||
** 0x0001 Debugging mode. Do not actually perform any optimizations
|
||||
** but instead return one line of text for each optimization
|
||||
** that would have been done. Off by default.
|
||||
** 0x00001 Debugging mode. Do not actually perform any optimizations
|
||||
** but instead return one line of text for each optimization
|
||||
** that would have been done. Off by default.
|
||||
**
|
||||
** 0x0002 Run ANALYZE on tables that might benefit. On by default.
|
||||
** See below for additional information.
|
||||
** 0x00002 Run ANALYZE on tables that might benefit. On by default.
|
||||
** See below for additional information.
|
||||
**
|
||||
** 0x0004 (Not yet implemented) Record usage and performance
|
||||
** information from the current session in the
|
||||
** database file so that it will be available to "optimize"
|
||||
** pragmas run by future database connections.
|
||||
** 0x00010 Run all ANALYZE operations using an analysis_limit that
|
||||
** is the lessor of the current analysis_limit and the
|
||||
** SQLITE_DEFAULT_OPTIMIZE_LIMIT compile-time option.
|
||||
** The default value of SQLITE_DEFAULT_OPTIMIZE_LIMIT is
|
||||
** currently (2024-02-19) set to 2000, which is such that
|
||||
** the worst case run-time for PRAGMA optimize on a 100MB
|
||||
** database will usually be less than 100 milliseconds on
|
||||
** a RaspberryPI-4 class machine. On by default.
|
||||
**
|
||||
** 0x0008 (Not yet implemented) Create indexes that might have
|
||||
** been helpful to recent queries
|
||||
** 0x10000 Look at tables to see if they need to be reanalyzed
|
||||
** due to growth or shrinkage even if they have not been
|
||||
** queried during the current connection. Off by default.
|
||||
**
|
||||
** The default MASK is and always shall be 0xfffe. 0xfffe means perform all
|
||||
** of the optimizations listed above except Debug Mode, including new
|
||||
** optimizations that have not yet been invented. If new optimizations are
|
||||
** ever added that should be off by default, those off-by-default
|
||||
** optimizations will have bitmasks of 0x10000 or larger.
|
||||
** The default MASK is and always shall be 0x0fffe. In the current
|
||||
** implementation, the default mask only covers the 0x00002 optimization,
|
||||
** though additional optimizations that are covered by 0x0fffe might be
|
||||
** added in the future. Optimizations that are off by default and must
|
||||
** be explicitly requested have masks of 0x10000 or greater.
|
||||
**
|
||||
** DETERMINATION OF WHEN TO RUN ANALYZE
|
||||
**
|
||||
** In the current implementation, a table is analyzed if only if all of
|
||||
** the following are true:
|
||||
**
|
||||
** (1) MASK bit 0x02 is set.
|
||||
** (1) MASK bit 0x00002 is set.
|
||||
**
|
||||
** (2) The query planner used sqlite_stat1-style statistics for one or
|
||||
** more indexes of the table at some point during the lifetime of
|
||||
** the current connection.
|
||||
** (2) The table is an ordinary table, not a virtual table or view.
|
||||
**
|
||||
** (3) One or more indexes of the table are currently unanalyzed OR
|
||||
** the number of rows in the table has increased by 25 times or more
|
||||
** since the last time ANALYZE was run.
|
||||
** (3) The table name does not begin with "sqlite_".
|
||||
**
|
||||
** (4) One or more of the following is true:
|
||||
** (4a) The 0x10000 MASK bit is set.
|
||||
** (4b) One or more indexes on the table lacks an entry
|
||||
** in the sqlite_stat1 table.
|
||||
** (4c) The query planner used sqlite_stat1-style statistics for one
|
||||
** or more indexes of the table at some point during the lifetime
|
||||
** of the current connection.
|
||||
**
|
||||
** (5) One or more of the following is true:
|
||||
** (5a) One or more indexes on the table lacks an entry
|
||||
** in the sqlite_stat1 table. (Same as 4a)
|
||||
** (5b) The number of rows in the table has increased or decreased by
|
||||
** 10-fold. In other words, the current size of the table is
|
||||
** 10 times larger than the size in sqlite_stat1 or else the
|
||||
** current size is less than 1/10th the size in sqlite_stat1.
|
||||
**
|
||||
** The rules for when tables are analyzed are likely to change in
|
||||
** future releases.
|
||||
** future releases. Future versions of SQLite might accept a string
|
||||
** literal argument to this pragma that contains a mnemonic description
|
||||
** of the options rather than a bitmap.
|
||||
*/
|
||||
case PragTyp_OPTIMIZE: {
|
||||
int iDbLast; /* Loop termination point for the schema loop */
|
||||
@@ -2423,6 +2479,10 @@ void sqlite3Pragma(
|
||||
LogEst szThreshold; /* Size threshold above which reanalysis needed */
|
||||
char *zSubSql; /* SQL statement for the OP_SqlExec opcode */
|
||||
u32 opMask; /* Mask of operations to perform */
|
||||
int nLimit; /* Analysis limit to use */
|
||||
int nCheck = 0; /* Number of tables to be optimized */
|
||||
int nBtree = 0; /* Number of btrees to scan */
|
||||
int nIndex; /* Number of indexes on the current table */
|
||||
|
||||
if( zRight ){
|
||||
opMask = (u32)sqlite3Atoi(zRight);
|
||||
@@ -2430,6 +2490,14 @@ void sqlite3Pragma(
|
||||
}else{
|
||||
opMask = 0xfffe;
|
||||
}
|
||||
if( (opMask & 0x10)==0 ){
|
||||
nLimit = 0;
|
||||
}else if( db->nAnalysisLimit>0
|
||||
&& db->nAnalysisLimit<SQLITE_DEFAULT_OPTIMIZE_LIMIT ){
|
||||
nLimit = 0;
|
||||
}else{
|
||||
nLimit = SQLITE_DEFAULT_OPTIMIZE_LIMIT;
|
||||
}
|
||||
iTabCur = pParse->nTab++;
|
||||
for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
|
||||
if( iDb==1 ) continue;
|
||||
@@ -2438,23 +2506,61 @@ void sqlite3Pragma(
|
||||
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
|
||||
pTab = (Table*)sqliteHashData(k);
|
||||
|
||||
/* If table pTab has not been used in a way that would benefit from
|
||||
** having analysis statistics during the current session, then skip it.
|
||||
** This also has the effect of skipping virtual tables and views */
|
||||
if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue;
|
||||
/* This only works for ordinary tables */
|
||||
if( !IsOrdinaryTable(pTab) ) continue;
|
||||
|
||||
/* Reanalyze if the table is 25 times larger than the last analysis */
|
||||
szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 );
|
||||
/* Do not scan system tables */
|
||||
if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ) continue;
|
||||
|
||||
/* Find the size of the table as last recorded in sqlite_stat1.
|
||||
** If any index is unanalyzed, then the threshold is -1 to
|
||||
** indicate a new, unanalyzed index
|
||||
*/
|
||||
szThreshold = pTab->nRowLogEst;
|
||||
nIndex = 0;
|
||||
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
||||
nIndex++;
|
||||
if( !pIdx->hasStat1 ){
|
||||
szThreshold = 0; /* Always analyze if any index lacks statistics */
|
||||
break;
|
||||
szThreshold = -1; /* Always analyze if any index lacks statistics */
|
||||
}
|
||||
}
|
||||
if( szThreshold ){
|
||||
sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
|
||||
sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur,
|
||||
sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold);
|
||||
|
||||
/* If table pTab has not been used in a way that would benefit from
|
||||
** having analysis statistics during the current session, then skip it,
|
||||
** unless the 0x10000 MASK bit is set. */
|
||||
if( (pTab->tabFlags & TF_MaybeReanalyze)!=0 ){
|
||||
/* Check for size change if stat1 has been used for a query */
|
||||
}else if( opMask & 0x10000 ){
|
||||
/* Check for size change if 0x10000 is set */
|
||||
}else if( pTab->pIndex!=0 && szThreshold<0 ){
|
||||
/* Do analysis if unanalyzed indexes exists */
|
||||
}else{
|
||||
/* Otherwise, we can skip this table */
|
||||
continue;
|
||||
}
|
||||
|
||||
nCheck++;
|
||||
if( nCheck==2 ){
|
||||
/* If ANALYZE might be invoked two or more times, hold a write
|
||||
** transaction for efficiency */
|
||||
sqlite3BeginWriteOperation(pParse, 0, iDb);
|
||||
}
|
||||
nBtree += nIndex+1;
|
||||
|
||||
/* Reanalyze if the table is 10 times larger or smaller than
|
||||
** the last analysis. Unconditional reanalysis if there are
|
||||
** unanalyzed indexes. */
|
||||
sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
|
||||
if( szThreshold>=0 ){
|
||||
const LogEst iRange = 33; /* 10x size change */
|
||||
sqlite3VdbeAddOp4Int(v, OP_IfSizeBetween, iTabCur,
|
||||
sqlite3VdbeCurrentAddr(v)+2+(opMask&1),
|
||||
szThreshold>=iRange ? szThreshold-iRange : -1,
|
||||
szThreshold+iRange);
|
||||
VdbeCoverage(v);
|
||||
}else{
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, iTabCur,
|
||||
sqlite3VdbeCurrentAddr(v)+2+(opMask&1));
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"",
|
||||
@@ -2464,11 +2570,27 @@ void sqlite3Pragma(
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1);
|
||||
}else{
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC);
|
||||
sqlite3VdbeAddOp4(v, OP_SqlExec, nLimit ? 0x02 : 00, nLimit, 0,
|
||||
zSubSql, P4_DYNAMIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
sqlite3VdbeAddOp0(v, OP_Expire);
|
||||
|
||||
/* In a schema with a large number of tables and indexes, scale back
|
||||
** the analysis_limit to avoid excess run-time in the worst case.
|
||||
*/
|
||||
if( !db->mallocFailed && nLimit>0 && nBtree>100 ){
|
||||
int iAddr, iEnd;
|
||||
VdbeOp *aOp;
|
||||
nLimit = 100*nLimit/nBtree;
|
||||
if( nLimit<100 ) nLimit = 100;
|
||||
aOp = sqlite3VdbeGetOp(v, 0);
|
||||
iEnd = sqlite3VdbeCurrentAddr(v);
|
||||
for(iAddr=0; iAddr<iEnd; iAddr++){
|
||||
if( aOp[iAddr].opcode==OP_SqlExec ) aOp[iAddr].p2 = nLimit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -498,6 +498,7 @@ void sqlite3_str_vappendf(
|
||||
if( xtype==etFLOAT ){
|
||||
iRound = -precision;
|
||||
}else if( xtype==etGENERIC ){
|
||||
if( precision==0 ) precision = 1;
|
||||
iRound = precision;
|
||||
}else{
|
||||
iRound = precision+1;
|
||||
@@ -533,13 +534,14 @@ void sqlite3_str_vappendf(
|
||||
}
|
||||
|
||||
exp = s.iDP-1;
|
||||
if( xtype==etGENERIC && precision>0 ) precision--;
|
||||
|
||||
/*
|
||||
** If the field type is etGENERIC, then convert to either etEXP
|
||||
** or etFLOAT, as appropriate.
|
||||
*/
|
||||
if( xtype==etGENERIC ){
|
||||
assert( precision>0 );
|
||||
precision--;
|
||||
flag_rtz = !flag_alternateform;
|
||||
if( exp<-4 || exp>precision ){
|
||||
xtype = etEXP;
|
||||
|
||||
+10
-5
@@ -79,6 +79,8 @@ static void resolveAlias(
|
||||
assert( iCol>=0 && iCol<pEList->nExpr );
|
||||
pOrig = pEList->a[iCol].pExpr;
|
||||
assert( pOrig!=0 );
|
||||
assert( !ExprHasProperty(pExpr, EP_Reduced|EP_TokenOnly) );
|
||||
if( pExpr->pAggInfo ) return;
|
||||
db = pParse->db;
|
||||
pDup = sqlite3ExprDup(db, pOrig, 0);
|
||||
if( db->mallocFailed ){
|
||||
@@ -277,7 +279,7 @@ static int lookupName(
|
||||
Parse *pParse, /* The parsing context */
|
||||
const char *zDb, /* Name of the database containing table, or NULL */
|
||||
const char *zTab, /* Name of table containing column, or NULL */
|
||||
const char *zCol, /* Name of the column. */
|
||||
const Expr *pRight, /* Name of the column. */
|
||||
NameContext *pNC, /* The name context used to resolve the name */
|
||||
Expr *pExpr /* Make this EXPR node point to the selected column */
|
||||
){
|
||||
@@ -294,6 +296,7 @@ static int lookupName(
|
||||
Table *pTab = 0; /* Table holding the row */
|
||||
Column *pCol; /* A column of pTab */
|
||||
ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */
|
||||
const char *zCol = pRight->u.zToken;
|
||||
|
||||
assert( pNC ); /* the name context cannot be NULL. */
|
||||
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
|
||||
@@ -753,6 +756,10 @@ static int lookupName(
|
||||
sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
|
||||
}else if( zTab ){
|
||||
sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
|
||||
}else if( cnt==0 && ExprHasProperty(pRight,EP_DblQuoted) ){
|
||||
sqlite3ErrorMsg(pParse, "%s: \"%s\" - should this be a"
|
||||
" string literal in single-quotes?",
|
||||
zErr, zCol);
|
||||
}else{
|
||||
sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
|
||||
}
|
||||
@@ -1000,7 +1007,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
*/
|
||||
case TK_ID:
|
||||
case TK_DOT: {
|
||||
const char *zColumn;
|
||||
const char *zTable;
|
||||
const char *zDb;
|
||||
Expr *pRight;
|
||||
@@ -1009,7 +1015,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
zDb = 0;
|
||||
zTable = 0;
|
||||
assert( !ExprHasProperty(pExpr, EP_IntValue) );
|
||||
zColumn = pExpr->u.zToken;
|
||||
pRight = pExpr;
|
||||
}else{
|
||||
Expr *pLeft = pExpr->pLeft;
|
||||
testcase( pNC->ncFlags & NC_IdxExpr );
|
||||
@@ -1028,14 +1034,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
}
|
||||
assert( ExprUseUToken(pLeft) && ExprUseUToken(pRight) );
|
||||
zTable = pLeft->u.zToken;
|
||||
zColumn = pRight->u.zToken;
|
||||
assert( ExprUseYTab(pExpr) );
|
||||
if( IN_RENAME_OBJECT ){
|
||||
sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight);
|
||||
sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft);
|
||||
}
|
||||
}
|
||||
return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
|
||||
return lookupName(pParse, zDb, zTable, pRight, pNC, pExpr);
|
||||
}
|
||||
|
||||
/* Resolve function names
|
||||
|
||||
@@ -6444,6 +6444,8 @@ void sqlite3SelectPrep(
|
||||
*/
|
||||
static void printAggInfo(AggInfo *pAggInfo){
|
||||
int ii;
|
||||
sqlite3DebugPrintf("AggInfo %d/%p:\n",
|
||||
pAggInfo->selId, pAggInfo);
|
||||
for(ii=0; ii<pAggInfo->nColumn; ii++){
|
||||
struct AggInfo_col *pCol = &pAggInfo->aCol[ii];
|
||||
sqlite3DebugPrintf(
|
||||
@@ -8546,6 +8548,12 @@ select_end:
|
||||
sqlite3ExprListDelete(db, pMinMaxOrderBy);
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( pAggInfo && !db->mallocFailed ){
|
||||
#if TREETRACE_ENABLED
|
||||
if( sqlite3TreeTrace & 0x20 ){
|
||||
TREETRACE(0x20,pParse,p,("Finished with AggInfo\n"));
|
||||
printAggInfo(pAggInfo);
|
||||
}
|
||||
#endif
|
||||
for(i=0; i<pAggInfo->nColumn; i++){
|
||||
Expr *pExpr = pAggInfo->aCol[i].pCExpr;
|
||||
if( pExpr==0 ) continue;
|
||||
|
||||
+158
-6
@@ -268,6 +268,9 @@ INCLUDE ../ext/consio/console_io.c
|
||||
* setOutputStream(FILE *pf)
|
||||
* This is normally the stream that CLI normal output goes to.
|
||||
* For the stand-alone CLI, it is stdout with no .output redirect.
|
||||
*
|
||||
* The ?putz(z) forms are required for the Fiddle builds for string literal
|
||||
* output, in aid of enforcing format string to argument correspondence.
|
||||
*/
|
||||
# define sputz(s,z) fPutsUtf8(z,s)
|
||||
# define sputf fPrintfUtf8
|
||||
@@ -279,12 +282,18 @@ INCLUDE ../ext/consio/console_io.c
|
||||
|
||||
#else
|
||||
/* For Fiddle, all console handling and emit redirection is omitted. */
|
||||
# define sputz(fp,z) fputs(z,fp)
|
||||
# define sputf(fp,fmt, ...) fprintf(fp,fmt,__VA_ARGS__)
|
||||
# define oputz(z) fputs(z,stdout)
|
||||
/* These next 3 macros are for emitting formatted output. When complaints
|
||||
* from the WASM build are issued for non-formatted output, (when a mere
|
||||
* string literal is to be emitted, the ?putz(z) forms should be used.
|
||||
* (This permits compile-time checking of format string / argument mismatch.)
|
||||
*/
|
||||
# define oputf(fmt, ...) printf(fmt,__VA_ARGS__)
|
||||
# define eputz(z) fputs(z,stderr)
|
||||
# define eputf(fmt, ...) fprintf(stderr,fmt,__VA_ARGS__)
|
||||
# define sputf(fp,fmt, ...) fprintf(fp,fmt,__VA_ARGS__)
|
||||
/* These next 3 macros are for emitting simple string literals. */
|
||||
# define oputz(z) fputs(z,stdout)
|
||||
# define eputz(z) fputs(z,stderr)
|
||||
# define sputz(fp,z) fputs(z,fp)
|
||||
# define oputb(buf,na) fwrite(buf,1,na,stdout)
|
||||
#endif
|
||||
|
||||
@@ -1213,6 +1222,9 @@ INCLUDE ../ext/misc/sqlar.c
|
||||
INCLUDE ../ext/expert/sqlite3expert.h
|
||||
INCLUDE ../ext/expert/sqlite3expert.c
|
||||
|
||||
INCLUDE ../ext/intck/sqlite3intck.h
|
||||
INCLUDE ../ext/intck/sqlite3intck.c
|
||||
|
||||
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
|
||||
#define SQLITE_SHELL_HAVE_RECOVER 1
|
||||
#else
|
||||
@@ -4732,6 +4744,7 @@ static const char *(azHelp[]) = {
|
||||
".indexes ?TABLE? Show names of indexes",
|
||||
" If TABLE is specified, only show indexes for",
|
||||
" tables matching TABLE using the LIKE operator.",
|
||||
".intck ?STEPS_PER_UNLOCK? Run an incremental integrity check on the db",
|
||||
#ifdef SQLITE_ENABLE_IOTRACE
|
||||
",iotrace FILE Enable I/O diagnostic logging to FILE",
|
||||
#endif
|
||||
@@ -7641,6 +7654,40 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){
|
||||
}
|
||||
#endif /* SQLITE_SHELL_HAVE_RECOVER */
|
||||
|
||||
/*
|
||||
** Implementation of ".intck STEPS_PER_UNLOCK" command.
|
||||
*/
|
||||
static int intckDatabaseCmd(ShellState *pState, i64 nStepPerUnlock){
|
||||
sqlite3_intck *p = 0;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
rc = sqlite3_intck_open(pState->db, "main", &p);
|
||||
if( rc==SQLITE_OK ){
|
||||
i64 nStep = 0;
|
||||
i64 nError = 0;
|
||||
const char *zErr = 0;
|
||||
while( SQLITE_OK==sqlite3_intck_step(p) ){
|
||||
const char *zMsg = sqlite3_intck_message(p);
|
||||
if( zMsg ){
|
||||
oputf("%s\n", zMsg);
|
||||
nError++;
|
||||
}
|
||||
nStep++;
|
||||
if( nStepPerUnlock && (nStep % nStepPerUnlock)==0 ){
|
||||
sqlite3_intck_unlock(p);
|
||||
}
|
||||
}
|
||||
rc = sqlite3_intck_error(p, &zErr);
|
||||
if( zErr ){
|
||||
eputf("%s\n", zErr);
|
||||
}
|
||||
sqlite3_intck_close(p);
|
||||
|
||||
oputf("%lld steps, %lld errors\n", nStep, nError);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* zAutoColumn(zCol, &db, ?) => Maybe init db, add column zCol to it.
|
||||
@@ -7884,6 +7931,38 @@ static int outputDumpWarning(ShellState *p, const char *zLike){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Fault-Simulator state and logic.
|
||||
*/
|
||||
static struct {
|
||||
int iId; /* ID that triggers a simulated fault. -1 means "any" */
|
||||
int iErr; /* The error code to return on a fault */
|
||||
int iCnt; /* Trigger the fault only if iCnt is already zero */
|
||||
int iInterval; /* Reset iCnt to this value after each fault */
|
||||
int eVerbose; /* When to print output */
|
||||
} faultsim_state = {-1, 0, 0, 0, 0};
|
||||
|
||||
/*
|
||||
** This is the fault-sim callback
|
||||
*/
|
||||
static int faultsim_callback(int iArg){
|
||||
if( faultsim_state.iId>0 && faultsim_state.iId!=iArg ){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( faultsim_state.iCnt>0 ){
|
||||
faultsim_state.iCnt--;
|
||||
if( faultsim_state.eVerbose>=2 ){
|
||||
oputf("FAULT-SIM id=%d no-fault (cnt=%d)\n", iArg, faultsim_state.iCnt);
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( faultsim_state.eVerbose>=1 ){
|
||||
oputf("FAULT-SIM id=%d returns %d\n", iArg, faultsim_state.iErr);
|
||||
}
|
||||
faultsim_state.iCnt = faultsim_state.iInterval;
|
||||
return faultsim_state.iErr;
|
||||
}
|
||||
|
||||
/*
|
||||
** If an input line begins with "." then invoke this routine to
|
||||
** process that line.
|
||||
@@ -9099,6 +9178,21 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}else
|
||||
#endif /* !defined(SQLITE_OMIT_TEST_CONTROL) */
|
||||
|
||||
if( c=='i' && cli_strncmp(azArg[0], "intck", n)==0 ){
|
||||
i64 iArg = 0;
|
||||
if( nArg==2 ){
|
||||
iArg = integerValue(azArg[1]);
|
||||
if( iArg==0 ) iArg = -1;
|
||||
}
|
||||
if( (nArg!=1 && nArg!=2) || iArg<0 ){
|
||||
eputf("Usage: .intck STEPS_PER_UNLOCK\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
open_db(p, 0);
|
||||
rc = intckDatabaseCmd(p, iArg);
|
||||
}else
|
||||
|
||||
#ifdef SQLITE_ENABLE_IOTRACE
|
||||
if( c=='i' && cli_strncmp(azArg[0], "iotrace", n)==0 ){
|
||||
SQLITE_API extern void (SQLITE_CDECL *sqlite3IoTrace)(const char*, ...);
|
||||
@@ -10772,7 +10866,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
/*{"bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/
|
||||
{"byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
|
||||
{"extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
|
||||
/*{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
|
||||
{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"args..." },
|
||||
{"fk_no_action", SQLITE_TESTCTRL_FK_NO_ACTION, 0, "BOOLEAN" },
|
||||
{"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
|
||||
{"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
|
||||
@@ -11005,6 +11099,64 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}
|
||||
sqlite3_test_control(testctrl, &rc2);
|
||||
break;
|
||||
case SQLITE_TESTCTRL_FAULT_INSTALL: {
|
||||
int kk;
|
||||
int bShowHelp = nArg<=2;
|
||||
isOk = 3;
|
||||
for(kk=2; kk<nArg; kk++){
|
||||
const char *z = azArg[kk];
|
||||
if( z[0]=='-' && z[1]=='-' ) z++;
|
||||
if( cli_strcmp(z,"off")==0 ){
|
||||
sqlite3_test_control(testctrl, 0);
|
||||
}else if( cli_strcmp(z,"on")==0 ){
|
||||
faultsim_state.iCnt = faultsim_state.iInterval;
|
||||
if( faultsim_state.iErr==0 ) faultsim_state.iErr = 1;
|
||||
sqlite3_test_control(testctrl, faultsim_callback);
|
||||
}else if( cli_strcmp(z,"reset")==0 ){
|
||||
faultsim_state.iCnt = faultsim_state.iInterval;
|
||||
}else if( cli_strcmp(z,"status")==0 ){
|
||||
oputf("faultsim.iId: %d\n", faultsim_state.iId);
|
||||
oputf("faultsim.iErr: %d\n", faultsim_state.iErr);
|
||||
oputf("faultsim.iCnt: %d\n", faultsim_state.iCnt);
|
||||
oputf("faultsim.iInterval: %d\n", faultsim_state.iInterval);
|
||||
oputf("faultsim.eVerbose: %d\n", faultsim_state.eVerbose);
|
||||
}else if( cli_strcmp(z,"-v")==0 ){
|
||||
if( faultsim_state.eVerbose<2 ) faultsim_state.eVerbose++;
|
||||
}else if( cli_strcmp(z,"-q")==0 ){
|
||||
if( faultsim_state.eVerbose>0 ) faultsim_state.eVerbose--;
|
||||
}else if( cli_strcmp(z,"-id")==0 && kk+1<nArg ){
|
||||
faultsim_state.iId = atoi(azArg[++kk]);
|
||||
}else if( cli_strcmp(z,"-errcode")==0 && kk+1<nArg ){
|
||||
faultsim_state.iErr = atoi(azArg[++kk]);
|
||||
}else if( cli_strcmp(z,"-interval")==0 && kk+1<nArg ){
|
||||
faultsim_state.iInterval = atoi(azArg[++kk]);
|
||||
}else if( cli_strcmp(z,"-?")==0 || sqlite3_strglob("*help*",z)==0){
|
||||
bShowHelp = 1;
|
||||
}else{
|
||||
eputf("Unrecognized fault_install argument: \"%s\"\n",
|
||||
azArg[kk]);
|
||||
rc = 1;
|
||||
bShowHelp = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( bShowHelp ){
|
||||
oputz(
|
||||
"Usage: .testctrl fault_install ARGS\n"
|
||||
"Possible arguments:\n"
|
||||
" off Disable faultsim\n"
|
||||
" on Activate faultsim\n"
|
||||
" reset Reset the trigger counter\n"
|
||||
" status Show current status\n"
|
||||
" -v Increase verbosity\n"
|
||||
" -q Decrease verbosity\n"
|
||||
" --errcode N When triggered, return N as error code\n"
|
||||
" --id ID Trigger only for the ID specified\n"
|
||||
" --interval N Trigger only after every N-th call\n"
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( isOk==0 && iCtrl>=0 ){
|
||||
@@ -11926,7 +12078,7 @@ static void usage(int showDetail){
|
||||
}else{
|
||||
eputz("Use the -help option for additional information\n");
|
||||
}
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+4
-2
@@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
||||
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
|
||||
** <li> The application must not modify the SQL statement text passed into
|
||||
** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
|
||||
** <li> The application must not dereference the arrays or string pointers
|
||||
** passed as the 3rd and 4th callback parameters after it returns.
|
||||
** </ul>
|
||||
*/
|
||||
int sqlite3_exec(
|
||||
@@ -762,11 +764,11 @@ struct sqlite3_file {
|
||||
** </ul>
|
||||
** xLock() upgrades the database file lock. In other words, xLock() moves the
|
||||
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
|
||||
** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
|
||||
** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
|
||||
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
|
||||
** requested lock, then the call to xLock() is a no-op.
|
||||
** xUnlock() downgrades the database file lock to either SHARED or NONE.
|
||||
* If the lock is already at or below the requested lock state, then the call
|
||||
** If the lock is already at or below the requested lock state, then the call
|
||||
** to xUnlock() is a no-op.
|
||||
** The xCheckReservedLock() method checks whether any database connection,
|
||||
** either in this process or in some other process, is holding a RESERVED,
|
||||
|
||||
+2
-3
@@ -886,7 +886,7 @@ typedef INT16_TYPE LogEst;
|
||||
# define SQLITE_PTRSIZE __SIZEOF_POINTER__
|
||||
# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
|
||||
defined(_M_ARM) || defined(__arm__) || defined(__x86) || \
|
||||
(defined(__APPLE__) && defined(__POWERPC__)) || \
|
||||
(defined(__APPLE__) && defined(__ppc__)) || \
|
||||
(defined(__TOS_AIX__) && !defined(__64BIT__))
|
||||
# define SQLITE_PTRSIZE 4
|
||||
# else
|
||||
@@ -2476,8 +2476,7 @@ struct Table {
|
||||
#define TF_HasStored 0x00000040 /* Has one or more STORED columns */
|
||||
#define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */
|
||||
#define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
|
||||
#define TF_StatsUsed 0x00000100 /* Query planner decisions affected by
|
||||
** Index.aiRowLogEst[] values */
|
||||
#define TF_MaybeReanalyze 0x00000100 /* Maybe run ANALYZE on this table */
|
||||
#define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */
|
||||
#define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */
|
||||
#define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */
|
||||
|
||||
@@ -108,6 +108,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
extern int Sqlitetest_window_Init(Tcl_Interp *);
|
||||
extern int Sqlitetestvdbecov_Init(Tcl_Interp *);
|
||||
extern int TestRecover_Init(Tcl_Interp*);
|
||||
extern int Sqlitetestintck_Init(Tcl_Interp*);
|
||||
|
||||
Tcl_CmdInfo cmdInfo;
|
||||
|
||||
@@ -175,6 +176,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
Sqlitetest_window_Init(interp);
|
||||
Sqlitetestvdbecov_Init(interp);
|
||||
TestRecover_Init(interp);
|
||||
Sqlitetestintck_Init(interp);
|
||||
|
||||
Tcl_CreateObjCommand(
|
||||
interp, "load_testfixture_extensions", load_testfixture_extensions,0,0
|
||||
|
||||
+1
-1
@@ -1069,7 +1069,7 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
assert( p->n>0 );
|
||||
assert( p->n<sizeof(p->zBuf) );
|
||||
p->iDP = p->n + exp;
|
||||
if( iRound<0 ){
|
||||
if( iRound<=0 ){
|
||||
iRound = p->iDP - iRound;
|
||||
if( iRound==0 && p->zBuf[i+1]>='5' ){
|
||||
iRound = 1;
|
||||
|
||||
+35
-13
@@ -2086,7 +2086,7 @@ case OP_RealAffinity: { /* in1 */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_OMIT_CAST
|
||||
#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_ANALYZE)
|
||||
/* Opcode: Cast P1 P2 * * *
|
||||
** Synopsis: affinity(r[P1])
|
||||
**
|
||||
@@ -6192,28 +6192,37 @@ case OP_Last: { /* jump, ncycle */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: IfSmaller P1 P2 P3 * *
|
||||
/* Opcode: IfSizeBetween P1 P2 P3 P4 *
|
||||
**
|
||||
** Estimate the number of rows in the table P1. Jump to P2 if that
|
||||
** estimate is less than approximately 2**(0.1*P3).
|
||||
** Let N be the approximate number of rows in the table or index
|
||||
** with cursor P1 and let X be 10*log2(N) if N is positive or -1
|
||||
** if N is zero. Thus X will be within the range of -1 to 640, inclusive
|
||||
** Jump to P2 if X is in between P3 and P4, inclusive.
|
||||
*/
|
||||
case OP_IfSmaller: { /* jump */
|
||||
case OP_IfSizeBetween: { /* jump */
|
||||
VdbeCursor *pC;
|
||||
BtCursor *pCrsr;
|
||||
int res;
|
||||
i64 sz;
|
||||
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
assert( pOp->p4type==P4_INT32 );
|
||||
assert( pOp->p3>=-1 && pOp->p3<=640 );
|
||||
assert( pOp->p4.i>=-1 && pOp->p4.i<=640 );
|
||||
pC = p->apCsr[pOp->p1];
|
||||
assert( pC!=0 );
|
||||
pCrsr = pC->uc.pCursor;
|
||||
assert( pCrsr );
|
||||
rc = sqlite3BtreeFirst(pCrsr, &res);
|
||||
if( rc ) goto abort_due_to_error;
|
||||
if( res==0 ){
|
||||
if( res!=0 ){
|
||||
sz = -1; /* -Infinity encoding */
|
||||
}else{
|
||||
sz = sqlite3BtreeRowCountEst(pCrsr);
|
||||
if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)<pOp->p3 ) res = 1;
|
||||
assert( sz>0 );
|
||||
sz = sqlite3LogEst((u64)sz);
|
||||
}
|
||||
res = sz>=pOp->p3 && sz<=pOp->p4.i;
|
||||
VdbeBranchTaken(res!=0,2);
|
||||
if( res ) goto jump_to_p2;
|
||||
break;
|
||||
@@ -6913,11 +6922,18 @@ case OP_CreateBtree: { /* out2 */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: SqlExec * * * P4 *
|
||||
/* Opcode: SqlExec P1 P2 * P4 *
|
||||
**
|
||||
** Run the SQL statement or statements specified in the P4 string.
|
||||
** Disable Auth and Trace callbacks while those statements are running if
|
||||
** P1 is true.
|
||||
**
|
||||
** The P1 parameter is a bitmask of options:
|
||||
**
|
||||
** 0x0001 Disable Auth and Trace callbacks while the statements
|
||||
** in P4 are running.
|
||||
**
|
||||
** 0x0002 Set db->nAnalysisLimit to P2 while the statements in
|
||||
** P4 are running.
|
||||
**
|
||||
*/
|
||||
case OP_SqlExec: {
|
||||
char *zErr;
|
||||
@@ -6925,6 +6941,7 @@ case OP_SqlExec: {
|
||||
sqlite3_xauth xAuth;
|
||||
#endif
|
||||
u8 mTrace;
|
||||
int savedAnalysisLimit;
|
||||
|
||||
sqlite3VdbeIncrWriteCounter(p, 0);
|
||||
db->nSqlExec++;
|
||||
@@ -6933,18 +6950,23 @@ case OP_SqlExec: {
|
||||
xAuth = db->xAuth;
|
||||
#endif
|
||||
mTrace = db->mTrace;
|
||||
if( pOp->p1 ){
|
||||
savedAnalysisLimit = db->nAnalysisLimit;
|
||||
if( pOp->p1 & 0x0001 ){
|
||||
#ifndef SQLITE_OMIT_AUTHORIZATION
|
||||
db->xAuth = 0;
|
||||
#endif
|
||||
db->mTrace = 0;
|
||||
}
|
||||
if( pOp->p1 & 0x0002 ){
|
||||
db->nAnalysisLimit = pOp->p2;
|
||||
}
|
||||
rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr);
|
||||
db->nSqlExec--;
|
||||
#ifndef SQLITE_OMIT_AUTHORIZATION
|
||||
db->xAuth = xAuth;
|
||||
#endif
|
||||
db->mTrace = mTrace;
|
||||
db->nAnalysisLimit = savedAnalysisLimit;
|
||||
if( zErr || rc ){
|
||||
sqlite3VdbeError(p, "%s", zErr);
|
||||
sqlite3_free(zErr);
|
||||
@@ -7101,8 +7123,8 @@ case OP_DropTrigger: {
|
||||
**
|
||||
** The register P3 contains one less than the maximum number of allowed errors.
|
||||
** At most reg(P3) errors will be reported.
|
||||
** In other words, the analysis stops as soon as reg(P1) errors are
|
||||
** seen. Reg(P1) is updated with the number of errors remaining.
|
||||
** In other words, the analysis stops as soon as reg(P3) errors are
|
||||
** seen. Reg(P3) is updated with the number of errors remaining.
|
||||
**
|
||||
** The root page numbers of all tables in the database are integers
|
||||
** stored in P4_INTARRAY argument.
|
||||
|
||||
+36
-10
@@ -4060,6 +4060,23 @@ static void serialGet(
|
||||
pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
|
||||
}
|
||||
}
|
||||
static int serialGet7(
|
||||
const unsigned char *buf, /* Buffer to deserialize from */
|
||||
Mem *pMem /* Memory cell to write value into */
|
||||
){
|
||||
u64 x = FOUR_BYTE_UINT(buf);
|
||||
u32 y = FOUR_BYTE_UINT(buf+4);
|
||||
x = (x<<32) + y;
|
||||
assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
|
||||
swapMixedEndianFloat(x);
|
||||
memcpy(&pMem->u.r, &x, sizeof(x));
|
||||
if( IsNaN(x) ){
|
||||
pMem->flags = MEM_Null;
|
||||
return 1;
|
||||
}
|
||||
pMem->flags = MEM_Real;
|
||||
return 0;
|
||||
}
|
||||
void sqlite3VdbeSerialGet(
|
||||
const unsigned char *buf, /* Buffer to deserialize from */
|
||||
u32 serial_type, /* Serial type to deserialize */
|
||||
@@ -4499,17 +4516,15 @@ int sqlite3IntFloatCompare(i64 i, double r){
|
||||
return (x<r) ? -1 : (x>r);
|
||||
}else{
|
||||
i64 y;
|
||||
double s;
|
||||
if( r<-9223372036854775808.0 ) return +1;
|
||||
if( r>=9223372036854775808.0 ) return -1;
|
||||
y = (i64)r;
|
||||
if( i<y ) return -1;
|
||||
if( i>y ) return +1;
|
||||
s = (double)i;
|
||||
testcase( doubleLt(s,r) );
|
||||
testcase( doubleLt(r,s) );
|
||||
testcase( doubleEq(r,s) );
|
||||
return (s<r) ? -1 : (s>r);
|
||||
testcase( doubleLt(((double)i),r) );
|
||||
testcase( doubleLt(r,((double)i)) );
|
||||
testcase( doubleEq(r,((double)i)) );
|
||||
return (((double)i)<r) ? -1 : (((double)i)>r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4739,7 +4754,7 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
}else if( serial_type==7 ){
|
||||
sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
|
||||
serialGet7(&aKey1[d1], &mem1);
|
||||
rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r);
|
||||
}else{
|
||||
i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]);
|
||||
@@ -4764,14 +4779,18 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
}else{
|
||||
sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
|
||||
if( serial_type==7 ){
|
||||
if( mem1.u.r<pRhs->u.r ){
|
||||
if( serialGet7(&aKey1[d1], &mem1) ){
|
||||
rc = -1; /* mem1 is a NaN */
|
||||
}else if( mem1.u.r<pRhs->u.r ){
|
||||
rc = -1;
|
||||
}else if( mem1.u.r>pRhs->u.r ){
|
||||
rc = +1;
|
||||
}else{
|
||||
assert( rc==0 );
|
||||
}
|
||||
}else{
|
||||
sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
|
||||
rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r);
|
||||
}
|
||||
}
|
||||
@@ -4841,7 +4860,14 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
/* RHS is null */
|
||||
else{
|
||||
serial_type = aKey1[idx1];
|
||||
rc = (serial_type!=0 && serial_type!=10);
|
||||
if( serial_type==0
|
||||
|| serial_type==10
|
||||
|| (serial_type==7 && serialGet7(&aKey1[d1], &mem1)!=0)
|
||||
){
|
||||
assert( rc==0 );
|
||||
}else{
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( rc!=0 ){
|
||||
|
||||
+3
-1
@@ -611,6 +611,8 @@ static int vtabCallConstructor(
|
||||
db->pVtabCtx = &sCtx;
|
||||
pTab->nTabRef++;
|
||||
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
|
||||
assert( pTab!=0 );
|
||||
assert( pTab->nTabRef>1 || rc!=SQLITE_OK );
|
||||
sqlite3DeleteTable(db, pTab);
|
||||
db->pVtabCtx = sCtx.pPrior;
|
||||
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
|
||||
@@ -633,7 +635,7 @@ static int vtabCallConstructor(
|
||||
pVTable->nRef = 1;
|
||||
if( sCtx.bDeclared==0 ){
|
||||
const char *zFormat = "vtable constructor did not declare schema: %s";
|
||||
*pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
|
||||
*pzErr = sqlite3MPrintf(db, zFormat, zModuleName);
|
||||
sqlite3VtabUnlock(pVTable);
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
|
||||
+15
-9
@@ -2975,7 +2975,9 @@ static int whereLoopAddBtreeIndex(
|
||||
}
|
||||
if( pProbe->bUnordered || pProbe->bLowQual ){
|
||||
if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
|
||||
if( pProbe->bLowQual ) opMask &= ~(WO_EQ|WO_IN|WO_IS);
|
||||
if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){
|
||||
opMask &= ~(WO_EQ|WO_IN|WO_IS);
|
||||
}
|
||||
}
|
||||
|
||||
assert( pNew->u.btree.nEq<pProbe->nColumn );
|
||||
@@ -3362,7 +3364,9 @@ static int indexMightHelpWithOrderBy(
|
||||
for(ii=0; ii<pOB->nExpr; ii++){
|
||||
Expr *pExpr = sqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr);
|
||||
if( NEVER(pExpr==0) ) continue;
|
||||
if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){
|
||||
if( (pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN)
|
||||
&& pExpr->iTable==iCursor
|
||||
){
|
||||
if( pExpr->iColumn<0 ) return 1;
|
||||
for(jj=0; jj<pIndex->nKeyCol; jj++){
|
||||
if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
|
||||
@@ -3968,7 +3972,7 @@ static int whereLoopAddBtree(
|
||||
** unique index is used (making the index functionally non-unique)
|
||||
** then the sqlite_stat1 data becomes important for scoring the
|
||||
** plan */
|
||||
pTab->tabFlags |= TF_StatsUsed;
|
||||
pTab->tabFlags |= TF_MaybeReanalyze;
|
||||
}
|
||||
#ifdef SQLITE_ENABLE_STAT4
|
||||
sqlite3Stat4ProbeFree(pBuilder->pRec);
|
||||
@@ -5462,10 +5466,9 @@ 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;
|
||||
}
|
||||
/* vvv--- See check-in [12ad822d9b827777] on 2023-03-16 ---vvv */
|
||||
assert( pWInfo->pSelect->pOrderBy==0
|
||||
|| pWInfo->nOBSat <= pWInfo->pSelect->pOrderBy->nExpr );
|
||||
}else{
|
||||
pWInfo->revMask = pFrom->revLoop;
|
||||
if( pWInfo->nOBSat<=0 ){
|
||||
@@ -5804,7 +5807,7 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
|
||||
SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
|
||||
Table *pTab = pItem->pTab;
|
||||
if( (pTab->tabFlags & TF_HasStat1)==0 ) break;
|
||||
pTab->tabFlags |= TF_StatsUsed;
|
||||
pTab->tabFlags |= TF_MaybeReanalyze;
|
||||
if( i>=1
|
||||
&& (pLoop->wsFlags & reqFlags)==reqFlags
|
||||
/* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
|
||||
@@ -6056,7 +6059,10 @@ WhereInfo *sqlite3WhereBegin(
|
||||
|
||||
/* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
|
||||
testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
|
||||
if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
|
||||
if( pOrderBy && pOrderBy->nExpr>=BMS ){
|
||||
pOrderBy = 0;
|
||||
wctrlFlags &= ~WHERE_WANT_DISTINCT;
|
||||
}
|
||||
|
||||
/* The number of tables in the FROM clause is limited by the number of
|
||||
** bits in a Bitmask
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ do_test 3.4 {
|
||||
proc busy_handler {n} { return 1 }
|
||||
do_test 3.5 {
|
||||
catchsql { PRAGMA optimize }
|
||||
} {0 {}}
|
||||
} {1 {database is locked}}
|
||||
|
||||
do_test 3.6 {
|
||||
execsql { COMMIT } db2
|
||||
|
||||
@@ -95,7 +95,7 @@ foreach {tn use_eph sql res} {
|
||||
7 0 "SELECT count(DISTINCT a) FROM t2, t1" 5
|
||||
8 1 "SELECT count(DISTINCT a+b) FROM t1, t2, t2, t2" 6
|
||||
9 0 "SELECT count(DISTINCT c) FROM t1 WHERE c=2" 1
|
||||
10 1 "SELECT count(DISTINCT t1.rowid) FROM t1, t2" 10
|
||||
10 0 "SELECT count(DISTINCT t1.rowid) FROM t1, t2" 10
|
||||
} {
|
||||
do_test 3.$tn.1 {
|
||||
set prg [db eval "EXPLAIN $sql"]
|
||||
@@ -148,6 +148,10 @@ do_execsql_test 3.0 {
|
||||
CREATE TABLE t3(x, y, z);
|
||||
INSERT INTO t3 VALUES(1,1,1);
|
||||
INSERT INTO t3 VALUES(2,2,2);
|
||||
|
||||
CREATE TABLE t4(a);
|
||||
CREATE INDEX t4a ON t4(a);
|
||||
INSERT INTO t4 VALUES(1), (2), (2), (3), (1);
|
||||
}
|
||||
|
||||
foreach {tn use_eph sql res} {
|
||||
@@ -158,6 +162,9 @@ foreach {tn use_eph sql res} {
|
||||
4 0 "SELECT count(DISTINCT f) FROM t2 GROUP BY d, e" {1 2 2 3}
|
||||
5 1 "SELECT count(DISTINCT f) FROM t2 GROUP BY d" {2 3}
|
||||
6 0 "SELECT count(DISTINCT f) FROM t2 WHERE d IS 1 GROUP BY e" {1 2 2}
|
||||
|
||||
7 0 "SELECT count(DISTINCT a) FROM t1" {4}
|
||||
8 0 "SELECT count(DISTINCT a) FROM t4" {3}
|
||||
} {
|
||||
do_test 4.$tn.1 {
|
||||
set prg [db eval "EXPLAIN $sql"]
|
||||
|
||||
@@ -50,5 +50,33 @@ do_faultsim_test 1 -faults oom* -prep {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 2.0 {
|
||||
BEGIN;
|
||||
CREATE VIRTUAL TABLE t1 USING fts3(a);
|
||||
WITH s(i) AS (
|
||||
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<50
|
||||
)
|
||||
INSERT INTO t1 SELECT 'abc def ghi jkl mno pqr' FROM s;
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
faultsim_save_and_close
|
||||
do_faultsim_test 2 -faults oom-t* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
BEGIN;
|
||||
CREATE TABLE x1(a PRIMARY KEY);
|
||||
}
|
||||
} -body {
|
||||
execsql {
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 ok} $::TMPDBERROR
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -786,6 +786,11 @@ do_test func-16.1 {
|
||||
}
|
||||
} {X'616263' NULL}
|
||||
|
||||
# Test the quote function for +Inf and -Inf
|
||||
do_execsql_test func-16.2 {
|
||||
SELECT quote(4.2e+859), quote(-7.8e+904);
|
||||
} {9.0e+999 -9.0e+999}
|
||||
|
||||
# Correctly handle function error messages that include %. Ticket #1354
|
||||
#
|
||||
do_test func-17.1 {
|
||||
|
||||
@@ -378,6 +378,20 @@ do_execsql_test json101-5.8 {
|
||||
WHERE jx.value<>jx.atom AND type NOT IN ('array','object');
|
||||
} {}
|
||||
|
||||
# 2024-02-16 https://sqlite.org/forum/forumpost/ecb94cd210
|
||||
# Regression in json_tree()/json_each(). The value column
|
||||
# should have the "J" subtype if the value is an array or
|
||||
# object.
|
||||
#
|
||||
do_execsql_test json101-5.10 {
|
||||
SELECT json_insert('{}','$.a',value) FROM json_tree('[1,2,3]') WHERE atom IS NULL;
|
||||
} {{{"a":[1,2,3]}}}
|
||||
# ^^^^^^^--- In double-quotes, a string literal, prior to bug fix
|
||||
|
||||
do_execsql_test json101-5.11 {
|
||||
SELECT json_insert('{}','$.a',value) FROM json_tree('"[1,2,3]"');
|
||||
} {{{"a":"[1,2,3]"}}}
|
||||
|
||||
do_execsql_test json101-6.1 {
|
||||
SELECT json_valid('{"a":55,"b":72,}');
|
||||
} {0}
|
||||
|
||||
@@ -306,4 +306,31 @@ do_execsql_test 13.1 {
|
||||
SELECT json('{x:''a "b" c''}');
|
||||
} {{{"x":"a \"b\" c"}}}
|
||||
|
||||
# 2024-01-31
|
||||
# Allow control characters within JSON5 string literals.
|
||||
#
|
||||
for {set c 1} {$c<=0x1f} {incr c} {
|
||||
do_execsql_test 14.$c.1 {
|
||||
SELECT json_valid('"abc' || char($c) || 'xyz"');
|
||||
} {0}
|
||||
do_execsql_test 14.$c.2 {
|
||||
SELECT json_valid('"abc' || char($c) || 'xyz"', 2);
|
||||
} {1}
|
||||
switch $c {
|
||||
8 {set e "\\b"}
|
||||
9 {set e "\\t"}
|
||||
10 {set e "\\n"}
|
||||
12 {set e "\\f"}
|
||||
13 {set e "\\r"}
|
||||
default {set e [format "\\u00%02x" $c]}
|
||||
}
|
||||
do_execsql_test 14.$c.3 {
|
||||
SELECT json('{label:"abc' || char($c) || 'xyz"}');
|
||||
} "{{\"label\":\"abc${e}xyz\"}}"
|
||||
do_execsql_test 14.$c.4 {
|
||||
SELECT jsonb('{label:"abc' || char($c) || 'xyz"}') -> '$';
|
||||
} "{{\"label\":\"abc${e}xyz\"}}"
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -46,4 +46,8 @@ foreach {id path res} {
|
||||
} $res
|
||||
}
|
||||
|
||||
do_catchsql_test jsonb01-2.0 {
|
||||
SELECT x'8ce6ffffffff171333' -> '$';
|
||||
} {1 {malformed JSON}}
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -84,7 +84,6 @@ do_test 152 {
|
||||
catchsql {INSERT INTO t1 VALUES(3,4);}
|
||||
} {1 {attempt to write a readonly database}}
|
||||
|
||||
breakpoint
|
||||
do_test 160 {
|
||||
db deserialize -maxsize 32768 $db1
|
||||
db eval {SELECT * FROM t1}
|
||||
@@ -248,6 +247,7 @@ if {[wal_is_capable]} {
|
||||
set fd [open test.db]
|
||||
fconfigure $fd -translation binary -encoding binary
|
||||
set data [read $fd [expr 20*1024]]
|
||||
close $fd
|
||||
|
||||
sqlite3 db ""
|
||||
db deserialize $data
|
||||
|
||||
+18
-6
@@ -569,11 +569,11 @@ ifcapable subquery&&compound {
|
||||
}
|
||||
|
||||
# Overflow the lemon parser stack by providing an overly complex
|
||||
# expression. Make sure that the overflow is detected and reported.
|
||||
# expression. Make sure that the overflow is detected and the
|
||||
# stack is grown automatically such that the application calling
|
||||
# SQLite never notices.
|
||||
#
|
||||
# This test fails when building with -DYYSTACKDEPTH=0
|
||||
#
|
||||
do_test misc5-7.1 {
|
||||
do_test misc5-7.1.1 {
|
||||
execsql {CREATE TABLE t1(x)}
|
||||
set sql "INSERT INTO t1 VALUES("
|
||||
set tail ""
|
||||
@@ -581,9 +581,21 @@ do_test misc5-7.1 {
|
||||
append sql "(1+"
|
||||
append tail ")"
|
||||
}
|
||||
append sql 2$tail
|
||||
append sql "0$tail); SELECT * FROM t1;"
|
||||
catchsql $sql
|
||||
} {1 {parser stack overflow}}
|
||||
} {0 200}
|
||||
do_test misc5-7.1.2 {
|
||||
execsql {DELETE FROM t1}
|
||||
set sql "INSERT INTO t1 VALUES("
|
||||
set tail ""
|
||||
for {set i 0} {$i<900} {incr i} {
|
||||
append sql "(1+"
|
||||
append tail ")"
|
||||
}
|
||||
append sql "0$tail); SELECT * FROM t1;"
|
||||
catchsql $sql
|
||||
} {0 900}
|
||||
|
||||
|
||||
# Parser stack overflow is silently ignored when it occurs while parsing the
|
||||
# schema and PRAGMA writable_schema is turned on.
|
||||
|
||||
+8
-8
@@ -45,18 +45,18 @@ proc register_rblob_code {dbname seed} {
|
||||
}
|
||||
|
||||
|
||||
# For cases 1.1 and 1.4, the number of pages read using xRead() is 4 on
|
||||
# unix and 9 on windows. The difference is that windows only ever maps
|
||||
# For cases 1.1 and 1.4, the number of pages read using xRead() is 8 on
|
||||
# unix and 12 on windows. The difference is that windows only ever maps
|
||||
# an integer number of OS pages (i.e. creates mappings that are a multiple
|
||||
# of 4KB in size). Whereas on unix any sized mapping may be created.
|
||||
#
|
||||
foreach {t mmap_size nRead c2init} {
|
||||
1.1 { PRAGMA mmap_size = 67108864 } /[49]/ {PRAGMA mmap_size = 0}
|
||||
1.2 { PRAGMA mmap_size = 53248 } 150 {PRAGMA mmap_size = 0}
|
||||
1.3 { PRAGMA mmap_size = 0 } 344 {PRAGMA mmap_size = 0}
|
||||
1.4 { PRAGMA mmap_size = 67108864 } /[49]/ {PRAGMA mmap_size = 67108864 }
|
||||
1.5 { PRAGMA mmap_size = 53248 } 150 {PRAGMA mmap_size = 67108864 }
|
||||
1.6 { PRAGMA mmap_size = 0 } 344 {PRAGMA mmap_size = 67108864 }
|
||||
1.1 { PRAGMA mmap_size = 67108864 } /8|12/ {PRAGMA mmap_size = 0}
|
||||
1.2 { PRAGMA mmap_size = 53248 } /15[34]/ {PRAGMA mmap_size = 0}
|
||||
1.3 { PRAGMA mmap_size = 0 } 344 {PRAGMA mmap_size = 0}
|
||||
1.4 { PRAGMA mmap_size = 67108864 } /12|8/ {PRAGMA mmap_size = 67108864 }
|
||||
1.5 { PRAGMA mmap_size = 53248 } /15[34]/ {PRAGMA mmap_size = 67108864 }
|
||||
1.6 { PRAGMA mmap_size = 0 } 344 {PRAGMA mmap_size = 67108864 }
|
||||
} {
|
||||
|
||||
do_multiclient_test tn {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# 2024 January 23
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# Test special cases of corrupt database handling in mmap-mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix mmapcorrupt
|
||||
|
||||
database_may_be_corrupt
|
||||
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_lookaside 0 0
|
||||
sqlite3_initialize
|
||||
|
||||
reset_db
|
||||
do_execsql_test 1.0 {
|
||||
PRAGMA page_size = 16384;
|
||||
CREATE TABLE tn1(a PRIMARY KEY) WITHOUT ROWID;
|
||||
CREATE TABLE t0(a PRIMARY KEY) WITHOUT ROWID;
|
||||
CREATE TABLE t1(a PRIMARY KEY) WITHOUT ROWID;
|
||||
INSERT INTO t1 VALUES('B');
|
||||
}
|
||||
db close
|
||||
|
||||
set sz [file size test.db]
|
||||
hexio_write test.db [expr $sz-3] 800380
|
||||
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 2.1 {
|
||||
PRAGMA mmap_size = 1000000;
|
||||
SELECT sql FROM sqlite_schema LIMIT 1;
|
||||
SELECT * FROM t0;
|
||||
} {1000000 {CREATE TABLE tn1(a PRIMARY KEY) WITHOUT ROWID}}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
INSERT INTO t0 SELECT * FROM t1;
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -95,6 +95,7 @@ foreach f [glob -nocomplain \
|
||||
$testdir/../ext/lsm1/test/*.test \
|
||||
$testdir/../ext/recover/*.test \
|
||||
$testdir/../ext/rbu/*.test \
|
||||
$testdir/../ext/intck/*.test \
|
||||
] {
|
||||
lappend alltests $f
|
||||
}
|
||||
|
||||
@@ -556,6 +556,21 @@ ifcapable altertable {
|
||||
do_execsql_test pragma-3.23 {
|
||||
PRAGMA integrity_check(1);
|
||||
} {{non-unique entry in index t1a}}
|
||||
|
||||
# forum post https://sqlite.org/forum/forumpost/ee4f6fa5ab
|
||||
do_execsql_test pragma-3.24 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
ALTER TABLE t1 ADD COLUMN b NOT NULL DEFAULT 0.25;
|
||||
SELECT * FROM t1;
|
||||
PRAGMA integrity_check(t1);
|
||||
} {1 0.25 ok}
|
||||
do_execsql_test pragma-3.25 {
|
||||
ALTER TABLE t1 ADD COLUMN c CHECK (1);
|
||||
SELECT * FROM t1;
|
||||
PRAGMA integrity_check(t1);
|
||||
} {1 0.25 {} ok}
|
||||
}
|
||||
|
||||
# PRAGMA integrity check (or more specifically the sqlite3BtreeCount()
|
||||
|
||||
@@ -3833,4 +3833,21 @@ do_execsql_test printf-18.1 {
|
||||
SELECT length( format('%,.249f', -5.0e-300) );
|
||||
} {252}
|
||||
|
||||
# 2024-02-16
|
||||
# https://sqlite.org/forum/info/393708f4a8
|
||||
#
|
||||
# The problem introduced by on 2023-07-03 by
|
||||
# https://sqlite.org/src/info/32befb224b254639
|
||||
#
|
||||
do_execsql_test printf-19.1 {
|
||||
SELECT format('%0.0f %0.0g %0.0g', 0.9, 0.09, 1.9);
|
||||
} {{1 0.09 2}}
|
||||
do_execsql_test printf-19.2 {
|
||||
SELECT format('%0.0f %#0.0f',0.0, 0.0);
|
||||
} {{0 0.}}
|
||||
do_execsql_test printf-19.3 {
|
||||
SELECT format('%,.0f %,.0f',12345e+10, 12345e+11);
|
||||
} {{123,450,000,000,000 1,234,500,000,000,000}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
+5
-5
@@ -103,7 +103,7 @@ foreach {tn sql errname} {
|
||||
3 { CREATE INDEX i3 ON t1("w") } w
|
||||
4 { CREATE INDEX i4 ON t1(x) WHERE z="w" } w
|
||||
} {
|
||||
do_catchsql_test 2.1.$tn $sql [list 1 "no such column: $errname"]
|
||||
do_catchsql_test 2.1.$tn $sql [list 1 "no such column: \"$errname\" - should this be a string literal in single-quotes?"]
|
||||
}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
@@ -147,19 +147,19 @@ ifcapable altertable {
|
||||
CREATE TABLE t1(a,b);
|
||||
CREATE INDEX x1 on t1("b");
|
||||
ALTER TABLE t1 DROP COLUMN b;
|
||||
} {1 {error in index x1 after drop column: no such column: b}}
|
||||
} {1 {error in index x1 after drop column: no such column: "b" - should this be a string literal in single-quotes?}}
|
||||
do_catchsql_test 3.1 {
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a,"b");
|
||||
CREATE INDEX x1 on t1("b");
|
||||
ALTER TABLE t1 DROP COLUMN b;
|
||||
} {1 {error in index x1 after drop column: no such column: b}}
|
||||
} {1 {error in index x1 after drop column: no such column: "b" - should this be a string literal in single-quotes?}}
|
||||
do_catchsql_test 3.2 {
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a,'b');
|
||||
CREATE INDEX x1 on t1("b");
|
||||
ALTER TABLE t1 DROP COLUMN b;
|
||||
} {1 {error in index x1 after drop column: no such column: b}}
|
||||
} {1 {error in index x1 after drop column: no such column: "b" - should this be a string literal in single-quotes?}}
|
||||
do_catchsql_test 3.3 {
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a,"b");
|
||||
@@ -172,7 +172,7 @@ ifcapable altertable {
|
||||
CREATE INDEX x1 ON t1("a"||"b");
|
||||
INSERT INTO t1 VALUES(1,2,3),(1,4,5);
|
||||
ALTER TABLE t1 DROP COLUMN b;
|
||||
} {1 {error in index x1 after drop column: no such column: b}}
|
||||
} {1 {error in index x1 after drop column: no such column: "b" - should this be a string literal in single-quotes?}}
|
||||
sqlite3_db_config db SQLITE_DBCONFIG_DQS_DDL 1
|
||||
do_catchsql_test 3.5 {
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -707,6 +707,7 @@ if {$SQLITE_MAX_EXPR_DEPTH==0} {
|
||||
}]
|
||||
} "1 {Expression tree is too large (maximum depth $::SQLITE_MAX_EXPR_DEPTH)}"
|
||||
|
||||
if 0 {
|
||||
# Attempting to beat the expression depth limit using nested SELECT
|
||||
# queries causes a parser stack overflow.
|
||||
do_test sqllimits1-9.2 {
|
||||
@@ -718,7 +719,6 @@ if {$SQLITE_MAX_EXPR_DEPTH==0} {
|
||||
catchsql [subst { $expr }]
|
||||
} "1 {parser stack overflow}"
|
||||
|
||||
if 0 {
|
||||
do_test sqllimits1-9.3 {
|
||||
execsql {
|
||||
PRAGMA max_page_count = 1000000; -- 1 GB
|
||||
|
||||
+41
-2
@@ -418,6 +418,8 @@ struct lemon {
|
||||
char *filename; /* Name of the input file */
|
||||
char *outname; /* Name of the current output file */
|
||||
char *tokenprefix; /* A prefix added to token names in the .h file */
|
||||
char *reallocFunc; /* Function to use to allocate stack space */
|
||||
char *freeFunc; /* Function to use to free stack space */
|
||||
int nconflict; /* Number of parsing conflicts */
|
||||
int nactiontab; /* Number of entries in the yy_action[] table */
|
||||
int nlookaheadtab; /* Number of entries in yy_lookahead[] */
|
||||
@@ -2531,6 +2533,12 @@ static void parseonetoken(struct pstate *psp)
|
||||
}else if( strcmp(x,"default_type")==0 ){
|
||||
psp->declargslot = &(psp->gp->vartype);
|
||||
psp->insertLineMacro = 0;
|
||||
}else if( strcmp(x,"realloc")==0 ){
|
||||
psp->declargslot = &(psp->gp->reallocFunc);
|
||||
psp->insertLineMacro = 0;
|
||||
}else if( strcmp(x,"free")==0 ){
|
||||
psp->declargslot = &(psp->gp->freeFunc);
|
||||
psp->insertLineMacro = 0;
|
||||
}else if( strcmp(x,"stack_size")==0 ){
|
||||
psp->declargslot = &(psp->gp->stacksize);
|
||||
psp->insertLineMacro = 0;
|
||||
@@ -4309,7 +4317,7 @@ void ReportTable(
|
||||
struct action *ap;
|
||||
struct rule *rp;
|
||||
struct acttab *pActtab;
|
||||
int i, j, n, sz;
|
||||
int i, j, n, sz, mn, mx;
|
||||
int nLookAhead;
|
||||
int szActionType; /* sizeof(YYACTIONTYPE) */
|
||||
int szCodeType; /* sizeof(YYCODETYPE) */
|
||||
@@ -4501,6 +4509,21 @@ void ReportTable(
|
||||
fprintf(out,"#define %sARG_FETCH\n",name); lineno++;
|
||||
fprintf(out,"#define %sARG_STORE\n",name); lineno++;
|
||||
}
|
||||
if( lemp->reallocFunc ){
|
||||
fprintf(out,"#define YYREALLOC %s\n", lemp->reallocFunc); lineno++;
|
||||
}else{
|
||||
fprintf(out,"#define YYREALLOC realloc\n"); lineno++;
|
||||
}
|
||||
if( lemp->freeFunc ){
|
||||
fprintf(out,"#define YYFREE %s\n", lemp->freeFunc); lineno++;
|
||||
}else{
|
||||
fprintf(out,"#define YYFREE free\n"); lineno++;
|
||||
}
|
||||
if( lemp->reallocFunc && lemp->freeFunc ){
|
||||
fprintf(out,"#define YYDYNSTACK 1\n"); lineno++;
|
||||
}else{
|
||||
fprintf(out,"#define YYDYNSTACK 0\n"); lineno++;
|
||||
}
|
||||
if( lemp->ctx && lemp->ctx[0] ){
|
||||
i = lemonStrlen(lemp->ctx);
|
||||
while( i>=1 && ISSPACE(lemp->ctx[i-1]) ) i--;
|
||||
@@ -4624,6 +4647,22 @@ void ReportTable(
|
||||
fprintf(out,"#define YY_MIN_REDUCE %d\n", lemp->minReduce); lineno++;
|
||||
i = lemp->minReduce + lemp->nrule;
|
||||
fprintf(out,"#define YY_MAX_REDUCE %d\n", i-1); lineno++;
|
||||
|
||||
/* Minimum and maximum token values that have a destructor */
|
||||
mn = mx = 0;
|
||||
for(i=0; i<lemp->nsymbol; i++){
|
||||
struct symbol *sp = lemp->symbols[i];
|
||||
|
||||
if( sp && sp->type!=TERMINAL && sp->destructor ){
|
||||
if( mn==0 || sp->index<mn ) mn = sp->index;
|
||||
if( sp->index>mx ) mx = sp->index;
|
||||
}
|
||||
}
|
||||
if( lemp->tokendest ) mn = 0;
|
||||
if( lemp->vardest ) mx = lemp->nsymbol-1;
|
||||
fprintf(out,"#define YY_MIN_DSTRCTR %d\n", mn); lineno++;
|
||||
fprintf(out,"#define YY_MAX_DSTRCTR %d\n", mx); lineno++;
|
||||
|
||||
tplt_xfer(lemp->name,in,out,&lineno);
|
||||
|
||||
/* Now output the action table and its associates:
|
||||
@@ -4767,7 +4806,7 @@ void ReportTable(
|
||||
/* Generate the table of fallback tokens.
|
||||
*/
|
||||
if( lemp->has_fallback ){
|
||||
int mx = lemp->nterminal - 1;
|
||||
mx = lemp->nterminal - 1;
|
||||
/* 2019-08-28: Generate fallback entries for every token to avoid
|
||||
** having to do a range check on the index */
|
||||
/* while( mx>0 && lemp->symbols[mx]->fallback==0 ){ mx--; } */
|
||||
|
||||
+75
-57
@@ -67,6 +67,9 @@
|
||||
** ParseARG_STORE Code to store %extra_argument into yypParser
|
||||
** ParseARG_FETCH Code to extract %extra_argument from yypParser
|
||||
** ParseCTX_* As ParseARG_ except for %extra_context
|
||||
** YYREALLOC Name of the realloc() function to use
|
||||
** YYFREE Name of the free() function to use
|
||||
** YYDYNSTACK True if stack space should be extended on heap
|
||||
** YYERRORSYMBOL is the code number of the error symbol. If not
|
||||
** defined, then do no error processing.
|
||||
** YYNSTATE the combined number of states.
|
||||
@@ -80,6 +83,8 @@
|
||||
** YY_NO_ACTION The yy_action[] code for no-op
|
||||
** YY_MIN_REDUCE Minimum value for reduce actions
|
||||
** YY_MAX_REDUCE Maximum value for reduce actions
|
||||
** YY_MIN_DSTRCTR Minimum symbol value that has a destructor
|
||||
** YY_MAX_DSTRCTR Maximum symbol value that has a destructor
|
||||
*/
|
||||
#ifndef INTERFACE
|
||||
# define INTERFACE 1
|
||||
@@ -101,6 +106,22 @@
|
||||
# define yytestcase(X)
|
||||
#endif
|
||||
|
||||
/* Macro to determine if stack space has the ability to grow using
|
||||
** heap memory.
|
||||
*/
|
||||
#if YYSTACKDEPTH<=0 || YYDYNSTACK
|
||||
# define YYGROWABLESTACK 1
|
||||
#else
|
||||
# define YYGROWABLESTACK 0
|
||||
#endif
|
||||
|
||||
/* Guarantee a minimum number of initial stack slots.
|
||||
*/
|
||||
#if YYSTACKDEPTH<=0
|
||||
# undef YYSTACKDEPTH
|
||||
# define YYSTACKDEPTH 2 /* Need a minimum stack size */
|
||||
#endif
|
||||
|
||||
|
||||
/* Next are the tables used to determine what action to take based on the
|
||||
** current state and lookahead token. These tables are used to implement
|
||||
@@ -212,14 +233,9 @@ struct yyParser {
|
||||
#endif
|
||||
ParseARG_SDECL /* A place to hold %extra_argument */
|
||||
ParseCTX_SDECL /* A place to hold %extra_context */
|
||||
#if YYSTACKDEPTH<=0
|
||||
int yystksz; /* Current side of the stack */
|
||||
yyStackEntry *yystack; /* The parser's stack */
|
||||
yyStackEntry yystk0; /* First stack entry */
|
||||
#else
|
||||
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
|
||||
yyStackEntry *yystackEnd; /* Last entry in the stack */
|
||||
#endif
|
||||
yyStackEntry *yystackEnd; /* Last entry in the stack */
|
||||
yyStackEntry *yystack; /* The parser stack */
|
||||
yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */
|
||||
};
|
||||
typedef struct yyParser yyParser;
|
||||
|
||||
@@ -273,37 +289,45 @@ static const char *const yyRuleName[] = {
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
||||
#if YYSTACKDEPTH<=0
|
||||
#if YYGROWABLESTACK
|
||||
/*
|
||||
** Try to increase the size of the parser stack. Return the number
|
||||
** of errors. Return 0 on success.
|
||||
*/
|
||||
static int yyGrowStack(yyParser *p){
|
||||
int oldSize = 1 + (int)(p->yystackEnd - p->yystack);
|
||||
int newSize;
|
||||
int idx;
|
||||
yyStackEntry *pNew;
|
||||
|
||||
newSize = p->yystksz*2 + 100;
|
||||
idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
|
||||
if( p->yystack==&p->yystk0 ){
|
||||
pNew = malloc(newSize*sizeof(pNew[0]));
|
||||
if( pNew ) pNew[0] = p->yystk0;
|
||||
newSize = oldSize*2 + 100;
|
||||
idx = (int)(p->yytos - p->yystack);
|
||||
if( p->yystack==p->yystk0 ){
|
||||
pNew = YYREALLOC(0, newSize*sizeof(pNew[0]));
|
||||
if( pNew==0 ) return 1;
|
||||
memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0]));
|
||||
}else{
|
||||
pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
|
||||
pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0]));
|
||||
if( pNew==0 ) return 1;
|
||||
}
|
||||
if( pNew ){
|
||||
p->yystack = pNew;
|
||||
p->yytos = &p->yystack[idx];
|
||||
p->yystack = pNew;
|
||||
p->yytos = &p->yystack[idx];
|
||||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
||||
yyTracePrompt, p->yystksz, newSize);
|
||||
}
|
||||
#endif
|
||||
p->yystksz = newSize;
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
||||
yyTracePrompt, oldSize, newSize);
|
||||
}
|
||||
return pNew==0;
|
||||
#endif
|
||||
p->yystackEnd = &p->yystack[newSize-1];
|
||||
return 0;
|
||||
}
|
||||
#endif /* YYGROWABLESTACK */
|
||||
|
||||
#if !YYGROWABLESTACK
|
||||
/* For builds that do no have a growable stack, yyGrowStack always
|
||||
** returns an error.
|
||||
*/
|
||||
# define yyGrowStack(X) 1
|
||||
#endif
|
||||
|
||||
/* Datatype of the argument to the memory allocated passed as the
|
||||
@@ -323,24 +347,14 @@ void ParseInit(void *yypRawParser ParseCTX_PDECL){
|
||||
#ifdef YYTRACKMAXSTACKDEPTH
|
||||
yypParser->yyhwm = 0;
|
||||
#endif
|
||||
#if YYSTACKDEPTH<=0
|
||||
yypParser->yytos = NULL;
|
||||
yypParser->yystack = NULL;
|
||||
yypParser->yystksz = 0;
|
||||
if( yyGrowStack(yypParser) ){
|
||||
yypParser->yystack = &yypParser->yystk0;
|
||||
yypParser->yystksz = 1;
|
||||
}
|
||||
#endif
|
||||
yypParser->yystack = yypParser->yystk0;
|
||||
yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
|
||||
#ifndef YYNOERRORRECOVERY
|
||||
yypParser->yyerrcnt = -1;
|
||||
#endif
|
||||
yypParser->yytos = yypParser->yystack;
|
||||
yypParser->yystack[0].stateno = 0;
|
||||
yypParser->yystack[0].major = 0;
|
||||
#if YYSTACKDEPTH>0
|
||||
yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef Parse_ENGINEALWAYSONSTACK
|
||||
@@ -426,9 +440,26 @@ static void yy_pop_parser_stack(yyParser *pParser){
|
||||
*/
|
||||
void ParseFinalize(void *p){
|
||||
yyParser *pParser = (yyParser*)p;
|
||||
while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
|
||||
#if YYSTACKDEPTH<=0
|
||||
if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
|
||||
|
||||
/* In-lined version of calling yy_pop_parser_stack() for each
|
||||
** element left in the stack */
|
||||
yyStackEntry *yytos = pParser->yytos;
|
||||
while( yytos>pParser->yystack ){
|
||||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sPopping %s\n",
|
||||
yyTracePrompt,
|
||||
yyTokenName[yytos->major]);
|
||||
}
|
||||
#endif
|
||||
if( yytos->major>=YY_MIN_DSTRCTR ){
|
||||
yy_destructor(pParser, yytos->major, &yytos->minor);
|
||||
}
|
||||
yytos--;
|
||||
}
|
||||
|
||||
#if YYGROWABLESTACK
|
||||
if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -654,25 +685,19 @@ static void yy_shift(
|
||||
assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
|
||||
}
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yytos>yypParser->yystackEnd ){
|
||||
yypParser->yytos--;
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
|
||||
yytos = yypParser->yytos;
|
||||
if( yytos>yypParser->yystackEnd ){
|
||||
if( yyGrowStack(yypParser) ){
|
||||
yypParser->yytos--;
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
}
|
||||
yytos = yypParser->yytos;
|
||||
assert( yytos <= yypParser->yystackEnd );
|
||||
}
|
||||
#endif
|
||||
if( yyNewState > YY_MAX_SHIFT ){
|
||||
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
||||
}
|
||||
yytos = yypParser->yytos;
|
||||
yytos->stateno = yyNewState;
|
||||
yytos->major = yyMajor;
|
||||
yytos->minor.yy0 = yyMinor;
|
||||
@@ -911,19 +936,12 @@ void Parse(
|
||||
(int)(yypParser->yytos - yypParser->yystack));
|
||||
}
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yytos>=yypParser->yystackEnd ){
|
||||
yyStackOverflow(yypParser);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
|
||||
if( yyGrowStack(yypParser) ){
|
||||
yyStackOverflow(yypParser);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM);
|
||||
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
|
||||
|
||||
+24
-3
@@ -17,7 +17,7 @@
|
||||
# After the "tsrc" directory has been created and populated, run
|
||||
# this script:
|
||||
#
|
||||
# tclsh mksqlite3c.tcl
|
||||
# tclsh mksqlite3c.tcl [flags] [extra source files]
|
||||
#
|
||||
# The amalgamated SQLite code will be written into sqlite3.c
|
||||
#
|
||||
@@ -42,6 +42,7 @@ set linemacros 0
|
||||
set useapicall 0
|
||||
set enable_recover 0
|
||||
set srcdir tsrc
|
||||
set extrasrc [list]
|
||||
|
||||
for {set i 0} {$i<[llength $argv]} {incr i} {
|
||||
set x [lindex $argv $i]
|
||||
@@ -63,8 +64,10 @@ for {set i 0} {$i<[llength $argv]} {incr i} {
|
||||
} elseif {[regexp {^-?-((help)|\?)$} $x]} {
|
||||
puts $help
|
||||
exit 0
|
||||
} else {
|
||||
} elseif {[regexp {^-?-} $x]} {
|
||||
error "unknown command-line option: $x"
|
||||
} else {
|
||||
lappend extrasrc $x
|
||||
}
|
||||
}
|
||||
set in [open $srcdir/sqlite3.h]
|
||||
@@ -349,6 +352,21 @@ proc copy_file {filename} {
|
||||
section_comment "End of $tail"
|
||||
}
|
||||
|
||||
# Read the source file named $filename and write it into the
|
||||
# sqlite3.c output file. The only transformation is the trimming
|
||||
# of EOL whitespace.
|
||||
#
|
||||
proc copy_file_verbatim {filename} {
|
||||
global out
|
||||
set in [open $filename r]
|
||||
set tail [file tail $filename]
|
||||
section_comment "Begin EXTRA_SRC file $tail"
|
||||
while {![eof $in]} {
|
||||
set line [string trimright [gets $in]]
|
||||
puts $out $line
|
||||
}
|
||||
section_comment "End of EXTRA_SRC $tail"
|
||||
}
|
||||
|
||||
# Process the source files. Process files containing commonly
|
||||
# used subroutines first in order to help the compiler find
|
||||
@@ -470,13 +488,16 @@ set flist {
|
||||
sqlite3session.c
|
||||
fts5.c
|
||||
stmt.c
|
||||
}
|
||||
}
|
||||
if {$enable_recover} {
|
||||
lappend flist sqlite3recover.c dbdata.c
|
||||
}
|
||||
foreach file $flist {
|
||||
copy_file $srcdir/$file
|
||||
}
|
||||
foreach file $extrasrc {
|
||||
copy_file_verbatim $file
|
||||
}
|
||||
|
||||
puts $out \
|
||||
"/* Return the source-id for this library */
|
||||
|
||||
Reference in New Issue
Block a user