Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0bbe4e9c2 | |||
| 2fb960b545 | |||
| 8b471e7e79 | |||
| 6559e2cec7 | |||
| 6be95366c7 | |||
| bd8fcc130a | |||
| 6e11b16282 | |||
| 59a386ea03 | |||
| 3144df1264 | |||
| a5e906f307 | |||
| 210ec4c855 | |||
| af38cdbc08 | |||
| d5fbde80a2 | |||
| 7df7475d0d | |||
| 169dd928c5 | |||
| a22dd3860a | |||
| 7f2d1cd2b0 | |||
| 54ac445d53 | |||
| 45e7d7dd1c | |||
| 65c2a71042 | |||
| c456a76fb3 | |||
| c45fdb2a7f | |||
| f383f35e6c | |||
| bd11a2acbb | |||
| e9acf4b48e | |||
| 0282c03abc | |||
| 2c2f392dca |
+2
-2
@@ -1744,7 +1744,7 @@ static int fts3CursorSeekStmt(Fts3Cursor *pCsr){
|
||||
}else{
|
||||
zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
|
||||
if( !zSql ) return SQLITE_NOMEM;
|
||||
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
|
||||
rc = sqlite3_prepare_v3(p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0);
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
|
||||
@@ -3281,7 +3281,7 @@ static int fts3FilterMethod(
|
||||
);
|
||||
}
|
||||
if( zSql ){
|
||||
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
|
||||
rc = sqlite3_prepare_v3(p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0);
|
||||
sqlite3_free(zSql);
|
||||
}else{
|
||||
rc = SQLITE_NOMEM;
|
||||
|
||||
@@ -407,7 +407,8 @@ static int fts3SqlStmt(
|
||||
if( !zSql ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL);
|
||||
rc = sqlite3_prepare_v3(p->db, zSql, -1, SQLITE_PREPARE_PERSISTENT,
|
||||
&pStmt, NULL);
|
||||
sqlite3_free(zSql);
|
||||
assert( rc==SQLITE_OK || pStmt==0 );
|
||||
p->aStmt[eStmt] = pStmt;
|
||||
|
||||
@@ -728,7 +728,8 @@ static int fts5IndexPrepareStmt(
|
||||
){
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( zSql ){
|
||||
p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0);
|
||||
p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
|
||||
SQLITE_PREPARE_PERSISTENT, ppStmt, 0);
|
||||
}else{
|
||||
p->rc = SQLITE_NOMEM;
|
||||
}
|
||||
@@ -777,7 +778,8 @@ static void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0);
|
||||
rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
|
||||
SQLITE_PREPARE_PERSISTENT, &p->pDeleter, 0);
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
|
||||
@@ -883,7 +883,8 @@ static int fts5PrepareStatement(
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0);
|
||||
rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
|
||||
SQLITE_PREPARE_PERSISTENT, &pRet, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
*pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db));
|
||||
}
|
||||
@@ -1019,7 +1020,8 @@ static int fts5FindRankFunction(Fts5Cursor *pCsr){
|
||||
char *zSql = sqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs);
|
||||
if( zSql ){
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pStmt, 0);
|
||||
rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
|
||||
SQLITE_PREPARE_PERSISTENT, &pStmt, 0);
|
||||
sqlite3_free(zSql);
|
||||
assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 );
|
||||
if( rc==SQLITE_OK ){
|
||||
|
||||
@@ -136,7 +136,8 @@ static int fts5StorageGetStmt(
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(pC->db, zSql, -1, &p->aStmt[eStmt], 0);
|
||||
rc = sqlite3_prepare_v3(pC->db, zSql, -1,
|
||||
SQLITE_PREPARE_PERSISTENT, &p->aStmt[eStmt], 0);
|
||||
sqlite3_free(zSql);
|
||||
if( rc!=SQLITE_OK && pzErrMsg ){
|
||||
*pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# 2014 June 17
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing the FTS5 module.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5leftjoin
|
||||
|
||||
# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE vt USING fts5(x);
|
||||
INSERT INTO vt VALUES('abc');
|
||||
INSERT INTO vt VALUES('xyz');
|
||||
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES(1), (2);
|
||||
}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
SELECT * FROM t1 LEFT JOIN (
|
||||
SELECT rowid AS rrr, * FROM vt WHERE vt MATCH 'abc'
|
||||
) ON t1.a = rrr
|
||||
} {1 1 abc 2 {} {}}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
SELECT * FROM t1 LEFT JOIN vt ON (vt MATCH 'abc')
|
||||
} {1 abc 2 abc}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ struct CsvReader {
|
||||
int n; /* Number of bytes in z */
|
||||
int nAlloc; /* Space allocated for z[] */
|
||||
int nLine; /* Current line number */
|
||||
int bNotFirst; /* True if prior text has been seen */
|
||||
char cTerm; /* Character that terminated the most recent field */
|
||||
size_t iIn; /* Next unread character in the input buffer */
|
||||
size_t nIn; /* Number of characters in the input buffer */
|
||||
@@ -91,6 +92,7 @@ static void csv_reader_init(CsvReader *p){
|
||||
p->n = 0;
|
||||
p->nAlloc = 0;
|
||||
p->nLine = 0;
|
||||
p->bNotFirst = 0;
|
||||
p->nIn = 0;
|
||||
p->zIn = 0;
|
||||
p->zErr[0] = 0;
|
||||
@@ -251,6 +253,21 @@ static char *csv_read_one_field(CsvReader *p){
|
||||
pc = c;
|
||||
}
|
||||
}else{
|
||||
/* If this is the first field being parsed and it begins with the
|
||||
** UTF-8 BOM (0xEF BB BF) then skip the BOM */
|
||||
if( (c&0xff)==0xef && p->bNotFirst==0 ){
|
||||
csv_append(p, (char)c);
|
||||
c = csv_getc(p);
|
||||
if( (c&0xff)==0xbb ){
|
||||
csv_append(p, (char)c);
|
||||
c = csv_getc(p);
|
||||
if( (c&0xff)==0xbf ){
|
||||
p->bNotFirst = 1;
|
||||
p->n = 0;
|
||||
return csv_read_one_field(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
while( c>',' || (c!=EOF && c!=',' && c!='\n') ){
|
||||
if( csv_append(p, (char)c) ) return 0;
|
||||
c = csv_getc(p);
|
||||
@@ -262,6 +279,7 @@ static char *csv_read_one_field(CsvReader *p){
|
||||
p->cTerm = (char)c;
|
||||
}
|
||||
if( p->z ) p->z[p->n] = 0;
|
||||
p->bNotFirst = 1;
|
||||
return p->z;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -3361,7 +3361,8 @@ static int rtreeSqlInit(
|
||||
for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){
|
||||
char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix);
|
||||
if( zSql ){
|
||||
rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0);
|
||||
rc = sqlite3_prepare_v3(db, zSql, -1, SQLITE_PREPARE_PERSISTENT,
|
||||
appStmt[i], 0);
|
||||
}else{
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
C Experimental\s"PRAGMA\ssecure_delete=FAST"\spragma.\s\sThe\sintent\sis\sto\soverwrite\ndeleted\scontent\swith\szeros\swithout\sincreasing\sthe\samount\sof\sdisk\sI/O.
|
||||
D 2017-06-19T11:44:22.399
|
||||
C Incorporate\srecent\strunk\schanges.
|
||||
D 2017-06-28T15:56:58.652
|
||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
|
||||
@@ -70,7 +70,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
|
||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
|
||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||
F ext/fts3/fts3.c 88ea5c444fdf262b4eb7b5872b9a3192b8b8d0df8cc9735c5aed159ec5dae02a
|
||||
F ext/fts3/fts3.c 6c5543ce771db11d27793fb696564ef5e977116671353a0d5c22056aba73055e
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h eb2502000148e80913b965db3e59f29251266d0a
|
||||
F ext/fts3/fts3_aux.c 9edc3655fcb287f0467d0a4b886a01c6185fe9f1
|
||||
@@ -88,7 +88,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
|
||||
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
|
||||
F ext/fts3/fts3_unicode.c 525a3bd9a7564603c5c061b7de55403a565307758a94600e8a2f6b00d1c40d9d
|
||||
F ext/fts3/fts3_unicode2.c cc04fc672bfd42b1e650398cb0bf71f64f9aae032cfe75bbcfe75b9cf966029c
|
||||
F ext/fts3/fts3_write.c a51d48d646974ee2fb4b17fcd5da0416a5759a32dcacc2cce2ba00d5a767848e
|
||||
F ext/fts3/fts3_write.c a3f7bf869622d1d0aa66661ba71d88e6f9646d69a2c335f40a0addf25974db47
|
||||
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
||||
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
||||
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
|
||||
@@ -105,9 +105,9 @@ F ext/fts5/fts5_buffer.c 1dd1ec0446b3acfc2d7d407eb894762a461613e2695273f48e449bf
|
||||
F ext/fts5/fts5_config.c 5af9c360e99669d29f06492c370892394aba0857
|
||||
F ext/fts5/fts5_expr.c f2825f714d91bbe62ab5820aee9ad12e0c94205b2a01725eaa9072415ae9ff1c
|
||||
F ext/fts5/fts5_hash.c 32be400cf761868c9db33efe81a06eb19a17c5402ad477ee9efb51301546dd55
|
||||
F ext/fts5/fts5_index.c cdceac47287c66500214ee946ca871ac48027a82a0ca82177c1c6af19f181ca0
|
||||
F ext/fts5/fts5_main.c 1ba0e7806886c1bc16e20d0dde1c2b535d1aeb98cbbb937c4c3e064af5ac6f03
|
||||
F ext/fts5/fts5_storage.c 7750986004f3f0c94619a85ecb5dd6cbef53e5e3853488e8a906c269d4d11db6
|
||||
F ext/fts5/fts5_index.c 2ce9d50ec5508b8205615aad69e1c9b2c77f017f21d4479e1fb2079c01fdd017
|
||||
F ext/fts5/fts5_main.c f32b3b878c21df7bd4ea4c096c7d4b36f3fa40b216899ddf29d2eb9b47053069
|
||||
F ext/fts5/fts5_storage.c fb5ef3c27073f67ade2e1bea08405f9e43f68f5f3676ed0ab7013bce5ba10be6
|
||||
F ext/fts5/fts5_tcl.c 4a901f00c8553740dba63511603f5527d741c26a
|
||||
F ext/fts5/fts5_test_mi.c 783b86697ebf773c18fc109992426c0173a055bc
|
||||
F ext/fts5/fts5_test_tok.c ffd657dd67e7fcdb31bf63fb60b6d867299a581d0f46e97086abacd66c2a9b26
|
||||
@@ -168,6 +168,7 @@ F ext/fts5/test/fts5fuzz1.test bece4695fc169b61ab236ada7931c6e4942cbef9
|
||||
F ext/fts5/test/fts5hash.test 06f9309ccb4d5050a131594e9e47d0b21456837d
|
||||
F ext/fts5/test/fts5integrity.test f5e4f8d284385875068ad0f3e894ce43e9de835d
|
||||
F ext/fts5/test/fts5lastrowid.test 4fac1aba696dd6c956e03b0cf91f6f1f3aaec494
|
||||
F ext/fts5/test/fts5leftjoin.test 513ad7a7c053f8a6b7968ed6c84d1fc8c7a84fd29cfde0d14cc085ae6ca682c6
|
||||
F ext/fts5/test/fts5matchinfo.test f7dde99697bcb310ea8faa8eb2714d9f4dfc0e1b
|
||||
F ext/fts5/test/fts5merge.test 9f65f090d214ff865c56bef4f864aaa1182af6e3
|
||||
F ext/fts5/test/fts5merge2.test a6da3c16d694235938d1939f503cfa53f0943d75
|
||||
@@ -214,7 +215,7 @@ F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a2
|
||||
F ext/misc/carray.c 40c27641010a4dc67e3690bdb7c9d36ca58b3c2d
|
||||
F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704
|
||||
F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
|
||||
F ext/misc/csv.c 531a46cbad789fca0aa9db69a0e6c8ac9e68767d
|
||||
F ext/misc/csv.c d91c0388445b08f6e373dd0e8fc024d4551b1fcaf64e876a1c3f4fac8a63adc2
|
||||
F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e
|
||||
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
||||
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
|
||||
@@ -274,7 +275,7 @@ F ext/rbu/sqlite3rbu.c d1438580a451eebda3bfd42ef69b677512f00125285e0e4e789b6131a
|
||||
F ext/rbu/sqlite3rbu.h fc25e1fcd99b5c6d32b1b5b1c73122632e873ac89bd0be9bf646db362b7ce02c
|
||||
F ext/rbu/test_rbu.c ec18cfc69a104309df23c359e3c80306c9a6bdd1d2c53c8b70ae158e9832dcd6
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
F ext/rtree/rtree.c 8205d6e4466f766e57ce1b8aa38224ac9e1cec2d2bf4684cd1cc5a6ddf9b7014
|
||||
F ext/rtree/rtree.c 9c55ff738ac3cd466f2eb23a91fb9bd6bf882ec30fed567066a0d95a6c757605
|
||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||
F ext/rtree/rtree1.test d5f0ba215b3bd1d05269ada86e74073b8445852aa0d33a63e10ec63a09c39473
|
||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||
@@ -341,26 +342,26 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c 3b23977620ce9662ac54443f65b87ba996e36121
|
||||
F src/alter.c 850ede4e607f12fa25ea4f3cb6ece2b2e29d1aa50e3f786ce49d615788849552
|
||||
F src/analyze.c 0d0ccf7520a201d8747ea2f02c92c26e26f801bc161f714f27b9f7630dde0421
|
||||
F src/attach.c 3bd555e28382603e80d430dfebb2270f86e1e375b4c4be3e1ab1aec3a0c44943
|
||||
F src/auth.c 79f96c6f33bf0e5da8d1c282cee5ebb1852bb8a6ccca3e485d7c459b035d9c3c
|
||||
F src/backup.c faf17e60b43233c214aae6a8179d24503a61e83b
|
||||
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
|
||||
F src/btmutex.c 0e9ce2d56159b89b9bc8e197e023ee11e39ff8ca
|
||||
F src/btree.c 127ae15b6328376fa549a2ead30a3ec20db31fe991a287c42cf394965f55fff0
|
||||
F src/btree.c 00579ff9c2831d6f98cc993f8f2a34c0ff996e89b3cd2f27928f75796bc3a58a
|
||||
F src/btree.h 3edc5329bc59534d2d15b4f069a9f54b779a7e51289e98fa481ae3c0e526a5ca
|
||||
F src/btreeInt.h 97700795edf8a43245720414798b7b29d8e465aef46bf301ffacd431910c0da1
|
||||
F src/build.c 88a8cdc11d1c081ed565aa3e795bdf9160f4556463b4c4555e9860b59dd80340
|
||||
F src/btreeInt.h a392d353104b4add58b4a59cb185f5d5693dde832c565b77d8d4c343ed98f610
|
||||
F src/build.c b24e0889ba18ba0e93e03e2ef5c9f1a2ca043d77c5abbd3d333858a76b795da3
|
||||
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c eeff225a310b2d9a2a6cb413acaf78ab301b142ed3bcd83f0c06298f609373cb
|
||||
F src/ctime.c e9a6db1321c2353fe922533f202b85abb3084cdf569450abcabf55e21e104550
|
||||
F src/date.c cc42a41c7422389860d40419a5e3bce5eaf6e7835c3ba2677751dc653550a5c7
|
||||
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
|
||||
F src/delete.c 3213547e97b676c6fa79948b7a9ede4801ea04a01a2043241deafedf132ecf5d
|
||||
F src/expr.c 452c6f3aa656aabf3eefe96bb5f316b2c987fbc12c647964e4ed880f193ca31f
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c db65492ae549c3b548c9ef1f279ce1684f1c473b116e1c56a90878cd5dcf968d
|
||||
F src/fkey.c 5ff2c895fe087756d8085dc1a9bc229b5670e2a65c3929dd87c71e43649af333
|
||||
F src/func.c 9d52522cc8ae7f5cdadfe14594262f1618bc1f86083c4cd6da861b4cf5af6174
|
||||
F src/global.c 8a6ab6b4d91effb96ffa81b39f0d70c862abca157f8aaa194600a4a8b7923344
|
||||
F src/hash.c 63d0ee752a3b92d4695b2b1f5259c4621b2cfebd
|
||||
@@ -368,9 +369,9 @@ F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4
|
||||
F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 974499a3999d339a4c1ba8ef129a988d9f136b3789e423808b38cdc19d28adbe
|
||||
F src/legacy.c e88ed13c2d531decde75d42c2e35623fb9ce3cb0
|
||||
F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e
|
||||
F src/loadext.c a72909474dadce771d3669bf84bf689424f6f87d471fee898589c3ef9b2acfd9
|
||||
F src/main.c 18f2145d572069dae91161add89446aec680aab296492a92ae5afcc2fc7c6b5a
|
||||
F src/main.c 747ec45346c3826113bc081cafe1aa2df945e50540c4b3fb13ec02b5e231c3db
|
||||
F src/malloc.c e20bb2b48abec52d3faf01cce12e8b4f95973755fafec98d45162dfdab111978
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||
@@ -394,28 +395,28 @@ F src/os_win.c 2a6c73eef01c51a048cc4ddccd57f981afbec18a
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 14f6982c470c05b8e85575c69e9c1712010602e20400f8670d8699e21283e0e4
|
||||
F src/pager.h f2a99646c5533ffe11afa43e9e0bea74054e4efa
|
||||
F src/parse.y 0513387ce02fea97897d8caef82d45f347818593f24f1bdc48e0c530a8af122d
|
||||
F src/parse.y b13c9fc83cb634daf7fd5fef89127e8eafdf4904ab9a168d3e1862c5a3c7ae22
|
||||
F src/pcache.c 62835bed959e2914edd26afadfecce29ece0e870
|
||||
F src/pcache.h 521bb9610d38ef17a3cc9b5ddafd4546c2ea67fa3d0e464823d73c2a28d50e11
|
||||
F src/pcache1.c 1195a21fe28e223e024f900b2011e80df53793f0356a24caace4188b098540dc
|
||||
F src/pragma.c b5483eba1898652d330231164c17624a93e7a991b2f5c7e8a80f9d85528b308c
|
||||
F src/pragma.h 37a1311d0388db480388d7ec09054f7103045eff20d4971f8a433b77f40b9921
|
||||
F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
|
||||
F src/pragma.c 2362670a9d28b71708aecb2b9b10b3f7be71f4c950961c07e81dc400e3ce6371
|
||||
F src/pragma.h 99d3df4a3d2f12c5227ad403f767334910e6356325b6d155a9a99b4037093460
|
||||
F src/prepare.c 4b84ae7458febe1df3e04ae62ba56abc851f771340e460d14426e6802c5615f4
|
||||
F src/printf.c 8757834f1b54dae512fb25eb1acc8e94a0d15dd2290b58f2563f65973265adb2
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c adf3ef9843135b1383321ad751f16f5a40c3f37925154555a3e61653d2a954e8
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c 0d2afdbdba5fbc61432c5454a35e0236e7aa4aa3756986a7d51b81a508e8083a
|
||||
F src/shell.c bcd3358ad6cb3f3dc7ec76ad3bd8191f123ed2425360c5c48fe431780eceb729
|
||||
F src/sqlite.h.in 67fa8bd29808e7988e0ce36c8d4c6043eb1727f94522fc612687aa5af51931e6
|
||||
F src/select.c 35ccfae64cecfa843d54a5898c4ab7d6595ce03d147267fa5eecdc8eab39cd6a
|
||||
F src/shell.c 227b86f2bdd707d0a177a4805a5c0b0378ef8337ab1ad04f5d79dc479568735a
|
||||
F src/sqlite.h.in b44ec77f83c8599182ea6646e0a99dfa5b11644943a00c8bb5736c2d19b8cbb5
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 58fd0676d3111d02e62e5a35992a7d3da5d3f88753acc174f2d37b774fbbdd28
|
||||
F src/sqliteInt.h 17e9bce594ea0c38c44ad0cbff4aa50cbff4b25f4bac9d38306caf9f1f028ac9
|
||||
F src/sqliteInt.h 620093497e54998c6b2a01ad98aed9b561716c3db4bde0cc37c8bf2416200bed
|
||||
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
|
||||
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
|
||||
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
|
||||
F src/tclsqlite.c c8cf60d0c5411d5e70e7c136470d29dbe760d250f55198b71682c67086524e4a
|
||||
F src/test1.c c99f0442918a7a5d5b68a95d6024c211989e6c782c15ced5a558994baaf76a5e
|
||||
F src/tclsqlite.c 2c29b0b76e91edfd1b43bf135c32c8674710089197327682b6b7e6af88062c3d
|
||||
F src/test1.c 735f7711e787f30ad4e0001220c580ce456d9f731e22e0e5f86dd5c7e41ccd4d
|
||||
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
|
||||
F src/test3.c b8434949dfb8aff8dfa082c8b592109e77844c2135ed3c492113839b6956255b
|
||||
F src/test4.c 18ec393bb4d0ad1de729f0b94da7267270f3d8e6
|
||||
@@ -472,13 +473,13 @@ F src/update.c c443935c652af9365e033f756550b5032d02e1b06eb2cb890ed7511ae0c051dc
|
||||
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
|
||||
F src/util.c fc081ec6f63448dcd80d3dfad35baecfa104823254a815b081a4d9fe76e1db23
|
||||
F src/vacuum.c 874c0f2f15ab2908748297d587d22d485ea96d55aaec91d4775dddb2e24d2ecf
|
||||
F src/vdbe.c 6783778df820f3e0c68289fe5d12ddd34168b0eb1acf248668fec6e2ea1012d5
|
||||
F src/vdbe.h 70a409d171d4e51b962f0d53abf15c33c404c6aa4c9d62fb3a931b5a62ba9615
|
||||
F src/vdbeInt.h cdcdabad4f5d6bf7a3beb826a7f33ee6f8f1cb220042bedd5b7d4bf2ea1d179f
|
||||
F src/vdbeapi.c c961d8d9e0f52e2df60a6ddbbccd7d99dc4d00103db7e53f77fcef44fbd23178
|
||||
F src/vdbeaux.c bc9b3228f6d99bef0d0ecaf3a0e0e8358b3873242d0d2fe944226de3fdf9521e
|
||||
F src/vdbe.c 50f4f47bb190099b61fe87e239de17ad00636a522a271dd9b28329053091401d
|
||||
F src/vdbe.h dde459b1e8a02b8445ecfd5959f38cd5ebb6b0ad392d491d8b159ac8193d231a
|
||||
F src/vdbeInt.h ba7a9436196e693cc51532138ba9431af2716efbc1afe62b03b2724a67853764
|
||||
F src/vdbeapi.c 899d8f021c89ab348708b3a9b00b855f5ecc3c0f949a75359a61a3c621021281
|
||||
F src/vdbeaux.c 69689a77db511e21dcc38d9acf7226c76861eee0e35f96d7f9f05b39f3fa39b7
|
||||
F src/vdbeblob.c 359891617358deefc85bef7bcf787fa6b77facb9
|
||||
F src/vdbemem.c 94b17d851f31d4fd075d47d373d4b33ed3962a6ecb82cf385018025751091360
|
||||
F src/vdbemem.c 8d78df62becfd2dce3c317f64b32a94ecaff8346d814bc8b0b877b38a1ad3718
|
||||
F src/vdbesort.c f512c68d0bf7e0105316a5594c4329358c8ee9cae3b25138df041d97516c0372
|
||||
F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
|
||||
F src/vtab.c 35b9bdc2b41de32a417141d12097bcc4e29a77ed7cdb8f836d1d2305d946b61b
|
||||
@@ -486,10 +487,10 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c 40c543f0a2195d1b0dc88ef12142bea690009344
|
||||
F src/wal.h 06b2a0b599cc0f53ea97f497cf8c6b758c999f71
|
||||
F src/walker.c d46044e7a5842560dfe7122d93ff5145dd4a96f4d0bf5ba5910a7731b8c01e79
|
||||
F src/where.c aa213e1b1c29eb8946a9f25108a18666a745ae5bac41b58d0be98730937a7785
|
||||
F src/where.c 74b0a05487e44e8c5d28ebe3bd77ca9719b1d5114235bed48079aee309a0bb4e
|
||||
F src/whereInt.h 2a4b634d63ce488b46d4b0da8f2eaa8f9aeab202bc25ef76f007de5e3fba1f20
|
||||
F src/wherecode.c 339ee802d9d311acf0cba8b5a9a092e167ef71c3a777d4b3e57de25d193251c7
|
||||
F src/whereexpr.c a2fe3811d45af45a5c6667caabc15e01054fe6228c64e86e1f7d2ba5ef5284f9
|
||||
F src/whereexpr.c 61035ab300a5e2ee37aa531cbb621bc33873631a28dcacceb9e71c3b884c4d1d
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
|
||||
@@ -504,7 +505,7 @@ F test/alter4.test b6d7b86860111864f6cddb54af313f5862dda23b
|
||||
F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc
|
||||
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
|
||||
F test/analyze.test 3eb35a4af972f98422e5dc0586501b17d103d321
|
||||
F test/analyze3.test 1dccda46a6c374018af617fba00bfe297a61d442
|
||||
F test/analyze3.test 8b3ef8ba6d1096b76c40e0925c0fe51e700d2b779cdda40914580de3f9b9d80f
|
||||
F test/analyze4.test eff2df19b8dd84529966420f29ea52edc6b56213
|
||||
F test/analyze5.test 765c4e284aa69ca172772aa940946f55629bc8c4
|
||||
F test/analyze6.test f1c552ce39cca4ec922a7e4e0e5d0203d6b3281f
|
||||
@@ -695,7 +696,7 @@ F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
|
||||
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
|
||||
F test/enc3.test 6807f7a7740a00361ca8d0ccd66bc60c8dc5f2b6
|
||||
F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020
|
||||
F test/eqp.test 3fe051af50921284189d1970eb653f9fcf5117d2
|
||||
F test/eqp.test 3f9ba0b2594837c7beaa3ba824e2137cfe857308f020ec5a0c7a62b444e837b0
|
||||
F test/errmsg.test f31592a594b44ee121371d25ddd5d63497bb3401
|
||||
F test/eval.test a64c9105d6ff163df7cf09d6ac29cdad5922078c
|
||||
F test/exclusive.test 9a57bd66e39144b888ca75c309914fcdefb4e3f9
|
||||
@@ -797,7 +798,7 @@ F test/fts3expr5.test f9abfffbf5e53d48a33e12a1e8f8ba2c551c9b49
|
||||
F test/fts3fault.test 3764ecffb3d341c5b05b3abe64153f385880035e67706ca2fc719e5d3352aedb
|
||||
F test/fts3fault2.test 536bbe01fe2946ec24b063a5eee813e8fd90354a6ca0b8f941d299c405edd17e
|
||||
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
|
||||
F test/fts3join.test 34750f3ce1e29b2749eaf0f1be2fa6301c5d50da
|
||||
F test/fts3join.test a758accc808cebaef8d622aac07994a2eae15c40eebc40888dcbbabc6f6bafb6
|
||||
F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6
|
||||
F test/fts3matchinfo.test ce864e0bd92429df8008f31cf557269ba172482a
|
||||
F test/fts3misc.test 66e7b59576ce2c795f0baff6d47f7f6f57e6f41101cf85fad05989e43bb060dd
|
||||
@@ -908,7 +909,7 @@ F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
|
||||
F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
|
||||
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
|
||||
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
|
||||
F test/join.test 302f164f4a41c240d16ebd780762834233be77b852f15232c9a48a6fe37ac0fa
|
||||
F test/join.test 442c462eea85cf065d70a663c626b780a95af6e11585d909bb63b87598afe678
|
||||
F test/join2.test a48f723c5692e2cbb23a9297ac2720cb77d51a70
|
||||
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
|
||||
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
|
||||
@@ -928,7 +929,7 @@ F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
|
||||
F test/kvtest.c d2b8cfc91047ebf6cac4f3a04f19c3a864e4ecfd683bbb65c395df450b8dc79c
|
||||
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
|
||||
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
|
||||
F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
|
||||
F test/like.test e7b1e724c731a219c4338e37cfe2c5861cd1cd7a856bbdd1d6045ae4f83dc7c7
|
||||
F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da
|
||||
F test/like3.test 3608a2042b6f922f900fbfd5d3ce4e7eca57f7c4
|
||||
F test/limit.test 0c99a27a87b14c646a9d583c7c89fd06c352663e
|
||||
@@ -1126,11 +1127,11 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
|
||||
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
|
||||
F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
|
||||
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
|
||||
F test/shell1.test 50226a3a66bbd42a902e9f7698f768927eb33a56e9cfc55b7c157c38eb3e80ac
|
||||
F test/shell1.test 65f55c120ab289bc72ec0e534d104e078124d94aeac75dc7444c338c4d84fd0d
|
||||
F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
|
||||
F test/shell3.test 9b95ba643eaa228376f06a898fb410ee9b6e57c1
|
||||
F test/shell4.test 89ad573879a745974ff2df20ff97c5d6ffffbd5d
|
||||
F test/shell5.test 50a732c1c2158b1cd62cf53975ce1ea7ce6b9dc9
|
||||
F test/shell5.test 0d973866d0df8501486a840f51d1502ab0d9b38ca12c9b242ee26adc788af576
|
||||
F test/shell6.test ab1592ebe881371f651f18ee6a0df21cbfb5310f88cb832ab642d4038f679772
|
||||
F test/shell7.test 07751911b294698e0c5df67bcbd29e7d2f0f2907
|
||||
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
|
||||
@@ -1187,7 +1188,7 @@ F test/tabfunc01.test 699251cb99651415218a891384510a685c7ab012
|
||||
F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f
|
||||
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
|
||||
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
|
||||
F test/tclsqlite.test 1d73b9203b1ca8798d7d7310742b8d3febc0d56e
|
||||
F test/tclsqlite.test c3d7ac9449634b9f17fd048a3c0212e88a7448be810a9c5bd051acc1ffa00d2f
|
||||
F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6
|
||||
F test/tempdb2.test 27e41ed540b2f9b056c2e77e9bddc1b875358507
|
||||
F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900
|
||||
@@ -1465,7 +1466,7 @@ F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
|
||||
F test/whereC.test cae295158703cb3fc23bf1a108a9ab730efff0f6
|
||||
F test/whereD.test 711d4df58d6d4fb9b3f5ce040b818564198be002
|
||||
F test/whereE.test b3a055eef928c992b0a33198a7b8dc10eea5ad2f
|
||||
F test/whereF.test 5b2ba0dbe8074aa13e416b37c753991f0a2492d7
|
||||
F test/whereF.test 97a86ecdfa4c21684fdff501dbd2cb7397689be8676d0dbad1f5a0892c6b56a3
|
||||
F test/whereG.test dde4c52a97385a55be6a7cd46be8373f0cf35501
|
||||
F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2
|
||||
F test/whereI.test eab5b226bbc344ac70d7dc09b963a064860ae6d7
|
||||
@@ -1508,8 +1509,8 @@ F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
||||
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
||||
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
|
||||
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
|
||||
F tool/lemon.c f4f1045743e12f86b132253a3192ef92c94bfceb7f41ac41b8e3b373aa78474e
|
||||
F tool/lempar.c db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1
|
||||
F tool/lemon.c 5a04dff28578a67415cea5bf981b893c50cebfdd4388fb21254d1892525edfd8
|
||||
F tool/lempar.c f0dc07c2838febff4c34244651a6932fceb523065e6fe79bacfaa93019cc8cca
|
||||
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
|
||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
|
||||
@@ -1521,7 +1522,7 @@ F tool/mkmsvcmin.tcl cbd93f1cfa3a0a9ae56fc958510aa3fc3ac65e29cb111716199e3d0e66e
|
||||
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
|
||||
F tool/mkopcodeh.tcl a01d2c1d8a6205b03fc635adf3735b4c523befd3
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||
F tool/mkpragmatab.tcl 32bb40741df11bddc8451de9ea4d130e7b4476d8064794b1cf402ac110840fba
|
||||
F tool/mkpragmatab.tcl aa94395a91b5bd47022b7db0c08126f047887e0d299cc19ec1c23a9e5b136961
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
F tool/mksqlite3c-noext.tcl fef88397668ae83166735c41af99d79f56afaabb
|
||||
F tool/mksqlite3c.tcl 226da6d794d7d43a31e159a6fa89db867bf1f5eafe4b37d031222287ef8dbadc
|
||||
@@ -1583,10 +1584,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P f3db02f49073c3f08c3fd7816d85e5472d5e22df20d862fe4886eb2a97efb15f
|
||||
R bfe3d3db972c98c6ca95dc686a1c98c9
|
||||
T *branch * fast-secure-delete
|
||||
T *sym-fast-secure-delete *
|
||||
T -sym-trunk *
|
||||
P 3fd050c343256c0748256ef183b46df04d9e0da0f81b841dbd336034402b36ab f02a54599de7620438aecd3753199fc52ce8919d7503bb8b2f5592b0e51dbf8c
|
||||
R feb9e70d0a08e3077acee5058fe09cc5
|
||||
U drh
|
||||
Z 1665a7b13a5f9ef4377c01699ae7453e
|
||||
Z 4e60571db7566c33ec3ac14916a90cee
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
f1682f0faf1a93ded066464b1ddd5f987e21ee0f6bb5e828ed31c3ad903cf2c3
|
||||
62b8269ba2ff71e2daaa86688698896badd6f6e34ab42fbf92dda7fcda73a230
|
||||
+1
-1
@@ -375,7 +375,7 @@ static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
|
||||
** Or, if zName is not a system table, zero is returned.
|
||||
*/
|
||||
static int isSystemTable(Parse *pParse, const char *zName){
|
||||
if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
|
||||
if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
|
||||
sqlite3ErrorMsg(pParse, "table %s may not be altered", zName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
+16
-33
@@ -152,7 +152,7 @@ static int hasSharedCacheTableLock(
|
||||
** Return true immediately.
|
||||
*/
|
||||
if( (pBtree->sharable==0)
|
||||
|| (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))
|
||||
|| (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommit))
|
||||
){
|
||||
return 1;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
|
||||
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
|
||||
if( p->pgnoRoot==iRoot
|
||||
&& p->pBtree!=pBtree
|
||||
&& 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted)
|
||||
&& 0==(p->pBtree->db->flags & SQLITE_ReadUncommit)
|
||||
){
|
||||
return 1;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
|
||||
assert( sqlite3BtreeHoldsMutex(p) );
|
||||
assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
|
||||
assert( p->db!=0 );
|
||||
assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 );
|
||||
assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 );
|
||||
|
||||
/* If requesting a write-lock, then the Btree must have an open write
|
||||
** transaction on this file. And, obviously, for this to be so there
|
||||
@@ -329,7 +329,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
|
||||
** obtain a read-lock using this function. The only read-lock obtained
|
||||
** by a connection in read-uncommitted mode is on the sqlite_master
|
||||
** table, and that lock is obtained in BtreeBeginTrans(). */
|
||||
assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK );
|
||||
assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK );
|
||||
|
||||
/* This function should only be called on a sharable b-tree after it
|
||||
** has been determined that no other b-tree holds a conflicting lock. */
|
||||
@@ -1640,7 +1640,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
|
||||
|
||||
/* Overwrite deleted information with zeros when the secure_delete
|
||||
** option is enabled */
|
||||
if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
|
||||
if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){
|
||||
memset(&data[iStart], 0, iSize);
|
||||
}
|
||||
|
||||
@@ -1931,7 +1931,7 @@ static void zeroPage(MemPage *pPage, int flags){
|
||||
assert( sqlite3PagerGetData(pPage->pDbPage) == data );
|
||||
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
if( pBt->btsFlags & BTS_FAST_SECURE ){
|
||||
if( pBt->btsFlags & BTS_SECURE_DELETE ){
|
||||
memset(&data[hdr], 0, pBt->usableSize - hdr);
|
||||
}
|
||||
data[hdr] = (char)flags;
|
||||
@@ -2354,10 +2354,8 @@ int sqlite3BtreeOpen(
|
||||
pBt->pCursor = 0;
|
||||
pBt->pPage1 = 0;
|
||||
if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
|
||||
#if defined(SQLITE_SECURE_DELETE)
|
||||
#ifdef SQLITE_SECURE_DELETE
|
||||
pBt->btsFlags |= BTS_SECURE_DELETE;
|
||||
#elif defined(SQLITE_FAST_SECURE_DELETE)
|
||||
pBt->btsFlags |= BTS_OVERWRITE;
|
||||
#endif
|
||||
/* EVIDENCE-OF: R-51873-39618 The page size for a database file is
|
||||
** determined by the 2-byte integer located at an offset of 16 bytes from
|
||||
@@ -2805,34 +2803,19 @@ int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){
|
||||
}
|
||||
|
||||
/*
|
||||
** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags:
|
||||
**
|
||||
** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared
|
||||
** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared
|
||||
** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set
|
||||
** newFlag==(-1) No changes
|
||||
**
|
||||
** This routine acts as a query if newFlag is less than zero
|
||||
**
|
||||
** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but
|
||||
** freelist leaf pages are not written back to the database. Thus in-page
|
||||
** deleted content is cleared, but freelist deleted content is not.
|
||||
**
|
||||
** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition
|
||||
** that freelist leaf pages are written back into the database, increasing
|
||||
** the amount of disk I/O.
|
||||
** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1. If newFlag is -1,
|
||||
** then make no changes. Always return the value of the BTS_SECURE_DELETE
|
||||
** setting after the change.
|
||||
*/
|
||||
int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
|
||||
int b;
|
||||
if( p==0 ) return 0;
|
||||
sqlite3BtreeEnter(p);
|
||||
assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 );
|
||||
assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) );
|
||||
if( newFlag>=0 ){
|
||||
p->pBt->btsFlags &= ~BTS_FAST_SECURE;
|
||||
p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag;
|
||||
}
|
||||
b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE;
|
||||
p->pBt->btsFlags &= ~BTS_SECURE_DELETE;
|
||||
if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;
|
||||
}
|
||||
b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;
|
||||
sqlite3BtreeLeave(p);
|
||||
return b;
|
||||
}
|
||||
@@ -3038,7 +3021,7 @@ static int lockBtree(BtShared *pBt){
|
||||
pageSize-usableSize);
|
||||
return rc;
|
||||
}
|
||||
if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){
|
||||
if( (pBt->db->flags & SQLITE_WriteSchema)==0 && nPage>nPageFile ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto page1_init_failed;
|
||||
}
|
||||
@@ -7227,7 +7210,7 @@ static int balance_nonroot(
|
||||
** In this case, temporarily copy the cell into the aOvflSpace[]
|
||||
** buffer. It will be copied out again as soon as the aSpace[] buffer
|
||||
** is allocated. */
|
||||
if( pBt->btsFlags & BTS_FAST_SECURE ){
|
||||
if( pBt->btsFlags & BTS_SECURE_DELETE ){
|
||||
int iOff;
|
||||
|
||||
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
|
||||
|
||||
+4
-6
@@ -448,12 +448,10 @@ struct BtShared {
|
||||
#define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
|
||||
#define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
|
||||
#define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
|
||||
#define BTS_OVERWRITE 0x0008 /* Overwrite deleted content with zeros */
|
||||
#define BTS_FAST_SECURE 0x000c /* Combination of the previous two */
|
||||
#define BTS_INITIALLY_EMPTY 0x0010 /* Database was empty at trans start */
|
||||
#define BTS_NO_WAL 0x0020 /* Do not open write-ahead-log files */
|
||||
#define BTS_EXCLUSIVE 0x0040 /* pWriter has an exclusive lock */
|
||||
#define BTS_PENDING 0x0080 /* Waiting for read-locks to clear */
|
||||
#define BTS_INITIALLY_EMPTY 0x0008 /* Database was empty at trans start */
|
||||
#define BTS_NO_WAL 0x0010 /* Do not open write-ahead-log files */
|
||||
#define BTS_EXCLUSIVE 0x0020 /* pWriter has an exclusive lock */
|
||||
#define BTS_PENDING 0x0040 /* Waiting for read-locks to clear */
|
||||
|
||||
/*
|
||||
** An instance of the following structure is used to hold information
|
||||
|
||||
+3
-1
@@ -4185,7 +4185,9 @@ void sqlite3UniqueConstraint(
|
||||
assert( pIdx->aiColumn[j]>=0 );
|
||||
zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
|
||||
if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2);
|
||||
sqlite3XPrintf(&errMsg, "%s.%s", pTab->zName, zCol);
|
||||
sqlite3StrAccumAppendAll(&errMsg, pTab->zName);
|
||||
sqlite3StrAccumAppend(&errMsg, ".", 1);
|
||||
sqlite3StrAccumAppendAll(&errMsg, zCol);
|
||||
}
|
||||
}
|
||||
zErr = sqlite3StrAccumFinish(&errMsg);
|
||||
|
||||
+11
-3
@@ -16,6 +16,14 @@
|
||||
|
||||
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
|
||||
|
||||
/*
|
||||
** Include the configuration header output by 'configure' if we're using the
|
||||
** autoconf-based build
|
||||
*/
|
||||
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
|
||||
#include "config.h"
|
||||
#define SQLITECONFIG_H 1
|
||||
#endif
|
||||
|
||||
/* These macros are provided to "stringify" the value of the define
|
||||
** for those options in which the value is meaningful. */
|
||||
@@ -30,7 +38,7 @@
|
||||
** only a handful of compile-time options, so most times this array is usually
|
||||
** rather short and uses little memory space.
|
||||
*/
|
||||
static const char * const azCompileOpt[] = {
|
||||
static const char * const sqlite3azCompileOpt[] = {
|
||||
|
||||
/*
|
||||
** BEGIN CODE GENERATED BY tool/mkctime.tcl
|
||||
@@ -728,8 +736,8 @@ static const char * const azCompileOpt[] = {
|
||||
};
|
||||
|
||||
const char **sqlite3CompileOptions(int *pnOpt){
|
||||
*pnOpt = sizeof(azCompileOpt) / sizeof(azCompileOpt[0]);
|
||||
return (const char**)azCompileOpt;
|
||||
*pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]);
|
||||
return (const char**)sqlite3azCompileOpt;
|
||||
}
|
||||
|
||||
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
|
||||
|
||||
+6
-4
@@ -633,10 +633,12 @@ static void fkScanChildren(
|
||||
/* Create VDBE to loop through the entries in pSrc that match the WHERE
|
||||
** clause. For each row found, increment either the deferred or immediate
|
||||
** foreign key constraint counter. */
|
||||
pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
|
||||
if( pWInfo ){
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
if( pParse->nErr==0 ){
|
||||
pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
|
||||
sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
|
||||
if( pWInfo ){
|
||||
sqlite3WhereEnd(pWInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the WHERE clause constructed above. */
|
||||
|
||||
+2
-5
@@ -127,11 +127,8 @@ exec_out:
|
||||
|
||||
rc = sqlite3ApiExit(db, rc);
|
||||
if( rc!=SQLITE_OK && pzErrMsg ){
|
||||
int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db));
|
||||
*pzErrMsg = sqlite3Malloc(nErrMsg);
|
||||
if( *pzErrMsg ){
|
||||
memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
|
||||
}else{
|
||||
*pzErrMsg = sqlite3DbStrDup(0, sqlite3_errmsg(db));
|
||||
if( *pzErrMsg==0 ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
sqlite3Error(db, SQLITE_NOMEM);
|
||||
}
|
||||
|
||||
@@ -811,6 +811,7 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
|
||||
{ SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer },
|
||||
{ SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_LoadExtension },
|
||||
{ SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose },
|
||||
{ SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG },
|
||||
};
|
||||
unsigned int i;
|
||||
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
|
||||
@@ -2915,6 +2916,9 @@ static int openDatabase(
|
||||
#endif
|
||||
#if defined(SQLITE_ENABLE_FTS3_TOKENIZER)
|
||||
| SQLITE_Fts3Tokenizer
|
||||
#endif
|
||||
#if defined(SQLITE_ENABLE_QPSG)
|
||||
| SQLITE_EnableQPSG
|
||||
#endif
|
||||
;
|
||||
sqlite3HashInit(&db->aCollSeq);
|
||||
|
||||
+1
-2
@@ -1375,8 +1375,7 @@ trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z)
|
||||
}
|
||||
|
||||
%type trigger_time {int}
|
||||
trigger_time(A) ::= BEFORE. { A = TK_BEFORE; }
|
||||
trigger_time(A) ::= AFTER. { A = TK_AFTER; }
|
||||
trigger_time(A) ::= BEFORE|AFTER(X). { A = @X; /*A-overwrites-X*/ }
|
||||
trigger_time(A) ::= INSTEAD OF. { A = TK_INSTEAD;}
|
||||
trigger_time(A) ::= . { A = TK_BEFORE; }
|
||||
|
||||
|
||||
+3
-7
@@ -515,22 +515,18 @@ void sqlite3Pragma(
|
||||
|
||||
/*
|
||||
** PRAGMA [schema.]secure_delete
|
||||
** PRAGMA [schema.]secure_delete=ON/OFF/FAST
|
||||
** PRAGMA [schema.]secure_delete=ON/OFF
|
||||
**
|
||||
** The first form reports the current setting for the
|
||||
** secure_delete flag. The second form changes the secure_delete
|
||||
** flag setting and reports the new value.
|
||||
** flag setting and reports thenew value.
|
||||
*/
|
||||
case PragTyp_SECURE_DELETE: {
|
||||
Btree *pBt = pDb->pBt;
|
||||
int b = -1;
|
||||
assert( pBt!=0 );
|
||||
if( zRight ){
|
||||
if( sqlite3_stricmp(zRight, "fast")==0 ){
|
||||
b = 2;
|
||||
}else{
|
||||
b = sqlite3GetBoolean(zRight, 0);
|
||||
}
|
||||
b = sqlite3GetBoolean(zRight, 0);
|
||||
}
|
||||
if( pId2->n==0 && b>=0 ){
|
||||
int ii;
|
||||
|
||||
+5
-5
@@ -267,7 +267,7 @@ static const PragmaName aPragmaName[] = {
|
||||
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
{/* zName: */ "foreign_key_check",
|
||||
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
|
||||
/* ColNames: */ 39, 4,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
@@ -354,7 +354,7 @@ static const PragmaName aPragmaName[] = {
|
||||
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
||||
{/* zName: */ "integrity_check",
|
||||
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1,
|
||||
/* ColNames: */ 0, 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
@@ -449,7 +449,7 @@ static const PragmaName aPragmaName[] = {
|
||||
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
||||
{/* zName: */ "quick_check",
|
||||
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema,
|
||||
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1,
|
||||
/* ColNames: */ 0, 0,
|
||||
/* iArg: */ 0 },
|
||||
#endif
|
||||
@@ -458,7 +458,7 @@ static const PragmaName aPragmaName[] = {
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
|
||||
/* ColNames: */ 0, 0,
|
||||
/* iArg: */ SQLITE_ReadUncommitted },
|
||||
/* iArg: */ SQLITE_ReadUncommit },
|
||||
{/* zName: */ "recursive_triggers",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
|
||||
@@ -610,7 +610,7 @@ static const PragmaName aPragmaName[] = {
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
|
||||
/* ColNames: */ 0, 0,
|
||||
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
|
||||
/* iArg: */ SQLITE_WriteSchema },
|
||||
#endif
|
||||
};
|
||||
/* Number of pragmas: 60 on by default, 74 total. */
|
||||
|
||||
+55
-15
@@ -25,7 +25,7 @@ static void corruptSchema(
|
||||
const char *zExtra /* Error information */
|
||||
){
|
||||
sqlite3 *db = pData->db;
|
||||
if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){
|
||||
if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){
|
||||
char *z;
|
||||
if( zObj==0 ) zObj = "?";
|
||||
z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
|
||||
@@ -312,8 +312,8 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
sqlite3ResetAllSchemasOfConnection(db);
|
||||
}
|
||||
if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){
|
||||
/* Black magic: If the SQLITE_RecoveryMode flag is set, then consider
|
||||
if( rc==SQLITE_OK || (db->flags&SQLITE_WriteSchema)){
|
||||
/* Black magic: If the SQLITE_WriteSchema flag is set, then consider
|
||||
** the schema loaded, even if errors occurred. In this situation the
|
||||
** current sqlite3_prepare() operation will fail, but the following one
|
||||
** will attempt to compile the supplied statement against whatever subset
|
||||
@@ -513,7 +513,7 @@ static int sqlite3Prepare(
|
||||
sqlite3 *db, /* Database handle. */
|
||||
const char *zSql, /* UTF-8 encoded SQL statement. */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
|
||||
u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
|
||||
Vdbe *pReprepare, /* VM being reprepared */
|
||||
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
|
||||
const char **pzTail /* OUT: End of parsed string */
|
||||
@@ -530,6 +530,14 @@ static int sqlite3Prepare(
|
||||
/* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
|
||||
assert( sqlite3_mutex_held(db->mutex) );
|
||||
|
||||
/* For a long-term use prepared statement avoid the use of
|
||||
** lookaside memory.
|
||||
*/
|
||||
if( prepFlags & SQLITE_PREPARE_PERSISTENT ){
|
||||
sParse.disableLookaside++;
|
||||
db->lookaside.bDisable++;
|
||||
}
|
||||
|
||||
/* Check to verify that it is possible to get a read lock on all
|
||||
** database schemas. The inability to get a read lock indicates that
|
||||
** some other database connection is holding a write-lock, which in
|
||||
@@ -561,7 +569,7 @@ static int sqlite3Prepare(
|
||||
if( rc ){
|
||||
const char *zDb = db->aDb[i].zDbSName;
|
||||
sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb);
|
||||
testcase( db->flags & SQLITE_ReadUncommitted );
|
||||
testcase( db->flags & SQLITE_ReadUncommit );
|
||||
goto end_prepare;
|
||||
}
|
||||
}
|
||||
@@ -629,8 +637,7 @@ static int sqlite3Prepare(
|
||||
#endif
|
||||
|
||||
if( db->init.busy==0 ){
|
||||
Vdbe *pVdbe = sParse.pVdbe;
|
||||
sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag);
|
||||
sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
|
||||
}
|
||||
if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
|
||||
sqlite3VdbeFinalize(sParse.pVdbe);
|
||||
@@ -664,7 +671,7 @@ static int sqlite3LockAndPrepare(
|
||||
sqlite3 *db, /* Database handle. */
|
||||
const char *zSql, /* UTF-8 encoded SQL statement. */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
|
||||
u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
|
||||
Vdbe *pOld, /* VM being reprepared */
|
||||
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
|
||||
const char **pzTail /* OUT: End of parsed string */
|
||||
@@ -680,10 +687,10 @@ static int sqlite3LockAndPrepare(
|
||||
}
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
sqlite3BtreeEnterAll(db);
|
||||
rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
|
||||
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
|
||||
if( rc==SQLITE_SCHEMA ){
|
||||
sqlite3_finalize(*ppStmt);
|
||||
rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
|
||||
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
|
||||
}
|
||||
sqlite3BtreeLeaveAll(db);
|
||||
sqlite3_mutex_leave(db->mutex);
|
||||
@@ -704,13 +711,15 @@ int sqlite3Reprepare(Vdbe *p){
|
||||
sqlite3_stmt *pNew;
|
||||
const char *zSql;
|
||||
sqlite3 *db;
|
||||
u8 prepFlags;
|
||||
|
||||
assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
|
||||
zSql = sqlite3_sql((sqlite3_stmt *)p);
|
||||
assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */
|
||||
db = sqlite3VdbeDb(p);
|
||||
assert( sqlite3_mutex_held(db->mutex) );
|
||||
rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);
|
||||
prepFlags = sqlite3VdbePrepareFlags(p);
|
||||
rc = sqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0);
|
||||
if( rc ){
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
sqlite3OomFault(db);
|
||||
@@ -756,7 +765,23 @@ int sqlite3_prepare_v2(
|
||||
const char **pzTail /* OUT: End of parsed string */
|
||||
){
|
||||
int rc;
|
||||
rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);
|
||||
rc = sqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0,
|
||||
ppStmt,pzTail);
|
||||
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
|
||||
return rc;
|
||||
}
|
||||
int sqlite3_prepare_v3(
|
||||
sqlite3 *db, /* Database handle. */
|
||||
const char *zSql, /* UTF-8 encoded SQL statement. */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
|
||||
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
|
||||
const char **pzTail /* OUT: End of parsed string */
|
||||
){
|
||||
int rc;
|
||||
rc = sqlite3LockAndPrepare(db,zSql,nBytes,
|
||||
SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK),
|
||||
0,ppStmt,pzTail);
|
||||
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
|
||||
return rc;
|
||||
}
|
||||
@@ -770,7 +795,7 @@ static int sqlite3Prepare16(
|
||||
sqlite3 *db, /* Database handle. */
|
||||
const void *zSql, /* UTF-16 encoded SQL statement. */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
int saveSqlFlag, /* True to save SQL text into the sqlite3_stmt */
|
||||
u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
|
||||
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
|
||||
const void **pzTail /* OUT: End of parsed string */
|
||||
){
|
||||
@@ -798,7 +823,7 @@ static int sqlite3Prepare16(
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
|
||||
if( zSql8 ){
|
||||
rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
|
||||
rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8);
|
||||
}
|
||||
|
||||
if( zTail8 && pzTail ){
|
||||
@@ -844,7 +869,22 @@ int sqlite3_prepare16_v2(
|
||||
const void **pzTail /* OUT: End of parsed string */
|
||||
){
|
||||
int rc;
|
||||
rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail);
|
||||
rc = sqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail);
|
||||
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
|
||||
return rc;
|
||||
}
|
||||
int sqlite3_prepare16_v3(
|
||||
sqlite3 *db, /* Database handle. */
|
||||
const void *zSql, /* UTF-16 encoded SQL statement. */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
|
||||
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
|
||||
const void **pzTail /* OUT: End of parsed string */
|
||||
){
|
||||
int rc;
|
||||
rc = sqlite3Prepare16(db,zSql,nBytes,
|
||||
SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK),
|
||||
ppStmt,pzTail);
|
||||
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
|
||||
return rc;
|
||||
}
|
||||
|
||||
+6
-3
@@ -3205,9 +3205,12 @@ static Expr *substExpr(
|
||||
pCopy = &ifNullRow;
|
||||
}
|
||||
pNew = sqlite3ExprDup(db, pCopy, 0);
|
||||
if( pNew && (pExpr->flags & EP_FromJoin) ){
|
||||
if( pNew && pSubst->isLeftJoin ){
|
||||
ExprSetProperty(pNew, EP_CanBeNull);
|
||||
}
|
||||
if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
|
||||
pNew->iRightJoinTable = pExpr->iRightJoinTable;
|
||||
pNew->flags |= EP_FromJoin;
|
||||
ExprSetProperty(pNew, EP_FromJoin);
|
||||
}
|
||||
sqlite3ExprDelete(db, pExpr);
|
||||
pExpr = pNew;
|
||||
@@ -3500,7 +3503,7 @@ static int flattenSubquery(
|
||||
**
|
||||
** If the subquery is the right operand of a LEFT JOIN, then the outer
|
||||
** query cannot be an aggregate. This is an artifact of the way aggregates
|
||||
** are processed - there is not mechanism to determine if the LEFT JOIN
|
||||
** are processed - there is no mechanism to determine if the LEFT JOIN
|
||||
** table should be all-NULL.
|
||||
**
|
||||
** See also tickets #306, #350, and #3300.
|
||||
|
||||
+18
-1
@@ -2363,7 +2363,7 @@ static void set_table_name(ShellState *p, const char *zName){
|
||||
if( zName==0 ) return;
|
||||
cQuote = quoteChar(zName);
|
||||
n = strlen30(zName);
|
||||
if( cQuote ) n += 2;
|
||||
if( cQuote ) n += n+2;
|
||||
z = p->zDestTable = malloc( n+1 );
|
||||
if( z==0 ){
|
||||
raw_printf(stderr,"Error: out of memory\n");
|
||||
@@ -3822,6 +3822,7 @@ struct ImportCtx {
|
||||
int n; /* Number of bytes in z */
|
||||
int nAlloc; /* Space allocated for z[] */
|
||||
int nLine; /* Current line number */
|
||||
int bNotFirst; /* True if one or more bytes already read */
|
||||
int cTerm; /* Character that terminated the most recent field */
|
||||
int cColSep; /* The column separator character. (Usually ",") */
|
||||
int cRowSep; /* The row separator character. (Usually "\n") */
|
||||
@@ -3901,6 +3902,21 @@ static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
|
||||
pc = c;
|
||||
}
|
||||
}else{
|
||||
/* If this is the first field being parsed and it begins with the
|
||||
** UTF-8 BOM (0xEF BB BF) then skip the BOM */
|
||||
if( (c&0xff)==0xef && p->bNotFirst==0 ){
|
||||
import_append_char(p, c);
|
||||
c = fgetc(p->in);
|
||||
if( (c&0xff)==0xbb ){
|
||||
import_append_char(p, c);
|
||||
c = fgetc(p->in);
|
||||
if( (c&0xff)==0xbf ){
|
||||
p->bNotFirst = 1;
|
||||
p->n = 0;
|
||||
return csv_read_one_field(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
while( c!=EOF && c!=cSep && c!=rSep ){
|
||||
import_append_char(p, c);
|
||||
c = fgetc(p->in);
|
||||
@@ -3912,6 +3928,7 @@ static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
|
||||
p->cTerm = c;
|
||||
}
|
||||
if( p->z ) p->z[p->n] = 0;
|
||||
p->bNotFirst = 1;
|
||||
return p->z;
|
||||
}
|
||||
|
||||
|
||||
+96
-36
@@ -235,7 +235,7 @@ int sqlite3_threadsafe(void);
|
||||
** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
|
||||
** and [sqlite3_close_v2()] are its destructors. There are many other
|
||||
** interfaces (such as
|
||||
** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
|
||||
** [sqlite3_prepare_v3()], [sqlite3_create_function()], and
|
||||
** [sqlite3_busy_timeout()] to name but three) that are methods on an
|
||||
** sqlite3 object.
|
||||
*/
|
||||
@@ -339,7 +339,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
||||
** METHOD: sqlite3
|
||||
**
|
||||
** The sqlite3_exec() interface is a convenience wrapper around
|
||||
** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
|
||||
** [sqlite3_prepare_v3()], [sqlite3_step()], and [sqlite3_finalize()],
|
||||
** that allows an application to run multiple statements of SQL
|
||||
** without having to use a lot of C code.
|
||||
**
|
||||
@@ -2007,6 +2007,17 @@ struct sqlite3_mem_methods {
|
||||
** have been disabled - 0 if they are not disabled, 1 if they are.
|
||||
** </dd>
|
||||
**
|
||||
** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
|
||||
** <dd>The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
|
||||
** the [query planner stability guarantee] (QPSG). When the QPSG is active,
|
||||
** a single SQL query statement will always use the same algorithm regardless
|
||||
** of values of [bound parameters]. The QPSG disables some query optimizations
|
||||
** that look at the values of bound parameters, which can make some queries
|
||||
** slower. But the QPSG has the advantage of more predictable behavior. With
|
||||
** the QPSG active, SQLite will always use the same query plan in the field as
|
||||
** was used during testing in the lab.
|
||||
** </dd>
|
||||
**
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
|
||||
@@ -2016,6 +2027,7 @@ struct sqlite3_mem_methods {
|
||||
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
|
||||
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
|
||||
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
|
||||
#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
|
||||
|
||||
|
||||
/*
|
||||
@@ -2679,7 +2691,8 @@ void sqlite3_randomness(int N, void *P);
|
||||
** [database connection], supplied in the first argument.
|
||||
** ^The authorizer callback is invoked as SQL statements are being compiled
|
||||
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
|
||||
** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
|
||||
** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
|
||||
** and [sqlite3_prepare16_v3()]. ^At various
|
||||
** points during the compilation process, as logic is being created
|
||||
** to perform various actions, the authorizer callback is invoked to
|
||||
** see if those actions are allowed. ^The authorizer callback should
|
||||
@@ -2688,12 +2701,12 @@ void sqlite3_randomness(int N, void *P);
|
||||
** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
|
||||
** rejected with an error. ^If the authorizer callback returns
|
||||
** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
|
||||
** then the [sqlite3_prepare_v2()] or equivalent call that triggered
|
||||
** then the [sqlite3_prepare_v3()] or equivalent call that triggered
|
||||
** the authorizer will fail with an error message.
|
||||
**
|
||||
** When the callback returns [SQLITE_OK], that means the operation
|
||||
** requested is ok. ^When the callback returns [SQLITE_DENY], the
|
||||
** [sqlite3_prepare_v2()] or equivalent call that triggered the
|
||||
** [sqlite3_prepare_v3()] or equivalent call that triggered the
|
||||
** authorizer will fail with an error message explaining that
|
||||
** access is denied.
|
||||
**
|
||||
@@ -2744,10 +2757,10 @@ void sqlite3_randomness(int N, void *P);
|
||||
**
|
||||
** The authorizer callback must not do anything that will modify
|
||||
** the database connection that invoked the authorizer callback.
|
||||
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
|
||||
** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their
|
||||
** database connections for the meaning of "modify" in this paragraph.
|
||||
**
|
||||
** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
|
||||
** ^When [sqlite3_prepare_v3()] is used to prepare a statement, the
|
||||
** statement might be re-prepared during [sqlite3_step()] due to a
|
||||
** schema change. Hence, the application should ensure that the
|
||||
** correct authorizer callback remains in place during the [sqlite3_step()].
|
||||
@@ -2756,7 +2769,7 @@ void sqlite3_randomness(int N, void *P);
|
||||
** [sqlite3_prepare()] or its variants. Authorization is not
|
||||
** performed during statement evaluation in [sqlite3_step()], unless
|
||||
** as stated in the previous paragraph, sqlite3_step() invokes
|
||||
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
|
||||
** sqlite3_prepare_v3() to reprepare a statement after a schema change.
|
||||
*/
|
||||
int sqlite3_set_authorizer(
|
||||
sqlite3*,
|
||||
@@ -2992,7 +3005,7 @@ int sqlite3_trace_v2(
|
||||
**
|
||||
** The progress handler callback must not do anything that will modify
|
||||
** the database connection that invoked the progress handler.
|
||||
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
|
||||
** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their
|
||||
** database connections for the meaning of "modify" in this paragraph.
|
||||
**
|
||||
*/
|
||||
@@ -3346,7 +3359,7 @@ const char *sqlite3_errstr(int);
|
||||
** The life-cycle of a prepared statement object usually goes like this:
|
||||
**
|
||||
** <ol>
|
||||
** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
|
||||
** <li> Create the prepared statement object using [sqlite3_prepare_v3()].
|
||||
** <li> Bind values to [parameters] using the sqlite3_bind_*()
|
||||
** interfaces.
|
||||
** <li> Run the SQL by calling [sqlite3_step()] one or more times.
|
||||
@@ -3428,7 +3441,7 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
**
|
||||
** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
|
||||
** <dd>The maximum number of instructions in a virtual machine program
|
||||
** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
|
||||
** used to implement an SQL statement. If [sqlite3_prepare_v3()] or
|
||||
** the equivalent tries to allocate space for more than this many opcodes
|
||||
** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^
|
||||
**
|
||||
@@ -3468,6 +3481,24 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
|
||||
#define SQLITE_LIMIT_WORKER_THREADS 11
|
||||
|
||||
/*
|
||||
** CAPI3REF: Prepare Flags
|
||||
** KEYWORDS:
|
||||
**
|
||||
** These constants define various flags that can be passed into
|
||||
** the [sqlite3_prepare_v3()] interface.
|
||||
**
|
||||
** <dl>
|
||||
** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
|
||||
** <dd>The SQLITE_PREPARE_PERSISTENT flag causes [sqlite3_prepare_v3()]
|
||||
** to optimize the resulting prepared statement to be retained for a
|
||||
** relatively long amount of time.)^ ^Without this flag,
|
||||
** [sqlite3_prepare_v3()] assumes that the prepared statement will be used
|
||||
** just once or at most a few times and then destroyed using
|
||||
** [sqlite3_finalize()] relatively soon.
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_PREPARE_PERSISTENT 0x01
|
||||
|
||||
/*
|
||||
** CAPI3REF: Compiling An SQL Statement
|
||||
@@ -3483,9 +3514,10 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
** [sqlite3_open16()]. The database connection must not have been closed.
|
||||
**
|
||||
** The second argument, "zSql", is the statement to be compiled, encoded
|
||||
** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
|
||||
** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
|
||||
** use UTF-16.
|
||||
** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
|
||||
** and sqlite3_prepare_v3()
|
||||
** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
|
||||
** and sqlite3_prepare16_v3() use UTF-16.
|
||||
**
|
||||
** ^If the nByte argument is negative, then zSql is read up to the
|
||||
** first zero terminator. ^If nByte is positive, then it is the
|
||||
@@ -3512,10 +3544,11 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
|
||||
** otherwise an [error code] is returned.
|
||||
**
|
||||
** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
|
||||
** recommended for all new programs. The two older interfaces are retained
|
||||
** for backwards compatibility, but their use is discouraged.
|
||||
** ^In the "v2" interfaces, the prepared statement
|
||||
** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
|
||||
** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
|
||||
** The older interfaces are retained (sqlite3_prepare() and sqlite3_prepare16())
|
||||
** are retained for backwards compatibility, but their use is discouraged.
|
||||
** ^In the "vX" interfaces, the prepared statement
|
||||
** that is returned (the [sqlite3_stmt] object) contains a copy of the
|
||||
** original SQL text. This causes the [sqlite3_step()] interface to
|
||||
** behave differently in three ways:
|
||||
@@ -3548,6 +3581,12 @@ int sqlite3_limit(sqlite3*, int id, int newVal);
|
||||
** or [GLOB] operator or if the parameter is compared to an indexed column
|
||||
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
|
||||
** </li>
|
||||
**
|
||||
** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
|
||||
** the extra prepFlags parameter, which is a bit array consisting of zero or
|
||||
** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
|
||||
** sqlite3_prepare_v2() interface works exactly the same as
|
||||
** sqlite3_prepare_v3() with a zero prepFlags parameter.
|
||||
** </ol>
|
||||
*/
|
||||
int sqlite3_prepare(
|
||||
@@ -3564,6 +3603,14 @@ int sqlite3_prepare_v2(
|
||||
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
int sqlite3_prepare_v3(
|
||||
sqlite3 *db, /* Database handle */
|
||||
const char *zSql, /* SQL statement, UTF-8 encoded */
|
||||
int nByte, /* Maximum length of zSql in bytes. */
|
||||
unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
|
||||
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
int sqlite3_prepare16(
|
||||
sqlite3 *db, /* Database handle */
|
||||
const void *zSql, /* SQL statement, UTF-16 encoded */
|
||||
@@ -3578,6 +3625,14 @@ int sqlite3_prepare16_v2(
|
||||
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
|
||||
const void **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
int sqlite3_prepare16_v3(
|
||||
sqlite3 *db, /* Database handle */
|
||||
const void *zSql, /* SQL statement, UTF-16 encoded */
|
||||
int nByte, /* Maximum length of zSql in bytes. */
|
||||
unsigned int prepFalgs, /* Zero or more SQLITE_PREPARE_ flags */
|
||||
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
|
||||
const void **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Retrieving Statement SQL
|
||||
@@ -3585,7 +3640,8 @@ int sqlite3_prepare16_v2(
|
||||
**
|
||||
** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
|
||||
** SQL text used to create [prepared statement] P if P was
|
||||
** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
|
||||
** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
|
||||
** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
|
||||
** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
|
||||
** string containing the SQL text of prepared statement P with
|
||||
** [bound parameters] expanded.
|
||||
@@ -3731,7 +3787,7 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
|
||||
** METHOD: sqlite3_stmt
|
||||
**
|
||||
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
||||
** ^(In the SQL statement text input to [sqlite3_prepare_v3()] and its variants,
|
||||
** literals may be replaced by a [parameter] that matches one of following
|
||||
** templates:
|
||||
**
|
||||
@@ -3750,7 +3806,7 @@ typedef struct sqlite3_context sqlite3_context;
|
||||
**
|
||||
** ^The first argument to the sqlite3_bind_*() routines is always
|
||||
** a pointer to the [sqlite3_stmt] object returned from
|
||||
** [sqlite3_prepare_v2()] or its variants.
|
||||
** [sqlite3_prepare_v3()] or its variants.
|
||||
**
|
||||
** ^The second argument is the index of the SQL parameter to be set.
|
||||
** ^The leftmost SQL parameter has an index of 1. ^When the same named
|
||||
@@ -3887,8 +3943,8 @@ int sqlite3_bind_parameter_count(sqlite3_stmt*);
|
||||
** ^If the value N is out of range or if the N-th parameter is
|
||||
** nameless, then NULL is returned. ^The returned string is
|
||||
** always in UTF-8 encoding even if the named parameter was
|
||||
** originally specified as UTF-16 in [sqlite3_prepare16()] or
|
||||
** [sqlite3_prepare16_v2()].
|
||||
** originally specified as UTF-16 in [sqlite3_prepare16()],
|
||||
** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
|
||||
**
|
||||
** See also: [sqlite3_bind_blob|sqlite3_bind()],
|
||||
** [sqlite3_bind_parameter_count()], and
|
||||
@@ -3905,7 +3961,8 @@ const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
|
||||
** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
|
||||
** is returned if no matching parameter is found. ^The parameter
|
||||
** name must be given in UTF-8 even if the original statement
|
||||
** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
|
||||
** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
|
||||
** [sqlite3_prepare16_v3()].
|
||||
**
|
||||
** See also: [sqlite3_bind_blob|sqlite3_bind()],
|
||||
** [sqlite3_bind_parameter_count()], and
|
||||
@@ -4059,16 +4116,18 @@ const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
||||
** CAPI3REF: Evaluate An SQL Statement
|
||||
** METHOD: sqlite3_stmt
|
||||
**
|
||||
** After a [prepared statement] has been prepared using either
|
||||
** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
|
||||
** After a [prepared statement] has been prepared using any of
|
||||
** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
|
||||
** or [sqlite3_prepare16_v3()] or one of the legacy
|
||||
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
|
||||
** must be called one or more times to evaluate the statement.
|
||||
**
|
||||
** The details of the behavior of the sqlite3_step() interface depend
|
||||
** on whether the statement was prepared using the newer "v2" interface
|
||||
** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
|
||||
** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
|
||||
** new "v2" interface is recommended for new applications but the legacy
|
||||
** on whether the statement was prepared using the newer "vX" interfaces
|
||||
** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
|
||||
** [sqlite3_prepare16_v2()] or the older legacy
|
||||
** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
|
||||
** new "vX" interface is recommended for new applications but the legacy
|
||||
** interface will continue to be supported.
|
||||
**
|
||||
** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
|
||||
@@ -4129,10 +4188,11 @@ const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
||||
** specific [error codes] that better describes the error.
|
||||
** We admit that this is a goofy design. The problem has been fixed
|
||||
** with the "v2" interface. If you prepare all of your SQL statements
|
||||
** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
|
||||
** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
|
||||
** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
|
||||
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
|
||||
** then the more specific [error codes] are returned directly
|
||||
** by sqlite3_step(). The use of the "v2" interface is recommended.
|
||||
** by sqlite3_step(). The use of the "vX" interfaces is recommended.
|
||||
*/
|
||||
int sqlite3_step(sqlite3_stmt*);
|
||||
|
||||
@@ -4197,7 +4257,7 @@ int sqlite3_data_count(sqlite3_stmt *pStmt);
|
||||
** ^These routines return information about a single column of the current
|
||||
** result row of a query. ^In every case the first argument is a pointer
|
||||
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
|
||||
** that was returned from [sqlite3_prepare_v2()] or one of its variants)
|
||||
** that was returned from [sqlite3_prepare_v3()] or one of its variants)
|
||||
** and the second argument is the index of the column for which information
|
||||
** should be returned. ^The leftmost column of the result set has the index 0.
|
||||
** ^The number of columns in the result can be determined using
|
||||
@@ -5321,7 +5381,7 @@ int sqlite3_get_autocommit(sqlite3*);
|
||||
** to which a [prepared statement] belongs. ^The [database connection]
|
||||
** returned by sqlite3_db_handle is the same [database connection]
|
||||
** that was the first argument
|
||||
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
|
||||
** to the [sqlite3_prepare_v3()] call (or its variants) that was used to
|
||||
** create the statement in the first place.
|
||||
*/
|
||||
sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
||||
@@ -5397,7 +5457,7 @@ sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
|
||||
** completion of the [sqlite3_step()] call that triggered the commit
|
||||
** or rollback hook in the first place.
|
||||
** Note that running any other SQL statements, including SELECT statements,
|
||||
** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify
|
||||
** or merely calling [sqlite3_prepare_v3()] and [sqlite3_step()] will modify
|
||||
** the database connections for the meaning of "modify" in this paragraph.
|
||||
**
|
||||
** ^Registering a NULL function disables the callback.
|
||||
@@ -5457,7 +5517,7 @@ void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
|
||||
** the database connection that invoked the update hook. Any actions
|
||||
** to modify the database connection must be deferred until after the
|
||||
** completion of the [sqlite3_step()] call that triggered the update hook.
|
||||
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
|
||||
** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their
|
||||
** database connections for the meaning of "modify" in this paragraph.
|
||||
**
|
||||
** ^The sqlite3_update_hook(D,C,P) function
|
||||
|
||||
+32
-26
@@ -178,8 +178,9 @@
|
||||
** Include the configuration header output by 'configure' if we're using the
|
||||
** autoconf-based build
|
||||
*/
|
||||
#ifdef _HAVE_SQLITE_CONFIG_H
|
||||
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
|
||||
#include "config.h"
|
||||
#define SQLITECONFIG_H 1
|
||||
#endif
|
||||
|
||||
#include "sqliteLimit.h"
|
||||
@@ -1449,8 +1450,8 @@ struct sqlite3 {
|
||||
** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC
|
||||
** SQLITE_CacheSpill == PAGER_CACHE_SPILL
|
||||
*/
|
||||
#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */
|
||||
#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */
|
||||
#define SQLITE_WriteSchema 0x00000001 /* OK to update SQLITE_MASTER */
|
||||
#define SQLITE_LegacyFileFmt 0x00000002 /* Create new databases in format 1 */
|
||||
#define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */
|
||||
#define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */
|
||||
#define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */
|
||||
@@ -1461,29 +1462,34 @@ struct sqlite3 {
|
||||
/* the count using a callback. */
|
||||
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
|
||||
/* result set is empty */
|
||||
#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */
|
||||
#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */
|
||||
#define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */
|
||||
#define SQLITE_VdbeAddopTrace 0x00001000 /* Trace sqlite3VdbeAddOp() calls */
|
||||
#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */
|
||||
#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */
|
||||
#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */
|
||||
#define SQLITE_RecoveryMode 0x00010000 /* Ignore schema errors */
|
||||
#define SQLITE_ReverseOrder 0x00020000 /* Reverse unordered SELECTs */
|
||||
#define SQLITE_RecTriggers 0x00040000 /* Enable recursive triggers */
|
||||
#define SQLITE_ForeignKeys 0x00080000 /* Enforce foreign key constraints */
|
||||
#define SQLITE_AutoIndex 0x00100000 /* Enable automatic indexes */
|
||||
#define SQLITE_PreferBuiltin 0x00200000 /* Preference to built-in funcs */
|
||||
#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */
|
||||
#define SQLITE_LoadExtFunc 0x00800000 /* Enable load_extension() SQL func */
|
||||
#define SQLITE_EnableTrigger 0x01000000 /* True to enable triggers */
|
||||
#define SQLITE_DeferFKs 0x02000000 /* Defer all FK constraints */
|
||||
#define SQLITE_QueryOnly 0x04000000 /* Disable database changes */
|
||||
#define SQLITE_VdbeEQP 0x08000000 /* Debug EXPLAIN QUERY PLAN */
|
||||
#define SQLITE_Vacuum 0x10000000 /* Currently in a VACUUM */
|
||||
#define SQLITE_CellSizeCk 0x20000000 /* Check btree cell sizes on load */
|
||||
#define SQLITE_Fts3Tokenizer 0x40000000 /* Enable fts3_tokenizer(2) */
|
||||
#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */
|
||||
#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
|
||||
#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
|
||||
#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
|
||||
#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
|
||||
#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
|
||||
#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
|
||||
#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
|
||||
#define SQLITE_LoadExtension 0x00010000 /* Enable load_extension */
|
||||
#define SQLITE_EnableTrigger 0x00020000 /* True to enable triggers */
|
||||
#define SQLITE_DeferFKs 0x00040000 /* Defer all FK constraints */
|
||||
#define SQLITE_QueryOnly 0x00080000 /* Disable database changes */
|
||||
#define SQLITE_CellSizeCk 0x00100000 /* Check btree cell sizes on load */
|
||||
#define SQLITE_Fts3Tokenizer 0x00200000 /* Enable fts3_tokenizer(2) */
|
||||
#define SQLITE_EnableQPSG 0x00400000 /* Query Planner Stability Guarantee */
|
||||
/* The next four values are not used by PRAGMAs or by sqlite3_dbconfig() and
|
||||
** could be factored out into a separate bit vector of the sqlite3 object. */
|
||||
#define SQLITE_InternChanges 0x00800000 /* Uncommitted Hash table changes */
|
||||
#define SQLITE_LoadExtFunc 0x01000000 /* Enable load_extension() SQL func */
|
||||
#define SQLITE_PreferBuiltin 0x02000000 /* Preference to built-in funcs */
|
||||
#define SQLITE_Vacuum 0x04000000 /* Currently in a VACUUM */
|
||||
/* Flags used only if debugging */
|
||||
#ifdef SQLITE_DEBUG
|
||||
#define SQLITE_SqlTrace 0x08000000 /* Debug print SQL as it executes */
|
||||
#define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */
|
||||
#define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */
|
||||
#define SQLITE_VdbeAddopTrace 0x40000000 /* Trace sqlite3VdbeAddOp() calls */
|
||||
#define SQLITE_VdbeEQP 0x80000000 /* Debug EXPLAIN QUERY PLAN */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+46
-13
@@ -161,6 +161,7 @@ struct SqliteDb {
|
||||
int nStmt; /* Number of statements in stmtList */
|
||||
IncrblobChannel *pIncrblob;/* Linked list of open incrblob channels */
|
||||
int nStep, nSort, nIndex; /* Statistics for most recent operation */
|
||||
int nVMStep; /* Another statistic for most recent operation */
|
||||
int nTransaction; /* Number of nested [transaction] methods */
|
||||
int openFlags; /* Flags used to open. (SQLITE_OPEN_URI) */
|
||||
#ifdef SQLITE_TEST
|
||||
@@ -1214,12 +1215,18 @@ static int dbPrepare(
|
||||
sqlite3_stmt **ppStmt, /* OUT: Prepared statement */
|
||||
const char **pzOut /* OUT: Pointer to next SQL statement */
|
||||
){
|
||||
unsigned int prepFlags = 0;
|
||||
#ifdef SQLITE_TEST
|
||||
if( pDb->bLegacyPrepare ){
|
||||
return sqlite3_prepare(pDb->db, zSql, -1, ppStmt, pzOut);
|
||||
}
|
||||
#endif
|
||||
return sqlite3_prepare_v2(pDb->db, zSql, -1, ppStmt, pzOut);
|
||||
/* If the statement cache is large, use the SQLITE_PREPARE_PERSISTENT
|
||||
** flags, which uses less lookaside memory. But if the cache is small,
|
||||
** omit that flag to make full use of lookaside */
|
||||
if( pDb->maxStmt>5 ) prepFlags = SQLITE_PREPARE_PERSISTENT;
|
||||
|
||||
return sqlite3_prepare_v3(pDb->db, zSql, -1, prepFlags, ppStmt, pzOut);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1450,10 +1457,13 @@ struct DbEvalContext {
|
||||
const char *zSql; /* Remaining SQL to execute */
|
||||
SqlPreparedStmt *pPreStmt; /* Current statement */
|
||||
int nCol; /* Number of columns returned by pStmt */
|
||||
int evalFlags; /* Flags used */
|
||||
Tcl_Obj *pArray; /* Name of array variable */
|
||||
Tcl_Obj **apColName; /* Array of column names */
|
||||
};
|
||||
|
||||
#define SQLITE_EVAL_WITHOUTNULLS 0x00001 /* Unset array(*) for NULL */
|
||||
|
||||
/*
|
||||
** Release any cache of column names currently held as part of
|
||||
** the DbEvalContext structure passed as the first argument.
|
||||
@@ -1486,7 +1496,8 @@ static void dbEvalInit(
|
||||
DbEvalContext *p, /* Pointer to structure to initialize */
|
||||
SqliteDb *pDb, /* Database handle */
|
||||
Tcl_Obj *pSql, /* Object containing SQL script */
|
||||
Tcl_Obj *pArray /* Name of Tcl array to set (*) element of */
|
||||
Tcl_Obj *pArray, /* Name of Tcl array to set (*) element of */
|
||||
int evalFlags /* Flags controlling evaluation */
|
||||
){
|
||||
memset(p, 0, sizeof(DbEvalContext));
|
||||
p->pDb = pDb;
|
||||
@@ -1497,6 +1508,7 @@ static void dbEvalInit(
|
||||
p->pArray = pArray;
|
||||
Tcl_IncrRefCount(pArray);
|
||||
}
|
||||
p->evalFlags = evalFlags;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1588,6 +1600,7 @@ static int dbEvalStep(DbEvalContext *p){
|
||||
pDb->nStep = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_FULLSCAN_STEP,1);
|
||||
pDb->nSort = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_SORT,1);
|
||||
pDb->nIndex = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_AUTOINDEX,1);
|
||||
pDb->nVMStep = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_VM_STEP,1);
|
||||
dbReleaseColumnNames(p);
|
||||
p->pPreStmt = 0;
|
||||
|
||||
@@ -1728,11 +1741,15 @@ static int SQLITE_TCLAPI DbEvalNextCmd(
|
||||
Tcl_Obj **apColName;
|
||||
dbEvalRowInfo(p, &nCol, &apColName);
|
||||
for(i=0; i<nCol; i++){
|
||||
Tcl_Obj *pVal = dbEvalColumnValue(p, i);
|
||||
if( pArray==0 ){
|
||||
Tcl_ObjSetVar2(interp, apColName[i], 0, pVal, 0);
|
||||
Tcl_ObjSetVar2(interp, apColName[i], 0, dbEvalColumnValue(p,i), 0);
|
||||
}else if( (p->evalFlags & SQLITE_EVAL_WITHOUTNULLS)!=0
|
||||
&& sqlite3_column_type(p->pPreStmt->pStmt, i)==SQLITE_NULL
|
||||
){
|
||||
Tcl_UnsetVar2(interp, Tcl_GetString(pArray),
|
||||
Tcl_GetString(apColName[i]), 0);
|
||||
}else{
|
||||
Tcl_ObjSetVar2(interp, pArray, apColName[i], pVal, 0);
|
||||
Tcl_ObjSetVar2(interp, pArray, apColName[i], dbEvalColumnValue(p,i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2445,7 +2462,7 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
dbEvalInit(&sEval, pDb, objv[2], 0);
|
||||
dbEvalInit(&sEval, pDb, objv[2], 0, 0);
|
||||
rc = dbEvalStep(&sEval);
|
||||
if( choice==DB_ONECOLUMN ){
|
||||
if( rc==TCL_OK ){
|
||||
@@ -2466,7 +2483,7 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
}
|
||||
|
||||
/*
|
||||
** $db eval $sql ?array? ?{ ...code... }?
|
||||
** $db eval ?options? $sql ?array? ?{ ...code... }?
|
||||
**
|
||||
** The SQL statement in $sql is evaluated. For each row, the values are
|
||||
** placed in elements of the array named "array" and ...code... is executed.
|
||||
@@ -2475,8 +2492,22 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
** that have the same name as the fields extracted by the query.
|
||||
*/
|
||||
case DB_EVAL: {
|
||||
int evalFlags = 0;
|
||||
const char *zOpt;
|
||||
while( objc>3 && (zOpt = Tcl_GetString(objv[2]))!=0 && zOpt[0]=='-' ){
|
||||
if( strcmp(zOpt, "-withoutnulls")==0 ){
|
||||
evalFlags |= SQLITE_EVAL_WITHOUTNULLS;
|
||||
}
|
||||
else{
|
||||
Tcl_AppendResult(interp, "unknown option: \"", zOpt, "\"", (void*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
objc--;
|
||||
objv++;
|
||||
}
|
||||
if( objc<3 || objc>5 ){
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME? ?SCRIPT?");
|
||||
Tcl_WrongNumArgs(interp, 2, objv,
|
||||
"?OPTIONS? SQL ?ARRAY-NAME? ?SCRIPT?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -2484,7 +2515,7 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
DbEvalContext sEval;
|
||||
Tcl_Obj *pRet = Tcl_NewObj();
|
||||
Tcl_IncrRefCount(pRet);
|
||||
dbEvalInit(&sEval, pDb, objv[2], 0);
|
||||
dbEvalInit(&sEval, pDb, objv[2], 0, 0);
|
||||
while( TCL_OK==(rc = dbEvalStep(&sEval)) ){
|
||||
int i;
|
||||
int nCol;
|
||||
@@ -2505,14 +2536,14 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
Tcl_Obj *pArray = 0;
|
||||
Tcl_Obj *pScript;
|
||||
|
||||
if( objc==5 && *(char *)Tcl_GetString(objv[3]) ){
|
||||
if( objc>=5 && *(char *)Tcl_GetString(objv[3]) ){
|
||||
pArray = objv[3];
|
||||
}
|
||||
pScript = objv[objc-1];
|
||||
Tcl_IncrRefCount(pScript);
|
||||
|
||||
p = (DbEvalContext *)Tcl_Alloc(sizeof(DbEvalContext));
|
||||
dbEvalInit(p, pDb, objv[2], pArray);
|
||||
dbEvalInit(p, pDb, objv[2], pArray, evalFlags);
|
||||
|
||||
cd2[0] = (void *)p;
|
||||
cd2[1] = (void *)pScript;
|
||||
@@ -2855,7 +2886,7 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
}
|
||||
|
||||
/*
|
||||
** $db status (step|sort|autoindex)
|
||||
** $db status (step|sort|autoindex|vmstep)
|
||||
**
|
||||
** Display SQLITE_STMTSTATUS_FULLSCAN_STEP or
|
||||
** SQLITE_STMTSTATUS_SORT for the most recent eval.
|
||||
@@ -2874,9 +2905,11 @@ static int SQLITE_TCLAPI DbObjCmd(
|
||||
v = pDb->nSort;
|
||||
}else if( strcmp(zOp, "autoindex")==0 ){
|
||||
v = pDb->nIndex;
|
||||
}else if( strcmp(zOp, "vmstep")==0 ){
|
||||
v = pDb->nVMStep;
|
||||
}else{
|
||||
Tcl_AppendResult(interp,
|
||||
"bad argument: should be autoindex, step, or sort",
|
||||
"bad argument: should be autoindex, step, sort or vmstep",
|
||||
(char*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
@@ -7317,6 +7317,7 @@ static int SQLITE_TCLAPI test_sqlite3_db_config(
|
||||
{ "FTS3_TOKENIZER", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
|
||||
{ "LOAD_EXTENSION", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
|
||||
{ "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
|
||||
{ "QPSG", SQLITE_DBCONFIG_ENABLE_QPSG },
|
||||
};
|
||||
int i;
|
||||
int v;
|
||||
|
||||
+1
-1
@@ -6571,7 +6571,7 @@ case OP_Expire: {
|
||||
*/
|
||||
case OP_TableLock: {
|
||||
u8 isWriteLock = (u8)pOp->p3;
|
||||
if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){
|
||||
if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){
|
||||
int p1 = pOp->p1;
|
||||
assert( p1>=0 && p1<db->nDb );
|
||||
assert( DbMaskTest(p->btreeMask, p1) );
|
||||
|
||||
+8
-1
@@ -165,6 +165,12 @@ typedef struct VdbeOpList VdbeOpList;
|
||||
*/
|
||||
#include "opcodes.h"
|
||||
|
||||
/*
|
||||
** Additional non-public SQLITE_PREPARE_* flags
|
||||
*/
|
||||
#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
|
||||
#define SQLITE_PREPARE_MASK 0x0f /* Mask of public flags */
|
||||
|
||||
/*
|
||||
** Prototypes for the VDBE interface. See comments on the implementation
|
||||
** for a description of what each of these routines does.
|
||||
@@ -222,7 +228,8 @@ void sqlite3VdbeSetNumCols(Vdbe*,int);
|
||||
int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
|
||||
void sqlite3VdbeCountChanges(Vdbe*);
|
||||
sqlite3 *sqlite3VdbeDb(Vdbe*);
|
||||
void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);
|
||||
u8 sqlite3VdbePrepareFlags(Vdbe*);
|
||||
void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8);
|
||||
void sqlite3VdbeSwap(Vdbe*,Vdbe*);
|
||||
VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
|
||||
sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);
|
||||
|
||||
+1
-1
@@ -382,6 +382,7 @@ struct Vdbe {
|
||||
u16 nResColumn; /* Number of columns in one row of the result set */
|
||||
u8 errorAction; /* Recovery action to do in case of an error */
|
||||
u8 minWriteFileFormat; /* Minimum file format for writable database files */
|
||||
u8 prepFlags; /* SQLITE_PREPARE_* flags */
|
||||
bft expired:1; /* True if the VM needs to be recompiled */
|
||||
bft doingRerun:1; /* True if rerunning after an auto-reprepare */
|
||||
bft explain:2; /* True if EXPLAIN present on SQL command */
|
||||
@@ -390,7 +391,6 @@ struct Vdbe {
|
||||
bft usesStmtJournal:1; /* True if uses a statement journal */
|
||||
bft readOnly:1; /* True for statements that do not write */
|
||||
bft bIsReader:1; /* True for statements that read */
|
||||
bft isPrepareV2:1; /* True if prepared with prepare_v2() */
|
||||
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
|
||||
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
|
||||
u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
|
||||
|
||||
+9
-6
@@ -154,7 +154,7 @@ int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
|
||||
sqlite3VdbeMemRelease(&p->aVar[i]);
|
||||
p->aVar[i].flags = MEM_Null;
|
||||
}
|
||||
assert( p->isPrepareV2 || p->expmask==0 );
|
||||
assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 );
|
||||
if( p->expmask ){
|
||||
p->expired = 1;
|
||||
}
|
||||
@@ -633,8 +633,11 @@ end_of_step:
|
||||
|| (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE
|
||||
);
|
||||
assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp );
|
||||
if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
|
||||
/* If this statement was prepared using sqlite3_prepare_v2(), and an
|
||||
if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0
|
||||
&& rc!=SQLITE_ROW
|
||||
&& rc!=SQLITE_DONE
|
||||
){
|
||||
/* If this statement was prepared using saved SQL and an
|
||||
** error has occurred, then return the error code in p->rc to the
|
||||
** caller. Set the error code in the database handle to the same value.
|
||||
*/
|
||||
@@ -1273,7 +1276,7 @@ static int vdbeUnbind(Vdbe *p, int i){
|
||||
** as if there had been a schema change, on the first sqlite3_step() call
|
||||
** following any change to the bindings of that parameter.
|
||||
*/
|
||||
assert( p->isPrepareV2 || p->expmask==0 );
|
||||
assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 );
|
||||
if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){
|
||||
p->expired = 1;
|
||||
}
|
||||
@@ -1539,11 +1542,11 @@ int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
|
||||
if( pFrom->nVar!=pTo->nVar ){
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
assert( pTo->isPrepareV2 || pTo->expmask==0 );
|
||||
assert( (pTo->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pTo->expmask==0 );
|
||||
if( pTo->expmask ){
|
||||
pTo->expired = 1;
|
||||
}
|
||||
assert( pFrom->isPrepareV2 || pFrom->expmask==0 );
|
||||
assert( (pFrom->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pFrom->expmask==0 );
|
||||
if( pFrom->expmask ){
|
||||
pFrom->expired = 1;
|
||||
}
|
||||
|
||||
+15
-8
@@ -54,16 +54,14 @@ void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){
|
||||
/*
|
||||
** Remember the SQL string for a prepared statement.
|
||||
*/
|
||||
void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){
|
||||
assert( isPrepareV2==1 || isPrepareV2==0 );
|
||||
void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){
|
||||
if( p==0 ) return;
|
||||
if( !isPrepareV2 ) p->expmask = 0;
|
||||
#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG)
|
||||
if( !isPrepareV2 ) return;
|
||||
#endif
|
||||
p->prepFlags = prepFlags;
|
||||
if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){
|
||||
p->expmask = 0;
|
||||
}
|
||||
assert( p->zSql==0 );
|
||||
p->zSql = sqlite3DbStrNDup(p->db, z, n);
|
||||
p->isPrepareV2 = (u8)isPrepareV2;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -85,8 +83,8 @@ void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
|
||||
zTmp = pA->zSql;
|
||||
pA->zSql = pB->zSql;
|
||||
pB->zSql = zTmp;
|
||||
pB->isPrepareV2 = pA->isPrepareV2;
|
||||
pB->expmask = pA->expmask;
|
||||
pB->prepFlags = pA->prepFlags;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4530,6 +4528,13 @@ sqlite3 *sqlite3VdbeDb(Vdbe *v){
|
||||
return v->db;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the SQLITE_PREPARE flags for a Vdbe.
|
||||
*/
|
||||
u8 sqlite3VdbePrepareFlags(Vdbe *v){
|
||||
return v->prepFlags;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a pointer to an sqlite3_value structure containing the value bound
|
||||
** parameter iVar of VM v. Except, if the value is an SQL NULL, return
|
||||
@@ -4542,6 +4547,7 @@ sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){
|
||||
assert( iVar>0 );
|
||||
if( v ){
|
||||
Mem *pMem = &v->aVar[iVar-1];
|
||||
assert( (v->db->flags & SQLITE_EnableQPSG)==0 );
|
||||
if( 0==(pMem->flags & MEM_Null) ){
|
||||
sqlite3_value *pRet = sqlite3ValueNew(v->db);
|
||||
if( pRet ){
|
||||
@@ -4561,6 +4567,7 @@ sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){
|
||||
*/
|
||||
void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
|
||||
assert( iVar>0 );
|
||||
assert( (v->db->flags & SQLITE_EnableQPSG)==0 );
|
||||
if( iVar>=32 ){
|
||||
v->expmask |= 0x80000000;
|
||||
}else{
|
||||
|
||||
+3
-6
@@ -1482,14 +1482,13 @@ static int stat4ValueFromExpr(
|
||||
/* Skip over any TK_COLLATE nodes */
|
||||
pExpr = sqlite3ExprSkipCollate(pExpr);
|
||||
|
||||
assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE );
|
||||
if( !pExpr ){
|
||||
pVal = valueNew(db, pAlloc);
|
||||
if( pVal ){
|
||||
sqlite3VdbeMemSetNull((Mem*)pVal);
|
||||
}
|
||||
}else if( pExpr->op==TK_VARIABLE
|
||||
|| NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)
|
||||
){
|
||||
}else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
|
||||
Vdbe *v;
|
||||
int iBindVar = pExpr->iColumn;
|
||||
sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);
|
||||
@@ -1497,9 +1496,7 @@ static int stat4ValueFromExpr(
|
||||
pVal = valueNew(db, pAlloc);
|
||||
if( pVal ){
|
||||
rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
|
||||
}
|
||||
sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
|
||||
pVal->db = pParse->db;
|
||||
}
|
||||
}
|
||||
|
||||
+45
-11
@@ -3972,6 +3972,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
||||
rUnsorted, rCost));
|
||||
}else{
|
||||
rCost = rUnsorted;
|
||||
rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */
|
||||
}
|
||||
|
||||
/* Check to see if pWLoop should be added to the set of
|
||||
@@ -4294,6 +4295,31 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Helper function for exprIsDeterministic().
|
||||
*/
|
||||
static int exprNodeIsDeterministic(Walker *pWalker, Expr *pExpr){
|
||||
if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_ConstFunc)==0 ){
|
||||
pWalker->eCode = 0;
|
||||
return WRC_Abort;
|
||||
}
|
||||
return WRC_Continue;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if the expression contains no non-deterministic SQL
|
||||
** functions. Do not consider non-deterministic SQL functions that are
|
||||
** part of sub-select statements.
|
||||
*/
|
||||
static int exprIsDeterministic(Expr *p){
|
||||
Walker w;
|
||||
memset(&w, 0, sizeof(w));
|
||||
w.eCode = 1;
|
||||
w.xExprCallback = exprNodeIsDeterministic;
|
||||
sqlite3WalkExpr(&w, p);
|
||||
return w.eCode;
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate the beginning of the loop used for WHERE clause processing.
|
||||
** The return value is a pointer to an opaque structure that contains
|
||||
@@ -4492,17 +4518,6 @@ WhereInfo *sqlite3WhereBegin(
|
||||
sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
|
||||
sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
|
||||
|
||||
/* Special case: a WHERE clause that is constant. Evaluate the
|
||||
** expression and either jump over all of the code or fall thru.
|
||||
*/
|
||||
for(ii=0; ii<sWLB.pWC->nTerm; ii++){
|
||||
if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){
|
||||
sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak,
|
||||
SQLITE_JUMPIFNULL);
|
||||
sWLB.pWC->a[ii].wtFlags |= TERM_CODED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Special case: No FROM clause
|
||||
*/
|
||||
if( nTabList==0 ){
|
||||
@@ -4541,6 +4556,25 @@ WhereInfo *sqlite3WhereBegin(
|
||||
sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
|
||||
if( db->mallocFailed ) goto whereBeginError;
|
||||
|
||||
/* Special case: WHERE terms that do not refer to any tables in the join
|
||||
** (constant expressions). Evaluate each such term, and jump over all the
|
||||
** generated code if the result is not true.
|
||||
**
|
||||
** Do not do this if the expression contains non-deterministic functions
|
||||
** that are not within a sub-select. This is not strictly required, but
|
||||
** preserves SQLite's legacy behaviour in the following two cases:
|
||||
**
|
||||
** FROM ... WHERE random()>0; -- eval random() once per row
|
||||
** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
|
||||
*/
|
||||
for(ii=0; ii<sWLB.pWC->nTerm; ii++){
|
||||
WhereTerm *pT = &sWLB.pWC->a[ii];
|
||||
if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
|
||||
sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL);
|
||||
pT->wtFlags |= TERM_CODED;
|
||||
}
|
||||
}
|
||||
|
||||
if( wctrlFlags & WHERE_WANT_DISTINCT ){
|
||||
if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
|
||||
/* The DISTINCT marking is pointless. Ignore it. */
|
||||
|
||||
+4
-1
@@ -216,7 +216,7 @@ static int isLikeOrGlob(
|
||||
|
||||
pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
|
||||
op = pRight->op;
|
||||
if( op==TK_VARIABLE ){
|
||||
if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
|
||||
Vdbe *pReprepare = pParse->pReprepare;
|
||||
int iCol = pRight->iColumn;
|
||||
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);
|
||||
@@ -1178,6 +1178,9 @@ static void exprAnalyze(
|
||||
Expr *pNewExpr;
|
||||
pNewExpr = sqlite3PExpr(pParse, TK_MATCH,
|
||||
0, sqlite3ExprDup(db, pRight, 0));
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
|
||||
ExprSetProperty(pNewExpr, EP_FromJoin);
|
||||
}
|
||||
idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
|
||||
testcase( idxNew==0 );
|
||||
pNewTerm = &pWC->a[idxNew];
|
||||
|
||||
@@ -123,6 +123,36 @@ do_eqp_test analyze3-1.1.3 {
|
||||
SELECT sum(y) FROM t1 WHERE x>0 AND x<1100
|
||||
} {0 0 0 {SCAN TABLE t1}}
|
||||
|
||||
# 2017-06-26: Verify that the SQLITE_DBCONFIG_ENABLE_QPSG setting disables
|
||||
# the use of bound parameters by STAT4
|
||||
#
|
||||
db cache flush
|
||||
unset -nocomplain l
|
||||
unset -nocomplain u
|
||||
do_eqp_test analyze3-1.1.3.100 {
|
||||
SELECT sum(y) FROM t1 WHERE x>$l AND x<$u
|
||||
} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (x>? AND x<?)}}
|
||||
set l 200
|
||||
set u 300
|
||||
do_eqp_test analyze3-1.1.3.101 {
|
||||
SELECT sum(y) FROM t1 WHERE x>$l AND x<$u
|
||||
} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (x>? AND x<?)}}
|
||||
set l 0
|
||||
set u 1100
|
||||
do_eqp_test analyze3-1.1.3.102 {
|
||||
SELECT sum(y) FROM t1 WHERE x>$l AND x<$u
|
||||
} {0 0 0 {SCAN TABLE t1}}
|
||||
db cache flush
|
||||
sqlite3_db_config db ENABLE_QPSG 1
|
||||
do_eqp_test analyze3-1.1.3.103 {
|
||||
SELECT sum(y) FROM t1 WHERE x>$l AND x<$u
|
||||
} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (x>? AND x<?)}}
|
||||
db cache flush
|
||||
sqlite3_db_config db ENABLE_QPSG 0
|
||||
do_eqp_test analyze3-1.1.3.104 {
|
||||
SELECT sum(y) FROM t1 WHERE x>$l AND x<$u
|
||||
} {0 0 0 {SCAN TABLE t1}}
|
||||
|
||||
do_test analyze3-1.1.4 {
|
||||
sf_execsql { SELECT sum(y) FROM t1 WHERE x>200 AND x<300 }
|
||||
} {199 0 14850}
|
||||
|
||||
+3
-3
@@ -188,24 +188,24 @@ do_eqp_test 3.1.1 {
|
||||
do_eqp_test 3.1.2 {
|
||||
SELECT * FROM t1 WHERE (SELECT x FROM t1 AS sub);
|
||||
} {
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
0 0 0 {EXECUTE SCALAR SUBQUERY 1}
|
||||
1 0 0 {SCAN TABLE t1 AS sub}
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
}
|
||||
do_eqp_test 3.1.3 {
|
||||
SELECT * FROM t1 WHERE (SELECT x FROM t1 AS sub ORDER BY y);
|
||||
} {
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
0 0 0 {EXECUTE SCALAR SUBQUERY 1}
|
||||
1 0 0 {SCAN TABLE t1 AS sub}
|
||||
1 0 0 {USE TEMP B-TREE FOR ORDER BY}
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
}
|
||||
do_eqp_test 3.1.4 {
|
||||
SELECT * FROM t1 WHERE (SELECT x FROM t2 ORDER BY x);
|
||||
} {
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
0 0 0 {EXECUTE SCALAR SUBQUERY 1}
|
||||
1 0 0 {SCAN TABLE t2 USING COVERING INDEX t2i1}
|
||||
0 0 0 {SCAN TABLE t1}
|
||||
}
|
||||
|
||||
det 3.2.1 {
|
||||
|
||||
@@ -61,4 +61,24 @@ do_catchsql_test 2.5 {
|
||||
SELECT * FROM ft3, ft2 WHERE y MATCH x AND x MATCH y;
|
||||
} {1 {unable to use function MATCH in the requested context}}
|
||||
|
||||
do_execsql_test 3.0 {
|
||||
CREATE VIRTUAL TABLE vt USING fts3(x);
|
||||
INSERT INTO vt VALUES('abc');
|
||||
INSERT INTO vt VALUES('xyz');
|
||||
|
||||
CREATE TABLE tt(a INTEGER PRIMARY KEY);
|
||||
INSERT INTO tt VALUES(1), (2);
|
||||
}
|
||||
|
||||
do_execsql_test 3.1 {
|
||||
SELECT * FROM tt LEFT JOIN (
|
||||
SELECT rowid AS rrr, * FROM vt WHERE vt MATCH 'abc'
|
||||
) ON tt.a = rrr
|
||||
} {1 1 abc 2 {} {}}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
SELECT * FROM tt LEFT JOIN vt ON (vt MATCH 'abc')
|
||||
} {1 abc 2 abc}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -763,4 +763,21 @@ do_execsql_test join-14.12 {
|
||||
SELECT *, '|' FROM t3 LEFT JOIN v2 ON a=x ORDER BY b;
|
||||
} {4 {} {} | 2 2 1 |}
|
||||
|
||||
# Verify the fix for ticket
|
||||
# https://www.sqlite.org/src/info/892fc34f173e99d8
|
||||
#
|
||||
db close
|
||||
sqlite3 db :memory:
|
||||
do_execsql_test join-14.20 {
|
||||
CREATE TABLE t1(id INTEGER PRIMARY KEY);
|
||||
CREATE TABLE t2(id INTEGER PRIMARY KEY, c2 INTEGER);
|
||||
CREATE TABLE t3(id INTEGER PRIMARY KEY, c3 INTEGER);
|
||||
INSERT INTO t1(id) VALUES(456);
|
||||
INSERT INTO t3(id) VALUES(1),(2);
|
||||
SELECT t1.id, x2.id, x3.id
|
||||
FROM t1
|
||||
LEFT JOIN (SELECT * FROM t2) AS x2 ON t1.id=x2.c2
|
||||
LEFT JOIN t3 AS x3 ON x2.id=x3.c3;
|
||||
} {456 {} {}}
|
||||
|
||||
finish_test
|
||||
|
||||
+44
-2
@@ -160,6 +160,7 @@ ifcapable !like_opt {
|
||||
#
|
||||
proc queryplan {sql} {
|
||||
set ::sqlite_sort_count 0
|
||||
db cache flush
|
||||
set data [execsql $sql]
|
||||
if {$::sqlite_sort_count} {set x sort} {set x nosort}
|
||||
lappend data $x
|
||||
@@ -196,7 +197,7 @@ do_test like-3.2 {
|
||||
|
||||
# With an index on t1.x and case sensitivity on, optimize completely.
|
||||
#
|
||||
do_test like-3.3 {
|
||||
do_test like-3.3.100 {
|
||||
set sqlite_like_count 0
|
||||
execsql {
|
||||
PRAGMA case_sensitive_like=on;
|
||||
@@ -206,10 +207,51 @@ do_test like-3.3 {
|
||||
SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1;
|
||||
}
|
||||
} {abc abcd nosort {} i1}
|
||||
do_test like-3.4 {
|
||||
do_test like-3.3.101 {
|
||||
set sqlite_like_count
|
||||
} 0
|
||||
|
||||
# The like optimization works even when the pattern is a bound parameter
|
||||
#
|
||||
do_test like-3.3.102 {
|
||||
set sqlite_like_count 0
|
||||
unset -nocomplain ::likepat
|
||||
set ::likepat abc%
|
||||
queryplan {
|
||||
SELECT x FROM t1 WHERE x LIKE $::likepat ORDER BY 1;
|
||||
}
|
||||
} {abc abcd nosort {} i1}
|
||||
do_test like-3.3.103 {
|
||||
set sqlite_like_count
|
||||
} 0
|
||||
|
||||
# Except, the like optimization does not work for bound parameters if
|
||||
# the query planner stability guarantee is active.
|
||||
#
|
||||
do_test like-3.3.104 {
|
||||
set sqlite_like_count 0
|
||||
sqlite3_db_config db QPSG 1
|
||||
queryplan {
|
||||
SELECT x FROM t1 WHERE x LIKE $::likepat ORDER BY 1;
|
||||
}
|
||||
} {abc abcd nosort {} i1}
|
||||
do_test like-3.3.105 {
|
||||
set sqlite_like_count
|
||||
} 12
|
||||
|
||||
# The query planner stability guarantee does not disrupt explicit patterns
|
||||
#
|
||||
do_test like-3.3.105 {
|
||||
set sqlite_like_count 0
|
||||
queryplan {
|
||||
SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1;
|
||||
}
|
||||
} {abc abcd nosort {} i1}
|
||||
do_test like-3.3.106 {
|
||||
set sqlite_like_count
|
||||
} 0
|
||||
sqlite3_db_config db QPSG 0
|
||||
|
||||
# The LIKE optimization still works when the RHS is a string with no
|
||||
# wildcard. Ticket [e090183531fc2747]
|
||||
#
|
||||
|
||||
@@ -558,6 +558,7 @@ do_test shell1-3.20.4 {
|
||||
catchcmd "test.db" ".restore FOO BAR BAD"
|
||||
} {1 {Usage: .restore ?DB? FILE}}
|
||||
|
||||
ifcapable vtab {
|
||||
# .schema ?TABLE? Show the CREATE statements
|
||||
# If TABLE specified, only show tables matching
|
||||
# LIKE pattern TABLE.
|
||||
@@ -583,6 +584,7 @@ do_test shell1-3.21.4 {
|
||||
CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
|
||||
CREATE VIEW v1 AS SELECT y+1 FROM v2;}}
|
||||
db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}
|
||||
}
|
||||
|
||||
# .separator STRING Change column separator used by output and .import
|
||||
do_test shell1-3.22.1 {
|
||||
|
||||
+32
-1
@@ -184,6 +184,36 @@ do_test shell5-1.4.10.2 {
|
||||
catchcmd "test.db" {SELECT b FROM t1 WHERE a='7';}
|
||||
} {0 {Now is the time for all good men to come to the aid of their country.}}
|
||||
|
||||
# import file with 2 rows, 2 columns and an initial BOM
|
||||
#
|
||||
do_test shell5-1.4.11 {
|
||||
set in [open shell5.csv wb]
|
||||
puts $in "\xef\xbb\xbf2|3"
|
||||
puts $in "4|5"
|
||||
close $in
|
||||
set res [catchcmd "test.db" {CREATE TABLE t2(x INT, y INT);
|
||||
.import shell5.csv t2
|
||||
.mode quote
|
||||
.header on
|
||||
SELECT * FROM t2;}]
|
||||
string map {\n | \n\r |} $res
|
||||
} {0 {'x','y'|2,3|4,5}}
|
||||
|
||||
# import file with 2 rows, 2 columns or text with an initial BOM
|
||||
#
|
||||
do_test shell5-1.4.12 {
|
||||
set in [open shell5.csv wb]
|
||||
puts $in "\xef\xbb\xbf\"two\"|3"
|
||||
puts $in "4|5"
|
||||
close $in
|
||||
set res [catchcmd "test.db" {DELETE FROM t2;
|
||||
.import shell5.csv t2
|
||||
.mode quote
|
||||
.header on
|
||||
SELECT * FROM t2;}]
|
||||
string map {\n | \n\r |} $res
|
||||
} {0 {'x','y'|'two',3|4,5}}
|
||||
|
||||
# check importing very long field
|
||||
do_test shell5-1.5.1 {
|
||||
set str [string repeat X 999]
|
||||
@@ -210,7 +240,8 @@ do_test shell5-1.6.1 {
|
||||
set in [open shell5.csv w]
|
||||
puts $in $data
|
||||
close $in
|
||||
set res [catchcmd "test.db" {.import shell5.csv t2
|
||||
set res [catchcmd "test.db" {DROP TABLE IF EXISTS t2;
|
||||
.import shell5.csv t2
|
||||
SELECT COUNT(*) FROM t2;}]
|
||||
} {0 1}
|
||||
|
||||
|
||||
+39
-1
@@ -113,7 +113,7 @@ ifcapable {complete} {
|
||||
do_test tcl-1.14 {
|
||||
set v [catch {db eval} msg]
|
||||
lappend v $msg
|
||||
} {1 {wrong # args: should be "db eval SQL ?ARRAY-NAME? ?SCRIPT?"}}
|
||||
} {1 {wrong # args: should be "db eval ?OPTIONS? SQL ?ARRAY-NAME? ?SCRIPT?"}}
|
||||
do_test tcl-1.15 {
|
||||
set v [catch {db function} msg]
|
||||
lappend v $msg
|
||||
@@ -665,6 +665,44 @@ do_test tcl-15.5 {
|
||||
} {0}
|
||||
|
||||
|
||||
# 2017-06-26: The --withoutnulls flag to "db eval".
|
||||
#
|
||||
# In the "db eval --withoutnulls SQL ARRAY" form, NULL results cause the
|
||||
# corresponding array entry to be unset. The default behavior (without
|
||||
# the -withoutnulls flags) is for the corresponding array value to get
|
||||
# the [db nullvalue] string.
|
||||
#
|
||||
catch {db close}
|
||||
forcedelete test.db
|
||||
sqlite3 db test.db
|
||||
do_execsql_test tcl-16.100 {
|
||||
CREATE TABLE t1(a,b);
|
||||
INSERT INTO t1 VALUES(1,2),(2,NULL),(3,'xyz');
|
||||
}
|
||||
do_test tcl-16.101 {
|
||||
set res {}
|
||||
unset -nocomplain x
|
||||
db eval {SELECT * FROM t1} x {
|
||||
lappend res $x(a) [array names x]
|
||||
}
|
||||
set res
|
||||
} {1 {a b *} 2 {a b *} 3 {a b *}}
|
||||
do_test tcl-16.102 {
|
||||
set res [catch {
|
||||
db eval -unknown {SELECT * FROM t1} x {
|
||||
lappend res $x(a) [array names x]
|
||||
}
|
||||
} rc]
|
||||
lappend res $rc
|
||||
} {1 {unknown option: "-unknown"}}
|
||||
do_test tcl-16.103 {
|
||||
set res {}
|
||||
unset -nocomplain x
|
||||
db eval -withoutnulls {SELECT * FROM t1} x {
|
||||
lappend res $x(a) [array names x]
|
||||
}
|
||||
set res
|
||||
} {1 {a b *} 2 {a *} 3 {a b *}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -119,4 +119,61 @@ do_execsql_test 4.0 {
|
||||
EXPLAIN QUERY PLAN SELECT rowid FROM t4 WHERE a=? AND b=?;
|
||||
} {/a=. AND b=./}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test the following case:
|
||||
#
|
||||
# ... FROM t1, t2 WHERE (
|
||||
# t2.rowid = +t1.rowid OR (t2.f2 = t1.f1 AND t1.f1!=-1)
|
||||
# )
|
||||
#
|
||||
# where there is an index on t2(f2). The planner should use "t1" as the
|
||||
# outer loop. The inner loop, on "t2", is an OR optimization. One pass
|
||||
# for:
|
||||
#
|
||||
# t2.rowid = $1
|
||||
#
|
||||
# and another for:
|
||||
#
|
||||
# t2.f2=$1 AND $1!=-1
|
||||
#
|
||||
# the test is to ensure that on the second pass, the ($1!=-1) condition
|
||||
# is tested before any seek operations are performed - i.e. outside of
|
||||
# the loop through the f2=$1 range of the t2(f2) index.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 5.0 {
|
||||
CREATE TABLE t1(f1);
|
||||
CREATE TABLE t2(f2);
|
||||
CREATE INDEX t2f ON t2(f2);
|
||||
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
|
||||
WITH w(i) AS (
|
||||
SELECT 1 UNION ALL SELECT i+1 FROM w WHERE i<1000
|
||||
)
|
||||
INSERT INTO t2 SELECT -1 FROM w;
|
||||
}
|
||||
|
||||
do_execsql_test 5.1 {
|
||||
SELECT count(*) FROM t1, t2 WHERE t2.rowid = +t1.rowid
|
||||
} {4}
|
||||
do_test 5.2 { expr [db status vmstep]<200 } 1
|
||||
|
||||
do_execsql_test 5.3 {
|
||||
SELECT count(*) FROM t1, t2 WHERE (
|
||||
t2.rowid = +t1.rowid OR t2.f2 = t1.f1
|
||||
)
|
||||
} {4000}
|
||||
do_test 5.4 { expr [db status vmstep]>1000 } 1
|
||||
|
||||
do_execsql_test 5.5 {
|
||||
SELECT count(*) FROM t1, t2 WHERE (
|
||||
t2.rowid = +t1.rowid OR (t2.f2 = t1.f1 AND t1.f1!=-1)
|
||||
)
|
||||
} {4}
|
||||
do_test 5.6 { expr [db status vmstep]<200 } 1
|
||||
|
||||
finish_test
|
||||
|
||||
+9
-2
@@ -3297,7 +3297,14 @@ PRIVATE int compute_action(struct lemon *lemp, struct action *ap)
|
||||
int act;
|
||||
switch( ap->type ){
|
||||
case SHIFT: act = ap->x.stp->statenum; break;
|
||||
case SHIFTREDUCE: act = ap->x.rp->iRule + lemp->nstate; break;
|
||||
case SHIFTREDUCE: {
|
||||
act = ap->x.rp->iRule + lemp->nstate;
|
||||
/* Since a SHIFT is inherient after a prior REDUCE, convert any
|
||||
** SHIFTREDUCE action with a nonterminal on the LHS into a simple
|
||||
** REDUCE action: */
|
||||
if( ap->sp->index>=lemp->nterminal ) act += lemp->nrule;
|
||||
break;
|
||||
}
|
||||
case REDUCE: act = ap->x.rp->iRule + lemp->nstate+lemp->nrule; break;
|
||||
case ERROR: act = lemp->nstate + lemp->nrule*2; break;
|
||||
case ACCEPT: act = lemp->nstate + lemp->nrule*2 + 1; break;
|
||||
@@ -4415,7 +4422,7 @@ void ReportTable(
|
||||
** sequentually beginning with 0.
|
||||
*/
|
||||
for(rp=lemp->rule; rp; rp=rp->next){
|
||||
fprintf(out," { %d, %d },\n",rp->lhs->index,rp->nrhs); lineno++;
|
||||
fprintf(out," { %d, %d },\n",rp->lhs->index,-rp->nrhs); lineno++;
|
||||
}
|
||||
tplt_xfer(lemp->name,in,out,&lineno);
|
||||
|
||||
|
||||
+21
-15
@@ -221,6 +221,7 @@ struct yyParser {
|
||||
yyStackEntry yystk0; /* First stack entry */
|
||||
#else
|
||||
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
|
||||
yyStackEntry *yystackEnd; /* Last entry in the stack */
|
||||
#endif
|
||||
};
|
||||
typedef struct yyParser yyParser;
|
||||
@@ -338,6 +339,7 @@ void ParseInit(void *yypParser){
|
||||
pParser->yytos = pParser->yystack;
|
||||
pParser->yystack[0].stateno = 0;
|
||||
pParser->yystack[0].major = 0;
|
||||
pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
|
||||
}
|
||||
|
||||
#ifndef Parse_ENGINEALWAYSONSTACK
|
||||
@@ -607,7 +609,7 @@ static void yy_shift(
|
||||
}
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){
|
||||
if( yypParser->yytos>yypParser->yystackEnd ){
|
||||
yypParser->yytos--;
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
@@ -635,8 +637,8 @@ static void yy_shift(
|
||||
** is used during the reduce.
|
||||
*/
|
||||
static const struct {
|
||||
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
|
||||
unsigned char nrhs; /* Number of right-hand side symbols in the rule */
|
||||
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
|
||||
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
|
||||
} yyRuleInfo[] = {
|
||||
%%
|
||||
};
|
||||
@@ -661,7 +663,7 @@ static void yy_reduce(
|
||||
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
|
||||
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
||||
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
||||
yyRuleName[yyruleno], yymsp[yysize].stateno);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
@@ -676,7 +678,7 @@ static void yy_reduce(
|
||||
}
|
||||
#endif
|
||||
#if YYSTACKDEPTH>0
|
||||
if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){
|
||||
if( yypParser->yytos>=yypParser->yystackEnd ){
|
||||
yyStackOverflow(yypParser);
|
||||
return;
|
||||
}
|
||||
@@ -707,20 +709,24 @@ static void yy_reduce(
|
||||
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
|
||||
yygoto = yyRuleInfo[yyruleno].lhs;
|
||||
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||
yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
|
||||
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
||||
if( yyact>YY_MAX_SHIFT ){
|
||||
yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
||||
}
|
||||
yymsp -= yysize-1;
|
||||
yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
|
||||
|
||||
/* There are no SHIFTREDUCE actions on nonterminals because the table
|
||||
** generator has simplified them to pure REDUCE actions. */
|
||||
assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
|
||||
|
||||
/* It is not possible for a REDUCE to be followed by an error */
|
||||
assert( yyact!=YY_ERROR_ACTION );
|
||||
|
||||
if( yyact==YY_ACCEPT_ACTION ){
|
||||
yypParser->yytos += yysize;
|
||||
yy_accept(yypParser);
|
||||
}else{
|
||||
yymsp += yysize+1;
|
||||
yypParser->yytos = yymsp;
|
||||
yymsp->stateno = (YYACTIONTYPE)yyact;
|
||||
yymsp->major = (YYCODETYPE)yygoto;
|
||||
yyTraceShift(yypParser, yyact);
|
||||
}else{
|
||||
assert( yyact == YY_ACCEPT_ACTION );
|
||||
yypParser->yytos -= yysize;
|
||||
yy_accept(yypParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,12 +120,12 @@ set pragma_def {
|
||||
|
||||
NAME: writable_schema
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_WriteSchema|SQLITE_RecoveryMode
|
||||
ARG: SQLITE_WriteSchema
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: read_uncommitted
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_ReadUncommitted
|
||||
ARG: SQLITE_ReadUncommit
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
|
||||
NAME: recursive_triggers
|
||||
@@ -263,7 +263,7 @@ set pragma_def {
|
||||
IF: !defined(SQLITE_OMIT_FOREIGN_KEY)
|
||||
|
||||
NAME: foreign_key_check
|
||||
FLAG: NeedSchema
|
||||
FLAG: NeedSchema Result0
|
||||
COLS: table rowid parent fkid
|
||||
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
|
||||
@@ -274,12 +274,12 @@ set pragma_def {
|
||||
FLAG: NoColumns
|
||||
|
||||
NAME: integrity_check
|
||||
FLAG: NeedSchema
|
||||
FLAG: NeedSchema Result0 Result1
|
||||
IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
||||
|
||||
NAME: quick_check
|
||||
TYPE: INTEGRITY_CHECK
|
||||
FLAG: NeedSchema
|
||||
FLAG: NeedSchema Result0 Result1
|
||||
IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
||||
|
||||
NAME: encoding
|
||||
|
||||
Reference in New Issue
Block a user