Fossil SCM

Merge the latest 3.38.0 alpha of SQLite that includes support for the use of Bloom filters, in order to test SQLite.

drh 2021-12-09 20:12 trunk
Commit 88a93432050c52b518e69846af497e52c58371d800e1fa93cc58d5c1bfb7ec21
3 files changed +72 -39 +1566 -920 +17 -4
+72 -39
--- src/shell.c
+++ src/shell.c
@@ -8675,11 +8675,11 @@
86758675
**
86768676
** SELECT zipfile(name,data) ...
86778677
** SELECT zipfile(name,mode,mtime,data) ...
86788678
** SELECT zipfile(name,mode,mtime,data,method) ...
86798679
*/
8680
-void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
8680
+static void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
86818681
ZipfileCtx *p; /* Aggregate function context */
86828682
ZipfileEntry e; /* New entry to add to zip archive */
86838683
86848684
sqlite3_value *pName = 0;
86858685
sqlite3_value *pMode = 0;
@@ -8850,11 +8850,11 @@
88508850
}
88518851
88528852
/*
88538853
** xFinalize() callback for zipfile aggregate function.
88548854
*/
8855
-void zipfileFinal(sqlite3_context *pCtx){
8855
+static void zipfileFinal(sqlite3_context *pCtx){
88568856
ZipfileCtx *p;
88578857
ZipfileEOCD eocd;
88588858
sqlite3_int64 nZip;
88598859
u8 *aZip;
88608860
@@ -10410,11 +10410,11 @@
1041010410
/*
1041110411
** This function is called after candidate indexes have been created. It
1041210412
** runs all the queries to see which indexes they prefer, and populates
1041310413
** IdxStatement.zIdx and IdxStatement.zEQP with the results.
1041410414
*/
10415
-int idxFindIndexes(
10415
+static int idxFindIndexes(
1041610416
sqlite3expert *p,
1041710417
char **pzErr /* OUT: Error message (sqlite3_malloc) */
1041810418
){
1041910419
IdxStatement *pStmt;
1042010420
sqlite3 *dbm = p->dbm;
@@ -12309,10 +12309,12 @@
1230912309
#define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */
1231012310
#define MODE_Json 13 /* Output JSON */
1231112311
#define MODE_Markdown 14 /* Markdown formatting */
1231212312
#define MODE_Table 15 /* MySQL-style table formatting */
1231312313
#define MODE_Box 16 /* Unicode box-drawing characters */
12314
+#define MODE_Count 17 /* Output only a count of the rows of output */
12315
+#define MODE_Off 18 /* No query output shown */
1231412316
1231512317
static const char *modeDescr[] = {
1231612318
"line",
1231712319
"column",
1231812320
"list",
@@ -12327,11 +12329,13 @@
1232712329
"prettyprint",
1232812330
"eqp",
1232912331
"json",
1233012332
"markdown",
1233112333
"table",
12332
- "box"
12334
+ "box",
12335
+ "count",
12336
+ "off"
1233312337
};
1233412338
1233512339
/*
1233612340
** These are the column/row/line separators used by the various
1233712341
** import/export modes.
@@ -13149,10 +13153,14 @@
1314913153
int i;
1315013154
ShellState *p = (ShellState*)pArg;
1315113155
1315213156
if( azArg==0 ) return 0;
1315313157
switch( p->cMode ){
13158
+ case MODE_Count:
13159
+ case MODE_Off: {
13160
+ break;
13161
+ }
1315413162
case MODE_Line: {
1315513163
int w = 5;
1315613164
if( azArg==0 ) break;
1315713165
for(i=0; i<nArg; i++){
1315813166
int len = strlen30(azCol[i] ? azCol[i] : "");
@@ -13846,17 +13854,24 @@
1384613854
raw_printf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n",
1384713855
iCur);
1384813856
}
1384913857
1385013858
if( pArg->pStmt ){
13859
+ int iHit, iMiss;
1385113860
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
1385213861
bReset);
1385313862
raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur);
1385413863
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1385513864
raw_printf(pArg->out, "Sort Operations: %d\n", iCur);
1385613865
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
1385713866
raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur);
13867
+ iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT, bReset);
13868
+ iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS, bReset);
13869
+ if( iHit || iMiss ){
13870
+ raw_printf(pArg->out, "Bloom filter bypass taken: %d/%d\n",
13871
+ iHit, iHit+iMiss);
13872
+ }
1385813873
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1385913874
raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
1386013875
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset);
1386113876
raw_printf(pArg->out, "Reprepare operations: %d\n", iCur);
1386213877
iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset);
@@ -14359,10 +14374,11 @@
1435914374
static void exec_prepared_stmt(
1436014375
ShellState *pArg, /* Pointer to ShellState */
1436114376
sqlite3_stmt *pStmt /* Statment to run */
1436214377
){
1436314378
int rc;
14379
+ sqlite3_uint64 nRow = 0;
1436414380
1436514381
if( pArg->cMode==MODE_Column
1436614382
|| pArg->cMode==MODE_Table
1436714383
|| pArg->cMode==MODE_Box
1436814384
|| pArg->cMode==MODE_Markdown
@@ -14391,10 +14407,11 @@
1439114407
/* save off ptrs to column names */
1439214408
for(i=0; i<nCol; i++){
1439314409
azCols[i] = (char *)sqlite3_column_name(pStmt, i);
1439414410
}
1439514411
do{
14412
+ nRow++;
1439614413
/* extract the data and data types */
1439714414
for(i=0; i<nCol; i++){
1439814415
aiTypes[i] = x = sqlite3_column_type(pStmt, i);
1439914416
if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
1440014417
azVals[i] = "";
@@ -14418,10 +14435,12 @@
1441814435
}
1441914436
} while( SQLITE_ROW == rc );
1442014437
sqlite3_free(pData);
1442114438
if( pArg->cMode==MODE_Json ){
1442214439
fputs("]\n", pArg->out);
14440
+ }else if( pArg->cMode==MODE_Count ){
14441
+ printf("%llu row%s\n", nRow, nRow!=1 ? "s" : "");
1442314442
}
1442414443
}
1442514444
}
1442614445
}
1442714446
@@ -19928,10 +19947,14 @@
1992819947
p->mode = MODE_Markdown;
1992919948
}else if( c2=='t' && strncmp(azArg[1],"table",n2)==0 ){
1993019949
p->mode = MODE_Table;
1993119950
}else if( c2=='b' && strncmp(azArg[1],"box",n2)==0 ){
1993219951
p->mode = MODE_Box;
19952
+ }else if( c2=='c' && strncmp(azArg[1],"count",n2)==0 ){
19953
+ p->mode = MODE_Count;
19954
+ }else if( c2=='o' && strncmp(azArg[1],"off",n2)==0 ){
19955
+ p->mode = MODE_Off;
1993319956
}else if( c2=='j' && strncmp(azArg[1],"json",n2)==0 ){
1993419957
p->mode = MODE_Json;
1993519958
}else if( nArg==1 ){
1993619959
raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
1993719960
}else{
@@ -19997,40 +20020,32 @@
1999720020
1999820021
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
1999920022
char *zNewFilename = 0; /* Name of the database file to open */
2000020023
int iName = 1; /* Index in azArg[] of the filename */
2000120024
int newFlag = 0; /* True to delete file before opening */
20002
- /* Close the existing database */
20003
- session_close_all(p, -1);
20004
- close_db(p->db);
20005
- p->db = 0;
20006
- p->pAuxDb->zDbFilename = 0;
20007
- sqlite3_free(p->pAuxDb->zFreeOnClose);
20008
- p->pAuxDb->zFreeOnClose = 0;
20009
- p->openMode = SHELL_OPEN_UNSPEC;
20010
- p->openFlags = 0;
20011
- p->szMax = 0;
20025
+ int openMode = SHELL_OPEN_UNSPEC;
20026
+
2001220027
/* Check for command-line arguments */
2001320028
for(iName=1; iName<nArg; iName++){
2001420029
const char *z = azArg[iName];
2001520030
if( optionMatch(z,"new") ){
2001620031
newFlag = 1;
2001720032
#ifdef SQLITE_HAVE_ZLIB
2001820033
}else if( optionMatch(z, "zip") ){
20019
- p->openMode = SHELL_OPEN_ZIPFILE;
20034
+ openMode = SHELL_OPEN_ZIPFILE;
2002020035
#endif
2002120036
}else if( optionMatch(z, "append") ){
20022
- p->openMode = SHELL_OPEN_APPENDVFS;
20037
+ openMode = SHELL_OPEN_APPENDVFS;
2002320038
}else if( optionMatch(z, "readonly") ){
20024
- p->openMode = SHELL_OPEN_READONLY;
20039
+ openMode = SHELL_OPEN_READONLY;
2002520040
}else if( optionMatch(z, "nofollow") ){
2002620041
p->openFlags |= SQLITE_OPEN_NOFOLLOW;
2002720042
#ifndef SQLITE_OMIT_DESERIALIZE
2002820043
}else if( optionMatch(z, "deserialize") ){
20029
- p->openMode = SHELL_OPEN_DESERIALIZE;
20044
+ openMode = SHELL_OPEN_DESERIALIZE;
2003020045
}else if( optionMatch(z, "hexdb") ){
20031
- p->openMode = SHELL_OPEN_HEXDB;
20046
+ openMode = SHELL_OPEN_HEXDB;
2003220047
}else if( optionMatch(z, "maxsize") && iName+1<nArg ){
2003320048
p->szMax = integerValue(azArg[++iName]);
2003420049
#endif /* SQLITE_OMIT_DESERIALIZE */
2003520050
}else if( z[0]=='-' ){
2003620051
utf8_printf(stderr, "unknown option: %s\n", z);
@@ -20042,10 +20057,22 @@
2004220057
goto meta_command_exit;
2004320058
}else{
2004420059
zNewFilename = sqlite3_mprintf("%s", z);
2004520060
}
2004620061
}
20062
+
20063
+ /* Close the existing database */
20064
+ session_close_all(p, -1);
20065
+ close_db(p->db);
20066
+ p->db = 0;
20067
+ p->pAuxDb->zDbFilename = 0;
20068
+ sqlite3_free(p->pAuxDb->zFreeOnClose);
20069
+ p->pAuxDb->zFreeOnClose = 0;
20070
+ p->openMode = openMode;
20071
+ p->openFlags = 0;
20072
+ p->szMax = 0;
20073
+
2004720074
/* If a filename is specified, try to open it first */
2004820075
if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
2004920076
if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
2005020077
if( p->bSafeMode
2005120078
&& p->openMode!=SHELL_OPEN_HEXDB
@@ -21260,34 +21287,35 @@
2126021287
#ifndef SQLITE_UNTESTABLE
2126121288
if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
2126221289
static const struct {
2126321290
const char *zCtrlName; /* Name of a test-control option */
2126421291
int ctrlCode; /* Integer code for that option */
21292
+ int unSafe; /* Not valid for --safe mode */
2126521293
const char *zUsage; /* Usage notes */
2126621294
} aCtrl[] = {
21267
- { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" },
21268
- { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" },
21269
- /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/
21270
- /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/
21271
- { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" },
21272
- { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" },
21273
- /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/
21274
- { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
21275
- { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "" },
21276
- { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
21277
- { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
21278
- { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
21295
+ { "always", SQLITE_TESTCTRL_ALWAYS, 1, "BOOLEAN" },
21296
+ { "assert", SQLITE_TESTCTRL_ASSERT, 1, "BOOLEAN" },
21297
+ /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,1, "" },*/
21298
+ /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/
21299
+ { "byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
21300
+ { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
21301
+ /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
21302
+ { "imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
21303
+ { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
21304
+ { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
21305
+ { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" },
21306
+ { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" },
2127921307
#ifdef YYCOVERAGE
21280
- { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
21308
+ { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE,0,"" },
2128121309
#endif
21282
- { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
21283
- { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
21284
- { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
21285
- { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
21286
- { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
21287
- { "sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, "NMAX" },
21288
- { "tune", SQLITE_TESTCTRL_TUNE, "ID VALUE" },
21310
+ { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE,0, "OFFSET " },
21311
+ { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE,0, "" },
21312
+ { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, 0, "" },
21313
+ { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, 0, "SEED ?db?" },
21314
+ { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
21315
+ { "sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
21316
+ { "tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
2128921317
};
2129021318
int testctrl = -1;
2129121319
int iCtrl = -1;
2129221320
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
2129321321
int isOk = 0;
@@ -21331,10 +21359,15 @@
2133121359
}
2133221360
}
2133321361
if( testctrl<0 ){
2133421362
utf8_printf(stderr,"Error: unknown test-control: %s\n"
2133521363
"Use \".testctrl --help\" for help\n", zCmd);
21364
+ }else if( aCtrl[iCtrl].unSafe && p->bSafeMode ){
21365
+ utf8_printf(stderr,
21366
+ "line %d: \".testctrl %s\" may not be used in safe mode\n",
21367
+ p->lineno, aCtrl[iCtrl].zCtrlName);
21368
+ exit(1);
2133621369
}else{
2133721370
switch(testctrl){
2133821371
2133921372
/* sqlite3_test_control(int, db, int) */
2134021373
case SQLITE_TESTCTRL_OPTIMIZATIONS:
2134121374
--- src/shell.c
+++ src/shell.c
@@ -8675,11 +8675,11 @@
8675 **
8676 ** SELECT zipfile(name,data) ...
8677 ** SELECT zipfile(name,mode,mtime,data) ...
8678 ** SELECT zipfile(name,mode,mtime,data,method) ...
8679 */
8680 void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
8681 ZipfileCtx *p; /* Aggregate function context */
8682 ZipfileEntry e; /* New entry to add to zip archive */
8683
8684 sqlite3_value *pName = 0;
8685 sqlite3_value *pMode = 0;
@@ -8850,11 +8850,11 @@
8850 }
8851
8852 /*
8853 ** xFinalize() callback for zipfile aggregate function.
8854 */
8855 void zipfileFinal(sqlite3_context *pCtx){
8856 ZipfileCtx *p;
8857 ZipfileEOCD eocd;
8858 sqlite3_int64 nZip;
8859 u8 *aZip;
8860
@@ -10410,11 +10410,11 @@
10410 /*
10411 ** This function is called after candidate indexes have been created. It
10412 ** runs all the queries to see which indexes they prefer, and populates
10413 ** IdxStatement.zIdx and IdxStatement.zEQP with the results.
10414 */
10415 int idxFindIndexes(
10416 sqlite3expert *p,
10417 char **pzErr /* OUT: Error message (sqlite3_malloc) */
10418 ){
10419 IdxStatement *pStmt;
10420 sqlite3 *dbm = p->dbm;
@@ -12309,10 +12309,12 @@
12309 #define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */
12310 #define MODE_Json 13 /* Output JSON */
12311 #define MODE_Markdown 14 /* Markdown formatting */
12312 #define MODE_Table 15 /* MySQL-style table formatting */
12313 #define MODE_Box 16 /* Unicode box-drawing characters */
 
 
12314
12315 static const char *modeDescr[] = {
12316 "line",
12317 "column",
12318 "list",
@@ -12327,11 +12329,13 @@
12327 "prettyprint",
12328 "eqp",
12329 "json",
12330 "markdown",
12331 "table",
12332 "box"
 
 
12333 };
12334
12335 /*
12336 ** These are the column/row/line separators used by the various
12337 ** import/export modes.
@@ -13149,10 +13153,14 @@
13149 int i;
13150 ShellState *p = (ShellState*)pArg;
13151
13152 if( azArg==0 ) return 0;
13153 switch( p->cMode ){
 
 
 
 
13154 case MODE_Line: {
13155 int w = 5;
13156 if( azArg==0 ) break;
13157 for(i=0; i<nArg; i++){
13158 int len = strlen30(azCol[i] ? azCol[i] : "");
@@ -13846,17 +13854,24 @@
13846 raw_printf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n",
13847 iCur);
13848 }
13849
13850 if( pArg->pStmt ){
 
13851 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
13852 bReset);
13853 raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur);
13854 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
13855 raw_printf(pArg->out, "Sort Operations: %d\n", iCur);
13856 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
13857 raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur);
 
 
 
 
 
 
13858 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
13859 raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
13860 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset);
13861 raw_printf(pArg->out, "Reprepare operations: %d\n", iCur);
13862 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset);
@@ -14359,10 +14374,11 @@
14359 static void exec_prepared_stmt(
14360 ShellState *pArg, /* Pointer to ShellState */
14361 sqlite3_stmt *pStmt /* Statment to run */
14362 ){
14363 int rc;
 
14364
14365 if( pArg->cMode==MODE_Column
14366 || pArg->cMode==MODE_Table
14367 || pArg->cMode==MODE_Box
14368 || pArg->cMode==MODE_Markdown
@@ -14391,10 +14407,11 @@
14391 /* save off ptrs to column names */
14392 for(i=0; i<nCol; i++){
14393 azCols[i] = (char *)sqlite3_column_name(pStmt, i);
14394 }
14395 do{
 
14396 /* extract the data and data types */
14397 for(i=0; i<nCol; i++){
14398 aiTypes[i] = x = sqlite3_column_type(pStmt, i);
14399 if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
14400 azVals[i] = "";
@@ -14418,10 +14435,12 @@
14418 }
14419 } while( SQLITE_ROW == rc );
14420 sqlite3_free(pData);
14421 if( pArg->cMode==MODE_Json ){
14422 fputs("]\n", pArg->out);
 
 
14423 }
14424 }
14425 }
14426 }
14427
@@ -19928,10 +19947,14 @@
19928 p->mode = MODE_Markdown;
19929 }else if( c2=='t' && strncmp(azArg[1],"table",n2)==0 ){
19930 p->mode = MODE_Table;
19931 }else if( c2=='b' && strncmp(azArg[1],"box",n2)==0 ){
19932 p->mode = MODE_Box;
 
 
 
 
19933 }else if( c2=='j' && strncmp(azArg[1],"json",n2)==0 ){
19934 p->mode = MODE_Json;
19935 }else if( nArg==1 ){
19936 raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
19937 }else{
@@ -19997,40 +20020,32 @@
19997
19998 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
19999 char *zNewFilename = 0; /* Name of the database file to open */
20000 int iName = 1; /* Index in azArg[] of the filename */
20001 int newFlag = 0; /* True to delete file before opening */
20002 /* Close the existing database */
20003 session_close_all(p, -1);
20004 close_db(p->db);
20005 p->db = 0;
20006 p->pAuxDb->zDbFilename = 0;
20007 sqlite3_free(p->pAuxDb->zFreeOnClose);
20008 p->pAuxDb->zFreeOnClose = 0;
20009 p->openMode = SHELL_OPEN_UNSPEC;
20010 p->openFlags = 0;
20011 p->szMax = 0;
20012 /* Check for command-line arguments */
20013 for(iName=1; iName<nArg; iName++){
20014 const char *z = azArg[iName];
20015 if( optionMatch(z,"new") ){
20016 newFlag = 1;
20017 #ifdef SQLITE_HAVE_ZLIB
20018 }else if( optionMatch(z, "zip") ){
20019 p->openMode = SHELL_OPEN_ZIPFILE;
20020 #endif
20021 }else if( optionMatch(z, "append") ){
20022 p->openMode = SHELL_OPEN_APPENDVFS;
20023 }else if( optionMatch(z, "readonly") ){
20024 p->openMode = SHELL_OPEN_READONLY;
20025 }else if( optionMatch(z, "nofollow") ){
20026 p->openFlags |= SQLITE_OPEN_NOFOLLOW;
20027 #ifndef SQLITE_OMIT_DESERIALIZE
20028 }else if( optionMatch(z, "deserialize") ){
20029 p->openMode = SHELL_OPEN_DESERIALIZE;
20030 }else if( optionMatch(z, "hexdb") ){
20031 p->openMode = SHELL_OPEN_HEXDB;
20032 }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
20033 p->szMax = integerValue(azArg[++iName]);
20034 #endif /* SQLITE_OMIT_DESERIALIZE */
20035 }else if( z[0]=='-' ){
20036 utf8_printf(stderr, "unknown option: %s\n", z);
@@ -20042,10 +20057,22 @@
20042 goto meta_command_exit;
20043 }else{
20044 zNewFilename = sqlite3_mprintf("%s", z);
20045 }
20046 }
 
 
 
 
 
 
 
 
 
 
 
 
20047 /* If a filename is specified, try to open it first */
20048 if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
20049 if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
20050 if( p->bSafeMode
20051 && p->openMode!=SHELL_OPEN_HEXDB
@@ -21260,34 +21287,35 @@
21260 #ifndef SQLITE_UNTESTABLE
21261 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
21262 static const struct {
21263 const char *zCtrlName; /* Name of a test-control option */
21264 int ctrlCode; /* Integer code for that option */
 
21265 const char *zUsage; /* Usage notes */
21266 } aCtrl[] = {
21267 { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" },
21268 { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" },
21269 /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/
21270 /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/
21271 { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" },
21272 { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" },
21273 /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/
21274 { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
21275 { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "" },
21276 { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
21277 { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
21278 { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
21279 #ifdef YYCOVERAGE
21280 { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" },
21281 #endif
21282 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
21283 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
21284 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
21285 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
21286 { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
21287 { "sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, "NMAX" },
21288 { "tune", SQLITE_TESTCTRL_TUNE, "ID VALUE" },
21289 };
21290 int testctrl = -1;
21291 int iCtrl = -1;
21292 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
21293 int isOk = 0;
@@ -21331,10 +21359,15 @@
21331 }
21332 }
21333 if( testctrl<0 ){
21334 utf8_printf(stderr,"Error: unknown test-control: %s\n"
21335 "Use \".testctrl --help\" for help\n", zCmd);
 
 
 
 
 
21336 }else{
21337 switch(testctrl){
21338
21339 /* sqlite3_test_control(int, db, int) */
21340 case SQLITE_TESTCTRL_OPTIMIZATIONS:
21341
--- src/shell.c
+++ src/shell.c
@@ -8675,11 +8675,11 @@
8675 **
8676 ** SELECT zipfile(name,data) ...
8677 ** SELECT zipfile(name,mode,mtime,data) ...
8678 ** SELECT zipfile(name,mode,mtime,data,method) ...
8679 */
8680 static void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
8681 ZipfileCtx *p; /* Aggregate function context */
8682 ZipfileEntry e; /* New entry to add to zip archive */
8683
8684 sqlite3_value *pName = 0;
8685 sqlite3_value *pMode = 0;
@@ -8850,11 +8850,11 @@
8850 }
8851
8852 /*
8853 ** xFinalize() callback for zipfile aggregate function.
8854 */
8855 static void zipfileFinal(sqlite3_context *pCtx){
8856 ZipfileCtx *p;
8857 ZipfileEOCD eocd;
8858 sqlite3_int64 nZip;
8859 u8 *aZip;
8860
@@ -10410,11 +10410,11 @@
10410 /*
10411 ** This function is called after candidate indexes have been created. It
10412 ** runs all the queries to see which indexes they prefer, and populates
10413 ** IdxStatement.zIdx and IdxStatement.zEQP with the results.
10414 */
10415 static int idxFindIndexes(
10416 sqlite3expert *p,
10417 char **pzErr /* OUT: Error message (sqlite3_malloc) */
10418 ){
10419 IdxStatement *pStmt;
10420 sqlite3 *dbm = p->dbm;
@@ -12309,10 +12309,12 @@
12309 #define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */
12310 #define MODE_Json 13 /* Output JSON */
12311 #define MODE_Markdown 14 /* Markdown formatting */
12312 #define MODE_Table 15 /* MySQL-style table formatting */
12313 #define MODE_Box 16 /* Unicode box-drawing characters */
12314 #define MODE_Count 17 /* Output only a count of the rows of output */
12315 #define MODE_Off 18 /* No query output shown */
12316
12317 static const char *modeDescr[] = {
12318 "line",
12319 "column",
12320 "list",
@@ -12327,11 +12329,13 @@
12329 "prettyprint",
12330 "eqp",
12331 "json",
12332 "markdown",
12333 "table",
12334 "box",
12335 "count",
12336 "off"
12337 };
12338
12339 /*
12340 ** These are the column/row/line separators used by the various
12341 ** import/export modes.
@@ -13149,10 +13153,14 @@
13153 int i;
13154 ShellState *p = (ShellState*)pArg;
13155
13156 if( azArg==0 ) return 0;
13157 switch( p->cMode ){
13158 case MODE_Count:
13159 case MODE_Off: {
13160 break;
13161 }
13162 case MODE_Line: {
13163 int w = 5;
13164 if( azArg==0 ) break;
13165 for(i=0; i<nArg; i++){
13166 int len = strlen30(azCol[i] ? azCol[i] : "");
@@ -13846,17 +13854,24 @@
13854 raw_printf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n",
13855 iCur);
13856 }
13857
13858 if( pArg->pStmt ){
13859 int iHit, iMiss;
13860 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
13861 bReset);
13862 raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur);
13863 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
13864 raw_printf(pArg->out, "Sort Operations: %d\n", iCur);
13865 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
13866 raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur);
13867 iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT, bReset);
13868 iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS, bReset);
13869 if( iHit || iMiss ){
13870 raw_printf(pArg->out, "Bloom filter bypass taken: %d/%d\n",
13871 iHit, iHit+iMiss);
13872 }
13873 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
13874 raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
13875 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset);
13876 raw_printf(pArg->out, "Reprepare operations: %d\n", iCur);
13877 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset);
@@ -14359,10 +14374,11 @@
14374 static void exec_prepared_stmt(
14375 ShellState *pArg, /* Pointer to ShellState */
14376 sqlite3_stmt *pStmt /* Statment to run */
14377 ){
14378 int rc;
14379 sqlite3_uint64 nRow = 0;
14380
14381 if( pArg->cMode==MODE_Column
14382 || pArg->cMode==MODE_Table
14383 || pArg->cMode==MODE_Box
14384 || pArg->cMode==MODE_Markdown
@@ -14391,10 +14407,11 @@
14407 /* save off ptrs to column names */
14408 for(i=0; i<nCol; i++){
14409 azCols[i] = (char *)sqlite3_column_name(pStmt, i);
14410 }
14411 do{
14412 nRow++;
14413 /* extract the data and data types */
14414 for(i=0; i<nCol; i++){
14415 aiTypes[i] = x = sqlite3_column_type(pStmt, i);
14416 if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
14417 azVals[i] = "";
@@ -14418,10 +14435,12 @@
14435 }
14436 } while( SQLITE_ROW == rc );
14437 sqlite3_free(pData);
14438 if( pArg->cMode==MODE_Json ){
14439 fputs("]\n", pArg->out);
14440 }else if( pArg->cMode==MODE_Count ){
14441 printf("%llu row%s\n", nRow, nRow!=1 ? "s" : "");
14442 }
14443 }
14444 }
14445 }
14446
@@ -19928,10 +19947,14 @@
19947 p->mode = MODE_Markdown;
19948 }else if( c2=='t' && strncmp(azArg[1],"table",n2)==0 ){
19949 p->mode = MODE_Table;
19950 }else if( c2=='b' && strncmp(azArg[1],"box",n2)==0 ){
19951 p->mode = MODE_Box;
19952 }else if( c2=='c' && strncmp(azArg[1],"count",n2)==0 ){
19953 p->mode = MODE_Count;
19954 }else if( c2=='o' && strncmp(azArg[1],"off",n2)==0 ){
19955 p->mode = MODE_Off;
19956 }else if( c2=='j' && strncmp(azArg[1],"json",n2)==0 ){
19957 p->mode = MODE_Json;
19958 }else if( nArg==1 ){
19959 raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
19960 }else{
@@ -19997,40 +20020,32 @@
20020
20021 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
20022 char *zNewFilename = 0; /* Name of the database file to open */
20023 int iName = 1; /* Index in azArg[] of the filename */
20024 int newFlag = 0; /* True to delete file before opening */
20025 int openMode = SHELL_OPEN_UNSPEC;
20026
 
 
 
 
 
 
 
 
20027 /* Check for command-line arguments */
20028 for(iName=1; iName<nArg; iName++){
20029 const char *z = azArg[iName];
20030 if( optionMatch(z,"new") ){
20031 newFlag = 1;
20032 #ifdef SQLITE_HAVE_ZLIB
20033 }else if( optionMatch(z, "zip") ){
20034 openMode = SHELL_OPEN_ZIPFILE;
20035 #endif
20036 }else if( optionMatch(z, "append") ){
20037 openMode = SHELL_OPEN_APPENDVFS;
20038 }else if( optionMatch(z, "readonly") ){
20039 openMode = SHELL_OPEN_READONLY;
20040 }else if( optionMatch(z, "nofollow") ){
20041 p->openFlags |= SQLITE_OPEN_NOFOLLOW;
20042 #ifndef SQLITE_OMIT_DESERIALIZE
20043 }else if( optionMatch(z, "deserialize") ){
20044 openMode = SHELL_OPEN_DESERIALIZE;
20045 }else if( optionMatch(z, "hexdb") ){
20046 openMode = SHELL_OPEN_HEXDB;
20047 }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
20048 p->szMax = integerValue(azArg[++iName]);
20049 #endif /* SQLITE_OMIT_DESERIALIZE */
20050 }else if( z[0]=='-' ){
20051 utf8_printf(stderr, "unknown option: %s\n", z);
@@ -20042,10 +20057,22 @@
20057 goto meta_command_exit;
20058 }else{
20059 zNewFilename = sqlite3_mprintf("%s", z);
20060 }
20061 }
20062
20063 /* Close the existing database */
20064 session_close_all(p, -1);
20065 close_db(p->db);
20066 p->db = 0;
20067 p->pAuxDb->zDbFilename = 0;
20068 sqlite3_free(p->pAuxDb->zFreeOnClose);
20069 p->pAuxDb->zFreeOnClose = 0;
20070 p->openMode = openMode;
20071 p->openFlags = 0;
20072 p->szMax = 0;
20073
20074 /* If a filename is specified, try to open it first */
20075 if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
20076 if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
20077 if( p->bSafeMode
20078 && p->openMode!=SHELL_OPEN_HEXDB
@@ -21260,34 +21287,35 @@
21287 #ifndef SQLITE_UNTESTABLE
21288 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
21289 static const struct {
21290 const char *zCtrlName; /* Name of a test-control option */
21291 int ctrlCode; /* Integer code for that option */
21292 int unSafe; /* Not valid for --safe mode */
21293 const char *zUsage; /* Usage notes */
21294 } aCtrl[] = {
21295 { "always", SQLITE_TESTCTRL_ALWAYS, 1, "BOOLEAN" },
21296 { "assert", SQLITE_TESTCTRL_ASSERT, 1, "BOOLEAN" },
21297 /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,1, "" },*/
21298 /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/
21299 { "byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
21300 { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
21301 /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
21302 { "imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
21303 { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
21304 { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
21305 { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" },
21306 { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" },
21307 #ifdef YYCOVERAGE
21308 { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE,0,"" },
21309 #endif
21310 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE,0, "OFFSET " },
21311 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE,0, "" },
21312 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, 0, "" },
21313 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, 0, "SEED ?db?" },
21314 { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
21315 { "sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
21316 { "tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
21317 };
21318 int testctrl = -1;
21319 int iCtrl = -1;
21320 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
21321 int isOk = 0;
@@ -21331,10 +21359,15 @@
21359 }
21360 }
21361 if( testctrl<0 ){
21362 utf8_printf(stderr,"Error: unknown test-control: %s\n"
21363 "Use \".testctrl --help\" for help\n", zCmd);
21364 }else if( aCtrl[iCtrl].unSafe && p->bSafeMode ){
21365 utf8_printf(stderr,
21366 "line %d: \".testctrl %s\" may not be used in safe mode\n",
21367 p->lineno, aCtrl[iCtrl].zCtrlName);
21368 exit(1);
21369 }else{
21370 switch(testctrl){
21371
21372 /* sqlite3_test_control(int, db, int) */
21373 case SQLITE_TESTCTRL_OPTIMIZATIONS:
21374
+1566 -920
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.37.0. By combining all the individual C code files into this
3
+** version 3.38.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -450,13 +450,13 @@
450450
**
451451
** See also: [sqlite3_libversion()],
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455
-#define SQLITE_VERSION "3.37.0"
456
-#define SQLITE_VERSION_NUMBER 3037000
457
-#define SQLITE_SOURCE_ID "2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8"
455
+#define SQLITE_VERSION "3.38.0"
456
+#define SQLITE_VERSION_NUMBER 3038000
457
+#define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -8248,11 +8248,12 @@
82488248
#define SQLITE_TESTCTRL_PRNG_SEED 28
82498249
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
82508250
#define SQLITE_TESTCTRL_SEEK_COUNT 30
82518251
#define SQLITE_TESTCTRL_TRACEFLAGS 31
82528252
#define SQLITE_TESTCTRL_TUNE 32
8253
-#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
8253
+#define SQLITE_TESTCTRL_LOGEST 33
8254
+#define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
82548255
82558256
/*
82568257
** CAPI3REF: SQL Keyword Checking
82578258
**
82588259
** These routines provide access to the set of SQL language keywords
@@ -8770,10 +8771,20 @@
87708771
** <dd>^This is the number of times that the prepared statement has
87718772
** been run. A single "run" for the purposes of this counter is one
87728773
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
87738774
** The counter is incremented on the first [sqlite3_step()] call of each
87748775
** cycle.
8776
+**
8777
+** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8778
+** [[SQLITE_STMTSTATUS_FILTER HIT]]
8779
+** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8780
+** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8781
+** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8782
+** step was bypassed because a Bloom filter returned not-found. The
8783
+** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8784
+** times that the Bloom filter returned a find, and thus the join step
8785
+** had to be processed as normal.
87758786
**
87768787
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
87778788
** <dd>^This is the approximate number of bytes of heap memory
87788789
** used to store the prepared statement. ^This value is not actually
87798790
** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8785,10 +8796,12 @@
87858796
#define SQLITE_STMTSTATUS_SORT 2
87868797
#define SQLITE_STMTSTATUS_AUTOINDEX 3
87878798
#define SQLITE_STMTSTATUS_VM_STEP 4
87888799
#define SQLITE_STMTSTATUS_REPREPARE 5
87898800
#define SQLITE_STMTSTATUS_RUN 6
8801
+#define SQLITE_STMTSTATUS_FILTER_MISS 7
8802
+#define SQLITE_STMTSTATUS_FILTER_HIT 8
87908803
#define SQLITE_STMTSTATUS_MEMUSED 99
87918804
87928805
/*
87938806
** CAPI3REF: Custom Page Cache Object
87948807
**
@@ -13552,14 +13565,14 @@
1355213565
#define TK_DETACH 40
1355313566
#define TK_EACH 41
1355413567
#define TK_FAIL 42
1355513568
#define TK_OR 43
1355613569
#define TK_AND 44
13557
-#define TK_IS 45
13558
-#define TK_MATCH 46
13559
-#define TK_LIKE_KW 47
13560
-#define TK_BETWEEN 48
13570
+#define TK_MATCH 45
13571
+#define TK_LIKE_KW 46
13572
+#define TK_BETWEEN 47
13573
+#define TK_IS 48
1356113574
#define TK_IN 49
1356213575
#define TK_ISNULL 50
1356313576
#define TK_NOTNULL 51
1356413577
#define TK_NE 52
1356513578
#define TK_EQ 53
@@ -13796,11 +13809,11 @@
1379613809
** The default initial allocation for the pagecache when using separate
1379713810
** pagecaches for each database connection. A positive number is the
1379813811
** number of pages. A negative number N translations means that a buffer
1379913812
** of -1024*N bytes is allocated and used for as many pages as it will hold.
1380013813
**
13801
-** The default value of "20" was choosen to minimize the run-time of the
13814
+** The default value of "20" was chosen to minimize the run-time of the
1380213815
** speedtest1 test program with options: --shrink-memory --reprepare
1380313816
*/
1380413817
#ifndef SQLITE_DEFAULT_PCACHE_INITSZ
1380513818
# define SQLITE_DEFAULT_PCACHE_INITSZ 20
1380613819
#endif
@@ -15251,49 +15264,49 @@
1525115264
#define OP_ElseEq 58 /* jump, same as TK_ESCAPE */
1525215265
#define OP_IfNotZero 59 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
1525315266
#define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */
1525415267
#define OP_IncrVacuum 61 /* jump */
1525515268
#define OP_VNext 62 /* jump */
15256
-#define OP_Init 63 /* jump, synopsis: Start at P2 */
15257
-#define OP_PureFunc 64 /* synopsis: r[P3]=func(r[P2@NP]) */
15258
-#define OP_Function 65 /* synopsis: r[P3]=func(r[P2@NP]) */
15259
-#define OP_Return 66
15260
-#define OP_EndCoroutine 67
15261
-#define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */
15262
-#define OP_Halt 69
15263
-#define OP_Integer 70 /* synopsis: r[P2]=P1 */
15264
-#define OP_Int64 71 /* synopsis: r[P2]=P4 */
15265
-#define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */
15266
-#define OP_Null 73 /* synopsis: r[P2..P3]=NULL */
15267
-#define OP_SoftNull 74 /* synopsis: r[P1]=NULL */
15268
-#define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */
15269
-#define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */
15270
-#define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */
15271
-#define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
15272
-#define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */
15273
-#define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */
15274
-#define OP_ChngCntRow 81 /* synopsis: output=r[P1] */
15275
-#define OP_ResultRow 82 /* synopsis: output=r[P1@P2] */
15276
-#define OP_CollSeq 83
15277
-#define OP_AddImm 84 /* synopsis: r[P1]=r[P1]+P2 */
15278
-#define OP_RealAffinity 85
15279
-#define OP_Cast 86 /* synopsis: affinity(r[P1]) */
15280
-#define OP_Permutation 87
15281
-#define OP_Compare 88 /* synopsis: r[P1@P3] <-> r[P2@P3] */
15282
-#define OP_IsTrue 89 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
15283
-#define OP_ZeroOrNull 90 /* synopsis: r[P2] = 0 OR NULL */
15284
-#define OP_Offset 91 /* synopsis: r[P3] = sqlite_offset(P1) */
15285
-#define OP_Column 92 /* synopsis: r[P3]=PX */
15286
-#define OP_TypeCheck 93 /* synopsis: typecheck(r[P1@P2]) */
15287
-#define OP_Affinity 94 /* synopsis: affinity(r[P1@P2]) */
15288
-#define OP_MakeRecord 95 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
15289
-#define OP_Count 96 /* synopsis: r[P2]=count() */
15290
-#define OP_ReadCookie 97
15291
-#define OP_SetCookie 98
15292
-#define OP_ReopenIdx 99 /* synopsis: root=P2 iDb=P3 */
15293
-#define OP_OpenRead 100 /* synopsis: root=P2 iDb=P3 */
15294
-#define OP_OpenWrite 101 /* synopsis: root=P2 iDb=P3 */
15269
+#define OP_Filter 63 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
15270
+#define OP_Init 64 /* jump, synopsis: Start at P2 */
15271
+#define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */
15272
+#define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */
15273
+#define OP_Return 67
15274
+#define OP_EndCoroutine 68
15275
+#define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */
15276
+#define OP_Halt 70
15277
+#define OP_Integer 71 /* synopsis: r[P2]=P1 */
15278
+#define OP_Int64 72 /* synopsis: r[P2]=P4 */
15279
+#define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */
15280
+#define OP_Null 74 /* synopsis: r[P2..P3]=NULL */
15281
+#define OP_SoftNull 75 /* synopsis: r[P1]=NULL */
15282
+#define OP_Blob 76 /* synopsis: r[P2]=P4 (len=P1) */
15283
+#define OP_Variable 77 /* synopsis: r[P2]=parameter(P1,P4) */
15284
+#define OP_Move 78 /* synopsis: r[P2@P3]=r[P1@P3] */
15285
+#define OP_Copy 79 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
15286
+#define OP_SCopy 80 /* synopsis: r[P2]=r[P1] */
15287
+#define OP_IntCopy 81 /* synopsis: r[P2]=r[P1] */
15288
+#define OP_FkCheck 82
15289
+#define OP_ResultRow 83 /* synopsis: output=r[P1@P2] */
15290
+#define OP_CollSeq 84
15291
+#define OP_AddImm 85 /* synopsis: r[P1]=r[P1]+P2 */
15292
+#define OP_RealAffinity 86
15293
+#define OP_Cast 87 /* synopsis: affinity(r[P1]) */
15294
+#define OP_Permutation 88
15295
+#define OP_Compare 89 /* synopsis: r[P1@P3] <-> r[P2@P3] */
15296
+#define OP_IsTrue 90 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
15297
+#define OP_ZeroOrNull 91 /* synopsis: r[P2] = 0 OR NULL */
15298
+#define OP_Offset 92 /* synopsis: r[P3] = sqlite_offset(P1) */
15299
+#define OP_Column 93 /* synopsis: r[P3]=PX */
15300
+#define OP_TypeCheck 94 /* synopsis: typecheck(r[P1@P2]) */
15301
+#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */
15302
+#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
15303
+#define OP_Count 97 /* synopsis: r[P2]=count() */
15304
+#define OP_ReadCookie 98
15305
+#define OP_SetCookie 99
15306
+#define OP_ReopenIdx 100 /* synopsis: root=P2 iDb=P3 */
15307
+#define OP_OpenRead 101 /* synopsis: root=P2 iDb=P3 */
1529515308
#define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
1529615309
#define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
1529715310
#define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
1529815311
#define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
1529915312
#define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -15300,80 +15313,82 @@
1530015313
#define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
1530115314
#define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
1530215315
#define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
1530315316
#define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
1530415317
#define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15305
-#define OP_OpenDup 112
15318
+#define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */
1530615319
#define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15307
-#define OP_OpenAutoindex 114 /* synopsis: nColumn=P2 */
15308
-#define OP_OpenEphemeral 115 /* synopsis: nColumn=P2 */
15320
+#define OP_OpenDup 114
15321
+#define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
1530915322
#define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15310
-#define OP_SorterOpen 117
15311
-#define OP_SequenceTest 118 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15312
-#define OP_OpenPseudo 119 /* synopsis: P3 columns in r[P2] */
15313
-#define OP_Close 120
15314
-#define OP_ColumnsUsed 121
15315
-#define OP_SeekScan 122 /* synopsis: Scan-ahead up to P1 rows */
15316
-#define OP_SeekHit 123 /* synopsis: set P2<=seekHit<=P3 */
15317
-#define OP_Sequence 124 /* synopsis: r[P2]=cursor[P1].ctr++ */
15318
-#define OP_NewRowid 125 /* synopsis: r[P2]=rowid */
15319
-#define OP_Insert 126 /* synopsis: intkey=r[P3] data=r[P2] */
15320
-#define OP_RowCell 127
15321
-#define OP_Delete 128
15322
-#define OP_ResetCount 129
15323
-#define OP_SorterCompare 130 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15324
-#define OP_SorterData 131 /* synopsis: r[P2]=data */
15325
-#define OP_RowData 132 /* synopsis: r[P2]=data */
15326
-#define OP_Rowid 133 /* synopsis: r[P2]=rowid */
15327
-#define OP_NullRow 134
15328
-#define OP_SeekEnd 135
15329
-#define OP_IdxInsert 136 /* synopsis: key=r[P2] */
15330
-#define OP_SorterInsert 137 /* synopsis: key=r[P2] */
15331
-#define OP_IdxDelete 138 /* synopsis: key=r[P2@P3] */
15332
-#define OP_DeferredSeek 139 /* synopsis: Move P3 to P1.rowid if needed */
15333
-#define OP_IdxRowid 140 /* synopsis: r[P2]=rowid */
15334
-#define OP_FinishSeek 141
15335
-#define OP_Destroy 142
15336
-#define OP_Clear 143
15337
-#define OP_ResetSorter 144
15338
-#define OP_CreateBtree 145 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15339
-#define OP_SqlExec 146
15340
-#define OP_ParseSchema 147
15341
-#define OP_LoadAnalysis 148
15342
-#define OP_DropTable 149
15343
-#define OP_DropIndex 150
15344
-#define OP_DropTrigger 151
15323
+#define OP_OpenEphemeral 117 /* synopsis: nColumn=P2 */
15324
+#define OP_SorterOpen 118
15325
+#define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15326
+#define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */
15327
+#define OP_Close 121
15328
+#define OP_ColumnsUsed 122
15329
+#define OP_SeekScan 123 /* synopsis: Scan-ahead up to P1 rows */
15330
+#define OP_SeekHit 124 /* synopsis: set P2<=seekHit<=P3 */
15331
+#define OP_Sequence 125 /* synopsis: r[P2]=cursor[P1].ctr++ */
15332
+#define OP_NewRowid 126 /* synopsis: r[P2]=rowid */
15333
+#define OP_Insert 127 /* synopsis: intkey=r[P3] data=r[P2] */
15334
+#define OP_RowCell 128
15335
+#define OP_Delete 129
15336
+#define OP_ResetCount 130
15337
+#define OP_SorterCompare 131 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15338
+#define OP_SorterData 132 /* synopsis: r[P2]=data */
15339
+#define OP_RowData 133 /* synopsis: r[P2]=data */
15340
+#define OP_Rowid 134 /* synopsis: r[P2]=rowid */
15341
+#define OP_NullRow 135
15342
+#define OP_SeekEnd 136
15343
+#define OP_IdxInsert 137 /* synopsis: key=r[P2] */
15344
+#define OP_SorterInsert 138 /* synopsis: key=r[P2] */
15345
+#define OP_IdxDelete 139 /* synopsis: key=r[P2@P3] */
15346
+#define OP_DeferredSeek 140 /* synopsis: Move P3 to P1.rowid if needed */
15347
+#define OP_IdxRowid 141 /* synopsis: r[P2]=rowid */
15348
+#define OP_FinishSeek 142
15349
+#define OP_Destroy 143
15350
+#define OP_Clear 144
15351
+#define OP_ResetSorter 145
15352
+#define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15353
+#define OP_SqlExec 147
15354
+#define OP_ParseSchema 148
15355
+#define OP_LoadAnalysis 149
15356
+#define OP_DropTable 150
15357
+#define OP_DropIndex 151
1534515358
#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15346
-#define OP_IntegrityCk 153
15347
-#define OP_RowSetAdd 154 /* synopsis: rowset(P1)=r[P2] */
15348
-#define OP_Param 155
15349
-#define OP_FkCounter 156 /* synopsis: fkctr[P1]+=P2 */
15350
-#define OP_MemMax 157 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15351
-#define OP_OffsetLimit 158 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15352
-#define OP_AggInverse 159 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15353
-#define OP_AggStep 160 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15354
-#define OP_AggStep1 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15355
-#define OP_AggValue 162 /* synopsis: r[P3]=value N=P2 */
15356
-#define OP_AggFinal 163 /* synopsis: accum=r[P1] N=P2 */
15357
-#define OP_Expire 164
15358
-#define OP_CursorLock 165
15359
-#define OP_CursorUnlock 166
15360
-#define OP_TableLock 167 /* synopsis: iDb=P1 root=P2 write=P3 */
15361
-#define OP_VBegin 168
15362
-#define OP_VCreate 169
15363
-#define OP_VDestroy 170
15364
-#define OP_VOpen 171
15365
-#define OP_VColumn 172 /* synopsis: r[P3]=vcolumn(P2) */
15366
-#define OP_VRename 173
15367
-#define OP_Pagecount 174
15368
-#define OP_MaxPgcnt 175
15369
-#define OP_Trace 176
15370
-#define OP_CursorHint 177
15371
-#define OP_ReleaseReg 178 /* synopsis: release r[P1@P2] mask P3 */
15372
-#define OP_Noop 179
15373
-#define OP_Explain 180
15374
-#define OP_Abortable 181
15359
+#define OP_DropTrigger 153
15360
+#define OP_IntegrityCk 154
15361
+#define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */
15362
+#define OP_Param 156
15363
+#define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */
15364
+#define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15365
+#define OP_OffsetLimit 159 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15366
+#define OP_AggInverse 160 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15367
+#define OP_AggStep 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15368
+#define OP_AggStep1 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15369
+#define OP_AggValue 163 /* synopsis: r[P3]=value N=P2 */
15370
+#define OP_AggFinal 164 /* synopsis: accum=r[P1] N=P2 */
15371
+#define OP_Expire 165
15372
+#define OP_CursorLock 166
15373
+#define OP_CursorUnlock 167
15374
+#define OP_TableLock 168 /* synopsis: iDb=P1 root=P2 write=P3 */
15375
+#define OP_VBegin 169
15376
+#define OP_VCreate 170
15377
+#define OP_VDestroy 171
15378
+#define OP_VOpen 172
15379
+#define OP_VColumn 173 /* synopsis: r[P3]=vcolumn(P2) */
15380
+#define OP_VRename 174
15381
+#define OP_Pagecount 175
15382
+#define OP_MaxPgcnt 176
15383
+#define OP_FilterAdd 177 /* synopsis: filter(P1) += key(P3@P4) */
15384
+#define OP_Trace 178
15385
+#define OP_CursorHint 179
15386
+#define OP_ReleaseReg 180 /* synopsis: release r[P1@P2] mask P3 */
15387
+#define OP_Noop 181
15388
+#define OP_Explain 182
15389
+#define OP_Abortable 183
1537515390
1537615391
/* Properties such as "out2" or "jump" that are specified in
1537715392
** comments following the "case" for each opcode in the vdbe.c
1537815393
** are encoded into bitvectors as follows:
1537915394
*/
@@ -15390,33 +15405,34 @@
1539015405
/* 24 */ 0x09, 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09,\
1539115406
/* 32 */ 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
1539215407
/* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\
1539315408
/* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
1539415409
/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\
15395
-/* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\
15396
-/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\
15397
-/* 80 */ 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
15398
-/* 88 */ 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00,\
15399
-/* 96 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\
15410
+/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\
15411
+/* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
15412
+/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\
15413
+/* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\
15414
+/* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
1540015415
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
1540115416
/* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15402
-/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15403
-/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
15404
-/* 136 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00,\
15405
-/* 144 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15406
-/* 152 */ 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00,\
15417
+/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15418
+/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
15419
+/* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\
15420
+/* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15421
+/* 152 */ 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
1540715422
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15408
-/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
15409
-/* 176 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
15423
+/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15424
+/* 176 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15425
+}
1541015426
1541115427
/* The resolve3P2Values() routine is able to run faster if it knows
1541215428
** the value of the largest JUMP opcode. The smaller the maximum
1541315429
** JUMP opcode the better, so the mkopcodeh.tcl script that
1541415430
** generated this include file strives to group all JUMP opcodes
1541515431
** together near the beginning of the list.
1541615432
*/
15417
-#define SQLITE_MX_JUMP_OPCODE 63 /* Maximum JUMP opcode */
15433
+#define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
1541815434
1541915435
/************** End of opcodes.h *********************************************/
1542015436
/************** Continuing where we left off in vdbe.h ***********************/
1542115437
1542215438
/*
@@ -16707,10 +16723,12 @@
1670716723
#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
1670816724
#define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
1670916725
#define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
1671016726
#define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
1671116727
/* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
16728
+#define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
16729
+#define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
1671216730
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1671316731
1671416732
/*
1671516733
** Macros for testing whether or not optimizations are enabled or disabled.
1671616734
*/
@@ -19509,10 +19527,11 @@
1950919527
SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
1951019528
SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
1951119529
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
1951219530
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
1951319531
#endif
19532
+SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
1951419533
SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
1951519534
SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
1951619535
Upsert*);
1951719536
SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
1951819537
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
@@ -19719,18 +19738,12 @@
1971919738
#endif
1972019739
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
1972119740
SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
1972219741
SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
1972319742
SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
19724
-#ifndef SQLITE_OMIT_VIRTUALTABLE
1972519743
SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double);
19726
-#endif
19727
-#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
19728
- defined(SQLITE_ENABLE_STAT4) || \
19729
- defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
1973019744
SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst);
19731
-#endif
1973219745
SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int);
1973319746
SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int);
1973419747
SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int);
1973519748
1973619749
/*
@@ -22106,11 +22119,11 @@
2210622119
bft usesStmtJournal:1; /* True if uses a statement journal */
2210722120
bft readOnly:1; /* True for statements that do not write */
2210822121
bft bIsReader:1; /* True for statements that read */
2210922122
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
2211022123
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
22111
- u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */
22124
+ u32 aCounter[9]; /* Counters used by sqlite3_stmt_status() */
2211222125
char *zSql; /* Text of the SQL statement that generated this */
2211322126
#ifdef SQLITE_ENABLE_NORMALIZE
2211422127
char *zNormSql; /* Normalization of the associated SQL statement */
2211522128
DblquoteStr *pDblStr; /* List of double-quoted string literals */
2211622129
#endif
@@ -22214,11 +22227,11 @@
2221422227
#endif
2221522228
SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*);
2221622229
SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
2221722230
SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8);
2221822231
SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double);
22219
-SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);
22232
+SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem*);
2222022233
SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
2222122234
SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
2222222235
SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull);
2222322236
SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
2222422237
SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
@@ -23212,11 +23225,13 @@
2321223225
pX = localtime(t);
2321323226
#ifndef SQLITE_UNTESTABLE
2321423227
if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
2321523228
#endif
2321623229
if( pX ) *pTm = *pX;
23230
+#if SQLITE_THREADSAFE>0
2321723231
sqlite3_mutex_leave(mutex);
23232
+#endif
2321823233
rc = pX==0;
2321923234
#else
2322023235
#ifndef SQLITE_UNTESTABLE
2322123236
if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
2322223237
#endif
@@ -23351,10 +23366,49 @@
2335123366
DateTime *p /* The date/time value to be modified */
2335223367
){
2335323368
int rc = 1;
2335423369
double r;
2335523370
switch(sqlite3UpperToLower[(u8)z[0]] ){
23371
+ case 'a': {
23372
+ /*
23373
+ ** auto
23374
+ **
23375
+ ** If rawS is available, then interpret as a julian day number, or
23376
+ ** a unix timestamp, depending on its magnitude.
23377
+ */
23378
+ if( sqlite3_stricmp(z, "auto")==0 ){
23379
+ if( !p->rawS || p->validJD ){
23380
+ rc = 0;
23381
+ p->rawS = 0;
23382
+ }else if( p->s>=-210866760000 && p->s<=253402300799 ){
23383
+ r = p->s*1000.0 + 210866760000000.0;
23384
+ clearYMD_HMS_TZ(p);
23385
+ p->iJD = (sqlite3_int64)(r + 0.5);
23386
+ p->validJD = 1;
23387
+ p->rawS = 0;
23388
+ rc = 0;
23389
+ }
23390
+ }
23391
+ break;
23392
+ }
23393
+ case 'j': {
23394
+ /*
23395
+ ** julianday
23396
+ **
23397
+ ** Always interpret the prior number as a julian-day value. If this
23398
+ ** is not the first modifier, or if the prior argument is not a numeric
23399
+ ** value in the allowed range of julian day numbers understood by
23400
+ ** SQLite (0..5373484.5) then the result will be NULL.
23401
+ */
23402
+ if( sqlite3_stricmp(z, "julianday")==0 ){
23403
+ if( p->validJD && p->rawS ){
23404
+ rc = 0;
23405
+ p->rawS = 0;
23406
+ }
23407
+ }
23408
+ break;
23409
+ }
2335623410
#ifndef SQLITE_OMIT_LOCALTIME
2335723411
case 'l': {
2335823412
/* localtime
2335923413
**
2336023414
** Assuming the current time value is UTC (a.k.a. GMT), shift it to
@@ -23614,10 +23668,28 @@
2361423668
if( isDate(context, argc, argv, &x)==0 ){
2361523669
computeJD(&x);
2361623670
sqlite3_result_double(context, x.iJD/86400000.0);
2361723671
}
2361823672
}
23673
+
23674
+/*
23675
+** unixepoch( TIMESTRING, MOD, MOD, ...)
23676
+**
23677
+** Return the number of seconds (including fractional seconds) since
23678
+** the unix epoch of 1970-01-01 00:00:00 GMT.
23679
+*/
23680
+static void unixepochFunc(
23681
+ sqlite3_context *context,
23682
+ int argc,
23683
+ sqlite3_value **argv
23684
+){
23685
+ DateTime x;
23686
+ if( isDate(context, argc, argv, &x)==0 ){
23687
+ computeJD(&x);
23688
+ sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
23689
+ }
23690
+}
2361923691
2362023692
/*
2362123693
** datetime( TIMESTRING, MOD, MOD, ...)
2362223694
**
2362323695
** Return YYYY-MM-DD HH:MM:SS
@@ -23891,10 +23963,11 @@
2389123963
*/
2389223964
SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
2389323965
static FuncDef aDateTimeFuncs[] = {
2389423966
#ifndef SQLITE_OMIT_DATETIME_FUNCS
2389523967
PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
23968
+ PURE_DATE(unixepoch, -1, 0, 0, unixepochFunc ),
2389623969
PURE_DATE(date, -1, 0, 0, dateFunc ),
2389723970
PURE_DATE(time, -1, 0, 0, timeFunc ),
2389823971
PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
2389923972
PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
2390023973
DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
@@ -33608,11 +33681,10 @@
3360833681
#endif
3360933682
}
3361033683
return a[x&7] + y - 10;
3361133684
}
3361233685
33613
-#ifndef SQLITE_OMIT_VIRTUALTABLE
3361433686
/*
3361533687
** Convert a double into a LogEst
3361633688
** In other words, compute an approximation for 10*log2(x).
3361733689
*/
3361833690
SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
@@ -33623,38 +33695,23 @@
3362333695
if( x<=2000000000 ) return sqlite3LogEst((u64)x);
3362433696
memcpy(&a, &x, 8);
3362533697
e = (a>>52) - 1022;
3362633698
return e*10;
3362733699
}
33628
-#endif /* SQLITE_OMIT_VIRTUALTABLE */
3362933700
33630
-#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
33631
- defined(SQLITE_ENABLE_STAT4) || \
33632
- defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
3363333701
/*
3363433702
** Convert a LogEst into an integer.
33635
-**
33636
-** Note that this routine is only used when one or more of various
33637
-** non-standard compile-time options is enabled.
3363833703
*/
3363933704
SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
3364033705
u64 n;
3364133706
n = x%10;
3364233707
x /= 10;
3364333708
if( n>=5 ) n -= 2;
3364433709
else if( n>=1 ) n -= 1;
33645
-#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
33646
- defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
3364733710
if( x>60 ) return (u64)LARGEST_INT64;
33648
-#else
33649
- /* If only SQLITE_ENABLE_STAT4 is on, then the largest input
33650
- ** possible to this routine is 310, resulting in a maximum x of 31 */
33651
- assert( x<=60 );
33652
-#endif
3365333711
return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
3365433712
}
33655
-#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */
3365633713
3365733714
/*
3365833715
** Add a new name/number pair to a VList. This might require that the
3365933716
** VList object be reallocated, so return the new VList. If an OOM
3366033717
** error occurs, the original VList returned and the
@@ -34104,49 +34161,49 @@
3410434161
/* 58 */ "ElseEq" OpHelp(""),
3410534162
/* 59 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
3410634163
/* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
3410734164
/* 61 */ "IncrVacuum" OpHelp(""),
3410834165
/* 62 */ "VNext" OpHelp(""),
34109
- /* 63 */ "Init" OpHelp("Start at P2"),
34110
- /* 64 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
34111
- /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
34112
- /* 66 */ "Return" OpHelp(""),
34113
- /* 67 */ "EndCoroutine" OpHelp(""),
34114
- /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
34115
- /* 69 */ "Halt" OpHelp(""),
34116
- /* 70 */ "Integer" OpHelp("r[P2]=P1"),
34117
- /* 71 */ "Int64" OpHelp("r[P2]=P4"),
34118
- /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
34119
- /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"),
34120
- /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"),
34121
- /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
34122
- /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
34123
- /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
34124
- /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
34125
- /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"),
34126
- /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
34127
- /* 81 */ "ChngCntRow" OpHelp("output=r[P1]"),
34128
- /* 82 */ "ResultRow" OpHelp("output=r[P1@P2]"),
34129
- /* 83 */ "CollSeq" OpHelp(""),
34130
- /* 84 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
34131
- /* 85 */ "RealAffinity" OpHelp(""),
34132
- /* 86 */ "Cast" OpHelp("affinity(r[P1])"),
34133
- /* 87 */ "Permutation" OpHelp(""),
34134
- /* 88 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
34135
- /* 89 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
34136
- /* 90 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
34137
- /* 91 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
34138
- /* 92 */ "Column" OpHelp("r[P3]=PX"),
34139
- /* 93 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
34140
- /* 94 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
34141
- /* 95 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
34142
- /* 96 */ "Count" OpHelp("r[P2]=count()"),
34143
- /* 97 */ "ReadCookie" OpHelp(""),
34144
- /* 98 */ "SetCookie" OpHelp(""),
34145
- /* 99 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
34146
- /* 100 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
34147
- /* 101 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34166
+ /* 63 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
34167
+ /* 64 */ "Init" OpHelp("Start at P2"),
34168
+ /* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
34169
+ /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
34170
+ /* 67 */ "Return" OpHelp(""),
34171
+ /* 68 */ "EndCoroutine" OpHelp(""),
34172
+ /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
34173
+ /* 70 */ "Halt" OpHelp(""),
34174
+ /* 71 */ "Integer" OpHelp("r[P2]=P1"),
34175
+ /* 72 */ "Int64" OpHelp("r[P2]=P4"),
34176
+ /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
34177
+ /* 74 */ "Null" OpHelp("r[P2..P3]=NULL"),
34178
+ /* 75 */ "SoftNull" OpHelp("r[P1]=NULL"),
34179
+ /* 76 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
34180
+ /* 77 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
34181
+ /* 78 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
34182
+ /* 79 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
34183
+ /* 80 */ "SCopy" OpHelp("r[P2]=r[P1]"),
34184
+ /* 81 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
34185
+ /* 82 */ "FkCheck" OpHelp(""),
34186
+ /* 83 */ "ResultRow" OpHelp("output=r[P1@P2]"),
34187
+ /* 84 */ "CollSeq" OpHelp(""),
34188
+ /* 85 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
34189
+ /* 86 */ "RealAffinity" OpHelp(""),
34190
+ /* 87 */ "Cast" OpHelp("affinity(r[P1])"),
34191
+ /* 88 */ "Permutation" OpHelp(""),
34192
+ /* 89 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
34193
+ /* 90 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
34194
+ /* 91 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
34195
+ /* 92 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
34196
+ /* 93 */ "Column" OpHelp("r[P3]=PX"),
34197
+ /* 94 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
34198
+ /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
34199
+ /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
34200
+ /* 97 */ "Count" OpHelp("r[P2]=count()"),
34201
+ /* 98 */ "ReadCookie" OpHelp(""),
34202
+ /* 99 */ "SetCookie" OpHelp(""),
34203
+ /* 100 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
34204
+ /* 101 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
3414834205
/* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
3414934206
/* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
3415034207
/* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
3415134208
/* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
3415234209
/* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -34153,80 +34210,82 @@
3415334210
/* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
3415434211
/* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
3415534212
/* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
3415634213
/* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
3415734214
/* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
34158
- /* 112 */ "OpenDup" OpHelp(""),
34215
+ /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
3415934216
/* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34160
- /* 114 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34161
- /* 115 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34217
+ /* 114 */ "OpenDup" OpHelp(""),
34218
+ /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
3416234219
/* 116 */ "String8" OpHelp("r[P2]='P4'"),
34163
- /* 117 */ "SorterOpen" OpHelp(""),
34164
- /* 118 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34165
- /* 119 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34166
- /* 120 */ "Close" OpHelp(""),
34167
- /* 121 */ "ColumnsUsed" OpHelp(""),
34168
- /* 122 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
34169
- /* 123 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
34170
- /* 124 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
34171
- /* 125 */ "NewRowid" OpHelp("r[P2]=rowid"),
34172
- /* 126 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
34173
- /* 127 */ "RowCell" OpHelp(""),
34174
- /* 128 */ "Delete" OpHelp(""),
34175
- /* 129 */ "ResetCount" OpHelp(""),
34176
- /* 130 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
34177
- /* 131 */ "SorterData" OpHelp("r[P2]=data"),
34178
- /* 132 */ "RowData" OpHelp("r[P2]=data"),
34179
- /* 133 */ "Rowid" OpHelp("r[P2]=rowid"),
34180
- /* 134 */ "NullRow" OpHelp(""),
34181
- /* 135 */ "SeekEnd" OpHelp(""),
34182
- /* 136 */ "IdxInsert" OpHelp("key=r[P2]"),
34183
- /* 137 */ "SorterInsert" OpHelp("key=r[P2]"),
34184
- /* 138 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
34185
- /* 139 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
34186
- /* 140 */ "IdxRowid" OpHelp("r[P2]=rowid"),
34187
- /* 141 */ "FinishSeek" OpHelp(""),
34188
- /* 142 */ "Destroy" OpHelp(""),
34189
- /* 143 */ "Clear" OpHelp(""),
34190
- /* 144 */ "ResetSorter" OpHelp(""),
34191
- /* 145 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
34192
- /* 146 */ "SqlExec" OpHelp(""),
34193
- /* 147 */ "ParseSchema" OpHelp(""),
34194
- /* 148 */ "LoadAnalysis" OpHelp(""),
34195
- /* 149 */ "DropTable" OpHelp(""),
34196
- /* 150 */ "DropIndex" OpHelp(""),
34197
- /* 151 */ "DropTrigger" OpHelp(""),
34220
+ /* 117 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34221
+ /* 118 */ "SorterOpen" OpHelp(""),
34222
+ /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34223
+ /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34224
+ /* 121 */ "Close" OpHelp(""),
34225
+ /* 122 */ "ColumnsUsed" OpHelp(""),
34226
+ /* 123 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
34227
+ /* 124 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
34228
+ /* 125 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
34229
+ /* 126 */ "NewRowid" OpHelp("r[P2]=rowid"),
34230
+ /* 127 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
34231
+ /* 128 */ "RowCell" OpHelp(""),
34232
+ /* 129 */ "Delete" OpHelp(""),
34233
+ /* 130 */ "ResetCount" OpHelp(""),
34234
+ /* 131 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
34235
+ /* 132 */ "SorterData" OpHelp("r[P2]=data"),
34236
+ /* 133 */ "RowData" OpHelp("r[P2]=data"),
34237
+ /* 134 */ "Rowid" OpHelp("r[P2]=rowid"),
34238
+ /* 135 */ "NullRow" OpHelp(""),
34239
+ /* 136 */ "SeekEnd" OpHelp(""),
34240
+ /* 137 */ "IdxInsert" OpHelp("key=r[P2]"),
34241
+ /* 138 */ "SorterInsert" OpHelp("key=r[P2]"),
34242
+ /* 139 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
34243
+ /* 140 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
34244
+ /* 141 */ "IdxRowid" OpHelp("r[P2]=rowid"),
34245
+ /* 142 */ "FinishSeek" OpHelp(""),
34246
+ /* 143 */ "Destroy" OpHelp(""),
34247
+ /* 144 */ "Clear" OpHelp(""),
34248
+ /* 145 */ "ResetSorter" OpHelp(""),
34249
+ /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
34250
+ /* 147 */ "SqlExec" OpHelp(""),
34251
+ /* 148 */ "ParseSchema" OpHelp(""),
34252
+ /* 149 */ "LoadAnalysis" OpHelp(""),
34253
+ /* 150 */ "DropTable" OpHelp(""),
34254
+ /* 151 */ "DropIndex" OpHelp(""),
3419834255
/* 152 */ "Real" OpHelp("r[P2]=P4"),
34199
- /* 153 */ "IntegrityCk" OpHelp(""),
34200
- /* 154 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34201
- /* 155 */ "Param" OpHelp(""),
34202
- /* 156 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34203
- /* 157 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
34204
- /* 158 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
34205
- /* 159 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
34206
- /* 160 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
34207
- /* 161 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
34208
- /* 162 */ "AggValue" OpHelp("r[P3]=value N=P2"),
34209
- /* 163 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
34210
- /* 164 */ "Expire" OpHelp(""),
34211
- /* 165 */ "CursorLock" OpHelp(""),
34212
- /* 166 */ "CursorUnlock" OpHelp(""),
34213
- /* 167 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
34214
- /* 168 */ "VBegin" OpHelp(""),
34215
- /* 169 */ "VCreate" OpHelp(""),
34216
- /* 170 */ "VDestroy" OpHelp(""),
34217
- /* 171 */ "VOpen" OpHelp(""),
34218
- /* 172 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
34219
- /* 173 */ "VRename" OpHelp(""),
34220
- /* 174 */ "Pagecount" OpHelp(""),
34221
- /* 175 */ "MaxPgcnt" OpHelp(""),
34222
- /* 176 */ "Trace" OpHelp(""),
34223
- /* 177 */ "CursorHint" OpHelp(""),
34224
- /* 178 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
34225
- /* 179 */ "Noop" OpHelp(""),
34226
- /* 180 */ "Explain" OpHelp(""),
34227
- /* 181 */ "Abortable" OpHelp(""),
34256
+ /* 153 */ "DropTrigger" OpHelp(""),
34257
+ /* 154 */ "IntegrityCk" OpHelp(""),
34258
+ /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34259
+ /* 156 */ "Param" OpHelp(""),
34260
+ /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34261
+ /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
34262
+ /* 159 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
34263
+ /* 160 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
34264
+ /* 161 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
34265
+ /* 162 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
34266
+ /* 163 */ "AggValue" OpHelp("r[P3]=value N=P2"),
34267
+ /* 164 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
34268
+ /* 165 */ "Expire" OpHelp(""),
34269
+ /* 166 */ "CursorLock" OpHelp(""),
34270
+ /* 167 */ "CursorUnlock" OpHelp(""),
34271
+ /* 168 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
34272
+ /* 169 */ "VBegin" OpHelp(""),
34273
+ /* 170 */ "VCreate" OpHelp(""),
34274
+ /* 171 */ "VDestroy" OpHelp(""),
34275
+ /* 172 */ "VOpen" OpHelp(""),
34276
+ /* 173 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
34277
+ /* 174 */ "VRename" OpHelp(""),
34278
+ /* 175 */ "Pagecount" OpHelp(""),
34279
+ /* 176 */ "MaxPgcnt" OpHelp(""),
34280
+ /* 177 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
34281
+ /* 178 */ "Trace" OpHelp(""),
34282
+ /* 179 */ "CursorHint" OpHelp(""),
34283
+ /* 180 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
34284
+ /* 181 */ "Noop" OpHelp(""),
34285
+ /* 182 */ "Explain" OpHelp(""),
34286
+ /* 183 */ "Abortable" OpHelp(""),
3422834287
};
3422934288
return azName[i];
3423034289
}
3423134290
#endif
3423234291
@@ -68263,34 +68322,42 @@
6826368322
/*
6826468323
** Make sure pBt->pTmpSpace points to an allocation of
6826568324
** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
6826668325
** pointer.
6826768326
*/
68268
-static void allocateTempSpace(BtShared *pBt){
68269
- if( !pBt->pTmpSpace ){
68270
- pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
68271
-
68272
- /* One of the uses of pBt->pTmpSpace is to format cells before
68273
- ** inserting them into a leaf page (function fillInCell()). If
68274
- ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
68275
- ** by the various routines that manipulate binary cells. Which
68276
- ** can mean that fillInCell() only initializes the first 2 or 3
68277
- ** bytes of pTmpSpace, but that the first 4 bytes are copied from
68278
- ** it into a database page. This is not actually a problem, but it
68279
- ** does cause a valgrind error when the 1 or 2 bytes of unitialized
68280
- ** data is passed to system call write(). So to avoid this error,
68281
- ** zero the first 4 bytes of temp space here.
68282
- **
68283
- ** Also: Provide four bytes of initialized space before the
68284
- ** beginning of pTmpSpace as an area available to prepend the
68285
- ** left-child pointer to the beginning of a cell.
68286
- */
68287
- if( pBt->pTmpSpace ){
68288
- memset(pBt->pTmpSpace, 0, 8);
68289
- pBt->pTmpSpace += 4;
68290
- }
68291
- }
68327
+static SQLITE_NOINLINE int allocateTempSpace(BtShared *pBt){
68328
+ assert( pBt!=0 );
68329
+ assert( pBt->pTmpSpace==0 );
68330
+ /* This routine is called only by btreeCursor() when allocating the
68331
+ ** first write cursor for the BtShared object */
68332
+ assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 );
68333
+ pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
68334
+ if( pBt->pTmpSpace==0 ){
68335
+ BtCursor *pCur = pBt->pCursor;
68336
+ pBt->pCursor = pCur->pNext; /* Unlink the cursor */
68337
+ memset(pCur, 0, sizeof(*pCur));
68338
+ return SQLITE_NOMEM_BKPT;
68339
+ }
68340
+
68341
+ /* One of the uses of pBt->pTmpSpace is to format cells before
68342
+ ** inserting them into a leaf page (function fillInCell()). If
68343
+ ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
68344
+ ** by the various routines that manipulate binary cells. Which
68345
+ ** can mean that fillInCell() only initializes the first 2 or 3
68346
+ ** bytes of pTmpSpace, but that the first 4 bytes are copied from
68347
+ ** it into a database page. This is not actually a problem, but it
68348
+ ** does cause a valgrind error when the 1 or 2 bytes of unitialized
68349
+ ** data is passed to system call write(). So to avoid this error,
68350
+ ** zero the first 4 bytes of temp space here.
68351
+ **
68352
+ ** Also: Provide four bytes of initialized space before the
68353
+ ** beginning of pTmpSpace as an area available to prepend the
68354
+ ** left-child pointer to the beginning of a cell.
68355
+ */
68356
+ memset(pBt->pTmpSpace, 0, 8);
68357
+ pBt->pTmpSpace += 4;
68358
+ return SQLITE_OK;
6829268359
}
6829368360
6829468361
/*
6829568362
** Free the pBt->pTmpSpace allocation
6829668363
*/
@@ -70027,14 +70094,10 @@
7002770094
assert( p->inTrans>TRANS_NONE );
7002870095
assert( wrFlag==0 || p->inTrans==TRANS_WRITE );
7002970096
assert( pBt->pPage1 && pBt->pPage1->aData );
7003070097
assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );
7003170098
70032
- if( wrFlag ){
70033
- allocateTempSpace(pBt);
70034
- if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
70035
- }
7003670099
if( iTable<=1 ){
7003770100
if( iTable<1 ){
7003870101
return SQLITE_CORRUPT_BKPT;
7003970102
}else if( btreePagecount(pBt)==0 ){
7004070103
assert( wrFlag==0 );
@@ -70047,23 +70110,29 @@
7004770110
pCur->pgnoRoot = iTable;
7004870111
pCur->iPage = -1;
7004970112
pCur->pKeyInfo = pKeyInfo;
7005070113
pCur->pBtree = p;
7005170114
pCur->pBt = pBt;
70052
- pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0;
70053
- pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY;
70115
+ pCur->curFlags = 0;
7005470116
/* If there are two or more cursors on the same btree, then all such
7005570117
** cursors *must* have the BTCF_Multiple flag set. */
7005670118
for(pX=pBt->pCursor; pX; pX=pX->pNext){
7005770119
if( pX->pgnoRoot==iTable ){
7005870120
pX->curFlags |= BTCF_Multiple;
70059
- pCur->curFlags |= BTCF_Multiple;
70121
+ pCur->curFlags = BTCF_Multiple;
7006070122
}
7006170123
}
70124
+ pCur->eState = CURSOR_INVALID;
7006270125
pCur->pNext = pBt->pCursor;
7006370126
pBt->pCursor = pCur;
70064
- pCur->eState = CURSOR_INVALID;
70127
+ if( wrFlag ){
70128
+ pCur->curFlags |= BTCF_WriteFlag;
70129
+ pCur->curPagerFlags = 0;
70130
+ if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt);
70131
+ }else{
70132
+ pCur->curPagerFlags = PAGER_GET_READONLY;
70133
+ }
7006570134
return SQLITE_OK;
7006670135
}
7006770136
static int btreeCursorWithLock(
7006870137
Btree *p, /* The btree */
7006970138
Pgno iTable, /* Root page of table to open */
@@ -77812,16 +77881,16 @@
7781277881
** it into an integer and return that. If pMem represents an
7781377882
** an SQL-NULL value, return 0.
7781477883
**
7781577884
** If pMem represents a string value, its encoding might be changed.
7781677885
*/
77817
-static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){
77886
+static SQLITE_NOINLINE i64 memIntValue(const Mem *pMem){
7781877887
i64 value = 0;
7781977888
sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
7782077889
return value;
7782177890
}
77822
-SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
77891
+SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem *pMem){
7782377892
int flags;
7782477893
assert( pMem!=0 );
7782577894
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
7782677895
assert( EIGHT_BYTE_ALIGNMENT(pMem) );
7782777896
flags = pMem->flags;
@@ -87366,10 +87435,35 @@
8736687435
}else{
8736787436
pOut->flags = MEM_Int;
8736887437
return pOut;
8736987438
}
8737087439
}
87440
+
87441
+/*
87442
+** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning
87443
+** with pOp->p3. Return the hash.
87444
+*/
87445
+static u64 filterHash(const Mem *aMem, const Op *pOp){
87446
+ int i, mx;
87447
+ u64 h = 0;
87448
+
87449
+ i = pOp->p3;
87450
+ assert( pOp->p4type==P4_INT32 );
87451
+ mx = i + pOp->p4.i;
87452
+ for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
87453
+ const Mem *p = &aMem[i];
87454
+ if( p->flags & (MEM_Int|MEM_IntReal) ){
87455
+ h += p->u.i;
87456
+ }else if( p->flags & MEM_Real ){
87457
+ h += sqlite3VdbeIntValue(p);
87458
+ }else if( p->flags & (MEM_Str|MEM_Blob) ){
87459
+ h += p->n;
87460
+ if( p->flags & MEM_Zero ) h += p->u.nZero;
87461
+ }
87462
+ }
87463
+ return h;
87464
+}
8737187465
8737287466
/*
8737387467
** Return the symbolic name for the data type of a pMem
8737487468
*/
8737587469
static const char *vdbeMemTypeName(Mem *pMem){
@@ -88021,16 +88115,22 @@
8802188115
8802288116
/* Opcode: Blob P1 P2 * P4 *
8802388117
** Synopsis: r[P2]=P4 (len=P1)
8802488118
**
8802588119
** P4 points to a blob of data P1 bytes long. Store this
88026
-** blob in register P2.
88120
+** blob in register P2. If P4 is a NULL pointer, then construct
88121
+** a zero-filled blob that is P1 bytes long in P2.
8802788122
*/
8802888123
case OP_Blob: { /* out2 */
8802988124
assert( pOp->p1 <= SQLITE_MAX_LENGTH );
8803088125
pOut = out2Prerelease(p, pOp);
88031
- sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
88126
+ if( pOp->p4.z==0 ){
88127
+ sqlite3VdbeMemSetZeroBlob(pOut, pOp->p1);
88128
+ if( sqlite3VdbeMemExpandBlob(pOut) ) goto no_mem;
88129
+ }else{
88130
+ sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
88131
+ }
8803288132
pOut->enc = encoding;
8803388133
UPDATE_MAX_BLOBSIZE(pOut);
8803488134
break;
8803588135
}
8803688136
@@ -88175,28 +88275,26 @@
8817588275
pOut = &aMem[pOp->p2];
8817688276
sqlite3VdbeMemSetInt64(pOut, pIn1->u.i);
8817788277
break;
8817888278
}
8817988279
88180
-/* Opcode: ChngCntRow P1 P2 * * *
88181
-** Synopsis: output=r[P1]
88182
-**
88183
-** Output value in register P1 as the chance count for a DML statement,
88184
-** due to the "PRAGMA count_changes=ON" setting. Or, if there was a
88185
-** foreign key error in the statement, trigger the error now.
88186
-**
88187
-** This opcode is a variant of OP_ResultRow that checks the foreign key
88188
-** immediate constraint count and throws an error if the count is
88189
-** non-zero. The P2 opcode must be 1.
88190
-*/
88191
-case OP_ChngCntRow: {
88192
- assert( pOp->p2==1 );
88280
+/* Opcode: FkCheck * * * * *
88281
+**
88282
+** Halt with an SQLITE_CONSTRAINT error if there are any unresolved
88283
+** foreign key constraint violations. If there are no foreign key
88284
+** constraint violations, this is a no-op.
88285
+**
88286
+** FK constraint violations are also checked when the prepared statement
88287
+** exits. This opcode is used to raise foreign key constraint errors prior
88288
+** to returning results such as a row change count or the result of a
88289
+** RETURNING clause.
88290
+*/
88291
+case OP_FkCheck: {
8819388292
if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){
8819488293
goto abort_due_to_error;
8819588294
}
88196
- /* Fall through to the next case, OP_ResultRow */
88197
- /* no break */ deliberate_fall_through
88295
+ break;
8819888296
}
8819988297
8820088298
/* Opcode: ResultRow P1 P2 * * *
8820188299
** Synopsis: output=r[P1@P2]
8820288300
**
@@ -90039,11 +90137,11 @@
9003990137
assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
9004090138
REGISTER_TRACE(pOp->p3, pOut);
9004190139
break;
9004290140
}
9004390141
90044
-/* Opcode: Count P1 P2 p3 * *
90142
+/* Opcode: Count P1 P2 P3 * *
9004590143
** Synopsis: r[P2]=count()
9004690144
**
9004790145
** Store the number of entries (an integer value) in the table or index
9004890146
** opened by cursor P1 in register P2.
9004990147
**
@@ -94824,10 +94922,81 @@
9482494922
9482594923
REGISTER_TRACE(pOp->p3, pOut);
9482694924
UPDATE_MAX_BLOBSIZE(pOut);
9482794925
break;
9482894926
}
94927
+
94928
+/* Opcode: FilterAdd P1 * P3 P4 *
94929
+** Synopsis: filter(P1) += key(P3@P4)
94930
+**
94931
+** Compute a hash on the P4 registers starting with r[P3] and
94932
+** add that hash to the bloom filter contained in r[P1].
94933
+*/
94934
+case OP_FilterAdd: {
94935
+ u64 h;
94936
+
94937
+ assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
94938
+ pIn1 = &aMem[pOp->p1];
94939
+ assert( pIn1->flags & MEM_Blob );
94940
+ assert( pIn1->n>0 );
94941
+ h = filterHash(aMem, pOp);
94942
+#ifdef SQLITE_DEBUG
94943
+ if( db->flags&SQLITE_VdbeTrace ){
94944
+ int ii;
94945
+ for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
94946
+ registerTrace(ii, &aMem[ii]);
94947
+ }
94948
+ printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
94949
+ }
94950
+#endif
94951
+ h %= pIn1->n;
94952
+ pIn1->z[h/8] |= 1<<(h&7);
94953
+ break;
94954
+}
94955
+
94956
+/* Opcode: Filter P1 P2 P3 P4 *
94957
+** Synopsis: if key(P3@P4) not in filter(P1) goto P2
94958
+**
94959
+** Compute a hash on the key contained in the P4 registers starting
94960
+** with r[P3]. Check to see if that hash is found in the
94961
+** bloom filter hosted by register P1. If it is not present then
94962
+** maybe jump to P2. Otherwise fall through.
94963
+**
94964
+** False negatives are harmless. It is always safe to fall through,
94965
+** even if the value is in the bloom filter. A false negative causes
94966
+** more CPU cycles to be used, but it should still yield the correct
94967
+** answer. However, an incorrect answer may well arise from a
94968
+** false positive - if the jump is taken when it should fall through.
94969
+*/
94970
+case OP_Filter: { /* jump */
94971
+ u64 h;
94972
+
94973
+ assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
94974
+ pIn1 = &aMem[pOp->p1];
94975
+ assert( (pIn1->flags & MEM_Blob)!=0 );
94976
+ assert( pIn1->n >= 1 );
94977
+ h = filterHash(aMem, pOp);
94978
+#ifdef SQLITE_DEBUG
94979
+ if( db->flags&SQLITE_VdbeTrace ){
94980
+ int ii;
94981
+ for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
94982
+ registerTrace(ii, &aMem[ii]);
94983
+ }
94984
+ printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
94985
+ }
94986
+#endif
94987
+ h %= pIn1->n;
94988
+ if( (pIn1->z[h/8] & (1<<(h&7)))==0 ){
94989
+ VdbeBranchTaken(1, 2);
94990
+ p->aCounter[SQLITE_STMTSTATUS_FILTER_HIT]++;
94991
+ goto jump_to_p2;
94992
+ }else{
94993
+ p->aCounter[SQLITE_STMTSTATUS_FILTER_MISS]++;
94994
+ VdbeBranchTaken(0, 2);
94995
+ }
94996
+ break;
94997
+}
9482994998
9483094999
/* Opcode: Trace P1 P2 * P4 *
9483195000
**
9483295001
** Write P4 on the statement trace output if statement tracing is
9483395002
** enabled.
@@ -104083,11 +104252,11 @@
104083104252
case TK_COLUMN:
104084104253
assert( ExprUseYTab(p) );
104085104254
return ExprHasProperty(p, EP_CanBeNull) ||
104086104255
p->y.pTab==0 || /* Reference to column of index on expression */
104087104256
(p->iColumn>=0
104088
- && ALWAYS(p->y.pTab->aCol!=0) /* Defense against OOM problems */
104257
+ && p->y.pTab->aCol!=0 /* Possible due to prior error */
104089104258
&& p->y.pTab->aCol[p->iColumn].notNull==0);
104090104259
default:
104091104260
return 1;
104092104261
}
104093104262
}
@@ -107514,11 +107683,11 @@
107514107683
** implement sqlite3ReferencesSrcList().
107515107684
*/
107516107685
struct RefSrcList {
107517107686
sqlite3 *db; /* Database connection used for sqlite3DbRealloc() */
107518107687
SrcList *pRef; /* Looking for references to these tables */
107519
- int nExclude; /* Number of tables to exclude from the search */
107688
+ i64 nExclude; /* Number of tables to exclude from the search */
107520107689
int *aiExclude; /* Cursor IDs for tables to exclude from the search */
107521107690
};
107522107691
107523107692
/*
107524107693
** Walker SELECT callbacks for sqlite3ReferencesSrcList().
@@ -107529,11 +107698,12 @@
107529107698
** When leaving the subquery, remove those entries from the exclude list.
107530107699
*/
107531107700
static int selectRefEnter(Walker *pWalker, Select *pSelect){
107532107701
struct RefSrcList *p = pWalker->u.pRefSrcList;
107533107702
SrcList *pSrc = pSelect->pSrc;
107534
- int i, j, *piNew;
107703
+ i64 i, j;
107704
+ int *piNew;
107535107705
if( pSrc->nSrc==0 ) return WRC_Continue;
107536107706
j = p->nExclude;
107537107707
p->nExclude += pSrc->nSrc;
107538107708
piNew = sqlite3DbRealloc(p->db, p->aiExclude, p->nExclude*sizeof(int));
107539107709
if( piNew==0 ){
@@ -113192,10 +113362,11 @@
113192113362
int reg;
113193113363
113194113364
if( pReturning->nRetCol==0 ){
113195113365
assert( CORRUPT_DB );
113196113366
}else{
113367
+ sqlite3VdbeAddOp0(v, OP_FkCheck);
113197113368
addrRewind =
113198113369
sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
113199113370
VdbeCoverage(v);
113200113371
reg = pReturning->iRetReg;
113201113372
for(i=0; i<pReturning->nRetCol; i++){
@@ -113761,12 +113932,12 @@
113761113932
SQLITE_PRIVATE void sqlite3ColumnSetColl(
113762113933
sqlite3 *db,
113763113934
Column *pCol,
113764113935
const char *zColl
113765113936
){
113766
- int nColl;
113767
- int n;
113937
+ i64 nColl;
113938
+ i64 n;
113768113939
char *zNew;
113769113940
assert( zColl!=0 );
113770113941
n = sqlite3Strlen30(pCol->zCnName) + 1;
113771113942
if( pCol->colFlags & COLFLAG_HASTYPE ){
113772113943
n += sqlite3Strlen30(pCol->zCnName+n) + 1;
@@ -114567,11 +114738,11 @@
114567114738
break;
114568114739
}
114569114740
}
114570114741
}
114571114742
114572
- z = sqlite3DbMallocRaw(db, sName.n + 1 + sType.n + (sType.n>0) );
114743
+ z = sqlite3DbMallocRaw(db, (i64)sName.n + 1 + (i64)sType.n + (sType.n>0) );
114573114744
if( z==0 ) return;
114574114745
if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName);
114575114746
memcpy(z, sName.z, sName.n);
114576114747
z[sName.n] = 0;
114577114748
sqlite3Dequote(z);
@@ -114581,11 +114752,11 @@
114581114752
sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
114582114753
sqlite3DbFree(db, z);
114583114754
return;
114584114755
}
114585114756
}
114586
- aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+1)*sizeof(p->aCol[0]));
114757
+ aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0]));
114587114758
if( aNew==0 ){
114588114759
sqlite3DbFree(db, z);
114589114760
return;
114590114761
}
114591114762
p->aCol = aNew;
@@ -116594,11 +116765,11 @@
116594116765
sqlite3 *db = pParse->db;
116595116766
#ifndef SQLITE_OMIT_FOREIGN_KEY
116596116767
FKey *pFKey = 0;
116597116768
FKey *pNextTo;
116598116769
Table *p = pParse->pNewTable;
116599
- int nByte;
116770
+ i64 nByte;
116600116771
int i;
116601116772
int nCol;
116602116773
char *z;
116603116774
116604116775
assert( pTo!=0 );
@@ -117424,17 +117595,17 @@
117424117595
}
117425117596
117426117597
/* Add an entry in sqlite_schema for this index
117427117598
*/
117428117599
sqlite3NestedParse(pParse,
117429
- "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",
117430
- db->aDb[iDb].zDbSName,
117431
- pIndex->zName,
117432
- pTab->zName,
117433
- iMem,
117434
- zStmt
117435
- );
117600
+ "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",
117601
+ db->aDb[iDb].zDbSName,
117602
+ pIndex->zName,
117603
+ pTab->zName,
117604
+ iMem,
117605
+ zStmt
117606
+ );
117436117607
sqlite3DbFree(db, zStmt);
117437117608
117438117609
/* Fill the index with data and reparse the schema. Code an OP_Expire
117439117610
** to invalidate all pre-compiled statements.
117440117611
*/
@@ -117978,11 +118149,11 @@
117978118149
pItem->pSelect = pSubquery;
117979118150
pItem->pOn = pOn;
117980118151
pItem->pUsing = pUsing;
117981118152
return p;
117982118153
117983
- append_from_error:
118154
+append_from_error:
117984118155
assert( p==0 );
117985118156
sqlite3ExprDelete(db, pOn);
117986118157
sqlite3IdListDelete(db, pUsing);
117987118158
sqlite3SelectDelete(db, pSubquery);
117988118159
return 0;
@@ -119234,10 +119405,20 @@
119234119405
pTab = 0;
119235119406
}
119236119407
}
119237119408
return pTab;
119238119409
}
119410
+
119411
+/* Generate byte-code that will report the number of rows modified
119412
+** by a DELETE, INSERT, or UPDATE statement.
119413
+*/
119414
+SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *zColName){
119415
+ sqlite3VdbeAddOp0(v, OP_FkCheck);
119416
+ sqlite3VdbeAddOp2(v, OP_ResultRow, regCounter, 1);
119417
+ sqlite3VdbeSetNumCols(v, 1);
119418
+ sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zColName, SQLITE_STATIC);
119419
+}
119239119420
119240119421
/* Return true if table pTab is read-only.
119241119422
**
119242119423
** A table is read-only if any of the following are true:
119243119424
**
@@ -119810,13 +119991,11 @@
119810119991
/* Return the number of rows that were deleted. If this routine is
119811119992
** generating code because of a call to sqlite3NestedParse(), do not
119812119993
** invoke the callback function.
119813119994
*/
119814119995
if( memCnt ){
119815
- sqlite3VdbeAddOp2(v, OP_ChngCntRow, memCnt, 1);
119816
- sqlite3VdbeSetNumCols(v, 1);
119817
- sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
119996
+ sqlite3CodeChangeCount(v, memCnt, "rows deleted");
119818119997
}
119819119998
119820119999
delete_from_cleanup:
119821120000
sqlite3AuthContextPop(&sContext);
119822120001
sqlite3SrcListDelete(db, pTabList);
@@ -125370,13 +125549,11 @@
125370125549
** Return the number of rows inserted. If this routine is
125371125550
** generating code because of a call to sqlite3NestedParse(), do not
125372125551
** invoke the callback function.
125373125552
*/
125374125553
if( regRowCount ){
125375
- sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
125376
- sqlite3VdbeSetNumCols(v, 1);
125377
- sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
125554
+ sqlite3CodeChangeCount(v, regRowCount, "rows inserted");
125378125555
}
125379125556
125380125557
insert_cleanup:
125381125558
sqlite3SrcListDelete(db, pTabList);
125382125559
sqlite3ExprListDelete(db, pList);
@@ -133002,10 +133179,11 @@
133002133179
/* Make multiple attempts to compile the SQL, until it either succeeds
133003133180
** or encounters a permanent error. A schema problem after one schema
133004133181
** reset is considered a permanent error. */
133005133182
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
133006133183
assert( rc==SQLITE_OK || *ppStmt==0 );
133184
+ if( rc==SQLITE_OK || db->mallocFailed ) break;
133007133185
}while( rc==SQLITE_ERROR_RETRY
133008133186
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
133009133187
sqlite3BtreeLeaveAll(db);
133010133188
rc = sqlite3ApiExit(db, rc);
133011133189
assert( (rc&db->errMask)==rc );
@@ -135418,11 +135596,11 @@
135418135596
memset(&sNC, 0, sizeof(sNC));
135419135597
sNC.pSrcList = pSelect->pSrc;
135420135598
a = pSelect->pEList->a;
135421135599
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
135422135600
const char *zType;
135423
- int n, m;
135601
+ i64 n, m;
135424135602
pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
135425135603
p = a[i].pExpr;
135426135604
zType = columnType(&sNC, p, 0, 0, 0);
135427135605
/* pCol->szEst = ... // Column size est for SELECT tables never used */
135428135606
pCol->affinity = sqlite3ExprAffinity(p);
@@ -137404,11 +137582,11 @@
137404137582
/* Restriction (23) */
137405137583
if( (p->selFlags & SF_Recursive) ) return 0;
137406137584
137407137585
if( pSrc->nSrc>1 ){
137408137586
if( pParse->nSelect>500 ) return 0;
137409
- aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+1)*sizeof(int));
137587
+ aCsrMap = sqlite3DbMallocZero(db, ((i64)pParse->nTab+1)*sizeof(int));
137410137588
if( aCsrMap ) aCsrMap[0] = pParse->nTab;
137411137589
}
137412137590
}
137413137591
137414137592
/***** If we reach this point, flattening is permitted. *****/
@@ -138175,15 +138353,15 @@
138175138353
**
138176138354
** where table is a database table, not a sub-select or view. If the query
138177138355
** does match this pattern, then a pointer to the Table object representing
138178138356
** <tbl> is returned. Otherwise, NULL is returned.
138179138357
**
138180
-** This routine a condition for the count optimization. A correct answer
138181
-** is obtained (though perhaps more slowly) if this routine returns NULL when
138182
-** it could have returned a table pointer. But returning the pointer when
138183
-** NULL should have been returned can result in incorrect answers and/or
138184
-** crashes. So, when in doubt, return NULL.
138358
+** This routine checks to see if it is safe to use the count optimization.
138359
+** A correct answer is still obtained (though perhaps more slowly) if
138360
+** this routine returns NULL when it could have returned a table pointer.
138361
+** But returning the pointer when NULL should have been returned can
138362
+** result in incorrect answers and/or crashes. So, when in doubt, return NULL.
138185138363
*/
138186138364
static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
138187138365
Table *pTab;
138188138366
Expr *pExpr;
138189138367
@@ -143493,13 +143671,11 @@
143493143671
/*
143494143672
** Return the number of rows that were changed, if we are tracking
143495143673
** that information.
143496143674
*/
143497143675
if( regRowCount ){
143498
- sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
143499
- sqlite3VdbeSetNumCols(v, 1);
143500
- sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
143676
+ sqlite3CodeChangeCount(v, regRowCount, "rows updated");
143501143677
}
143502143678
143503143679
update_cleanup:
143504143680
sqlite3AuthContextPop(&sContext);
143505143681
sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */
@@ -145869,10 +146045,11 @@
145869146045
int addrBignull; /* Jump here for next part of big-null scan */
145870146046
#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS
145871146047
u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */
145872146048
int addrLikeRep; /* LIKE range processing address */
145873146049
#endif
146050
+ int regFilter; /* Bloom filter */
145874146051
u8 iFrom; /* Which entry in the FROM clause */
145875146052
u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
145876146053
int p1, p2; /* Operands of the opcode used to end the loop */
145877146054
union { /* Information that depends on pWLoop->wsFlags */
145878146055
struct {
@@ -146097,15 +146274,15 @@
146097146274
struct WhereScan {
146098146275
WhereClause *pOrigWC; /* Original, innermost WhereClause */
146099146276
WhereClause *pWC; /* WhereClause currently being scanned */
146100146277
const char *zCollName; /* Required collating sequence, if not NULL */
146101146278
Expr *pIdxExpr; /* Search for this index expression */
146102
- char idxaff; /* Must match this affinity, if zCollName!=NULL */
146103
- unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */
146104
- unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */
146279
+ int k; /* Resume scanning at this->pWC->a[this->k] */
146105146280
u32 opMask; /* Acceptable operators */
146106
- int k; /* Resume scanning at this->pWC->a[this->k] */
146281
+ char idxaff; /* Must match this affinity, if zCollName!=NULL */
146282
+ unsigned char iEquiv; /* Current slot in aiCur[] and aiColumn[] */
146283
+ unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */
146107146284
int aiCur[11]; /* Cursors in the equivalence class */
146108146285
i16 aiColumn[11]; /* Corresponding column number in the eq-class */
146109146286
};
146110146287
146111146288
/*
@@ -146125,10 +146302,11 @@
146125146302
WhereClause *pOuter; /* Outer conjunction */
146126146303
u8 op; /* Split operator. TK_AND or TK_OR */
146127146304
u8 hasOr; /* True if any a[].eOperator is WO_OR */
146128146305
int nTerm; /* Number of terms */
146129146306
int nSlot; /* Number of entries in a[] */
146307
+ int nBase; /* Number of terms through the last non-Virtual */
146130146308
WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */
146131146309
#if defined(SQLITE_SMALL_STACK)
146132146310
WhereTerm aStatic[1]; /* Initial static space for a[] */
146133146311
#else
146134146312
WhereTerm aStatic[8]; /* Initial static space for a[] */
@@ -146182,15 +146360,10 @@
146182146360
int bVarSelect; /* Used by sqlite3WhereExprUsage() */
146183146361
int n; /* Number of assigned cursor values */
146184146362
int ix[BMS]; /* Cursor assigned to each bit */
146185146363
};
146186146364
146187
-/*
146188
-** Initialize a WhereMaskSet object
146189
-*/
146190
-#define initMaskSet(P) (P)->n=0
146191
-
146192146365
/*
146193146366
** This object is a convenience wrapper holding all information needed
146194146367
** to construct WhereLoop objects for a particular query.
146195146368
*/
146196146369
struct WhereLoopBuilder {
@@ -146315,12 +146488,18 @@
146315146488
Parse *pParse, /* Parse context */
146316146489
SrcList *pTabList, /* Table list this loop refers to */
146317146490
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
146318146491
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
146319146492
);
146493
+SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter(
146494
+ const Parse *pParse, /* Parse context */
146495
+ const WhereInfo *pWInfo, /* WHERE clause */
146496
+ const WhereLevel *pLevel /* Bloom filter on this level */
146497
+);
146320146498
#else
146321146499
# define sqlite3WhereExplainOneScan(u,v,w,x) 0
146500
+# define sqlite3WhereExplainBloomFilter(u,v,w) 0
146322146501
#endif /* SQLITE_OMIT_EXPLAIN */
146323146502
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146324146503
SQLITE_PRIVATE void sqlite3WhereAddScanStatus(
146325146504
Vdbe *v, /* Vdbe to add scanstatus entry to */
146326146505
SrcList *pSrclist, /* FROM clause pLvl reads data from */
@@ -146409,10 +146588,12 @@
146409146588
#define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
146410146589
#define WHERE_IN_EARLYOUT 0x00040000 /* Perhaps quit IN loops early */
146411146590
#define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */
146412146591
#define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */
146413146592
#define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */
146593
+#define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */
146594
+#define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */
146414146595
146415146596
#endif /* !defined(SQLITE_WHEREINT_H) */
146416146597
146417146598
/************** End of whereInt.h ********************************************/
146418146599
/************** Continuing where we left off in wherecode.c ******************/
@@ -146571,23 +146752,31 @@
146571146752
sqlite3_str_append(&str, " USING ", 7);
146572146753
sqlite3_str_appendf(&str, zFmt, pIdx->zName);
146573146754
explainIndexRange(&str, pLoop);
146574146755
}
146575146756
}else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
146576
- const char *zRangeOp;
146757
+ char cRangeOp;
146758
+#if 0 /* Better output, but breaks many tests */
146759
+ const Table *pTab = pItem->pTab;
146760
+ const char *zRowid = pTab->iPKey>=0 ? pTab->aCol[pTab->iPKey].zCnName:
146761
+ "rowid";
146762
+#else
146763
+ const char *zRowid = "rowid";
146764
+#endif
146765
+ sqlite3_str_appendf(&str, " USING INTEGER PRIMARY KEY (%s", zRowid);
146577146766
if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){
146578
- zRangeOp = "=";
146767
+ cRangeOp = '=';
146579146768
}else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){
146580
- zRangeOp = ">? AND rowid<";
146769
+ sqlite3_str_appendf(&str, ">? AND %s", zRowid);
146770
+ cRangeOp = '<';
146581146771
}else if( flags&WHERE_BTM_LIMIT ){
146582
- zRangeOp = ">";
146772
+ cRangeOp = '>';
146583146773
}else{
146584146774
assert( flags&WHERE_TOP_LIMIT);
146585
- zRangeOp = "<";
146775
+ cRangeOp = '<';
146586146776
}
146587
- sqlite3_str_appendf(&str,
146588
- " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
146777
+ sqlite3_str_appendf(&str, "%c?)", cRangeOp);
146589146778
}
146590146779
#ifndef SQLITE_OMIT_VIRTUALTABLE
146591146780
else if( (flags & WHERE_VIRTUALTABLE)!=0 ){
146592146781
sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s",
146593146782
pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
@@ -146606,10 +146795,60 @@
146606146795
ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
146607146796
pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
146608146797
}
146609146798
return ret;
146610146799
}
146800
+
146801
+/*
146802
+** Add a single OP_Explain opcode that describes a Bloom filter.
146803
+**
146804
+** Or if not processing EXPLAIN QUERY PLAN and not in a SQLITE_DEBUG and/or
146805
+** SQLITE_ENABLE_STMT_SCANSTATUS build, then OP_Explain opcodes are not
146806
+** required and this routine is a no-op.
146807
+**
146808
+** If an OP_Explain opcode is added to the VM, its address is returned.
146809
+** Otherwise, if no OP_Explain is coded, zero is returned.
146810
+*/
146811
+SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter(
146812
+ const Parse *pParse, /* Parse context */
146813
+ const WhereInfo *pWInfo, /* WHERE clause */
146814
+ const WhereLevel *pLevel /* Bloom filter on this level */
146815
+){
146816
+ int ret = 0;
146817
+ SrcItem *pItem = &pWInfo->pTabList->a[pLevel->iFrom];
146818
+ Vdbe *v = pParse->pVdbe; /* VM being constructed */
146819
+ sqlite3 *db = pParse->db; /* Database handle */
146820
+ char *zMsg; /* Text to add to EQP output */
146821
+ int i; /* Loop counter */
146822
+ WhereLoop *pLoop; /* The where loop */
146823
+ StrAccum str; /* EQP output string */
146824
+ char zBuf[100]; /* Initial space for EQP output string */
146825
+
146826
+ sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);
146827
+ str.printfFlags = SQLITE_PRINTF_INTERNAL;
146828
+ sqlite3_str_appendf(&str, "BLOOM FILTER ON %S (", pItem);
146829
+ pLoop = pLevel->pWLoop;
146830
+ if( pLoop->wsFlags & WHERE_IPK ){
146831
+ const Table *pTab = pItem->pTab;
146832
+ if( pTab->iPKey>=0 ){
146833
+ sqlite3_str_appendf(&str, "%s=?", pTab->aCol[pTab->iPKey].zCnName);
146834
+ }else{
146835
+ sqlite3_str_appendf(&str, "rowid=?");
146836
+ }
146837
+ }else{
146838
+ for(i=pLoop->nSkip; i<pLoop->u.btree.nEq; i++){
146839
+ const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i);
146840
+ if( i>pLoop->nSkip ) sqlite3_str_append(&str, " AND ", 5);
146841
+ sqlite3_str_appendf(&str, "%s=?", z);
146842
+ }
146843
+ }
146844
+ sqlite3_str_append(&str, ")", 1);
146845
+ zMsg = sqlite3StrAccumFinish(&str);
146846
+ ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
146847
+ pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
146848
+ return ret;
146849
+}
146611146850
#endif /* SQLITE_OMIT_EXPLAIN */
146612146851
146613146852
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146614146853
/*
146615146854
** Configure the VM passed as the first argument with an
@@ -147365,11 +147604,11 @@
147365147604
sHint.pIdx = pLoop->u.btree.pIndex;
147366147605
memset(&sWalker, 0, sizeof(sWalker));
147367147606
sWalker.pParse = pParse;
147368147607
sWalker.u.pCCurHint = &sHint;
147369147608
pWC = &pWInfo->sWC;
147370
- for(i=0; i<pWC->nTerm; i++){
147609
+ for(i=0; i<pWC->nBase; i++){
147371147610
pTerm = &pWC->a[i];
147372147611
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
147373147612
if( pTerm->prereqAll & pLevel->notReady ) continue;
147374147613
147375147614
/* Any terms specified as part of the ON(...) clause for any LEFT
@@ -147695,10 +147934,67 @@
147695147934
if( sqlite3ExprCompare(0, pExpr, pTruth, iTabCur)==0 ){
147696147935
pTerm->wtFlags |= TERM_CODED;
147697147936
}
147698147937
}
147699147938
}
147939
+
147940
+/*
147941
+** This routine is called right after An OP_Filter has been generated and
147942
+** before the corresponding index search has been performed. This routine
147943
+** checks to see if there are additional Bloom filters in inner loops that
147944
+** can be checked prior to doing the index lookup. If there are available
147945
+** inner-loop Bloom filters, then evaluate those filters now, before the
147946
+** index lookup. The idea is that a Bloom filter check is way faster than
147947
+** an index lookup, and the Bloom filter might return false, meaning that
147948
+** the index lookup can be skipped.
147949
+**
147950
+** We know that an inner loop uses a Bloom filter because it has the
147951
+** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked,
147952
+** then clear the WhereLevel.regFilter value to prevent the Bloom filter
147953
+** from being checked a second time when the inner loop is evaluated.
147954
+*/
147955
+static SQLITE_NOINLINE void filterPullDown(
147956
+ Parse *pParse, /* Parsing context */
147957
+ WhereInfo *pWInfo, /* Complete information about the WHERE clause */
147958
+ int iLevel, /* Which level of pWInfo->a[] should be coded */
147959
+ int addrNxt, /* Jump here to bypass inner loops */
147960
+ Bitmask notReady /* Loops that are not ready */
147961
+){
147962
+ while( ++iLevel < pWInfo->nLevel ){
147963
+ WhereLevel *pLevel = &pWInfo->a[iLevel];
147964
+ WhereLoop *pLoop = pLevel->pWLoop;
147965
+ if( pLevel->regFilter==0 ) continue;
147966
+ /* ,--- Because constructBloomFilter() has will not have set
147967
+ ** vvvvv--' pLevel->regFilter if this were true. */
147968
+ if( NEVER(pLoop->prereq & notReady) ) continue;
147969
+ if( pLoop->wsFlags & WHERE_IPK ){
147970
+ WhereTerm *pTerm = pLoop->aLTerm[0];
147971
+ int regRowid;
147972
+ assert( pTerm!=0 );
147973
+ assert( pTerm->pExpr!=0 );
147974
+ testcase( pTerm->wtFlags & TERM_VIRTUAL );
147975
+ regRowid = sqlite3GetTempReg(pParse);
147976
+ regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid);
147977
+ sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147978
+ addrNxt, regRowid, 1);
147979
+ VdbeCoverage(pParse->pVdbe);
147980
+ }else{
147981
+ u16 nEq = pLoop->u.btree.nEq;
147982
+ int r1;
147983
+ char *zStartAff;
147984
+
147985
+ assert( pLoop->wsFlags & WHERE_INDEXED );
147986
+ r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff);
147987
+ codeApplyAffinity(pParse, r1, nEq, zStartAff);
147988
+ sqlite3DbFree(pParse->db, zStartAff);
147989
+ sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147990
+ addrNxt, r1, nEq);
147991
+ VdbeCoverage(pParse->pVdbe);
147992
+ }
147993
+ pLevel->regFilter = 0;
147994
+ }
147995
+}
147700147996
147701147997
/*
147702147998
** Generate code for the start of the iLevel-th loop in the WHERE clause
147703147999
** implementation described by pWInfo.
147704148000
*/
@@ -147906,10 +148202,16 @@
147906148202
testcase( pTerm->wtFlags & TERM_VIRTUAL );
147907148203
iReleaseReg = ++pParse->nMem;
147908148204
iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
147909148205
if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
147910148206
addrNxt = pLevel->addrNxt;
148207
+ if( pLevel->regFilter ){
148208
+ sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
148209
+ iRowidReg, 1);
148210
+ VdbeCoverage(v);
148211
+ filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady);
148212
+ }
147911148213
sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
147912148214
VdbeCoverage(v);
147913148215
pLevel->op = OP_Noop;
147914148216
}else if( (pLoop->wsFlags & WHERE_IPK)!=0
147915148217
&& (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
@@ -148231,10 +148533,16 @@
148231148533
}else{
148232148534
if( regBignull ){
148233148535
sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
148234148536
VdbeComment((v, "NULL-scan pass ctr"));
148235148537
}
148538
+ if( pLevel->regFilter ){
148539
+ sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
148540
+ regBase, nEq);
148541
+ VdbeCoverage(v);
148542
+ filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady);
148543
+ }
148236148544
148237148545
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
148238148546
assert( op!=0 );
148239148547
if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 && op==OP_SeekGE ){
148240148548
assert( regBignull==0 );
@@ -148862,11 +149170,11 @@
148862149170
** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
148863149171
** and we are coding the t1 loop and the t2 loop has not yet coded,
148864149172
** then we cannot use the "t1.a=t2.b" constraint, but we can code
148865149173
** the implied "t1.a=123" constraint.
148866149174
*/
148867
- for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
149175
+ for(pTerm=pWC->a, j=pWC->nBase; j>0; j--, pTerm++){
148868149176
Expr *pE, sEAlt;
148869149177
WhereTerm *pAlt;
148870149178
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
148871149179
if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
148872149180
if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
@@ -148907,11 +149215,11 @@
148907149215
*/
148908149216
if( pLevel->iLeftJoin ){
148909149217
pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
148910149218
sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
148911149219
VdbeComment((v, "record LEFT JOIN hit"));
148912
- for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
149220
+ for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){
148913149221
testcase( pTerm->wtFlags & TERM_VIRTUAL );
148914149222
testcase( pTerm->wtFlags & TERM_CODED );
148915149223
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
148916149224
if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
148917149225
assert( pWInfo->untestedTerms );
@@ -149018,10 +149326,11 @@
149018149326
sqlite3DbFree(db, pOld);
149019149327
}
149020149328
pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
149021149329
}
149022149330
pTerm = &pWC->a[idx = pWC->nTerm++];
149331
+ if( (wtFlags & TERM_VIRTUAL)==0 ) pWC->nBase = pWC->nTerm;
149023149332
if( p && ExprHasProperty(p, EP_Unlikely) ){
149024149333
pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
149025149334
}else{
149026149335
pTerm->truthProb = 1;
149027149336
}
@@ -150009,14 +150318,17 @@
150009150318
int nLeft; /* Number of elements on left side vector */
150010150319
150011150320
if( db->mallocFailed ){
150012150321
return;
150013150322
}
150323
+ assert( pWC->nTerm > idxTerm );
150014150324
pTerm = &pWC->a[idxTerm];
150015150325
pMaskSet = &pWInfo->sMaskSet;
150016150326
pExpr = pTerm->pExpr;
150327
+ assert( pExpr!=0 ); /* Because malloc() has not failed */
150017150328
assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );
150329
+ pMaskSet->bVarSelect = 0;
150018150330
prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft);
150019150331
op = pExpr->op;
150020150332
if( op==TK_IN ){
150021150333
assert( pExpr->pRight==0 );
150022150334
if( sqlite3ExprCheckIN(pParse, pExpr) ) return;
@@ -150023,18 +150335,32 @@
150023150335
if( ExprUseXSelect(pExpr) ){
150024150336
pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect);
150025150337
}else{
150026150338
pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList);
150027150339
}
150028
- }else if( op==TK_ISNULL ){
150029
- pTerm->prereqRight = 0;
150340
+ prereqAll = prereqLeft | pTerm->prereqRight;
150030150341
}else{
150031150342
pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
150343
+ if( pExpr->pLeft==0
150344
+ || ExprHasProperty(pExpr, EP_xIsSelect|EP_IfNullRow)
150345
+ || pExpr->x.pList!=0
150346
+ ){
150347
+ prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr);
150348
+ }else{
150349
+ prereqAll = prereqLeft | pTerm->prereqRight;
150350
+ }
150032150351
}
150033
- pMaskSet->bVarSelect = 0;
150034
- prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr);
150035150352
if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
150353
+
150354
+#ifdef SQLITE_DEBUG
150355
+ if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){
150356
+ printf("\n*** Incorrect prereqAll computed for:\n");
150357
+ sqlite3TreeViewExpr(0,pExpr,0);
150358
+ abort();
150359
+ }
150360
+#endif
150361
+
150036150362
if( ExprHasProperty(pExpr, EP_FromJoin) ){
150037150363
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
150038150364
prereqAll |= x;
150039150365
extraRight = x-1; /* ON clause terms may not be used with an index
150040150366
** on left table of a LEFT JOIN. Ticket #3015 */
@@ -150454,10 +150780,11 @@
150454150780
){
150455150781
pWC->pWInfo = pWInfo;
150456150782
pWC->hasOr = 0;
150457150783
pWC->pOuter = 0;
150458150784
pWC->nTerm = 0;
150785
+ pWC->nBase = 0;
150459150786
pWC->nSlot = ArraySize(pWC->aStatic);
150460150787
pWC->a = pWC->aStatic;
150461150788
}
150462150789
150463150790
/*
@@ -150464,21 +150791,37 @@
150464150791
** Deallocate a WhereClause structure. The WhereClause structure
150465150792
** itself is not freed. This routine is the inverse of
150466150793
** sqlite3WhereClauseInit().
150467150794
*/
150468150795
SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){
150469
- int i;
150470
- WhereTerm *a;
150471150796
sqlite3 *db = pWC->pWInfo->pParse->db;
150472
- for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){
150473
- if( a->wtFlags & TERM_DYNAMIC ){
150474
- sqlite3ExprDelete(db, a->pExpr);
150475
- }
150476
- if( a->wtFlags & TERM_ORINFO ){
150477
- whereOrInfoDelete(db, a->u.pOrInfo);
150478
- }else if( a->wtFlags & TERM_ANDINFO ){
150479
- whereAndInfoDelete(db, a->u.pAndInfo);
150797
+ assert( pWC->nTerm>=pWC->nBase );
150798
+ if( pWC->nTerm>0 ){
150799
+ WhereTerm *a = pWC->a;
150800
+ WhereTerm *aLast = &pWC->a[pWC->nTerm-1];
150801
+#ifdef SQLITE_DEBUG
150802
+ int i;
150803
+ /* Verify that every term past pWC->nBase is virtual */
150804
+ for(i=pWC->nBase; i<pWC->nTerm; i++){
150805
+ assert( (pWC->a[i].wtFlags & TERM_VIRTUAL)!=0 );
150806
+ }
150807
+#endif
150808
+ while(1){
150809
+ if( a->wtFlags & TERM_DYNAMIC ){
150810
+ sqlite3ExprDelete(db, a->pExpr);
150811
+ }
150812
+ if( a->wtFlags & (TERM_ORINFO|TERM_ANDINFO) ){
150813
+ if( a->wtFlags & TERM_ORINFO ){
150814
+ assert( (a->wtFlags & TERM_ANDINFO)==0 );
150815
+ whereOrInfoDelete(db, a->u.pOrInfo);
150816
+ }else{
150817
+ assert( (a->wtFlags & TERM_ANDINFO)!=0 );
150818
+ whereAndInfoDelete(db, a->u.pAndInfo);
150819
+ }
150820
+ }
150821
+ if( a==aLast ) break;
150822
+ a++;
150480150823
}
150481150824
}
150482150825
if( pWC->a!=pWC->aStatic ){
150483150826
sqlite3DbFree(db, pWC->a);
150484150827
}
@@ -150487,19 +150830,42 @@
150487150830
150488150831
/*
150489150832
** These routines walk (recursively) an expression tree and generate
150490150833
** a bitmask indicating which tables are used in that expression
150491150834
** tree.
150835
+**
150836
+** sqlite3WhereExprUsage(MaskSet, Expr) ->
150837
+**
150838
+** Return a Bitmask of all tables referenced by Expr. Expr can be
150839
+** be NULL, in which case 0 is returned.
150840
+**
150841
+** sqlite3WhereExprUsageNN(MaskSet, Expr) ->
150842
+**
150843
+** Same as sqlite3WhereExprUsage() except that Expr must not be
150844
+** NULL. The "NN" suffix on the name stands for "Not Null".
150845
+**
150846
+** sqlite3WhereExprListUsage(MaskSet, ExprList) ->
150847
+**
150848
+** Return a Bitmask of all tables referenced by every expression
150849
+** in the expression list ExprList. ExprList can be NULL, in which
150850
+** case 0 is returned.
150851
+**
150852
+** sqlite3WhereExprUsageFull(MaskSet, ExprList) ->
150853
+**
150854
+** Internal use only. Called only by sqlite3WhereExprUsageNN() for
150855
+** complex expressions that require pushing register values onto
150856
+** the stack. Many calls to sqlite3WhereExprUsageNN() do not need
150857
+** the more complex analysis done by this routine. Hence, the
150858
+** computations done by this routine are broken out into a separate
150859
+** "no-inline" function to avoid the stack push overhead in the
150860
+** common case where it is not needed.
150492150861
*/
150493
-SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
150862
+static SQLITE_NOINLINE Bitmask sqlite3WhereExprUsageFull(
150863
+ WhereMaskSet *pMaskSet,
150864
+ Expr *p
150865
+){
150494150866
Bitmask mask;
150495
- if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
150496
- return sqlite3WhereGetMask(pMaskSet, p->iTable);
150497
- }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
150498
- assert( p->op!=TK_IF_NULL_ROW );
150499
- return 0;
150500
- }
150501150867
mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
150502150868
if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft);
150503150869
if( p->pRight ){
150504150870
mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pRight);
150505150871
assert( p->x.pList==0 );
@@ -150516,10 +150882,19 @@
150516150882
mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy);
150517150883
mask |= sqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter);
150518150884
}
150519150885
#endif
150520150886
return mask;
150887
+}
150888
+SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
150889
+ if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
150890
+ return sqlite3WhereGetMask(pMaskSet, p->iTable);
150891
+ }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
150892
+ assert( p->op!=TK_IF_NULL_ROW );
150893
+ return 0;
150894
+ }
150895
+ return sqlite3WhereExprUsageFull(pMaskSet, p);
150521150896
}
150522150897
SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){
150523150898
return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0;
150524150899
}
150525150900
SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){
@@ -150834,11 +151209,16 @@
150834151209
** iCursor is not in the set.
150835151210
*/
150836151211
SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){
150837151212
int i;
150838151213
assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );
150839
- for(i=0; i<pMaskSet->n; i++){
151214
+ assert( pMaskSet->n>0 || pMaskSet->ix[0]<0 );
151215
+ assert( iCursor>=-1 );
151216
+ if( pMaskSet->ix[0]==iCursor ){
151217
+ return 1;
151218
+ }
151219
+ for(i=1; i<pMaskSet->n; i++){
150840151220
if( pMaskSet->ix[i]==iCursor ){
150841151221
return MASKBIT(i);
150842151222
}
150843151223
}
150844151224
return 0;
@@ -151019,20 +151399,20 @@
151019151399
pScan->nEquiv = 1;
151020151400
pScan->iEquiv = 1;
151021151401
if( pIdx ){
151022151402
int j = iColumn;
151023151403
iColumn = pIdx->aiColumn[j];
151024
- if( iColumn==XN_EXPR ){
151404
+ if( iColumn==pIdx->pTable->iPKey ){
151405
+ iColumn = XN_ROWID;
151406
+ }else if( iColumn>=0 ){
151407
+ pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
151408
+ pScan->zCollName = pIdx->azColl[j];
151409
+ }else if( iColumn==XN_EXPR ){
151025151410
pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
151026151411
pScan->zCollName = pIdx->azColl[j];
151027151412
pScan->aiColumn[0] = XN_EXPR;
151028151413
return whereScanInitIndexExpr(pScan);
151029
- }else if( iColumn==pIdx->pTable->iPKey ){
151030
- iColumn = XN_ROWID;
151031
- }else if( iColumn>=0 ){
151032
- pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
151033
- pScan->zCollName = pIdx->azColl[j];
151034151414
}
151035151415
}else if( iColumn==XN_EXPR ){
151036151416
return 0;
151037151417
}
151038151418
pScan->aiColumn[0] = iColumn;
@@ -151312,13 +151692,13 @@
151312151692
** Return TRUE if the WHERE clause term pTerm is of a form where it
151313151693
** could be used with an index to access pSrc, assuming an appropriate
151314151694
** index existed.
151315151695
*/
151316151696
static int termCanDriveIndex(
151317
- WhereTerm *pTerm, /* WHERE clause term to check */
151318
- SrcItem *pSrc, /* Table we are trying to access */
151319
- Bitmask notReady /* Tables in outer loops of the join */
151697
+ const WhereTerm *pTerm, /* WHERE clause term to check */
151698
+ const SrcItem *pSrc, /* Table we are trying to access */
151699
+ const Bitmask notReady /* Tables in outer loops of the join */
151320151700
){
151321151701
char aff;
151322151702
if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
151323151703
if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
151324151704
if( (pSrc->fg.jointype & JT_LEFT)
@@ -151345,15 +151725,15 @@
151345151725
/*
151346151726
** Generate code to construct the Index object for an automatic index
151347151727
** and to set up the WhereLevel object pLevel so that the code generator
151348151728
** makes use of the automatic index.
151349151729
*/
151350
-static void constructAutomaticIndex(
151730
+static SQLITE_NOINLINE void constructAutomaticIndex(
151351151731
Parse *pParse, /* The parsing context */
151352
- WhereClause *pWC, /* The WHERE clause */
151353
- SrcItem *pSrc, /* The FROM clause term to get the next index */
151354
- Bitmask notReady, /* Mask of cursors that are not available */
151732
+ const WhereClause *pWC, /* The WHERE clause */
151733
+ const SrcItem *pSrc, /* The FROM clause term to get the next index */
151734
+ const Bitmask notReady, /* Mask of cursors that are not available */
151355151735
WhereLevel *pLevel /* Write new index here */
151356151736
){
151357151737
int nKeyCol; /* Number of columns in the constructed index */
151358151738
WhereTerm *pTerm; /* A single term of the WHERE clause */
151359151739
WhereTerm *pWCEnd; /* End of pWC->a[] */
@@ -151391,17 +151771,17 @@
151391151771
pWCEnd = &pWC->a[pWC->nTerm];
151392151772
pLoop = pLevel->pWLoop;
151393151773
idxCols = 0;
151394151774
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
151395151775
Expr *pExpr = pTerm->pExpr;
151396
- assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
151397
- || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
151398
- || pLoop->prereq!=0 ); /* table of a LEFT JOIN */
151399
- if( pLoop->prereq==0
151400
- && (pTerm->wtFlags & TERM_VIRTUAL)==0
151401
- && !ExprHasProperty(pExpr, EP_FromJoin)
151402
- && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
151776
+ /* Make the automatic index a partial index if there are terms in the
151777
+ ** WHERE clause (or the ON clause of a LEFT join) that constrain which
151778
+ ** rows of the target table (pSrc) that can be used. */
151779
+ if( (pTerm->wtFlags & TERM_VIRTUAL)==0
151780
+ && ((pSrc->fg.jointype&JT_LEFT)==0 || ExprHasProperty(pExpr,EP_FromJoin))
151781
+ && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor)
151782
+ ){
151403151783
pPartial = sqlite3ExprAnd(pParse, pPartial,
151404151784
sqlite3ExprDup(pParse->db, pExpr, 0));
151405151785
}
151406151786
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
151407151787
int iCol;
@@ -151504,10 +151884,14 @@
151504151884
assert( pLevel->iIdxCur>=0 );
151505151885
pLevel->iIdxCur = pParse->nTab++;
151506151886
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
151507151887
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
151508151888
VdbeComment((v, "for %s", pTable->zName));
151889
+ if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
151890
+ pLevel->regFilter = ++pParse->nMem;
151891
+ sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
151892
+ }
151509151893
151510151894
/* Fill the automatic index with content */
151511151895
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
151512151896
if( pTabItem->fg.viaCoroutine ){
151513151897
int regYield = pTabItem->regReturn;
@@ -151526,10 +151910,14 @@
151526151910
}
151527151911
regRecord = sqlite3GetTempReg(pParse);
151528151912
regBase = sqlite3GenerateIndexKey(
151529151913
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
151530151914
);
151915
+ if( pLevel->regFilter ){
151916
+ sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0,
151917
+ regBase, pLoop->u.btree.nEq);
151918
+ }
151531151919
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
151532151920
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
151533151921
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
151534151922
if( pTabItem->fg.viaCoroutine ){
151535151923
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
@@ -151551,10 +151939,127 @@
151551151939
151552151940
end_auto_index_create:
151553151941
sqlite3ExprDelete(pParse->db, pPartial);
151554151942
}
151555151943
#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
151944
+
151945
+/*
151946
+** Generate bytecode that will initialize a Bloom filter that is appropriate
151947
+** for pLevel.
151948
+**
151949
+** If there are inner loops within pLevel that have the WHERE_BLOOMFILTER
151950
+** flag set, initialize a Bloomfilter for them as well. Except don't do
151951
+** this recursive initialization if the SQLITE_BloomPulldown optimization has
151952
+** been turned off.
151953
+**
151954
+** When the Bloom filter is initialized, the WHERE_BLOOMFILTER flag is cleared
151955
+** from the loop, but the regFilter value is set to a register that implements
151956
+** the Bloom filter. When regFilter is positive, the
151957
+** sqlite3WhereCodeOneLoopStart() will generate code to test the Bloom filter
151958
+** and skip the subsequence B-Tree seek if the Bloom filter indicates that
151959
+** no matching rows exist.
151960
+**
151961
+** This routine may only be called if it has previously been determined that
151962
+** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
151963
+** is set.
151964
+*/
151965
+static SQLITE_NOINLINE void constructBloomFilter(
151966
+ WhereInfo *pWInfo, /* The WHERE clause */
151967
+ int iLevel, /* Index in pWInfo->a[] that is pLevel */
151968
+ WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */
151969
+ Bitmask notReady /* Loops that are not ready */
151970
+){
151971
+ int addrOnce; /* Address of opening OP_Once */
151972
+ int addrTop; /* Address of OP_Rewind */
151973
+ int addrCont; /* Jump here to skip a row */
151974
+ const WhereTerm *pTerm; /* For looping over WHERE clause terms */
151975
+ const WhereTerm *pWCEnd; /* Last WHERE clause term */
151976
+ Parse *pParse = pWInfo->pParse; /* Parsing context */
151977
+ Vdbe *v = pParse->pVdbe; /* VDBE under construction */
151978
+ WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
151979
+ int iCur; /* Cursor for table getting the filter */
151980
+
151981
+ assert( pLoop!=0 );
151982
+ assert( v!=0 );
151983
+ assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
151984
+
151985
+ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
151986
+ do{
151987
+ const SrcItem *pItem;
151988
+ const Table *pTab;
151989
+ u64 sz;
151990
+ sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel);
151991
+ addrCont = sqlite3VdbeMakeLabel(pParse);
151992
+ iCur = pLevel->iTabCur;
151993
+ pLevel->regFilter = ++pParse->nMem;
151994
+
151995
+ /* The Bloom filter is a Blob held in a register. Initialize it
151996
+ ** to zero-filled blob of at least 80K bits, but maybe more if the
151997
+ ** estimated size of the table is larger. We could actually
151998
+ ** measure the size of the table at run-time using OP_Count with
151999
+ ** P3==1 and use that value to initialize the blob. But that makes
152000
+ ** testing complicated. By basing the blob size on the value in the
152001
+ ** sqlite_stat1 table, testing is much easier.
152002
+ */
152003
+ pItem = &pWInfo->pTabList->a[pLevel->iFrom];
152004
+ assert( pItem!=0 );
152005
+ pTab = pItem->pTab;
152006
+ assert( pTab!=0 );
152007
+ sz = sqlite3LogEstToInt(pTab->nRowLogEst);
152008
+ if( sz<10000 ){
152009
+ sz = 10000;
152010
+ }else if( sz>10000000 ){
152011
+ sz = 10000000;
152012
+ }
152013
+ sqlite3VdbeAddOp2(v, OP_Blob, (int)sz, pLevel->regFilter);
152014
+
152015
+ addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
152016
+ pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
152017
+ for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
152018
+ Expr *pExpr = pTerm->pExpr;
152019
+ if( (pTerm->wtFlags & TERM_VIRTUAL)==0
152020
+ && sqlite3ExprIsTableConstant(pExpr, iCur)
152021
+ ){
152022
+ sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
152023
+ }
152024
+ }
152025
+ if( pLoop->wsFlags & WHERE_IPK ){
152026
+ int r1 = sqlite3GetTempReg(pParse);
152027
+ sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1);
152028
+ sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, 1);
152029
+ sqlite3ReleaseTempReg(pParse, r1);
152030
+ }else{
152031
+ Index *pIdx = pLoop->u.btree.pIndex;
152032
+ int n = pLoop->u.btree.nEq;
152033
+ int r1 = sqlite3GetTempRange(pParse, n);
152034
+ int jj;
152035
+ for(jj=0; jj<n; jj++){
152036
+ int iCol = pIdx->aiColumn[jj];
152037
+ assert( pIdx->pTable==pItem->pTab );
152038
+ sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
152039
+ }
152040
+ sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
152041
+ sqlite3ReleaseTempRange(pParse, r1, n);
152042
+ }
152043
+ sqlite3VdbeResolveLabel(v, addrCont);
152044
+ sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
152045
+ VdbeCoverage(v);
152046
+ sqlite3VdbeJumpHere(v, addrTop);
152047
+ pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
152048
+ if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
152049
+ while( iLevel < pWInfo->nLevel ){
152050
+ iLevel++;
152051
+ pLevel = &pWInfo->a[iLevel];
152052
+ pLoop = pLevel->pWLoop;
152053
+ if( pLoop==0 ) continue;
152054
+ if( pLoop->prereq & notReady ) continue;
152055
+ if( pLoop->wsFlags & WHERE_BLOOMFILTER ) break;
152056
+ }
152057
+ }while( iLevel < pWInfo->nLevel );
152058
+ sqlite3VdbeJumpHere(v, addrOnce);
152059
+}
152060
+
151556152061
151557152062
#ifndef SQLITE_OMIT_VIRTUALTABLE
151558152063
/*
151559152064
** Allocate and populate an sqlite3_index_info structure. It is the
151560152065
** responsibility of the caller to eventually release the structure
@@ -152494,13 +152999,13 @@
152494152999
}
152495153000
sqlite3DebugPrintf(" %-19s", z);
152496153001
sqlite3_free(z);
152497153002
}
152498153003
if( p->wsFlags & WHERE_SKIPSCAN ){
152499
- sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
153004
+ sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
152500153005
}else{
152501
- sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
153006
+ sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm);
152502153007
}
152503153008
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
152504153009
if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
152505153010
int i;
152506153011
for(i=0; i<p->nLTerm; i++){
@@ -152956,22 +153461,29 @@
152956153461
Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
152957153462
int i, j;
152958153463
LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
152959153464
152960153465
assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
152961
- for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
153466
+ for(i=pWC->nBase, pTerm=pWC->a; i>0; i--, pTerm++){
152962153467
assert( pTerm!=0 );
152963
- if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
153468
+ if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
152964153469
if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
152965
- if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
153470
+ if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) continue;
152966153471
for(j=pLoop->nLTerm-1; j>=0; j--){
152967153472
pX = pLoop->aLTerm[j];
152968153473
if( pX==0 ) continue;
152969153474
if( pX==pTerm ) break;
152970153475
if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
152971153476
}
152972153477
if( j<0 ){
153478
+ if( pLoop->maskSelf==pTerm->prereqAll ){
153479
+ /* If there are extra terms in the WHERE clause not used by an index
153480
+ ** that depend only on the table being scanned, and that will tend to
153481
+ ** cause many rows to be omitted, then mark that table as
153482
+ ** "self-culling". */
153483
+ pLoop->wsFlags |= WHERE_SELFCULL;
153484
+ }
152973153485
if( pTerm->truthProb<=0 ){
152974153486
/* If a truth probability is specified using the likelihood() hints,
152975153487
** then use the probability provided by the application. */
152976153488
pLoop->nOut += pTerm->truthProb;
152977153489
}else{
@@ -152995,11 +153507,13 @@
152995153507
}
152996153508
}
152997153509
}
152998153510
}
152999153511
}
153000
- if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
153512
+ if( pLoop->nOut > nRow-iReduce ){
153513
+ pLoop->nOut = nRow - iReduce;
153514
+ }
153001153515
}
153002153516
153003153517
/*
153004153518
** Term pTerm is a vector range comparison operation. The first comparison
153005153519
** in the vector can be optimized using column nEq of the index. This
@@ -154231,10 +154745,11 @@
154231154745
}else if( pOrTerm->leftCursor==iCur ){
154232154746
tempWC.pWInfo = pWC->pWInfo;
154233154747
tempWC.pOuter = pWC;
154234154748
tempWC.op = TK_AND;
154235154749
tempWC.nTerm = 1;
154750
+ tempWC.nBase = 1;
154236154751
tempWC.a = pOrTerm;
154237154752
sSubBuild.pWC = &tempWC;
154238154753
}else{
154239154754
continue;
154240154755
}
@@ -155337,10 +155852,154 @@
155337155852
}
155338155853
# define WHERETRACE_ALL_LOOPS(W,C) showAllWhereLoops(W,C)
155339155854
#else
155340155855
# define WHERETRACE_ALL_LOOPS(W,C)
155341155856
#endif
155857
+
155858
+/* Attempt to omit tables from a join that do not affect the result.
155859
+** For a table to not affect the result, the following must be true:
155860
+**
155861
+** 1) The query must not be an aggregate.
155862
+** 2) The table must be the RHS of a LEFT JOIN.
155863
+** 3) Either the query must be DISTINCT, or else the ON or USING clause
155864
+** must contain a constraint that limits the scan of the table to
155865
+** at most a single row.
155866
+** 4) The table must not be referenced by any part of the query apart
155867
+** from its own USING or ON clause.
155868
+**
155869
+** For example, given:
155870
+**
155871
+** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1);
155872
+** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2);
155873
+** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3);
155874
+**
155875
+** then table t2 can be omitted from the following:
155876
+**
155877
+** SELECT v1, v3 FROM t1
155878
+** LEFT JOIN t2 ON (t1.ipk=t2.ipk)
155879
+** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155880
+**
155881
+** or from:
155882
+**
155883
+** SELECT DISTINCT v1, v3 FROM t1
155884
+** LEFT JOIN t2
155885
+** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155886
+*/
155887
+static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
155888
+ WhereInfo *pWInfo,
155889
+ Bitmask notReady
155890
+){
155891
+ int i;
155892
+ Bitmask tabUsed;
155893
+
155894
+ /* Preconditions checked by the caller */
155895
+ assert( pWInfo->nLevel>=2 );
155896
+ assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_OmitNoopJoin) );
155897
+
155898
+ /* These two preconditions checked by the caller combine to guarantee
155899
+ ** condition (1) of the header comment */
155900
+ assert( pWInfo->pResultSet!=0 );
155901
+ assert( 0==(pWInfo->wctrlFlags & WHERE_AGG_DISTINCT) );
155902
+
155903
+ tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet);
155904
+ if( pWInfo->pOrderBy ){
155905
+ tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy);
155906
+ }
155907
+ for(i=pWInfo->nLevel-1; i>=1; i--){
155908
+ WhereTerm *pTerm, *pEnd;
155909
+ SrcItem *pItem;
155910
+ WhereLoop *pLoop;
155911
+ pLoop = pWInfo->a[i].pWLoop;
155912
+ pItem = &pWInfo->pTabList->a[pLoop->iTab];
155913
+ if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
155914
+ if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0
155915
+ && (pLoop->wsFlags & WHERE_ONEROW)==0
155916
+ ){
155917
+ continue;
155918
+ }
155919
+ if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
155920
+ pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm;
155921
+ for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
155922
+ if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155923
+ if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
155924
+ || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
155925
+ ){
155926
+ break;
155927
+ }
155928
+ }
155929
+ }
155930
+ if( pTerm<pEnd ) continue;
155931
+ WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
155932
+ notReady &= ~pLoop->maskSelf;
155933
+ for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
155934
+ if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155935
+ pTerm->wtFlags |= TERM_CODED;
155936
+ }
155937
+ }
155938
+ if( i!=pWInfo->nLevel-1 ){
155939
+ int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
155940
+ memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
155941
+ }
155942
+ pWInfo->nLevel--;
155943
+ assert( pWInfo->nLevel>0 );
155944
+ }
155945
+ return notReady;
155946
+}
155947
+
155948
+/*
155949
+** Check to see if there are any SEARCH loops that might benefit from
155950
+** using a Bloom filter. Consider a Bloom filter if:
155951
+**
155952
+** (1) The SEARCH happens more than N times where N is the number
155953
+** of rows in the table that is being considered for the Bloom
155954
+** filter.
155955
+** (2) Some searches are expected to find zero rows. (This is determined
155956
+** by the WHERE_SELFCULL flag on the term.)
155957
+** (3) Bloom-filter processing is not disabled. (Checked by the
155958
+** caller.)
155959
+** (4) The size of the table being searched is known by ANALYZE.
155960
+**
155961
+** This block of code merely checks to see if a Bloom filter would be
155962
+** appropriate, and if so sets the WHERE_BLOOMFILTER flag on the
155963
+** WhereLoop. The implementation of the Bloom filter comes further
155964
+** down where the code for each WhereLoop is generated.
155965
+*/
155966
+static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
155967
+ const WhereInfo *pWInfo
155968
+){
155969
+ int i;
155970
+ LogEst nSearch;
155971
+
155972
+ assert( pWInfo->nLevel>=2 );
155973
+ assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
155974
+ nSearch = pWInfo->a[0].pWLoop->nOut;
155975
+ for(i=1; i<pWInfo->nLevel; i++){
155976
+ WhereLoop *pLoop = pWInfo->a[i].pWLoop;
155977
+ const int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
155978
+ if( (pLoop->wsFlags & reqFlags)==reqFlags
155979
+ /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
155980
+ && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
155981
+ ){
155982
+ SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
155983
+ Table *pTab = pItem->pTab;
155984
+ pTab->tabFlags |= TF_StatsUsed;
155985
+ if( nSearch > pTab->nRowLogEst
155986
+ && (pTab->tabFlags & TF_HasStat1)!=0
155987
+ ){
155988
+ testcase( pItem->fg.jointype & JT_LEFT );
155989
+ pLoop->wsFlags |= WHERE_BLOOMFILTER;
155990
+ pLoop->wsFlags &= ~WHERE_IDX_ONLY;
155991
+ WHERETRACE(0xffff, (
155992
+ "-> use Bloom-filter on loop %c because there are ~%.1e "
155993
+ "lookups into %s which has only ~%.1e rows\n",
155994
+ pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName,
155995
+ (double)sqlite3LogEstToInt(pTab->nRowLogEst)));
155996
+ }
155997
+ }
155998
+ nSearch += pLoop->nOut;
155999
+ }
156000
+}
155342156001
155343156002
/*
155344156003
** Generate the beginning of the loop used for WHERE clause processing.
155345156004
** The return value is a pointer to an opaque structure that contains
155346156005
** information needed to terminate the loop. Later, the calling routine
@@ -155468,16 +156127,10 @@
155468156127
/* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
155469156128
testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
155470156129
if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
155471156130
sWLB.pOrderBy = pOrderBy;
155472156131
155473
- /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
155474
- ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
155475
- if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
155476
- wctrlFlags &= ~WHERE_WANT_DISTINCT;
155477
- }
155478
-
155479156132
/* The number of tables in the FROM clause is limited by the number of
155480156133
** bits in a Bitmask
155481156134
*/
155482156135
testcase( pTabList->nSrc==BMS );
155483156136
if( pTabList->nSrc>BMS ){
@@ -155520,10 +156173,14 @@
155520156173
memset(&pWInfo->nOBSat, 0,
155521156174
offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));
155522156175
memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));
155523156176
assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */
155524156177
pMaskSet = &pWInfo->sMaskSet;
156178
+ pMaskSet->n = 0;
156179
+ pMaskSet->ix[0] = -99; /* Initialize ix[0] to a value that can never be
156180
+ ** a valid cursor number, to avoid an initial
156181
+ ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */
155525156182
sWLB.pWInfo = pWInfo;
155526156183
sWLB.pWC = &pWInfo->sWC;
155527156184
sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);
155528156185
assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );
155529156186
whereLoopInit(sWLB.pNew);
@@ -155532,19 +156189,20 @@
155532156189
#endif
155533156190
155534156191
/* Split the WHERE clause into separate subexpressions where each
155535156192
** subexpression is separated by an AND operator.
155536156193
*/
155537
- initMaskSet(pMaskSet);
155538156194
sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
155539156195
sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
155540156196
155541156197
/* Special case: No FROM clause
155542156198
*/
155543156199
if( nTabList==0 ){
155544156200
if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;
155545
- if( wctrlFlags & WHERE_WANT_DISTINCT ){
156201
+ if( (wctrlFlags & WHERE_WANT_DISTINCT)!=0
156202
+ && OptimizationEnabled(db, SQLITE_DistinctOpt)
156203
+ ){
155546156204
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
155547156205
}
155548156206
ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
155549156207
}else{
155550156208
/* Assign a bit from the bitmask to every term in the FROM clause.
@@ -155591,21 +156249,26 @@
155591156249
** preserves SQLite's legacy behaviour in the following two cases:
155592156250
**
155593156251
** FROM ... WHERE random()>0; -- eval random() once per row
155594156252
** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
155595156253
*/
155596
- for(ii=0; ii<sWLB.pWC->nTerm; ii++){
156254
+ for(ii=0; ii<sWLB.pWC->nBase; ii++){
155597156255
WhereTerm *pT = &sWLB.pWC->a[ii];
155598156256
if( pT->wtFlags & TERM_VIRTUAL ) continue;
155599156257
if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
155600156258
sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL);
155601156259
pT->wtFlags |= TERM_CODED;
155602156260
}
155603156261
}
155604156262
155605156263
if( wctrlFlags & WHERE_WANT_DISTINCT ){
155606
- if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
156264
+ if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
156265
+ /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
156266
+ ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
156267
+ wctrlFlags &= ~WHERE_WANT_DISTINCT;
156268
+ pWInfo->wctrlFlags &= ~WHERE_WANT_DISTINCT;
156269
+ }else if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
155607156270
/* The DISTINCT marking is pointless. Ignore it. */
155608156271
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
155609156272
}else if( pOrderBy==0 ){
155610156273
/* Try to ORDER BY the result set to make distinct processing easier */
155611156274
pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
@@ -155702,88 +156365,40 @@
155702156365
sqlite3WhereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC);
155703156366
}
155704156367
}
155705156368
#endif
155706156369
155707
- /* Attempt to omit tables from the join that do not affect the result.
155708
- ** For a table to not affect the result, the following must be true:
155709
- **
155710
- ** 1) The query must not be an aggregate.
155711
- ** 2) The table must be the RHS of a LEFT JOIN.
155712
- ** 3) Either the query must be DISTINCT, or else the ON or USING clause
155713
- ** must contain a constraint that limits the scan of the table to
155714
- ** at most a single row.
155715
- ** 4) The table must not be referenced by any part of the query apart
155716
- ** from its own USING or ON clause.
155717
- **
155718
- ** For example, given:
155719
- **
155720
- ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1);
155721
- ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2);
155722
- ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3);
155723
- **
155724
- ** then table t2 can be omitted from the following:
155725
- **
155726
- ** SELECT v1, v3 FROM t1
155727
- ** LEFT JOIN t2 ON (t1.ipk=t2.ipk)
155728
- ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155729
- **
155730
- ** or from:
155731
- **
155732
- ** SELECT DISTINCT v1, v3 FROM t1
155733
- ** LEFT JOIN t2
155734
- ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
156370
+ /* Attempt to omit tables from a join that do not affect the result.
156371
+ ** See the comment on whereOmitNoopJoin() for further information.
156372
+ **
156373
+ ** This query optimization is factored out into a separate "no-inline"
156374
+ ** procedure to keep the sqlite3WhereBegin() procedure from becoming
156375
+ ** too large. If sqlite3WhereBegin() becomes too large, that prevents
156376
+ ** some C-compiler optimizers from in-lining the
156377
+ ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to
156378
+ ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons.
155735156379
*/
155736156380
notReady = ~(Bitmask)0;
155737156381
if( pWInfo->nLevel>=2
155738156382
&& pResultSet!=0 /* these two combine to guarantee */
155739156383
&& 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */
155740156384
&& OptimizationEnabled(db, SQLITE_OmitNoopJoin)
155741156385
){
155742
- int i;
155743
- Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet);
155744
- if( sWLB.pOrderBy ){
155745
- tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
155746
- }
155747
- for(i=pWInfo->nLevel-1; i>=1; i--){
155748
- WhereTerm *pTerm, *pEnd;
155749
- SrcItem *pItem;
155750
- pLoop = pWInfo->a[i].pWLoop;
155751
- pItem = &pWInfo->pTabList->a[pLoop->iTab];
155752
- if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
155753
- if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
155754
- && (pLoop->wsFlags & WHERE_ONEROW)==0
155755
- ){
155756
- continue;
155757
- }
155758
- if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
155759
- pEnd = sWLB.pWC->a + sWLB.pWC->nTerm;
155760
- for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
155761
- if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155762
- if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
155763
- || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
155764
- ){
155765
- break;
155766
- }
155767
- }
155768
- }
155769
- if( pTerm<pEnd ) continue;
155770
- WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
155771
- notReady &= ~pLoop->maskSelf;
155772
- for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
155773
- if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155774
- pTerm->wtFlags |= TERM_CODED;
155775
- }
155776
- }
155777
- if( i!=pWInfo->nLevel-1 ){
155778
- int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
155779
- memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
155780
- }
155781
- pWInfo->nLevel--;
155782
- nTabList--;
155783
- }
155784
- }
156386
+ notReady = whereOmitNoopJoin(pWInfo, notReady);
156387
+ nTabList = pWInfo->nLevel;
156388
+ assert( nTabList>0 );
156389
+ }
156390
+
156391
+ /* Check to see if there are any SEARCH loops that might benefit from
156392
+ ** using a Bloom filter.
156393
+ */
156394
+ if( pWInfo->nLevel>=2
156395
+ && OptimizationEnabled(db, SQLITE_BloomFilter)
156396
+ ){
156397
+ whereCheckIfBloomFilterIsUseful(pWInfo);
156398
+ }
156399
+
155785156400
#if defined(WHERETRACE_ENABLED)
155786156401
if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
155787156402
sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n");
155788156403
sqlite3WhereClausePrint(sWLB.pWC);
155789156404
}
@@ -155968,17 +156583,21 @@
155968156583
int addrExplain;
155969156584
int wsFlags;
155970156585
if( pParse->nErr ) goto whereBeginError;
155971156586
pLevel = &pWInfo->a[ii];
155972156587
wsFlags = pLevel->pWLoop->wsFlags;
156588
+ if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){
156589
+ if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){
155973156590
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
155974
- if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
155975
- constructAutomaticIndex(pParse, &pWInfo->sWC,
155976
- &pTabList->a[pLevel->iFrom], notReady, pLevel);
156591
+ constructAutomaticIndex(pParse, &pWInfo->sWC,
156592
+ &pTabList->a[pLevel->iFrom], notReady, pLevel);
156593
+#endif
156594
+ }else{
156595
+ constructBloomFilter(pWInfo, ii, pLevel, notReady);
156596
+ }
155977156597
if( db->mallocFailed ) goto whereBeginError;
155978156598
}
155979
-#endif
155980156599
addrExplain = sqlite3WhereExplainOneScan(
155981156600
pParse, pTabList, pLevel, wctrlFlags
155982156601
);
155983156602
pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
155984156603
notReady = sqlite3WhereCodeOneLoopStart(pParse,v,pWInfo,ii,pLevel,notReady);
@@ -159701,14 +160320,14 @@
159701160320
#define TK_DETACH 40
159702160321
#define TK_EACH 41
159703160322
#define TK_FAIL 42
159704160323
#define TK_OR 43
159705160324
#define TK_AND 44
159706
-#define TK_IS 45
159707
-#define TK_MATCH 46
159708
-#define TK_LIKE_KW 47
159709
-#define TK_BETWEEN 48
160325
+#define TK_MATCH 45
160326
+#define TK_LIKE_KW 46
160327
+#define TK_BETWEEN 47
160328
+#define TK_IS 48
159710160329
#define TK_IN 49
159711160330
#define TK_ISNULL 50
159712160331
#define TK_NOTNULL 51
159713160332
#define TK_NE 52
159714160333
#define TK_EQ 53
@@ -160016,216 +160635,215 @@
160016160635
** yy_reduce_ofst[] For each state, the offset into yy_action for
160017160636
** shifting non-terminals after a reduce.
160018160637
** yy_default[] Default action for each state.
160019160638
**
160020160639
*********** Begin parsing tables **********************************************/
160021
-#define YY_ACTTAB_COUNT (2037)
160640
+#define YY_ACTTAB_COUNT (2022)
160022160641
static const YYACTIONTYPE yy_action[] = {
160023160642
/* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564,
160024160643
/* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407,
160025160644
/* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558,
160026160645
/* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966,
160027
- /* 40 */ 296, 1269, 296, 122, 123, 113, 1207, 1207, 1041, 1044,
160646
+ /* 40 */ 296, 1269, 296, 122, 123, 1207, 1207, 1041, 113, 1044,
160028160647
/* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407,
160029160648
/* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112,
160030160649
/* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250,
160031
- /* 80 */ 217, 71, 71, 122, 123, 113, 1207, 1207, 1041, 1044,
160650
+ /* 80 */ 217, 71, 71, 122, 123, 1207, 1207, 1041, 113, 1044,
160032160651
/* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440,
160033160652
/* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117,
160034160653
/* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513,
160035
- /* 120 */ 1548, 1554, 374, 442, 6, 1183, 1154, 522, 1154, 407,
160654
+ /* 120 */ 1548, 1554, 374, 213, 6, 169, 1154, 522, 1154, 407,
160036160655
/* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121,
160037160656
/* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
160038
- /* 150 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044,
160657
+ /* 150 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160039160658
/* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183,
160040160659
/* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124,
160041
- /* 180 */ 567, 1183, 1184, 1185, 474, 497, 119, 119, 119, 119,
160660
+ /* 180 */ 567, 1128, 1627, 344, 1627, 497, 119, 119, 119, 119,
160042160661
/* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407,
160043160662
/* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442,
160044
- /* 210 */ 1409, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160045
- /* 220 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044,
160046
- /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 1031,
160047
- /* 240 */ 1031, 1042, 1045, 81, 382, 541, 378, 80, 119, 119,
160663
+ /* 210 */ 474, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160664
+ /* 220 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160665
+ /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 208,
160666
+ /* 240 */ 539, 1548, 1424, 81, 339, 6, 342, 80, 119, 119,
160048160667
/* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381,
160049
- /* 260 */ 463, 332, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160050
- /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 215, 512,
160051
- /* 280 */ 1424, 422, 119, 119, 119, 119, 118, 118, 117, 117,
160668
+ /* 260 */ 1126, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160669
+ /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 463, 332,
160670
+ /* 280 */ 359, 1567, 119, 119, 119, 119, 118, 118, 117, 117,
160052160671
/* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573,
160053
- /* 300 */ 571, 2, 1235, 307, 1149, 141, 1600, 307, 407, 141,
160054
- /* 310 */ 1183, 361, 1317, 1035, 866, 531, 1317, 1149, 359, 1567,
160672
+ /* 300 */ 571, 2, 1235, 307, 1149, 141, 417, 307, 407, 141,
160673
+ /* 310 */ 1183, 98, 1317, 489, 866, 531, 1317, 1149, 215, 512,
160055160674
/* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160056
- /* 330 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160675
+ /* 330 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160057160676
/* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001,
160058
- /* 350 */ 426, 275, 275, 1128, 1627, 1021, 1627, 137, 542, 1541,
160059
- /* 360 */ 561, 272, 950, 950, 561, 1423, 1183, 1184, 1185, 1594,
160060
- /* 370 */ 866, 1012, 530, 315, 231, 1011, 468, 1276, 231, 119,
160677
+ /* 350 */ 1257, 275, 275, 1128, 1628, 1021, 1628, 137, 415, 1600,
160678
+ /* 360 */ 561, 272, 1255, 950, 561, 1423, 1183, 1184, 1185, 1594,
160679
+ /* 370 */ 866, 1012, 530, 315, 231, 1011, 317, 1276, 231, 119,
160061160680
/* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160062160681
/* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160063160682
/* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013,
160064
- /* 410 */ 446, 207, 564, 306, 555, 407, 363, 1021, 363, 346,
160683
+ /* 410 */ 446, 877, 564, 306, 555, 407, 447, 1021, 563, 346,
160065160684
/* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71,
160066160685
/* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122,
160067
- /* 440 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160068
- /* 450 */ 121, 121, 121, 121, 219, 219, 472, 1183, 407, 570,
160069
- /* 460 */ 1183, 1235, 503, 1477, 149, 546, 307, 489, 141, 1011,
160070
- /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 191, 1214, 950,
160071
- /* 480 */ 950, 514, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160072
- /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 563, 119, 119,
160686
+ /* 440 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160687
+ /* 450 */ 121, 121, 121, 121, 1304, 219, 1283, 1183, 407, 570,
160688
+ /* 460 */ 1183, 1235, 503, 1477, 1304, 546, 307, 489, 141, 1011,
160689
+ /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 382, 1214, 378,
160690
+ /* 480 */ 950, 514, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160691
+ /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 472, 119, 119,
160073160692
/* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283,
160074
- /* 510 */ 275, 275, 415, 1183, 1184, 1185, 1183, 1184, 1185, 372,
160075
- /* 520 */ 1183, 243, 344, 561, 502, 499, 498, 1539, 407, 1540,
160076
- /* 530 */ 1183, 288, 870, 143, 497, 1549, 185, 231, 9, 6,
160693
+ /* 510 */ 275, 275, 1476, 1183, 1184, 1185, 1183, 1184, 1185, 417,
160694
+ /* 520 */ 1183, 243, 541, 561, 502, 499, 498, 1001, 407, 478,
160695
+ /* 530 */ 1183, 472, 870, 143, 497, 1549, 185, 231, 9, 6,
160077160696
/* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160078
- /* 550 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160079
- /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 137, 446,
160080
- /* 570 */ 447, 863, 169, 1183, 397, 1204, 1183, 1184, 1185, 931,
160081
- /* 580 */ 526, 1001, 98, 339, 564, 342, 1183, 1184, 1185, 306,
160082
- /* 590 */ 555, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160083
- /* 600 */ 120, 120, 121, 121, 121, 121, 452, 71, 71, 275,
160697
+ /* 550 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160698
+ /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 372, 446,
160699
+ /* 570 */ 363, 863, 288, 1183, 397, 1204, 1183, 1184, 1185, 931,
160700
+ /* 580 */ 330, 458, 318, 526, 564, 541, 1183, 1184, 1185, 284,
160701
+ /* 590 */ 1183, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160702
+ /* 600 */ 120, 120, 121, 121, 121, 121, 291, 71, 71, 275,
160084160703
/* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160085
- /* 620 */ 116, 442, 561, 417, 306, 555, 1183, 1307, 1307, 1183,
160086
- /* 630 */ 1184, 1185, 1204, 1149, 330, 458, 318, 407, 363, 470,
160087
- /* 640 */ 431, 1167, 32, 541, 527, 350, 1149, 1629, 393, 1149,
160704
+ /* 620 */ 116, 442, 561, 1031, 1031, 1042, 1183, 1045, 287, 1183,
160705
+ /* 630 */ 1184, 1185, 1204, 137, 218, 542, 1541, 407, 363, 470,
160706
+ /* 640 */ 431, 1167, 32, 363, 527, 350, 1183, 1184, 1185, 380,
160088160707
/* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160089
- /* 660 */ 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160090
- /* 670 */ 120, 120, 121, 121, 121, 121, 407, 199, 472, 1183,
160091
- /* 680 */ 1022, 472, 1183, 1184, 1185, 386, 151, 539, 1548, 277,
160092
- /* 690 */ 400, 137, 6, 317, 5, 564, 562, 3, 920, 920,
160093
- /* 700 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120,
160708
+ /* 660 */ 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160709
+ /* 670 */ 120, 120, 121, 121, 121, 121, 407, 392, 1227, 1183,
160710
+ /* 680 */ 1022, 1540, 1183, 1184, 1185, 1523, 149, 1307, 1307, 306,
160711
+ /* 690 */ 555, 151, 1546, 361, 5, 564, 6, 3, 1035, 1542,
160712
+ /* 700 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160094160713
/* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71,
160095160714
/* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160096
- /* 730 */ 442, 1183, 218, 428, 1183, 1183, 1184, 1185, 363, 261,
160097
- /* 740 */ 278, 358, 508, 353, 507, 248, 407, 306, 555, 1539,
160098
- /* 750 */ 1006, 349, 363, 291, 489, 302, 293, 1542, 281, 119,
160715
+ /* 730 */ 442, 1183, 426, 428, 1183, 1183, 1184, 1185, 191, 261,
160716
+ /* 740 */ 278, 358, 508, 353, 507, 248, 407, 455, 137, 1539,
160717
+ /* 750 */ 1006, 349, 363, 472, 1539, 302, 1228, 405, 281, 119,
160099160718
/* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160100
- /* 770 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120,
160101
- /* 780 */ 120, 121, 121, 121, 121, 407, 148, 1183, 1184, 1185,
160102
- /* 790 */ 1183, 1184, 1185, 275, 275, 1304, 1257, 1283, 483, 1476,
160103
- /* 800 */ 150, 489, 480, 564, 1187, 1304, 561, 1587, 1255, 122,
160104
- /* 810 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160105
- /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 520, 119,
160719
+ /* 770 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160720
+ /* 780 */ 120, 121, 121, 121, 121, 407, 452, 1183, 1184, 1185,
160721
+ /* 790 */ 1183, 1184, 1185, 275, 275, 269, 269, 489, 483, 1525,
160722
+ /* 800 */ 148, 363, 480, 564, 306, 555, 561, 489, 561, 122,
160723
+ /* 810 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160724
+ /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 293, 119,
160106160725
/* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160107
- /* 840 */ 1183, 420, 417, 564, 269, 269, 1316, 13, 13, 1539,
160108
- /* 850 */ 1546, 16, 16, 322, 6, 407, 506, 561, 1089, 1089,
160109
- /* 860 */ 486, 1187, 425, 1539, 887, 292, 71, 71, 119, 119,
160726
+ /* 840 */ 1183, 420, 1316, 564, 98, 417, 199, 13, 13, 150,
160727
+ /* 850 */ 306, 555, 1312, 322, 386, 407, 506, 478, 562, 400,
160728
+ /* 860 */ 920, 920, 425, 1539, 887, 292, 71, 71, 119, 119,
160110160729
/* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122,
160111
- /* 880 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160112
- /* 890 */ 121, 121, 121, 121, 564, 12, 1183, 1184, 1185, 407,
160113
- /* 900 */ 275, 275, 451, 303, 834, 835, 836, 417, 489, 276,
160114
- /* 910 */ 276, 1547, 284, 561, 319, 6, 321, 71, 71, 429,
160115
- /* 920 */ 451, 450, 561, 952, 101, 113, 1207, 1207, 1041, 1044,
160730
+ /* 880 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160731
+ /* 890 */ 121, 121, 121, 121, 564, 1149, 1183, 1184, 1185, 407,
160732
+ /* 900 */ 275, 275, 451, 303, 1089, 1089, 486, 448, 1149, 276,
160733
+ /* 910 */ 276, 1149, 1539, 561, 319, 286, 321, 71, 71, 429,
160734
+ /* 920 */ 451, 450, 561, 952, 101, 1207, 1207, 1041, 113, 1044,
160116160735
/* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119,
160117160736
/* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105,
160118
- /* 950 */ 1183, 489, 564, 1312, 437, 455, 478, 564, 246, 245,
160119
- /* 960 */ 244, 1409, 1545, 547, 1106, 405, 6, 1544, 196, 1258,
160120
- /* 970 */ 413, 6, 105, 462, 103, 71, 71, 286, 564, 1107,
160737
+ /* 950 */ 1183, 1547, 564, 12, 437, 6, 329, 564, 834, 835,
160738
+ /* 960 */ 836, 1629, 393, 547, 1106, 246, 245, 244, 1545, 1258,
160739
+ /* 970 */ 413, 1521, 6, 1086, 310, 71, 71, 1086, 564, 1107,
160121160740
/* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117,
160122
- /* 990 */ 117, 116, 442, 451, 104, 427, 337, 320, 275, 275,
160123
- /* 1000 */ 906, 13, 13, 564, 1482, 1105, 1183, 1184, 1185, 126,
160124
- /* 1010 */ 907, 561, 546, 564, 407, 478, 295, 1321, 253, 200,
160125
- /* 1020 */ 1106, 548, 1482, 1484, 280, 1409, 55, 55, 1287, 561,
160126
- /* 1030 */ 478, 380, 423, 951, 407, 1107, 71, 71, 122, 123,
160127
- /* 1040 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160128
- /* 1050 */ 121, 121, 121, 1204, 407, 287, 552, 309, 122, 123,
160129
- /* 1060 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160130
- /* 1070 */ 121, 121, 121, 441, 1128, 1628, 146, 1628, 122, 111,
160131
- /* 1080 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160132
- /* 1090 */ 121, 121, 121, 404, 403, 1482, 424, 119, 119, 119,
160741
+ /* 990 */ 117, 116, 442, 451, 104, 427, 537, 320, 275, 275,
160742
+ /* 1000 */ 906, 13, 13, 520, 1482, 1105, 1183, 1184, 1185, 484,
160743
+ /* 1010 */ 907, 561, 546, 564, 407, 536, 295, 478, 253, 200,
160744
+ /* 1020 */ 1106, 548, 1482, 1484, 1160, 1409, 16, 16, 126, 557,
160745
+ /* 1030 */ 413, 479, 311, 951, 407, 1107, 71, 71, 122, 123,
160746
+ /* 1040 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160747
+ /* 1050 */ 121, 121, 121, 1204, 407, 544, 552, 314, 122, 123,
160748
+ /* 1060 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160749
+ /* 1070 */ 121, 121, 121, 441, 144, 1160, 468, 146, 122, 111,
160750
+ /* 1080 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160751
+ /* 1090 */ 121, 121, 121, 247, 12, 1482, 422, 119, 119, 119,
160133160752
/* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564,
160134
- /* 1110 */ 1204, 544, 1086, 858, 329, 361, 1086, 119, 119, 119,
160135
- /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 294,
160136
- /* 1130 */ 144, 523, 56, 56, 224, 564, 510, 119, 119, 119,
160137
- /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 484, 1409,
160138
- /* 1150 */ 537, 15, 15, 1126, 434, 439, 438, 407, 13, 13,
160139
- /* 1160 */ 1523, 12, 926, 1211, 1183, 1184, 1185, 925, 1213, 536,
160140
- /* 1170 */ 858, 557, 413, 193, 1525, 494, 1212, 448, 1160, 1222,
160141
- /* 1180 */ 1183, 564, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160142
- /* 1190 */ 120, 120, 121, 121, 121, 121, 1521, 1149, 564, 965,
160143
- /* 1200 */ 564, 1214, 247, 1214, 13, 13, 1409, 966, 538, 564,
160144
- /* 1210 */ 1149, 108, 556, 1149, 4, 310, 392, 1227, 17, 194,
160145
- /* 1220 */ 485, 43, 43, 57, 57, 306, 555, 524, 559, 1160,
160146
- /* 1230 */ 464, 564, 44, 44, 392, 1127, 1183, 1184, 1185, 479,
160753
+ /* 1110 */ 1204, 207, 404, 403, 858, 950, 294, 119, 119, 119,
160754
+ /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 30,
160755
+ /* 1130 */ 564, 1409, 55, 55, 1599, 564, 895, 119, 119, 119,
160756
+ /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 510, 1409,
160757
+ /* 1150 */ 1409, 56, 56, 15, 15, 439, 438, 407, 13, 13,
160758
+ /* 1160 */ 31, 1187, 412, 1211, 1183, 1184, 1185, 196, 1213, 306,
160759
+ /* 1170 */ 555, 858, 462, 193, 926, 564, 1212, 489, 361, 925,
160760
+ /* 1180 */ 1183, 564, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160761
+ /* 1190 */ 120, 120, 121, 121, 121, 121, 1544, 1149, 43, 43,
160762
+ /* 1200 */ 6, 1214, 423, 1214, 13, 13, 564, 219, 538, 494,
160763
+ /* 1210 */ 1149, 108, 556, 1149, 4, 392, 1127, 434, 1187, 194,
160764
+ /* 1220 */ 424, 485, 337, 1315, 414, 171, 1253, 1321, 559, 57,
160765
+ /* 1230 */ 57, 564, 950, 564, 224, 247, 1183, 1184, 1185, 561,
160147160766
/* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160148
- /* 1250 */ 442, 443, 564, 327, 13, 13, 564, 418, 1315, 414,
160149
- /* 1260 */ 171, 564, 311, 553, 213, 529, 1253, 564, 517, 543,
160150
- /* 1270 */ 412, 108, 556, 137, 4, 58, 58, 435, 314, 59,
160151
- /* 1280 */ 59, 274, 217, 549, 60, 60, 349, 476, 559, 1353,
160152
- /* 1290 */ 61, 61, 1021, 275, 275, 1228, 213, 564, 106, 106,
160153
- /* 1300 */ 8, 275, 275, 275, 275, 107, 561, 443, 566, 565,
160154
- /* 1310 */ 564, 443, 1011, 1228, 561, 564, 561, 564, 275, 275,
160155
- /* 1320 */ 62, 62, 1352, 553, 247, 456, 564, 98, 110, 306,
160156
- /* 1330 */ 555, 561, 564, 45, 45, 405, 1203, 533, 46, 46,
160157
- /* 1340 */ 47, 47, 532, 465, 1011, 1011, 1013, 1014, 27, 49,
160158
- /* 1350 */ 49, 564, 1021, 405, 469, 50, 50, 564, 106, 106,
160159
- /* 1360 */ 305, 564, 84, 204, 405, 107, 564, 443, 566, 565,
160160
- /* 1370 */ 405, 564, 1011, 564, 63, 63, 564, 1599, 564, 895,
160161
- /* 1380 */ 64, 64, 457, 477, 65, 65, 147, 96, 38, 14,
160162
- /* 1390 */ 14, 1528, 412, 564, 66, 66, 128, 128, 926, 67,
160163
- /* 1400 */ 67, 52, 52, 925, 1011, 1011, 1013, 1014, 27, 1572,
160164
- /* 1410 */ 1171, 445, 208, 1123, 279, 394, 68, 68, 228, 390,
160165
- /* 1420 */ 390, 389, 264, 387, 1171, 445, 843, 877, 279, 108,
160166
- /* 1430 */ 556, 453, 4, 390, 390, 389, 264, 387, 564, 225,
160167
- /* 1440 */ 843, 313, 328, 1003, 98, 252, 559, 544, 471, 312,
160168
- /* 1450 */ 252, 564, 208, 225, 564, 313, 473, 30, 252, 279,
160169
- /* 1460 */ 466, 69, 69, 312, 390, 390, 389, 264, 387, 443,
160170
- /* 1470 */ 333, 843, 98, 564, 53, 53, 323, 157, 157, 227,
160171
- /* 1480 */ 495, 553, 249, 289, 225, 564, 313, 162, 31, 1501,
160172
- /* 1490 */ 135, 564, 1500, 227, 312, 533, 158, 158, 885, 884,
160173
- /* 1500 */ 534, 162, 873, 301, 135, 564, 481, 226, 76, 76,
160174
- /* 1510 */ 1021, 347, 1071, 98, 54, 54, 106, 106, 1067, 564,
160175
- /* 1520 */ 249, 226, 519, 107, 227, 443, 566, 565, 72, 72,
160176
- /* 1530 */ 1011, 334, 162, 564, 230, 135, 108, 556, 959, 4,
160177
- /* 1540 */ 252, 408, 129, 129, 564, 1349, 306, 555, 564, 923,
160178
- /* 1550 */ 564, 110, 226, 559, 564, 408, 73, 73, 564, 873,
160179
- /* 1560 */ 306, 555, 1011, 1011, 1013, 1014, 27, 130, 130, 1071,
160180
- /* 1570 */ 449, 131, 131, 127, 127, 357, 443, 156, 156, 892,
160181
- /* 1580 */ 893, 155, 155, 338, 449, 356, 408, 564, 553, 968,
160182
- /* 1590 */ 969, 306, 555, 1015, 341, 564, 108, 556, 564, 4,
160183
- /* 1600 */ 1132, 1286, 533, 564, 856, 343, 145, 532, 345, 1300,
160184
- /* 1610 */ 136, 136, 1083, 559, 1083, 449, 564, 1021, 134, 134,
160185
- /* 1620 */ 1284, 132, 132, 106, 106, 1285, 133, 133, 564, 352,
160186
- /* 1630 */ 107, 564, 443, 566, 565, 1340, 443, 1011, 362, 75,
160187
- /* 1640 */ 75, 1082, 564, 1082, 564, 924, 1561, 110, 553, 551,
160188
- /* 1650 */ 1015, 77, 77, 1361, 74, 74, 1408, 1336, 1347, 550,
160189
- /* 1660 */ 1414, 1265, 1256, 1244, 1243, 42, 42, 48, 48, 1011,
160190
- /* 1670 */ 1011, 1013, 1014, 27, 1245, 1580, 490, 1021, 267, 202,
160191
- /* 1680 */ 1333, 365, 11, 106, 106, 930, 367, 210, 369, 391,
160192
- /* 1690 */ 107, 1395, 443, 566, 565, 223, 1390, 1011, 500, 454,
160193
- /* 1700 */ 282, 1400, 285, 108, 556, 214, 4, 325, 1383, 1283,
160194
- /* 1710 */ 475, 355, 1473, 1583, 1472, 1399, 371, 1222, 326, 398,
160195
- /* 1720 */ 559, 290, 331, 197, 100, 556, 209, 4, 198, 1011,
160196
- /* 1730 */ 1011, 1013, 1014, 27, 385, 256, 1520, 1518, 554, 1219,
160197
- /* 1740 */ 416, 559, 83, 443, 173, 206, 182, 221, 459, 167,
160198
- /* 1750 */ 177, 460, 175, 493, 233, 553, 79, 178, 1396, 179,
160199
- /* 1760 */ 35, 180, 96, 1402, 443, 396, 36, 467, 1478, 1401,
160200
- /* 1770 */ 482, 237, 1404, 399, 82, 186, 553, 1467, 89, 488,
160201
- /* 1780 */ 190, 268, 239, 491, 1021, 340, 240, 401, 1246, 1489,
160202
- /* 1790 */ 106, 106, 336, 509, 1294, 241, 1303, 107, 430, 443,
160203
- /* 1800 */ 566, 565, 1302, 91, 1011, 1021, 1598, 1301, 1273, 215,
160204
- /* 1810 */ 1597, 106, 106, 402, 877, 432, 354, 1272, 107, 1271,
160205
- /* 1820 */ 443, 566, 565, 1596, 1566, 1011, 1293, 433, 518, 299,
160206
- /* 1830 */ 300, 360, 95, 525, 1344, 364, 1011, 1011, 1013, 1014,
160207
- /* 1840 */ 27, 254, 255, 1552, 436, 1551, 125, 544, 10, 379,
160208
- /* 1850 */ 1326, 1453, 102, 97, 1345, 528, 304, 1011, 1011, 1013,
160209
- /* 1860 */ 1014, 27, 366, 377, 1343, 1342, 368, 370, 1325, 384,
160210
- /* 1870 */ 201, 383, 34, 1368, 1367, 568, 1177, 266, 263, 265,
160211
- /* 1880 */ 1505, 159, 569, 1241, 1236, 1506, 160, 142, 1504, 1503,
160212
- /* 1890 */ 297, 211, 830, 161, 212, 78, 444, 203, 308, 222,
160213
- /* 1900 */ 1081, 139, 1079, 316, 174, 163, 1203, 229, 176, 909,
160214
- /* 1910 */ 324, 232, 1095, 181, 409, 410, 172, 164, 165, 419,
160215
- /* 1920 */ 183, 85, 86, 421, 166, 87, 88, 1098, 1094, 234,
160216
- /* 1930 */ 235, 152, 18, 236, 335, 1087, 1216, 252, 187, 487,
160217
- /* 1940 */ 238, 188, 37, 845, 492, 356, 242, 496, 351, 501,
160218
- /* 1950 */ 189, 90, 19, 504, 348, 20, 875, 92, 298, 168,
160219
- /* 1960 */ 888, 153, 93, 511, 94, 1165, 154, 1047, 1134, 39,
160220
- /* 1970 */ 216, 1133, 271, 273, 958, 192, 953, 110, 1151, 1155,
160221
- /* 1980 */ 251, 7, 21, 1159, 1139, 22, 1153, 33, 23, 24,
160222
- /* 1990 */ 25, 540, 1158, 195, 98, 1062, 26, 1048, 1046, 1050,
160223
- /* 2000 */ 1104, 1051, 1103, 257, 258, 28, 40, 1173, 1016, 857,
160224
- /* 2010 */ 109, 29, 560, 388, 138, 1172, 259, 170, 260, 1232,
160225
- /* 2020 */ 1232, 919, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232,
160226
- /* 2030 */ 1232, 1232, 1589, 1232, 1232, 1232, 1588,
160767
+ /* 1250 */ 442, 443, 564, 517, 13, 13, 44, 44, 275, 275,
160768
+ /* 1260 */ 1409, 275, 275, 553, 1353, 529, 213, 549, 456, 543,
160769
+ /* 1270 */ 465, 561, 564, 137, 561, 58, 58, 469, 405, 1222,
160770
+ /* 1280 */ 405, 274, 217, 108, 556, 110, 4, 405, 275, 275,
160771
+ /* 1290 */ 564, 1352, 1021, 564, 1228, 59, 59, 523, 106, 106,
160772
+ /* 1300 */ 559, 561, 275, 275, 412, 107, 457, 443, 566, 565,
160773
+ /* 1310 */ 564, 8, 1011, 60, 60, 561, 61, 61, 564, 965,
160774
+ /* 1320 */ 349, 926, 305, 443, 84, 204, 925, 966, 564, 306,
160775
+ /* 1330 */ 555, 435, 405, 62, 62, 553, 476, 105, 564, 103,
160776
+ /* 1340 */ 464, 45, 45, 1203, 1011, 1011, 1013, 1014, 27, 533,
160777
+ /* 1350 */ 564, 46, 46, 453, 532, 1572, 1171, 445, 1528, 564,
160778
+ /* 1360 */ 279, 47, 47, 327, 1021, 390, 390, 389, 264, 387,
160779
+ /* 1370 */ 106, 106, 843, 49, 49, 108, 556, 107, 4, 443,
160780
+ /* 1380 */ 566, 565, 50, 50, 1011, 225, 564, 313, 564, 96,
160781
+ /* 1390 */ 564, 228, 559, 524, 147, 312, 38, 1123, 564, 394,
160782
+ /* 1400 */ 466, 328, 280, 98, 544, 564, 17, 564, 323, 63,
160783
+ /* 1410 */ 63, 64, 64, 65, 65, 443, 1011, 1011, 1013, 1014,
160784
+ /* 1420 */ 27, 14, 14, 289, 564, 227, 564, 553, 66, 66,
160785
+ /* 1430 */ 128, 128, 477, 162, 564, 309, 135, 564, 1003, 277,
160786
+ /* 1440 */ 252, 533, 564, 1501, 564, 418, 534, 67, 67, 52,
160787
+ /* 1450 */ 52, 564, 1287, 226, 564, 1500, 1021, 68, 68, 208,
160788
+ /* 1460 */ 69, 69, 106, 106, 1286, 53, 53, 157, 157, 107,
160789
+ /* 1470 */ 873, 443, 566, 565, 158, 158, 1011, 76, 76, 564,
160790
+ /* 1480 */ 357, 564, 108, 556, 471, 4, 252, 408, 885, 884,
160791
+ /* 1490 */ 356, 564, 306, 555, 564, 473, 564, 252, 481, 559,
160792
+ /* 1500 */ 564, 334, 54, 54, 72, 72, 564, 230, 1011, 1011,
160793
+ /* 1510 */ 1013, 1014, 27, 564, 129, 129, 449, 73, 73, 130,
160794
+ /* 1520 */ 130, 564, 443, 131, 131, 519, 564, 873, 564, 127,
160795
+ /* 1530 */ 127, 333, 1071, 98, 553, 1349, 156, 156, 564, 495,
160796
+ /* 1540 */ 347, 249, 98, 338, 155, 155, 892, 893, 533, 136,
160797
+ /* 1550 */ 136, 134, 134, 532, 341, 1171, 445, 1587, 564, 279,
160798
+ /* 1560 */ 343, 132, 132, 1021, 390, 390, 389, 264, 387, 106,
160799
+ /* 1570 */ 106, 843, 564, 1067, 564, 249, 107, 564, 443, 566,
160800
+ /* 1580 */ 565, 133, 133, 1011, 225, 1015, 313, 108, 556, 1071,
160801
+ /* 1590 */ 4, 345, 968, 969, 312, 75, 75, 77, 77, 1300,
160802
+ /* 1600 */ 74, 74, 564, 1132, 559, 564, 108, 556, 959, 4,
160803
+ /* 1610 */ 252, 923, 1083, 110, 1083, 1011, 1011, 1013, 1014, 27,
160804
+ /* 1620 */ 1082, 1285, 1082, 559, 227, 42, 42, 443, 48, 48,
160805
+ /* 1630 */ 1284, 856, 162, 145, 924, 135, 110, 352, 362, 553,
160806
+ /* 1640 */ 1340, 1361, 1015, 1408, 1336, 301, 443, 1561, 1347, 550,
160807
+ /* 1650 */ 1414, 551, 226, 202, 1265, 1333, 1256, 1244, 553, 1243,
160808
+ /* 1660 */ 490, 1245, 1580, 267, 11, 391, 210, 223, 1021, 1390,
160809
+ /* 1670 */ 1395, 282, 365, 367, 106, 106, 930, 369, 454, 285,
160810
+ /* 1680 */ 1383, 107, 325, 443, 566, 565, 408, 1021, 1011, 326,
160811
+ /* 1690 */ 475, 306, 555, 106, 106, 100, 556, 500, 4, 1400,
160812
+ /* 1700 */ 107, 1399, 443, 566, 565, 398, 1283, 1011, 214, 355,
160813
+ /* 1710 */ 1473, 290, 559, 1472, 1583, 449, 554, 371, 331, 197,
160814
+ /* 1720 */ 1011, 1011, 1013, 1014, 27, 198, 209, 385, 1222, 173,
160815
+ /* 1730 */ 221, 256, 1520, 1518, 1219, 443, 79, 416, 206, 1011,
160816
+ /* 1740 */ 1011, 1013, 1014, 27, 83, 279, 182, 553, 82, 167,
160817
+ /* 1750 */ 390, 390, 389, 264, 387, 35, 1396, 843, 1478, 459,
160818
+ /* 1760 */ 175, 177, 460, 493, 178, 179, 180, 233, 96, 396,
160819
+ /* 1770 */ 225, 1402, 313, 1401, 36, 1404, 1021, 467, 186, 482,
160820
+ /* 1780 */ 312, 399, 106, 106, 237, 1467, 89, 1489, 488, 107,
160821
+ /* 1790 */ 239, 443, 566, 565, 268, 336, 1011, 190, 491, 340,
160822
+ /* 1800 */ 240, 401, 1246, 241, 509, 1294, 430, 1303, 91, 877,
160823
+ /* 1810 */ 227, 215, 1566, 1302, 1301, 1273, 1598, 432, 162, 518,
160824
+ /* 1820 */ 1272, 135, 1597, 354, 402, 433, 1271, 1596, 1011, 1011,
160825
+ /* 1830 */ 1013, 1014, 27, 1293, 299, 360, 300, 525, 226, 95,
160826
+ /* 1840 */ 254, 255, 1344, 364, 436, 125, 544, 1552, 10, 1453,
160827
+ /* 1850 */ 379, 1551, 102, 304, 97, 528, 34, 568, 1177, 263,
160828
+ /* 1860 */ 265, 266, 569, 1241, 1236, 172, 409, 410, 159, 383,
160829
+ /* 1870 */ 377, 366, 408, 1345, 1343, 368, 370, 306, 555, 1342,
160830
+ /* 1880 */ 1326, 1325, 1368, 201, 384, 1367, 1505, 1506, 160, 1504,
160831
+ /* 1890 */ 1503, 142, 161, 211, 212, 78, 830, 444, 203, 308,
160832
+ /* 1900 */ 297, 449, 222, 1081, 139, 1079, 316, 174, 163, 1203,
160833
+ /* 1910 */ 229, 176, 232, 909, 324, 1095, 164, 181, 165, 419,
160834
+ /* 1920 */ 421, 183, 85, 86, 87, 88, 166, 1098, 235, 234,
160835
+ /* 1930 */ 1094, 152, 18, 236, 335, 1087, 252, 1216, 487, 238,
160836
+ /* 1940 */ 37, 187, 188, 845, 492, 356, 242, 348, 496, 189,
160837
+ /* 1950 */ 90, 93, 19, 20, 168, 875, 501, 351, 92, 504,
160838
+ /* 1960 */ 888, 153, 511, 1133, 1165, 154, 298, 1047, 94, 1134,
160839
+ /* 1970 */ 39, 958, 216, 271, 273, 192, 953, 110, 1151, 251,
160840
+ /* 1980 */ 1155, 21, 1159, 22, 1158, 1139, 1153, 33, 23, 24,
160841
+ /* 1990 */ 540, 25, 195, 98, 26, 1062, 1048, 1046, 1050, 1104,
160842
+ /* 2000 */ 7, 1103, 257, 258, 1051, 28, 40, 560, 1016, 857,
160843
+ /* 2010 */ 109, 29, 919, 138, 259, 260, 170, 1589, 388, 1588,
160844
+ /* 2020 */ 1173, 1172,
160227160845
};
160228160846
static const YYCODETYPE yy_lookahead[] = {
160229160847
/* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192,
160230160848
/* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19,
160231160849
/* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210,
@@ -160236,202 +160854,202 @@
160236160854
/* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255,
160237160855
/* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49,
160238160856
/* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210,
160239160857
/* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109,
160240160858
/* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307,
160241
- /* 120 */ 308, 313, 314, 112, 312, 59, 86, 261, 88, 19,
160859
+ /* 120 */ 308, 313, 314, 25, 312, 192, 86, 261, 88, 19,
160242160860
/* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55,
160243160861
/* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
160244160862
/* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160245160863
/* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115,
160246160864
/* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69,
160247
- /* 180 */ 204, 115, 116, 117, 192, 131, 102, 103, 104, 105,
160865
+ /* 180 */ 204, 22, 23, 16, 25, 131, 102, 103, 104, 105,
160248160866
/* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19,
160249160867
/* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
160250160868
/* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109,
160251160869
/* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160252
- /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 46,
160253
- /* 240 */ 47, 48, 49, 24, 248, 192, 250, 67, 102, 103,
160870
+ /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 141,
160871
+ /* 240 */ 307, 308, 272, 24, 77, 312, 79, 67, 102, 103,
160254160872
/* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277,
160255
- /* 260 */ 127, 128, 43, 44, 45, 46, 47, 48, 49, 50,
160256
- /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 164, 165,
160257
- /* 280 */ 272, 263, 102, 103, 104, 105, 106, 107, 108, 109,
160873
+ /* 260 */ 101, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160874
+ /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 127, 128,
160875
+ /* 280 */ 310, 311, 102, 103, 104, 105, 106, 107, 108, 109,
160258160876
/* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186,
160259
- /* 300 */ 187, 188, 189, 194, 76, 196, 229, 194, 19, 196,
160260
- /* 310 */ 59, 192, 203, 120, 59, 87, 203, 89, 310, 311,
160877
+ /* 300 */ 187, 188, 189, 194, 76, 196, 192, 194, 19, 196,
160878
+ /* 310 */ 59, 25, 203, 192, 59, 87, 203, 89, 164, 165,
160261160879
/* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160262160880
/* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160263160881
/* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73,
160264
- /* 350 */ 231, 238, 239, 22, 23, 100, 25, 81, 305, 306,
160265
- /* 360 */ 251, 23, 25, 25, 251, 272, 115, 116, 117, 214,
160266
- /* 370 */ 115, 116, 144, 192, 265, 120, 114, 222, 265, 102,
160882
+ /* 350 */ 192, 238, 239, 22, 23, 100, 25, 81, 237, 229,
160883
+ /* 360 */ 251, 23, 204, 25, 251, 272, 115, 116, 117, 214,
160884
+ /* 370 */ 115, 116, 144, 192, 265, 120, 262, 222, 265, 102,
160267160885
/* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160268160886
/* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160269160887
/* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154,
160270
- /* 410 */ 297, 149, 192, 137, 138, 19, 192, 100, 192, 23,
160888
+ /* 410 */ 297, 125, 192, 137, 138, 19, 295, 100, 192, 23,
160271160889
/* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216,
160272160890
/* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43,
160273160891
/* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160274
- /* 450 */ 54, 55, 56, 57, 117, 117, 192, 59, 19, 187,
160275
- /* 460 */ 59, 189, 23, 282, 240, 252, 194, 192, 196, 152,
160276
- /* 470 */ 153, 154, 252, 72, 261, 203, 152, 25, 154, 142,
160892
+ /* 450 */ 54, 55, 56, 57, 222, 117, 224, 59, 19, 187,
160893
+ /* 460 */ 59, 189, 23, 282, 232, 252, 194, 192, 196, 152,
160894
+ /* 470 */ 153, 154, 252, 72, 261, 203, 152, 248, 154, 250,
160277160895
/* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50,
160278160896
/* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103,
160279160897
/* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267,
160280160898
/* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192,
160281
- /* 520 */ 59, 118, 16, 251, 121, 122, 123, 303, 19, 303,
160282
- /* 530 */ 59, 267, 23, 72, 131, 308, 22, 265, 22, 312,
160899
+ /* 520 */ 59, 118, 192, 251, 121, 122, 123, 73, 19, 192,
160900
+ /* 530 */ 59, 192, 23, 72, 131, 308, 22, 265, 22, 312,
160283160901
/* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160284160902
/* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160285
- /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 81, 297,
160286
- /* 570 */ 295, 23, 192, 59, 203, 59, 115, 116, 117, 108,
160287
- /* 580 */ 192, 73, 25, 77, 192, 79, 115, 116, 117, 137,
160288
- /* 590 */ 138, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160289
- /* 600 */ 52, 53, 54, 55, 56, 57, 119, 215, 216, 238,
160903
+ /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 192, 297,
160904
+ /* 570 */ 192, 23, 267, 59, 203, 59, 115, 116, 117, 108,
160905
+ /* 580 */ 126, 127, 128, 192, 192, 192, 115, 116, 117, 262,
160906
+ /* 590 */ 59, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160907
+ /* 600 */ 52, 53, 54, 55, 56, 57, 267, 215, 216, 238,
160290160908
/* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160291
- /* 620 */ 111, 112, 251, 192, 137, 138, 59, 234, 235, 115,
160292
- /* 630 */ 116, 117, 116, 76, 126, 127, 128, 19, 192, 268,
160293
- /* 640 */ 19, 23, 22, 192, 252, 24, 89, 300, 301, 92,
160909
+ /* 620 */ 111, 112, 251, 45, 46, 47, 59, 49, 291, 115,
160910
+ /* 630 */ 116, 117, 116, 81, 192, 305, 306, 19, 192, 268,
160911
+ /* 640 */ 19, 23, 22, 192, 252, 24, 115, 116, 117, 192,
160294160912
/* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160295160913
/* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160296
- /* 670 */ 52, 53, 54, 55, 56, 57, 19, 192, 192, 59,
160297
- /* 680 */ 23, 192, 115, 116, 117, 200, 240, 307, 308, 22,
160298
- /* 690 */ 205, 81, 312, 262, 22, 192, 133, 22, 135, 136,
160914
+ /* 670 */ 52, 53, 54, 55, 56, 57, 19, 22, 23, 59,
160915
+ /* 680 */ 23, 303, 115, 116, 117, 192, 240, 234, 235, 137,
160916
+ /* 690 */ 138, 240, 308, 192, 22, 192, 312, 22, 120, 306,
160299160917
/* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160300160918
/* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216,
160301160919
/* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160302
- /* 730 */ 112, 59, 192, 112, 59, 115, 116, 117, 192, 118,
160303
- /* 740 */ 119, 120, 121, 122, 123, 124, 19, 137, 138, 303,
160304
- /* 750 */ 23, 130, 192, 267, 192, 252, 267, 306, 203, 102,
160920
+ /* 730 */ 112, 59, 231, 112, 59, 115, 116, 117, 25, 118,
160921
+ /* 740 */ 119, 120, 121, 122, 123, 124, 19, 243, 81, 303,
160922
+ /* 750 */ 23, 130, 192, 192, 303, 252, 101, 253, 203, 102,
160305160923
/* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160306160924
/* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160307
- /* 780 */ 53, 54, 55, 56, 57, 19, 240, 115, 116, 117,
160308
- /* 790 */ 115, 116, 117, 238, 239, 222, 192, 224, 280, 237,
160309
- /* 800 */ 240, 192, 284, 192, 59, 232, 251, 140, 204, 43,
160925
+ /* 780 */ 53, 54, 55, 56, 57, 19, 119, 115, 116, 117,
160926
+ /* 790 */ 115, 116, 117, 238, 239, 238, 239, 192, 280, 192,
160927
+ /* 800 */ 240, 192, 284, 192, 137, 138, 251, 192, 251, 43,
160310160928
/* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160311
- /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 192, 102,
160929
+ /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 267, 102,
160312160930
/* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160313
- /* 840 */ 59, 230, 192, 192, 238, 239, 237, 215, 216, 303,
160314
- /* 850 */ 308, 215, 216, 16, 312, 19, 66, 251, 126, 127,
160315
- /* 860 */ 128, 116, 230, 303, 74, 203, 215, 216, 102, 103,
160931
+ /* 840 */ 59, 230, 237, 192, 25, 192, 192, 215, 216, 240,
160932
+ /* 850 */ 137, 138, 237, 16, 200, 19, 66, 192, 133, 205,
160933
+ /* 860 */ 135, 136, 230, 303, 74, 203, 215, 216, 102, 103,
160316160934
/* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
160317160935
/* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160318
- /* 890 */ 54, 55, 56, 57, 192, 212, 115, 116, 117, 19,
160319
- /* 900 */ 238, 239, 192, 252, 7, 8, 9, 192, 192, 238,
160320
- /* 910 */ 239, 308, 262, 251, 77, 312, 79, 215, 216, 129,
160936
+ /* 890 */ 54, 55, 56, 57, 192, 76, 115, 116, 117, 19,
160937
+ /* 900 */ 238, 239, 192, 252, 126, 127, 128, 192, 89, 238,
160938
+ /* 910 */ 239, 92, 303, 251, 77, 262, 79, 215, 216, 129,
160321160939
/* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49,
160322160940
/* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
160323160941
/* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12,
160324
- /* 950 */ 59, 192, 192, 237, 252, 243, 192, 192, 126, 127,
160325
- /* 960 */ 128, 192, 308, 203, 27, 253, 312, 308, 285, 207,
160326
- /* 970 */ 208, 312, 157, 290, 159, 215, 216, 262, 192, 42,
160942
+ /* 950 */ 59, 308, 192, 212, 252, 312, 291, 192, 7, 8,
160943
+ /* 960 */ 9, 300, 301, 203, 27, 126, 127, 128, 308, 207,
160944
+ /* 970 */ 208, 192, 312, 29, 192, 215, 216, 33, 192, 42,
160327160945
/* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109,
160328
- /* 990 */ 110, 111, 112, 283, 158, 230, 237, 160, 238, 239,
160329
- /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 22,
160330
- /* 1010 */ 73, 251, 252, 192, 19, 192, 230, 239, 24, 24,
160331
- /* 1020 */ 27, 261, 210, 211, 99, 192, 215, 216, 225, 251,
160332
- /* 1030 */ 192, 192, 263, 142, 19, 42, 215, 216, 43, 44,
160946
+ /* 990 */ 110, 111, 112, 283, 158, 230, 66, 160, 238, 239,
160947
+ /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 65,
160948
+ /* 1010 */ 73, 251, 252, 192, 19, 85, 230, 192, 24, 24,
160949
+ /* 1020 */ 27, 261, 210, 211, 94, 192, 215, 216, 22, 207,
160950
+ /* 1030 */ 208, 290, 192, 142, 19, 42, 215, 216, 43, 44,
160333160951
/* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160334
- /* 1050 */ 55, 56, 57, 59, 19, 291, 63, 132, 43, 44,
160952
+ /* 1050 */ 55, 56, 57, 59, 19, 144, 63, 192, 43, 44,
160335160953
/* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160336
- /* 1070 */ 55, 56, 57, 252, 22, 23, 22, 25, 43, 44,
160954
+ /* 1070 */ 55, 56, 57, 252, 163, 145, 114, 22, 43, 44,
160337160955
/* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160338
- /* 1090 */ 55, 56, 57, 106, 107, 283, 263, 102, 103, 104,
160956
+ /* 1090 */ 55, 56, 57, 45, 212, 283, 263, 102, 103, 104,
160339160957
/* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192,
160340
- /* 1110 */ 116, 144, 29, 59, 291, 192, 33, 102, 103, 104,
160341
- /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 291,
160342
- /* 1130 */ 163, 19, 215, 216, 15, 192, 108, 102, 103, 104,
160343
- /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 65, 192,
160344
- /* 1150 */ 66, 215, 216, 101, 231, 106, 107, 19, 215, 216,
160345
- /* 1160 */ 192, 212, 134, 114, 115, 116, 117, 139, 119, 85,
160346
- /* 1170 */ 116, 207, 208, 230, 192, 19, 127, 192, 94, 60,
160958
+ /* 1110 */ 116, 149, 106, 107, 59, 25, 291, 102, 103, 104,
160959
+ /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 22,
160960
+ /* 1130 */ 192, 192, 215, 216, 23, 192, 25, 102, 103, 104,
160961
+ /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 108, 192,
160962
+ /* 1150 */ 192, 215, 216, 215, 216, 106, 107, 19, 215, 216,
160963
+ /* 1160 */ 53, 59, 114, 114, 115, 116, 117, 285, 119, 137,
160964
+ /* 1170 */ 138, 116, 290, 230, 134, 192, 127, 192, 192, 139,
160347160965
/* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51,
160348
- /* 1190 */ 52, 53, 54, 55, 56, 57, 192, 76, 192, 31,
160349
- /* 1200 */ 192, 152, 46, 154, 215, 216, 192, 39, 87, 192,
160350
- /* 1210 */ 89, 19, 20, 92, 22, 192, 22, 23, 22, 230,
160351
- /* 1220 */ 263, 215, 216, 215, 216, 137, 138, 115, 36, 145,
160352
- /* 1230 */ 128, 192, 215, 216, 22, 23, 115, 116, 117, 290,
160966
+ /* 1190 */ 52, 53, 54, 55, 56, 57, 308, 76, 215, 216,
160967
+ /* 1200 */ 312, 152, 263, 154, 215, 216, 192, 117, 87, 19,
160968
+ /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 231, 116, 230,
160969
+ /* 1220 */ 263, 263, 237, 203, 298, 299, 203, 239, 36, 215,
160970
+ /* 1230 */ 216, 192, 142, 192, 15, 45, 115, 116, 117, 251,
160353160971
/* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160354
- /* 1250 */ 112, 59, 192, 151, 215, 216, 192, 61, 203, 298,
160355
- /* 1260 */ 299, 192, 192, 71, 25, 144, 203, 192, 203, 230,
160356
- /* 1270 */ 114, 19, 20, 81, 22, 215, 216, 263, 192, 215,
160357
- /* 1280 */ 216, 255, 256, 203, 215, 216, 130, 19, 36, 192,
160358
- /* 1290 */ 215, 216, 100, 238, 239, 101, 25, 192, 106, 107,
160359
- /* 1300 */ 48, 238, 239, 238, 239, 113, 251, 115, 116, 117,
160360
- /* 1310 */ 192, 59, 120, 101, 251, 192, 251, 192, 238, 239,
160361
- /* 1320 */ 215, 216, 192, 71, 46, 243, 192, 25, 25, 137,
160362
- /* 1330 */ 138, 251, 192, 215, 216, 253, 25, 85, 215, 216,
160363
- /* 1340 */ 215, 216, 90, 243, 152, 153, 154, 155, 156, 215,
160364
- /* 1350 */ 216, 192, 100, 253, 243, 215, 216, 192, 106, 107,
160365
- /* 1360 */ 243, 192, 148, 149, 253, 113, 192, 115, 116, 117,
160366
- /* 1370 */ 253, 192, 120, 192, 215, 216, 192, 23, 192, 25,
160367
- /* 1380 */ 215, 216, 192, 115, 215, 216, 22, 148, 24, 215,
160368
- /* 1390 */ 216, 192, 114, 192, 215, 216, 215, 216, 134, 215,
160369
- /* 1400 */ 216, 215, 216, 139, 152, 153, 154, 155, 156, 0,
160370
- /* 1410 */ 1, 2, 141, 23, 5, 25, 215, 216, 24, 10,
160371
- /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 125, 5, 19,
160372
- /* 1430 */ 20, 268, 22, 10, 11, 12, 13, 14, 192, 30,
160373
- /* 1440 */ 17, 32, 23, 23, 25, 25, 36, 144, 23, 40,
160374
- /* 1450 */ 25, 192, 141, 30, 192, 32, 23, 22, 25, 5,
160375
- /* 1460 */ 128, 215, 216, 40, 10, 11, 12, 13, 14, 59,
160376
- /* 1470 */ 23, 17, 25, 192, 215, 216, 192, 215, 216, 70,
160377
- /* 1480 */ 23, 71, 25, 151, 30, 192, 32, 78, 53, 192,
160378
- /* 1490 */ 81, 192, 192, 70, 40, 85, 215, 216, 119, 120,
160379
- /* 1500 */ 90, 78, 59, 254, 81, 192, 192, 98, 215, 216,
160380
- /* 1510 */ 100, 23, 59, 25, 215, 216, 106, 107, 23, 192,
160381
- /* 1520 */ 25, 98, 19, 113, 70, 115, 116, 117, 215, 216,
160382
- /* 1530 */ 120, 192, 78, 192, 140, 81, 19, 20, 23, 22,
160383
- /* 1540 */ 25, 132, 215, 216, 192, 192, 137, 138, 192, 23,
160384
- /* 1550 */ 192, 25, 98, 36, 192, 132, 215, 216, 192, 116,
160385
- /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 215, 216, 116,
160386
- /* 1570 */ 161, 215, 216, 215, 216, 120, 59, 215, 216, 7,
160387
- /* 1580 */ 8, 215, 216, 192, 161, 130, 132, 192, 71, 83,
160388
- /* 1590 */ 84, 137, 138, 59, 192, 192, 19, 20, 192, 22,
160389
- /* 1600 */ 97, 225, 85, 192, 23, 192, 25, 90, 192, 192,
160390
- /* 1610 */ 215, 216, 152, 36, 154, 161, 192, 100, 215, 216,
160391
- /* 1620 */ 192, 215, 216, 106, 107, 225, 215, 216, 192, 192,
160392
- /* 1630 */ 113, 192, 115, 116, 117, 257, 59, 120, 192, 215,
160393
- /* 1640 */ 216, 152, 192, 154, 192, 23, 317, 25, 71, 235,
160394
- /* 1650 */ 116, 215, 216, 192, 215, 216, 192, 192, 192, 192,
160395
- /* 1660 */ 192, 192, 192, 192, 192, 215, 216, 215, 216, 152,
160396
- /* 1670 */ 153, 154, 155, 156, 192, 192, 287, 100, 286, 241,
160397
- /* 1680 */ 254, 254, 242, 106, 107, 108, 254, 213, 254, 190,
160398
- /* 1690 */ 113, 270, 115, 116, 117, 296, 266, 120, 219, 258,
160399
- /* 1700 */ 244, 270, 258, 19, 20, 228, 22, 292, 266, 224,
160400
- /* 1710 */ 292, 218, 218, 195, 218, 270, 258, 60, 245, 270,
160401
- /* 1720 */ 36, 245, 244, 248, 19, 20, 242, 22, 248, 152,
160402
- /* 1730 */ 153, 154, 155, 156, 244, 140, 199, 199, 279, 38,
160403
- /* 1740 */ 199, 36, 150, 59, 296, 149, 22, 296, 18, 43,
160404
- /* 1750 */ 236, 199, 233, 18, 198, 71, 293, 236, 271, 236,
160405
- /* 1760 */ 269, 236, 148, 271, 59, 245, 269, 245, 282, 271,
160406
- /* 1770 */ 199, 198, 233, 245, 293, 233, 71, 245, 157, 62,
160407
- /* 1780 */ 22, 199, 198, 220, 100, 199, 198, 220, 199, 289,
160408
- /* 1790 */ 106, 107, 288, 114, 226, 198, 217, 113, 64, 115,
160409
- /* 1800 */ 116, 117, 217, 22, 120, 100, 223, 217, 217, 164,
160410
- /* 1810 */ 223, 106, 107, 220, 125, 24, 217, 219, 113, 217,
160411
- /* 1820 */ 115, 116, 117, 217, 311, 120, 226, 112, 304, 281,
160412
- /* 1830 */ 281, 220, 114, 143, 260, 259, 152, 153, 154, 155,
160413
- /* 1840 */ 156, 199, 91, 316, 82, 316, 147, 144, 22, 199,
160414
- /* 1850 */ 249, 276, 157, 146, 260, 145, 278, 152, 153, 154,
160415
- /* 1860 */ 155, 156, 259, 248, 260, 260, 259, 259, 249, 245,
160416
- /* 1870 */ 247, 246, 25, 264, 264, 201, 13, 6, 193, 193,
160417
- /* 1880 */ 212, 206, 191, 191, 191, 212, 206, 221, 212, 212,
160418
- /* 1890 */ 221, 213, 4, 206, 213, 212, 3, 22, 162, 15,
160419
- /* 1900 */ 23, 16, 23, 138, 150, 129, 25, 24, 141, 20,
160420
- /* 1910 */ 16, 143, 1, 141, 302, 302, 299, 129, 129, 61,
160421
- /* 1920 */ 150, 53, 53, 37, 129, 53, 53, 115, 1, 34,
160422
- /* 1930 */ 140, 5, 22, 114, 160, 68, 75, 25, 68, 41,
160423
- /* 1940 */ 140, 114, 24, 20, 19, 130, 124, 67, 24, 67,
160424
- /* 1950 */ 22, 22, 22, 96, 23, 22, 59, 22, 67, 37,
160425
- /* 1960 */ 28, 23, 148, 22, 25, 23, 23, 23, 23, 22,
160426
- /* 1970 */ 140, 97, 23, 23, 115, 22, 142, 25, 88, 75,
160427
- /* 1980 */ 34, 44, 34, 75, 23, 34, 86, 22, 34, 34,
160428
- /* 1990 */ 34, 24, 93, 25, 25, 23, 34, 23, 23, 23,
160429
- /* 2000 */ 23, 11, 23, 25, 22, 22, 22, 1, 23, 23,
160430
- /* 2010 */ 22, 22, 25, 15, 23, 1, 140, 25, 140, 318,
160431
- /* 2020 */ 318, 134, 318, 318, 318, 318, 318, 318, 318, 318,
160432
- /* 2030 */ 318, 318, 140, 318, 318, 318, 140, 318, 318, 318,
160972
+ /* 1250 */ 112, 59, 192, 203, 215, 216, 215, 216, 238, 239,
160973
+ /* 1260 */ 192, 238, 239, 71, 192, 144, 25, 203, 243, 230,
160974
+ /* 1270 */ 243, 251, 192, 81, 251, 215, 216, 243, 253, 60,
160975
+ /* 1280 */ 253, 255, 256, 19, 20, 25, 22, 253, 238, 239,
160976
+ /* 1290 */ 192, 192, 100, 192, 101, 215, 216, 19, 106, 107,
160977
+ /* 1300 */ 36, 251, 238, 239, 114, 113, 192, 115, 116, 117,
160978
+ /* 1310 */ 192, 47, 120, 215, 216, 251, 215, 216, 192, 31,
160979
+ /* 1320 */ 130, 134, 243, 59, 148, 149, 139, 39, 192, 137,
160980
+ /* 1330 */ 138, 263, 253, 215, 216, 71, 19, 157, 192, 159,
160981
+ /* 1340 */ 128, 215, 216, 25, 152, 153, 154, 155, 156, 85,
160982
+ /* 1350 */ 192, 215, 216, 268, 90, 0, 1, 2, 192, 192,
160983
+ /* 1360 */ 5, 215, 216, 151, 100, 10, 11, 12, 13, 14,
160984
+ /* 1370 */ 106, 107, 17, 215, 216, 19, 20, 113, 22, 115,
160985
+ /* 1380 */ 116, 117, 215, 216, 120, 30, 192, 32, 192, 148,
160986
+ /* 1390 */ 192, 24, 36, 115, 22, 40, 24, 23, 192, 25,
160987
+ /* 1400 */ 128, 23, 99, 25, 144, 192, 22, 192, 192, 215,
160988
+ /* 1410 */ 216, 215, 216, 215, 216, 59, 152, 153, 154, 155,
160989
+ /* 1420 */ 156, 215, 216, 151, 192, 70, 192, 71, 215, 216,
160990
+ /* 1430 */ 215, 216, 115, 78, 192, 132, 81, 192, 23, 22,
160991
+ /* 1440 */ 25, 85, 192, 192, 192, 61, 90, 215, 216, 215,
160992
+ /* 1450 */ 216, 192, 225, 98, 192, 192, 100, 215, 216, 141,
160993
+ /* 1460 */ 215, 216, 106, 107, 225, 215, 216, 215, 216, 113,
160994
+ /* 1470 */ 59, 115, 116, 117, 215, 216, 120, 215, 216, 192,
160995
+ /* 1480 */ 120, 192, 19, 20, 23, 22, 25, 132, 119, 120,
160996
+ /* 1490 */ 130, 192, 137, 138, 192, 23, 192, 25, 192, 36,
160997
+ /* 1500 */ 192, 192, 215, 216, 215, 216, 192, 140, 152, 153,
160998
+ /* 1510 */ 154, 155, 156, 192, 215, 216, 161, 215, 216, 215,
160999
+ /* 1520 */ 216, 192, 59, 215, 216, 19, 192, 116, 192, 215,
161000
+ /* 1530 */ 216, 23, 59, 25, 71, 192, 215, 216, 192, 23,
161001
+ /* 1540 */ 23, 25, 25, 192, 215, 216, 7, 8, 85, 215,
161002
+ /* 1550 */ 216, 215, 216, 90, 192, 1, 2, 140, 192, 5,
161003
+ /* 1560 */ 192, 215, 216, 100, 10, 11, 12, 13, 14, 106,
161004
+ /* 1570 */ 107, 17, 192, 23, 192, 25, 113, 192, 115, 116,
161005
+ /* 1580 */ 117, 215, 216, 120, 30, 59, 32, 19, 20, 116,
161006
+ /* 1590 */ 22, 192, 83, 84, 40, 215, 216, 215, 216, 192,
161007
+ /* 1600 */ 215, 216, 192, 97, 36, 192, 19, 20, 23, 22,
161008
+ /* 1610 */ 25, 23, 152, 25, 154, 152, 153, 154, 155, 156,
161009
+ /* 1620 */ 152, 225, 154, 36, 70, 215, 216, 59, 215, 216,
161010
+ /* 1630 */ 192, 23, 78, 25, 23, 81, 25, 192, 192, 71,
161011
+ /* 1640 */ 257, 192, 116, 192, 192, 254, 59, 317, 192, 192,
161012
+ /* 1650 */ 192, 235, 98, 241, 192, 254, 192, 192, 71, 192,
161013
+ /* 1660 */ 287, 192, 192, 286, 242, 190, 213, 296, 100, 266,
161014
+ /* 1670 */ 270, 244, 254, 254, 106, 107, 108, 254, 258, 258,
161015
+ /* 1680 */ 266, 113, 292, 115, 116, 117, 132, 100, 120, 245,
161016
+ /* 1690 */ 292, 137, 138, 106, 107, 19, 20, 219, 22, 270,
161017
+ /* 1700 */ 113, 270, 115, 116, 117, 270, 224, 120, 228, 218,
161018
+ /* 1710 */ 218, 245, 36, 218, 195, 161, 279, 258, 244, 248,
161019
+ /* 1720 */ 152, 153, 154, 155, 156, 248, 242, 244, 60, 296,
161020
+ /* 1730 */ 296, 140, 199, 199, 38, 59, 293, 199, 149, 152,
161021
+ /* 1740 */ 153, 154, 155, 156, 150, 5, 22, 71, 293, 43,
161022
+ /* 1750 */ 10, 11, 12, 13, 14, 269, 271, 17, 282, 18,
161023
+ /* 1760 */ 233, 236, 199, 18, 236, 236, 236, 198, 148, 245,
161024
+ /* 1770 */ 30, 271, 32, 271, 269, 233, 100, 245, 233, 199,
161025
+ /* 1780 */ 40, 245, 106, 107, 198, 245, 157, 289, 62, 113,
161026
+ /* 1790 */ 198, 115, 116, 117, 199, 288, 120, 22, 220, 199,
161027
+ /* 1800 */ 198, 220, 199, 198, 114, 226, 64, 217, 22, 125,
161028
+ /* 1810 */ 70, 164, 311, 217, 217, 217, 223, 24, 78, 304,
161029
+ /* 1820 */ 219, 81, 223, 217, 220, 112, 217, 217, 152, 153,
161030
+ /* 1830 */ 154, 155, 156, 226, 281, 220, 281, 143, 98, 114,
161031
+ /* 1840 */ 199, 91, 260, 259, 82, 147, 144, 316, 22, 276,
161032
+ /* 1850 */ 199, 316, 157, 278, 146, 145, 25, 201, 13, 193,
161033
+ /* 1860 */ 193, 6, 191, 191, 191, 299, 302, 302, 206, 246,
161034
+ /* 1870 */ 248, 259, 132, 260, 260, 259, 259, 137, 138, 260,
161035
+ /* 1880 */ 249, 249, 264, 247, 245, 264, 212, 212, 206, 212,
161036
+ /* 1890 */ 212, 221, 206, 213, 213, 212, 4, 3, 22, 162,
161037
+ /* 1900 */ 221, 161, 15, 23, 16, 23, 138, 150, 129, 25,
161038
+ /* 1910 */ 24, 141, 143, 20, 16, 1, 129, 141, 129, 61,
161039
+ /* 1920 */ 37, 150, 53, 53, 53, 53, 129, 115, 140, 34,
161040
+ /* 1930 */ 1, 5, 22, 114, 160, 68, 25, 75, 41, 140,
161041
+ /* 1940 */ 24, 68, 114, 20, 19, 130, 124, 23, 67, 22,
161042
+ /* 1950 */ 22, 148, 22, 22, 37, 59, 67, 24, 22, 96,
161043
+ /* 1960 */ 28, 23, 22, 97, 23, 23, 67, 23, 25, 23,
161044
+ /* 1970 */ 22, 115, 140, 23, 23, 22, 142, 25, 88, 34,
161045
+ /* 1980 */ 75, 34, 75, 34, 93, 23, 86, 22, 34, 34,
161046
+ /* 1990 */ 24, 34, 25, 25, 34, 23, 23, 23, 23, 23,
161047
+ /* 2000 */ 44, 23, 25, 22, 11, 22, 22, 25, 23, 23,
161048
+ /* 2010 */ 22, 22, 134, 23, 140, 140, 25, 140, 15, 140,
161049
+ /* 2020 */ 1, 1, 318, 318, 318, 318, 318, 318, 318, 318,
161050
+ /* 2030 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160433161051
/* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160434161052
/* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160435161053
/* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160436161054
/* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160437161055
/* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
@@ -160444,122 +161062,120 @@
160444161062
/* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160445161063
/* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160446161064
/* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160447161065
/* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160448161066
/* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160449
- /* 2200 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160450
- /* 2210 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160451
- /* 2220 */ 318,
161067
+ /* 2200 */ 318, 318, 318, 318, 318, 318,
160452161068
};
160453161069
#define YY_SHIFT_COUNT (571)
160454161070
#define YY_SHIFT_MIN (0)
160455
-#define YY_SHIFT_MAX (2014)
161071
+#define YY_SHIFT_MAX (2020)
160456161072
static const unsigned short int yy_shift_ofst[] = {
160457
- /* 0 */ 1423, 1409, 1454, 1192, 1192, 610, 1252, 1410, 1517, 1684,
160458
- /* 10 */ 1684, 1684, 276, 0, 0, 180, 1015, 1684, 1684, 1684,
160459
- /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160460
- /* 30 */ 1049, 1049, 1121, 1121, 54, 487, 610, 610, 610, 610,
160461
- /* 40 */ 610, 40, 110, 219, 289, 396, 439, 509, 548, 618,
161073
+ /* 0 */ 1554, 1355, 1740, 1192, 1192, 552, 1264, 1356, 1463, 1587,
161074
+ /* 10 */ 1587, 1587, 276, 0, 0, 180, 1015, 1587, 1587, 1587,
161075
+ /* 20 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161076
+ /* 30 */ 1049, 1049, 1121, 1121, 54, 667, 552, 552, 552, 552,
161077
+ /* 40 */ 552, 40, 110, 219, 289, 396, 439, 509, 548, 618,
160462161078
/* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
160463161079
/* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
160464
- /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684,
160465
- /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160466
- /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160467
- /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160468
- /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684,
160469
- /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84,
160470
- /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 66,
160471
- /* 140 */ 66, 51, 1156, 66, 66, 324, 324, 66, 452, 452,
160472
- /* 150 */ 452, 452, 133, 114, 114, 4, 11, 2037, 2037, 621,
161080
+ /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1568, 1587,
161081
+ /* 80 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161082
+ /* 90 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161083
+ /* 100 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161084
+ /* 110 */ 1587, 1587, 1587, 1676, 1587, 1587, 1587, 1587, 1587, 1587,
161085
+ /* 120 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 146, 84, 84,
161086
+ /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 531,
161087
+ /* 140 */ 531, 51, 1190, 531, 531, 324, 324, 531, 713, 713,
161088
+ /* 150 */ 713, 713, 151, 154, 154, 4, 149, 2022, 2022, 621,
160473161089
/* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228,
160474
- /* 170 */ 251, 331, 1052, 66, 66, 66, 66, 66, 66, 66,
160475
- /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
160476
- /* 190 */ 66, 66, 66, 557, 557, 66, 9, 25, 25, 745,
160477
- /* 200 */ 745, 967, 1088, 2037, 2037, 2037, 2037, 2037, 2037, 2037,
161090
+ /* 170 */ 251, 159, 331, 531, 531, 531, 531, 531, 531, 531,
161091
+ /* 180 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161092
+ /* 190 */ 531, 531, 531, 819, 819, 531, 9, 25, 25, 1102,
161093
+ /* 200 */ 1102, 911, 1032, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
160478161094
/* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891,
160479
- /* 220 */ 675, 66, 66, 66, 66, 66, 66, 66, 66, 66,
160480
- /* 230 */ 66, 508, 66, 66, 66, 66, 66, 66, 66, 66,
160481
- /* 240 */ 66, 66, 66, 66, 790, 790, 790, 66, 66, 66,
160482
- /* 250 */ 338, 66, 66, 66, 516, 1084, 66, 66, 993, 66,
160483
- /* 260 */ 66, 66, 66, 66, 66, 66, 66, 732, 1083, 563,
160484
- /* 270 */ 994, 994, 994, 994, 337, 563, 563, 1028, 987, 897,
160485
- /* 280 */ 1119, 262, 1214, 1271, 1112, 1214, 1112, 1268, 1239, 262,
160486
- /* 290 */ 262, 1239, 262, 1271, 1268, 1302, 1354, 1278, 1168, 1168,
160487
- /* 300 */ 1168, 1112, 1303, 1303, 815, 1311, 1264, 1364, 1657, 1657,
160488
- /* 310 */ 1595, 1595, 1701, 1701, 1595, 1592, 1596, 1724, 1706, 1730,
160489
- /* 320 */ 1730, 1730, 1730, 1595, 1735, 1614, 1596, 1596, 1614, 1724,
160490
- /* 330 */ 1706, 1614, 1706, 1614, 1595, 1735, 1621, 1717, 1595, 1735,
160491
- /* 340 */ 1758, 1595, 1735, 1595, 1735, 1758, 1679, 1679, 1679, 1734,
160492
- /* 350 */ 1781, 1781, 1758, 1679, 1689, 1679, 1734, 1679, 1679, 1645,
160493
- /* 360 */ 1791, 1715, 1715, 1758, 1690, 1718, 1690, 1718, 1690, 1718,
160494
- /* 370 */ 1690, 1718, 1595, 1751, 1751, 1762, 1762, 1699, 1703, 1826,
160495
- /* 380 */ 1595, 1695, 1699, 1707, 1710, 1614, 1847, 1863, 1863, 1871,
160496
- /* 390 */ 1871, 1871, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037,
160497
- /* 400 */ 2037, 2037, 2037, 2037, 2037, 2037, 2037, 193, 837, 1194,
160498
- /* 410 */ 1212, 506, 832, 1054, 1390, 925, 1435, 1394, 1102, 1332,
160499
- /* 420 */ 1419, 1196, 1420, 1425, 1433, 1447, 1457, 1488, 1443, 1379,
160500
- /* 430 */ 1572, 1455, 1503, 1453, 1495, 1515, 1506, 1526, 1460, 1489,
160501
- /* 440 */ 1581, 1622, 1534, 667, 1888, 1893, 1875, 1736, 1884, 1885,
160502
- /* 450 */ 1877, 1879, 1765, 1754, 1776, 1881, 1881, 1883, 1767, 1889,
160503
- /* 460 */ 1768, 1894, 1911, 1772, 1788, 1881, 1789, 1858, 1886, 1881,
160504
- /* 470 */ 1770, 1868, 1869, 1872, 1873, 1795, 1812, 1895, 1790, 1927,
160505
- /* 480 */ 1926, 1910, 1819, 1774, 1867, 1912, 1870, 1861, 1898, 1800,
160506
- /* 490 */ 1827, 1918, 1923, 1925, 1815, 1822, 1928, 1880, 1929, 1930,
160507
- /* 500 */ 1931, 1933, 1882, 1897, 1924, 1857, 1932, 1935, 1891, 1922,
160508
- /* 510 */ 1938, 1814, 1941, 1942, 1943, 1944, 1939, 1945, 1947, 1874,
160509
- /* 520 */ 1830, 1949, 1950, 1859, 1946, 1953, 1834, 1952, 1948, 1951,
160510
- /* 530 */ 1954, 1955, 1890, 1904, 1900, 1937, 1908, 1899, 1956, 1961,
160511
- /* 540 */ 1965, 1967, 1968, 1969, 1962, 1972, 1952, 1974, 1975, 1976,
160512
- /* 550 */ 1977, 1978, 1979, 1982, 1990, 1983, 1984, 1985, 1986, 1988,
160513
- /* 560 */ 1989, 1987, 1887, 1876, 1878, 1892, 1896, 1992, 1991, 1998,
160514
- /* 570 */ 2006, 2014,
161095
+ /* 220 */ 675, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161096
+ /* 230 */ 531, 454, 531, 531, 531, 531, 531, 531, 531, 531,
161097
+ /* 240 */ 531, 531, 531, 531, 790, 790, 790, 531, 531, 531,
161098
+ /* 250 */ 338, 531, 531, 531, 516, 930, 531, 531, 993, 531,
161099
+ /* 260 */ 531, 531, 531, 531, 531, 531, 531, 778, 944, 725,
161100
+ /* 270 */ 994, 994, 994, 994, 1090, 725, 725, 1040, 1006, 951,
161101
+ /* 280 */ 1219, 962, 1176, 98, 1278, 1176, 1278, 1317, 1241, 962,
161102
+ /* 290 */ 962, 1241, 962, 98, 1317, 286, 1111, 1048, 1288, 1288,
161103
+ /* 300 */ 1288, 1278, 1260, 1260, 1180, 1318, 1187, 1372, 1668, 1668,
161104
+ /* 310 */ 1591, 1591, 1696, 1696, 1591, 1594, 1589, 1724, 1706, 1741,
161105
+ /* 320 */ 1741, 1741, 1741, 1591, 1745, 1620, 1589, 1589, 1620, 1724,
161106
+ /* 330 */ 1706, 1620, 1706, 1620, 1591, 1745, 1629, 1726, 1591, 1745,
161107
+ /* 340 */ 1775, 1591, 1745, 1591, 1745, 1775, 1690, 1690, 1690, 1742,
161108
+ /* 350 */ 1786, 1786, 1775, 1690, 1684, 1690, 1742, 1690, 1690, 1647,
161109
+ /* 360 */ 1793, 1713, 1713, 1775, 1694, 1725, 1694, 1725, 1694, 1725,
161110
+ /* 370 */ 1694, 1725, 1591, 1750, 1750, 1762, 1762, 1698, 1702, 1826,
161111
+ /* 380 */ 1591, 1695, 1698, 1708, 1710, 1620, 1831, 1845, 1845, 1855,
161112
+ /* 390 */ 1855, 1855, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161113
+ /* 400 */ 2022, 2022, 2022, 2022, 2022, 2022, 2022, 578, 837, 655,
161114
+ /* 410 */ 1193, 167, 839, 1055, 1374, 1303, 1107, 1367, 1212, 1272,
161115
+ /* 420 */ 1378, 1384, 1415, 1461, 1472, 1508, 1516, 1517, 1411, 1369,
161116
+ /* 430 */ 1539, 1360, 1506, 1473, 1550, 1585, 1509, 1588, 1460, 1468,
161117
+ /* 440 */ 1608, 1611, 1526, 1417, 1892, 1894, 1876, 1737, 1887, 1888,
161118
+ /* 450 */ 1880, 1882, 1768, 1757, 1779, 1884, 1884, 1886, 1770, 1893,
161119
+ /* 460 */ 1769, 1898, 1914, 1776, 1787, 1884, 1789, 1858, 1883, 1884,
161120
+ /* 470 */ 1771, 1869, 1870, 1871, 1872, 1797, 1812, 1895, 1788, 1929,
161121
+ /* 480 */ 1926, 1910, 1819, 1774, 1867, 1911, 1873, 1862, 1897, 1799,
161122
+ /* 490 */ 1828, 1916, 1923, 1925, 1815, 1822, 1927, 1881, 1928, 1930,
161123
+ /* 500 */ 1924, 1931, 1889, 1896, 1933, 1863, 1932, 1936, 1899, 1917,
161124
+ /* 510 */ 1938, 1803, 1940, 1941, 1942, 1944, 1943, 1946, 1948, 1866,
161125
+ /* 520 */ 1832, 1950, 1951, 1856, 1945, 1953, 1834, 1952, 1947, 1949,
161126
+ /* 530 */ 1954, 1955, 1890, 1905, 1900, 1956, 1907, 1891, 1957, 1962,
161127
+ /* 540 */ 1965, 1966, 1967, 1968, 1960, 1972, 1952, 1973, 1974, 1975,
161128
+ /* 550 */ 1976, 1977, 1978, 1981, 1993, 1983, 1984, 1985, 1986, 1988,
161129
+ /* 560 */ 1989, 1982, 1878, 1874, 1875, 1877, 1879, 1991, 1990, 2003,
161130
+ /* 570 */ 2019, 2020,
160515161131
};
160516161132
#define YY_REDUCE_COUNT (406)
160517161133
#define YY_REDUCE_MIN (-272)
160518
-#define YY_REDUCE_MAX (1693)
161134
+#define YY_REDUCE_MAX (1686)
160519161135
static const short yy_reduce_ofst[] = {
160520161136
/* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134,
160521161137
/* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765,
160522161138
/* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821,
160523
- /* 30 */ 710, 812, -188, 380, -187, 555, 662, 1055, 1063, 1065,
160524
- /* 40 */ 1080, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161139
+ /* 30 */ 710, 812, -188, -67, -187, 555, 662, 1020, 1023, 1050,
161140
+ /* 40 */ 1064, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160525161141
/* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160526161142
/* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160527
- /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 636, 811,
160528
- /* 80 */ 917, 936, 1006, 1008, 1017, 1060, 1064, 1069, 1075, 1105,
160529
- /* 90 */ 1118, 1123, 1125, 1134, 1140, 1159, 1165, 1169, 1174, 1179,
160530
- /* 100 */ 1181, 1184, 1186, 1201, 1246, 1259, 1262, 1281, 1293, 1299,
160531
- /* 110 */ 1313, 1327, 1341, 1352, 1356, 1358, 1362, 1366, 1395, 1403,
160532
- /* 120 */ 1406, 1411, 1424, 1436, 1439, 1450, 1452, -267, -267, -267,
160533
- /* 130 */ -267, -267, -267, -267, -267, 224, -267, 446, -24, 275,
160534
- /* 140 */ 546, 518, 573, 560, 53, -181, -111, 485, 606, 671,
160535
- /* 150 */ 606, 671, 683, 8, 93, -267, -267, -267, -267, 155,
160536
- /* 160 */ 155, 155, 181, 242, 264, 486, 489, -218, 393, 227,
160537
- /* 170 */ 604, 347, 347, -171, 431, 650, 715, -166, 562, 609,
160538
- /* 180 */ 716, 764, 18, 823, 769, 833, 838, 957, 759, 119,
160539
- /* 190 */ 923, 226, 1014, 542, 603, 451, 949, 654, 659, 762,
160540
- /* 200 */ 964, -4, 778, 961, 712, 1082, 1100, 1111, 1026, 1117,
160541
- /* 210 */ -204, -174, -151, -8, 77, 198, 305, 327, 388, 540,
160542
- /* 220 */ 839, 968, 982, 985, 1004, 1023, 1070, 1086, 1097, 1130,
160543
- /* 230 */ 1190, 1163, 1199, 1284, 1297, 1300, 1314, 1339, 1353, 1391,
160544
- /* 240 */ 1402, 1413, 1416, 1417, 803, 1376, 1400, 1428, 1437, 1446,
160545
- /* 250 */ 1378, 1461, 1464, 1465, 1249, 1329, 1466, 1467, 1414, 1468,
160546
- /* 260 */ 305, 1469, 1470, 1471, 1472, 1482, 1483, 1389, 1392, 1438,
160547
- /* 270 */ 1426, 1427, 1432, 1434, 1378, 1438, 1438, 1440, 1474, 1499,
160548
- /* 280 */ 1399, 1421, 1430, 1456, 1441, 1442, 1444, 1415, 1473, 1431,
160549
- /* 290 */ 1445, 1476, 1449, 1478, 1418, 1479, 1477, 1485, 1493, 1494,
160550
- /* 300 */ 1496, 1458, 1475, 1480, 1459, 1490, 1484, 1518, 1448, 1451,
160551
- /* 310 */ 1537, 1538, 1463, 1481, 1541, 1486, 1487, 1491, 1519, 1514,
160552
- /* 320 */ 1521, 1523, 1525, 1552, 1556, 1520, 1492, 1498, 1522, 1497,
160553
- /* 330 */ 1539, 1528, 1542, 1532, 1571, 1573, 1500, 1504, 1582, 1584,
160554
- /* 340 */ 1563, 1586, 1588, 1589, 1597, 1567, 1579, 1585, 1590, 1568,
160555
- /* 350 */ 1583, 1587, 1593, 1591, 1598, 1599, 1600, 1602, 1606, 1513,
160556
- /* 360 */ 1524, 1548, 1549, 1611, 1574, 1576, 1594, 1603, 1604, 1607,
160557
- /* 370 */ 1605, 1608, 1642, 1527, 1529, 1609, 1610, 1601, 1615, 1575,
160558
- /* 380 */ 1650, 1578, 1619, 1623, 1625, 1624, 1674, 1685, 1686, 1691,
160559
- /* 390 */ 1692, 1693, 1612, 1613, 1617, 1675, 1668, 1673, 1676, 1677,
160560
- /* 400 */ 1680, 1666, 1669, 1678, 1681, 1683, 1687,
161143
+ /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 811, 917,
161144
+ /* 80 */ 936, 938, 983, 1014, 1041, 1060, 1080, 1098, 1101, 1118,
161145
+ /* 90 */ 1126, 1136, 1146, 1158, 1167, 1194, 1196, 1198, 1206, 1213,
161146
+ /* 100 */ 1215, 1232, 1234, 1242, 1245, 1250, 1252, 1259, 1262, 1287,
161147
+ /* 110 */ 1289, 1299, 1302, 1304, 1308, 1314, 1321, 1329, 1334, 1336,
161148
+ /* 120 */ 1346, 1366, 1380, 1382, 1385, 1410, 1413, -267, -267, -267,
161149
+ /* 130 */ -267, -267, -267, -267, -267, 446, -267, 451, -24, 121,
161150
+ /* 140 */ 560, 518, 232, 609, 330, -181, -111, 654, 557, 671,
161151
+ /* 150 */ 557, 671, 882, -30, 93, -267, -267, -267, -267, 155,
161152
+ /* 160 */ 155, 155, 181, 242, 305, 339, 561, -218, 453, 227,
161153
+ /* 170 */ 158, 661, 661, -171, 114, 327, 653, -166, 275, 605,
161154
+ /* 180 */ 615, 337, 833, 665, 939, 957, 825, 958, 985, 501,
161155
+ /* 190 */ 986, 378, 1068, 384, 643, 393, 741, 660, 888, 762,
161156
+ /* 200 */ 822, 229, 988, 926, 504, 1025, 1027, 1034, 1026, 1079,
161157
+ /* 210 */ -204, -174, -151, 18, 130, 198, 226, 376, 391, 442,
161158
+ /* 220 */ 457, 493, 607, 715, 779, 782, 840, 865, 1072, 1099,
161159
+ /* 230 */ 1114, 1085, 1166, 1216, 1251, 1263, 1306, 1309, 1343, 1351,
161160
+ /* 240 */ 1362, 1368, 1399, 1407, 1227, 1239, 1396, 1438, 1445, 1446,
161161
+ /* 250 */ 1383, 1449, 1451, 1452, 1391, 1330, 1456, 1457, 1416, 1458,
161162
+ /* 260 */ 226, 1462, 1464, 1465, 1467, 1469, 1470, 1373, 1377, 1412,
161163
+ /* 270 */ 1401, 1418, 1419, 1423, 1383, 1412, 1412, 1422, 1453, 1475,
161164
+ /* 280 */ 1371, 1400, 1403, 1427, 1420, 1414, 1421, 1390, 1444, 1429,
161165
+ /* 290 */ 1431, 1466, 1435, 1474, 1398, 1478, 1480, 1482, 1491, 1492,
161166
+ /* 300 */ 1495, 1459, 1471, 1477, 1437, 1483, 1484, 1519, 1433, 1434,
161167
+ /* 310 */ 1533, 1534, 1443, 1455, 1538, 1476, 1485, 1486, 1527, 1525,
161168
+ /* 320 */ 1528, 1529, 1530, 1563, 1569, 1524, 1500, 1502, 1532, 1505,
161169
+ /* 330 */ 1542, 1536, 1545, 1540, 1580, 1586, 1498, 1507, 1595, 1592,
161170
+ /* 340 */ 1578, 1600, 1602, 1603, 1605, 1581, 1590, 1596, 1597, 1579,
161171
+ /* 350 */ 1593, 1599, 1604, 1598, 1601, 1606, 1607, 1609, 1610, 1501,
161172
+ /* 360 */ 1515, 1553, 1555, 1615, 1582, 1584, 1613, 1612, 1614, 1616,
161173
+ /* 370 */ 1619, 1617, 1641, 1531, 1535, 1618, 1621, 1631, 1622, 1573,
161174
+ /* 380 */ 1651, 1575, 1632, 1636, 1623, 1639, 1656, 1666, 1667, 1671,
161175
+ /* 390 */ 1672, 1673, 1564, 1565, 1566, 1662, 1674, 1675, 1677, 1678,
161176
+ /* 400 */ 1682, 1670, 1679, 1680, 1681, 1683, 1686,
160561161177
};
160562161178
static const YYACTIONTYPE yy_default[] = {
160563161179
/* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462,
160564161180
/* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230,
160565161181
/* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230,
@@ -160680,14 +161296,14 @@
160680161296
59, /* DETACH => ID */
160681161297
59, /* EACH => ID */
160682161298
59, /* FAIL => ID */
160683161299
0, /* OR => nothing */
160684161300
0, /* AND => nothing */
160685
- 0, /* IS => nothing */
160686161301
59, /* MATCH => ID */
160687161302
59, /* LIKE_KW => ID */
160688161303
0, /* BETWEEN => nothing */
161304
+ 0, /* IS => nothing */
160689161305
0, /* IN => nothing */
160690161306
0, /* ISNULL => nothing */
160691161307
0, /* NOTNULL => nothing */
160692161308
0, /* NE => nothing */
160693161309
0, /* EQ => nothing */
@@ -160952,14 +161568,14 @@
160952161568
/* 40 */ "DETACH",
160953161569
/* 41 */ "EACH",
160954161570
/* 42 */ "FAIL",
160955161571
/* 43 */ "OR",
160956161572
/* 44 */ "AND",
160957
- /* 45 */ "IS",
160958
- /* 46 */ "MATCH",
160959
- /* 47 */ "LIKE_KW",
160960
- /* 48 */ "BETWEEN",
161573
+ /* 45 */ "MATCH",
161574
+ /* 46 */ "LIKE_KW",
161575
+ /* 47 */ "BETWEEN",
161576
+ /* 48 */ "IS",
160961161577
/* 49 */ "IN",
160962161578
/* 50 */ "ISNULL",
160963161579
/* 51 */ "NOTNULL",
160964161580
/* 52 */ "NE",
160965161581
/* 53 */ "EQ",
@@ -169408,10 +170024,12 @@
169408170024
}
169409170025
oldLimit = db->aLimit[limitId];
169410170026
if( newLimit>=0 ){ /* IMP: R-52476-28732 */
169411170027
if( newLimit>aHardLimit[limitId] ){
169412170028
newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
170029
+ }else if( newLimit<1 && limitId==SQLITE_LIMIT_LENGTH ){
170030
+ newLimit = 1;
169413170031
}
169414170032
db->aLimit[limitId] = newLimit;
169415170033
}
169416170034
return oldLimit; /* IMP: R-53341-35419 */
169417170035
}
@@ -170811,16 +171429,20 @@
170811171429
** the schema to be reparsed the next time it is needed. This has the
170812171430
** effect of erasing all imposter tables.
170813171431
*/
170814171432
case SQLITE_TESTCTRL_IMPOSTER: {
170815171433
sqlite3 *db = va_arg(ap, sqlite3*);
171434
+ int iDb;
170816171435
sqlite3_mutex_enter(db->mutex);
170817
- db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*));
170818
- db->init.busy = db->init.imposterTable = va_arg(ap,int);
170819
- db->init.newTnum = va_arg(ap,int);
170820
- if( db->init.busy==0 && db->init.newTnum>0 ){
170821
- sqlite3ResetAllSchemasOfConnection(db);
171436
+ iDb = sqlite3FindDbName(db, va_arg(ap,const char*));
171437
+ if( iDb>=0 ){
171438
+ db->init.iDb = iDb;
171439
+ db->init.busy = db->init.imposterTable = va_arg(ap,int);
171440
+ db->init.newTnum = va_arg(ap,int);
171441
+ if( db->init.busy==0 && db->init.newTnum>0 ){
171442
+ sqlite3ResetAllSchemasOfConnection(db);
171443
+ }
170822171444
}
170823171445
sqlite3_mutex_leave(db->mutex);
170824171446
break;
170825171447
}
170826171448
@@ -170891,10 +171513,30 @@
170891171513
case 2: *ptr = sqlite3WhereTrace; break;
170892171514
case 3: sqlite3WhereTrace = *ptr; break;
170893171515
}
170894171516
break;
170895171517
}
171518
+
171519
+ /* sqlite3_test_control(SQLITE_TESTCTRL_LOGEST,
171520
+ ** double fIn, // Input value
171521
+ ** int *pLogEst, // sqlite3LogEstFromDouble(fIn)
171522
+ ** u64 *pInt, // sqlite3LogEstToInt(*pLogEst)
171523
+ ** int *pLogEst2 // sqlite3LogEst(*pInt)
171524
+ ** );
171525
+ **
171526
+ ** Test access for the LogEst conversion routines.
171527
+ */
171528
+ case SQLITE_TESTCTRL_LOGEST: {
171529
+ double rIn = va_arg(ap, double);
171530
+ LogEst rLogEst = sqlite3LogEstFromDouble(rIn);
171531
+ u64 iInt = sqlite3LogEstToInt(rLogEst);
171532
+ va_arg(ap, int*)[0] = rLogEst;
171533
+ va_arg(ap, u64*)[0] = iInt;
171534
+ va_arg(ap, int*)[0] = sqlite3LogEst(iInt);
171535
+ break;
171536
+ }
171537
+
170896171538
170897171539
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD)
170898171540
/* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
170899171541
**
170900171542
** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
@@ -203302,11 +203944,11 @@
203302203944
**
203303203945
** If the expression cannot be created, NULL is returned. In this case,
203304203946
** the caller has to use an OFFSET clause to extract only the required
203305203947
** rows from the sourct table, just as it does for an RBU update operation.
203306203948
*/
203307
-char *rbuVacuumIndexStart(
203949
+static char *rbuVacuumIndexStart(
203308203950
sqlite3rbu *p, /* RBU handle */
203309203951
RbuObjIter *pIter /* RBU iterator object */
203310203952
){
203311203953
char *zOrder = 0;
203312203954
char *zLhs = 0;
@@ -223727,11 +224369,11 @@
223727224369
** an error occurs, (*pRc) is set to an SQLite error code before returning.
223728224370
*/
223729224371
static void fts5StructureMakeWritable(int *pRc, Fts5Structure **pp){
223730224372
Fts5Structure *p = *pp;
223731224373
if( *pRc==SQLITE_OK && p->nRef>1 ){
223732
- int nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel);
224374
+ i64 nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel);
223733224375
Fts5Structure *pNew;
223734224376
pNew = (Fts5Structure*)sqlite3Fts5MallocZero(pRc, nByte);
223735224377
if( pNew ){
223736224378
int i;
223737224379
memcpy(pNew, p, nByte);
@@ -224756,12 +225398,16 @@
224756225398
}
224757225399
}else{
224758225400
int iRowidOff;
224759225401
iRowidOff = fts5LeafFirstRowidOff(pNew);
224760225402
if( iRowidOff ){
224761
- pIter->pLeaf = pNew;
224762
- pIter->iLeafOffset = iRowidOff;
225403
+ if( iRowidOff>=pNew->szLeaf ){
225404
+ p->rc = FTS5_CORRUPT;
225405
+ }else{
225406
+ pIter->pLeaf = pNew;
225407
+ pIter->iLeafOffset = iRowidOff;
225408
+ }
224763225409
}
224764225410
}
224765225411
224766225412
if( pIter->pLeaf ){
224767225413
u8 *a = &pIter->pLeaf->p[pIter->iLeafOffset];
@@ -232486,11 +233132,11 @@
232486233132
int nArg, /* Number of args */
232487233133
sqlite3_value **apUnused /* Function arguments */
232488233134
){
232489233135
assert( nArg==0 );
232490233136
UNUSED_PARAM2(nArg, apUnused);
232491
- sqlite3_result_text(pCtx, "fts5: 2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8", -1, SQLITE_TRANSIENT);
233137
+ sqlite3_result_text(pCtx, "fts5: 2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882", -1, SQLITE_TRANSIENT);
232492233138
}
232493233139
232494233140
/*
232495233141
** Return true if zName is the extension on one of the shadow tables used
232496233142
** by this module.
@@ -236703,11 +237349,11 @@
236703237349
rc = sqlite3Fts5FlushToDisk(pFts5);
236704237350
}
236705237351
}
236706237352
236707237353
if( rc==SQLITE_OK ){
236708
- int nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor);
237354
+ i64 nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor);
236709237355
pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte);
236710237356
}
236711237357
236712237358
if( pCsr ){
236713237359
pCsr->pFts5 = pFts5;
236714237360
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.37.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.37.0"
456 #define SQLITE_VERSION_NUMBER 3037000
457 #define SQLITE_SOURCE_ID "2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -8248,11 +8248,12 @@
8248 #define SQLITE_TESTCTRL_PRNG_SEED 28
8249 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8250 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8251 #define SQLITE_TESTCTRL_TRACEFLAGS 31
8252 #define SQLITE_TESTCTRL_TUNE 32
8253 #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
 
8254
8255 /*
8256 ** CAPI3REF: SQL Keyword Checking
8257 **
8258 ** These routines provide access to the set of SQL language keywords
@@ -8770,10 +8771,20 @@
8770 ** <dd>^This is the number of times that the prepared statement has
8771 ** been run. A single "run" for the purposes of this counter is one
8772 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
8773 ** The counter is incremented on the first [sqlite3_step()] call of each
8774 ** cycle.
 
 
 
 
 
 
 
 
 
 
8775 **
8776 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8777 ** <dd>^This is the approximate number of bytes of heap memory
8778 ** used to store the prepared statement. ^This value is not actually
8779 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8785,10 +8796,12 @@
8785 #define SQLITE_STMTSTATUS_SORT 2
8786 #define SQLITE_STMTSTATUS_AUTOINDEX 3
8787 #define SQLITE_STMTSTATUS_VM_STEP 4
8788 #define SQLITE_STMTSTATUS_REPREPARE 5
8789 #define SQLITE_STMTSTATUS_RUN 6
 
 
8790 #define SQLITE_STMTSTATUS_MEMUSED 99
8791
8792 /*
8793 ** CAPI3REF: Custom Page Cache Object
8794 **
@@ -13552,14 +13565,14 @@
13552 #define TK_DETACH 40
13553 #define TK_EACH 41
13554 #define TK_FAIL 42
13555 #define TK_OR 43
13556 #define TK_AND 44
13557 #define TK_IS 45
13558 #define TK_MATCH 46
13559 #define TK_LIKE_KW 47
13560 #define TK_BETWEEN 48
13561 #define TK_IN 49
13562 #define TK_ISNULL 50
13563 #define TK_NOTNULL 51
13564 #define TK_NE 52
13565 #define TK_EQ 53
@@ -13796,11 +13809,11 @@
13796 ** The default initial allocation for the pagecache when using separate
13797 ** pagecaches for each database connection. A positive number is the
13798 ** number of pages. A negative number N translations means that a buffer
13799 ** of -1024*N bytes is allocated and used for as many pages as it will hold.
13800 **
13801 ** The default value of "20" was choosen to minimize the run-time of the
13802 ** speedtest1 test program with options: --shrink-memory --reprepare
13803 */
13804 #ifndef SQLITE_DEFAULT_PCACHE_INITSZ
13805 # define SQLITE_DEFAULT_PCACHE_INITSZ 20
13806 #endif
@@ -15251,49 +15264,49 @@
15251 #define OP_ElseEq 58 /* jump, same as TK_ESCAPE */
15252 #define OP_IfNotZero 59 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
15253 #define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */
15254 #define OP_IncrVacuum 61 /* jump */
15255 #define OP_VNext 62 /* jump */
15256 #define OP_Init 63 /* jump, synopsis: Start at P2 */
15257 #define OP_PureFunc 64 /* synopsis: r[P3]=func(r[P2@NP]) */
15258 #define OP_Function 65 /* synopsis: r[P3]=func(r[P2@NP]) */
15259 #define OP_Return 66
15260 #define OP_EndCoroutine 67
15261 #define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */
15262 #define OP_Halt 69
15263 #define OP_Integer 70 /* synopsis: r[P2]=P1 */
15264 #define OP_Int64 71 /* synopsis: r[P2]=P4 */
15265 #define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */
15266 #define OP_Null 73 /* synopsis: r[P2..P3]=NULL */
15267 #define OP_SoftNull 74 /* synopsis: r[P1]=NULL */
15268 #define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */
15269 #define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */
15270 #define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */
15271 #define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
15272 #define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */
15273 #define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */
15274 #define OP_ChngCntRow 81 /* synopsis: output=r[P1] */
15275 #define OP_ResultRow 82 /* synopsis: output=r[P1@P2] */
15276 #define OP_CollSeq 83
15277 #define OP_AddImm 84 /* synopsis: r[P1]=r[P1]+P2 */
15278 #define OP_RealAffinity 85
15279 #define OP_Cast 86 /* synopsis: affinity(r[P1]) */
15280 #define OP_Permutation 87
15281 #define OP_Compare 88 /* synopsis: r[P1@P3] <-> r[P2@P3] */
15282 #define OP_IsTrue 89 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
15283 #define OP_ZeroOrNull 90 /* synopsis: r[P2] = 0 OR NULL */
15284 #define OP_Offset 91 /* synopsis: r[P3] = sqlite_offset(P1) */
15285 #define OP_Column 92 /* synopsis: r[P3]=PX */
15286 #define OP_TypeCheck 93 /* synopsis: typecheck(r[P1@P2]) */
15287 #define OP_Affinity 94 /* synopsis: affinity(r[P1@P2]) */
15288 #define OP_MakeRecord 95 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
15289 #define OP_Count 96 /* synopsis: r[P2]=count() */
15290 #define OP_ReadCookie 97
15291 #define OP_SetCookie 98
15292 #define OP_ReopenIdx 99 /* synopsis: root=P2 iDb=P3 */
15293 #define OP_OpenRead 100 /* synopsis: root=P2 iDb=P3 */
15294 #define OP_OpenWrite 101 /* synopsis: root=P2 iDb=P3 */
15295 #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15296 #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15297 #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15298 #define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15299 #define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -15300,80 +15313,82 @@
15300 #define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15301 #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15302 #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15303 #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15304 #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15305 #define OP_OpenDup 112
15306 #define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15307 #define OP_OpenAutoindex 114 /* synopsis: nColumn=P2 */
15308 #define OP_OpenEphemeral 115 /* synopsis: nColumn=P2 */
15309 #define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15310 #define OP_SorterOpen 117
15311 #define OP_SequenceTest 118 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15312 #define OP_OpenPseudo 119 /* synopsis: P3 columns in r[P2] */
15313 #define OP_Close 120
15314 #define OP_ColumnsUsed 121
15315 #define OP_SeekScan 122 /* synopsis: Scan-ahead up to P1 rows */
15316 #define OP_SeekHit 123 /* synopsis: set P2<=seekHit<=P3 */
15317 #define OP_Sequence 124 /* synopsis: r[P2]=cursor[P1].ctr++ */
15318 #define OP_NewRowid 125 /* synopsis: r[P2]=rowid */
15319 #define OP_Insert 126 /* synopsis: intkey=r[P3] data=r[P2] */
15320 #define OP_RowCell 127
15321 #define OP_Delete 128
15322 #define OP_ResetCount 129
15323 #define OP_SorterCompare 130 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15324 #define OP_SorterData 131 /* synopsis: r[P2]=data */
15325 #define OP_RowData 132 /* synopsis: r[P2]=data */
15326 #define OP_Rowid 133 /* synopsis: r[P2]=rowid */
15327 #define OP_NullRow 134
15328 #define OP_SeekEnd 135
15329 #define OP_IdxInsert 136 /* synopsis: key=r[P2] */
15330 #define OP_SorterInsert 137 /* synopsis: key=r[P2] */
15331 #define OP_IdxDelete 138 /* synopsis: key=r[P2@P3] */
15332 #define OP_DeferredSeek 139 /* synopsis: Move P3 to P1.rowid if needed */
15333 #define OP_IdxRowid 140 /* synopsis: r[P2]=rowid */
15334 #define OP_FinishSeek 141
15335 #define OP_Destroy 142
15336 #define OP_Clear 143
15337 #define OP_ResetSorter 144
15338 #define OP_CreateBtree 145 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15339 #define OP_SqlExec 146
15340 #define OP_ParseSchema 147
15341 #define OP_LoadAnalysis 148
15342 #define OP_DropTable 149
15343 #define OP_DropIndex 150
15344 #define OP_DropTrigger 151
15345 #define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15346 #define OP_IntegrityCk 153
15347 #define OP_RowSetAdd 154 /* synopsis: rowset(P1)=r[P2] */
15348 #define OP_Param 155
15349 #define OP_FkCounter 156 /* synopsis: fkctr[P1]+=P2 */
15350 #define OP_MemMax 157 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15351 #define OP_OffsetLimit 158 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15352 #define OP_AggInverse 159 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15353 #define OP_AggStep 160 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15354 #define OP_AggStep1 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15355 #define OP_AggValue 162 /* synopsis: r[P3]=value N=P2 */
15356 #define OP_AggFinal 163 /* synopsis: accum=r[P1] N=P2 */
15357 #define OP_Expire 164
15358 #define OP_CursorLock 165
15359 #define OP_CursorUnlock 166
15360 #define OP_TableLock 167 /* synopsis: iDb=P1 root=P2 write=P3 */
15361 #define OP_VBegin 168
15362 #define OP_VCreate 169
15363 #define OP_VDestroy 170
15364 #define OP_VOpen 171
15365 #define OP_VColumn 172 /* synopsis: r[P3]=vcolumn(P2) */
15366 #define OP_VRename 173
15367 #define OP_Pagecount 174
15368 #define OP_MaxPgcnt 175
15369 #define OP_Trace 176
15370 #define OP_CursorHint 177
15371 #define OP_ReleaseReg 178 /* synopsis: release r[P1@P2] mask P3 */
15372 #define OP_Noop 179
15373 #define OP_Explain 180
15374 #define OP_Abortable 181
 
 
15375
15376 /* Properties such as "out2" or "jump" that are specified in
15377 ** comments following the "case" for each opcode in the vdbe.c
15378 ** are encoded into bitvectors as follows:
15379 */
@@ -15390,33 +15405,34 @@
15390 /* 24 */ 0x09, 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09,\
15391 /* 32 */ 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
15392 /* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\
15393 /* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
15394 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\
15395 /* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\
15396 /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\
15397 /* 80 */ 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
15398 /* 88 */ 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00,\
15399 /* 96 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\
15400 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15401 /* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15402 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
15403 /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
15404 /* 136 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00,\
15405 /* 144 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15406 /* 152 */ 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00,\
15407 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15408 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
15409 /* 176 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
 
15410
15411 /* The resolve3P2Values() routine is able to run faster if it knows
15412 ** the value of the largest JUMP opcode. The smaller the maximum
15413 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15414 ** generated this include file strives to group all JUMP opcodes
15415 ** together near the beginning of the list.
15416 */
15417 #define SQLITE_MX_JUMP_OPCODE 63 /* Maximum JUMP opcode */
15418
15419 /************** End of opcodes.h *********************************************/
15420 /************** Continuing where we left off in vdbe.h ***********************/
15421
15422 /*
@@ -16707,10 +16723,12 @@
16707 #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
16708 #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
16709 #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
16710 #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
16711 /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
 
 
16712 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
16713
16714 /*
16715 ** Macros for testing whether or not optimizations are enabled or disabled.
16716 */
@@ -19509,10 +19527,11 @@
19509 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
19510 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
19511 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
19512 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
19513 #endif
 
19514 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
19515 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
19516 Upsert*);
19517 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
19518 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
@@ -19719,18 +19738,12 @@
19719 #endif
19720 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
19721 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
19722 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
19723 SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
19724 #ifndef SQLITE_OMIT_VIRTUALTABLE
19725 SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double);
19726 #endif
19727 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
19728 defined(SQLITE_ENABLE_STAT4) || \
19729 defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
19730 SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst);
19731 #endif
19732 SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int);
19733 SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int);
19734 SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int);
19735
19736 /*
@@ -22106,11 +22119,11 @@
22106 bft usesStmtJournal:1; /* True if uses a statement journal */
22107 bft readOnly:1; /* True for statements that do not write */
22108 bft bIsReader:1; /* True for statements that read */
22109 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
22110 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
22111 u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */
22112 char *zSql; /* Text of the SQL statement that generated this */
22113 #ifdef SQLITE_ENABLE_NORMALIZE
22114 char *zNormSql; /* Normalization of the associated SQL statement */
22115 DblquoteStr *pDblStr; /* List of double-quoted string literals */
22116 #endif
@@ -22214,11 +22227,11 @@
22214 #endif
22215 SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*);
22216 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
22217 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8);
22218 SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double);
22219 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);
22220 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
22221 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
22222 SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull);
22223 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
22224 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
@@ -23212,11 +23225,13 @@
23212 pX = localtime(t);
23213 #ifndef SQLITE_UNTESTABLE
23214 if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
23215 #endif
23216 if( pX ) *pTm = *pX;
 
23217 sqlite3_mutex_leave(mutex);
 
23218 rc = pX==0;
23219 #else
23220 #ifndef SQLITE_UNTESTABLE
23221 if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
23222 #endif
@@ -23351,10 +23366,49 @@
23351 DateTime *p /* The date/time value to be modified */
23352 ){
23353 int rc = 1;
23354 double r;
23355 switch(sqlite3UpperToLower[(u8)z[0]] ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23356 #ifndef SQLITE_OMIT_LOCALTIME
23357 case 'l': {
23358 /* localtime
23359 **
23360 ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
@@ -23614,10 +23668,28 @@
23614 if( isDate(context, argc, argv, &x)==0 ){
23615 computeJD(&x);
23616 sqlite3_result_double(context, x.iJD/86400000.0);
23617 }
23618 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23619
23620 /*
23621 ** datetime( TIMESTRING, MOD, MOD, ...)
23622 **
23623 ** Return YYYY-MM-DD HH:MM:SS
@@ -23891,10 +23963,11 @@
23891 */
23892 SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
23893 static FuncDef aDateTimeFuncs[] = {
23894 #ifndef SQLITE_OMIT_DATETIME_FUNCS
23895 PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
 
23896 PURE_DATE(date, -1, 0, 0, dateFunc ),
23897 PURE_DATE(time, -1, 0, 0, timeFunc ),
23898 PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
23899 PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
23900 DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
@@ -33608,11 +33681,10 @@
33608 #endif
33609 }
33610 return a[x&7] + y - 10;
33611 }
33612
33613 #ifndef SQLITE_OMIT_VIRTUALTABLE
33614 /*
33615 ** Convert a double into a LogEst
33616 ** In other words, compute an approximation for 10*log2(x).
33617 */
33618 SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
@@ -33623,38 +33695,23 @@
33623 if( x<=2000000000 ) return sqlite3LogEst((u64)x);
33624 memcpy(&a, &x, 8);
33625 e = (a>>52) - 1022;
33626 return e*10;
33627 }
33628 #endif /* SQLITE_OMIT_VIRTUALTABLE */
33629
33630 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
33631 defined(SQLITE_ENABLE_STAT4) || \
33632 defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
33633 /*
33634 ** Convert a LogEst into an integer.
33635 **
33636 ** Note that this routine is only used when one or more of various
33637 ** non-standard compile-time options is enabled.
33638 */
33639 SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
33640 u64 n;
33641 n = x%10;
33642 x /= 10;
33643 if( n>=5 ) n -= 2;
33644 else if( n>=1 ) n -= 1;
33645 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
33646 defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
33647 if( x>60 ) return (u64)LARGEST_INT64;
33648 #else
33649 /* If only SQLITE_ENABLE_STAT4 is on, then the largest input
33650 ** possible to this routine is 310, resulting in a maximum x of 31 */
33651 assert( x<=60 );
33652 #endif
33653 return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
33654 }
33655 #endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */
33656
33657 /*
33658 ** Add a new name/number pair to a VList. This might require that the
33659 ** VList object be reallocated, so return the new VList. If an OOM
33660 ** error occurs, the original VList returned and the
@@ -34104,49 +34161,49 @@
34104 /* 58 */ "ElseEq" OpHelp(""),
34105 /* 59 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
34106 /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
34107 /* 61 */ "IncrVacuum" OpHelp(""),
34108 /* 62 */ "VNext" OpHelp(""),
34109 /* 63 */ "Init" OpHelp("Start at P2"),
34110 /* 64 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
34111 /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
34112 /* 66 */ "Return" OpHelp(""),
34113 /* 67 */ "EndCoroutine" OpHelp(""),
34114 /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
34115 /* 69 */ "Halt" OpHelp(""),
34116 /* 70 */ "Integer" OpHelp("r[P2]=P1"),
34117 /* 71 */ "Int64" OpHelp("r[P2]=P4"),
34118 /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
34119 /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"),
34120 /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"),
34121 /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
34122 /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
34123 /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
34124 /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
34125 /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"),
34126 /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
34127 /* 81 */ "ChngCntRow" OpHelp("output=r[P1]"),
34128 /* 82 */ "ResultRow" OpHelp("output=r[P1@P2]"),
34129 /* 83 */ "CollSeq" OpHelp(""),
34130 /* 84 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
34131 /* 85 */ "RealAffinity" OpHelp(""),
34132 /* 86 */ "Cast" OpHelp("affinity(r[P1])"),
34133 /* 87 */ "Permutation" OpHelp(""),
34134 /* 88 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
34135 /* 89 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
34136 /* 90 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
34137 /* 91 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
34138 /* 92 */ "Column" OpHelp("r[P3]=PX"),
34139 /* 93 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
34140 /* 94 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
34141 /* 95 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
34142 /* 96 */ "Count" OpHelp("r[P2]=count()"),
34143 /* 97 */ "ReadCookie" OpHelp(""),
34144 /* 98 */ "SetCookie" OpHelp(""),
34145 /* 99 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
34146 /* 100 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
34147 /* 101 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34148 /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
34149 /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
34150 /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
34151 /* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
34152 /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -34153,80 +34210,82 @@
34153 /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
34154 /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
34155 /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
34156 /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
34157 /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
34158 /* 112 */ "OpenDup" OpHelp(""),
34159 /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34160 /* 114 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34161 /* 115 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34162 /* 116 */ "String8" OpHelp("r[P2]='P4'"),
34163 /* 117 */ "SorterOpen" OpHelp(""),
34164 /* 118 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34165 /* 119 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34166 /* 120 */ "Close" OpHelp(""),
34167 /* 121 */ "ColumnsUsed" OpHelp(""),
34168 /* 122 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
34169 /* 123 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
34170 /* 124 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
34171 /* 125 */ "NewRowid" OpHelp("r[P2]=rowid"),
34172 /* 126 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
34173 /* 127 */ "RowCell" OpHelp(""),
34174 /* 128 */ "Delete" OpHelp(""),
34175 /* 129 */ "ResetCount" OpHelp(""),
34176 /* 130 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
34177 /* 131 */ "SorterData" OpHelp("r[P2]=data"),
34178 /* 132 */ "RowData" OpHelp("r[P2]=data"),
34179 /* 133 */ "Rowid" OpHelp("r[P2]=rowid"),
34180 /* 134 */ "NullRow" OpHelp(""),
34181 /* 135 */ "SeekEnd" OpHelp(""),
34182 /* 136 */ "IdxInsert" OpHelp("key=r[P2]"),
34183 /* 137 */ "SorterInsert" OpHelp("key=r[P2]"),
34184 /* 138 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
34185 /* 139 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
34186 /* 140 */ "IdxRowid" OpHelp("r[P2]=rowid"),
34187 /* 141 */ "FinishSeek" OpHelp(""),
34188 /* 142 */ "Destroy" OpHelp(""),
34189 /* 143 */ "Clear" OpHelp(""),
34190 /* 144 */ "ResetSorter" OpHelp(""),
34191 /* 145 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
34192 /* 146 */ "SqlExec" OpHelp(""),
34193 /* 147 */ "ParseSchema" OpHelp(""),
34194 /* 148 */ "LoadAnalysis" OpHelp(""),
34195 /* 149 */ "DropTable" OpHelp(""),
34196 /* 150 */ "DropIndex" OpHelp(""),
34197 /* 151 */ "DropTrigger" OpHelp(""),
34198 /* 152 */ "Real" OpHelp("r[P2]=P4"),
34199 /* 153 */ "IntegrityCk" OpHelp(""),
34200 /* 154 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34201 /* 155 */ "Param" OpHelp(""),
34202 /* 156 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34203 /* 157 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
34204 /* 158 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
34205 /* 159 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
34206 /* 160 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
34207 /* 161 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
34208 /* 162 */ "AggValue" OpHelp("r[P3]=value N=P2"),
34209 /* 163 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
34210 /* 164 */ "Expire" OpHelp(""),
34211 /* 165 */ "CursorLock" OpHelp(""),
34212 /* 166 */ "CursorUnlock" OpHelp(""),
34213 /* 167 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
34214 /* 168 */ "VBegin" OpHelp(""),
34215 /* 169 */ "VCreate" OpHelp(""),
34216 /* 170 */ "VDestroy" OpHelp(""),
34217 /* 171 */ "VOpen" OpHelp(""),
34218 /* 172 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
34219 /* 173 */ "VRename" OpHelp(""),
34220 /* 174 */ "Pagecount" OpHelp(""),
34221 /* 175 */ "MaxPgcnt" OpHelp(""),
34222 /* 176 */ "Trace" OpHelp(""),
34223 /* 177 */ "CursorHint" OpHelp(""),
34224 /* 178 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
34225 /* 179 */ "Noop" OpHelp(""),
34226 /* 180 */ "Explain" OpHelp(""),
34227 /* 181 */ "Abortable" OpHelp(""),
 
 
34228 };
34229 return azName[i];
34230 }
34231 #endif
34232
@@ -68263,34 +68322,42 @@
68263 /*
68264 ** Make sure pBt->pTmpSpace points to an allocation of
68265 ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
68266 ** pointer.
68267 */
68268 static void allocateTempSpace(BtShared *pBt){
68269 if( !pBt->pTmpSpace ){
68270 pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
68271
68272 /* One of the uses of pBt->pTmpSpace is to format cells before
68273 ** inserting them into a leaf page (function fillInCell()). If
68274 ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
68275 ** by the various routines that manipulate binary cells. Which
68276 ** can mean that fillInCell() only initializes the first 2 or 3
68277 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
68278 ** it into a database page. This is not actually a problem, but it
68279 ** does cause a valgrind error when the 1 or 2 bytes of unitialized
68280 ** data is passed to system call write(). So to avoid this error,
68281 ** zero the first 4 bytes of temp space here.
68282 **
68283 ** Also: Provide four bytes of initialized space before the
68284 ** beginning of pTmpSpace as an area available to prepend the
68285 ** left-child pointer to the beginning of a cell.
68286 */
68287 if( pBt->pTmpSpace ){
68288 memset(pBt->pTmpSpace, 0, 8);
68289 pBt->pTmpSpace += 4;
68290 }
68291 }
 
 
 
 
 
 
 
 
68292 }
68293
68294 /*
68295 ** Free the pBt->pTmpSpace allocation
68296 */
@@ -70027,14 +70094,10 @@
70027 assert( p->inTrans>TRANS_NONE );
70028 assert( wrFlag==0 || p->inTrans==TRANS_WRITE );
70029 assert( pBt->pPage1 && pBt->pPage1->aData );
70030 assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );
70031
70032 if( wrFlag ){
70033 allocateTempSpace(pBt);
70034 if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
70035 }
70036 if( iTable<=1 ){
70037 if( iTable<1 ){
70038 return SQLITE_CORRUPT_BKPT;
70039 }else if( btreePagecount(pBt)==0 ){
70040 assert( wrFlag==0 );
@@ -70047,23 +70110,29 @@
70047 pCur->pgnoRoot = iTable;
70048 pCur->iPage = -1;
70049 pCur->pKeyInfo = pKeyInfo;
70050 pCur->pBtree = p;
70051 pCur->pBt = pBt;
70052 pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0;
70053 pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY;
70054 /* If there are two or more cursors on the same btree, then all such
70055 ** cursors *must* have the BTCF_Multiple flag set. */
70056 for(pX=pBt->pCursor; pX; pX=pX->pNext){
70057 if( pX->pgnoRoot==iTable ){
70058 pX->curFlags |= BTCF_Multiple;
70059 pCur->curFlags |= BTCF_Multiple;
70060 }
70061 }
 
70062 pCur->pNext = pBt->pCursor;
70063 pBt->pCursor = pCur;
70064 pCur->eState = CURSOR_INVALID;
 
 
 
 
 
 
70065 return SQLITE_OK;
70066 }
70067 static int btreeCursorWithLock(
70068 Btree *p, /* The btree */
70069 Pgno iTable, /* Root page of table to open */
@@ -77812,16 +77881,16 @@
77812 ** it into an integer and return that. If pMem represents an
77813 ** an SQL-NULL value, return 0.
77814 **
77815 ** If pMem represents a string value, its encoding might be changed.
77816 */
77817 static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){
77818 i64 value = 0;
77819 sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
77820 return value;
77821 }
77822 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
77823 int flags;
77824 assert( pMem!=0 );
77825 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
77826 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
77827 flags = pMem->flags;
@@ -87366,10 +87435,35 @@
87366 }else{
87367 pOut->flags = MEM_Int;
87368 return pOut;
87369 }
87370 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87371
87372 /*
87373 ** Return the symbolic name for the data type of a pMem
87374 */
87375 static const char *vdbeMemTypeName(Mem *pMem){
@@ -88021,16 +88115,22 @@
88021
88022 /* Opcode: Blob P1 P2 * P4 *
88023 ** Synopsis: r[P2]=P4 (len=P1)
88024 **
88025 ** P4 points to a blob of data P1 bytes long. Store this
88026 ** blob in register P2.
 
88027 */
88028 case OP_Blob: { /* out2 */
88029 assert( pOp->p1 <= SQLITE_MAX_LENGTH );
88030 pOut = out2Prerelease(p, pOp);
88031 sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
 
 
 
 
 
88032 pOut->enc = encoding;
88033 UPDATE_MAX_BLOBSIZE(pOut);
88034 break;
88035 }
88036
@@ -88175,28 +88275,26 @@
88175 pOut = &aMem[pOp->p2];
88176 sqlite3VdbeMemSetInt64(pOut, pIn1->u.i);
88177 break;
88178 }
88179
88180 /* Opcode: ChngCntRow P1 P2 * * *
88181 ** Synopsis: output=r[P1]
88182 **
88183 ** Output value in register P1 as the chance count for a DML statement,
88184 ** due to the "PRAGMA count_changes=ON" setting. Or, if there was a
88185 ** foreign key error in the statement, trigger the error now.
88186 **
88187 ** This opcode is a variant of OP_ResultRow that checks the foreign key
88188 ** immediate constraint count and throws an error if the count is
88189 ** non-zero. The P2 opcode must be 1.
88190 */
88191 case OP_ChngCntRow: {
88192 assert( pOp->p2==1 );
88193 if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){
88194 goto abort_due_to_error;
88195 }
88196 /* Fall through to the next case, OP_ResultRow */
88197 /* no break */ deliberate_fall_through
88198 }
88199
88200 /* Opcode: ResultRow P1 P2 * * *
88201 ** Synopsis: output=r[P1@P2]
88202 **
@@ -90039,11 +90137,11 @@
90039 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
90040 REGISTER_TRACE(pOp->p3, pOut);
90041 break;
90042 }
90043
90044 /* Opcode: Count P1 P2 p3 * *
90045 ** Synopsis: r[P2]=count()
90046 **
90047 ** Store the number of entries (an integer value) in the table or index
90048 ** opened by cursor P1 in register P2.
90049 **
@@ -94824,10 +94922,81 @@
94824
94825 REGISTER_TRACE(pOp->p3, pOut);
94826 UPDATE_MAX_BLOBSIZE(pOut);
94827 break;
94828 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94829
94830 /* Opcode: Trace P1 P2 * P4 *
94831 **
94832 ** Write P4 on the statement trace output if statement tracing is
94833 ** enabled.
@@ -104083,11 +104252,11 @@
104083 case TK_COLUMN:
104084 assert( ExprUseYTab(p) );
104085 return ExprHasProperty(p, EP_CanBeNull) ||
104086 p->y.pTab==0 || /* Reference to column of index on expression */
104087 (p->iColumn>=0
104088 && ALWAYS(p->y.pTab->aCol!=0) /* Defense against OOM problems */
104089 && p->y.pTab->aCol[p->iColumn].notNull==0);
104090 default:
104091 return 1;
104092 }
104093 }
@@ -107514,11 +107683,11 @@
107514 ** implement sqlite3ReferencesSrcList().
107515 */
107516 struct RefSrcList {
107517 sqlite3 *db; /* Database connection used for sqlite3DbRealloc() */
107518 SrcList *pRef; /* Looking for references to these tables */
107519 int nExclude; /* Number of tables to exclude from the search */
107520 int *aiExclude; /* Cursor IDs for tables to exclude from the search */
107521 };
107522
107523 /*
107524 ** Walker SELECT callbacks for sqlite3ReferencesSrcList().
@@ -107529,11 +107698,12 @@
107529 ** When leaving the subquery, remove those entries from the exclude list.
107530 */
107531 static int selectRefEnter(Walker *pWalker, Select *pSelect){
107532 struct RefSrcList *p = pWalker->u.pRefSrcList;
107533 SrcList *pSrc = pSelect->pSrc;
107534 int i, j, *piNew;
 
107535 if( pSrc->nSrc==0 ) return WRC_Continue;
107536 j = p->nExclude;
107537 p->nExclude += pSrc->nSrc;
107538 piNew = sqlite3DbRealloc(p->db, p->aiExclude, p->nExclude*sizeof(int));
107539 if( piNew==0 ){
@@ -113192,10 +113362,11 @@
113192 int reg;
113193
113194 if( pReturning->nRetCol==0 ){
113195 assert( CORRUPT_DB );
113196 }else{
 
113197 addrRewind =
113198 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
113199 VdbeCoverage(v);
113200 reg = pReturning->iRetReg;
113201 for(i=0; i<pReturning->nRetCol; i++){
@@ -113761,12 +113932,12 @@
113761 SQLITE_PRIVATE void sqlite3ColumnSetColl(
113762 sqlite3 *db,
113763 Column *pCol,
113764 const char *zColl
113765 ){
113766 int nColl;
113767 int n;
113768 char *zNew;
113769 assert( zColl!=0 );
113770 n = sqlite3Strlen30(pCol->zCnName) + 1;
113771 if( pCol->colFlags & COLFLAG_HASTYPE ){
113772 n += sqlite3Strlen30(pCol->zCnName+n) + 1;
@@ -114567,11 +114738,11 @@
114567 break;
114568 }
114569 }
114570 }
114571
114572 z = sqlite3DbMallocRaw(db, sName.n + 1 + sType.n + (sType.n>0) );
114573 if( z==0 ) return;
114574 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName);
114575 memcpy(z, sName.z, sName.n);
114576 z[sName.n] = 0;
114577 sqlite3Dequote(z);
@@ -114581,11 +114752,11 @@
114581 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
114582 sqlite3DbFree(db, z);
114583 return;
114584 }
114585 }
114586 aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+1)*sizeof(p->aCol[0]));
114587 if( aNew==0 ){
114588 sqlite3DbFree(db, z);
114589 return;
114590 }
114591 p->aCol = aNew;
@@ -116594,11 +116765,11 @@
116594 sqlite3 *db = pParse->db;
116595 #ifndef SQLITE_OMIT_FOREIGN_KEY
116596 FKey *pFKey = 0;
116597 FKey *pNextTo;
116598 Table *p = pParse->pNewTable;
116599 int nByte;
116600 int i;
116601 int nCol;
116602 char *z;
116603
116604 assert( pTo!=0 );
@@ -117424,17 +117595,17 @@
117424 }
117425
117426 /* Add an entry in sqlite_schema for this index
117427 */
117428 sqlite3NestedParse(pParse,
117429 "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",
117430 db->aDb[iDb].zDbSName,
117431 pIndex->zName,
117432 pTab->zName,
117433 iMem,
117434 zStmt
117435 );
117436 sqlite3DbFree(db, zStmt);
117437
117438 /* Fill the index with data and reparse the schema. Code an OP_Expire
117439 ** to invalidate all pre-compiled statements.
117440 */
@@ -117978,11 +118149,11 @@
117978 pItem->pSelect = pSubquery;
117979 pItem->pOn = pOn;
117980 pItem->pUsing = pUsing;
117981 return p;
117982
117983 append_from_error:
117984 assert( p==0 );
117985 sqlite3ExprDelete(db, pOn);
117986 sqlite3IdListDelete(db, pUsing);
117987 sqlite3SelectDelete(db, pSubquery);
117988 return 0;
@@ -119234,10 +119405,20 @@
119234 pTab = 0;
119235 }
119236 }
119237 return pTab;
119238 }
 
 
 
 
 
 
 
 
 
 
119239
119240 /* Return true if table pTab is read-only.
119241 **
119242 ** A table is read-only if any of the following are true:
119243 **
@@ -119810,13 +119991,11 @@
119810 /* Return the number of rows that were deleted. If this routine is
119811 ** generating code because of a call to sqlite3NestedParse(), do not
119812 ** invoke the callback function.
119813 */
119814 if( memCnt ){
119815 sqlite3VdbeAddOp2(v, OP_ChngCntRow, memCnt, 1);
119816 sqlite3VdbeSetNumCols(v, 1);
119817 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
119818 }
119819
119820 delete_from_cleanup:
119821 sqlite3AuthContextPop(&sContext);
119822 sqlite3SrcListDelete(db, pTabList);
@@ -125370,13 +125549,11 @@
125370 ** Return the number of rows inserted. If this routine is
125371 ** generating code because of a call to sqlite3NestedParse(), do not
125372 ** invoke the callback function.
125373 */
125374 if( regRowCount ){
125375 sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
125376 sqlite3VdbeSetNumCols(v, 1);
125377 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
125378 }
125379
125380 insert_cleanup:
125381 sqlite3SrcListDelete(db, pTabList);
125382 sqlite3ExprListDelete(db, pList);
@@ -133002,10 +133179,11 @@
133002 /* Make multiple attempts to compile the SQL, until it either succeeds
133003 ** or encounters a permanent error. A schema problem after one schema
133004 ** reset is considered a permanent error. */
133005 rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
133006 assert( rc==SQLITE_OK || *ppStmt==0 );
 
133007 }while( rc==SQLITE_ERROR_RETRY
133008 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
133009 sqlite3BtreeLeaveAll(db);
133010 rc = sqlite3ApiExit(db, rc);
133011 assert( (rc&db->errMask)==rc );
@@ -135418,11 +135596,11 @@
135418 memset(&sNC, 0, sizeof(sNC));
135419 sNC.pSrcList = pSelect->pSrc;
135420 a = pSelect->pEList->a;
135421 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
135422 const char *zType;
135423 int n, m;
135424 pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
135425 p = a[i].pExpr;
135426 zType = columnType(&sNC, p, 0, 0, 0);
135427 /* pCol->szEst = ... // Column size est for SELECT tables never used */
135428 pCol->affinity = sqlite3ExprAffinity(p);
@@ -137404,11 +137582,11 @@
137404 /* Restriction (23) */
137405 if( (p->selFlags & SF_Recursive) ) return 0;
137406
137407 if( pSrc->nSrc>1 ){
137408 if( pParse->nSelect>500 ) return 0;
137409 aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+1)*sizeof(int));
137410 if( aCsrMap ) aCsrMap[0] = pParse->nTab;
137411 }
137412 }
137413
137414 /***** If we reach this point, flattening is permitted. *****/
@@ -138175,15 +138353,15 @@
138175 **
138176 ** where table is a database table, not a sub-select or view. If the query
138177 ** does match this pattern, then a pointer to the Table object representing
138178 ** <tbl> is returned. Otherwise, NULL is returned.
138179 **
138180 ** This routine a condition for the count optimization. A correct answer
138181 ** is obtained (though perhaps more slowly) if this routine returns NULL when
138182 ** it could have returned a table pointer. But returning the pointer when
138183 ** NULL should have been returned can result in incorrect answers and/or
138184 ** crashes. So, when in doubt, return NULL.
138185 */
138186 static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
138187 Table *pTab;
138188 Expr *pExpr;
138189
@@ -143493,13 +143671,11 @@
143493 /*
143494 ** Return the number of rows that were changed, if we are tracking
143495 ** that information.
143496 */
143497 if( regRowCount ){
143498 sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
143499 sqlite3VdbeSetNumCols(v, 1);
143500 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
143501 }
143502
143503 update_cleanup:
143504 sqlite3AuthContextPop(&sContext);
143505 sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */
@@ -145869,10 +146045,11 @@
145869 int addrBignull; /* Jump here for next part of big-null scan */
145870 #ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS
145871 u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */
145872 int addrLikeRep; /* LIKE range processing address */
145873 #endif
 
145874 u8 iFrom; /* Which entry in the FROM clause */
145875 u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
145876 int p1, p2; /* Operands of the opcode used to end the loop */
145877 union { /* Information that depends on pWLoop->wsFlags */
145878 struct {
@@ -146097,15 +146274,15 @@
146097 struct WhereScan {
146098 WhereClause *pOrigWC; /* Original, innermost WhereClause */
146099 WhereClause *pWC; /* WhereClause currently being scanned */
146100 const char *zCollName; /* Required collating sequence, if not NULL */
146101 Expr *pIdxExpr; /* Search for this index expression */
146102 char idxaff; /* Must match this affinity, if zCollName!=NULL */
146103 unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */
146104 unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */
146105 u32 opMask; /* Acceptable operators */
146106 int k; /* Resume scanning at this->pWC->a[this->k] */
 
 
146107 int aiCur[11]; /* Cursors in the equivalence class */
146108 i16 aiColumn[11]; /* Corresponding column number in the eq-class */
146109 };
146110
146111 /*
@@ -146125,10 +146302,11 @@
146125 WhereClause *pOuter; /* Outer conjunction */
146126 u8 op; /* Split operator. TK_AND or TK_OR */
146127 u8 hasOr; /* True if any a[].eOperator is WO_OR */
146128 int nTerm; /* Number of terms */
146129 int nSlot; /* Number of entries in a[] */
 
146130 WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */
146131 #if defined(SQLITE_SMALL_STACK)
146132 WhereTerm aStatic[1]; /* Initial static space for a[] */
146133 #else
146134 WhereTerm aStatic[8]; /* Initial static space for a[] */
@@ -146182,15 +146360,10 @@
146182 int bVarSelect; /* Used by sqlite3WhereExprUsage() */
146183 int n; /* Number of assigned cursor values */
146184 int ix[BMS]; /* Cursor assigned to each bit */
146185 };
146186
146187 /*
146188 ** Initialize a WhereMaskSet object
146189 */
146190 #define initMaskSet(P) (P)->n=0
146191
146192 /*
146193 ** This object is a convenience wrapper holding all information needed
146194 ** to construct WhereLoop objects for a particular query.
146195 */
146196 struct WhereLoopBuilder {
@@ -146315,12 +146488,18 @@
146315 Parse *pParse, /* Parse context */
146316 SrcList *pTabList, /* Table list this loop refers to */
146317 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
146318 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
146319 );
 
 
 
 
 
146320 #else
146321 # define sqlite3WhereExplainOneScan(u,v,w,x) 0
 
146322 #endif /* SQLITE_OMIT_EXPLAIN */
146323 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146324 SQLITE_PRIVATE void sqlite3WhereAddScanStatus(
146325 Vdbe *v, /* Vdbe to add scanstatus entry to */
146326 SrcList *pSrclist, /* FROM clause pLvl reads data from */
@@ -146409,10 +146588,12 @@
146409 #define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
146410 #define WHERE_IN_EARLYOUT 0x00040000 /* Perhaps quit IN loops early */
146411 #define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */
146412 #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */
146413 #define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */
 
 
146414
146415 #endif /* !defined(SQLITE_WHEREINT_H) */
146416
146417 /************** End of whereInt.h ********************************************/
146418 /************** Continuing where we left off in wherecode.c ******************/
@@ -146571,23 +146752,31 @@
146571 sqlite3_str_append(&str, " USING ", 7);
146572 sqlite3_str_appendf(&str, zFmt, pIdx->zName);
146573 explainIndexRange(&str, pLoop);
146574 }
146575 }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
146576 const char *zRangeOp;
 
 
 
 
 
 
 
 
146577 if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){
146578 zRangeOp = "=";
146579 }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){
146580 zRangeOp = ">? AND rowid<";
 
146581 }else if( flags&WHERE_BTM_LIMIT ){
146582 zRangeOp = ">";
146583 }else{
146584 assert( flags&WHERE_TOP_LIMIT);
146585 zRangeOp = "<";
146586 }
146587 sqlite3_str_appendf(&str,
146588 " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
146589 }
146590 #ifndef SQLITE_OMIT_VIRTUALTABLE
146591 else if( (flags & WHERE_VIRTUALTABLE)!=0 ){
146592 sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s",
146593 pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
@@ -146606,10 +146795,60 @@
146606 ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
146607 pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
146608 }
146609 return ret;
146610 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146611 #endif /* SQLITE_OMIT_EXPLAIN */
146612
146613 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146614 /*
146615 ** Configure the VM passed as the first argument with an
@@ -147365,11 +147604,11 @@
147365 sHint.pIdx = pLoop->u.btree.pIndex;
147366 memset(&sWalker, 0, sizeof(sWalker));
147367 sWalker.pParse = pParse;
147368 sWalker.u.pCCurHint = &sHint;
147369 pWC = &pWInfo->sWC;
147370 for(i=0; i<pWC->nTerm; i++){
147371 pTerm = &pWC->a[i];
147372 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
147373 if( pTerm->prereqAll & pLevel->notReady ) continue;
147374
147375 /* Any terms specified as part of the ON(...) clause for any LEFT
@@ -147695,10 +147934,67 @@
147695 if( sqlite3ExprCompare(0, pExpr, pTruth, iTabCur)==0 ){
147696 pTerm->wtFlags |= TERM_CODED;
147697 }
147698 }
147699 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147700
147701 /*
147702 ** Generate code for the start of the iLevel-th loop in the WHERE clause
147703 ** implementation described by pWInfo.
147704 */
@@ -147906,10 +148202,16 @@
147906 testcase( pTerm->wtFlags & TERM_VIRTUAL );
147907 iReleaseReg = ++pParse->nMem;
147908 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
147909 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
147910 addrNxt = pLevel->addrNxt;
 
 
 
 
 
 
147911 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
147912 VdbeCoverage(v);
147913 pLevel->op = OP_Noop;
147914 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
147915 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
@@ -148231,10 +148533,16 @@
148231 }else{
148232 if( regBignull ){
148233 sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
148234 VdbeComment((v, "NULL-scan pass ctr"));
148235 }
 
 
 
 
 
 
148236
148237 op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
148238 assert( op!=0 );
148239 if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 && op==OP_SeekGE ){
148240 assert( regBignull==0 );
@@ -148862,11 +149170,11 @@
148862 ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
148863 ** and we are coding the t1 loop and the t2 loop has not yet coded,
148864 ** then we cannot use the "t1.a=t2.b" constraint, but we can code
148865 ** the implied "t1.a=123" constraint.
148866 */
148867 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
148868 Expr *pE, sEAlt;
148869 WhereTerm *pAlt;
148870 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
148871 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
148872 if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
@@ -148907,11 +149215,11 @@
148907 */
148908 if( pLevel->iLeftJoin ){
148909 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
148910 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
148911 VdbeComment((v, "record LEFT JOIN hit"));
148912 for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
148913 testcase( pTerm->wtFlags & TERM_VIRTUAL );
148914 testcase( pTerm->wtFlags & TERM_CODED );
148915 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
148916 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
148917 assert( pWInfo->untestedTerms );
@@ -149018,10 +149326,11 @@
149018 sqlite3DbFree(db, pOld);
149019 }
149020 pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
149021 }
149022 pTerm = &pWC->a[idx = pWC->nTerm++];
 
149023 if( p && ExprHasProperty(p, EP_Unlikely) ){
149024 pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
149025 }else{
149026 pTerm->truthProb = 1;
149027 }
@@ -150009,14 +150318,17 @@
150009 int nLeft; /* Number of elements on left side vector */
150010
150011 if( db->mallocFailed ){
150012 return;
150013 }
 
150014 pTerm = &pWC->a[idxTerm];
150015 pMaskSet = &pWInfo->sMaskSet;
150016 pExpr = pTerm->pExpr;
 
150017 assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );
 
150018 prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft);
150019 op = pExpr->op;
150020 if( op==TK_IN ){
150021 assert( pExpr->pRight==0 );
150022 if( sqlite3ExprCheckIN(pParse, pExpr) ) return;
@@ -150023,18 +150335,32 @@
150023 if( ExprUseXSelect(pExpr) ){
150024 pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect);
150025 }else{
150026 pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList);
150027 }
150028 }else if( op==TK_ISNULL ){
150029 pTerm->prereqRight = 0;
150030 }else{
150031 pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
 
 
 
 
 
 
 
 
150032 }
150033 pMaskSet->bVarSelect = 0;
150034 prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr);
150035 if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
 
 
 
 
 
 
 
 
 
150036 if( ExprHasProperty(pExpr, EP_FromJoin) ){
150037 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
150038 prereqAll |= x;
150039 extraRight = x-1; /* ON clause terms may not be used with an index
150040 ** on left table of a LEFT JOIN. Ticket #3015 */
@@ -150454,10 +150780,11 @@
150454 ){
150455 pWC->pWInfo = pWInfo;
150456 pWC->hasOr = 0;
150457 pWC->pOuter = 0;
150458 pWC->nTerm = 0;
 
150459 pWC->nSlot = ArraySize(pWC->aStatic);
150460 pWC->a = pWC->aStatic;
150461 }
150462
150463 /*
@@ -150464,21 +150791,37 @@
150464 ** Deallocate a WhereClause structure. The WhereClause structure
150465 ** itself is not freed. This routine is the inverse of
150466 ** sqlite3WhereClauseInit().
150467 */
150468 SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){
150469 int i;
150470 WhereTerm *a;
150471 sqlite3 *db = pWC->pWInfo->pParse->db;
150472 for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){
150473 if( a->wtFlags & TERM_DYNAMIC ){
150474 sqlite3ExprDelete(db, a->pExpr);
150475 }
150476 if( a->wtFlags & TERM_ORINFO ){
150477 whereOrInfoDelete(db, a->u.pOrInfo);
150478 }else if( a->wtFlags & TERM_ANDINFO ){
150479 whereAndInfoDelete(db, a->u.pAndInfo);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150480 }
150481 }
150482 if( pWC->a!=pWC->aStatic ){
150483 sqlite3DbFree(db, pWC->a);
150484 }
@@ -150487,19 +150830,42 @@
150487
150488 /*
150489 ** These routines walk (recursively) an expression tree and generate
150490 ** a bitmask indicating which tables are used in that expression
150491 ** tree.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150492 */
150493 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
 
 
 
150494 Bitmask mask;
150495 if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
150496 return sqlite3WhereGetMask(pMaskSet, p->iTable);
150497 }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
150498 assert( p->op!=TK_IF_NULL_ROW );
150499 return 0;
150500 }
150501 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
150502 if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft);
150503 if( p->pRight ){
150504 mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pRight);
150505 assert( p->x.pList==0 );
@@ -150516,10 +150882,19 @@
150516 mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy);
150517 mask |= sqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter);
150518 }
150519 #endif
150520 return mask;
 
 
 
 
 
 
 
 
 
150521 }
150522 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){
150523 return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0;
150524 }
150525 SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){
@@ -150834,11 +151209,16 @@
150834 ** iCursor is not in the set.
150835 */
150836 SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){
150837 int i;
150838 assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );
150839 for(i=0; i<pMaskSet->n; i++){
 
 
 
 
 
150840 if( pMaskSet->ix[i]==iCursor ){
150841 return MASKBIT(i);
150842 }
150843 }
150844 return 0;
@@ -151019,20 +151399,20 @@
151019 pScan->nEquiv = 1;
151020 pScan->iEquiv = 1;
151021 if( pIdx ){
151022 int j = iColumn;
151023 iColumn = pIdx->aiColumn[j];
151024 if( iColumn==XN_EXPR ){
 
 
 
 
 
151025 pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
151026 pScan->zCollName = pIdx->azColl[j];
151027 pScan->aiColumn[0] = XN_EXPR;
151028 return whereScanInitIndexExpr(pScan);
151029 }else if( iColumn==pIdx->pTable->iPKey ){
151030 iColumn = XN_ROWID;
151031 }else if( iColumn>=0 ){
151032 pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
151033 pScan->zCollName = pIdx->azColl[j];
151034 }
151035 }else if( iColumn==XN_EXPR ){
151036 return 0;
151037 }
151038 pScan->aiColumn[0] = iColumn;
@@ -151312,13 +151692,13 @@
151312 ** Return TRUE if the WHERE clause term pTerm is of a form where it
151313 ** could be used with an index to access pSrc, assuming an appropriate
151314 ** index existed.
151315 */
151316 static int termCanDriveIndex(
151317 WhereTerm *pTerm, /* WHERE clause term to check */
151318 SrcItem *pSrc, /* Table we are trying to access */
151319 Bitmask notReady /* Tables in outer loops of the join */
151320 ){
151321 char aff;
151322 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
151323 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
151324 if( (pSrc->fg.jointype & JT_LEFT)
@@ -151345,15 +151725,15 @@
151345 /*
151346 ** Generate code to construct the Index object for an automatic index
151347 ** and to set up the WhereLevel object pLevel so that the code generator
151348 ** makes use of the automatic index.
151349 */
151350 static void constructAutomaticIndex(
151351 Parse *pParse, /* The parsing context */
151352 WhereClause *pWC, /* The WHERE clause */
151353 SrcItem *pSrc, /* The FROM clause term to get the next index */
151354 Bitmask notReady, /* Mask of cursors that are not available */
151355 WhereLevel *pLevel /* Write new index here */
151356 ){
151357 int nKeyCol; /* Number of columns in the constructed index */
151358 WhereTerm *pTerm; /* A single term of the WHERE clause */
151359 WhereTerm *pWCEnd; /* End of pWC->a[] */
@@ -151391,17 +151771,17 @@
151391 pWCEnd = &pWC->a[pWC->nTerm];
151392 pLoop = pLevel->pWLoop;
151393 idxCols = 0;
151394 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
151395 Expr *pExpr = pTerm->pExpr;
151396 assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
151397 || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
151398 || pLoop->prereq!=0 ); /* table of a LEFT JOIN */
151399 if( pLoop->prereq==0
151400 && (pTerm->wtFlags & TERM_VIRTUAL)==0
151401 && !ExprHasProperty(pExpr, EP_FromJoin)
151402 && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
151403 pPartial = sqlite3ExprAnd(pParse, pPartial,
151404 sqlite3ExprDup(pParse->db, pExpr, 0));
151405 }
151406 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
151407 int iCol;
@@ -151504,10 +151884,14 @@
151504 assert( pLevel->iIdxCur>=0 );
151505 pLevel->iIdxCur = pParse->nTab++;
151506 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
151507 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
151508 VdbeComment((v, "for %s", pTable->zName));
 
 
 
 
151509
151510 /* Fill the automatic index with content */
151511 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
151512 if( pTabItem->fg.viaCoroutine ){
151513 int regYield = pTabItem->regReturn;
@@ -151526,10 +151910,14 @@
151526 }
151527 regRecord = sqlite3GetTempReg(pParse);
151528 regBase = sqlite3GenerateIndexKey(
151529 pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
151530 );
 
 
 
 
151531 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
151532 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
151533 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
151534 if( pTabItem->fg.viaCoroutine ){
151535 sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
@@ -151551,10 +151939,127 @@
151551
151552 end_auto_index_create:
151553 sqlite3ExprDelete(pParse->db, pPartial);
151554 }
151555 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151556
151557 #ifndef SQLITE_OMIT_VIRTUALTABLE
151558 /*
151559 ** Allocate and populate an sqlite3_index_info structure. It is the
151560 ** responsibility of the caller to eventually release the structure
@@ -152494,13 +152999,13 @@
152494 }
152495 sqlite3DebugPrintf(" %-19s", z);
152496 sqlite3_free(z);
152497 }
152498 if( p->wsFlags & WHERE_SKIPSCAN ){
152499 sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
152500 }else{
152501 sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
152502 }
152503 sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
152504 if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
152505 int i;
152506 for(i=0; i<p->nLTerm; i++){
@@ -152956,22 +153461,29 @@
152956 Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
152957 int i, j;
152958 LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
152959
152960 assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
152961 for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
152962 assert( pTerm!=0 );
152963 if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
152964 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
152965 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
152966 for(j=pLoop->nLTerm-1; j>=0; j--){
152967 pX = pLoop->aLTerm[j];
152968 if( pX==0 ) continue;
152969 if( pX==pTerm ) break;
152970 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
152971 }
152972 if( j<0 ){
 
 
 
 
 
 
 
152973 if( pTerm->truthProb<=0 ){
152974 /* If a truth probability is specified using the likelihood() hints,
152975 ** then use the probability provided by the application. */
152976 pLoop->nOut += pTerm->truthProb;
152977 }else{
@@ -152995,11 +153507,13 @@
152995 }
152996 }
152997 }
152998 }
152999 }
153000 if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
 
 
153001 }
153002
153003 /*
153004 ** Term pTerm is a vector range comparison operation. The first comparison
153005 ** in the vector can be optimized using column nEq of the index. This
@@ -154231,10 +154745,11 @@
154231 }else if( pOrTerm->leftCursor==iCur ){
154232 tempWC.pWInfo = pWC->pWInfo;
154233 tempWC.pOuter = pWC;
154234 tempWC.op = TK_AND;
154235 tempWC.nTerm = 1;
 
154236 tempWC.a = pOrTerm;
154237 sSubBuild.pWC = &tempWC;
154238 }else{
154239 continue;
154240 }
@@ -155337,10 +155852,154 @@
155337 }
155338 # define WHERETRACE_ALL_LOOPS(W,C) showAllWhereLoops(W,C)
155339 #else
155340 # define WHERETRACE_ALL_LOOPS(W,C)
155341 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155342
155343 /*
155344 ** Generate the beginning of the loop used for WHERE clause processing.
155345 ** The return value is a pointer to an opaque structure that contains
155346 ** information needed to terminate the loop. Later, the calling routine
@@ -155468,16 +156127,10 @@
155468 /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
155469 testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
155470 if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
155471 sWLB.pOrderBy = pOrderBy;
155472
155473 /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
155474 ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
155475 if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
155476 wctrlFlags &= ~WHERE_WANT_DISTINCT;
155477 }
155478
155479 /* The number of tables in the FROM clause is limited by the number of
155480 ** bits in a Bitmask
155481 */
155482 testcase( pTabList->nSrc==BMS );
155483 if( pTabList->nSrc>BMS ){
@@ -155520,10 +156173,14 @@
155520 memset(&pWInfo->nOBSat, 0,
155521 offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));
155522 memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));
155523 assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */
155524 pMaskSet = &pWInfo->sMaskSet;
 
 
 
 
155525 sWLB.pWInfo = pWInfo;
155526 sWLB.pWC = &pWInfo->sWC;
155527 sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);
155528 assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );
155529 whereLoopInit(sWLB.pNew);
@@ -155532,19 +156189,20 @@
155532 #endif
155533
155534 /* Split the WHERE clause into separate subexpressions where each
155535 ** subexpression is separated by an AND operator.
155536 */
155537 initMaskSet(pMaskSet);
155538 sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
155539 sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
155540
155541 /* Special case: No FROM clause
155542 */
155543 if( nTabList==0 ){
155544 if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;
155545 if( wctrlFlags & WHERE_WANT_DISTINCT ){
 
 
155546 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
155547 }
155548 ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
155549 }else{
155550 /* Assign a bit from the bitmask to every term in the FROM clause.
@@ -155591,21 +156249,26 @@
155591 ** preserves SQLite's legacy behaviour in the following two cases:
155592 **
155593 ** FROM ... WHERE random()>0; -- eval random() once per row
155594 ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
155595 */
155596 for(ii=0; ii<sWLB.pWC->nTerm; ii++){
155597 WhereTerm *pT = &sWLB.pWC->a[ii];
155598 if( pT->wtFlags & TERM_VIRTUAL ) continue;
155599 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
155600 sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL);
155601 pT->wtFlags |= TERM_CODED;
155602 }
155603 }
155604
155605 if( wctrlFlags & WHERE_WANT_DISTINCT ){
155606 if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
 
 
 
 
 
155607 /* The DISTINCT marking is pointless. Ignore it. */
155608 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
155609 }else if( pOrderBy==0 ){
155610 /* Try to ORDER BY the result set to make distinct processing easier */
155611 pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
@@ -155702,88 +156365,40 @@
155702 sqlite3WhereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC);
155703 }
155704 }
155705 #endif
155706
155707 /* Attempt to omit tables from the join that do not affect the result.
155708 ** For a table to not affect the result, the following must be true:
155709 **
155710 ** 1) The query must not be an aggregate.
155711 ** 2) The table must be the RHS of a LEFT JOIN.
155712 ** 3) Either the query must be DISTINCT, or else the ON or USING clause
155713 ** must contain a constraint that limits the scan of the table to
155714 ** at most a single row.
155715 ** 4) The table must not be referenced by any part of the query apart
155716 ** from its own USING or ON clause.
155717 **
155718 ** For example, given:
155719 **
155720 ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1);
155721 ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2);
155722 ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3);
155723 **
155724 ** then table t2 can be omitted from the following:
155725 **
155726 ** SELECT v1, v3 FROM t1
155727 ** LEFT JOIN t2 ON (t1.ipk=t2.ipk)
155728 ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155729 **
155730 ** or from:
155731 **
155732 ** SELECT DISTINCT v1, v3 FROM t1
155733 ** LEFT JOIN t2
155734 ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155735 */
155736 notReady = ~(Bitmask)0;
155737 if( pWInfo->nLevel>=2
155738 && pResultSet!=0 /* these two combine to guarantee */
155739 && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */
155740 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
155741 ){
155742 int i;
155743 Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet);
155744 if( sWLB.pOrderBy ){
155745 tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
155746 }
155747 for(i=pWInfo->nLevel-1; i>=1; i--){
155748 WhereTerm *pTerm, *pEnd;
155749 SrcItem *pItem;
155750 pLoop = pWInfo->a[i].pWLoop;
155751 pItem = &pWInfo->pTabList->a[pLoop->iTab];
155752 if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
155753 if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
155754 && (pLoop->wsFlags & WHERE_ONEROW)==0
155755 ){
155756 continue;
155757 }
155758 if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
155759 pEnd = sWLB.pWC->a + sWLB.pWC->nTerm;
155760 for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
155761 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155762 if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
155763 || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
155764 ){
155765 break;
155766 }
155767 }
155768 }
155769 if( pTerm<pEnd ) continue;
155770 WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
155771 notReady &= ~pLoop->maskSelf;
155772 for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
155773 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155774 pTerm->wtFlags |= TERM_CODED;
155775 }
155776 }
155777 if( i!=pWInfo->nLevel-1 ){
155778 int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
155779 memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
155780 }
155781 pWInfo->nLevel--;
155782 nTabList--;
155783 }
155784 }
155785 #if defined(WHERETRACE_ENABLED)
155786 if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
155787 sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n");
155788 sqlite3WhereClausePrint(sWLB.pWC);
155789 }
@@ -155968,17 +156583,21 @@
155968 int addrExplain;
155969 int wsFlags;
155970 if( pParse->nErr ) goto whereBeginError;
155971 pLevel = &pWInfo->a[ii];
155972 wsFlags = pLevel->pWLoop->wsFlags;
 
 
155973 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
155974 if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
155975 constructAutomaticIndex(pParse, &pWInfo->sWC,
155976 &pTabList->a[pLevel->iFrom], notReady, pLevel);
 
 
 
155977 if( db->mallocFailed ) goto whereBeginError;
155978 }
155979 #endif
155980 addrExplain = sqlite3WhereExplainOneScan(
155981 pParse, pTabList, pLevel, wctrlFlags
155982 );
155983 pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
155984 notReady = sqlite3WhereCodeOneLoopStart(pParse,v,pWInfo,ii,pLevel,notReady);
@@ -159701,14 +160320,14 @@
159701 #define TK_DETACH 40
159702 #define TK_EACH 41
159703 #define TK_FAIL 42
159704 #define TK_OR 43
159705 #define TK_AND 44
159706 #define TK_IS 45
159707 #define TK_MATCH 46
159708 #define TK_LIKE_KW 47
159709 #define TK_BETWEEN 48
159710 #define TK_IN 49
159711 #define TK_ISNULL 50
159712 #define TK_NOTNULL 51
159713 #define TK_NE 52
159714 #define TK_EQ 53
@@ -160016,216 +160635,215 @@
160016 ** yy_reduce_ofst[] For each state, the offset into yy_action for
160017 ** shifting non-terminals after a reduce.
160018 ** yy_default[] Default action for each state.
160019 **
160020 *********** Begin parsing tables **********************************************/
160021 #define YY_ACTTAB_COUNT (2037)
160022 static const YYACTIONTYPE yy_action[] = {
160023 /* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564,
160024 /* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407,
160025 /* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558,
160026 /* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966,
160027 /* 40 */ 296, 1269, 296, 122, 123, 113, 1207, 1207, 1041, 1044,
160028 /* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407,
160029 /* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112,
160030 /* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250,
160031 /* 80 */ 217, 71, 71, 122, 123, 113, 1207, 1207, 1041, 1044,
160032 /* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440,
160033 /* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117,
160034 /* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513,
160035 /* 120 */ 1548, 1554, 374, 442, 6, 1183, 1154, 522, 1154, 407,
160036 /* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121,
160037 /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
160038 /* 150 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044,
160039 /* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183,
160040 /* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124,
160041 /* 180 */ 567, 1183, 1184, 1185, 474, 497, 119, 119, 119, 119,
160042 /* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407,
160043 /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442,
160044 /* 210 */ 1409, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160045 /* 220 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044,
160046 /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 1031,
160047 /* 240 */ 1031, 1042, 1045, 81, 382, 541, 378, 80, 119, 119,
160048 /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381,
160049 /* 260 */ 463, 332, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160050 /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 215, 512,
160051 /* 280 */ 1424, 422, 119, 119, 119, 119, 118, 118, 117, 117,
160052 /* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573,
160053 /* 300 */ 571, 2, 1235, 307, 1149, 141, 1600, 307, 407, 141,
160054 /* 310 */ 1183, 361, 1317, 1035, 866, 531, 1317, 1149, 359, 1567,
160055 /* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160056 /* 330 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160057 /* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001,
160058 /* 350 */ 426, 275, 275, 1128, 1627, 1021, 1627, 137, 542, 1541,
160059 /* 360 */ 561, 272, 950, 950, 561, 1423, 1183, 1184, 1185, 1594,
160060 /* 370 */ 866, 1012, 530, 315, 231, 1011, 468, 1276, 231, 119,
160061 /* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160062 /* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160063 /* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013,
160064 /* 410 */ 446, 207, 564, 306, 555, 407, 363, 1021, 363, 346,
160065 /* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71,
160066 /* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122,
160067 /* 440 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160068 /* 450 */ 121, 121, 121, 121, 219, 219, 472, 1183, 407, 570,
160069 /* 460 */ 1183, 1235, 503, 1477, 149, 546, 307, 489, 141, 1011,
160070 /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 191, 1214, 950,
160071 /* 480 */ 950, 514, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160072 /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 563, 119, 119,
160073 /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283,
160074 /* 510 */ 275, 275, 415, 1183, 1184, 1185, 1183, 1184, 1185, 372,
160075 /* 520 */ 1183, 243, 344, 561, 502, 499, 498, 1539, 407, 1540,
160076 /* 530 */ 1183, 288, 870, 143, 497, 1549, 185, 231, 9, 6,
160077 /* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160078 /* 550 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034,
160079 /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 137, 446,
160080 /* 570 */ 447, 863, 169, 1183, 397, 1204, 1183, 1184, 1185, 931,
160081 /* 580 */ 526, 1001, 98, 339, 564, 342, 1183, 1184, 1185, 306,
160082 /* 590 */ 555, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160083 /* 600 */ 120, 120, 121, 121, 121, 121, 452, 71, 71, 275,
160084 /* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160085 /* 620 */ 116, 442, 561, 417, 306, 555, 1183, 1307, 1307, 1183,
160086 /* 630 */ 1184, 1185, 1204, 1149, 330, 458, 318, 407, 363, 470,
160087 /* 640 */ 431, 1167, 32, 541, 527, 350, 1149, 1629, 393, 1149,
160088 /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160089 /* 660 */ 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160090 /* 670 */ 120, 120, 121, 121, 121, 121, 407, 199, 472, 1183,
160091 /* 680 */ 1022, 472, 1183, 1184, 1185, 386, 151, 539, 1548, 277,
160092 /* 690 */ 400, 137, 6, 317, 5, 564, 562, 3, 920, 920,
160093 /* 700 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120,
160094 /* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71,
160095 /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160096 /* 730 */ 442, 1183, 218, 428, 1183, 1183, 1184, 1185, 363, 261,
160097 /* 740 */ 278, 358, 508, 353, 507, 248, 407, 306, 555, 1539,
160098 /* 750 */ 1006, 349, 363, 291, 489, 302, 293, 1542, 281, 119,
160099 /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160100 /* 770 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120,
160101 /* 780 */ 120, 121, 121, 121, 121, 407, 148, 1183, 1184, 1185,
160102 /* 790 */ 1183, 1184, 1185, 275, 275, 1304, 1257, 1283, 483, 1476,
160103 /* 800 */ 150, 489, 480, 564, 1187, 1304, 561, 1587, 1255, 122,
160104 /* 810 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160105 /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 520, 119,
160106 /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160107 /* 840 */ 1183, 420, 417, 564, 269, 269, 1316, 13, 13, 1539,
160108 /* 850 */ 1546, 16, 16, 322, 6, 407, 506, 561, 1089, 1089,
160109 /* 860 */ 486, 1187, 425, 1539, 887, 292, 71, 71, 119, 119,
160110 /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122,
160111 /* 880 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120,
160112 /* 890 */ 121, 121, 121, 121, 564, 12, 1183, 1184, 1185, 407,
160113 /* 900 */ 275, 275, 451, 303, 834, 835, 836, 417, 489, 276,
160114 /* 910 */ 276, 1547, 284, 561, 319, 6, 321, 71, 71, 429,
160115 /* 920 */ 451, 450, 561, 952, 101, 113, 1207, 1207, 1041, 1044,
160116 /* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119,
160117 /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105,
160118 /* 950 */ 1183, 489, 564, 1312, 437, 455, 478, 564, 246, 245,
160119 /* 960 */ 244, 1409, 1545, 547, 1106, 405, 6, 1544, 196, 1258,
160120 /* 970 */ 413, 6, 105, 462, 103, 71, 71, 286, 564, 1107,
160121 /* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117,
160122 /* 990 */ 117, 116, 442, 451, 104, 427, 337, 320, 275, 275,
160123 /* 1000 */ 906, 13, 13, 564, 1482, 1105, 1183, 1184, 1185, 126,
160124 /* 1010 */ 907, 561, 546, 564, 407, 478, 295, 1321, 253, 200,
160125 /* 1020 */ 1106, 548, 1482, 1484, 280, 1409, 55, 55, 1287, 561,
160126 /* 1030 */ 478, 380, 423, 951, 407, 1107, 71, 71, 122, 123,
160127 /* 1040 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160128 /* 1050 */ 121, 121, 121, 1204, 407, 287, 552, 309, 122, 123,
160129 /* 1060 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160130 /* 1070 */ 121, 121, 121, 441, 1128, 1628, 146, 1628, 122, 111,
160131 /* 1080 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121,
160132 /* 1090 */ 121, 121, 121, 404, 403, 1482, 424, 119, 119, 119,
160133 /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564,
160134 /* 1110 */ 1204, 544, 1086, 858, 329, 361, 1086, 119, 119, 119,
160135 /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 294,
160136 /* 1130 */ 144, 523, 56, 56, 224, 564, 510, 119, 119, 119,
160137 /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 484, 1409,
160138 /* 1150 */ 537, 15, 15, 1126, 434, 439, 438, 407, 13, 13,
160139 /* 1160 */ 1523, 12, 926, 1211, 1183, 1184, 1185, 925, 1213, 536,
160140 /* 1170 */ 858, 557, 413, 193, 1525, 494, 1212, 448, 1160, 1222,
160141 /* 1180 */ 1183, 564, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034,
160142 /* 1190 */ 120, 120, 121, 121, 121, 121, 1521, 1149, 564, 965,
160143 /* 1200 */ 564, 1214, 247, 1214, 13, 13, 1409, 966, 538, 564,
160144 /* 1210 */ 1149, 108, 556, 1149, 4, 310, 392, 1227, 17, 194,
160145 /* 1220 */ 485, 43, 43, 57, 57, 306, 555, 524, 559, 1160,
160146 /* 1230 */ 464, 564, 44, 44, 392, 1127, 1183, 1184, 1185, 479,
160147 /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160148 /* 1250 */ 442, 443, 564, 327, 13, 13, 564, 418, 1315, 414,
160149 /* 1260 */ 171, 564, 311, 553, 213, 529, 1253, 564, 517, 543,
160150 /* 1270 */ 412, 108, 556, 137, 4, 58, 58, 435, 314, 59,
160151 /* 1280 */ 59, 274, 217, 549, 60, 60, 349, 476, 559, 1353,
160152 /* 1290 */ 61, 61, 1021, 275, 275, 1228, 213, 564, 106, 106,
160153 /* 1300 */ 8, 275, 275, 275, 275, 107, 561, 443, 566, 565,
160154 /* 1310 */ 564, 443, 1011, 1228, 561, 564, 561, 564, 275, 275,
160155 /* 1320 */ 62, 62, 1352, 553, 247, 456, 564, 98, 110, 306,
160156 /* 1330 */ 555, 561, 564, 45, 45, 405, 1203, 533, 46, 46,
160157 /* 1340 */ 47, 47, 532, 465, 1011, 1011, 1013, 1014, 27, 49,
160158 /* 1350 */ 49, 564, 1021, 405, 469, 50, 50, 564, 106, 106,
160159 /* 1360 */ 305, 564, 84, 204, 405, 107, 564, 443, 566, 565,
160160 /* 1370 */ 405, 564, 1011, 564, 63, 63, 564, 1599, 564, 895,
160161 /* 1380 */ 64, 64, 457, 477, 65, 65, 147, 96, 38, 14,
160162 /* 1390 */ 14, 1528, 412, 564, 66, 66, 128, 128, 926, 67,
160163 /* 1400 */ 67, 52, 52, 925, 1011, 1011, 1013, 1014, 27, 1572,
160164 /* 1410 */ 1171, 445, 208, 1123, 279, 394, 68, 68, 228, 390,
160165 /* 1420 */ 390, 389, 264, 387, 1171, 445, 843, 877, 279, 108,
160166 /* 1430 */ 556, 453, 4, 390, 390, 389, 264, 387, 564, 225,
160167 /* 1440 */ 843, 313, 328, 1003, 98, 252, 559, 544, 471, 312,
160168 /* 1450 */ 252, 564, 208, 225, 564, 313, 473, 30, 252, 279,
160169 /* 1460 */ 466, 69, 69, 312, 390, 390, 389, 264, 387, 443,
160170 /* 1470 */ 333, 843, 98, 564, 53, 53, 323, 157, 157, 227,
160171 /* 1480 */ 495, 553, 249, 289, 225, 564, 313, 162, 31, 1501,
160172 /* 1490 */ 135, 564, 1500, 227, 312, 533, 158, 158, 885, 884,
160173 /* 1500 */ 534, 162, 873, 301, 135, 564, 481, 226, 76, 76,
160174 /* 1510 */ 1021, 347, 1071, 98, 54, 54, 106, 106, 1067, 564,
160175 /* 1520 */ 249, 226, 519, 107, 227, 443, 566, 565, 72, 72,
160176 /* 1530 */ 1011, 334, 162, 564, 230, 135, 108, 556, 959, 4,
160177 /* 1540 */ 252, 408, 129, 129, 564, 1349, 306, 555, 564, 923,
160178 /* 1550 */ 564, 110, 226, 559, 564, 408, 73, 73, 564, 873,
160179 /* 1560 */ 306, 555, 1011, 1011, 1013, 1014, 27, 130, 130, 1071,
160180 /* 1570 */ 449, 131, 131, 127, 127, 357, 443, 156, 156, 892,
160181 /* 1580 */ 893, 155, 155, 338, 449, 356, 408, 564, 553, 968,
160182 /* 1590 */ 969, 306, 555, 1015, 341, 564, 108, 556, 564, 4,
160183 /* 1600 */ 1132, 1286, 533, 564, 856, 343, 145, 532, 345, 1300,
160184 /* 1610 */ 136, 136, 1083, 559, 1083, 449, 564, 1021, 134, 134,
160185 /* 1620 */ 1284, 132, 132, 106, 106, 1285, 133, 133, 564, 352,
160186 /* 1630 */ 107, 564, 443, 566, 565, 1340, 443, 1011, 362, 75,
160187 /* 1640 */ 75, 1082, 564, 1082, 564, 924, 1561, 110, 553, 551,
160188 /* 1650 */ 1015, 77, 77, 1361, 74, 74, 1408, 1336, 1347, 550,
160189 /* 1660 */ 1414, 1265, 1256, 1244, 1243, 42, 42, 48, 48, 1011,
160190 /* 1670 */ 1011, 1013, 1014, 27, 1245, 1580, 490, 1021, 267, 202,
160191 /* 1680 */ 1333, 365, 11, 106, 106, 930, 367, 210, 369, 391,
160192 /* 1690 */ 107, 1395, 443, 566, 565, 223, 1390, 1011, 500, 454,
160193 /* 1700 */ 282, 1400, 285, 108, 556, 214, 4, 325, 1383, 1283,
160194 /* 1710 */ 475, 355, 1473, 1583, 1472, 1399, 371, 1222, 326, 398,
160195 /* 1720 */ 559, 290, 331, 197, 100, 556, 209, 4, 198, 1011,
160196 /* 1730 */ 1011, 1013, 1014, 27, 385, 256, 1520, 1518, 554, 1219,
160197 /* 1740 */ 416, 559, 83, 443, 173, 206, 182, 221, 459, 167,
160198 /* 1750 */ 177, 460, 175, 493, 233, 553, 79, 178, 1396, 179,
160199 /* 1760 */ 35, 180, 96, 1402, 443, 396, 36, 467, 1478, 1401,
160200 /* 1770 */ 482, 237, 1404, 399, 82, 186, 553, 1467, 89, 488,
160201 /* 1780 */ 190, 268, 239, 491, 1021, 340, 240, 401, 1246, 1489,
160202 /* 1790 */ 106, 106, 336, 509, 1294, 241, 1303, 107, 430, 443,
160203 /* 1800 */ 566, 565, 1302, 91, 1011, 1021, 1598, 1301, 1273, 215,
160204 /* 1810 */ 1597, 106, 106, 402, 877, 432, 354, 1272, 107, 1271,
160205 /* 1820 */ 443, 566, 565, 1596, 1566, 1011, 1293, 433, 518, 299,
160206 /* 1830 */ 300, 360, 95, 525, 1344, 364, 1011, 1011, 1013, 1014,
160207 /* 1840 */ 27, 254, 255, 1552, 436, 1551, 125, 544, 10, 379,
160208 /* 1850 */ 1326, 1453, 102, 97, 1345, 528, 304, 1011, 1011, 1013,
160209 /* 1860 */ 1014, 27, 366, 377, 1343, 1342, 368, 370, 1325, 384,
160210 /* 1870 */ 201, 383, 34, 1368, 1367, 568, 1177, 266, 263, 265,
160211 /* 1880 */ 1505, 159, 569, 1241, 1236, 1506, 160, 142, 1504, 1503,
160212 /* 1890 */ 297, 211, 830, 161, 212, 78, 444, 203, 308, 222,
160213 /* 1900 */ 1081, 139, 1079, 316, 174, 163, 1203, 229, 176, 909,
160214 /* 1910 */ 324, 232, 1095, 181, 409, 410, 172, 164, 165, 419,
160215 /* 1920 */ 183, 85, 86, 421, 166, 87, 88, 1098, 1094, 234,
160216 /* 1930 */ 235, 152, 18, 236, 335, 1087, 1216, 252, 187, 487,
160217 /* 1940 */ 238, 188, 37, 845, 492, 356, 242, 496, 351, 501,
160218 /* 1950 */ 189, 90, 19, 504, 348, 20, 875, 92, 298, 168,
160219 /* 1960 */ 888, 153, 93, 511, 94, 1165, 154, 1047, 1134, 39,
160220 /* 1970 */ 216, 1133, 271, 273, 958, 192, 953, 110, 1151, 1155,
160221 /* 1980 */ 251, 7, 21, 1159, 1139, 22, 1153, 33, 23, 24,
160222 /* 1990 */ 25, 540, 1158, 195, 98, 1062, 26, 1048, 1046, 1050,
160223 /* 2000 */ 1104, 1051, 1103, 257, 258, 28, 40, 1173, 1016, 857,
160224 /* 2010 */ 109, 29, 560, 388, 138, 1172, 259, 170, 260, 1232,
160225 /* 2020 */ 1232, 919, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232,
160226 /* 2030 */ 1232, 1232, 1589, 1232, 1232, 1232, 1588,
160227 };
160228 static const YYCODETYPE yy_lookahead[] = {
160229 /* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192,
160230 /* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19,
160231 /* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210,
@@ -160236,202 +160854,202 @@
160236 /* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255,
160237 /* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49,
160238 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210,
160239 /* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109,
160240 /* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307,
160241 /* 120 */ 308, 313, 314, 112, 312, 59, 86, 261, 88, 19,
160242 /* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55,
160243 /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
160244 /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160245 /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115,
160246 /* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69,
160247 /* 180 */ 204, 115, 116, 117, 192, 131, 102, 103, 104, 105,
160248 /* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19,
160249 /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
160250 /* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109,
160251 /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160252 /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 46,
160253 /* 240 */ 47, 48, 49, 24, 248, 192, 250, 67, 102, 103,
160254 /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277,
160255 /* 260 */ 127, 128, 43, 44, 45, 46, 47, 48, 49, 50,
160256 /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 164, 165,
160257 /* 280 */ 272, 263, 102, 103, 104, 105, 106, 107, 108, 109,
160258 /* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186,
160259 /* 300 */ 187, 188, 189, 194, 76, 196, 229, 194, 19, 196,
160260 /* 310 */ 59, 192, 203, 120, 59, 87, 203, 89, 310, 311,
160261 /* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160262 /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160263 /* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73,
160264 /* 350 */ 231, 238, 239, 22, 23, 100, 25, 81, 305, 306,
160265 /* 360 */ 251, 23, 25, 25, 251, 272, 115, 116, 117, 214,
160266 /* 370 */ 115, 116, 144, 192, 265, 120, 114, 222, 265, 102,
160267 /* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160268 /* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160269 /* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154,
160270 /* 410 */ 297, 149, 192, 137, 138, 19, 192, 100, 192, 23,
160271 /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216,
160272 /* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43,
160273 /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160274 /* 450 */ 54, 55, 56, 57, 117, 117, 192, 59, 19, 187,
160275 /* 460 */ 59, 189, 23, 282, 240, 252, 194, 192, 196, 152,
160276 /* 470 */ 153, 154, 252, 72, 261, 203, 152, 25, 154, 142,
160277 /* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50,
160278 /* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103,
160279 /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267,
160280 /* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192,
160281 /* 520 */ 59, 118, 16, 251, 121, 122, 123, 303, 19, 303,
160282 /* 530 */ 59, 267, 23, 72, 131, 308, 22, 265, 22, 312,
160283 /* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160284 /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160285 /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 81, 297,
160286 /* 570 */ 295, 23, 192, 59, 203, 59, 115, 116, 117, 108,
160287 /* 580 */ 192, 73, 25, 77, 192, 79, 115, 116, 117, 137,
160288 /* 590 */ 138, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160289 /* 600 */ 52, 53, 54, 55, 56, 57, 119, 215, 216, 238,
160290 /* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160291 /* 620 */ 111, 112, 251, 192, 137, 138, 59, 234, 235, 115,
160292 /* 630 */ 116, 117, 116, 76, 126, 127, 128, 19, 192, 268,
160293 /* 640 */ 19, 23, 22, 192, 252, 24, 89, 300, 301, 92,
160294 /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160295 /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160296 /* 670 */ 52, 53, 54, 55, 56, 57, 19, 192, 192, 59,
160297 /* 680 */ 23, 192, 115, 116, 117, 200, 240, 307, 308, 22,
160298 /* 690 */ 205, 81, 312, 262, 22, 192, 133, 22, 135, 136,
160299 /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160300 /* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216,
160301 /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160302 /* 730 */ 112, 59, 192, 112, 59, 115, 116, 117, 192, 118,
160303 /* 740 */ 119, 120, 121, 122, 123, 124, 19, 137, 138, 303,
160304 /* 750 */ 23, 130, 192, 267, 192, 252, 267, 306, 203, 102,
160305 /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160306 /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160307 /* 780 */ 53, 54, 55, 56, 57, 19, 240, 115, 116, 117,
160308 /* 790 */ 115, 116, 117, 238, 239, 222, 192, 224, 280, 237,
160309 /* 800 */ 240, 192, 284, 192, 59, 232, 251, 140, 204, 43,
160310 /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160311 /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 192, 102,
160312 /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160313 /* 840 */ 59, 230, 192, 192, 238, 239, 237, 215, 216, 303,
160314 /* 850 */ 308, 215, 216, 16, 312, 19, 66, 251, 126, 127,
160315 /* 860 */ 128, 116, 230, 303, 74, 203, 215, 216, 102, 103,
160316 /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
160317 /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160318 /* 890 */ 54, 55, 56, 57, 192, 212, 115, 116, 117, 19,
160319 /* 900 */ 238, 239, 192, 252, 7, 8, 9, 192, 192, 238,
160320 /* 910 */ 239, 308, 262, 251, 77, 312, 79, 215, 216, 129,
160321 /* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49,
160322 /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
160323 /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12,
160324 /* 950 */ 59, 192, 192, 237, 252, 243, 192, 192, 126, 127,
160325 /* 960 */ 128, 192, 308, 203, 27, 253, 312, 308, 285, 207,
160326 /* 970 */ 208, 312, 157, 290, 159, 215, 216, 262, 192, 42,
160327 /* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109,
160328 /* 990 */ 110, 111, 112, 283, 158, 230, 237, 160, 238, 239,
160329 /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 22,
160330 /* 1010 */ 73, 251, 252, 192, 19, 192, 230, 239, 24, 24,
160331 /* 1020 */ 27, 261, 210, 211, 99, 192, 215, 216, 225, 251,
160332 /* 1030 */ 192, 192, 263, 142, 19, 42, 215, 216, 43, 44,
160333 /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160334 /* 1050 */ 55, 56, 57, 59, 19, 291, 63, 132, 43, 44,
160335 /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160336 /* 1070 */ 55, 56, 57, 252, 22, 23, 22, 25, 43, 44,
160337 /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160338 /* 1090 */ 55, 56, 57, 106, 107, 283, 263, 102, 103, 104,
160339 /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192,
160340 /* 1110 */ 116, 144, 29, 59, 291, 192, 33, 102, 103, 104,
160341 /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 291,
160342 /* 1130 */ 163, 19, 215, 216, 15, 192, 108, 102, 103, 104,
160343 /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 65, 192,
160344 /* 1150 */ 66, 215, 216, 101, 231, 106, 107, 19, 215, 216,
160345 /* 1160 */ 192, 212, 134, 114, 115, 116, 117, 139, 119, 85,
160346 /* 1170 */ 116, 207, 208, 230, 192, 19, 127, 192, 94, 60,
160347 /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51,
160348 /* 1190 */ 52, 53, 54, 55, 56, 57, 192, 76, 192, 31,
160349 /* 1200 */ 192, 152, 46, 154, 215, 216, 192, 39, 87, 192,
160350 /* 1210 */ 89, 19, 20, 92, 22, 192, 22, 23, 22, 230,
160351 /* 1220 */ 263, 215, 216, 215, 216, 137, 138, 115, 36, 145,
160352 /* 1230 */ 128, 192, 215, 216, 22, 23, 115, 116, 117, 290,
160353 /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160354 /* 1250 */ 112, 59, 192, 151, 215, 216, 192, 61, 203, 298,
160355 /* 1260 */ 299, 192, 192, 71, 25, 144, 203, 192, 203, 230,
160356 /* 1270 */ 114, 19, 20, 81, 22, 215, 216, 263, 192, 215,
160357 /* 1280 */ 216, 255, 256, 203, 215, 216, 130, 19, 36, 192,
160358 /* 1290 */ 215, 216, 100, 238, 239, 101, 25, 192, 106, 107,
160359 /* 1300 */ 48, 238, 239, 238, 239, 113, 251, 115, 116, 117,
160360 /* 1310 */ 192, 59, 120, 101, 251, 192, 251, 192, 238, 239,
160361 /* 1320 */ 215, 216, 192, 71, 46, 243, 192, 25, 25, 137,
160362 /* 1330 */ 138, 251, 192, 215, 216, 253, 25, 85, 215, 216,
160363 /* 1340 */ 215, 216, 90, 243, 152, 153, 154, 155, 156, 215,
160364 /* 1350 */ 216, 192, 100, 253, 243, 215, 216, 192, 106, 107,
160365 /* 1360 */ 243, 192, 148, 149, 253, 113, 192, 115, 116, 117,
160366 /* 1370 */ 253, 192, 120, 192, 215, 216, 192, 23, 192, 25,
160367 /* 1380 */ 215, 216, 192, 115, 215, 216, 22, 148, 24, 215,
160368 /* 1390 */ 216, 192, 114, 192, 215, 216, 215, 216, 134, 215,
160369 /* 1400 */ 216, 215, 216, 139, 152, 153, 154, 155, 156, 0,
160370 /* 1410 */ 1, 2, 141, 23, 5, 25, 215, 216, 24, 10,
160371 /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 125, 5, 19,
160372 /* 1430 */ 20, 268, 22, 10, 11, 12, 13, 14, 192, 30,
160373 /* 1440 */ 17, 32, 23, 23, 25, 25, 36, 144, 23, 40,
160374 /* 1450 */ 25, 192, 141, 30, 192, 32, 23, 22, 25, 5,
160375 /* 1460 */ 128, 215, 216, 40, 10, 11, 12, 13, 14, 59,
160376 /* 1470 */ 23, 17, 25, 192, 215, 216, 192, 215, 216, 70,
160377 /* 1480 */ 23, 71, 25, 151, 30, 192, 32, 78, 53, 192,
160378 /* 1490 */ 81, 192, 192, 70, 40, 85, 215, 216, 119, 120,
160379 /* 1500 */ 90, 78, 59, 254, 81, 192, 192, 98, 215, 216,
160380 /* 1510 */ 100, 23, 59, 25, 215, 216, 106, 107, 23, 192,
160381 /* 1520 */ 25, 98, 19, 113, 70, 115, 116, 117, 215, 216,
160382 /* 1530 */ 120, 192, 78, 192, 140, 81, 19, 20, 23, 22,
160383 /* 1540 */ 25, 132, 215, 216, 192, 192, 137, 138, 192, 23,
160384 /* 1550 */ 192, 25, 98, 36, 192, 132, 215, 216, 192, 116,
160385 /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 215, 216, 116,
160386 /* 1570 */ 161, 215, 216, 215, 216, 120, 59, 215, 216, 7,
160387 /* 1580 */ 8, 215, 216, 192, 161, 130, 132, 192, 71, 83,
160388 /* 1590 */ 84, 137, 138, 59, 192, 192, 19, 20, 192, 22,
160389 /* 1600 */ 97, 225, 85, 192, 23, 192, 25, 90, 192, 192,
160390 /* 1610 */ 215, 216, 152, 36, 154, 161, 192, 100, 215, 216,
160391 /* 1620 */ 192, 215, 216, 106, 107, 225, 215, 216, 192, 192,
160392 /* 1630 */ 113, 192, 115, 116, 117, 257, 59, 120, 192, 215,
160393 /* 1640 */ 216, 152, 192, 154, 192, 23, 317, 25, 71, 235,
160394 /* 1650 */ 116, 215, 216, 192, 215, 216, 192, 192, 192, 192,
160395 /* 1660 */ 192, 192, 192, 192, 192, 215, 216, 215, 216, 152,
160396 /* 1670 */ 153, 154, 155, 156, 192, 192, 287, 100, 286, 241,
160397 /* 1680 */ 254, 254, 242, 106, 107, 108, 254, 213, 254, 190,
160398 /* 1690 */ 113, 270, 115, 116, 117, 296, 266, 120, 219, 258,
160399 /* 1700 */ 244, 270, 258, 19, 20, 228, 22, 292, 266, 224,
160400 /* 1710 */ 292, 218, 218, 195, 218, 270, 258, 60, 245, 270,
160401 /* 1720 */ 36, 245, 244, 248, 19, 20, 242, 22, 248, 152,
160402 /* 1730 */ 153, 154, 155, 156, 244, 140, 199, 199, 279, 38,
160403 /* 1740 */ 199, 36, 150, 59, 296, 149, 22, 296, 18, 43,
160404 /* 1750 */ 236, 199, 233, 18, 198, 71, 293, 236, 271, 236,
160405 /* 1760 */ 269, 236, 148, 271, 59, 245, 269, 245, 282, 271,
160406 /* 1770 */ 199, 198, 233, 245, 293, 233, 71, 245, 157, 62,
160407 /* 1780 */ 22, 199, 198, 220, 100, 199, 198, 220, 199, 289,
160408 /* 1790 */ 106, 107, 288, 114, 226, 198, 217, 113, 64, 115,
160409 /* 1800 */ 116, 117, 217, 22, 120, 100, 223, 217, 217, 164,
160410 /* 1810 */ 223, 106, 107, 220, 125, 24, 217, 219, 113, 217,
160411 /* 1820 */ 115, 116, 117, 217, 311, 120, 226, 112, 304, 281,
160412 /* 1830 */ 281, 220, 114, 143, 260, 259, 152, 153, 154, 155,
160413 /* 1840 */ 156, 199, 91, 316, 82, 316, 147, 144, 22, 199,
160414 /* 1850 */ 249, 276, 157, 146, 260, 145, 278, 152, 153, 154,
160415 /* 1860 */ 155, 156, 259, 248, 260, 260, 259, 259, 249, 245,
160416 /* 1870 */ 247, 246, 25, 264, 264, 201, 13, 6, 193, 193,
160417 /* 1880 */ 212, 206, 191, 191, 191, 212, 206, 221, 212, 212,
160418 /* 1890 */ 221, 213, 4, 206, 213, 212, 3, 22, 162, 15,
160419 /* 1900 */ 23, 16, 23, 138, 150, 129, 25, 24, 141, 20,
160420 /* 1910 */ 16, 143, 1, 141, 302, 302, 299, 129, 129, 61,
160421 /* 1920 */ 150, 53, 53, 37, 129, 53, 53, 115, 1, 34,
160422 /* 1930 */ 140, 5, 22, 114, 160, 68, 75, 25, 68, 41,
160423 /* 1940 */ 140, 114, 24, 20, 19, 130, 124, 67, 24, 67,
160424 /* 1950 */ 22, 22, 22, 96, 23, 22, 59, 22, 67, 37,
160425 /* 1960 */ 28, 23, 148, 22, 25, 23, 23, 23, 23, 22,
160426 /* 1970 */ 140, 97, 23, 23, 115, 22, 142, 25, 88, 75,
160427 /* 1980 */ 34, 44, 34, 75, 23, 34, 86, 22, 34, 34,
160428 /* 1990 */ 34, 24, 93, 25, 25, 23, 34, 23, 23, 23,
160429 /* 2000 */ 23, 11, 23, 25, 22, 22, 22, 1, 23, 23,
160430 /* 2010 */ 22, 22, 25, 15, 23, 1, 140, 25, 140, 318,
160431 /* 2020 */ 318, 134, 318, 318, 318, 318, 318, 318, 318, 318,
160432 /* 2030 */ 318, 318, 140, 318, 318, 318, 140, 318, 318, 318,
160433 /* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160434 /* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160435 /* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160436 /* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160437 /* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
@@ -160444,122 +161062,120 @@
160444 /* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160445 /* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160446 /* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160447 /* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160448 /* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160449 /* 2200 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160450 /* 2210 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
160451 /* 2220 */ 318,
160452 };
160453 #define YY_SHIFT_COUNT (571)
160454 #define YY_SHIFT_MIN (0)
160455 #define YY_SHIFT_MAX (2014)
160456 static const unsigned short int yy_shift_ofst[] = {
160457 /* 0 */ 1423, 1409, 1454, 1192, 1192, 610, 1252, 1410, 1517, 1684,
160458 /* 10 */ 1684, 1684, 276, 0, 0, 180, 1015, 1684, 1684, 1684,
160459 /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160460 /* 30 */ 1049, 1049, 1121, 1121, 54, 487, 610, 610, 610, 610,
160461 /* 40 */ 610, 40, 110, 219, 289, 396, 439, 509, 548, 618,
160462 /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
160463 /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
160464 /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684,
160465 /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160466 /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160467 /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
160468 /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684,
160469 /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84,
160470 /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 66,
160471 /* 140 */ 66, 51, 1156, 66, 66, 324, 324, 66, 452, 452,
160472 /* 150 */ 452, 452, 133, 114, 114, 4, 11, 2037, 2037, 621,
160473 /* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228,
160474 /* 170 */ 251, 331, 1052, 66, 66, 66, 66, 66, 66, 66,
160475 /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
160476 /* 190 */ 66, 66, 66, 557, 557, 66, 9, 25, 25, 745,
160477 /* 200 */ 745, 967, 1088, 2037, 2037, 2037, 2037, 2037, 2037, 2037,
160478 /* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891,
160479 /* 220 */ 675, 66, 66, 66, 66, 66, 66, 66, 66, 66,
160480 /* 230 */ 66, 508, 66, 66, 66, 66, 66, 66, 66, 66,
160481 /* 240 */ 66, 66, 66, 66, 790, 790, 790, 66, 66, 66,
160482 /* 250 */ 338, 66, 66, 66, 516, 1084, 66, 66, 993, 66,
160483 /* 260 */ 66, 66, 66, 66, 66, 66, 66, 732, 1083, 563,
160484 /* 270 */ 994, 994, 994, 994, 337, 563, 563, 1028, 987, 897,
160485 /* 280 */ 1119, 262, 1214, 1271, 1112, 1214, 1112, 1268, 1239, 262,
160486 /* 290 */ 262, 1239, 262, 1271, 1268, 1302, 1354, 1278, 1168, 1168,
160487 /* 300 */ 1168, 1112, 1303, 1303, 815, 1311, 1264, 1364, 1657, 1657,
160488 /* 310 */ 1595, 1595, 1701, 1701, 1595, 1592, 1596, 1724, 1706, 1730,
160489 /* 320 */ 1730, 1730, 1730, 1595, 1735, 1614, 1596, 1596, 1614, 1724,
160490 /* 330 */ 1706, 1614, 1706, 1614, 1595, 1735, 1621, 1717, 1595, 1735,
160491 /* 340 */ 1758, 1595, 1735, 1595, 1735, 1758, 1679, 1679, 1679, 1734,
160492 /* 350 */ 1781, 1781, 1758, 1679, 1689, 1679, 1734, 1679, 1679, 1645,
160493 /* 360 */ 1791, 1715, 1715, 1758, 1690, 1718, 1690, 1718, 1690, 1718,
160494 /* 370 */ 1690, 1718, 1595, 1751, 1751, 1762, 1762, 1699, 1703, 1826,
160495 /* 380 */ 1595, 1695, 1699, 1707, 1710, 1614, 1847, 1863, 1863, 1871,
160496 /* 390 */ 1871, 1871, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037,
160497 /* 400 */ 2037, 2037, 2037, 2037, 2037, 2037, 2037, 193, 837, 1194,
160498 /* 410 */ 1212, 506, 832, 1054, 1390, 925, 1435, 1394, 1102, 1332,
160499 /* 420 */ 1419, 1196, 1420, 1425, 1433, 1447, 1457, 1488, 1443, 1379,
160500 /* 430 */ 1572, 1455, 1503, 1453, 1495, 1515, 1506, 1526, 1460, 1489,
160501 /* 440 */ 1581, 1622, 1534, 667, 1888, 1893, 1875, 1736, 1884, 1885,
160502 /* 450 */ 1877, 1879, 1765, 1754, 1776, 1881, 1881, 1883, 1767, 1889,
160503 /* 460 */ 1768, 1894, 1911, 1772, 1788, 1881, 1789, 1858, 1886, 1881,
160504 /* 470 */ 1770, 1868, 1869, 1872, 1873, 1795, 1812, 1895, 1790, 1927,
160505 /* 480 */ 1926, 1910, 1819, 1774, 1867, 1912, 1870, 1861, 1898, 1800,
160506 /* 490 */ 1827, 1918, 1923, 1925, 1815, 1822, 1928, 1880, 1929, 1930,
160507 /* 500 */ 1931, 1933, 1882, 1897, 1924, 1857, 1932, 1935, 1891, 1922,
160508 /* 510 */ 1938, 1814, 1941, 1942, 1943, 1944, 1939, 1945, 1947, 1874,
160509 /* 520 */ 1830, 1949, 1950, 1859, 1946, 1953, 1834, 1952, 1948, 1951,
160510 /* 530 */ 1954, 1955, 1890, 1904, 1900, 1937, 1908, 1899, 1956, 1961,
160511 /* 540 */ 1965, 1967, 1968, 1969, 1962, 1972, 1952, 1974, 1975, 1976,
160512 /* 550 */ 1977, 1978, 1979, 1982, 1990, 1983, 1984, 1985, 1986, 1988,
160513 /* 560 */ 1989, 1987, 1887, 1876, 1878, 1892, 1896, 1992, 1991, 1998,
160514 /* 570 */ 2006, 2014,
160515 };
160516 #define YY_REDUCE_COUNT (406)
160517 #define YY_REDUCE_MIN (-272)
160518 #define YY_REDUCE_MAX (1693)
160519 static const short yy_reduce_ofst[] = {
160520 /* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134,
160521 /* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765,
160522 /* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821,
160523 /* 30 */ 710, 812, -188, 380, -187, 555, 662, 1055, 1063, 1065,
160524 /* 40 */ 1080, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160525 /* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160526 /* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
160527 /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 636, 811,
160528 /* 80 */ 917, 936, 1006, 1008, 1017, 1060, 1064, 1069, 1075, 1105,
160529 /* 90 */ 1118, 1123, 1125, 1134, 1140, 1159, 1165, 1169, 1174, 1179,
160530 /* 100 */ 1181, 1184, 1186, 1201, 1246, 1259, 1262, 1281, 1293, 1299,
160531 /* 110 */ 1313, 1327, 1341, 1352, 1356, 1358, 1362, 1366, 1395, 1403,
160532 /* 120 */ 1406, 1411, 1424, 1436, 1439, 1450, 1452, -267, -267, -267,
160533 /* 130 */ -267, -267, -267, -267, -267, 224, -267, 446, -24, 275,
160534 /* 140 */ 546, 518, 573, 560, 53, -181, -111, 485, 606, 671,
160535 /* 150 */ 606, 671, 683, 8, 93, -267, -267, -267, -267, 155,
160536 /* 160 */ 155, 155, 181, 242, 264, 486, 489, -218, 393, 227,
160537 /* 170 */ 604, 347, 347, -171, 431, 650, 715, -166, 562, 609,
160538 /* 180 */ 716, 764, 18, 823, 769, 833, 838, 957, 759, 119,
160539 /* 190 */ 923, 226, 1014, 542, 603, 451, 949, 654, 659, 762,
160540 /* 200 */ 964, -4, 778, 961, 712, 1082, 1100, 1111, 1026, 1117,
160541 /* 210 */ -204, -174, -151, -8, 77, 198, 305, 327, 388, 540,
160542 /* 220 */ 839, 968, 982, 985, 1004, 1023, 1070, 1086, 1097, 1130,
160543 /* 230 */ 1190, 1163, 1199, 1284, 1297, 1300, 1314, 1339, 1353, 1391,
160544 /* 240 */ 1402, 1413, 1416, 1417, 803, 1376, 1400, 1428, 1437, 1446,
160545 /* 250 */ 1378, 1461, 1464, 1465, 1249, 1329, 1466, 1467, 1414, 1468,
160546 /* 260 */ 305, 1469, 1470, 1471, 1472, 1482, 1483, 1389, 1392, 1438,
160547 /* 270 */ 1426, 1427, 1432, 1434, 1378, 1438, 1438, 1440, 1474, 1499,
160548 /* 280 */ 1399, 1421, 1430, 1456, 1441, 1442, 1444, 1415, 1473, 1431,
160549 /* 290 */ 1445, 1476, 1449, 1478, 1418, 1479, 1477, 1485, 1493, 1494,
160550 /* 300 */ 1496, 1458, 1475, 1480, 1459, 1490, 1484, 1518, 1448, 1451,
160551 /* 310 */ 1537, 1538, 1463, 1481, 1541, 1486, 1487, 1491, 1519, 1514,
160552 /* 320 */ 1521, 1523, 1525, 1552, 1556, 1520, 1492, 1498, 1522, 1497,
160553 /* 330 */ 1539, 1528, 1542, 1532, 1571, 1573, 1500, 1504, 1582, 1584,
160554 /* 340 */ 1563, 1586, 1588, 1589, 1597, 1567, 1579, 1585, 1590, 1568,
160555 /* 350 */ 1583, 1587, 1593, 1591, 1598, 1599, 1600, 1602, 1606, 1513,
160556 /* 360 */ 1524, 1548, 1549, 1611, 1574, 1576, 1594, 1603, 1604, 1607,
160557 /* 370 */ 1605, 1608, 1642, 1527, 1529, 1609, 1610, 1601, 1615, 1575,
160558 /* 380 */ 1650, 1578, 1619, 1623, 1625, 1624, 1674, 1685, 1686, 1691,
160559 /* 390 */ 1692, 1693, 1612, 1613, 1617, 1675, 1668, 1673, 1676, 1677,
160560 /* 400 */ 1680, 1666, 1669, 1678, 1681, 1683, 1687,
160561 };
160562 static const YYACTIONTYPE yy_default[] = {
160563 /* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462,
160564 /* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230,
160565 /* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230,
@@ -160680,14 +161296,14 @@
160680 59, /* DETACH => ID */
160681 59, /* EACH => ID */
160682 59, /* FAIL => ID */
160683 0, /* OR => nothing */
160684 0, /* AND => nothing */
160685 0, /* IS => nothing */
160686 59, /* MATCH => ID */
160687 59, /* LIKE_KW => ID */
160688 0, /* BETWEEN => nothing */
 
160689 0, /* IN => nothing */
160690 0, /* ISNULL => nothing */
160691 0, /* NOTNULL => nothing */
160692 0, /* NE => nothing */
160693 0, /* EQ => nothing */
@@ -160952,14 +161568,14 @@
160952 /* 40 */ "DETACH",
160953 /* 41 */ "EACH",
160954 /* 42 */ "FAIL",
160955 /* 43 */ "OR",
160956 /* 44 */ "AND",
160957 /* 45 */ "IS",
160958 /* 46 */ "MATCH",
160959 /* 47 */ "LIKE_KW",
160960 /* 48 */ "BETWEEN",
160961 /* 49 */ "IN",
160962 /* 50 */ "ISNULL",
160963 /* 51 */ "NOTNULL",
160964 /* 52 */ "NE",
160965 /* 53 */ "EQ",
@@ -169408,10 +170024,12 @@
169408 }
169409 oldLimit = db->aLimit[limitId];
169410 if( newLimit>=0 ){ /* IMP: R-52476-28732 */
169411 if( newLimit>aHardLimit[limitId] ){
169412 newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
 
 
169413 }
169414 db->aLimit[limitId] = newLimit;
169415 }
169416 return oldLimit; /* IMP: R-53341-35419 */
169417 }
@@ -170811,16 +171429,20 @@
170811 ** the schema to be reparsed the next time it is needed. This has the
170812 ** effect of erasing all imposter tables.
170813 */
170814 case SQLITE_TESTCTRL_IMPOSTER: {
170815 sqlite3 *db = va_arg(ap, sqlite3*);
 
170816 sqlite3_mutex_enter(db->mutex);
170817 db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*));
170818 db->init.busy = db->init.imposterTable = va_arg(ap,int);
170819 db->init.newTnum = va_arg(ap,int);
170820 if( db->init.busy==0 && db->init.newTnum>0 ){
170821 sqlite3ResetAllSchemasOfConnection(db);
 
 
 
170822 }
170823 sqlite3_mutex_leave(db->mutex);
170824 break;
170825 }
170826
@@ -170891,10 +171513,30 @@
170891 case 2: *ptr = sqlite3WhereTrace; break;
170892 case 3: sqlite3WhereTrace = *ptr; break;
170893 }
170894 break;
170895 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170896
170897 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD)
170898 /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
170899 **
170900 ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
@@ -203302,11 +203944,11 @@
203302 **
203303 ** If the expression cannot be created, NULL is returned. In this case,
203304 ** the caller has to use an OFFSET clause to extract only the required
203305 ** rows from the sourct table, just as it does for an RBU update operation.
203306 */
203307 char *rbuVacuumIndexStart(
203308 sqlite3rbu *p, /* RBU handle */
203309 RbuObjIter *pIter /* RBU iterator object */
203310 ){
203311 char *zOrder = 0;
203312 char *zLhs = 0;
@@ -223727,11 +224369,11 @@
223727 ** an error occurs, (*pRc) is set to an SQLite error code before returning.
223728 */
223729 static void fts5StructureMakeWritable(int *pRc, Fts5Structure **pp){
223730 Fts5Structure *p = *pp;
223731 if( *pRc==SQLITE_OK && p->nRef>1 ){
223732 int nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel);
223733 Fts5Structure *pNew;
223734 pNew = (Fts5Structure*)sqlite3Fts5MallocZero(pRc, nByte);
223735 if( pNew ){
223736 int i;
223737 memcpy(pNew, p, nByte);
@@ -224756,12 +225398,16 @@
224756 }
224757 }else{
224758 int iRowidOff;
224759 iRowidOff = fts5LeafFirstRowidOff(pNew);
224760 if( iRowidOff ){
224761 pIter->pLeaf = pNew;
224762 pIter->iLeafOffset = iRowidOff;
 
 
 
 
224763 }
224764 }
224765
224766 if( pIter->pLeaf ){
224767 u8 *a = &pIter->pLeaf->p[pIter->iLeafOffset];
@@ -232486,11 +233132,11 @@
232486 int nArg, /* Number of args */
232487 sqlite3_value **apUnused /* Function arguments */
232488 ){
232489 assert( nArg==0 );
232490 UNUSED_PARAM2(nArg, apUnused);
232491 sqlite3_result_text(pCtx, "fts5: 2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8", -1, SQLITE_TRANSIENT);
232492 }
232493
232494 /*
232495 ** Return true if zName is the extension on one of the shadow tables used
232496 ** by this module.
@@ -236703,11 +237349,11 @@
236703 rc = sqlite3Fts5FlushToDisk(pFts5);
236704 }
236705 }
236706
236707 if( rc==SQLITE_OK ){
236708 int nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor);
236709 pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte);
236710 }
236711
236712 if( pCsr ){
236713 pCsr->pFts5 = pFts5;
236714
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.38.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.38.0"
456 #define SQLITE_VERSION_NUMBER 3038000
457 #define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -8248,11 +8248,12 @@
8248 #define SQLITE_TESTCTRL_PRNG_SEED 28
8249 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
8250 #define SQLITE_TESTCTRL_SEEK_COUNT 30
8251 #define SQLITE_TESTCTRL_TRACEFLAGS 31
8252 #define SQLITE_TESTCTRL_TUNE 32
8253 #define SQLITE_TESTCTRL_LOGEST 33
8254 #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
8255
8256 /*
8257 ** CAPI3REF: SQL Keyword Checking
8258 **
8259 ** These routines provide access to the set of SQL language keywords
@@ -8770,10 +8771,20 @@
8771 ** <dd>^This is the number of times that the prepared statement has
8772 ** been run. A single "run" for the purposes of this counter is one
8773 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
8774 ** The counter is incremented on the first [sqlite3_step()] call of each
8775 ** cycle.
8776 **
8777 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8778 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
8779 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8780 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8781 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8782 ** step was bypassed because a Bloom filter returned not-found. The
8783 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8784 ** times that the Bloom filter returned a find, and thus the join step
8785 ** had to be processed as normal.
8786 **
8787 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8788 ** <dd>^This is the approximate number of bytes of heap memory
8789 ** used to store the prepared statement. ^This value is not actually
8790 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8785,10 +8796,12 @@
8796 #define SQLITE_STMTSTATUS_SORT 2
8797 #define SQLITE_STMTSTATUS_AUTOINDEX 3
8798 #define SQLITE_STMTSTATUS_VM_STEP 4
8799 #define SQLITE_STMTSTATUS_REPREPARE 5
8800 #define SQLITE_STMTSTATUS_RUN 6
8801 #define SQLITE_STMTSTATUS_FILTER_MISS 7
8802 #define SQLITE_STMTSTATUS_FILTER_HIT 8
8803 #define SQLITE_STMTSTATUS_MEMUSED 99
8804
8805 /*
8806 ** CAPI3REF: Custom Page Cache Object
8807 **
@@ -13552,14 +13565,14 @@
13565 #define TK_DETACH 40
13566 #define TK_EACH 41
13567 #define TK_FAIL 42
13568 #define TK_OR 43
13569 #define TK_AND 44
13570 #define TK_MATCH 45
13571 #define TK_LIKE_KW 46
13572 #define TK_BETWEEN 47
13573 #define TK_IS 48
13574 #define TK_IN 49
13575 #define TK_ISNULL 50
13576 #define TK_NOTNULL 51
13577 #define TK_NE 52
13578 #define TK_EQ 53
@@ -13796,11 +13809,11 @@
13809 ** The default initial allocation for the pagecache when using separate
13810 ** pagecaches for each database connection. A positive number is the
13811 ** number of pages. A negative number N translations means that a buffer
13812 ** of -1024*N bytes is allocated and used for as many pages as it will hold.
13813 **
13814 ** The default value of "20" was chosen to minimize the run-time of the
13815 ** speedtest1 test program with options: --shrink-memory --reprepare
13816 */
13817 #ifndef SQLITE_DEFAULT_PCACHE_INITSZ
13818 # define SQLITE_DEFAULT_PCACHE_INITSZ 20
13819 #endif
@@ -15251,49 +15264,49 @@
15264 #define OP_ElseEq 58 /* jump, same as TK_ESCAPE */
15265 #define OP_IfNotZero 59 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
15266 #define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */
15267 #define OP_IncrVacuum 61 /* jump */
15268 #define OP_VNext 62 /* jump */
15269 #define OP_Filter 63 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
15270 #define OP_Init 64 /* jump, synopsis: Start at P2 */
15271 #define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */
15272 #define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */
15273 #define OP_Return 67
15274 #define OP_EndCoroutine 68
15275 #define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */
15276 #define OP_Halt 70
15277 #define OP_Integer 71 /* synopsis: r[P2]=P1 */
15278 #define OP_Int64 72 /* synopsis: r[P2]=P4 */
15279 #define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */
15280 #define OP_Null 74 /* synopsis: r[P2..P3]=NULL */
15281 #define OP_SoftNull 75 /* synopsis: r[P1]=NULL */
15282 #define OP_Blob 76 /* synopsis: r[P2]=P4 (len=P1) */
15283 #define OP_Variable 77 /* synopsis: r[P2]=parameter(P1,P4) */
15284 #define OP_Move 78 /* synopsis: r[P2@P3]=r[P1@P3] */
15285 #define OP_Copy 79 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
15286 #define OP_SCopy 80 /* synopsis: r[P2]=r[P1] */
15287 #define OP_IntCopy 81 /* synopsis: r[P2]=r[P1] */
15288 #define OP_FkCheck 82
15289 #define OP_ResultRow 83 /* synopsis: output=r[P1@P2] */
15290 #define OP_CollSeq 84
15291 #define OP_AddImm 85 /* synopsis: r[P1]=r[P1]+P2 */
15292 #define OP_RealAffinity 86
15293 #define OP_Cast 87 /* synopsis: affinity(r[P1]) */
15294 #define OP_Permutation 88
15295 #define OP_Compare 89 /* synopsis: r[P1@P3] <-> r[P2@P3] */
15296 #define OP_IsTrue 90 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
15297 #define OP_ZeroOrNull 91 /* synopsis: r[P2] = 0 OR NULL */
15298 #define OP_Offset 92 /* synopsis: r[P3] = sqlite_offset(P1) */
15299 #define OP_Column 93 /* synopsis: r[P3]=PX */
15300 #define OP_TypeCheck 94 /* synopsis: typecheck(r[P1@P2]) */
15301 #define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */
15302 #define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
15303 #define OP_Count 97 /* synopsis: r[P2]=count() */
15304 #define OP_ReadCookie 98
15305 #define OP_SetCookie 99
15306 #define OP_ReopenIdx 100 /* synopsis: root=P2 iDb=P3 */
15307 #define OP_OpenRead 101 /* synopsis: root=P2 iDb=P3 */
15308 #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15309 #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15310 #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15311 #define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15312 #define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -15300,80 +15313,82 @@
15313 #define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15314 #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15315 #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15316 #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15317 #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15318 #define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */
15319 #define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15320 #define OP_OpenDup 114
15321 #define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
15322 #define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15323 #define OP_OpenEphemeral 117 /* synopsis: nColumn=P2 */
15324 #define OP_SorterOpen 118
15325 #define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15326 #define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */
15327 #define OP_Close 121
15328 #define OP_ColumnsUsed 122
15329 #define OP_SeekScan 123 /* synopsis: Scan-ahead up to P1 rows */
15330 #define OP_SeekHit 124 /* synopsis: set P2<=seekHit<=P3 */
15331 #define OP_Sequence 125 /* synopsis: r[P2]=cursor[P1].ctr++ */
15332 #define OP_NewRowid 126 /* synopsis: r[P2]=rowid */
15333 #define OP_Insert 127 /* synopsis: intkey=r[P3] data=r[P2] */
15334 #define OP_RowCell 128
15335 #define OP_Delete 129
15336 #define OP_ResetCount 130
15337 #define OP_SorterCompare 131 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
15338 #define OP_SorterData 132 /* synopsis: r[P2]=data */
15339 #define OP_RowData 133 /* synopsis: r[P2]=data */
15340 #define OP_Rowid 134 /* synopsis: r[P2]=rowid */
15341 #define OP_NullRow 135
15342 #define OP_SeekEnd 136
15343 #define OP_IdxInsert 137 /* synopsis: key=r[P2] */
15344 #define OP_SorterInsert 138 /* synopsis: key=r[P2] */
15345 #define OP_IdxDelete 139 /* synopsis: key=r[P2@P3] */
15346 #define OP_DeferredSeek 140 /* synopsis: Move P3 to P1.rowid if needed */
15347 #define OP_IdxRowid 141 /* synopsis: r[P2]=rowid */
15348 #define OP_FinishSeek 142
15349 #define OP_Destroy 143
15350 #define OP_Clear 144
15351 #define OP_ResetSorter 145
15352 #define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
15353 #define OP_SqlExec 147
15354 #define OP_ParseSchema 148
15355 #define OP_LoadAnalysis 149
15356 #define OP_DropTable 150
15357 #define OP_DropIndex 151
15358 #define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15359 #define OP_DropTrigger 153
15360 #define OP_IntegrityCk 154
15361 #define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */
15362 #define OP_Param 156
15363 #define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */
15364 #define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15365 #define OP_OffsetLimit 159 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15366 #define OP_AggInverse 160 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15367 #define OP_AggStep 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15368 #define OP_AggStep1 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */
15369 #define OP_AggValue 163 /* synopsis: r[P3]=value N=P2 */
15370 #define OP_AggFinal 164 /* synopsis: accum=r[P1] N=P2 */
15371 #define OP_Expire 165
15372 #define OP_CursorLock 166
15373 #define OP_CursorUnlock 167
15374 #define OP_TableLock 168 /* synopsis: iDb=P1 root=P2 write=P3 */
15375 #define OP_VBegin 169
15376 #define OP_VCreate 170
15377 #define OP_VDestroy 171
15378 #define OP_VOpen 172
15379 #define OP_VColumn 173 /* synopsis: r[P3]=vcolumn(P2) */
15380 #define OP_VRename 174
15381 #define OP_Pagecount 175
15382 #define OP_MaxPgcnt 176
15383 #define OP_FilterAdd 177 /* synopsis: filter(P1) += key(P3@P4) */
15384 #define OP_Trace 178
15385 #define OP_CursorHint 179
15386 #define OP_ReleaseReg 180 /* synopsis: release r[P1@P2] mask P3 */
15387 #define OP_Noop 181
15388 #define OP_Explain 182
15389 #define OP_Abortable 183
15390
15391 /* Properties such as "out2" or "jump" that are specified in
15392 ** comments following the "case" for each opcode in the vdbe.c
15393 ** are encoded into bitvectors as follows:
15394 */
@@ -15390,33 +15405,34 @@
15405 /* 24 */ 0x09, 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09,\
15406 /* 32 */ 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
15407 /* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\
15408 /* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
15409 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\
15410 /* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\
15411 /* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
15412 /* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\
15413 /* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\
15414 /* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
15415 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15416 /* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15417 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15418 /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
15419 /* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\
15420 /* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15421 /* 152 */ 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
15422 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15423 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15424 /* 176 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15425 }
15426
15427 /* The resolve3P2Values() routine is able to run faster if it knows
15428 ** the value of the largest JUMP opcode. The smaller the maximum
15429 ** JUMP opcode the better, so the mkopcodeh.tcl script that
15430 ** generated this include file strives to group all JUMP opcodes
15431 ** together near the beginning of the list.
15432 */
15433 #define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
15434
15435 /************** End of opcodes.h *********************************************/
15436 /************** Continuing where we left off in vdbe.h ***********************/
15437
15438 /*
@@ -16707,10 +16723,12 @@
16723 #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
16724 #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
16725 #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
16726 #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
16727 /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
16728 #define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
16729 #define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
16730 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
16731
16732 /*
16733 ** Macros for testing whether or not optimizations are enabled or disabled.
16734 */
@@ -19509,10 +19527,11 @@
19527 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
19528 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
19529 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
19530 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
19531 #endif
19532 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
19533 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
19534 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
19535 Upsert*);
19536 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
19537 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
@@ -19719,18 +19738,12 @@
19738 #endif
19739 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
19740 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
19741 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
19742 SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
 
19743 SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double);
 
 
 
 
19744 SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst);
 
19745 SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int);
19746 SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int);
19747 SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int);
19748
19749 /*
@@ -22106,11 +22119,11 @@
22119 bft usesStmtJournal:1; /* True if uses a statement journal */
22120 bft readOnly:1; /* True for statements that do not write */
22121 bft bIsReader:1; /* True for statements that read */
22122 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
22123 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
22124 u32 aCounter[9]; /* Counters used by sqlite3_stmt_status() */
22125 char *zSql; /* Text of the SQL statement that generated this */
22126 #ifdef SQLITE_ENABLE_NORMALIZE
22127 char *zNormSql; /* Normalization of the associated SQL statement */
22128 DblquoteStr *pDblStr; /* List of double-quoted string literals */
22129 #endif
@@ -22214,11 +22227,11 @@
22227 #endif
22228 SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*);
22229 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
22230 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8);
22231 SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double);
22232 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem*);
22233 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
22234 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
22235 SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull);
22236 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
22237 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
@@ -23212,11 +23225,13 @@
23225 pX = localtime(t);
23226 #ifndef SQLITE_UNTESTABLE
23227 if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
23228 #endif
23229 if( pX ) *pTm = *pX;
23230 #if SQLITE_THREADSAFE>0
23231 sqlite3_mutex_leave(mutex);
23232 #endif
23233 rc = pX==0;
23234 #else
23235 #ifndef SQLITE_UNTESTABLE
23236 if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
23237 #endif
@@ -23351,10 +23366,49 @@
23366 DateTime *p /* The date/time value to be modified */
23367 ){
23368 int rc = 1;
23369 double r;
23370 switch(sqlite3UpperToLower[(u8)z[0]] ){
23371 case 'a': {
23372 /*
23373 ** auto
23374 **
23375 ** If rawS is available, then interpret as a julian day number, or
23376 ** a unix timestamp, depending on its magnitude.
23377 */
23378 if( sqlite3_stricmp(z, "auto")==0 ){
23379 if( !p->rawS || p->validJD ){
23380 rc = 0;
23381 p->rawS = 0;
23382 }else if( p->s>=-210866760000 && p->s<=253402300799 ){
23383 r = p->s*1000.0 + 210866760000000.0;
23384 clearYMD_HMS_TZ(p);
23385 p->iJD = (sqlite3_int64)(r + 0.5);
23386 p->validJD = 1;
23387 p->rawS = 0;
23388 rc = 0;
23389 }
23390 }
23391 break;
23392 }
23393 case 'j': {
23394 /*
23395 ** julianday
23396 **
23397 ** Always interpret the prior number as a julian-day value. If this
23398 ** is not the first modifier, or if the prior argument is not a numeric
23399 ** value in the allowed range of julian day numbers understood by
23400 ** SQLite (0..5373484.5) then the result will be NULL.
23401 */
23402 if( sqlite3_stricmp(z, "julianday")==0 ){
23403 if( p->validJD && p->rawS ){
23404 rc = 0;
23405 p->rawS = 0;
23406 }
23407 }
23408 break;
23409 }
23410 #ifndef SQLITE_OMIT_LOCALTIME
23411 case 'l': {
23412 /* localtime
23413 **
23414 ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
@@ -23614,10 +23668,28 @@
23668 if( isDate(context, argc, argv, &x)==0 ){
23669 computeJD(&x);
23670 sqlite3_result_double(context, x.iJD/86400000.0);
23671 }
23672 }
23673
23674 /*
23675 ** unixepoch( TIMESTRING, MOD, MOD, ...)
23676 **
23677 ** Return the number of seconds (including fractional seconds) since
23678 ** the unix epoch of 1970-01-01 00:00:00 GMT.
23679 */
23680 static void unixepochFunc(
23681 sqlite3_context *context,
23682 int argc,
23683 sqlite3_value **argv
23684 ){
23685 DateTime x;
23686 if( isDate(context, argc, argv, &x)==0 ){
23687 computeJD(&x);
23688 sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
23689 }
23690 }
23691
23692 /*
23693 ** datetime( TIMESTRING, MOD, MOD, ...)
23694 **
23695 ** Return YYYY-MM-DD HH:MM:SS
@@ -23891,10 +23963,11 @@
23963 */
23964 SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
23965 static FuncDef aDateTimeFuncs[] = {
23966 #ifndef SQLITE_OMIT_DATETIME_FUNCS
23967 PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
23968 PURE_DATE(unixepoch, -1, 0, 0, unixepochFunc ),
23969 PURE_DATE(date, -1, 0, 0, dateFunc ),
23970 PURE_DATE(time, -1, 0, 0, timeFunc ),
23971 PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
23972 PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
23973 DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
@@ -33608,11 +33681,10 @@
33681 #endif
33682 }
33683 return a[x&7] + y - 10;
33684 }
33685
 
33686 /*
33687 ** Convert a double into a LogEst
33688 ** In other words, compute an approximation for 10*log2(x).
33689 */
33690 SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
@@ -33623,38 +33695,23 @@
33695 if( x<=2000000000 ) return sqlite3LogEst((u64)x);
33696 memcpy(&a, &x, 8);
33697 e = (a>>52) - 1022;
33698 return e*10;
33699 }
 
33700
 
 
 
33701 /*
33702 ** Convert a LogEst into an integer.
 
 
 
33703 */
33704 SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
33705 u64 n;
33706 n = x%10;
33707 x /= 10;
33708 if( n>=5 ) n -= 2;
33709 else if( n>=1 ) n -= 1;
 
 
33710 if( x>60 ) return (u64)LARGEST_INT64;
 
 
 
 
 
33711 return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
33712 }
 
33713
33714 /*
33715 ** Add a new name/number pair to a VList. This might require that the
33716 ** VList object be reallocated, so return the new VList. If an OOM
33717 ** error occurs, the original VList returned and the
@@ -34104,49 +34161,49 @@
34161 /* 58 */ "ElseEq" OpHelp(""),
34162 /* 59 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
34163 /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
34164 /* 61 */ "IncrVacuum" OpHelp(""),
34165 /* 62 */ "VNext" OpHelp(""),
34166 /* 63 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
34167 /* 64 */ "Init" OpHelp("Start at P2"),
34168 /* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
34169 /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
34170 /* 67 */ "Return" OpHelp(""),
34171 /* 68 */ "EndCoroutine" OpHelp(""),
34172 /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
34173 /* 70 */ "Halt" OpHelp(""),
34174 /* 71 */ "Integer" OpHelp("r[P2]=P1"),
34175 /* 72 */ "Int64" OpHelp("r[P2]=P4"),
34176 /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
34177 /* 74 */ "Null" OpHelp("r[P2..P3]=NULL"),
34178 /* 75 */ "SoftNull" OpHelp("r[P1]=NULL"),
34179 /* 76 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
34180 /* 77 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
34181 /* 78 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
34182 /* 79 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
34183 /* 80 */ "SCopy" OpHelp("r[P2]=r[P1]"),
34184 /* 81 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
34185 /* 82 */ "FkCheck" OpHelp(""),
34186 /* 83 */ "ResultRow" OpHelp("output=r[P1@P2]"),
34187 /* 84 */ "CollSeq" OpHelp(""),
34188 /* 85 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
34189 /* 86 */ "RealAffinity" OpHelp(""),
34190 /* 87 */ "Cast" OpHelp("affinity(r[P1])"),
34191 /* 88 */ "Permutation" OpHelp(""),
34192 /* 89 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
34193 /* 90 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
34194 /* 91 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
34195 /* 92 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
34196 /* 93 */ "Column" OpHelp("r[P3]=PX"),
34197 /* 94 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
34198 /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
34199 /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
34200 /* 97 */ "Count" OpHelp("r[P2]=count()"),
34201 /* 98 */ "ReadCookie" OpHelp(""),
34202 /* 99 */ "SetCookie" OpHelp(""),
34203 /* 100 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
34204 /* 101 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
34205 /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
34206 /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
34207 /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
34208 /* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
34209 /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -34153,80 +34210,82 @@
34210 /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
34211 /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
34212 /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
34213 /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
34214 /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
34215 /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34216 /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34217 /* 114 */ "OpenDup" OpHelp(""),
34218 /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34219 /* 116 */ "String8" OpHelp("r[P2]='P4'"),
34220 /* 117 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34221 /* 118 */ "SorterOpen" OpHelp(""),
34222 /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34223 /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34224 /* 121 */ "Close" OpHelp(""),
34225 /* 122 */ "ColumnsUsed" OpHelp(""),
34226 /* 123 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
34227 /* 124 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
34228 /* 125 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
34229 /* 126 */ "NewRowid" OpHelp("r[P2]=rowid"),
34230 /* 127 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
34231 /* 128 */ "RowCell" OpHelp(""),
34232 /* 129 */ "Delete" OpHelp(""),
34233 /* 130 */ "ResetCount" OpHelp(""),
34234 /* 131 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
34235 /* 132 */ "SorterData" OpHelp("r[P2]=data"),
34236 /* 133 */ "RowData" OpHelp("r[P2]=data"),
34237 /* 134 */ "Rowid" OpHelp("r[P2]=rowid"),
34238 /* 135 */ "NullRow" OpHelp(""),
34239 /* 136 */ "SeekEnd" OpHelp(""),
34240 /* 137 */ "IdxInsert" OpHelp("key=r[P2]"),
34241 /* 138 */ "SorterInsert" OpHelp("key=r[P2]"),
34242 /* 139 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
34243 /* 140 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
34244 /* 141 */ "IdxRowid" OpHelp("r[P2]=rowid"),
34245 /* 142 */ "FinishSeek" OpHelp(""),
34246 /* 143 */ "Destroy" OpHelp(""),
34247 /* 144 */ "Clear" OpHelp(""),
34248 /* 145 */ "ResetSorter" OpHelp(""),
34249 /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
34250 /* 147 */ "SqlExec" OpHelp(""),
34251 /* 148 */ "ParseSchema" OpHelp(""),
34252 /* 149 */ "LoadAnalysis" OpHelp(""),
34253 /* 150 */ "DropTable" OpHelp(""),
34254 /* 151 */ "DropIndex" OpHelp(""),
34255 /* 152 */ "Real" OpHelp("r[P2]=P4"),
34256 /* 153 */ "DropTrigger" OpHelp(""),
34257 /* 154 */ "IntegrityCk" OpHelp(""),
34258 /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34259 /* 156 */ "Param" OpHelp(""),
34260 /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34261 /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
34262 /* 159 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
34263 /* 160 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
34264 /* 161 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
34265 /* 162 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
34266 /* 163 */ "AggValue" OpHelp("r[P3]=value N=P2"),
34267 /* 164 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
34268 /* 165 */ "Expire" OpHelp(""),
34269 /* 166 */ "CursorLock" OpHelp(""),
34270 /* 167 */ "CursorUnlock" OpHelp(""),
34271 /* 168 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
34272 /* 169 */ "VBegin" OpHelp(""),
34273 /* 170 */ "VCreate" OpHelp(""),
34274 /* 171 */ "VDestroy" OpHelp(""),
34275 /* 172 */ "VOpen" OpHelp(""),
34276 /* 173 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
34277 /* 174 */ "VRename" OpHelp(""),
34278 /* 175 */ "Pagecount" OpHelp(""),
34279 /* 176 */ "MaxPgcnt" OpHelp(""),
34280 /* 177 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
34281 /* 178 */ "Trace" OpHelp(""),
34282 /* 179 */ "CursorHint" OpHelp(""),
34283 /* 180 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
34284 /* 181 */ "Noop" OpHelp(""),
34285 /* 182 */ "Explain" OpHelp(""),
34286 /* 183 */ "Abortable" OpHelp(""),
34287 };
34288 return azName[i];
34289 }
34290 #endif
34291
@@ -68263,34 +68322,42 @@
68322 /*
68323 ** Make sure pBt->pTmpSpace points to an allocation of
68324 ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
68325 ** pointer.
68326 */
68327 static SQLITE_NOINLINE int allocateTempSpace(BtShared *pBt){
68328 assert( pBt!=0 );
68329 assert( pBt->pTmpSpace==0 );
68330 /* This routine is called only by btreeCursor() when allocating the
68331 ** first write cursor for the BtShared object */
68332 assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 );
68333 pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
68334 if( pBt->pTmpSpace==0 ){
68335 BtCursor *pCur = pBt->pCursor;
68336 pBt->pCursor = pCur->pNext; /* Unlink the cursor */
68337 memset(pCur, 0, sizeof(*pCur));
68338 return SQLITE_NOMEM_BKPT;
68339 }
68340
68341 /* One of the uses of pBt->pTmpSpace is to format cells before
68342 ** inserting them into a leaf page (function fillInCell()). If
68343 ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
68344 ** by the various routines that manipulate binary cells. Which
68345 ** can mean that fillInCell() only initializes the first 2 or 3
68346 ** bytes of pTmpSpace, but that the first 4 bytes are copied from
68347 ** it into a database page. This is not actually a problem, but it
68348 ** does cause a valgrind error when the 1 or 2 bytes of unitialized
68349 ** data is passed to system call write(). So to avoid this error,
68350 ** zero the first 4 bytes of temp space here.
68351 **
68352 ** Also: Provide four bytes of initialized space before the
68353 ** beginning of pTmpSpace as an area available to prepend the
68354 ** left-child pointer to the beginning of a cell.
68355 */
68356 memset(pBt->pTmpSpace, 0, 8);
68357 pBt->pTmpSpace += 4;
68358 return SQLITE_OK;
68359 }
68360
68361 /*
68362 ** Free the pBt->pTmpSpace allocation
68363 */
@@ -70027,14 +70094,10 @@
70094 assert( p->inTrans>TRANS_NONE );
70095 assert( wrFlag==0 || p->inTrans==TRANS_WRITE );
70096 assert( pBt->pPage1 && pBt->pPage1->aData );
70097 assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );
70098
 
 
 
 
70099 if( iTable<=1 ){
70100 if( iTable<1 ){
70101 return SQLITE_CORRUPT_BKPT;
70102 }else if( btreePagecount(pBt)==0 ){
70103 assert( wrFlag==0 );
@@ -70047,23 +70110,29 @@
70110 pCur->pgnoRoot = iTable;
70111 pCur->iPage = -1;
70112 pCur->pKeyInfo = pKeyInfo;
70113 pCur->pBtree = p;
70114 pCur->pBt = pBt;
70115 pCur->curFlags = 0;
 
70116 /* If there are two or more cursors on the same btree, then all such
70117 ** cursors *must* have the BTCF_Multiple flag set. */
70118 for(pX=pBt->pCursor; pX; pX=pX->pNext){
70119 if( pX->pgnoRoot==iTable ){
70120 pX->curFlags |= BTCF_Multiple;
70121 pCur->curFlags = BTCF_Multiple;
70122 }
70123 }
70124 pCur->eState = CURSOR_INVALID;
70125 pCur->pNext = pBt->pCursor;
70126 pBt->pCursor = pCur;
70127 if( wrFlag ){
70128 pCur->curFlags |= BTCF_WriteFlag;
70129 pCur->curPagerFlags = 0;
70130 if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt);
70131 }else{
70132 pCur->curPagerFlags = PAGER_GET_READONLY;
70133 }
70134 return SQLITE_OK;
70135 }
70136 static int btreeCursorWithLock(
70137 Btree *p, /* The btree */
70138 Pgno iTable, /* Root page of table to open */
@@ -77812,16 +77881,16 @@
77881 ** it into an integer and return that. If pMem represents an
77882 ** an SQL-NULL value, return 0.
77883 **
77884 ** If pMem represents a string value, its encoding might be changed.
77885 */
77886 static SQLITE_NOINLINE i64 memIntValue(const Mem *pMem){
77887 i64 value = 0;
77888 sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
77889 return value;
77890 }
77891 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem *pMem){
77892 int flags;
77893 assert( pMem!=0 );
77894 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
77895 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
77896 flags = pMem->flags;
@@ -87366,10 +87435,35 @@
87435 }else{
87436 pOut->flags = MEM_Int;
87437 return pOut;
87438 }
87439 }
87440
87441 /*
87442 ** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning
87443 ** with pOp->p3. Return the hash.
87444 */
87445 static u64 filterHash(const Mem *aMem, const Op *pOp){
87446 int i, mx;
87447 u64 h = 0;
87448
87449 i = pOp->p3;
87450 assert( pOp->p4type==P4_INT32 );
87451 mx = i + pOp->p4.i;
87452 for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
87453 const Mem *p = &aMem[i];
87454 if( p->flags & (MEM_Int|MEM_IntReal) ){
87455 h += p->u.i;
87456 }else if( p->flags & MEM_Real ){
87457 h += sqlite3VdbeIntValue(p);
87458 }else if( p->flags & (MEM_Str|MEM_Blob) ){
87459 h += p->n;
87460 if( p->flags & MEM_Zero ) h += p->u.nZero;
87461 }
87462 }
87463 return h;
87464 }
87465
87466 /*
87467 ** Return the symbolic name for the data type of a pMem
87468 */
87469 static const char *vdbeMemTypeName(Mem *pMem){
@@ -88021,16 +88115,22 @@
88115
88116 /* Opcode: Blob P1 P2 * P4 *
88117 ** Synopsis: r[P2]=P4 (len=P1)
88118 **
88119 ** P4 points to a blob of data P1 bytes long. Store this
88120 ** blob in register P2. If P4 is a NULL pointer, then construct
88121 ** a zero-filled blob that is P1 bytes long in P2.
88122 */
88123 case OP_Blob: { /* out2 */
88124 assert( pOp->p1 <= SQLITE_MAX_LENGTH );
88125 pOut = out2Prerelease(p, pOp);
88126 if( pOp->p4.z==0 ){
88127 sqlite3VdbeMemSetZeroBlob(pOut, pOp->p1);
88128 if( sqlite3VdbeMemExpandBlob(pOut) ) goto no_mem;
88129 }else{
88130 sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
88131 }
88132 pOut->enc = encoding;
88133 UPDATE_MAX_BLOBSIZE(pOut);
88134 break;
88135 }
88136
@@ -88175,28 +88275,26 @@
88275 pOut = &aMem[pOp->p2];
88276 sqlite3VdbeMemSetInt64(pOut, pIn1->u.i);
88277 break;
88278 }
88279
88280 /* Opcode: FkCheck * * * * *
88281 **
88282 ** Halt with an SQLITE_CONSTRAINT error if there are any unresolved
88283 ** foreign key constraint violations. If there are no foreign key
88284 ** constraint violations, this is a no-op.
88285 **
88286 ** FK constraint violations are also checked when the prepared statement
88287 ** exits. This opcode is used to raise foreign key constraint errors prior
88288 ** to returning results such as a row change count or the result of a
88289 ** RETURNING clause.
88290 */
88291 case OP_FkCheck: {
 
88292 if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){
88293 goto abort_due_to_error;
88294 }
88295 break;
 
88296 }
88297
88298 /* Opcode: ResultRow P1 P2 * * *
88299 ** Synopsis: output=r[P1@P2]
88300 **
@@ -90039,11 +90137,11 @@
90137 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
90138 REGISTER_TRACE(pOp->p3, pOut);
90139 break;
90140 }
90141
90142 /* Opcode: Count P1 P2 P3 * *
90143 ** Synopsis: r[P2]=count()
90144 **
90145 ** Store the number of entries (an integer value) in the table or index
90146 ** opened by cursor P1 in register P2.
90147 **
@@ -94824,10 +94922,81 @@
94922
94923 REGISTER_TRACE(pOp->p3, pOut);
94924 UPDATE_MAX_BLOBSIZE(pOut);
94925 break;
94926 }
94927
94928 /* Opcode: FilterAdd P1 * P3 P4 *
94929 ** Synopsis: filter(P1) += key(P3@P4)
94930 **
94931 ** Compute a hash on the P4 registers starting with r[P3] and
94932 ** add that hash to the bloom filter contained in r[P1].
94933 */
94934 case OP_FilterAdd: {
94935 u64 h;
94936
94937 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
94938 pIn1 = &aMem[pOp->p1];
94939 assert( pIn1->flags & MEM_Blob );
94940 assert( pIn1->n>0 );
94941 h = filterHash(aMem, pOp);
94942 #ifdef SQLITE_DEBUG
94943 if( db->flags&SQLITE_VdbeTrace ){
94944 int ii;
94945 for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
94946 registerTrace(ii, &aMem[ii]);
94947 }
94948 printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
94949 }
94950 #endif
94951 h %= pIn1->n;
94952 pIn1->z[h/8] |= 1<<(h&7);
94953 break;
94954 }
94955
94956 /* Opcode: Filter P1 P2 P3 P4 *
94957 ** Synopsis: if key(P3@P4) not in filter(P1) goto P2
94958 **
94959 ** Compute a hash on the key contained in the P4 registers starting
94960 ** with r[P3]. Check to see if that hash is found in the
94961 ** bloom filter hosted by register P1. If it is not present then
94962 ** maybe jump to P2. Otherwise fall through.
94963 **
94964 ** False negatives are harmless. It is always safe to fall through,
94965 ** even if the value is in the bloom filter. A false negative causes
94966 ** more CPU cycles to be used, but it should still yield the correct
94967 ** answer. However, an incorrect answer may well arise from a
94968 ** false positive - if the jump is taken when it should fall through.
94969 */
94970 case OP_Filter: { /* jump */
94971 u64 h;
94972
94973 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
94974 pIn1 = &aMem[pOp->p1];
94975 assert( (pIn1->flags & MEM_Blob)!=0 );
94976 assert( pIn1->n >= 1 );
94977 h = filterHash(aMem, pOp);
94978 #ifdef SQLITE_DEBUG
94979 if( db->flags&SQLITE_VdbeTrace ){
94980 int ii;
94981 for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
94982 registerTrace(ii, &aMem[ii]);
94983 }
94984 printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
94985 }
94986 #endif
94987 h %= pIn1->n;
94988 if( (pIn1->z[h/8] & (1<<(h&7)))==0 ){
94989 VdbeBranchTaken(1, 2);
94990 p->aCounter[SQLITE_STMTSTATUS_FILTER_HIT]++;
94991 goto jump_to_p2;
94992 }else{
94993 p->aCounter[SQLITE_STMTSTATUS_FILTER_MISS]++;
94994 VdbeBranchTaken(0, 2);
94995 }
94996 break;
94997 }
94998
94999 /* Opcode: Trace P1 P2 * P4 *
95000 **
95001 ** Write P4 on the statement trace output if statement tracing is
95002 ** enabled.
@@ -104083,11 +104252,11 @@
104252 case TK_COLUMN:
104253 assert( ExprUseYTab(p) );
104254 return ExprHasProperty(p, EP_CanBeNull) ||
104255 p->y.pTab==0 || /* Reference to column of index on expression */
104256 (p->iColumn>=0
104257 && p->y.pTab->aCol!=0 /* Possible due to prior error */
104258 && p->y.pTab->aCol[p->iColumn].notNull==0);
104259 default:
104260 return 1;
104261 }
104262 }
@@ -107514,11 +107683,11 @@
107683 ** implement sqlite3ReferencesSrcList().
107684 */
107685 struct RefSrcList {
107686 sqlite3 *db; /* Database connection used for sqlite3DbRealloc() */
107687 SrcList *pRef; /* Looking for references to these tables */
107688 i64 nExclude; /* Number of tables to exclude from the search */
107689 int *aiExclude; /* Cursor IDs for tables to exclude from the search */
107690 };
107691
107692 /*
107693 ** Walker SELECT callbacks for sqlite3ReferencesSrcList().
@@ -107529,11 +107698,12 @@
107698 ** When leaving the subquery, remove those entries from the exclude list.
107699 */
107700 static int selectRefEnter(Walker *pWalker, Select *pSelect){
107701 struct RefSrcList *p = pWalker->u.pRefSrcList;
107702 SrcList *pSrc = pSelect->pSrc;
107703 i64 i, j;
107704 int *piNew;
107705 if( pSrc->nSrc==0 ) return WRC_Continue;
107706 j = p->nExclude;
107707 p->nExclude += pSrc->nSrc;
107708 piNew = sqlite3DbRealloc(p->db, p->aiExclude, p->nExclude*sizeof(int));
107709 if( piNew==0 ){
@@ -113192,10 +113362,11 @@
113362 int reg;
113363
113364 if( pReturning->nRetCol==0 ){
113365 assert( CORRUPT_DB );
113366 }else{
113367 sqlite3VdbeAddOp0(v, OP_FkCheck);
113368 addrRewind =
113369 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
113370 VdbeCoverage(v);
113371 reg = pReturning->iRetReg;
113372 for(i=0; i<pReturning->nRetCol; i++){
@@ -113761,12 +113932,12 @@
113932 SQLITE_PRIVATE void sqlite3ColumnSetColl(
113933 sqlite3 *db,
113934 Column *pCol,
113935 const char *zColl
113936 ){
113937 i64 nColl;
113938 i64 n;
113939 char *zNew;
113940 assert( zColl!=0 );
113941 n = sqlite3Strlen30(pCol->zCnName) + 1;
113942 if( pCol->colFlags & COLFLAG_HASTYPE ){
113943 n += sqlite3Strlen30(pCol->zCnName+n) + 1;
@@ -114567,11 +114738,11 @@
114738 break;
114739 }
114740 }
114741 }
114742
114743 z = sqlite3DbMallocRaw(db, (i64)sName.n + 1 + (i64)sType.n + (sType.n>0) );
114744 if( z==0 ) return;
114745 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName);
114746 memcpy(z, sName.z, sName.n);
114747 z[sName.n] = 0;
114748 sqlite3Dequote(z);
@@ -114581,11 +114752,11 @@
114752 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
114753 sqlite3DbFree(db, z);
114754 return;
114755 }
114756 }
114757 aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0]));
114758 if( aNew==0 ){
114759 sqlite3DbFree(db, z);
114760 return;
114761 }
114762 p->aCol = aNew;
@@ -116594,11 +116765,11 @@
116765 sqlite3 *db = pParse->db;
116766 #ifndef SQLITE_OMIT_FOREIGN_KEY
116767 FKey *pFKey = 0;
116768 FKey *pNextTo;
116769 Table *p = pParse->pNewTable;
116770 i64 nByte;
116771 int i;
116772 int nCol;
116773 char *z;
116774
116775 assert( pTo!=0 );
@@ -117424,17 +117595,17 @@
117595 }
117596
117597 /* Add an entry in sqlite_schema for this index
117598 */
117599 sqlite3NestedParse(pParse,
117600 "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",
117601 db->aDb[iDb].zDbSName,
117602 pIndex->zName,
117603 pTab->zName,
117604 iMem,
117605 zStmt
117606 );
117607 sqlite3DbFree(db, zStmt);
117608
117609 /* Fill the index with data and reparse the schema. Code an OP_Expire
117610 ** to invalidate all pre-compiled statements.
117611 */
@@ -117978,11 +118149,11 @@
118149 pItem->pSelect = pSubquery;
118150 pItem->pOn = pOn;
118151 pItem->pUsing = pUsing;
118152 return p;
118153
118154 append_from_error:
118155 assert( p==0 );
118156 sqlite3ExprDelete(db, pOn);
118157 sqlite3IdListDelete(db, pUsing);
118158 sqlite3SelectDelete(db, pSubquery);
118159 return 0;
@@ -119234,10 +119405,20 @@
119405 pTab = 0;
119406 }
119407 }
119408 return pTab;
119409 }
119410
119411 /* Generate byte-code that will report the number of rows modified
119412 ** by a DELETE, INSERT, or UPDATE statement.
119413 */
119414 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *zColName){
119415 sqlite3VdbeAddOp0(v, OP_FkCheck);
119416 sqlite3VdbeAddOp2(v, OP_ResultRow, regCounter, 1);
119417 sqlite3VdbeSetNumCols(v, 1);
119418 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zColName, SQLITE_STATIC);
119419 }
119420
119421 /* Return true if table pTab is read-only.
119422 **
119423 ** A table is read-only if any of the following are true:
119424 **
@@ -119810,13 +119991,11 @@
119991 /* Return the number of rows that were deleted. If this routine is
119992 ** generating code because of a call to sqlite3NestedParse(), do not
119993 ** invoke the callback function.
119994 */
119995 if( memCnt ){
119996 sqlite3CodeChangeCount(v, memCnt, "rows deleted");
 
 
119997 }
119998
119999 delete_from_cleanup:
120000 sqlite3AuthContextPop(&sContext);
120001 sqlite3SrcListDelete(db, pTabList);
@@ -125370,13 +125549,11 @@
125549 ** Return the number of rows inserted. If this routine is
125550 ** generating code because of a call to sqlite3NestedParse(), do not
125551 ** invoke the callback function.
125552 */
125553 if( regRowCount ){
125554 sqlite3CodeChangeCount(v, regRowCount, "rows inserted");
 
 
125555 }
125556
125557 insert_cleanup:
125558 sqlite3SrcListDelete(db, pTabList);
125559 sqlite3ExprListDelete(db, pList);
@@ -133002,10 +133179,11 @@
133179 /* Make multiple attempts to compile the SQL, until it either succeeds
133180 ** or encounters a permanent error. A schema problem after one schema
133181 ** reset is considered a permanent error. */
133182 rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
133183 assert( rc==SQLITE_OK || *ppStmt==0 );
133184 if( rc==SQLITE_OK || db->mallocFailed ) break;
133185 }while( rc==SQLITE_ERROR_RETRY
133186 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
133187 sqlite3BtreeLeaveAll(db);
133188 rc = sqlite3ApiExit(db, rc);
133189 assert( (rc&db->errMask)==rc );
@@ -135418,11 +135596,11 @@
135596 memset(&sNC, 0, sizeof(sNC));
135597 sNC.pSrcList = pSelect->pSrc;
135598 a = pSelect->pEList->a;
135599 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
135600 const char *zType;
135601 i64 n, m;
135602 pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
135603 p = a[i].pExpr;
135604 zType = columnType(&sNC, p, 0, 0, 0);
135605 /* pCol->szEst = ... // Column size est for SELECT tables never used */
135606 pCol->affinity = sqlite3ExprAffinity(p);
@@ -137404,11 +137582,11 @@
137582 /* Restriction (23) */
137583 if( (p->selFlags & SF_Recursive) ) return 0;
137584
137585 if( pSrc->nSrc>1 ){
137586 if( pParse->nSelect>500 ) return 0;
137587 aCsrMap = sqlite3DbMallocZero(db, ((i64)pParse->nTab+1)*sizeof(int));
137588 if( aCsrMap ) aCsrMap[0] = pParse->nTab;
137589 }
137590 }
137591
137592 /***** If we reach this point, flattening is permitted. *****/
@@ -138175,15 +138353,15 @@
138353 **
138354 ** where table is a database table, not a sub-select or view. If the query
138355 ** does match this pattern, then a pointer to the Table object representing
138356 ** <tbl> is returned. Otherwise, NULL is returned.
138357 **
138358 ** This routine checks to see if it is safe to use the count optimization.
138359 ** A correct answer is still obtained (though perhaps more slowly) if
138360 ** this routine returns NULL when it could have returned a table pointer.
138361 ** But returning the pointer when NULL should have been returned can
138362 ** result in incorrect answers and/or crashes. So, when in doubt, return NULL.
138363 */
138364 static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
138365 Table *pTab;
138366 Expr *pExpr;
138367
@@ -143493,13 +143671,11 @@
143671 /*
143672 ** Return the number of rows that were changed, if we are tracking
143673 ** that information.
143674 */
143675 if( regRowCount ){
143676 sqlite3CodeChangeCount(v, regRowCount, "rows updated");
 
 
143677 }
143678
143679 update_cleanup:
143680 sqlite3AuthContextPop(&sContext);
143681 sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */
@@ -145869,10 +146045,11 @@
146045 int addrBignull; /* Jump here for next part of big-null scan */
146046 #ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS
146047 u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */
146048 int addrLikeRep; /* LIKE range processing address */
146049 #endif
146050 int regFilter; /* Bloom filter */
146051 u8 iFrom; /* Which entry in the FROM clause */
146052 u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */
146053 int p1, p2; /* Operands of the opcode used to end the loop */
146054 union { /* Information that depends on pWLoop->wsFlags */
146055 struct {
@@ -146097,15 +146274,15 @@
146274 struct WhereScan {
146275 WhereClause *pOrigWC; /* Original, innermost WhereClause */
146276 WhereClause *pWC; /* WhereClause currently being scanned */
146277 const char *zCollName; /* Required collating sequence, if not NULL */
146278 Expr *pIdxExpr; /* Search for this index expression */
146279 int k; /* Resume scanning at this->pWC->a[this->k] */
 
 
146280 u32 opMask; /* Acceptable operators */
146281 char idxaff; /* Must match this affinity, if zCollName!=NULL */
146282 unsigned char iEquiv; /* Current slot in aiCur[] and aiColumn[] */
146283 unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */
146284 int aiCur[11]; /* Cursors in the equivalence class */
146285 i16 aiColumn[11]; /* Corresponding column number in the eq-class */
146286 };
146287
146288 /*
@@ -146125,10 +146302,11 @@
146302 WhereClause *pOuter; /* Outer conjunction */
146303 u8 op; /* Split operator. TK_AND or TK_OR */
146304 u8 hasOr; /* True if any a[].eOperator is WO_OR */
146305 int nTerm; /* Number of terms */
146306 int nSlot; /* Number of entries in a[] */
146307 int nBase; /* Number of terms through the last non-Virtual */
146308 WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */
146309 #if defined(SQLITE_SMALL_STACK)
146310 WhereTerm aStatic[1]; /* Initial static space for a[] */
146311 #else
146312 WhereTerm aStatic[8]; /* Initial static space for a[] */
@@ -146182,15 +146360,10 @@
146360 int bVarSelect; /* Used by sqlite3WhereExprUsage() */
146361 int n; /* Number of assigned cursor values */
146362 int ix[BMS]; /* Cursor assigned to each bit */
146363 };
146364
 
 
 
 
 
146365 /*
146366 ** This object is a convenience wrapper holding all information needed
146367 ** to construct WhereLoop objects for a particular query.
146368 */
146369 struct WhereLoopBuilder {
@@ -146315,12 +146488,18 @@
146488 Parse *pParse, /* Parse context */
146489 SrcList *pTabList, /* Table list this loop refers to */
146490 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
146491 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
146492 );
146493 SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter(
146494 const Parse *pParse, /* Parse context */
146495 const WhereInfo *pWInfo, /* WHERE clause */
146496 const WhereLevel *pLevel /* Bloom filter on this level */
146497 );
146498 #else
146499 # define sqlite3WhereExplainOneScan(u,v,w,x) 0
146500 # define sqlite3WhereExplainBloomFilter(u,v,w) 0
146501 #endif /* SQLITE_OMIT_EXPLAIN */
146502 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146503 SQLITE_PRIVATE void sqlite3WhereAddScanStatus(
146504 Vdbe *v, /* Vdbe to add scanstatus entry to */
146505 SrcList *pSrclist, /* FROM clause pLvl reads data from */
@@ -146409,10 +146588,12 @@
146588 #define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
146589 #define WHERE_IN_EARLYOUT 0x00040000 /* Perhaps quit IN loops early */
146590 #define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */
146591 #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */
146592 #define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */
146593 #define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */
146594 #define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */
146595
146596 #endif /* !defined(SQLITE_WHEREINT_H) */
146597
146598 /************** End of whereInt.h ********************************************/
146599 /************** Continuing where we left off in wherecode.c ******************/
@@ -146571,23 +146752,31 @@
146752 sqlite3_str_append(&str, " USING ", 7);
146753 sqlite3_str_appendf(&str, zFmt, pIdx->zName);
146754 explainIndexRange(&str, pLoop);
146755 }
146756 }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
146757 char cRangeOp;
146758 #if 0 /* Better output, but breaks many tests */
146759 const Table *pTab = pItem->pTab;
146760 const char *zRowid = pTab->iPKey>=0 ? pTab->aCol[pTab->iPKey].zCnName:
146761 "rowid";
146762 #else
146763 const char *zRowid = "rowid";
146764 #endif
146765 sqlite3_str_appendf(&str, " USING INTEGER PRIMARY KEY (%s", zRowid);
146766 if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){
146767 cRangeOp = '=';
146768 }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){
146769 sqlite3_str_appendf(&str, ">? AND %s", zRowid);
146770 cRangeOp = '<';
146771 }else if( flags&WHERE_BTM_LIMIT ){
146772 cRangeOp = '>';
146773 }else{
146774 assert( flags&WHERE_TOP_LIMIT);
146775 cRangeOp = '<';
146776 }
146777 sqlite3_str_appendf(&str, "%c?)", cRangeOp);
 
146778 }
146779 #ifndef SQLITE_OMIT_VIRTUALTABLE
146780 else if( (flags & WHERE_VIRTUALTABLE)!=0 ){
146781 sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s",
146782 pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
@@ -146606,10 +146795,60 @@
146795 ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
146796 pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
146797 }
146798 return ret;
146799 }
146800
146801 /*
146802 ** Add a single OP_Explain opcode that describes a Bloom filter.
146803 **
146804 ** Or if not processing EXPLAIN QUERY PLAN and not in a SQLITE_DEBUG and/or
146805 ** SQLITE_ENABLE_STMT_SCANSTATUS build, then OP_Explain opcodes are not
146806 ** required and this routine is a no-op.
146807 **
146808 ** If an OP_Explain opcode is added to the VM, its address is returned.
146809 ** Otherwise, if no OP_Explain is coded, zero is returned.
146810 */
146811 SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter(
146812 const Parse *pParse, /* Parse context */
146813 const WhereInfo *pWInfo, /* WHERE clause */
146814 const WhereLevel *pLevel /* Bloom filter on this level */
146815 ){
146816 int ret = 0;
146817 SrcItem *pItem = &pWInfo->pTabList->a[pLevel->iFrom];
146818 Vdbe *v = pParse->pVdbe; /* VM being constructed */
146819 sqlite3 *db = pParse->db; /* Database handle */
146820 char *zMsg; /* Text to add to EQP output */
146821 int i; /* Loop counter */
146822 WhereLoop *pLoop; /* The where loop */
146823 StrAccum str; /* EQP output string */
146824 char zBuf[100]; /* Initial space for EQP output string */
146825
146826 sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);
146827 str.printfFlags = SQLITE_PRINTF_INTERNAL;
146828 sqlite3_str_appendf(&str, "BLOOM FILTER ON %S (", pItem);
146829 pLoop = pLevel->pWLoop;
146830 if( pLoop->wsFlags & WHERE_IPK ){
146831 const Table *pTab = pItem->pTab;
146832 if( pTab->iPKey>=0 ){
146833 sqlite3_str_appendf(&str, "%s=?", pTab->aCol[pTab->iPKey].zCnName);
146834 }else{
146835 sqlite3_str_appendf(&str, "rowid=?");
146836 }
146837 }else{
146838 for(i=pLoop->nSkip; i<pLoop->u.btree.nEq; i++){
146839 const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i);
146840 if( i>pLoop->nSkip ) sqlite3_str_append(&str, " AND ", 5);
146841 sqlite3_str_appendf(&str, "%s=?", z);
146842 }
146843 }
146844 sqlite3_str_append(&str, ")", 1);
146845 zMsg = sqlite3StrAccumFinish(&str);
146846 ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v),
146847 pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
146848 return ret;
146849 }
146850 #endif /* SQLITE_OMIT_EXPLAIN */
146851
146852 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
146853 /*
146854 ** Configure the VM passed as the first argument with an
@@ -147365,11 +147604,11 @@
147604 sHint.pIdx = pLoop->u.btree.pIndex;
147605 memset(&sWalker, 0, sizeof(sWalker));
147606 sWalker.pParse = pParse;
147607 sWalker.u.pCCurHint = &sHint;
147608 pWC = &pWInfo->sWC;
147609 for(i=0; i<pWC->nBase; i++){
147610 pTerm = &pWC->a[i];
147611 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
147612 if( pTerm->prereqAll & pLevel->notReady ) continue;
147613
147614 /* Any terms specified as part of the ON(...) clause for any LEFT
@@ -147695,10 +147934,67 @@
147934 if( sqlite3ExprCompare(0, pExpr, pTruth, iTabCur)==0 ){
147935 pTerm->wtFlags |= TERM_CODED;
147936 }
147937 }
147938 }
147939
147940 /*
147941 ** This routine is called right after An OP_Filter has been generated and
147942 ** before the corresponding index search has been performed. This routine
147943 ** checks to see if there are additional Bloom filters in inner loops that
147944 ** can be checked prior to doing the index lookup. If there are available
147945 ** inner-loop Bloom filters, then evaluate those filters now, before the
147946 ** index lookup. The idea is that a Bloom filter check is way faster than
147947 ** an index lookup, and the Bloom filter might return false, meaning that
147948 ** the index lookup can be skipped.
147949 **
147950 ** We know that an inner loop uses a Bloom filter because it has the
147951 ** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked,
147952 ** then clear the WhereLevel.regFilter value to prevent the Bloom filter
147953 ** from being checked a second time when the inner loop is evaluated.
147954 */
147955 static SQLITE_NOINLINE void filterPullDown(
147956 Parse *pParse, /* Parsing context */
147957 WhereInfo *pWInfo, /* Complete information about the WHERE clause */
147958 int iLevel, /* Which level of pWInfo->a[] should be coded */
147959 int addrNxt, /* Jump here to bypass inner loops */
147960 Bitmask notReady /* Loops that are not ready */
147961 ){
147962 while( ++iLevel < pWInfo->nLevel ){
147963 WhereLevel *pLevel = &pWInfo->a[iLevel];
147964 WhereLoop *pLoop = pLevel->pWLoop;
147965 if( pLevel->regFilter==0 ) continue;
147966 /* ,--- Because constructBloomFilter() has will not have set
147967 ** vvvvv--' pLevel->regFilter if this were true. */
147968 if( NEVER(pLoop->prereq & notReady) ) continue;
147969 if( pLoop->wsFlags & WHERE_IPK ){
147970 WhereTerm *pTerm = pLoop->aLTerm[0];
147971 int regRowid;
147972 assert( pTerm!=0 );
147973 assert( pTerm->pExpr!=0 );
147974 testcase( pTerm->wtFlags & TERM_VIRTUAL );
147975 regRowid = sqlite3GetTempReg(pParse);
147976 regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid);
147977 sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147978 addrNxt, regRowid, 1);
147979 VdbeCoverage(pParse->pVdbe);
147980 }else{
147981 u16 nEq = pLoop->u.btree.nEq;
147982 int r1;
147983 char *zStartAff;
147984
147985 assert( pLoop->wsFlags & WHERE_INDEXED );
147986 r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff);
147987 codeApplyAffinity(pParse, r1, nEq, zStartAff);
147988 sqlite3DbFree(pParse->db, zStartAff);
147989 sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147990 addrNxt, r1, nEq);
147991 VdbeCoverage(pParse->pVdbe);
147992 }
147993 pLevel->regFilter = 0;
147994 }
147995 }
147996
147997 /*
147998 ** Generate code for the start of the iLevel-th loop in the WHERE clause
147999 ** implementation described by pWInfo.
148000 */
@@ -147906,10 +148202,16 @@
148202 testcase( pTerm->wtFlags & TERM_VIRTUAL );
148203 iReleaseReg = ++pParse->nMem;
148204 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
148205 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
148206 addrNxt = pLevel->addrNxt;
148207 if( pLevel->regFilter ){
148208 sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
148209 iRowidReg, 1);
148210 VdbeCoverage(v);
148211 filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady);
148212 }
148213 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
148214 VdbeCoverage(v);
148215 pLevel->op = OP_Noop;
148216 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
148217 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
@@ -148231,10 +148533,16 @@
148533 }else{
148534 if( regBignull ){
148535 sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
148536 VdbeComment((v, "NULL-scan pass ctr"));
148537 }
148538 if( pLevel->regFilter ){
148539 sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
148540 regBase, nEq);
148541 VdbeCoverage(v);
148542 filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady);
148543 }
148544
148545 op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
148546 assert( op!=0 );
148547 if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 && op==OP_SeekGE ){
148548 assert( regBignull==0 );
@@ -148862,11 +149170,11 @@
149170 ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
149171 ** and we are coding the t1 loop and the t2 loop has not yet coded,
149172 ** then we cannot use the "t1.a=t2.b" constraint, but we can code
149173 ** the implied "t1.a=123" constraint.
149174 */
149175 for(pTerm=pWC->a, j=pWC->nBase; j>0; j--, pTerm++){
149176 Expr *pE, sEAlt;
149177 WhereTerm *pAlt;
149178 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
149179 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
149180 if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
@@ -148907,11 +149215,11 @@
149215 */
149216 if( pLevel->iLeftJoin ){
149217 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
149218 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
149219 VdbeComment((v, "record LEFT JOIN hit"));
149220 for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){
149221 testcase( pTerm->wtFlags & TERM_VIRTUAL );
149222 testcase( pTerm->wtFlags & TERM_CODED );
149223 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
149224 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
149225 assert( pWInfo->untestedTerms );
@@ -149018,10 +149326,11 @@
149326 sqlite3DbFree(db, pOld);
149327 }
149328 pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
149329 }
149330 pTerm = &pWC->a[idx = pWC->nTerm++];
149331 if( (wtFlags & TERM_VIRTUAL)==0 ) pWC->nBase = pWC->nTerm;
149332 if( p && ExprHasProperty(p, EP_Unlikely) ){
149333 pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
149334 }else{
149335 pTerm->truthProb = 1;
149336 }
@@ -150009,14 +150318,17 @@
150318 int nLeft; /* Number of elements on left side vector */
150319
150320 if( db->mallocFailed ){
150321 return;
150322 }
150323 assert( pWC->nTerm > idxTerm );
150324 pTerm = &pWC->a[idxTerm];
150325 pMaskSet = &pWInfo->sMaskSet;
150326 pExpr = pTerm->pExpr;
150327 assert( pExpr!=0 ); /* Because malloc() has not failed */
150328 assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );
150329 pMaskSet->bVarSelect = 0;
150330 prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft);
150331 op = pExpr->op;
150332 if( op==TK_IN ){
150333 assert( pExpr->pRight==0 );
150334 if( sqlite3ExprCheckIN(pParse, pExpr) ) return;
@@ -150023,18 +150335,32 @@
150335 if( ExprUseXSelect(pExpr) ){
150336 pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect);
150337 }else{
150338 pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList);
150339 }
150340 prereqAll = prereqLeft | pTerm->prereqRight;
 
150341 }else{
150342 pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
150343 if( pExpr->pLeft==0
150344 || ExprHasProperty(pExpr, EP_xIsSelect|EP_IfNullRow)
150345 || pExpr->x.pList!=0
150346 ){
150347 prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr);
150348 }else{
150349 prereqAll = prereqLeft | pTerm->prereqRight;
150350 }
150351 }
 
 
150352 if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
150353
150354 #ifdef SQLITE_DEBUG
150355 if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){
150356 printf("\n*** Incorrect prereqAll computed for:\n");
150357 sqlite3TreeViewExpr(0,pExpr,0);
150358 abort();
150359 }
150360 #endif
150361
150362 if( ExprHasProperty(pExpr, EP_FromJoin) ){
150363 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
150364 prereqAll |= x;
150365 extraRight = x-1; /* ON clause terms may not be used with an index
150366 ** on left table of a LEFT JOIN. Ticket #3015 */
@@ -150454,10 +150780,11 @@
150780 ){
150781 pWC->pWInfo = pWInfo;
150782 pWC->hasOr = 0;
150783 pWC->pOuter = 0;
150784 pWC->nTerm = 0;
150785 pWC->nBase = 0;
150786 pWC->nSlot = ArraySize(pWC->aStatic);
150787 pWC->a = pWC->aStatic;
150788 }
150789
150790 /*
@@ -150464,21 +150791,37 @@
150791 ** Deallocate a WhereClause structure. The WhereClause structure
150792 ** itself is not freed. This routine is the inverse of
150793 ** sqlite3WhereClauseInit().
150794 */
150795 SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){
 
 
150796 sqlite3 *db = pWC->pWInfo->pParse->db;
150797 assert( pWC->nTerm>=pWC->nBase );
150798 if( pWC->nTerm>0 ){
150799 WhereTerm *a = pWC->a;
150800 WhereTerm *aLast = &pWC->a[pWC->nTerm-1];
150801 #ifdef SQLITE_DEBUG
150802 int i;
150803 /* Verify that every term past pWC->nBase is virtual */
150804 for(i=pWC->nBase; i<pWC->nTerm; i++){
150805 assert( (pWC->a[i].wtFlags & TERM_VIRTUAL)!=0 );
150806 }
150807 #endif
150808 while(1){
150809 if( a->wtFlags & TERM_DYNAMIC ){
150810 sqlite3ExprDelete(db, a->pExpr);
150811 }
150812 if( a->wtFlags & (TERM_ORINFO|TERM_ANDINFO) ){
150813 if( a->wtFlags & TERM_ORINFO ){
150814 assert( (a->wtFlags & TERM_ANDINFO)==0 );
150815 whereOrInfoDelete(db, a->u.pOrInfo);
150816 }else{
150817 assert( (a->wtFlags & TERM_ANDINFO)!=0 );
150818 whereAndInfoDelete(db, a->u.pAndInfo);
150819 }
150820 }
150821 if( a==aLast ) break;
150822 a++;
150823 }
150824 }
150825 if( pWC->a!=pWC->aStatic ){
150826 sqlite3DbFree(db, pWC->a);
150827 }
@@ -150487,19 +150830,42 @@
150830
150831 /*
150832 ** These routines walk (recursively) an expression tree and generate
150833 ** a bitmask indicating which tables are used in that expression
150834 ** tree.
150835 **
150836 ** sqlite3WhereExprUsage(MaskSet, Expr) ->
150837 **
150838 ** Return a Bitmask of all tables referenced by Expr. Expr can be
150839 ** be NULL, in which case 0 is returned.
150840 **
150841 ** sqlite3WhereExprUsageNN(MaskSet, Expr) ->
150842 **
150843 ** Same as sqlite3WhereExprUsage() except that Expr must not be
150844 ** NULL. The "NN" suffix on the name stands for "Not Null".
150845 **
150846 ** sqlite3WhereExprListUsage(MaskSet, ExprList) ->
150847 **
150848 ** Return a Bitmask of all tables referenced by every expression
150849 ** in the expression list ExprList. ExprList can be NULL, in which
150850 ** case 0 is returned.
150851 **
150852 ** sqlite3WhereExprUsageFull(MaskSet, ExprList) ->
150853 **
150854 ** Internal use only. Called only by sqlite3WhereExprUsageNN() for
150855 ** complex expressions that require pushing register values onto
150856 ** the stack. Many calls to sqlite3WhereExprUsageNN() do not need
150857 ** the more complex analysis done by this routine. Hence, the
150858 ** computations done by this routine are broken out into a separate
150859 ** "no-inline" function to avoid the stack push overhead in the
150860 ** common case where it is not needed.
150861 */
150862 static SQLITE_NOINLINE Bitmask sqlite3WhereExprUsageFull(
150863 WhereMaskSet *pMaskSet,
150864 Expr *p
150865 ){
150866 Bitmask mask;
 
 
 
 
 
 
150867 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
150868 if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft);
150869 if( p->pRight ){
150870 mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pRight);
150871 assert( p->x.pList==0 );
@@ -150516,10 +150882,19 @@
150882 mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy);
150883 mask |= sqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter);
150884 }
150885 #endif
150886 return mask;
150887 }
150888 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
150889 if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
150890 return sqlite3WhereGetMask(pMaskSet, p->iTable);
150891 }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
150892 assert( p->op!=TK_IF_NULL_ROW );
150893 return 0;
150894 }
150895 return sqlite3WhereExprUsageFull(pMaskSet, p);
150896 }
150897 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){
150898 return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0;
150899 }
150900 SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){
@@ -150834,11 +151209,16 @@
151209 ** iCursor is not in the set.
151210 */
151211 SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){
151212 int i;
151213 assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );
151214 assert( pMaskSet->n>0 || pMaskSet->ix[0]<0 );
151215 assert( iCursor>=-1 );
151216 if( pMaskSet->ix[0]==iCursor ){
151217 return 1;
151218 }
151219 for(i=1; i<pMaskSet->n; i++){
151220 if( pMaskSet->ix[i]==iCursor ){
151221 return MASKBIT(i);
151222 }
151223 }
151224 return 0;
@@ -151019,20 +151399,20 @@
151399 pScan->nEquiv = 1;
151400 pScan->iEquiv = 1;
151401 if( pIdx ){
151402 int j = iColumn;
151403 iColumn = pIdx->aiColumn[j];
151404 if( iColumn==pIdx->pTable->iPKey ){
151405 iColumn = XN_ROWID;
151406 }else if( iColumn>=0 ){
151407 pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
151408 pScan->zCollName = pIdx->azColl[j];
151409 }else if( iColumn==XN_EXPR ){
151410 pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
151411 pScan->zCollName = pIdx->azColl[j];
151412 pScan->aiColumn[0] = XN_EXPR;
151413 return whereScanInitIndexExpr(pScan);
 
 
 
 
 
151414 }
151415 }else if( iColumn==XN_EXPR ){
151416 return 0;
151417 }
151418 pScan->aiColumn[0] = iColumn;
@@ -151312,13 +151692,13 @@
151692 ** Return TRUE if the WHERE clause term pTerm is of a form where it
151693 ** could be used with an index to access pSrc, assuming an appropriate
151694 ** index existed.
151695 */
151696 static int termCanDriveIndex(
151697 const WhereTerm *pTerm, /* WHERE clause term to check */
151698 const SrcItem *pSrc, /* Table we are trying to access */
151699 const Bitmask notReady /* Tables in outer loops of the join */
151700 ){
151701 char aff;
151702 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
151703 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
151704 if( (pSrc->fg.jointype & JT_LEFT)
@@ -151345,15 +151725,15 @@
151725 /*
151726 ** Generate code to construct the Index object for an automatic index
151727 ** and to set up the WhereLevel object pLevel so that the code generator
151728 ** makes use of the automatic index.
151729 */
151730 static SQLITE_NOINLINE void constructAutomaticIndex(
151731 Parse *pParse, /* The parsing context */
151732 const WhereClause *pWC, /* The WHERE clause */
151733 const SrcItem *pSrc, /* The FROM clause term to get the next index */
151734 const Bitmask notReady, /* Mask of cursors that are not available */
151735 WhereLevel *pLevel /* Write new index here */
151736 ){
151737 int nKeyCol; /* Number of columns in the constructed index */
151738 WhereTerm *pTerm; /* A single term of the WHERE clause */
151739 WhereTerm *pWCEnd; /* End of pWC->a[] */
@@ -151391,17 +151771,17 @@
151771 pWCEnd = &pWC->a[pWC->nTerm];
151772 pLoop = pLevel->pWLoop;
151773 idxCols = 0;
151774 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
151775 Expr *pExpr = pTerm->pExpr;
151776 /* Make the automatic index a partial index if there are terms in the
151777 ** WHERE clause (or the ON clause of a LEFT join) that constrain which
151778 ** rows of the target table (pSrc) that can be used. */
151779 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
151780 && ((pSrc->fg.jointype&JT_LEFT)==0 || ExprHasProperty(pExpr,EP_FromJoin))
151781 && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor)
151782 ){
151783 pPartial = sqlite3ExprAnd(pParse, pPartial,
151784 sqlite3ExprDup(pParse->db, pExpr, 0));
151785 }
151786 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
151787 int iCol;
@@ -151504,10 +151884,14 @@
151884 assert( pLevel->iIdxCur>=0 );
151885 pLevel->iIdxCur = pParse->nTab++;
151886 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
151887 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
151888 VdbeComment((v, "for %s", pTable->zName));
151889 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
151890 pLevel->regFilter = ++pParse->nMem;
151891 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
151892 }
151893
151894 /* Fill the automatic index with content */
151895 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
151896 if( pTabItem->fg.viaCoroutine ){
151897 int regYield = pTabItem->regReturn;
@@ -151526,10 +151910,14 @@
151910 }
151911 regRecord = sqlite3GetTempReg(pParse);
151912 regBase = sqlite3GenerateIndexKey(
151913 pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
151914 );
151915 if( pLevel->regFilter ){
151916 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0,
151917 regBase, pLoop->u.btree.nEq);
151918 }
151919 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
151920 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
151921 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
151922 if( pTabItem->fg.viaCoroutine ){
151923 sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
@@ -151551,10 +151939,127 @@
151939
151940 end_auto_index_create:
151941 sqlite3ExprDelete(pParse->db, pPartial);
151942 }
151943 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
151944
151945 /*
151946 ** Generate bytecode that will initialize a Bloom filter that is appropriate
151947 ** for pLevel.
151948 **
151949 ** If there are inner loops within pLevel that have the WHERE_BLOOMFILTER
151950 ** flag set, initialize a Bloomfilter for them as well. Except don't do
151951 ** this recursive initialization if the SQLITE_BloomPulldown optimization has
151952 ** been turned off.
151953 **
151954 ** When the Bloom filter is initialized, the WHERE_BLOOMFILTER flag is cleared
151955 ** from the loop, but the regFilter value is set to a register that implements
151956 ** the Bloom filter. When regFilter is positive, the
151957 ** sqlite3WhereCodeOneLoopStart() will generate code to test the Bloom filter
151958 ** and skip the subsequence B-Tree seek if the Bloom filter indicates that
151959 ** no matching rows exist.
151960 **
151961 ** This routine may only be called if it has previously been determined that
151962 ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
151963 ** is set.
151964 */
151965 static SQLITE_NOINLINE void constructBloomFilter(
151966 WhereInfo *pWInfo, /* The WHERE clause */
151967 int iLevel, /* Index in pWInfo->a[] that is pLevel */
151968 WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */
151969 Bitmask notReady /* Loops that are not ready */
151970 ){
151971 int addrOnce; /* Address of opening OP_Once */
151972 int addrTop; /* Address of OP_Rewind */
151973 int addrCont; /* Jump here to skip a row */
151974 const WhereTerm *pTerm; /* For looping over WHERE clause terms */
151975 const WhereTerm *pWCEnd; /* Last WHERE clause term */
151976 Parse *pParse = pWInfo->pParse; /* Parsing context */
151977 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
151978 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
151979 int iCur; /* Cursor for table getting the filter */
151980
151981 assert( pLoop!=0 );
151982 assert( v!=0 );
151983 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
151984
151985 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
151986 do{
151987 const SrcItem *pItem;
151988 const Table *pTab;
151989 u64 sz;
151990 sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel);
151991 addrCont = sqlite3VdbeMakeLabel(pParse);
151992 iCur = pLevel->iTabCur;
151993 pLevel->regFilter = ++pParse->nMem;
151994
151995 /* The Bloom filter is a Blob held in a register. Initialize it
151996 ** to zero-filled blob of at least 80K bits, but maybe more if the
151997 ** estimated size of the table is larger. We could actually
151998 ** measure the size of the table at run-time using OP_Count with
151999 ** P3==1 and use that value to initialize the blob. But that makes
152000 ** testing complicated. By basing the blob size on the value in the
152001 ** sqlite_stat1 table, testing is much easier.
152002 */
152003 pItem = &pWInfo->pTabList->a[pLevel->iFrom];
152004 assert( pItem!=0 );
152005 pTab = pItem->pTab;
152006 assert( pTab!=0 );
152007 sz = sqlite3LogEstToInt(pTab->nRowLogEst);
152008 if( sz<10000 ){
152009 sz = 10000;
152010 }else if( sz>10000000 ){
152011 sz = 10000000;
152012 }
152013 sqlite3VdbeAddOp2(v, OP_Blob, (int)sz, pLevel->regFilter);
152014
152015 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
152016 pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
152017 for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
152018 Expr *pExpr = pTerm->pExpr;
152019 if( (pTerm->wtFlags & TERM_VIRTUAL)==0
152020 && sqlite3ExprIsTableConstant(pExpr, iCur)
152021 ){
152022 sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
152023 }
152024 }
152025 if( pLoop->wsFlags & WHERE_IPK ){
152026 int r1 = sqlite3GetTempReg(pParse);
152027 sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1);
152028 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, 1);
152029 sqlite3ReleaseTempReg(pParse, r1);
152030 }else{
152031 Index *pIdx = pLoop->u.btree.pIndex;
152032 int n = pLoop->u.btree.nEq;
152033 int r1 = sqlite3GetTempRange(pParse, n);
152034 int jj;
152035 for(jj=0; jj<n; jj++){
152036 int iCol = pIdx->aiColumn[jj];
152037 assert( pIdx->pTable==pItem->pTab );
152038 sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
152039 }
152040 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
152041 sqlite3ReleaseTempRange(pParse, r1, n);
152042 }
152043 sqlite3VdbeResolveLabel(v, addrCont);
152044 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
152045 VdbeCoverage(v);
152046 sqlite3VdbeJumpHere(v, addrTop);
152047 pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
152048 if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
152049 while( iLevel < pWInfo->nLevel ){
152050 iLevel++;
152051 pLevel = &pWInfo->a[iLevel];
152052 pLoop = pLevel->pWLoop;
152053 if( pLoop==0 ) continue;
152054 if( pLoop->prereq & notReady ) continue;
152055 if( pLoop->wsFlags & WHERE_BLOOMFILTER ) break;
152056 }
152057 }while( iLevel < pWInfo->nLevel );
152058 sqlite3VdbeJumpHere(v, addrOnce);
152059 }
152060
152061
152062 #ifndef SQLITE_OMIT_VIRTUALTABLE
152063 /*
152064 ** Allocate and populate an sqlite3_index_info structure. It is the
152065 ** responsibility of the caller to eventually release the structure
@@ -152494,13 +152999,13 @@
152999 }
153000 sqlite3DebugPrintf(" %-19s", z);
153001 sqlite3_free(z);
153002 }
153003 if( p->wsFlags & WHERE_SKIPSCAN ){
153004 sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
153005 }else{
153006 sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm);
153007 }
153008 sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
153009 if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
153010 int i;
153011 for(i=0; i<p->nLTerm; i++){
@@ -152956,22 +153461,29 @@
153461 Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
153462 int i, j;
153463 LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
153464
153465 assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
153466 for(i=pWC->nBase, pTerm=pWC->a; i>0; i--, pTerm++){
153467 assert( pTerm!=0 );
153468 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
153469 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
153470 if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) continue;
153471 for(j=pLoop->nLTerm-1; j>=0; j--){
153472 pX = pLoop->aLTerm[j];
153473 if( pX==0 ) continue;
153474 if( pX==pTerm ) break;
153475 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
153476 }
153477 if( j<0 ){
153478 if( pLoop->maskSelf==pTerm->prereqAll ){
153479 /* If there are extra terms in the WHERE clause not used by an index
153480 ** that depend only on the table being scanned, and that will tend to
153481 ** cause many rows to be omitted, then mark that table as
153482 ** "self-culling". */
153483 pLoop->wsFlags |= WHERE_SELFCULL;
153484 }
153485 if( pTerm->truthProb<=0 ){
153486 /* If a truth probability is specified using the likelihood() hints,
153487 ** then use the probability provided by the application. */
153488 pLoop->nOut += pTerm->truthProb;
153489 }else{
@@ -152995,11 +153507,13 @@
153507 }
153508 }
153509 }
153510 }
153511 }
153512 if( pLoop->nOut > nRow-iReduce ){
153513 pLoop->nOut = nRow - iReduce;
153514 }
153515 }
153516
153517 /*
153518 ** Term pTerm is a vector range comparison operation. The first comparison
153519 ** in the vector can be optimized using column nEq of the index. This
@@ -154231,10 +154745,11 @@
154745 }else if( pOrTerm->leftCursor==iCur ){
154746 tempWC.pWInfo = pWC->pWInfo;
154747 tempWC.pOuter = pWC;
154748 tempWC.op = TK_AND;
154749 tempWC.nTerm = 1;
154750 tempWC.nBase = 1;
154751 tempWC.a = pOrTerm;
154752 sSubBuild.pWC = &tempWC;
154753 }else{
154754 continue;
154755 }
@@ -155337,10 +155852,154 @@
155852 }
155853 # define WHERETRACE_ALL_LOOPS(W,C) showAllWhereLoops(W,C)
155854 #else
155855 # define WHERETRACE_ALL_LOOPS(W,C)
155856 #endif
155857
155858 /* Attempt to omit tables from a join that do not affect the result.
155859 ** For a table to not affect the result, the following must be true:
155860 **
155861 ** 1) The query must not be an aggregate.
155862 ** 2) The table must be the RHS of a LEFT JOIN.
155863 ** 3) Either the query must be DISTINCT, or else the ON or USING clause
155864 ** must contain a constraint that limits the scan of the table to
155865 ** at most a single row.
155866 ** 4) The table must not be referenced by any part of the query apart
155867 ** from its own USING or ON clause.
155868 **
155869 ** For example, given:
155870 **
155871 ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1);
155872 ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2);
155873 ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3);
155874 **
155875 ** then table t2 can be omitted from the following:
155876 **
155877 ** SELECT v1, v3 FROM t1
155878 ** LEFT JOIN t2 ON (t1.ipk=t2.ipk)
155879 ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155880 **
155881 ** or from:
155882 **
155883 ** SELECT DISTINCT v1, v3 FROM t1
155884 ** LEFT JOIN t2
155885 ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
155886 */
155887 static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
155888 WhereInfo *pWInfo,
155889 Bitmask notReady
155890 ){
155891 int i;
155892 Bitmask tabUsed;
155893
155894 /* Preconditions checked by the caller */
155895 assert( pWInfo->nLevel>=2 );
155896 assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_OmitNoopJoin) );
155897
155898 /* These two preconditions checked by the caller combine to guarantee
155899 ** condition (1) of the header comment */
155900 assert( pWInfo->pResultSet!=0 );
155901 assert( 0==(pWInfo->wctrlFlags & WHERE_AGG_DISTINCT) );
155902
155903 tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet);
155904 if( pWInfo->pOrderBy ){
155905 tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy);
155906 }
155907 for(i=pWInfo->nLevel-1; i>=1; i--){
155908 WhereTerm *pTerm, *pEnd;
155909 SrcItem *pItem;
155910 WhereLoop *pLoop;
155911 pLoop = pWInfo->a[i].pWLoop;
155912 pItem = &pWInfo->pTabList->a[pLoop->iTab];
155913 if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
155914 if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0
155915 && (pLoop->wsFlags & WHERE_ONEROW)==0
155916 ){
155917 continue;
155918 }
155919 if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
155920 pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm;
155921 for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
155922 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155923 if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
155924 || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
155925 ){
155926 break;
155927 }
155928 }
155929 }
155930 if( pTerm<pEnd ) continue;
155931 WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
155932 notReady &= ~pLoop->maskSelf;
155933 for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
155934 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
155935 pTerm->wtFlags |= TERM_CODED;
155936 }
155937 }
155938 if( i!=pWInfo->nLevel-1 ){
155939 int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
155940 memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
155941 }
155942 pWInfo->nLevel--;
155943 assert( pWInfo->nLevel>0 );
155944 }
155945 return notReady;
155946 }
155947
155948 /*
155949 ** Check to see if there are any SEARCH loops that might benefit from
155950 ** using a Bloom filter. Consider a Bloom filter if:
155951 **
155952 ** (1) The SEARCH happens more than N times where N is the number
155953 ** of rows in the table that is being considered for the Bloom
155954 ** filter.
155955 ** (2) Some searches are expected to find zero rows. (This is determined
155956 ** by the WHERE_SELFCULL flag on the term.)
155957 ** (3) Bloom-filter processing is not disabled. (Checked by the
155958 ** caller.)
155959 ** (4) The size of the table being searched is known by ANALYZE.
155960 **
155961 ** This block of code merely checks to see if a Bloom filter would be
155962 ** appropriate, and if so sets the WHERE_BLOOMFILTER flag on the
155963 ** WhereLoop. The implementation of the Bloom filter comes further
155964 ** down where the code for each WhereLoop is generated.
155965 */
155966 static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
155967 const WhereInfo *pWInfo
155968 ){
155969 int i;
155970 LogEst nSearch;
155971
155972 assert( pWInfo->nLevel>=2 );
155973 assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
155974 nSearch = pWInfo->a[0].pWLoop->nOut;
155975 for(i=1; i<pWInfo->nLevel; i++){
155976 WhereLoop *pLoop = pWInfo->a[i].pWLoop;
155977 const int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
155978 if( (pLoop->wsFlags & reqFlags)==reqFlags
155979 /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
155980 && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
155981 ){
155982 SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
155983 Table *pTab = pItem->pTab;
155984 pTab->tabFlags |= TF_StatsUsed;
155985 if( nSearch > pTab->nRowLogEst
155986 && (pTab->tabFlags & TF_HasStat1)!=0
155987 ){
155988 testcase( pItem->fg.jointype & JT_LEFT );
155989 pLoop->wsFlags |= WHERE_BLOOMFILTER;
155990 pLoop->wsFlags &= ~WHERE_IDX_ONLY;
155991 WHERETRACE(0xffff, (
155992 "-> use Bloom-filter on loop %c because there are ~%.1e "
155993 "lookups into %s which has only ~%.1e rows\n",
155994 pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName,
155995 (double)sqlite3LogEstToInt(pTab->nRowLogEst)));
155996 }
155997 }
155998 nSearch += pLoop->nOut;
155999 }
156000 }
156001
156002 /*
156003 ** Generate the beginning of the loop used for WHERE clause processing.
156004 ** The return value is a pointer to an opaque structure that contains
156005 ** information needed to terminate the loop. Later, the calling routine
@@ -155468,16 +156127,10 @@
156127 /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
156128 testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
156129 if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
156130 sWLB.pOrderBy = pOrderBy;
156131
 
 
 
 
 
 
156132 /* The number of tables in the FROM clause is limited by the number of
156133 ** bits in a Bitmask
156134 */
156135 testcase( pTabList->nSrc==BMS );
156136 if( pTabList->nSrc>BMS ){
@@ -155520,10 +156173,14 @@
156173 memset(&pWInfo->nOBSat, 0,
156174 offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));
156175 memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));
156176 assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */
156177 pMaskSet = &pWInfo->sMaskSet;
156178 pMaskSet->n = 0;
156179 pMaskSet->ix[0] = -99; /* Initialize ix[0] to a value that can never be
156180 ** a valid cursor number, to avoid an initial
156181 ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */
156182 sWLB.pWInfo = pWInfo;
156183 sWLB.pWC = &pWInfo->sWC;
156184 sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);
156185 assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );
156186 whereLoopInit(sWLB.pNew);
@@ -155532,19 +156189,20 @@
156189 #endif
156190
156191 /* Split the WHERE clause into separate subexpressions where each
156192 ** subexpression is separated by an AND operator.
156193 */
 
156194 sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
156195 sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
156196
156197 /* Special case: No FROM clause
156198 */
156199 if( nTabList==0 ){
156200 if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;
156201 if( (wctrlFlags & WHERE_WANT_DISTINCT)!=0
156202 && OptimizationEnabled(db, SQLITE_DistinctOpt)
156203 ){
156204 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
156205 }
156206 ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW"));
156207 }else{
156208 /* Assign a bit from the bitmask to every term in the FROM clause.
@@ -155591,21 +156249,26 @@
156249 ** preserves SQLite's legacy behaviour in the following two cases:
156250 **
156251 ** FROM ... WHERE random()>0; -- eval random() once per row
156252 ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
156253 */
156254 for(ii=0; ii<sWLB.pWC->nBase; ii++){
156255 WhereTerm *pT = &sWLB.pWC->a[ii];
156256 if( pT->wtFlags & TERM_VIRTUAL ) continue;
156257 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
156258 sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL);
156259 pT->wtFlags |= TERM_CODED;
156260 }
156261 }
156262
156263 if( wctrlFlags & WHERE_WANT_DISTINCT ){
156264 if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
156265 /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
156266 ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
156267 wctrlFlags &= ~WHERE_WANT_DISTINCT;
156268 pWInfo->wctrlFlags &= ~WHERE_WANT_DISTINCT;
156269 }else if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
156270 /* The DISTINCT marking is pointless. Ignore it. */
156271 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
156272 }else if( pOrderBy==0 ){
156273 /* Try to ORDER BY the result set to make distinct processing easier */
156274 pWInfo->wctrlFlags |= WHERE_DISTINCTBY;
@@ -155702,88 +156365,40 @@
156365 sqlite3WhereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC);
156366 }
156367 }
156368 #endif
156369
156370 /* Attempt to omit tables from a join that do not affect the result.
156371 ** See the comment on whereOmitNoopJoin() for further information.
156372 **
156373 ** This query optimization is factored out into a separate "no-inline"
156374 ** procedure to keep the sqlite3WhereBegin() procedure from becoming
156375 ** too large. If sqlite3WhereBegin() becomes too large, that prevents
156376 ** some C-compiler optimizers from in-lining the
156377 ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to
156378 ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156379 */
156380 notReady = ~(Bitmask)0;
156381 if( pWInfo->nLevel>=2
156382 && pResultSet!=0 /* these two combine to guarantee */
156383 && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */
156384 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
156385 ){
156386 notReady = whereOmitNoopJoin(pWInfo, notReady);
156387 nTabList = pWInfo->nLevel;
156388 assert( nTabList>0 );
156389 }
156390
156391 /* Check to see if there are any SEARCH loops that might benefit from
156392 ** using a Bloom filter.
156393 */
156394 if( pWInfo->nLevel>=2
156395 && OptimizationEnabled(db, SQLITE_BloomFilter)
156396 ){
156397 whereCheckIfBloomFilterIsUseful(pWInfo);
156398 }
156399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156400 #if defined(WHERETRACE_ENABLED)
156401 if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */
156402 sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n");
156403 sqlite3WhereClausePrint(sWLB.pWC);
156404 }
@@ -155968,17 +156583,21 @@
156583 int addrExplain;
156584 int wsFlags;
156585 if( pParse->nErr ) goto whereBeginError;
156586 pLevel = &pWInfo->a[ii];
156587 wsFlags = pLevel->pWLoop->wsFlags;
156588 if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){
156589 if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){
156590 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
156591 constructAutomaticIndex(pParse, &pWInfo->sWC,
156592 &pTabList->a[pLevel->iFrom], notReady, pLevel);
156593 #endif
156594 }else{
156595 constructBloomFilter(pWInfo, ii, pLevel, notReady);
156596 }
156597 if( db->mallocFailed ) goto whereBeginError;
156598 }
 
156599 addrExplain = sqlite3WhereExplainOneScan(
156600 pParse, pTabList, pLevel, wctrlFlags
156601 );
156602 pLevel->addrBody = sqlite3VdbeCurrentAddr(v);
156603 notReady = sqlite3WhereCodeOneLoopStart(pParse,v,pWInfo,ii,pLevel,notReady);
@@ -159701,14 +160320,14 @@
160320 #define TK_DETACH 40
160321 #define TK_EACH 41
160322 #define TK_FAIL 42
160323 #define TK_OR 43
160324 #define TK_AND 44
160325 #define TK_MATCH 45
160326 #define TK_LIKE_KW 46
160327 #define TK_BETWEEN 47
160328 #define TK_IS 48
160329 #define TK_IN 49
160330 #define TK_ISNULL 50
160331 #define TK_NOTNULL 51
160332 #define TK_NE 52
160333 #define TK_EQ 53
@@ -160016,216 +160635,215 @@
160635 ** yy_reduce_ofst[] For each state, the offset into yy_action for
160636 ** shifting non-terminals after a reduce.
160637 ** yy_default[] Default action for each state.
160638 **
160639 *********** Begin parsing tables **********************************************/
160640 #define YY_ACTTAB_COUNT (2022)
160641 static const YYACTIONTYPE yy_action[] = {
160642 /* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564,
160643 /* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407,
160644 /* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558,
160645 /* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966,
160646 /* 40 */ 296, 1269, 296, 122, 123, 1207, 1207, 1041, 113, 1044,
160647 /* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407,
160648 /* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112,
160649 /* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250,
160650 /* 80 */ 217, 71, 71, 122, 123, 1207, 1207, 1041, 113, 1044,
160651 /* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440,
160652 /* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117,
160653 /* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513,
160654 /* 120 */ 1548, 1554, 374, 213, 6, 169, 1154, 522, 1154, 407,
160655 /* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121,
160656 /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
160657 /* 150 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160658 /* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183,
160659 /* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124,
160660 /* 180 */ 567, 1128, 1627, 344, 1627, 497, 119, 119, 119, 119,
160661 /* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407,
160662 /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442,
160663 /* 210 */ 474, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160664 /* 220 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160665 /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 208,
160666 /* 240 */ 539, 1548, 1424, 81, 339, 6, 342, 80, 119, 119,
160667 /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381,
160668 /* 260 */ 1126, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160669 /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 463, 332,
160670 /* 280 */ 359, 1567, 119, 119, 119, 119, 118, 118, 117, 117,
160671 /* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573,
160672 /* 300 */ 571, 2, 1235, 307, 1149, 141, 417, 307, 407, 141,
160673 /* 310 */ 1183, 98, 1317, 489, 866, 531, 1317, 1149, 215, 512,
160674 /* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160675 /* 330 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160676 /* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001,
160677 /* 350 */ 1257, 275, 275, 1128, 1628, 1021, 1628, 137, 415, 1600,
160678 /* 360 */ 561, 272, 1255, 950, 561, 1423, 1183, 1184, 1185, 1594,
160679 /* 370 */ 866, 1012, 530, 315, 231, 1011, 317, 1276, 231, 119,
160680 /* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160681 /* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160682 /* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013,
160683 /* 410 */ 446, 877, 564, 306, 555, 407, 447, 1021, 563, 346,
160684 /* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71,
160685 /* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122,
160686 /* 440 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160687 /* 450 */ 121, 121, 121, 121, 1304, 219, 1283, 1183, 407, 570,
160688 /* 460 */ 1183, 1235, 503, 1477, 1304, 546, 307, 489, 141, 1011,
160689 /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 382, 1214, 378,
160690 /* 480 */ 950, 514, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160691 /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 472, 119, 119,
160692 /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283,
160693 /* 510 */ 275, 275, 1476, 1183, 1184, 1185, 1183, 1184, 1185, 417,
160694 /* 520 */ 1183, 243, 541, 561, 502, 499, 498, 1001, 407, 478,
160695 /* 530 */ 1183, 472, 870, 143, 497, 1549, 185, 231, 9, 6,
160696 /* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160697 /* 550 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160698 /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 372, 446,
160699 /* 570 */ 363, 863, 288, 1183, 397, 1204, 1183, 1184, 1185, 931,
160700 /* 580 */ 330, 458, 318, 526, 564, 541, 1183, 1184, 1185, 284,
160701 /* 590 */ 1183, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160702 /* 600 */ 120, 120, 121, 121, 121, 121, 291, 71, 71, 275,
160703 /* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160704 /* 620 */ 116, 442, 561, 1031, 1031, 1042, 1183, 1045, 287, 1183,
160705 /* 630 */ 1184, 1185, 1204, 137, 218, 542, 1541, 407, 363, 470,
160706 /* 640 */ 431, 1167, 32, 363, 527, 350, 1183, 1184, 1185, 380,
160707 /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160708 /* 660 */ 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160709 /* 670 */ 120, 120, 121, 121, 121, 121, 407, 392, 1227, 1183,
160710 /* 680 */ 1022, 1540, 1183, 1184, 1185, 1523, 149, 1307, 1307, 306,
160711 /* 690 */ 555, 151, 1546, 361, 5, 564, 6, 3, 1035, 1542,
160712 /* 700 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160713 /* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71,
160714 /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160715 /* 730 */ 442, 1183, 426, 428, 1183, 1183, 1184, 1185, 191, 261,
160716 /* 740 */ 278, 358, 508, 353, 507, 248, 407, 455, 137, 1539,
160717 /* 750 */ 1006, 349, 363, 472, 1539, 302, 1228, 405, 281, 119,
160718 /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160719 /* 770 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160720 /* 780 */ 120, 121, 121, 121, 121, 407, 452, 1183, 1184, 1185,
160721 /* 790 */ 1183, 1184, 1185, 275, 275, 269, 269, 489, 483, 1525,
160722 /* 800 */ 148, 363, 480, 564, 306, 555, 561, 489, 561, 122,
160723 /* 810 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160724 /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 293, 119,
160725 /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160726 /* 840 */ 1183, 420, 1316, 564, 98, 417, 199, 13, 13, 150,
160727 /* 850 */ 306, 555, 1312, 322, 386, 407, 506, 478, 562, 400,
160728 /* 860 */ 920, 920, 425, 1539, 887, 292, 71, 71, 119, 119,
160729 /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122,
160730 /* 880 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160731 /* 890 */ 121, 121, 121, 121, 564, 1149, 1183, 1184, 1185, 407,
160732 /* 900 */ 275, 275, 451, 303, 1089, 1089, 486, 448, 1149, 276,
160733 /* 910 */ 276, 1149, 1539, 561, 319, 286, 321, 71, 71, 429,
160734 /* 920 */ 451, 450, 561, 952, 101, 1207, 1207, 1041, 113, 1044,
160735 /* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119,
160736 /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105,
160737 /* 950 */ 1183, 1547, 564, 12, 437, 6, 329, 564, 834, 835,
160738 /* 960 */ 836, 1629, 393, 547, 1106, 246, 245, 244, 1545, 1258,
160739 /* 970 */ 413, 1521, 6, 1086, 310, 71, 71, 1086, 564, 1107,
160740 /* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117,
160741 /* 990 */ 117, 116, 442, 451, 104, 427, 537, 320, 275, 275,
160742 /* 1000 */ 906, 13, 13, 520, 1482, 1105, 1183, 1184, 1185, 484,
160743 /* 1010 */ 907, 561, 546, 564, 407, 536, 295, 478, 253, 200,
160744 /* 1020 */ 1106, 548, 1482, 1484, 1160, 1409, 16, 16, 126, 557,
160745 /* 1030 */ 413, 479, 311, 951, 407, 1107, 71, 71, 122, 123,
160746 /* 1040 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160747 /* 1050 */ 121, 121, 121, 1204, 407, 544, 552, 314, 122, 123,
160748 /* 1060 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160749 /* 1070 */ 121, 121, 121, 441, 144, 1160, 468, 146, 122, 111,
160750 /* 1080 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160751 /* 1090 */ 121, 121, 121, 247, 12, 1482, 422, 119, 119, 119,
160752 /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564,
160753 /* 1110 */ 1204, 207, 404, 403, 858, 950, 294, 119, 119, 119,
160754 /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 30,
160755 /* 1130 */ 564, 1409, 55, 55, 1599, 564, 895, 119, 119, 119,
160756 /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 510, 1409,
160757 /* 1150 */ 1409, 56, 56, 15, 15, 439, 438, 407, 13, 13,
160758 /* 1160 */ 31, 1187, 412, 1211, 1183, 1184, 1185, 196, 1213, 306,
160759 /* 1170 */ 555, 858, 462, 193, 926, 564, 1212, 489, 361, 925,
160760 /* 1180 */ 1183, 564, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160761 /* 1190 */ 120, 120, 121, 121, 121, 121, 1544, 1149, 43, 43,
160762 /* 1200 */ 6, 1214, 423, 1214, 13, 13, 564, 219, 538, 494,
160763 /* 1210 */ 1149, 108, 556, 1149, 4, 392, 1127, 434, 1187, 194,
160764 /* 1220 */ 424, 485, 337, 1315, 414, 171, 1253, 1321, 559, 57,
160765 /* 1230 */ 57, 564, 950, 564, 224, 247, 1183, 1184, 1185, 561,
160766 /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160767 /* 1250 */ 442, 443, 564, 517, 13, 13, 44, 44, 275, 275,
160768 /* 1260 */ 1409, 275, 275, 553, 1353, 529, 213, 549, 456, 543,
160769 /* 1270 */ 465, 561, 564, 137, 561, 58, 58, 469, 405, 1222,
160770 /* 1280 */ 405, 274, 217, 108, 556, 110, 4, 405, 275, 275,
160771 /* 1290 */ 564, 1352, 1021, 564, 1228, 59, 59, 523, 106, 106,
160772 /* 1300 */ 559, 561, 275, 275, 412, 107, 457, 443, 566, 565,
160773 /* 1310 */ 564, 8, 1011, 60, 60, 561, 61, 61, 564, 965,
160774 /* 1320 */ 349, 926, 305, 443, 84, 204, 925, 966, 564, 306,
160775 /* 1330 */ 555, 435, 405, 62, 62, 553, 476, 105, 564, 103,
160776 /* 1340 */ 464, 45, 45, 1203, 1011, 1011, 1013, 1014, 27, 533,
160777 /* 1350 */ 564, 46, 46, 453, 532, 1572, 1171, 445, 1528, 564,
160778 /* 1360 */ 279, 47, 47, 327, 1021, 390, 390, 389, 264, 387,
160779 /* 1370 */ 106, 106, 843, 49, 49, 108, 556, 107, 4, 443,
160780 /* 1380 */ 566, 565, 50, 50, 1011, 225, 564, 313, 564, 96,
160781 /* 1390 */ 564, 228, 559, 524, 147, 312, 38, 1123, 564, 394,
160782 /* 1400 */ 466, 328, 280, 98, 544, 564, 17, 564, 323, 63,
160783 /* 1410 */ 63, 64, 64, 65, 65, 443, 1011, 1011, 1013, 1014,
160784 /* 1420 */ 27, 14, 14, 289, 564, 227, 564, 553, 66, 66,
160785 /* 1430 */ 128, 128, 477, 162, 564, 309, 135, 564, 1003, 277,
160786 /* 1440 */ 252, 533, 564, 1501, 564, 418, 534, 67, 67, 52,
160787 /* 1450 */ 52, 564, 1287, 226, 564, 1500, 1021, 68, 68, 208,
160788 /* 1460 */ 69, 69, 106, 106, 1286, 53, 53, 157, 157, 107,
160789 /* 1470 */ 873, 443, 566, 565, 158, 158, 1011, 76, 76, 564,
160790 /* 1480 */ 357, 564, 108, 556, 471, 4, 252, 408, 885, 884,
160791 /* 1490 */ 356, 564, 306, 555, 564, 473, 564, 252, 481, 559,
160792 /* 1500 */ 564, 334, 54, 54, 72, 72, 564, 230, 1011, 1011,
160793 /* 1510 */ 1013, 1014, 27, 564, 129, 129, 449, 73, 73, 130,
160794 /* 1520 */ 130, 564, 443, 131, 131, 519, 564, 873, 564, 127,
160795 /* 1530 */ 127, 333, 1071, 98, 553, 1349, 156, 156, 564, 495,
160796 /* 1540 */ 347, 249, 98, 338, 155, 155, 892, 893, 533, 136,
160797 /* 1550 */ 136, 134, 134, 532, 341, 1171, 445, 1587, 564, 279,
160798 /* 1560 */ 343, 132, 132, 1021, 390, 390, 389, 264, 387, 106,
160799 /* 1570 */ 106, 843, 564, 1067, 564, 249, 107, 564, 443, 566,
160800 /* 1580 */ 565, 133, 133, 1011, 225, 1015, 313, 108, 556, 1071,
160801 /* 1590 */ 4, 345, 968, 969, 312, 75, 75, 77, 77, 1300,
160802 /* 1600 */ 74, 74, 564, 1132, 559, 564, 108, 556, 959, 4,
160803 /* 1610 */ 252, 923, 1083, 110, 1083, 1011, 1011, 1013, 1014, 27,
160804 /* 1620 */ 1082, 1285, 1082, 559, 227, 42, 42, 443, 48, 48,
160805 /* 1630 */ 1284, 856, 162, 145, 924, 135, 110, 352, 362, 553,
160806 /* 1640 */ 1340, 1361, 1015, 1408, 1336, 301, 443, 1561, 1347, 550,
160807 /* 1650 */ 1414, 551, 226, 202, 1265, 1333, 1256, 1244, 553, 1243,
160808 /* 1660 */ 490, 1245, 1580, 267, 11, 391, 210, 223, 1021, 1390,
160809 /* 1670 */ 1395, 282, 365, 367, 106, 106, 930, 369, 454, 285,
160810 /* 1680 */ 1383, 107, 325, 443, 566, 565, 408, 1021, 1011, 326,
160811 /* 1690 */ 475, 306, 555, 106, 106, 100, 556, 500, 4, 1400,
160812 /* 1700 */ 107, 1399, 443, 566, 565, 398, 1283, 1011, 214, 355,
160813 /* 1710 */ 1473, 290, 559, 1472, 1583, 449, 554, 371, 331, 197,
160814 /* 1720 */ 1011, 1011, 1013, 1014, 27, 198, 209, 385, 1222, 173,
160815 /* 1730 */ 221, 256, 1520, 1518, 1219, 443, 79, 416, 206, 1011,
160816 /* 1740 */ 1011, 1013, 1014, 27, 83, 279, 182, 553, 82, 167,
160817 /* 1750 */ 390, 390, 389, 264, 387, 35, 1396, 843, 1478, 459,
160818 /* 1760 */ 175, 177, 460, 493, 178, 179, 180, 233, 96, 396,
160819 /* 1770 */ 225, 1402, 313, 1401, 36, 1404, 1021, 467, 186, 482,
160820 /* 1780 */ 312, 399, 106, 106, 237, 1467, 89, 1489, 488, 107,
160821 /* 1790 */ 239, 443, 566, 565, 268, 336, 1011, 190, 491, 340,
160822 /* 1800 */ 240, 401, 1246, 241, 509, 1294, 430, 1303, 91, 877,
160823 /* 1810 */ 227, 215, 1566, 1302, 1301, 1273, 1598, 432, 162, 518,
160824 /* 1820 */ 1272, 135, 1597, 354, 402, 433, 1271, 1596, 1011, 1011,
160825 /* 1830 */ 1013, 1014, 27, 1293, 299, 360, 300, 525, 226, 95,
160826 /* 1840 */ 254, 255, 1344, 364, 436, 125, 544, 1552, 10, 1453,
160827 /* 1850 */ 379, 1551, 102, 304, 97, 528, 34, 568, 1177, 263,
160828 /* 1860 */ 265, 266, 569, 1241, 1236, 172, 409, 410, 159, 383,
160829 /* 1870 */ 377, 366, 408, 1345, 1343, 368, 370, 306, 555, 1342,
160830 /* 1880 */ 1326, 1325, 1368, 201, 384, 1367, 1505, 1506, 160, 1504,
160831 /* 1890 */ 1503, 142, 161, 211, 212, 78, 830, 444, 203, 308,
160832 /* 1900 */ 297, 449, 222, 1081, 139, 1079, 316, 174, 163, 1203,
160833 /* 1910 */ 229, 176, 232, 909, 324, 1095, 164, 181, 165, 419,
160834 /* 1920 */ 421, 183, 85, 86, 87, 88, 166, 1098, 235, 234,
160835 /* 1930 */ 1094, 152, 18, 236, 335, 1087, 252, 1216, 487, 238,
160836 /* 1940 */ 37, 187, 188, 845, 492, 356, 242, 348, 496, 189,
160837 /* 1950 */ 90, 93, 19, 20, 168, 875, 501, 351, 92, 504,
160838 /* 1960 */ 888, 153, 511, 1133, 1165, 154, 298, 1047, 94, 1134,
160839 /* 1970 */ 39, 958, 216, 271, 273, 192, 953, 110, 1151, 251,
160840 /* 1980 */ 1155, 21, 1159, 22, 1158, 1139, 1153, 33, 23, 24,
160841 /* 1990 */ 540, 25, 195, 98, 26, 1062, 1048, 1046, 1050, 1104,
160842 /* 2000 */ 7, 1103, 257, 258, 1051, 28, 40, 560, 1016, 857,
160843 /* 2010 */ 109, 29, 919, 138, 259, 260, 170, 1589, 388, 1588,
160844 /* 2020 */ 1173, 1172,
 
160845 };
160846 static const YYCODETYPE yy_lookahead[] = {
160847 /* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192,
160848 /* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19,
160849 /* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210,
@@ -160236,202 +160854,202 @@
160854 /* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255,
160855 /* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49,
160856 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210,
160857 /* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109,
160858 /* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307,
160859 /* 120 */ 308, 313, 314, 25, 312, 192, 86, 261, 88, 19,
160860 /* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55,
160861 /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
160862 /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160863 /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115,
160864 /* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69,
160865 /* 180 */ 204, 22, 23, 16, 25, 131, 102, 103, 104, 105,
160866 /* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19,
160867 /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
160868 /* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109,
160869 /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160870 /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 141,
160871 /* 240 */ 307, 308, 272, 24, 77, 312, 79, 67, 102, 103,
160872 /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277,
160873 /* 260 */ 101, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160874 /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 127, 128,
160875 /* 280 */ 310, 311, 102, 103, 104, 105, 106, 107, 108, 109,
160876 /* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186,
160877 /* 300 */ 187, 188, 189, 194, 76, 196, 192, 194, 19, 196,
160878 /* 310 */ 59, 25, 203, 192, 59, 87, 203, 89, 164, 165,
160879 /* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160880 /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160881 /* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73,
160882 /* 350 */ 192, 238, 239, 22, 23, 100, 25, 81, 237, 229,
160883 /* 360 */ 251, 23, 204, 25, 251, 272, 115, 116, 117, 214,
160884 /* 370 */ 115, 116, 144, 192, 265, 120, 262, 222, 265, 102,
160885 /* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160886 /* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160887 /* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154,
160888 /* 410 */ 297, 125, 192, 137, 138, 19, 295, 100, 192, 23,
160889 /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216,
160890 /* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43,
160891 /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160892 /* 450 */ 54, 55, 56, 57, 222, 117, 224, 59, 19, 187,
160893 /* 460 */ 59, 189, 23, 282, 232, 252, 194, 192, 196, 152,
160894 /* 470 */ 153, 154, 252, 72, 261, 203, 152, 248, 154, 250,
160895 /* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50,
160896 /* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103,
160897 /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267,
160898 /* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192,
160899 /* 520 */ 59, 118, 192, 251, 121, 122, 123, 73, 19, 192,
160900 /* 530 */ 59, 192, 23, 72, 131, 308, 22, 265, 22, 312,
160901 /* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160902 /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160903 /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 192, 297,
160904 /* 570 */ 192, 23, 267, 59, 203, 59, 115, 116, 117, 108,
160905 /* 580 */ 126, 127, 128, 192, 192, 192, 115, 116, 117, 262,
160906 /* 590 */ 59, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160907 /* 600 */ 52, 53, 54, 55, 56, 57, 267, 215, 216, 238,
160908 /* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160909 /* 620 */ 111, 112, 251, 45, 46, 47, 59, 49, 291, 115,
160910 /* 630 */ 116, 117, 116, 81, 192, 305, 306, 19, 192, 268,
160911 /* 640 */ 19, 23, 22, 192, 252, 24, 115, 116, 117, 192,
160912 /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160913 /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160914 /* 670 */ 52, 53, 54, 55, 56, 57, 19, 22, 23, 59,
160915 /* 680 */ 23, 303, 115, 116, 117, 192, 240, 234, 235, 137,
160916 /* 690 */ 138, 240, 308, 192, 22, 192, 312, 22, 120, 306,
160917 /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160918 /* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216,
160919 /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160920 /* 730 */ 112, 59, 231, 112, 59, 115, 116, 117, 25, 118,
160921 /* 740 */ 119, 120, 121, 122, 123, 124, 19, 243, 81, 303,
160922 /* 750 */ 23, 130, 192, 192, 303, 252, 101, 253, 203, 102,
160923 /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160924 /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160925 /* 780 */ 53, 54, 55, 56, 57, 19, 119, 115, 116, 117,
160926 /* 790 */ 115, 116, 117, 238, 239, 238, 239, 192, 280, 192,
160927 /* 800 */ 240, 192, 284, 192, 137, 138, 251, 192, 251, 43,
160928 /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160929 /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 267, 102,
160930 /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160931 /* 840 */ 59, 230, 237, 192, 25, 192, 192, 215, 216, 240,
160932 /* 850 */ 137, 138, 237, 16, 200, 19, 66, 192, 133, 205,
160933 /* 860 */ 135, 136, 230, 303, 74, 203, 215, 216, 102, 103,
160934 /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
160935 /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160936 /* 890 */ 54, 55, 56, 57, 192, 76, 115, 116, 117, 19,
160937 /* 900 */ 238, 239, 192, 252, 126, 127, 128, 192, 89, 238,
160938 /* 910 */ 239, 92, 303, 251, 77, 262, 79, 215, 216, 129,
160939 /* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49,
160940 /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
160941 /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12,
160942 /* 950 */ 59, 308, 192, 212, 252, 312, 291, 192, 7, 8,
160943 /* 960 */ 9, 300, 301, 203, 27, 126, 127, 128, 308, 207,
160944 /* 970 */ 208, 192, 312, 29, 192, 215, 216, 33, 192, 42,
160945 /* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109,
160946 /* 990 */ 110, 111, 112, 283, 158, 230, 66, 160, 238, 239,
160947 /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 65,
160948 /* 1010 */ 73, 251, 252, 192, 19, 85, 230, 192, 24, 24,
160949 /* 1020 */ 27, 261, 210, 211, 94, 192, 215, 216, 22, 207,
160950 /* 1030 */ 208, 290, 192, 142, 19, 42, 215, 216, 43, 44,
160951 /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160952 /* 1050 */ 55, 56, 57, 59, 19, 144, 63, 192, 43, 44,
160953 /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160954 /* 1070 */ 55, 56, 57, 252, 163, 145, 114, 22, 43, 44,
160955 /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160956 /* 1090 */ 55, 56, 57, 45, 212, 283, 263, 102, 103, 104,
160957 /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192,
160958 /* 1110 */ 116, 149, 106, 107, 59, 25, 291, 102, 103, 104,
160959 /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 22,
160960 /* 1130 */ 192, 192, 215, 216, 23, 192, 25, 102, 103, 104,
160961 /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 108, 192,
160962 /* 1150 */ 192, 215, 216, 215, 216, 106, 107, 19, 215, 216,
160963 /* 1160 */ 53, 59, 114, 114, 115, 116, 117, 285, 119, 137,
160964 /* 1170 */ 138, 116, 290, 230, 134, 192, 127, 192, 192, 139,
160965 /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51,
160966 /* 1190 */ 52, 53, 54, 55, 56, 57, 308, 76, 215, 216,
160967 /* 1200 */ 312, 152, 263, 154, 215, 216, 192, 117, 87, 19,
160968 /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 231, 116, 230,
160969 /* 1220 */ 263, 263, 237, 203, 298, 299, 203, 239, 36, 215,
160970 /* 1230 */ 216, 192, 142, 192, 15, 45, 115, 116, 117, 251,
160971 /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160972 /* 1250 */ 112, 59, 192, 203, 215, 216, 215, 216, 238, 239,
160973 /* 1260 */ 192, 238, 239, 71, 192, 144, 25, 203, 243, 230,
160974 /* 1270 */ 243, 251, 192, 81, 251, 215, 216, 243, 253, 60,
160975 /* 1280 */ 253, 255, 256, 19, 20, 25, 22, 253, 238, 239,
160976 /* 1290 */ 192, 192, 100, 192, 101, 215, 216, 19, 106, 107,
160977 /* 1300 */ 36, 251, 238, 239, 114, 113, 192, 115, 116, 117,
160978 /* 1310 */ 192, 47, 120, 215, 216, 251, 215, 216, 192, 31,
160979 /* 1320 */ 130, 134, 243, 59, 148, 149, 139, 39, 192, 137,
160980 /* 1330 */ 138, 263, 253, 215, 216, 71, 19, 157, 192, 159,
160981 /* 1340 */ 128, 215, 216, 25, 152, 153, 154, 155, 156, 85,
160982 /* 1350 */ 192, 215, 216, 268, 90, 0, 1, 2, 192, 192,
160983 /* 1360 */ 5, 215, 216, 151, 100, 10, 11, 12, 13, 14,
160984 /* 1370 */ 106, 107, 17, 215, 216, 19, 20, 113, 22, 115,
160985 /* 1380 */ 116, 117, 215, 216, 120, 30, 192, 32, 192, 148,
160986 /* 1390 */ 192, 24, 36, 115, 22, 40, 24, 23, 192, 25,
160987 /* 1400 */ 128, 23, 99, 25, 144, 192, 22, 192, 192, 215,
160988 /* 1410 */ 216, 215, 216, 215, 216, 59, 152, 153, 154, 155,
160989 /* 1420 */ 156, 215, 216, 151, 192, 70, 192, 71, 215, 216,
160990 /* 1430 */ 215, 216, 115, 78, 192, 132, 81, 192, 23, 22,
160991 /* 1440 */ 25, 85, 192, 192, 192, 61, 90, 215, 216, 215,
160992 /* 1450 */ 216, 192, 225, 98, 192, 192, 100, 215, 216, 141,
160993 /* 1460 */ 215, 216, 106, 107, 225, 215, 216, 215, 216, 113,
160994 /* 1470 */ 59, 115, 116, 117, 215, 216, 120, 215, 216, 192,
160995 /* 1480 */ 120, 192, 19, 20, 23, 22, 25, 132, 119, 120,
160996 /* 1490 */ 130, 192, 137, 138, 192, 23, 192, 25, 192, 36,
160997 /* 1500 */ 192, 192, 215, 216, 215, 216, 192, 140, 152, 153,
160998 /* 1510 */ 154, 155, 156, 192, 215, 216, 161, 215, 216, 215,
160999 /* 1520 */ 216, 192, 59, 215, 216, 19, 192, 116, 192, 215,
161000 /* 1530 */ 216, 23, 59, 25, 71, 192, 215, 216, 192, 23,
161001 /* 1540 */ 23, 25, 25, 192, 215, 216, 7, 8, 85, 215,
161002 /* 1550 */ 216, 215, 216, 90, 192, 1, 2, 140, 192, 5,
161003 /* 1560 */ 192, 215, 216, 100, 10, 11, 12, 13, 14, 106,
161004 /* 1570 */ 107, 17, 192, 23, 192, 25, 113, 192, 115, 116,
161005 /* 1580 */ 117, 215, 216, 120, 30, 59, 32, 19, 20, 116,
161006 /* 1590 */ 22, 192, 83, 84, 40, 215, 216, 215, 216, 192,
161007 /* 1600 */ 215, 216, 192, 97, 36, 192, 19, 20, 23, 22,
161008 /* 1610 */ 25, 23, 152, 25, 154, 152, 153, 154, 155, 156,
161009 /* 1620 */ 152, 225, 154, 36, 70, 215, 216, 59, 215, 216,
161010 /* 1630 */ 192, 23, 78, 25, 23, 81, 25, 192, 192, 71,
161011 /* 1640 */ 257, 192, 116, 192, 192, 254, 59, 317, 192, 192,
161012 /* 1650 */ 192, 235, 98, 241, 192, 254, 192, 192, 71, 192,
161013 /* 1660 */ 287, 192, 192, 286, 242, 190, 213, 296, 100, 266,
161014 /* 1670 */ 270, 244, 254, 254, 106, 107, 108, 254, 258, 258,
161015 /* 1680 */ 266, 113, 292, 115, 116, 117, 132, 100, 120, 245,
161016 /* 1690 */ 292, 137, 138, 106, 107, 19, 20, 219, 22, 270,
161017 /* 1700 */ 113, 270, 115, 116, 117, 270, 224, 120, 228, 218,
161018 /* 1710 */ 218, 245, 36, 218, 195, 161, 279, 258, 244, 248,
161019 /* 1720 */ 152, 153, 154, 155, 156, 248, 242, 244, 60, 296,
161020 /* 1730 */ 296, 140, 199, 199, 38, 59, 293, 199, 149, 152,
161021 /* 1740 */ 153, 154, 155, 156, 150, 5, 22, 71, 293, 43,
161022 /* 1750 */ 10, 11, 12, 13, 14, 269, 271, 17, 282, 18,
161023 /* 1760 */ 233, 236, 199, 18, 236, 236, 236, 198, 148, 245,
161024 /* 1770 */ 30, 271, 32, 271, 269, 233, 100, 245, 233, 199,
161025 /* 1780 */ 40, 245, 106, 107, 198, 245, 157, 289, 62, 113,
161026 /* 1790 */ 198, 115, 116, 117, 199, 288, 120, 22, 220, 199,
161027 /* 1800 */ 198, 220, 199, 198, 114, 226, 64, 217, 22, 125,
161028 /* 1810 */ 70, 164, 311, 217, 217, 217, 223, 24, 78, 304,
161029 /* 1820 */ 219, 81, 223, 217, 220, 112, 217, 217, 152, 153,
161030 /* 1830 */ 154, 155, 156, 226, 281, 220, 281, 143, 98, 114,
161031 /* 1840 */ 199, 91, 260, 259, 82, 147, 144, 316, 22, 276,
161032 /* 1850 */ 199, 316, 157, 278, 146, 145, 25, 201, 13, 193,
161033 /* 1860 */ 193, 6, 191, 191, 191, 299, 302, 302, 206, 246,
161034 /* 1870 */ 248, 259, 132, 260, 260, 259, 259, 137, 138, 260,
161035 /* 1880 */ 249, 249, 264, 247, 245, 264, 212, 212, 206, 212,
161036 /* 1890 */ 212, 221, 206, 213, 213, 212, 4, 3, 22, 162,
161037 /* 1900 */ 221, 161, 15, 23, 16, 23, 138, 150, 129, 25,
161038 /* 1910 */ 24, 141, 143, 20, 16, 1, 129, 141, 129, 61,
161039 /* 1920 */ 37, 150, 53, 53, 53, 53, 129, 115, 140, 34,
161040 /* 1930 */ 1, 5, 22, 114, 160, 68, 25, 75, 41, 140,
161041 /* 1940 */ 24, 68, 114, 20, 19, 130, 124, 23, 67, 22,
161042 /* 1950 */ 22, 148, 22, 22, 37, 59, 67, 24, 22, 96,
161043 /* 1960 */ 28, 23, 22, 97, 23, 23, 67, 23, 25, 23,
161044 /* 1970 */ 22, 115, 140, 23, 23, 22, 142, 25, 88, 34,
161045 /* 1980 */ 75, 34, 75, 34, 93, 23, 86, 22, 34, 34,
161046 /* 1990 */ 24, 34, 25, 25, 34, 23, 23, 23, 23, 23,
161047 /* 2000 */ 44, 23, 25, 22, 11, 22, 22, 25, 23, 23,
161048 /* 2010 */ 22, 22, 134, 23, 140, 140, 25, 140, 15, 140,
161049 /* 2020 */ 1, 1, 318, 318, 318, 318, 318, 318, 318, 318,
161050 /* 2030 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161051 /* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161052 /* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161053 /* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161054 /* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161055 /* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
@@ -160444,122 +161062,120 @@
161062 /* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161063 /* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161064 /* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161065 /* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161066 /* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161067 /* 2200 */ 318, 318, 318, 318, 318, 318,
 
 
161068 };
161069 #define YY_SHIFT_COUNT (571)
161070 #define YY_SHIFT_MIN (0)
161071 #define YY_SHIFT_MAX (2020)
161072 static const unsigned short int yy_shift_ofst[] = {
161073 /* 0 */ 1554, 1355, 1740, 1192, 1192, 552, 1264, 1356, 1463, 1587,
161074 /* 10 */ 1587, 1587, 276, 0, 0, 180, 1015, 1587, 1587, 1587,
161075 /* 20 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161076 /* 30 */ 1049, 1049, 1121, 1121, 54, 667, 552, 552, 552, 552,
161077 /* 40 */ 552, 40, 110, 219, 289, 396, 439, 509, 548, 618,
161078 /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
161079 /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
161080 /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1568, 1587,
161081 /* 80 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161082 /* 90 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161083 /* 100 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161084 /* 110 */ 1587, 1587, 1587, 1676, 1587, 1587, 1587, 1587, 1587, 1587,
161085 /* 120 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 146, 84, 84,
161086 /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 531,
161087 /* 140 */ 531, 51, 1190, 531, 531, 324, 324, 531, 713, 713,
161088 /* 150 */ 713, 713, 151, 154, 154, 4, 149, 2022, 2022, 621,
161089 /* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228,
161090 /* 170 */ 251, 159, 331, 531, 531, 531, 531, 531, 531, 531,
161091 /* 180 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161092 /* 190 */ 531, 531, 531, 819, 819, 531, 9, 25, 25, 1102,
161093 /* 200 */ 1102, 911, 1032, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161094 /* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891,
161095 /* 220 */ 675, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161096 /* 230 */ 531, 454, 531, 531, 531, 531, 531, 531, 531, 531,
161097 /* 240 */ 531, 531, 531, 531, 790, 790, 790, 531, 531, 531,
161098 /* 250 */ 338, 531, 531, 531, 516, 930, 531, 531, 993, 531,
161099 /* 260 */ 531, 531, 531, 531, 531, 531, 531, 778, 944, 725,
161100 /* 270 */ 994, 994, 994, 994, 1090, 725, 725, 1040, 1006, 951,
161101 /* 280 */ 1219, 962, 1176, 98, 1278, 1176, 1278, 1317, 1241, 962,
161102 /* 290 */ 962, 1241, 962, 98, 1317, 286, 1111, 1048, 1288, 1288,
161103 /* 300 */ 1288, 1278, 1260, 1260, 1180, 1318, 1187, 1372, 1668, 1668,
161104 /* 310 */ 1591, 1591, 1696, 1696, 1591, 1594, 1589, 1724, 1706, 1741,
161105 /* 320 */ 1741, 1741, 1741, 1591, 1745, 1620, 1589, 1589, 1620, 1724,
161106 /* 330 */ 1706, 1620, 1706, 1620, 1591, 1745, 1629, 1726, 1591, 1745,
161107 /* 340 */ 1775, 1591, 1745, 1591, 1745, 1775, 1690, 1690, 1690, 1742,
161108 /* 350 */ 1786, 1786, 1775, 1690, 1684, 1690, 1742, 1690, 1690, 1647,
161109 /* 360 */ 1793, 1713, 1713, 1775, 1694, 1725, 1694, 1725, 1694, 1725,
161110 /* 370 */ 1694, 1725, 1591, 1750, 1750, 1762, 1762, 1698, 1702, 1826,
161111 /* 380 */ 1591, 1695, 1698, 1708, 1710, 1620, 1831, 1845, 1845, 1855,
161112 /* 390 */ 1855, 1855, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161113 /* 400 */ 2022, 2022, 2022, 2022, 2022, 2022, 2022, 578, 837, 655,
161114 /* 410 */ 1193, 167, 839, 1055, 1374, 1303, 1107, 1367, 1212, 1272,
161115 /* 420 */ 1378, 1384, 1415, 1461, 1472, 1508, 1516, 1517, 1411, 1369,
161116 /* 430 */ 1539, 1360, 1506, 1473, 1550, 1585, 1509, 1588, 1460, 1468,
161117 /* 440 */ 1608, 1611, 1526, 1417, 1892, 1894, 1876, 1737, 1887, 1888,
161118 /* 450 */ 1880, 1882, 1768, 1757, 1779, 1884, 1884, 1886, 1770, 1893,
161119 /* 460 */ 1769, 1898, 1914, 1776, 1787, 1884, 1789, 1858, 1883, 1884,
161120 /* 470 */ 1771, 1869, 1870, 1871, 1872, 1797, 1812, 1895, 1788, 1929,
161121 /* 480 */ 1926, 1910, 1819, 1774, 1867, 1911, 1873, 1862, 1897, 1799,
161122 /* 490 */ 1828, 1916, 1923, 1925, 1815, 1822, 1927, 1881, 1928, 1930,
161123 /* 500 */ 1924, 1931, 1889, 1896, 1933, 1863, 1932, 1936, 1899, 1917,
161124 /* 510 */ 1938, 1803, 1940, 1941, 1942, 1944, 1943, 1946, 1948, 1866,
161125 /* 520 */ 1832, 1950, 1951, 1856, 1945, 1953, 1834, 1952, 1947, 1949,
161126 /* 530 */ 1954, 1955, 1890, 1905, 1900, 1956, 1907, 1891, 1957, 1962,
161127 /* 540 */ 1965, 1966, 1967, 1968, 1960, 1972, 1952, 1973, 1974, 1975,
161128 /* 550 */ 1976, 1977, 1978, 1981, 1993, 1983, 1984, 1985, 1986, 1988,
161129 /* 560 */ 1989, 1982, 1878, 1874, 1875, 1877, 1879, 1991, 1990, 2003,
161130 /* 570 */ 2019, 2020,
161131 };
161132 #define YY_REDUCE_COUNT (406)
161133 #define YY_REDUCE_MIN (-272)
161134 #define YY_REDUCE_MAX (1686)
161135 static const short yy_reduce_ofst[] = {
161136 /* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134,
161137 /* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765,
161138 /* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821,
161139 /* 30 */ 710, 812, -188, -67, -187, 555, 662, 1020, 1023, 1050,
161140 /* 40 */ 1064, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161141 /* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161142 /* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161143 /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 811, 917,
161144 /* 80 */ 936, 938, 983, 1014, 1041, 1060, 1080, 1098, 1101, 1118,
161145 /* 90 */ 1126, 1136, 1146, 1158, 1167, 1194, 1196, 1198, 1206, 1213,
161146 /* 100 */ 1215, 1232, 1234, 1242, 1245, 1250, 1252, 1259, 1262, 1287,
161147 /* 110 */ 1289, 1299, 1302, 1304, 1308, 1314, 1321, 1329, 1334, 1336,
161148 /* 120 */ 1346, 1366, 1380, 1382, 1385, 1410, 1413, -267, -267, -267,
161149 /* 130 */ -267, -267, -267, -267, -267, 446, -267, 451, -24, 121,
161150 /* 140 */ 560, 518, 232, 609, 330, -181, -111, 654, 557, 671,
161151 /* 150 */ 557, 671, 882, -30, 93, -267, -267, -267, -267, 155,
161152 /* 160 */ 155, 155, 181, 242, 305, 339, 561, -218, 453, 227,
161153 /* 170 */ 158, 661, 661, -171, 114, 327, 653, -166, 275, 605,
161154 /* 180 */ 615, 337, 833, 665, 939, 957, 825, 958, 985, 501,
161155 /* 190 */ 986, 378, 1068, 384, 643, 393, 741, 660, 888, 762,
161156 /* 200 */ 822, 229, 988, 926, 504, 1025, 1027, 1034, 1026, 1079,
161157 /* 210 */ -204, -174, -151, 18, 130, 198, 226, 376, 391, 442,
161158 /* 220 */ 457, 493, 607, 715, 779, 782, 840, 865, 1072, 1099,
161159 /* 230 */ 1114, 1085, 1166, 1216, 1251, 1263, 1306, 1309, 1343, 1351,
161160 /* 240 */ 1362, 1368, 1399, 1407, 1227, 1239, 1396, 1438, 1445, 1446,
161161 /* 250 */ 1383, 1449, 1451, 1452, 1391, 1330, 1456, 1457, 1416, 1458,
161162 /* 260 */ 226, 1462, 1464, 1465, 1467, 1469, 1470, 1373, 1377, 1412,
161163 /* 270 */ 1401, 1418, 1419, 1423, 1383, 1412, 1412, 1422, 1453, 1475,
161164 /* 280 */ 1371, 1400, 1403, 1427, 1420, 1414, 1421, 1390, 1444, 1429,
161165 /* 290 */ 1431, 1466, 1435, 1474, 1398, 1478, 1480, 1482, 1491, 1492,
161166 /* 300 */ 1495, 1459, 1471, 1477, 1437, 1483, 1484, 1519, 1433, 1434,
161167 /* 310 */ 1533, 1534, 1443, 1455, 1538, 1476, 1485, 1486, 1527, 1525,
161168 /* 320 */ 1528, 1529, 1530, 1563, 1569, 1524, 1500, 1502, 1532, 1505,
161169 /* 330 */ 1542, 1536, 1545, 1540, 1580, 1586, 1498, 1507, 1595, 1592,
161170 /* 340 */ 1578, 1600, 1602, 1603, 1605, 1581, 1590, 1596, 1597, 1579,
161171 /* 350 */ 1593, 1599, 1604, 1598, 1601, 1606, 1607, 1609, 1610, 1501,
161172 /* 360 */ 1515, 1553, 1555, 1615, 1582, 1584, 1613, 1612, 1614, 1616,
161173 /* 370 */ 1619, 1617, 1641, 1531, 1535, 1618, 1621, 1631, 1622, 1573,
161174 /* 380 */ 1651, 1575, 1632, 1636, 1623, 1639, 1656, 1666, 1667, 1671,
161175 /* 390 */ 1672, 1673, 1564, 1565, 1566, 1662, 1674, 1675, 1677, 1678,
161176 /* 400 */ 1682, 1670, 1679, 1680, 1681, 1683, 1686,
161177 };
161178 static const YYACTIONTYPE yy_default[] = {
161179 /* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462,
161180 /* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230,
161181 /* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230,
@@ -160680,14 +161296,14 @@
161296 59, /* DETACH => ID */
161297 59, /* EACH => ID */
161298 59, /* FAIL => ID */
161299 0, /* OR => nothing */
161300 0, /* AND => nothing */
 
161301 59, /* MATCH => ID */
161302 59, /* LIKE_KW => ID */
161303 0, /* BETWEEN => nothing */
161304 0, /* IS => nothing */
161305 0, /* IN => nothing */
161306 0, /* ISNULL => nothing */
161307 0, /* NOTNULL => nothing */
161308 0, /* NE => nothing */
161309 0, /* EQ => nothing */
@@ -160952,14 +161568,14 @@
161568 /* 40 */ "DETACH",
161569 /* 41 */ "EACH",
161570 /* 42 */ "FAIL",
161571 /* 43 */ "OR",
161572 /* 44 */ "AND",
161573 /* 45 */ "MATCH",
161574 /* 46 */ "LIKE_KW",
161575 /* 47 */ "BETWEEN",
161576 /* 48 */ "IS",
161577 /* 49 */ "IN",
161578 /* 50 */ "ISNULL",
161579 /* 51 */ "NOTNULL",
161580 /* 52 */ "NE",
161581 /* 53 */ "EQ",
@@ -169408,10 +170024,12 @@
170024 }
170025 oldLimit = db->aLimit[limitId];
170026 if( newLimit>=0 ){ /* IMP: R-52476-28732 */
170027 if( newLimit>aHardLimit[limitId] ){
170028 newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */
170029 }else if( newLimit<1 && limitId==SQLITE_LIMIT_LENGTH ){
170030 newLimit = 1;
170031 }
170032 db->aLimit[limitId] = newLimit;
170033 }
170034 return oldLimit; /* IMP: R-53341-35419 */
170035 }
@@ -170811,16 +171429,20 @@
171429 ** the schema to be reparsed the next time it is needed. This has the
171430 ** effect of erasing all imposter tables.
171431 */
171432 case SQLITE_TESTCTRL_IMPOSTER: {
171433 sqlite3 *db = va_arg(ap, sqlite3*);
171434 int iDb;
171435 sqlite3_mutex_enter(db->mutex);
171436 iDb = sqlite3FindDbName(db, va_arg(ap,const char*));
171437 if( iDb>=0 ){
171438 db->init.iDb = iDb;
171439 db->init.busy = db->init.imposterTable = va_arg(ap,int);
171440 db->init.newTnum = va_arg(ap,int);
171441 if( db->init.busy==0 && db->init.newTnum>0 ){
171442 sqlite3ResetAllSchemasOfConnection(db);
171443 }
171444 }
171445 sqlite3_mutex_leave(db->mutex);
171446 break;
171447 }
171448
@@ -170891,10 +171513,30 @@
171513 case 2: *ptr = sqlite3WhereTrace; break;
171514 case 3: sqlite3WhereTrace = *ptr; break;
171515 }
171516 break;
171517 }
171518
171519 /* sqlite3_test_control(SQLITE_TESTCTRL_LOGEST,
171520 ** double fIn, // Input value
171521 ** int *pLogEst, // sqlite3LogEstFromDouble(fIn)
171522 ** u64 *pInt, // sqlite3LogEstToInt(*pLogEst)
171523 ** int *pLogEst2 // sqlite3LogEst(*pInt)
171524 ** );
171525 **
171526 ** Test access for the LogEst conversion routines.
171527 */
171528 case SQLITE_TESTCTRL_LOGEST: {
171529 double rIn = va_arg(ap, double);
171530 LogEst rLogEst = sqlite3LogEstFromDouble(rIn);
171531 u64 iInt = sqlite3LogEstToInt(rLogEst);
171532 va_arg(ap, int*)[0] = rLogEst;
171533 va_arg(ap, u64*)[0] = iInt;
171534 va_arg(ap, int*)[0] = sqlite3LogEst(iInt);
171535 break;
171536 }
171537
171538
171539 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD)
171540 /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
171541 **
171542 ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
@@ -203302,11 +203944,11 @@
203944 **
203945 ** If the expression cannot be created, NULL is returned. In this case,
203946 ** the caller has to use an OFFSET clause to extract only the required
203947 ** rows from the sourct table, just as it does for an RBU update operation.
203948 */
203949 static char *rbuVacuumIndexStart(
203950 sqlite3rbu *p, /* RBU handle */
203951 RbuObjIter *pIter /* RBU iterator object */
203952 ){
203953 char *zOrder = 0;
203954 char *zLhs = 0;
@@ -223727,11 +224369,11 @@
224369 ** an error occurs, (*pRc) is set to an SQLite error code before returning.
224370 */
224371 static void fts5StructureMakeWritable(int *pRc, Fts5Structure **pp){
224372 Fts5Structure *p = *pp;
224373 if( *pRc==SQLITE_OK && p->nRef>1 ){
224374 i64 nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel);
224375 Fts5Structure *pNew;
224376 pNew = (Fts5Structure*)sqlite3Fts5MallocZero(pRc, nByte);
224377 if( pNew ){
224378 int i;
224379 memcpy(pNew, p, nByte);
@@ -224756,12 +225398,16 @@
225398 }
225399 }else{
225400 int iRowidOff;
225401 iRowidOff = fts5LeafFirstRowidOff(pNew);
225402 if( iRowidOff ){
225403 if( iRowidOff>=pNew->szLeaf ){
225404 p->rc = FTS5_CORRUPT;
225405 }else{
225406 pIter->pLeaf = pNew;
225407 pIter->iLeafOffset = iRowidOff;
225408 }
225409 }
225410 }
225411
225412 if( pIter->pLeaf ){
225413 u8 *a = &pIter->pLeaf->p[pIter->iLeafOffset];
@@ -232486,11 +233132,11 @@
233132 int nArg, /* Number of args */
233133 sqlite3_value **apUnused /* Function arguments */
233134 ){
233135 assert( nArg==0 );
233136 UNUSED_PARAM2(nArg, apUnused);
233137 sqlite3_result_text(pCtx, "fts5: 2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882", -1, SQLITE_TRANSIENT);
233138 }
233139
233140 /*
233141 ** Return true if zName is the extension on one of the shadow tables used
233142 ** by this module.
@@ -236703,11 +237349,11 @@
237349 rc = sqlite3Fts5FlushToDisk(pFts5);
237350 }
237351 }
237352
237353 if( rc==SQLITE_OK ){
237354 i64 nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor);
237355 pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte);
237356 }
237357
237358 if( pCsr ){
237359 pCsr->pFts5 = pFts5;
237360
+17 -4
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -144,13 +144,13 @@
144144
**
145145
** See also: [sqlite3_libversion()],
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149
-#define SQLITE_VERSION "3.37.0"
150
-#define SQLITE_VERSION_NUMBER 3037000
151
-#define SQLITE_SOURCE_ID "2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8"
149
+#define SQLITE_VERSION "3.38.0"
150
+#define SQLITE_VERSION_NUMBER 3038000
151
+#define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -7942,11 +7942,12 @@
79427942
#define SQLITE_TESTCTRL_PRNG_SEED 28
79437943
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
79447944
#define SQLITE_TESTCTRL_SEEK_COUNT 30
79457945
#define SQLITE_TESTCTRL_TRACEFLAGS 31
79467946
#define SQLITE_TESTCTRL_TUNE 32
7947
-#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
7947
+#define SQLITE_TESTCTRL_LOGEST 33
7948
+#define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
79487949
79497950
/*
79507951
** CAPI3REF: SQL Keyword Checking
79517952
**
79527953
** These routines provide access to the set of SQL language keywords
@@ -8464,10 +8465,20 @@
84648465
** <dd>^This is the number of times that the prepared statement has
84658466
** been run. A single "run" for the purposes of this counter is one
84668467
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
84678468
** The counter is incremented on the first [sqlite3_step()] call of each
84688469
** cycle.
8470
+**
8471
+** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8472
+** [[SQLITE_STMTSTATUS_FILTER HIT]]
8473
+** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8474
+** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8475
+** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8476
+** step was bypassed because a Bloom filter returned not-found. The
8477
+** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8478
+** times that the Bloom filter returned a find, and thus the join step
8479
+** had to be processed as normal.
84698480
**
84708481
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
84718482
** <dd>^This is the approximate number of bytes of heap memory
84728483
** used to store the prepared statement. ^This value is not actually
84738484
** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8479,10 +8490,12 @@
84798490
#define SQLITE_STMTSTATUS_SORT 2
84808491
#define SQLITE_STMTSTATUS_AUTOINDEX 3
84818492
#define SQLITE_STMTSTATUS_VM_STEP 4
84828493
#define SQLITE_STMTSTATUS_REPREPARE 5
84838494
#define SQLITE_STMTSTATUS_RUN 6
8495
+#define SQLITE_STMTSTATUS_FILTER_MISS 7
8496
+#define SQLITE_STMTSTATUS_FILTER_HIT 8
84848497
#define SQLITE_STMTSTATUS_MEMUSED 99
84858498
84868499
/*
84878500
** CAPI3REF: Custom Page Cache Object
84888501
**
84898502
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.37.0"
150 #define SQLITE_VERSION_NUMBER 3037000
151 #define SQLITE_SOURCE_ID "2021-11-22 16:06:57 0f567b61072e214c40cae1441889f83622a975f429b41803dfbed687718731c8"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -7942,11 +7942,12 @@
7942 #define SQLITE_TESTCTRL_PRNG_SEED 28
7943 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7944 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7945 #define SQLITE_TESTCTRL_TRACEFLAGS 31
7946 #define SQLITE_TESTCTRL_TUNE 32
7947 #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
 
7948
7949 /*
7950 ** CAPI3REF: SQL Keyword Checking
7951 **
7952 ** These routines provide access to the set of SQL language keywords
@@ -8464,10 +8465,20 @@
8464 ** <dd>^This is the number of times that the prepared statement has
8465 ** been run. A single "run" for the purposes of this counter is one
8466 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
8467 ** The counter is incremented on the first [sqlite3_step()] call of each
8468 ** cycle.
 
 
 
 
 
 
 
 
 
 
8469 **
8470 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8471 ** <dd>^This is the approximate number of bytes of heap memory
8472 ** used to store the prepared statement. ^This value is not actually
8473 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8479,10 +8490,12 @@
8479 #define SQLITE_STMTSTATUS_SORT 2
8480 #define SQLITE_STMTSTATUS_AUTOINDEX 3
8481 #define SQLITE_STMTSTATUS_VM_STEP 4
8482 #define SQLITE_STMTSTATUS_REPREPARE 5
8483 #define SQLITE_STMTSTATUS_RUN 6
 
 
8484 #define SQLITE_STMTSTATUS_MEMUSED 99
8485
8486 /*
8487 ** CAPI3REF: Custom Page Cache Object
8488 **
8489
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.38.0"
150 #define SQLITE_VERSION_NUMBER 3038000
151 #define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -7942,11 +7942,12 @@
7942 #define SQLITE_TESTCTRL_PRNG_SEED 28
7943 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7944 #define SQLITE_TESTCTRL_SEEK_COUNT 30
7945 #define SQLITE_TESTCTRL_TRACEFLAGS 31
7946 #define SQLITE_TESTCTRL_TUNE 32
7947 #define SQLITE_TESTCTRL_LOGEST 33
7948 #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
7949
7950 /*
7951 ** CAPI3REF: SQL Keyword Checking
7952 **
7953 ** These routines provide access to the set of SQL language keywords
@@ -8464,10 +8465,20 @@
8465 ** <dd>^This is the number of times that the prepared statement has
8466 ** been run. A single "run" for the purposes of this counter is one
8467 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
8468 ** The counter is incremented on the first [sqlite3_step()] call of each
8469 ** cycle.
8470 **
8471 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8472 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
8473 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8474 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8475 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8476 ** step was bypassed because a Bloom filter returned not-found. The
8477 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8478 ** times that the Bloom filter returned a find, and thus the join step
8479 ** had to be processed as normal.
8480 **
8481 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8482 ** <dd>^This is the approximate number of bytes of heap memory
8483 ** used to store the prepared statement. ^This value is not actually
8484 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -8479,10 +8490,12 @@
8490 #define SQLITE_STMTSTATUS_SORT 2
8491 #define SQLITE_STMTSTATUS_AUTOINDEX 3
8492 #define SQLITE_STMTSTATUS_VM_STEP 4
8493 #define SQLITE_STMTSTATUS_REPREPARE 5
8494 #define SQLITE_STMTSTATUS_RUN 6
8495 #define SQLITE_STMTSTATUS_FILTER_MISS 7
8496 #define SQLITE_STMTSTATUS_FILTER_HIT 8
8497 #define SQLITE_STMTSTATUS_MEMUSED 99
8498
8499 /*
8500 ** CAPI3REF: Custom Page Cache Object
8501 **
8502

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button