Fossil SCM

Update the built-in SQLite to the latest 3.24.0 alpha version.

drh 2018-04-25 13:34 trunk
Commit de76c92a63e9e009804cbdbad9622137260f1e3621f0e1b1c98c7469789dc896
+2 -1
--- src/main.mk
+++ src/main.mk
@@ -589,11 +589,12 @@
589589
-DSQLITE_ENABLE_DBPAGE_VTAB \
590590
-Dmain=sqlite3_shell \
591591
-DSQLITE_SHELL_IS_UTF8=1 \
592592
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
593593
-DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
594
- -DSQLITE_SHELL_DBNAME_PROC=fossil_open
594
+ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
595
+ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
595596
596597
# Setup the options used to compile the included miniz library.
597598
MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
598599
-DMINIZ_NO_TIME \
599600
-DMINIZ_NO_ARCHIVE_APIS
600601
--- src/main.mk
+++ src/main.mk
@@ -589,11 +589,12 @@
589 -DSQLITE_ENABLE_DBPAGE_VTAB \
590 -Dmain=sqlite3_shell \
591 -DSQLITE_SHELL_IS_UTF8=1 \
592 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
593 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
594 -DSQLITE_SHELL_DBNAME_PROC=fossil_open
 
595
596 # Setup the options used to compile the included miniz library.
597 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
598 -DMINIZ_NO_TIME \
599 -DMINIZ_NO_ARCHIVE_APIS
600
--- src/main.mk
+++ src/main.mk
@@ -589,11 +589,12 @@
589 -DSQLITE_ENABLE_DBPAGE_VTAB \
590 -Dmain=sqlite3_shell \
591 -DSQLITE_SHELL_IS_UTF8=1 \
592 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
593 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
594 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
595 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
596
597 # Setup the options used to compile the included miniz library.
598 MINIZ_OPTIONS = -DMINIZ_NO_STDIO \
599 -DMINIZ_NO_TIME \
600 -DMINIZ_NO_ARCHIVE_APIS
601
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -206,11 +206,12 @@
206206
set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
207207
-Dmain=sqlite3_shell
208208
-DSQLITE_SHELL_IS_UTF8=1
209209
-DSQLITE_OMIT_LOAD_EXTENSION=1
210210
-DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE)
211
- -DSQLITE_SHELL_DBNAME_PROC=fossil_open
211
+ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname
212
+ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
212213
}]
213214
214215
# miniz (libz drop-in alternative) precompiler flags.
215216
#
216217
set MINIZ_OPTIONS {
217218
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -206,11 +206,12 @@
206 set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
207 -Dmain=sqlite3_shell
208 -DSQLITE_SHELL_IS_UTF8=1
209 -DSQLITE_OMIT_LOAD_EXTENSION=1
210 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE)
211 -DSQLITE_SHELL_DBNAME_PROC=fossil_open
 
212 }]
213
214 # miniz (libz drop-in alternative) precompiler flags.
215 #
216 set MINIZ_OPTIONS {
217
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -206,11 +206,12 @@
206 set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
207 -Dmain=sqlite3_shell
208 -DSQLITE_SHELL_IS_UTF8=1
209 -DSQLITE_OMIT_LOAD_EXTENSION=1
210 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE)
211 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname
212 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
213 }]
214
215 # miniz (libz drop-in alternative) precompiler flags.
216 #
217 set MINIZ_OPTIONS {
218
+222 -77
--- src/shell.c
+++ src/shell.c
@@ -451,10 +451,16 @@
451451
** includes string formatting (e.g. "%s").
452452
*/
453453
#if !defined(raw_printf)
454454
# define raw_printf fprintf
455455
#endif
456
+
457
+/* Indicate out-of-memory and exit. */
458
+static void shell_out_of_memory(void){
459
+ raw_printf(stderr,"Error: out of memory\n");
460
+ exit(1);
461
+}
456462
457463
/*
458464
** Write I/O traces to the following stream.
459465
*/
460466
#ifdef SQLITE_ENABLE_IOTRACE
@@ -8527,10 +8533,26 @@
85278533
struct ExpertInfo {
85288534
sqlite3expert *pExpert;
85298535
int bVerbose;
85308536
};
85318537
8538
+/* A single line in the EQP output */
8539
+typedef struct EQPGraphRow EQPGraphRow;
8540
+struct EQPGraphRow {
8541
+ int iSelectId; /* The SelectID for this row */
8542
+ EQPGraphRow *pNext; /* Next row in sequence */
8543
+ char zText[1]; /* Text to display for this row */
8544
+};
8545
+
8546
+/* All EQP output is collected into an instance of the following */
8547
+typedef struct EQPGraph EQPGraph;
8548
+struct EQPGraph {
8549
+ EQPGraphRow *pRow; /* Linked list of all rows of the EQP output */
8550
+ EQPGraphRow *pLast; /* Last element of the pRow list */
8551
+ char zPrefix[100]; /* Graph prefix */
8552
+};
8553
+
85328554
/*
85338555
** State information about the database connection is contained in an
85348556
** instance of the following structure.
85358557
*/
85368558
typedef struct ShellState ShellState;
@@ -8540,10 +8562,12 @@
85408562
u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
85418563
u8 statsOn; /* True to display memory stats before each finalize */
85428564
u8 scanstatsOn; /* True to display scan stats before each finalize */
85438565
u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
85448566
u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
8567
+ u8 nEqpLevel; /* Depth of the EQP output graph */
8568
+ unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
85458569
int outCount; /* Revert to stdout when reaching zero */
85468570
int cnt; /* Number of records displayed so far */
85478571
FILE *out; /* Write results here */
85488572
FILE *traceOut; /* Output for sqlite3_trace() */
85498573
int nErr; /* Number of errors seen */
@@ -8573,10 +8597,11 @@
85738597
sqlite3_stmt *pStmt; /* Current statement if any. */
85748598
FILE *pLog; /* Write log output here */
85758599
int *aiIndent; /* Array of indents used in MODE_Explain */
85768600
int nIndent; /* Size of array aiIndent[] */
85778601
int iIndent; /* Index of current op in aiIndent[] */
8602
+ EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
85788603
#if defined(SQLITE_ENABLE_SESSION)
85798604
int nSession; /* Number of active sessions */
85808605
OpenSession aSession[4]; /* Array of sessions. [0] is in focus. */
85818606
#endif
85828607
ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
@@ -8629,10 +8654,11 @@
86298654
#define MODE_Tcl 7 /* Generate ANSI-C or TCL quoted elements */
86308655
#define MODE_Csv 8 /* Quote strings, numbers are plain */
86318656
#define MODE_Explain 9 /* Like MODE_Column, but do not truncate data */
86328657
#define MODE_Ascii 10 /* Use ASCII unit and record separators (0x1F/0x1E) */
86338658
#define MODE_Pretty 11 /* Pretty-print schemas */
8659
+#define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */
86348660
86358661
static const char *modeDescr[] = {
86368662
"line",
86378663
"column",
86388664
"list",
@@ -8643,10 +8669,11 @@
86438669
"tcl",
86448670
"csv",
86458671
"explain",
86468672
"ascii",
86478673
"prettyprint",
8674
+ "eqp"
86488675
};
86498676
86508677
/*
86518678
** These are the column/row/line separators used by the various
86528679
** import/export modes.
@@ -9191,11 +9218,110 @@
91919218
if( z[i]=='-' && z[i+1]=='-' ) return 1;
91929219
return 0;
91939220
}
91949221
return 1;
91959222
}
9196
-
9223
+
9224
+/*
9225
+** Add a new entry to the EXPLAIN QUERY PLAN data
9226
+*/
9227
+static void eqp_append(ShellState *p, int iSelectId, const char *zText){
9228
+ EQPGraphRow *pNew;
9229
+ int nText = strlen30(zText);
9230
+ pNew = sqlite3_malloc64( sizeof(*pNew) + nText );
9231
+ if( pNew==0 ) shell_out_of_memory();
9232
+ pNew->iSelectId = iSelectId;
9233
+ memcpy(pNew->zText, zText, nText+1);
9234
+ pNew->pNext = 0;
9235
+ if( p->sGraph.pLast ){
9236
+ p->sGraph.pLast->pNext = pNew;
9237
+ }else{
9238
+ p->sGraph.pRow = pNew;
9239
+ }
9240
+ p->sGraph.pLast = pNew;
9241
+}
9242
+
9243
+/*
9244
+** Free and reset the EXPLAIN QUERY PLAN data that has been collected
9245
+** in p->sGraph.
9246
+*/
9247
+static void eqp_reset(ShellState *p){
9248
+ EQPGraphRow *pRow, *pNext;
9249
+ for(pRow = p->sGraph.pRow; pRow; pRow = pNext){
9250
+ pNext = pRow->pNext;
9251
+ sqlite3_free(pRow);
9252
+ }
9253
+ memset(&p->sGraph, 0, sizeof(p->sGraph));
9254
+}
9255
+
9256
+/* Return the next EXPLAIN QUERY PLAN line with iSelectId that occurs after
9257
+** pOld, or return the first such line if pOld is NULL
9258
+*/
9259
+static EQPGraphRow *eqp_next_row(ShellState *p, int iSelectId, EQPGraphRow *pOld){
9260
+ EQPGraphRow *pRow = pOld ? pOld->pNext : p->sGraph.pRow;
9261
+ while( pRow && pRow->iSelectId!=iSelectId ) pRow = pRow->pNext;
9262
+ return pRow;
9263
+}
9264
+
9265
+/* Render a single level of the graph shell having iSelectId. Called
9266
+** recursively to render sublevels.
9267
+*/
9268
+static void eqp_render_level(ShellState *p, int iSelectId){
9269
+ EQPGraphRow *pRow, *pNext;
9270
+ int i;
9271
+ int n = strlen30(p->sGraph.zPrefix);
9272
+ char *z;
9273
+ for(pRow = eqp_next_row(p, iSelectId, 0); pRow; pRow = pNext){
9274
+ pNext = eqp_next_row(p, iSelectId, pRow);
9275
+ z = pRow->zText;
9276
+ utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z);
9277
+ if( n<sizeof(p->sGraph.zPrefix)-7 && (z = strstr(z, " SUBQUER"))!=0 ){
9278
+ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4);
9279
+ if( strncmp(z, " SUBQUERY ", 9)==0 && (i = atoi(z+10))>iSelectId ){
9280
+ eqp_render_level(p, i);
9281
+ }else if( strncmp(z, " SUBQUERIES ", 12)==0 ){
9282
+ i = atoi(z+12);
9283
+ if( i>iSelectId ){
9284
+ utf8_printf(p->out, "%s|--SUBQUERY %d\n", p->sGraph.zPrefix, i);
9285
+ memcpy(&p->sGraph.zPrefix[n+3],"| ",4);
9286
+ eqp_render_level(p, i);
9287
+ }
9288
+ z = strstr(z, " AND ");
9289
+ if( z && (i = atoi(z+5))>iSelectId ){
9290
+ p->sGraph.zPrefix[n+3] = 0;
9291
+ utf8_printf(p->out, "%s`--SUBQUERY %d\n", p->sGraph.zPrefix, i);
9292
+ memcpy(&p->sGraph.zPrefix[n+3]," ",4);
9293
+ eqp_render_level(p, i);
9294
+ }
9295
+ }
9296
+ p->sGraph.zPrefix[n] = 0;
9297
+ }
9298
+ }
9299
+}
9300
+
9301
+/*
9302
+** Display and reset the EXPLAIN QUERY PLAN data
9303
+*/
9304
+static void eqp_render(ShellState *p){
9305
+ EQPGraphRow *pRow = p->sGraph.pRow;
9306
+ if( pRow ){
9307
+ if( pRow->zText[0]=='-' ){
9308
+ if( pRow->pNext==0 ){
9309
+ eqp_reset(p);
9310
+ return;
9311
+ }
9312
+ utf8_printf(p->out, "%s\n", pRow->zText+3);
9313
+ p->sGraph.pRow = pRow->pNext;
9314
+ sqlite3_free(pRow);
9315
+ }else{
9316
+ utf8_printf(p->out, "QUERY PLAN\n");
9317
+ }
9318
+ p->sGraph.zPrefix[0] = 0;
9319
+ eqp_render_level(p, 0);
9320
+ eqp_reset(p);
9321
+ }
9322
+}
91979323
91989324
/*
91999325
** This is the callback routine that the shell
92009326
** invokes for each row of a query result.
92019327
*/
@@ -9542,10 +9668,14 @@
95429668
utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
95439669
}
95449670
utf8_printf(p->out, "%s", p->rowSeparator);
95459671
break;
95469672
}
9673
+ case MODE_EQP: {
9674
+ eqp_append(p, atoi(azArg[0]), azArg[3]);
9675
+ break;
9676
+ }
95479677
}
95489678
return 0;
95499679
}
95509680
95519681
/*
@@ -9640,14 +9770,11 @@
96409770
if( zName==0 ) return;
96419771
cQuote = quoteChar(zName);
96429772
n = strlen30(zName);
96439773
if( cQuote ) n += n+2;
96449774
z = p->zDestTable = malloc( n+1 );
9645
- if( z==0 ){
9646
- raw_printf(stderr,"Error: out of memory\n");
9647
- exit(1);
9648
- }
9775
+ if( z==0 ) shell_out_of_memory();
96499776
n = 0;
96509777
if( cQuote ) z[n++] = cQuote;
96519778
for(i=0; zName[i]; i++){
96529779
z[n++] = zName[i];
96539780
if( zName[i]==cQuote ) z[n++] = cQuote;
@@ -10383,15 +10510,16 @@
1038310510
}
1038410511
zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
1038510512
rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1038610513
if( rc==SQLITE_OK ){
1038710514
while( sqlite3_step(pExplain)==SQLITE_ROW ){
10388
- raw_printf(pArg->out,"--EQP-- %d,",sqlite3_column_int(pExplain, 0));
10389
- raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
10390
- raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
10391
- utf8_printf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
10515
+ const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3);
10516
+ int iSelectId = sqlite3_column_int(pExplain, 0);
10517
+ if( zEQPLine[0]=='-' ) eqp_render(pArg);
10518
+ eqp_append(pArg, iSelectId, zEQPLine);
1039210519
}
10520
+ eqp_render(pArg);
1039310521
}
1039410522
sqlite3_finalize(pExplain);
1039510523
sqlite3_free(zEQP);
1039610524
if( pArg->autoEQP>=AUTOEQP_full ){
1039710525
/* Also do an EXPLAIN for ".eqp full" mode */
@@ -10415,15 +10543,20 @@
1041510543
restore_debug_trace_modes();
1041610544
}
1041710545
1041810546
if( pArg ){
1041910547
pArg->cMode = pArg->mode;
10420
- if( pArg->autoExplain
10421
- && sqlite3_column_count(pStmt)==8
10422
- && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
10423
- ){
10424
- pArg->cMode = MODE_Explain;
10548
+ if( pArg->autoExplain ){
10549
+ if( sqlite3_column_count(pStmt)==8
10550
+ && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
10551
+ ){
10552
+ pArg->cMode = MODE_Explain;
10553
+ }
10554
+ if( sqlite3_column_count(pStmt)==4
10555
+ && sqlite3_strlike("EXPLAIN QUERY PLAN%", zStmtSql,0)==0 ){
10556
+ pArg->cMode = MODE_EQP;
10557
+ }
1042510558
}
1042610559
1042710560
/* If the shell is currently in ".explain" mode, gather the extra
1042810561
** data required to add indents to the output.*/
1042910562
if( pArg->cMode==MODE_Explain ){
@@ -10431,10 +10564,11 @@
1043110564
}
1043210565
}
1043310566
1043410567
exec_prepared_stmt(pArg, pStmt);
1043510568
explain_data_delete(pArg);
10569
+ eqp_render(pArg);
1043610570
1043710571
/* print usage stats if stats on */
1043810572
if( pArg && pArg->statsOn ){
1043910573
display_stats(db, pArg, 0);
1044010574
}
@@ -10508,14 +10642,11 @@
1050810642
if( rc ) return 0;
1050910643
while( sqlite3_step(pStmt)==SQLITE_ROW ){
1051010644
if( nCol>=nAlloc-2 ){
1051110645
nAlloc = nAlloc*2 + nCol + 10;
1051210646
azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
10513
- if( azCol==0 ){
10514
- raw_printf(stderr, "Error: out of memory\n");
10515
- exit(1);
10516
- }
10647
+ if( azCol==0 ) shell_out_of_memory();
1051710648
}
1051810649
azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
1051910650
if( sqlite3_column_int(pStmt, 5) ){
1052010651
nPK++;
1052110652
if( nPK==1
@@ -11006,11 +11137,10 @@
1100611137
** Make sure the database is open. If it is not, then open it. If
1100711138
** the database fails to open, print an error message and exit.
1100811139
*/
1100911140
static void open_db(ShellState *p, int keepAlive){
1101011141
if( p->db==0 ){
11011
- sqlite3_initialize();
1101211142
if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){
1101311143
p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
1101411144
}
1101511145
switch( p->openMode ){
1101611146
case SHELL_OPEN_APPENDVFS: {
@@ -11309,14 +11439,11 @@
1130911439
/* Append a single byte to z[] */
1131011440
static void import_append_char(ImportCtx *p, int c){
1131111441
if( p->n+1>=p->nAlloc ){
1131211442
p->nAlloc += p->nAlloc + 100;
1131311443
p->z = sqlite3_realloc64(p->z, p->nAlloc);
11314
- if( p->z==0 ){
11315
- raw_printf(stderr, "out of memory\n");
11316
- exit(1);
11317
- }
11444
+ if( p->z==0 ) shell_out_of_memory();
1131811445
}
1131911446
p->z[p->n++] = (char)c;
1132011447
}
1132111448
1132211449
/* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -11473,14 +11600,11 @@
1147311600
zQuery);
1147411601
goto end_data_xfer;
1147511602
}
1147611603
n = sqlite3_column_count(pQuery);
1147711604
zInsert = sqlite3_malloc64(200 + nTable + n*3);
11478
- if( zInsert==0 ){
11479
- raw_printf(stderr, "out of memory\n");
11480
- goto end_data_xfer;
11481
- }
11605
+ if( zInsert==0 ) shell_out_of_memory();
1148211606
sqlite3_snprintf(200+nTable,zInsert,
1148311607
"INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
1148411608
i = strlen30(zInsert);
1148511609
for(j=1; j<n; j++){
1148611610
memcpy(zInsert+i, ",?", 2);
@@ -11817,18 +11941,10 @@
1181711941
const char *zErr = sqlite3_errmsg(db);
1181811942
utf8_printf(stderr, "Error: %s\n", zErr);
1181911943
return 1;
1182011944
}
1182111945
11822
-/*
11823
-** Print an out-of-memory message to stderr and return 1.
11824
-*/
11825
-static int shellNomemError(void){
11826
- raw_printf(stderr, "Error: out of memory\n");
11827
- return 1;
11828
-}
11829
-
1183011946
/*
1183111947
** Compare the pattern in zGlob[] against the text in z[]. Return TRUE
1183211948
** if they match and FALSE (0) if they do not match.
1183311949
**
1183411950
** Globbing rules:
@@ -13518,13 +13634,12 @@
1351813634
}
1351913635
sCtx.cColSep = p->colSeparator[0];
1352013636
sCtx.cRowSep = p->rowSeparator[0];
1352113637
zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
1352213638
if( zSql==0 ){
13523
- raw_printf(stderr, "Error: out of memory\n");
1352413639
xCloser(sCtx.in);
13525
- return 1;
13640
+ shell_out_of_memory();
1352613641
}
1352713642
nByte = strlen30(zSql);
1352813643
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
1352913644
import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */
1353013645
if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){
@@ -13565,13 +13680,12 @@
1356513680
sqlite3_finalize(pStmt);
1356613681
pStmt = 0;
1356713682
if( nCol==0 ) return 0; /* no columns, no error */
1356813683
zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 );
1356913684
if( zSql==0 ){
13570
- raw_printf(stderr, "Error: out of memory\n");
1357113685
xCloser(sCtx.in);
13572
- return 1;
13686
+ shell_out_of_memory();
1357313687
}
1357413688
sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
1357513689
j = strlen30(zSql);
1357613690
for(i=1; i<nCol; i++){
1357713691
zSql[j++] = ',';
@@ -13643,16 +13757,21 @@
1364313757
char *zSql;
1364413758
char *zCollist = 0;
1364513759
sqlite3_stmt *pStmt;
1364613760
int tnum = 0;
1364713761
int i;
13648
- if( nArg!=3 ){
13649
- utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n");
13762
+ if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
13763
+ utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
13764
+ " .imposter off\n");
1365013765
rc = 1;
1365113766
goto meta_command_exit;
1365213767
}
1365313768
open_db(p, 0);
13769
+ if( nArg==2 ){
13770
+ sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
13771
+ goto meta_command_exit;
13772
+ }
1365413773
zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master"
1365513774
" WHERE name='%q' AND type='index'", azArg[1]);
1365613775
sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
1365713776
sqlite3_free(zSql);
1365813777
if( sqlite3_step(pStmt)==SQLITE_ROW ){
@@ -14833,22 +14952,16 @@
1483314952
while( sqlite3_step(pStmt)==SQLITE_ROW ){
1483414953
if( nRow>=nAlloc ){
1483514954
char **azNew;
1483614955
int n2 = nAlloc*2 + 10;
1483714956
azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
14838
- if( azNew==0 ){
14839
- rc = shellNomemError();
14840
- break;
14841
- }
14957
+ if( azNew==0 ) shell_out_of_memory();
1484214958
nAlloc = n2;
1484314959
azResult = azNew;
1484414960
}
1484514961
azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
14846
- if( 0==azResult[nRow] ){
14847
- rc = shellNomemError();
14848
- break;
14849
- }
14962
+ if( 0==azResult[nRow] ) shell_out_of_memory();
1485014963
nRow++;
1485114964
}
1485214965
if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
1485314966
rc = shellDatabaseError(p->db);
1485414967
}
@@ -15415,14 +15528,11 @@
1541515528
}
1541615529
nLine = strlen30(zLine);
1541715530
if( nSql+nLine+2>=nAlloc ){
1541815531
nAlloc = nSql+nLine+100;
1541915532
zSql = realloc(zSql, nAlloc);
15420
- if( zSql==0 ){
15421
- raw_printf(stderr, "Error: out of memory\n");
15422
- exit(1);
15423
- }
15533
+ if( zSql==0 ) shell_out_of_memory();
1542415534
}
1542515535
nSqlPrior = nSql;
1542615536
if( nSql==0 ){
1542715537
int i;
1542815538
for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
@@ -15547,11 +15657,10 @@
1554715657
if( home_dir==0 ){
1554815658
raw_printf(stderr, "-- warning: cannot find home directory;"
1554915659
" cannot read ~/.sqliterc\n");
1555015660
return;
1555115661
}
15552
- sqlite3_initialize();
1555315662
zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
1555415663
sqliterc = zBuf;
1555515664
}
1555615665
in = fopen(sqliterc,"rb");
1555715666
if( in ){
@@ -15598,10 +15707,13 @@
1559815707
" -nullvalue TEXT set text string for NULL values. Default ''\n"
1559915708
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
1560015709
" -quote set output mode to 'quote'\n"
1560115710
" -readonly open the database read-only\n"
1560215711
" -separator SEP set output column separator. Default: '|'\n"
15712
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
15713
+ " -sorterref SIZE sorter references threshold size\n"
15714
+#endif
1560315715
" -stats print memory stats before each finalize\n"
1560415716
" -version show SQLite version\n"
1560515717
" -vfs NAME use NAME as the default VFS\n"
1560615718
#ifdef SQLITE_ENABLE_VFSTRACE
1560715719
" -vfstrace enable tracing of all VFS calls\n"
@@ -15620,10 +15732,21 @@
1562015732
}else{
1562115733
raw_printf(stderr, "Use the -help option for additional information\n");
1562215734
}
1562315735
exit(1);
1562415736
}
15737
+
15738
+/*
15739
+** Internal check: Verify that the SQLite is uninitialized. Print a
15740
+** error message if it is initialized.
15741
+*/
15742
+static void verify_uninitialized(void){
15743
+ if( sqlite3_config(-1)==SQLITE_MISUSE ){
15744
+ utf8_printf(stdout, "WARNING: attempt to configuration SQLite after"
15745
+ " initialization.\n");
15746
+ }
15747
+}
1562515748
1562615749
/*
1562715750
** Initialize the state information in data
1562815751
*/
1562915752
static void main_init(ShellState *data) {
@@ -15632,10 +15755,11 @@
1563215755
data->autoExplain = 1;
1563315756
memcpy(data->colSeparator,SEP_Column, 2);
1563415757
memcpy(data->rowSeparator,SEP_Row, 2);
1563515758
data->showHeader = 0;
1563615759
data->shellFlgs = SHFLG_Lookaside;
15760
+ verify_uninitialized();
1563715761
sqlite3_config(SQLITE_CONFIG_URI, 1);
1563815762
sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
1563915763
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
1564015764
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
1564115765
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
@@ -15695,10 +15819,11 @@
1569515819
int rc = 0;
1569615820
int warnInmemoryDb = 0;
1569715821
int readStdin = 1;
1569815822
int nCmd = 0;
1569915823
char **azCmd = 0;
15824
+ const char *zVfs = 0; /* Value of -vfs command-line option */
1570015825
1570115826
setBinaryMode(stdin, 0);
1570215827
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
1570315828
stdin_is_interactive = isatty(0);
1570415829
stdout_is_console = isatty(1);
@@ -15719,27 +15844,18 @@
1571915844
** memory that does not come from the SQLite memory allocator.
1572015845
*/
1572115846
#if !SQLITE_SHELL_IS_UTF8
1572215847
sqlite3_initialize();
1572315848
argv = malloc(sizeof(argv[0])*argc);
15724
- if( argv==0 ){
15725
- raw_printf(stderr, "out of memory\n");
15726
- exit(1);
15727
- }
15849
+ if( argv==0 ) shell_out_of_memory();
1572815850
for(i=0; i<argc; i++){
1572915851
char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
1573015852
int n;
15731
- if( z==0 ){
15732
- raw_printf(stderr, "out of memory\n");
15733
- exit(1);
15734
- }
15853
+ if( z==0 ) shell_out_of_memory();
1573515854
n = (int)strlen(z);
1573615855
argv[i] = malloc( n+1 );
15737
- if( argv[i]==0 ){
15738
- raw_printf(stderr, "out of memory\n");
15739
- exit(1);
15740
- }
15856
+ if( argv[i]==0 ) shell_out_of_memory();
1574115857
memcpy(argv[i], z, n+1);
1574215858
sqlite3_free(z);
1574315859
}
1574415860
sqlite3_shutdown();
1574515861
#endif
@@ -15771,10 +15887,11 @@
1577115887
/* Do an initial pass through the command-line argument to locate
1577215888
** the name of the database file, the name of the initialization file,
1577315889
** the size of the alternative malloc heap,
1577415890
** and the first command to execute.
1577515891
*/
15892
+ verify_uninitialized();
1577615893
for(i=1; i<argc; i++){
1577715894
char *z;
1577815895
z = argv[i];
1577915896
if( z[0]!='-' ){
1578015897
if( data.zDbFilename==0 ){
@@ -15783,14 +15900,11 @@
1578315900
/* Excesss arguments are interpreted as SQL (or dot-commands) and
1578415901
** mean that nothing is read from stdin */
1578515902
readStdin = 0;
1578615903
nCmd++;
1578715904
azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
15788
- if( azCmd==0 ){
15789
- raw_printf(stderr, "out of memory\n");
15790
- exit(1);
15791
- }
15905
+ if( azCmd==0 ) shell_out_of_memory();
1579215906
azCmd[nCmd-1] = z;
1579315907
}
1579415908
}
1579515909
if( z[1]=='-' ) z++;
1579615910
if( strcmp(z,"-separator")==0
@@ -15853,18 +15967,17 @@
1585315967
sqlite3_multiplex_initialize(0, 1);
1585415968
#endif
1585515969
}else if( strcmp(z,"-mmap")==0 ){
1585615970
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
1585715971
sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
15972
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
15973
+ }else if( strcmp(z,"-sorterref")==0 ){
15974
+ sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
15975
+ sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
15976
+#endif
1585815977
}else if( strcmp(z,"-vfs")==0 ){
15859
- sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
15860
- if( pVfs ){
15861
- sqlite3_vfs_register(pVfs, 1);
15862
- }else{
15863
- utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
15864
- exit(1);
15865
- }
15978
+ zVfs = cmdline_option_value(argc, argv, ++i);
1586615979
#ifdef SQLITE_HAVE_ZLIB
1586715980
}else if( strcmp(z,"-zip")==0 ){
1586815981
data.openMode = SHELL_OPEN_ZIPFILE;
1586915982
#endif
1587015983
}else if( strcmp(z,"-append")==0 ){
@@ -15877,10 +15990,38 @@
1587715990
** command, so ignore them */
1587815991
break;
1587915992
#endif
1588015993
}
1588115994
}
15995
+ verify_uninitialized();
15996
+
15997
+
15998
+#ifdef SQLITE_SHELL_INIT_PROC
15999
+ {
16000
+ /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
16001
+ ** of a C-function that will perform initialization actions on SQLite that
16002
+ ** occur just before or after sqlite3_initialize(). Use this compile-time
16003
+ ** option to embed this shell program in larger applications. */
16004
+ extern void SQLITE_SHELL_INIT_PROC(void);
16005
+ SQLITE_SHELL_INIT_PROC();
16006
+ }
16007
+#else
16008
+ /* All the sqlite3_config() calls have now been made. So it is safe
16009
+ ** to call sqlite3_initialize() and process any command line -vfs option. */
16010
+ sqlite3_initialize();
16011
+#endif
16012
+
16013
+ if( zVfs ){
16014
+ sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
16015
+ if( pVfs ){
16016
+ sqlite3_vfs_register(pVfs, 1);
16017
+ }else{
16018
+ utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
16019
+ exit(1);
16020
+ }
16021
+ }
16022
+
1588216023
if( data.zDbFilename==0 ){
1588316024
#ifndef SQLITE_OMIT_MEMORYDB
1588416025
data.zDbFilename = ":memory:";
1588516026
warnInmemoryDb = argc==1;
1588616027
#else
@@ -15989,10 +16130,14 @@
1598916130
i+=2;
1599016131
}else if( strcmp(z,"-lookaside")==0 ){
1599116132
i+=2;
1599216133
}else if( strcmp(z,"-mmap")==0 ){
1599316134
i++;
16135
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
16136
+ }else if( strcmp(z,"-sorterref")==0 ){
16137
+ i++;
16138
+#endif
1599416139
}else if( strcmp(z,"-vfs")==0 ){
1599516140
i++;
1599616141
#ifdef SQLITE_ENABLE_VFSTRACE
1599716142
}else if( strcmp(z,"-vfstrace")==0 ){
1599816143
i++;
1599916144
--- src/shell.c
+++ src/shell.c
@@ -451,10 +451,16 @@
451 ** includes string formatting (e.g. "%s").
452 */
453 #if !defined(raw_printf)
454 # define raw_printf fprintf
455 #endif
 
 
 
 
 
 
456
457 /*
458 ** Write I/O traces to the following stream.
459 */
460 #ifdef SQLITE_ENABLE_IOTRACE
@@ -8527,10 +8533,26 @@
8527 struct ExpertInfo {
8528 sqlite3expert *pExpert;
8529 int bVerbose;
8530 };
8531
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8532 /*
8533 ** State information about the database connection is contained in an
8534 ** instance of the following structure.
8535 */
8536 typedef struct ShellState ShellState;
@@ -8540,10 +8562,12 @@
8540 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
8541 u8 statsOn; /* True to display memory stats before each finalize */
8542 u8 scanstatsOn; /* True to display scan stats before each finalize */
8543 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
8544 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
 
 
8545 int outCount; /* Revert to stdout when reaching zero */
8546 int cnt; /* Number of records displayed so far */
8547 FILE *out; /* Write results here */
8548 FILE *traceOut; /* Output for sqlite3_trace() */
8549 int nErr; /* Number of errors seen */
@@ -8573,10 +8597,11 @@
8573 sqlite3_stmt *pStmt; /* Current statement if any. */
8574 FILE *pLog; /* Write log output here */
8575 int *aiIndent; /* Array of indents used in MODE_Explain */
8576 int nIndent; /* Size of array aiIndent[] */
8577 int iIndent; /* Index of current op in aiIndent[] */
 
8578 #if defined(SQLITE_ENABLE_SESSION)
8579 int nSession; /* Number of active sessions */
8580 OpenSession aSession[4]; /* Array of sessions. [0] is in focus. */
8581 #endif
8582 ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
@@ -8629,10 +8654,11 @@
8629 #define MODE_Tcl 7 /* Generate ANSI-C or TCL quoted elements */
8630 #define MODE_Csv 8 /* Quote strings, numbers are plain */
8631 #define MODE_Explain 9 /* Like MODE_Column, but do not truncate data */
8632 #define MODE_Ascii 10 /* Use ASCII unit and record separators (0x1F/0x1E) */
8633 #define MODE_Pretty 11 /* Pretty-print schemas */
 
8634
8635 static const char *modeDescr[] = {
8636 "line",
8637 "column",
8638 "list",
@@ -8643,10 +8669,11 @@
8643 "tcl",
8644 "csv",
8645 "explain",
8646 "ascii",
8647 "prettyprint",
 
8648 };
8649
8650 /*
8651 ** These are the column/row/line separators used by the various
8652 ** import/export modes.
@@ -9191,11 +9218,110 @@
9191 if( z[i]=='-' && z[i+1]=='-' ) return 1;
9192 return 0;
9193 }
9194 return 1;
9195 }
9196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9197
9198 /*
9199 ** This is the callback routine that the shell
9200 ** invokes for each row of a query result.
9201 */
@@ -9542,10 +9668,14 @@
9542 utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
9543 }
9544 utf8_printf(p->out, "%s", p->rowSeparator);
9545 break;
9546 }
 
 
 
 
9547 }
9548 return 0;
9549 }
9550
9551 /*
@@ -9640,14 +9770,11 @@
9640 if( zName==0 ) return;
9641 cQuote = quoteChar(zName);
9642 n = strlen30(zName);
9643 if( cQuote ) n += n+2;
9644 z = p->zDestTable = malloc( n+1 );
9645 if( z==0 ){
9646 raw_printf(stderr,"Error: out of memory\n");
9647 exit(1);
9648 }
9649 n = 0;
9650 if( cQuote ) z[n++] = cQuote;
9651 for(i=0; zName[i]; i++){
9652 z[n++] = zName[i];
9653 if( zName[i]==cQuote ) z[n++] = cQuote;
@@ -10383,15 +10510,16 @@
10383 }
10384 zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
10385 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
10386 if( rc==SQLITE_OK ){
10387 while( sqlite3_step(pExplain)==SQLITE_ROW ){
10388 raw_printf(pArg->out,"--EQP-- %d,",sqlite3_column_int(pExplain, 0));
10389 raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
10390 raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
10391 utf8_printf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
10392 }
 
10393 }
10394 sqlite3_finalize(pExplain);
10395 sqlite3_free(zEQP);
10396 if( pArg->autoEQP>=AUTOEQP_full ){
10397 /* Also do an EXPLAIN for ".eqp full" mode */
@@ -10415,15 +10543,20 @@
10415 restore_debug_trace_modes();
10416 }
10417
10418 if( pArg ){
10419 pArg->cMode = pArg->mode;
10420 if( pArg->autoExplain
10421 && sqlite3_column_count(pStmt)==8
10422 && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
10423 ){
10424 pArg->cMode = MODE_Explain;
 
 
 
 
 
10425 }
10426
10427 /* If the shell is currently in ".explain" mode, gather the extra
10428 ** data required to add indents to the output.*/
10429 if( pArg->cMode==MODE_Explain ){
@@ -10431,10 +10564,11 @@
10431 }
10432 }
10433
10434 exec_prepared_stmt(pArg, pStmt);
10435 explain_data_delete(pArg);
 
10436
10437 /* print usage stats if stats on */
10438 if( pArg && pArg->statsOn ){
10439 display_stats(db, pArg, 0);
10440 }
@@ -10508,14 +10642,11 @@
10508 if( rc ) return 0;
10509 while( sqlite3_step(pStmt)==SQLITE_ROW ){
10510 if( nCol>=nAlloc-2 ){
10511 nAlloc = nAlloc*2 + nCol + 10;
10512 azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
10513 if( azCol==0 ){
10514 raw_printf(stderr, "Error: out of memory\n");
10515 exit(1);
10516 }
10517 }
10518 azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
10519 if( sqlite3_column_int(pStmt, 5) ){
10520 nPK++;
10521 if( nPK==1
@@ -11006,11 +11137,10 @@
11006 ** Make sure the database is open. If it is not, then open it. If
11007 ** the database fails to open, print an error message and exit.
11008 */
11009 static void open_db(ShellState *p, int keepAlive){
11010 if( p->db==0 ){
11011 sqlite3_initialize();
11012 if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){
11013 p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
11014 }
11015 switch( p->openMode ){
11016 case SHELL_OPEN_APPENDVFS: {
@@ -11309,14 +11439,11 @@
11309 /* Append a single byte to z[] */
11310 static void import_append_char(ImportCtx *p, int c){
11311 if( p->n+1>=p->nAlloc ){
11312 p->nAlloc += p->nAlloc + 100;
11313 p->z = sqlite3_realloc64(p->z, p->nAlloc);
11314 if( p->z==0 ){
11315 raw_printf(stderr, "out of memory\n");
11316 exit(1);
11317 }
11318 }
11319 p->z[p->n++] = (char)c;
11320 }
11321
11322 /* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -11473,14 +11600,11 @@
11473 zQuery);
11474 goto end_data_xfer;
11475 }
11476 n = sqlite3_column_count(pQuery);
11477 zInsert = sqlite3_malloc64(200 + nTable + n*3);
11478 if( zInsert==0 ){
11479 raw_printf(stderr, "out of memory\n");
11480 goto end_data_xfer;
11481 }
11482 sqlite3_snprintf(200+nTable,zInsert,
11483 "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
11484 i = strlen30(zInsert);
11485 for(j=1; j<n; j++){
11486 memcpy(zInsert+i, ",?", 2);
@@ -11817,18 +11941,10 @@
11817 const char *zErr = sqlite3_errmsg(db);
11818 utf8_printf(stderr, "Error: %s\n", zErr);
11819 return 1;
11820 }
11821
11822 /*
11823 ** Print an out-of-memory message to stderr and return 1.
11824 */
11825 static int shellNomemError(void){
11826 raw_printf(stderr, "Error: out of memory\n");
11827 return 1;
11828 }
11829
11830 /*
11831 ** Compare the pattern in zGlob[] against the text in z[]. Return TRUE
11832 ** if they match and FALSE (0) if they do not match.
11833 **
11834 ** Globbing rules:
@@ -13518,13 +13634,12 @@
13518 }
13519 sCtx.cColSep = p->colSeparator[0];
13520 sCtx.cRowSep = p->rowSeparator[0];
13521 zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
13522 if( zSql==0 ){
13523 raw_printf(stderr, "Error: out of memory\n");
13524 xCloser(sCtx.in);
13525 return 1;
13526 }
13527 nByte = strlen30(zSql);
13528 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
13529 import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */
13530 if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){
@@ -13565,13 +13680,12 @@
13565 sqlite3_finalize(pStmt);
13566 pStmt = 0;
13567 if( nCol==0 ) return 0; /* no columns, no error */
13568 zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 );
13569 if( zSql==0 ){
13570 raw_printf(stderr, "Error: out of memory\n");
13571 xCloser(sCtx.in);
13572 return 1;
13573 }
13574 sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
13575 j = strlen30(zSql);
13576 for(i=1; i<nCol; i++){
13577 zSql[j++] = ',';
@@ -13643,16 +13757,21 @@
13643 char *zSql;
13644 char *zCollist = 0;
13645 sqlite3_stmt *pStmt;
13646 int tnum = 0;
13647 int i;
13648 if( nArg!=3 ){
13649 utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n");
 
13650 rc = 1;
13651 goto meta_command_exit;
13652 }
13653 open_db(p, 0);
 
 
 
 
13654 zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master"
13655 " WHERE name='%q' AND type='index'", azArg[1]);
13656 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
13657 sqlite3_free(zSql);
13658 if( sqlite3_step(pStmt)==SQLITE_ROW ){
@@ -14833,22 +14952,16 @@
14833 while( sqlite3_step(pStmt)==SQLITE_ROW ){
14834 if( nRow>=nAlloc ){
14835 char **azNew;
14836 int n2 = nAlloc*2 + 10;
14837 azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
14838 if( azNew==0 ){
14839 rc = shellNomemError();
14840 break;
14841 }
14842 nAlloc = n2;
14843 azResult = azNew;
14844 }
14845 azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
14846 if( 0==azResult[nRow] ){
14847 rc = shellNomemError();
14848 break;
14849 }
14850 nRow++;
14851 }
14852 if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
14853 rc = shellDatabaseError(p->db);
14854 }
@@ -15415,14 +15528,11 @@
15415 }
15416 nLine = strlen30(zLine);
15417 if( nSql+nLine+2>=nAlloc ){
15418 nAlloc = nSql+nLine+100;
15419 zSql = realloc(zSql, nAlloc);
15420 if( zSql==0 ){
15421 raw_printf(stderr, "Error: out of memory\n");
15422 exit(1);
15423 }
15424 }
15425 nSqlPrior = nSql;
15426 if( nSql==0 ){
15427 int i;
15428 for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
@@ -15547,11 +15657,10 @@
15547 if( home_dir==0 ){
15548 raw_printf(stderr, "-- warning: cannot find home directory;"
15549 " cannot read ~/.sqliterc\n");
15550 return;
15551 }
15552 sqlite3_initialize();
15553 zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
15554 sqliterc = zBuf;
15555 }
15556 in = fopen(sqliterc,"rb");
15557 if( in ){
@@ -15598,10 +15707,13 @@
15598 " -nullvalue TEXT set text string for NULL values. Default ''\n"
15599 " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
15600 " -quote set output mode to 'quote'\n"
15601 " -readonly open the database read-only\n"
15602 " -separator SEP set output column separator. Default: '|'\n"
 
 
 
15603 " -stats print memory stats before each finalize\n"
15604 " -version show SQLite version\n"
15605 " -vfs NAME use NAME as the default VFS\n"
15606 #ifdef SQLITE_ENABLE_VFSTRACE
15607 " -vfstrace enable tracing of all VFS calls\n"
@@ -15620,10 +15732,21 @@
15620 }else{
15621 raw_printf(stderr, "Use the -help option for additional information\n");
15622 }
15623 exit(1);
15624 }
 
 
 
 
 
 
 
 
 
 
 
15625
15626 /*
15627 ** Initialize the state information in data
15628 */
15629 static void main_init(ShellState *data) {
@@ -15632,10 +15755,11 @@
15632 data->autoExplain = 1;
15633 memcpy(data->colSeparator,SEP_Column, 2);
15634 memcpy(data->rowSeparator,SEP_Row, 2);
15635 data->showHeader = 0;
15636 data->shellFlgs = SHFLG_Lookaside;
 
15637 sqlite3_config(SQLITE_CONFIG_URI, 1);
15638 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
15639 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
15640 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
15641 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
@@ -15695,10 +15819,11 @@
15695 int rc = 0;
15696 int warnInmemoryDb = 0;
15697 int readStdin = 1;
15698 int nCmd = 0;
15699 char **azCmd = 0;
 
15700
15701 setBinaryMode(stdin, 0);
15702 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
15703 stdin_is_interactive = isatty(0);
15704 stdout_is_console = isatty(1);
@@ -15719,27 +15844,18 @@
15719 ** memory that does not come from the SQLite memory allocator.
15720 */
15721 #if !SQLITE_SHELL_IS_UTF8
15722 sqlite3_initialize();
15723 argv = malloc(sizeof(argv[0])*argc);
15724 if( argv==0 ){
15725 raw_printf(stderr, "out of memory\n");
15726 exit(1);
15727 }
15728 for(i=0; i<argc; i++){
15729 char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
15730 int n;
15731 if( z==0 ){
15732 raw_printf(stderr, "out of memory\n");
15733 exit(1);
15734 }
15735 n = (int)strlen(z);
15736 argv[i] = malloc( n+1 );
15737 if( argv[i]==0 ){
15738 raw_printf(stderr, "out of memory\n");
15739 exit(1);
15740 }
15741 memcpy(argv[i], z, n+1);
15742 sqlite3_free(z);
15743 }
15744 sqlite3_shutdown();
15745 #endif
@@ -15771,10 +15887,11 @@
15771 /* Do an initial pass through the command-line argument to locate
15772 ** the name of the database file, the name of the initialization file,
15773 ** the size of the alternative malloc heap,
15774 ** and the first command to execute.
15775 */
 
15776 for(i=1; i<argc; i++){
15777 char *z;
15778 z = argv[i];
15779 if( z[0]!='-' ){
15780 if( data.zDbFilename==0 ){
@@ -15783,14 +15900,11 @@
15783 /* Excesss arguments are interpreted as SQL (or dot-commands) and
15784 ** mean that nothing is read from stdin */
15785 readStdin = 0;
15786 nCmd++;
15787 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
15788 if( azCmd==0 ){
15789 raw_printf(stderr, "out of memory\n");
15790 exit(1);
15791 }
15792 azCmd[nCmd-1] = z;
15793 }
15794 }
15795 if( z[1]=='-' ) z++;
15796 if( strcmp(z,"-separator")==0
@@ -15853,18 +15967,17 @@
15853 sqlite3_multiplex_initialize(0, 1);
15854 #endif
15855 }else if( strcmp(z,"-mmap")==0 ){
15856 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
15857 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
 
 
 
 
 
15858 }else if( strcmp(z,"-vfs")==0 ){
15859 sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
15860 if( pVfs ){
15861 sqlite3_vfs_register(pVfs, 1);
15862 }else{
15863 utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
15864 exit(1);
15865 }
15866 #ifdef SQLITE_HAVE_ZLIB
15867 }else if( strcmp(z,"-zip")==0 ){
15868 data.openMode = SHELL_OPEN_ZIPFILE;
15869 #endif
15870 }else if( strcmp(z,"-append")==0 ){
@@ -15877,10 +15990,38 @@
15877 ** command, so ignore them */
15878 break;
15879 #endif
15880 }
15881 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15882 if( data.zDbFilename==0 ){
15883 #ifndef SQLITE_OMIT_MEMORYDB
15884 data.zDbFilename = ":memory:";
15885 warnInmemoryDb = argc==1;
15886 #else
@@ -15989,10 +16130,14 @@
15989 i+=2;
15990 }else if( strcmp(z,"-lookaside")==0 ){
15991 i+=2;
15992 }else if( strcmp(z,"-mmap")==0 ){
15993 i++;
 
 
 
 
15994 }else if( strcmp(z,"-vfs")==0 ){
15995 i++;
15996 #ifdef SQLITE_ENABLE_VFSTRACE
15997 }else if( strcmp(z,"-vfstrace")==0 ){
15998 i++;
15999
--- src/shell.c
+++ src/shell.c
@@ -451,10 +451,16 @@
451 ** includes string formatting (e.g. "%s").
452 */
453 #if !defined(raw_printf)
454 # define raw_printf fprintf
455 #endif
456
457 /* Indicate out-of-memory and exit. */
458 static void shell_out_of_memory(void){
459 raw_printf(stderr,"Error: out of memory\n");
460 exit(1);
461 }
462
463 /*
464 ** Write I/O traces to the following stream.
465 */
466 #ifdef SQLITE_ENABLE_IOTRACE
@@ -8527,10 +8533,26 @@
8533 struct ExpertInfo {
8534 sqlite3expert *pExpert;
8535 int bVerbose;
8536 };
8537
8538 /* A single line in the EQP output */
8539 typedef struct EQPGraphRow EQPGraphRow;
8540 struct EQPGraphRow {
8541 int iSelectId; /* The SelectID for this row */
8542 EQPGraphRow *pNext; /* Next row in sequence */
8543 char zText[1]; /* Text to display for this row */
8544 };
8545
8546 /* All EQP output is collected into an instance of the following */
8547 typedef struct EQPGraph EQPGraph;
8548 struct EQPGraph {
8549 EQPGraphRow *pRow; /* Linked list of all rows of the EQP output */
8550 EQPGraphRow *pLast; /* Last element of the pRow list */
8551 char zPrefix[100]; /* Graph prefix */
8552 };
8553
8554 /*
8555 ** State information about the database connection is contained in an
8556 ** instance of the following structure.
8557 */
8558 typedef struct ShellState ShellState;
@@ -8540,10 +8562,12 @@
8562 u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
8563 u8 statsOn; /* True to display memory stats before each finalize */
8564 u8 scanstatsOn; /* True to display scan stats before each finalize */
8565 u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */
8566 u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */
8567 u8 nEqpLevel; /* Depth of the EQP output graph */
8568 unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
8569 int outCount; /* Revert to stdout when reaching zero */
8570 int cnt; /* Number of records displayed so far */
8571 FILE *out; /* Write results here */
8572 FILE *traceOut; /* Output for sqlite3_trace() */
8573 int nErr; /* Number of errors seen */
@@ -8573,10 +8597,11 @@
8597 sqlite3_stmt *pStmt; /* Current statement if any. */
8598 FILE *pLog; /* Write log output here */
8599 int *aiIndent; /* Array of indents used in MODE_Explain */
8600 int nIndent; /* Size of array aiIndent[] */
8601 int iIndent; /* Index of current op in aiIndent[] */
8602 EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
8603 #if defined(SQLITE_ENABLE_SESSION)
8604 int nSession; /* Number of active sessions */
8605 OpenSession aSession[4]; /* Array of sessions. [0] is in focus. */
8606 #endif
8607 ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
@@ -8629,10 +8654,11 @@
8654 #define MODE_Tcl 7 /* Generate ANSI-C or TCL quoted elements */
8655 #define MODE_Csv 8 /* Quote strings, numbers are plain */
8656 #define MODE_Explain 9 /* Like MODE_Column, but do not truncate data */
8657 #define MODE_Ascii 10 /* Use ASCII unit and record separators (0x1F/0x1E) */
8658 #define MODE_Pretty 11 /* Pretty-print schemas */
8659 #define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */
8660
8661 static const char *modeDescr[] = {
8662 "line",
8663 "column",
8664 "list",
@@ -8643,10 +8669,11 @@
8669 "tcl",
8670 "csv",
8671 "explain",
8672 "ascii",
8673 "prettyprint",
8674 "eqp"
8675 };
8676
8677 /*
8678 ** These are the column/row/line separators used by the various
8679 ** import/export modes.
@@ -9191,11 +9218,110 @@
9218 if( z[i]=='-' && z[i+1]=='-' ) return 1;
9219 return 0;
9220 }
9221 return 1;
9222 }
9223
9224 /*
9225 ** Add a new entry to the EXPLAIN QUERY PLAN data
9226 */
9227 static void eqp_append(ShellState *p, int iSelectId, const char *zText){
9228 EQPGraphRow *pNew;
9229 int nText = strlen30(zText);
9230 pNew = sqlite3_malloc64( sizeof(*pNew) + nText );
9231 if( pNew==0 ) shell_out_of_memory();
9232 pNew->iSelectId = iSelectId;
9233 memcpy(pNew->zText, zText, nText+1);
9234 pNew->pNext = 0;
9235 if( p->sGraph.pLast ){
9236 p->sGraph.pLast->pNext = pNew;
9237 }else{
9238 p->sGraph.pRow = pNew;
9239 }
9240 p->sGraph.pLast = pNew;
9241 }
9242
9243 /*
9244 ** Free and reset the EXPLAIN QUERY PLAN data that has been collected
9245 ** in p->sGraph.
9246 */
9247 static void eqp_reset(ShellState *p){
9248 EQPGraphRow *pRow, *pNext;
9249 for(pRow = p->sGraph.pRow; pRow; pRow = pNext){
9250 pNext = pRow->pNext;
9251 sqlite3_free(pRow);
9252 }
9253 memset(&p->sGraph, 0, sizeof(p->sGraph));
9254 }
9255
9256 /* Return the next EXPLAIN QUERY PLAN line with iSelectId that occurs after
9257 ** pOld, or return the first such line if pOld is NULL
9258 */
9259 static EQPGraphRow *eqp_next_row(ShellState *p, int iSelectId, EQPGraphRow *pOld){
9260 EQPGraphRow *pRow = pOld ? pOld->pNext : p->sGraph.pRow;
9261 while( pRow && pRow->iSelectId!=iSelectId ) pRow = pRow->pNext;
9262 return pRow;
9263 }
9264
9265 /* Render a single level of the graph shell having iSelectId. Called
9266 ** recursively to render sublevels.
9267 */
9268 static void eqp_render_level(ShellState *p, int iSelectId){
9269 EQPGraphRow *pRow, *pNext;
9270 int i;
9271 int n = strlen30(p->sGraph.zPrefix);
9272 char *z;
9273 for(pRow = eqp_next_row(p, iSelectId, 0); pRow; pRow = pNext){
9274 pNext = eqp_next_row(p, iSelectId, pRow);
9275 z = pRow->zText;
9276 utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z);
9277 if( n<sizeof(p->sGraph.zPrefix)-7 && (z = strstr(z, " SUBQUER"))!=0 ){
9278 memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4);
9279 if( strncmp(z, " SUBQUERY ", 9)==0 && (i = atoi(z+10))>iSelectId ){
9280 eqp_render_level(p, i);
9281 }else if( strncmp(z, " SUBQUERIES ", 12)==0 ){
9282 i = atoi(z+12);
9283 if( i>iSelectId ){
9284 utf8_printf(p->out, "%s|--SUBQUERY %d\n", p->sGraph.zPrefix, i);
9285 memcpy(&p->sGraph.zPrefix[n+3],"| ",4);
9286 eqp_render_level(p, i);
9287 }
9288 z = strstr(z, " AND ");
9289 if( z && (i = atoi(z+5))>iSelectId ){
9290 p->sGraph.zPrefix[n+3] = 0;
9291 utf8_printf(p->out, "%s`--SUBQUERY %d\n", p->sGraph.zPrefix, i);
9292 memcpy(&p->sGraph.zPrefix[n+3]," ",4);
9293 eqp_render_level(p, i);
9294 }
9295 }
9296 p->sGraph.zPrefix[n] = 0;
9297 }
9298 }
9299 }
9300
9301 /*
9302 ** Display and reset the EXPLAIN QUERY PLAN data
9303 */
9304 static void eqp_render(ShellState *p){
9305 EQPGraphRow *pRow = p->sGraph.pRow;
9306 if( pRow ){
9307 if( pRow->zText[0]=='-' ){
9308 if( pRow->pNext==0 ){
9309 eqp_reset(p);
9310 return;
9311 }
9312 utf8_printf(p->out, "%s\n", pRow->zText+3);
9313 p->sGraph.pRow = pRow->pNext;
9314 sqlite3_free(pRow);
9315 }else{
9316 utf8_printf(p->out, "QUERY PLAN\n");
9317 }
9318 p->sGraph.zPrefix[0] = 0;
9319 eqp_render_level(p, 0);
9320 eqp_reset(p);
9321 }
9322 }
9323
9324 /*
9325 ** This is the callback routine that the shell
9326 ** invokes for each row of a query result.
9327 */
@@ -9542,10 +9668,14 @@
9668 utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
9669 }
9670 utf8_printf(p->out, "%s", p->rowSeparator);
9671 break;
9672 }
9673 case MODE_EQP: {
9674 eqp_append(p, atoi(azArg[0]), azArg[3]);
9675 break;
9676 }
9677 }
9678 return 0;
9679 }
9680
9681 /*
@@ -9640,14 +9770,11 @@
9770 if( zName==0 ) return;
9771 cQuote = quoteChar(zName);
9772 n = strlen30(zName);
9773 if( cQuote ) n += n+2;
9774 z = p->zDestTable = malloc( n+1 );
9775 if( z==0 ) shell_out_of_memory();
 
 
 
9776 n = 0;
9777 if( cQuote ) z[n++] = cQuote;
9778 for(i=0; zName[i]; i++){
9779 z[n++] = zName[i];
9780 if( zName[i]==cQuote ) z[n++] = cQuote;
@@ -10383,15 +10510,16 @@
10510 }
10511 zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
10512 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
10513 if( rc==SQLITE_OK ){
10514 while( sqlite3_step(pExplain)==SQLITE_ROW ){
10515 const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3);
10516 int iSelectId = sqlite3_column_int(pExplain, 0);
10517 if( zEQPLine[0]=='-' ) eqp_render(pArg);
10518 eqp_append(pArg, iSelectId, zEQPLine);
10519 }
10520 eqp_render(pArg);
10521 }
10522 sqlite3_finalize(pExplain);
10523 sqlite3_free(zEQP);
10524 if( pArg->autoEQP>=AUTOEQP_full ){
10525 /* Also do an EXPLAIN for ".eqp full" mode */
@@ -10415,15 +10543,20 @@
10543 restore_debug_trace_modes();
10544 }
10545
10546 if( pArg ){
10547 pArg->cMode = pArg->mode;
10548 if( pArg->autoExplain ){
10549 if( sqlite3_column_count(pStmt)==8
10550 && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
10551 ){
10552 pArg->cMode = MODE_Explain;
10553 }
10554 if( sqlite3_column_count(pStmt)==4
10555 && sqlite3_strlike("EXPLAIN QUERY PLAN%", zStmtSql,0)==0 ){
10556 pArg->cMode = MODE_EQP;
10557 }
10558 }
10559
10560 /* If the shell is currently in ".explain" mode, gather the extra
10561 ** data required to add indents to the output.*/
10562 if( pArg->cMode==MODE_Explain ){
@@ -10431,10 +10564,11 @@
10564 }
10565 }
10566
10567 exec_prepared_stmt(pArg, pStmt);
10568 explain_data_delete(pArg);
10569 eqp_render(pArg);
10570
10571 /* print usage stats if stats on */
10572 if( pArg && pArg->statsOn ){
10573 display_stats(db, pArg, 0);
10574 }
@@ -10508,14 +10642,11 @@
10642 if( rc ) return 0;
10643 while( sqlite3_step(pStmt)==SQLITE_ROW ){
10644 if( nCol>=nAlloc-2 ){
10645 nAlloc = nAlloc*2 + nCol + 10;
10646 azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
10647 if( azCol==0 ) shell_out_of_memory();
 
 
 
10648 }
10649 azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
10650 if( sqlite3_column_int(pStmt, 5) ){
10651 nPK++;
10652 if( nPK==1
@@ -11006,11 +11137,10 @@
11137 ** Make sure the database is open. If it is not, then open it. If
11138 ** the database fails to open, print an error message and exit.
11139 */
11140 static void open_db(ShellState *p, int keepAlive){
11141 if( p->db==0 ){
 
11142 if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){
11143 p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0);
11144 }
11145 switch( p->openMode ){
11146 case SHELL_OPEN_APPENDVFS: {
@@ -11309,14 +11439,11 @@
11439 /* Append a single byte to z[] */
11440 static void import_append_char(ImportCtx *p, int c){
11441 if( p->n+1>=p->nAlloc ){
11442 p->nAlloc += p->nAlloc + 100;
11443 p->z = sqlite3_realloc64(p->z, p->nAlloc);
11444 if( p->z==0 ) shell_out_of_memory();
 
 
 
11445 }
11446 p->z[p->n++] = (char)c;
11447 }
11448
11449 /* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -11473,14 +11600,11 @@
11600 zQuery);
11601 goto end_data_xfer;
11602 }
11603 n = sqlite3_column_count(pQuery);
11604 zInsert = sqlite3_malloc64(200 + nTable + n*3);
11605 if( zInsert==0 ) shell_out_of_memory();
 
 
 
11606 sqlite3_snprintf(200+nTable,zInsert,
11607 "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
11608 i = strlen30(zInsert);
11609 for(j=1; j<n; j++){
11610 memcpy(zInsert+i, ",?", 2);
@@ -11817,18 +11941,10 @@
11941 const char *zErr = sqlite3_errmsg(db);
11942 utf8_printf(stderr, "Error: %s\n", zErr);
11943 return 1;
11944 }
11945
 
 
 
 
 
 
 
 
11946 /*
11947 ** Compare the pattern in zGlob[] against the text in z[]. Return TRUE
11948 ** if they match and FALSE (0) if they do not match.
11949 **
11950 ** Globbing rules:
@@ -13518,13 +13634,12 @@
13634 }
13635 sCtx.cColSep = p->colSeparator[0];
13636 sCtx.cRowSep = p->rowSeparator[0];
13637 zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
13638 if( zSql==0 ){
 
13639 xCloser(sCtx.in);
13640 shell_out_of_memory();
13641 }
13642 nByte = strlen30(zSql);
13643 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
13644 import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */
13645 if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){
@@ -13565,13 +13680,12 @@
13680 sqlite3_finalize(pStmt);
13681 pStmt = 0;
13682 if( nCol==0 ) return 0; /* no columns, no error */
13683 zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 );
13684 if( zSql==0 ){
 
13685 xCloser(sCtx.in);
13686 shell_out_of_memory();
13687 }
13688 sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
13689 j = strlen30(zSql);
13690 for(i=1; i<nCol; i++){
13691 zSql[j++] = ',';
@@ -13643,16 +13757,21 @@
13757 char *zSql;
13758 char *zCollist = 0;
13759 sqlite3_stmt *pStmt;
13760 int tnum = 0;
13761 int i;
13762 if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
13763 utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
13764 " .imposter off\n");
13765 rc = 1;
13766 goto meta_command_exit;
13767 }
13768 open_db(p, 0);
13769 if( nArg==2 ){
13770 sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
13771 goto meta_command_exit;
13772 }
13773 zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master"
13774 " WHERE name='%q' AND type='index'", azArg[1]);
13775 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
13776 sqlite3_free(zSql);
13777 if( sqlite3_step(pStmt)==SQLITE_ROW ){
@@ -14833,22 +14952,16 @@
14952 while( sqlite3_step(pStmt)==SQLITE_ROW ){
14953 if( nRow>=nAlloc ){
14954 char **azNew;
14955 int n2 = nAlloc*2 + 10;
14956 azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
14957 if( azNew==0 ) shell_out_of_memory();
 
 
 
14958 nAlloc = n2;
14959 azResult = azNew;
14960 }
14961 azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
14962 if( 0==azResult[nRow] ) shell_out_of_memory();
 
 
 
14963 nRow++;
14964 }
14965 if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
14966 rc = shellDatabaseError(p->db);
14967 }
@@ -15415,14 +15528,11 @@
15528 }
15529 nLine = strlen30(zLine);
15530 if( nSql+nLine+2>=nAlloc ){
15531 nAlloc = nSql+nLine+100;
15532 zSql = realloc(zSql, nAlloc);
15533 if( zSql==0 ) shell_out_of_memory();
 
 
 
15534 }
15535 nSqlPrior = nSql;
15536 if( nSql==0 ){
15537 int i;
15538 for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
@@ -15547,11 +15657,10 @@
15657 if( home_dir==0 ){
15658 raw_printf(stderr, "-- warning: cannot find home directory;"
15659 " cannot read ~/.sqliterc\n");
15660 return;
15661 }
 
15662 zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
15663 sqliterc = zBuf;
15664 }
15665 in = fopen(sqliterc,"rb");
15666 if( in ){
@@ -15598,10 +15707,13 @@
15707 " -nullvalue TEXT set text string for NULL values. Default ''\n"
15708 " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
15709 " -quote set output mode to 'quote'\n"
15710 " -readonly open the database read-only\n"
15711 " -separator SEP set output column separator. Default: '|'\n"
15712 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
15713 " -sorterref SIZE sorter references threshold size\n"
15714 #endif
15715 " -stats print memory stats before each finalize\n"
15716 " -version show SQLite version\n"
15717 " -vfs NAME use NAME as the default VFS\n"
15718 #ifdef SQLITE_ENABLE_VFSTRACE
15719 " -vfstrace enable tracing of all VFS calls\n"
@@ -15620,10 +15732,21 @@
15732 }else{
15733 raw_printf(stderr, "Use the -help option for additional information\n");
15734 }
15735 exit(1);
15736 }
15737
15738 /*
15739 ** Internal check: Verify that the SQLite is uninitialized. Print a
15740 ** error message if it is initialized.
15741 */
15742 static void verify_uninitialized(void){
15743 if( sqlite3_config(-1)==SQLITE_MISUSE ){
15744 utf8_printf(stdout, "WARNING: attempt to configuration SQLite after"
15745 " initialization.\n");
15746 }
15747 }
15748
15749 /*
15750 ** Initialize the state information in data
15751 */
15752 static void main_init(ShellState *data) {
@@ -15632,10 +15755,11 @@
15755 data->autoExplain = 1;
15756 memcpy(data->colSeparator,SEP_Column, 2);
15757 memcpy(data->rowSeparator,SEP_Row, 2);
15758 data->showHeader = 0;
15759 data->shellFlgs = SHFLG_Lookaside;
15760 verify_uninitialized();
15761 sqlite3_config(SQLITE_CONFIG_URI, 1);
15762 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
15763 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
15764 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
15765 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
@@ -15695,10 +15819,11 @@
15819 int rc = 0;
15820 int warnInmemoryDb = 0;
15821 int readStdin = 1;
15822 int nCmd = 0;
15823 char **azCmd = 0;
15824 const char *zVfs = 0; /* Value of -vfs command-line option */
15825
15826 setBinaryMode(stdin, 0);
15827 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
15828 stdin_is_interactive = isatty(0);
15829 stdout_is_console = isatty(1);
@@ -15719,27 +15844,18 @@
15844 ** memory that does not come from the SQLite memory allocator.
15845 */
15846 #if !SQLITE_SHELL_IS_UTF8
15847 sqlite3_initialize();
15848 argv = malloc(sizeof(argv[0])*argc);
15849 if( argv==0 ) shell_out_of_memory();
 
 
 
15850 for(i=0; i<argc; i++){
15851 char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
15852 int n;
15853 if( z==0 ) shell_out_of_memory();
 
 
 
15854 n = (int)strlen(z);
15855 argv[i] = malloc( n+1 );
15856 if( argv[i]==0 ) shell_out_of_memory();
 
 
 
15857 memcpy(argv[i], z, n+1);
15858 sqlite3_free(z);
15859 }
15860 sqlite3_shutdown();
15861 #endif
@@ -15771,10 +15887,11 @@
15887 /* Do an initial pass through the command-line argument to locate
15888 ** the name of the database file, the name of the initialization file,
15889 ** the size of the alternative malloc heap,
15890 ** and the first command to execute.
15891 */
15892 verify_uninitialized();
15893 for(i=1; i<argc; i++){
15894 char *z;
15895 z = argv[i];
15896 if( z[0]!='-' ){
15897 if( data.zDbFilename==0 ){
@@ -15783,14 +15900,11 @@
15900 /* Excesss arguments are interpreted as SQL (or dot-commands) and
15901 ** mean that nothing is read from stdin */
15902 readStdin = 0;
15903 nCmd++;
15904 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
15905 if( azCmd==0 ) shell_out_of_memory();
 
 
 
15906 azCmd[nCmd-1] = z;
15907 }
15908 }
15909 if( z[1]=='-' ) z++;
15910 if( strcmp(z,"-separator")==0
@@ -15853,18 +15967,17 @@
15967 sqlite3_multiplex_initialize(0, 1);
15968 #endif
15969 }else if( strcmp(z,"-mmap")==0 ){
15970 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
15971 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
15972 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
15973 }else if( strcmp(z,"-sorterref")==0 ){
15974 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
15975 sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
15976 #endif
15977 }else if( strcmp(z,"-vfs")==0 ){
15978 zVfs = cmdline_option_value(argc, argv, ++i);
 
 
 
 
 
 
15979 #ifdef SQLITE_HAVE_ZLIB
15980 }else if( strcmp(z,"-zip")==0 ){
15981 data.openMode = SHELL_OPEN_ZIPFILE;
15982 #endif
15983 }else if( strcmp(z,"-append")==0 ){
@@ -15877,10 +15990,38 @@
15990 ** command, so ignore them */
15991 break;
15992 #endif
15993 }
15994 }
15995 verify_uninitialized();
15996
15997
15998 #ifdef SQLITE_SHELL_INIT_PROC
15999 {
16000 /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
16001 ** of a C-function that will perform initialization actions on SQLite that
16002 ** occur just before or after sqlite3_initialize(). Use this compile-time
16003 ** option to embed this shell program in larger applications. */
16004 extern void SQLITE_SHELL_INIT_PROC(void);
16005 SQLITE_SHELL_INIT_PROC();
16006 }
16007 #else
16008 /* All the sqlite3_config() calls have now been made. So it is safe
16009 ** to call sqlite3_initialize() and process any command line -vfs option. */
16010 sqlite3_initialize();
16011 #endif
16012
16013 if( zVfs ){
16014 sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
16015 if( pVfs ){
16016 sqlite3_vfs_register(pVfs, 1);
16017 }else{
16018 utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]);
16019 exit(1);
16020 }
16021 }
16022
16023 if( data.zDbFilename==0 ){
16024 #ifndef SQLITE_OMIT_MEMORYDB
16025 data.zDbFilename = ":memory:";
16026 warnInmemoryDb = argc==1;
16027 #else
@@ -15989,10 +16130,14 @@
16130 i+=2;
16131 }else if( strcmp(z,"-lookaside")==0 ){
16132 i+=2;
16133 }else if( strcmp(z,"-mmap")==0 ){
16134 i++;
16135 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
16136 }else if( strcmp(z,"-sorterref")==0 ){
16137 i++;
16138 #endif
16139 }else if( strcmp(z,"-vfs")==0 ){
16140 i++;
16141 #ifdef SQLITE_ENABLE_VFSTRACE
16142 }else if( strcmp(z,"-vfstrace")==0 ){
16143 i++;
16144
+12 -4
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -175,17 +175,25 @@
175175
static void sqlcmd_atexit(void) {
176176
g.zConfigDbName = 0; /* prevent panic */
177177
}
178178
179179
/*
180
-** This routine is called by the patched sqlite3 command-line shell in order
181
-** to load the name and database connection for the open Fossil database.
180
+** This routine is called by the sqlite3 command-line shell to
181
+** to load the name the Fossil repository database.
182182
*/
183
-void fossil_open(const char **pzRepoName){
184
- sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
183
+void sqlcmd_get_dbname(const char **pzRepoName){
185184
*pzRepoName = g.zRepositoryName;
186185
}
186
+
187
+/*
188
+** This routine is called by the sqlite3 command-line shell to do
189
+** extra initialization prior to starting up the shell.
190
+*/
191
+void sqlcmd_init_proc(void){
192
+ sqlite3_initialize();
193
+ sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
194
+}
187195
188196
#if USE_SEE
189197
/*
190198
** This routine is called by the patched sqlite3 command-line shell in order
191199
** to load the encryption key for the open Fossil database. The memory that
192200
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -175,17 +175,25 @@
175 static void sqlcmd_atexit(void) {
176 g.zConfigDbName = 0; /* prevent panic */
177 }
178
179 /*
180 ** This routine is called by the patched sqlite3 command-line shell in order
181 ** to load the name and database connection for the open Fossil database.
182 */
183 void fossil_open(const char **pzRepoName){
184 sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
185 *pzRepoName = g.zRepositoryName;
186 }
 
 
 
 
 
 
 
 
 
187
188 #if USE_SEE
189 /*
190 ** This routine is called by the patched sqlite3 command-line shell in order
191 ** to load the encryption key for the open Fossil database. The memory that
192
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -175,17 +175,25 @@
175 static void sqlcmd_atexit(void) {
176 g.zConfigDbName = 0; /* prevent panic */
177 }
178
179 /*
180 ** This routine is called by the sqlite3 command-line shell to
181 ** to load the name the Fossil repository database.
182 */
183 void sqlcmd_get_dbname(const char **pzRepoName){
 
184 *pzRepoName = g.zRepositoryName;
185 }
186
187 /*
188 ** This routine is called by the sqlite3 command-line shell to do
189 ** extra initialization prior to starting up the shell.
190 */
191 void sqlcmd_init_proc(void){
192 sqlite3_initialize();
193 sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
194 }
195
196 #if USE_SEE
197 /*
198 ** This routine is called by the patched sqlite3 command-line shell in order
199 ** to load the encryption key for the open Fossil database. The memory that
200
+3870 -2858
--- 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.23.1. By combining all the individual C code files into this
3
+** version 3.24.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.
@@ -308,10 +308,13 @@
308308
#if SQLITE_ENABLE_SESSION
309309
"ENABLE_SESSION",
310310
#endif
311311
#if SQLITE_ENABLE_SNAPSHOT
312312
"ENABLE_SNAPSHOT",
313
+#endif
314
+#if SQLITE_ENABLE_SORTER_REFERENCES
315
+ "ENABLE_SORTER_REFERENCES",
313316
#endif
314317
#if SQLITE_ENABLE_SQLLOG
315318
"ENABLE_SQLLOG",
316319
#endif
317320
#if defined(SQLITE_ENABLE_STAT4)
@@ -1145,13 +1148,13 @@
11451148
**
11461149
** See also: [sqlite3_libversion()],
11471150
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11481151
** [sqlite_version()] and [sqlite_source_id()].
11491152
*/
1150
-#define SQLITE_VERSION "3.23.1"
1151
-#define SQLITE_VERSION_NUMBER 3023001
1152
-#define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b"
1153
+#define SQLITE_VERSION "3.24.0"
1154
+#define SQLITE_VERSION_NUMBER 3024000
1155
+#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
11531156
11541157
/*
11551158
** CAPI3REF: Run-Time Library Version Numbers
11561159
** KEYWORDS: sqlite3_version sqlite3_sourceid
11571160
**
@@ -2952,10 +2955,26 @@
29522955
** Since many statement journals never become large, setting the spill
29532956
** threshold to a value such as 64KiB can greatly reduce the amount of
29542957
** I/O required to support statement rollback.
29552958
** The default value for this setting is controlled by the
29562959
** [SQLITE_STMTJRNL_SPILL] compile-time option.
2960
+**
2961
+** [[SQLITE_CONFIG_SORTERREF_SIZE]]
2962
+** <dt>SQLITE_CONFIG_SORTERREF_SIZE
2963
+** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
2964
+** of type (int) - the new value of the sorter-reference size threshold.
2965
+** Usually, when SQLite uses an external sort to order records according
2966
+** to an ORDER BY clause, all fields required by the caller are present in the
2967
+** sorted records. However, if SQLite determines based on the declared type
2968
+** of a table column that its values are likely to be very large - larger
2969
+** than the configured sorter-reference size threshold - then a reference
2970
+** is stored in each sorted record and the required column values loaded
2971
+** from the database as records are returned in sorted order. The default
2972
+** value for this option is to never use this optimization. Specifying a
2973
+** negative value for this option restores the default behaviour.
2974
+** This option is only available if SQLite is compiled with the
2975
+** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
29572976
** </dl>
29582977
*/
29592978
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
29602979
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
29612980
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -2981,10 +3000,11 @@
29813000
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
29823001
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
29833002
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
29843003
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
29853004
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
3005
+#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
29863006
29873007
/*
29883008
** CAPI3REF: Database Connection Configuration Options
29893009
**
29903010
** These constants are the available integer configuration options that
@@ -12939,111 +12959,113 @@
1293912959
#define TK_LT 56
1294012960
#define TK_GE 57
1294112961
#define TK_ESCAPE 58
1294212962
#define TK_ID 59
1294312963
#define TK_COLUMNKW 60
12944
-#define TK_FOR 61
12945
-#define TK_IGNORE 62
12946
-#define TK_INITIALLY 63
12947
-#define TK_INSTEAD 64
12948
-#define TK_NO 65
12949
-#define TK_KEY 66
12950
-#define TK_OF 67
12951
-#define TK_OFFSET 68
12952
-#define TK_PRAGMA 69
12953
-#define TK_RAISE 70
12954
-#define TK_RECURSIVE 71
12955
-#define TK_REPLACE 72
12956
-#define TK_RESTRICT 73
12957
-#define TK_ROW 74
12958
-#define TK_TRIGGER 75
12959
-#define TK_VACUUM 76
12960
-#define TK_VIEW 77
12961
-#define TK_VIRTUAL 78
12962
-#define TK_WITH 79
12963
-#define TK_REINDEX 80
12964
-#define TK_RENAME 81
12965
-#define TK_CTIME_KW 82
12966
-#define TK_ANY 83
12967
-#define TK_BITAND 84
12968
-#define TK_BITOR 85
12969
-#define TK_LSHIFT 86
12970
-#define TK_RSHIFT 87
12971
-#define TK_PLUS 88
12972
-#define TK_MINUS 89
12973
-#define TK_STAR 90
12974
-#define TK_SLASH 91
12975
-#define TK_REM 92
12976
-#define TK_CONCAT 93
12977
-#define TK_COLLATE 94
12978
-#define TK_BITNOT 95
12979
-#define TK_INDEXED 96
12980
-#define TK_STRING 97
12981
-#define TK_JOIN_KW 98
12982
-#define TK_CONSTRAINT 99
12983
-#define TK_DEFAULT 100
12984
-#define TK_NULL 101
12985
-#define TK_PRIMARY 102
12986
-#define TK_UNIQUE 103
12987
-#define TK_CHECK 104
12988
-#define TK_REFERENCES 105
12989
-#define TK_AUTOINCR 106
12990
-#define TK_ON 107
12991
-#define TK_INSERT 108
12992
-#define TK_DELETE 109
12993
-#define TK_UPDATE 110
12994
-#define TK_SET 111
12995
-#define TK_DEFERRABLE 112
12996
-#define TK_FOREIGN 113
12997
-#define TK_DROP 114
12998
-#define TK_UNION 115
12999
-#define TK_ALL 116
13000
-#define TK_EXCEPT 117
13001
-#define TK_INTERSECT 118
13002
-#define TK_SELECT 119
13003
-#define TK_VALUES 120
13004
-#define TK_DISTINCT 121
13005
-#define TK_DOT 122
13006
-#define TK_FROM 123
13007
-#define TK_JOIN 124
13008
-#define TK_USING 125
13009
-#define TK_ORDER 126
13010
-#define TK_GROUP 127
13011
-#define TK_HAVING 128
13012
-#define TK_LIMIT 129
13013
-#define TK_WHERE 130
13014
-#define TK_INTO 131
13015
-#define TK_FLOAT 132
13016
-#define TK_BLOB 133
13017
-#define TK_INTEGER 134
13018
-#define TK_VARIABLE 135
13019
-#define TK_CASE 136
13020
-#define TK_WHEN 137
13021
-#define TK_THEN 138
13022
-#define TK_ELSE 139
13023
-#define TK_INDEX 140
13024
-#define TK_ALTER 141
13025
-#define TK_ADD 142
13026
-#define TK_TRUEFALSE 143
13027
-#define TK_ISNOT 144
13028
-#define TK_FUNCTION 145
13029
-#define TK_COLUMN 146
13030
-#define TK_AGG_FUNCTION 147
13031
-#define TK_AGG_COLUMN 148
13032
-#define TK_UMINUS 149
13033
-#define TK_UPLUS 150
13034
-#define TK_TRUTH 151
13035
-#define TK_REGISTER 152
13036
-#define TK_VECTOR 153
13037
-#define TK_SELECT_COLUMN 154
13038
-#define TK_IF_NULL_ROW 155
13039
-#define TK_ASTERISK 156
13040
-#define TK_SPAN 157
13041
-#define TK_END_OF_FILE 158
13042
-#define TK_UNCLOSED_STRING 159
13043
-#define TK_SPACE 160
13044
-#define TK_ILLEGAL 161
12964
+#define TK_DO 61
12965
+#define TK_FOR 62
12966
+#define TK_IGNORE 63
12967
+#define TK_INITIALLY 64
12968
+#define TK_INSTEAD 65
12969
+#define TK_NO 66
12970
+#define TK_KEY 67
12971
+#define TK_OF 68
12972
+#define TK_OFFSET 69
12973
+#define TK_PRAGMA 70
12974
+#define TK_RAISE 71
12975
+#define TK_RECURSIVE 72
12976
+#define TK_REPLACE 73
12977
+#define TK_RESTRICT 74
12978
+#define TK_ROW 75
12979
+#define TK_TRIGGER 76
12980
+#define TK_VACUUM 77
12981
+#define TK_VIEW 78
12982
+#define TK_VIRTUAL 79
12983
+#define TK_WITH 80
12984
+#define TK_REINDEX 81
12985
+#define TK_RENAME 82
12986
+#define TK_CTIME_KW 83
12987
+#define TK_ANY 84
12988
+#define TK_BITAND 85
12989
+#define TK_BITOR 86
12990
+#define TK_LSHIFT 87
12991
+#define TK_RSHIFT 88
12992
+#define TK_PLUS 89
12993
+#define TK_MINUS 90
12994
+#define TK_STAR 91
12995
+#define TK_SLASH 92
12996
+#define TK_REM 93
12997
+#define TK_CONCAT 94
12998
+#define TK_COLLATE 95
12999
+#define TK_BITNOT 96
13000
+#define TK_ON 97
13001
+#define TK_INDEXED 98
13002
+#define TK_STRING 99
13003
+#define TK_JOIN_KW 100
13004
+#define TK_CONSTRAINT 101
13005
+#define TK_DEFAULT 102
13006
+#define TK_NULL 103
13007
+#define TK_PRIMARY 104
13008
+#define TK_UNIQUE 105
13009
+#define TK_CHECK 106
13010
+#define TK_REFERENCES 107
13011
+#define TK_AUTOINCR 108
13012
+#define TK_INSERT 109
13013
+#define TK_DELETE 110
13014
+#define TK_UPDATE 111
13015
+#define TK_SET 112
13016
+#define TK_DEFERRABLE 113
13017
+#define TK_FOREIGN 114
13018
+#define TK_DROP 115
13019
+#define TK_UNION 116
13020
+#define TK_ALL 117
13021
+#define TK_EXCEPT 118
13022
+#define TK_INTERSECT 119
13023
+#define TK_SELECT 120
13024
+#define TK_VALUES 121
13025
+#define TK_DISTINCT 122
13026
+#define TK_DOT 123
13027
+#define TK_FROM 124
13028
+#define TK_JOIN 125
13029
+#define TK_USING 126
13030
+#define TK_ORDER 127
13031
+#define TK_GROUP 128
13032
+#define TK_HAVING 129
13033
+#define TK_LIMIT 130
13034
+#define TK_WHERE 131
13035
+#define TK_INTO 132
13036
+#define TK_NOTHING 133
13037
+#define TK_FLOAT 134
13038
+#define TK_BLOB 135
13039
+#define TK_INTEGER 136
13040
+#define TK_VARIABLE 137
13041
+#define TK_CASE 138
13042
+#define TK_WHEN 139
13043
+#define TK_THEN 140
13044
+#define TK_ELSE 141
13045
+#define TK_INDEX 142
13046
+#define TK_ALTER 143
13047
+#define TK_ADD 144
13048
+#define TK_TRUEFALSE 145
13049
+#define TK_ISNOT 146
13050
+#define TK_FUNCTION 147
13051
+#define TK_COLUMN 148
13052
+#define TK_AGG_FUNCTION 149
13053
+#define TK_AGG_COLUMN 150
13054
+#define TK_UMINUS 151
13055
+#define TK_UPLUS 152
13056
+#define TK_TRUTH 153
13057
+#define TK_REGISTER 154
13058
+#define TK_VECTOR 155
13059
+#define TK_SELECT_COLUMN 156
13060
+#define TK_IF_NULL_ROW 157
13061
+#define TK_ASTERISK 158
13062
+#define TK_SPAN 159
13063
+#define TK_END_OF_FILE 160
13064
+#define TK_UNCLOSED_STRING 161
13065
+#define TK_SPACE 162
13066
+#define TK_ILLEGAL 163
1304513067
1304613068
/* The token codes above must all fit in 8 bits */
1304713069
#define TKFLG_MASK 0xff
1304813070
1304913071
/* Flags that can be added to a token code when it is not
@@ -13159,10 +13181,17 @@
1315913181
*/
1316013182
#ifndef SQLITE_DEFAULT_PCACHE_INITSZ
1316113183
# define SQLITE_DEFAULT_PCACHE_INITSZ 20
1316213184
#endif
1316313185
13186
+/*
13187
+** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option.
13188
+*/
13189
+#ifndef SQLITE_DEFAULT_SORTERREF_SIZE
13190
+# define SQLITE_DEFAULT_SORTERREF_SIZE 0x7fffffff
13191
+#endif
13192
+
1316413193
/*
1316513194
** The compile-time options SQLITE_MMAP_READWRITE and
1316613195
** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
1316713196
** You must choose one or the other (or neither) but not both.
1316813197
*/
@@ -13617,10 +13646,11 @@
1361713646
typedef struct TreeView TreeView;
1361813647
typedef struct Trigger Trigger;
1361913648
typedef struct TriggerPrg TriggerPrg;
1362013649
typedef struct TriggerStep TriggerStep;
1362113650
typedef struct UnpackedRecord UnpackedRecord;
13651
+typedef struct Upsert Upsert;
1362213652
typedef struct VTable VTable;
1362313653
typedef struct VtabCtx VtabCtx;
1362413654
typedef struct Walker Walker;
1362513655
typedef struct WhereInfo WhereInfo;
1362613656
typedef struct With With;
@@ -14274,26 +14304,26 @@
1427414304
#define OP_CollSeq 79
1427514305
#define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */
1427614306
#define OP_RealAffinity 81
1427714307
#define OP_Cast 82 /* synopsis: affinity(r[P1]) */
1427814308
#define OP_Permutation 83
14279
-#define OP_BitAnd 84 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14280
-#define OP_BitOr 85 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14281
-#define OP_ShiftLeft 86 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14282
-#define OP_ShiftRight 87 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14283
-#define OP_Add 88 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
14284
-#define OP_Subtract 89 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14285
-#define OP_Multiply 90 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14286
-#define OP_Divide 91 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14287
-#define OP_Remainder 92 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14288
-#define OP_Concat 93 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14289
-#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14290
-#define OP_BitNot 95 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
14291
-#define OP_IsTrue 96 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14292
-#define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
14293
-#define OP_Offset 98 /* synopsis: r[P3] = sqlite_offset(P1) */
14294
-#define OP_Column 99 /* synopsis: r[P3]=PX */
14309
+#define OP_Compare 84 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14310
+#define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14311
+#define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14312
+#define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14313
+#define OP_ShiftRight 88 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14314
+#define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
14315
+#define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14316
+#define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14317
+#define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14318
+#define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14319
+#define OP_Concat 94 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14320
+#define OP_IsTrue 95 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14321
+#define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
14322
+#define OP_Offset 97 /* synopsis: r[P3] = sqlite_offset(P1) */
14323
+#define OP_Column 98 /* synopsis: r[P3]=PX */
14324
+#define OP_String8 99 /* same as TK_STRING, synopsis: r[P2]='P4' */
1429514325
#define OP_Affinity 100 /* synopsis: affinity(r[P1@P2]) */
1429614326
#define OP_MakeRecord 101 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
1429714327
#define OP_Count 102 /* synopsis: r[P2]=count() */
1429814328
#define OP_ReadCookie 103
1429914329
#define OP_SetCookie 104
@@ -14322,13 +14352,13 @@
1432214352
#define OP_SeekEnd 127
1432314353
#define OP_SorterInsert 128 /* synopsis: key=r[P2] */
1432414354
#define OP_IdxInsert 129 /* synopsis: key=r[P2] */
1432514355
#define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */
1432614356
#define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */
14327
-#define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14328
-#define OP_IdxRowid 133 /* synopsis: r[P2]=rowid */
14329
-#define OP_Destroy 134
14357
+#define OP_IdxRowid 132 /* synopsis: r[P2]=rowid */
14358
+#define OP_Destroy 133
14359
+#define OP_Real 134 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
1433014360
#define OP_Clear 135
1433114361
#define OP_ResetSorter 136
1433214362
#define OP_CreateBtree 137 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
1433314363
#define OP_SqlExec 138
1433414364
#define OP_ParseSchema 139
@@ -14383,13 +14413,13 @@
1438314413
/* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\
1438414414
/* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
1438514415
/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\
1438614416
/* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\
1438714417
/* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14388
-/* 80 */ 0x02, 0x02, 0x02, 0x00, 0x26, 0x26, 0x26, 0x26,\
14389
-/* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
14390
-/* 96 */ 0x12, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10,\
14418
+/* 80 */ 0x02, 0x02, 0x02, 0x00, 0x00, 0x26, 0x26, 0x26,\
14419
+/* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x12,\
14420
+/* 96 */ 0x12, 0x20, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10,\
1439114421
/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
1439214422
/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
1439314423
/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
1439414424
/* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\
1439514425
/* 136 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
@@ -14459,10 +14489,13 @@
1445914489
SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
1446014490
SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
1446114491
SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
1446214492
SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
1446314493
SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
14494
+#ifdef SQLITE_COVERAGE_TEST
14495
+SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe*,int);
14496
+#endif
1446414497
SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
1446514498
#ifdef SQLITE_DEBUG
1446614499
SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
1446714500
#endif
1446814501
SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15593,11 +15626,11 @@
1559315626
signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
1559415627
u8 suppressErr; /* Do not issue error messages if true */
1559515628
u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
1559615629
u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
1559715630
u8 mTrace; /* zero or more SQLITE_TRACE flags */
15598
- u8 skipBtreeMutex; /* True if no shared-cache backends */
15631
+ u8 noSharedCache; /* True if no shared-cache backends */
1559915632
u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
1560015633
int nextPagesize; /* Pagesize after VACUUM if >0 */
1560115634
u32 magic; /* Magic number for detect library misuse */
1560215635
int nChange; /* Value returned by sqlite3_changes() */
1560315636
int nTotalChange; /* Value returned by sqlite3_total_changes() */
@@ -15753,10 +15786,11 @@
1575315786
** Allowed values for sqlite3.mDbFlags
1575415787
*/
1575515788
#define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */
1575615789
#define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */
1575715790
#define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */
15791
+#define DBFLAG_SchemaKnownOk 0x0008 /* Schema is known to be valid */
1575815792
1575915793
/*
1576015794
** Bits of the sqlite3.dbOptFlags field that are used by the
1576115795
** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
1576215796
** selectively disable various optimizations.
@@ -15998,10 +16032,11 @@
1599816032
*/
1599916033
#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
1600016034
#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
1600116035
#define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
1600216036
#define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
16037
+#define COLFLAG_SORTERREF 0x0010 /* Use sorter-refs with this column */
1600316038
1600416039
/*
1600516040
** A "Collating Sequence" is defined by an instance of the following
1600616041
** structure. Conceptually, a collating sequence consists of a name and
1600716042
** a comparison routine that defines the order of that sequence.
@@ -16285,17 +16320,16 @@
1628516320
#define OE_Rollback 1 /* Fail the operation and rollback the transaction */
1628616321
#define OE_Abort 2 /* Back out changes but do no rollback transaction */
1628716322
#define OE_Fail 3 /* Stop the operation but leave all prior changes */
1628816323
#define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */
1628916324
#define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */
16290
-
16291
-#define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
16292
-#define OE_SetNull 7 /* Set the foreign key value to NULL */
16293
-#define OE_SetDflt 8 /* Set the foreign key value to its default */
16294
-#define OE_Cascade 9 /* Cascade the changes */
16295
-
16296
-#define OE_Default 10 /* Do whatever the default action is */
16325
+#define OE_Update 6 /* Process as a DO UPDATE in an upsert */
16326
+#define OE_Restrict 7 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
16327
+#define OE_SetNull 8 /* Set the foreign key value to NULL */
16328
+#define OE_SetDflt 9 /* Set the foreign key value to its default */
16329
+#define OE_Cascade 10 /* Cascade the changes */
16330
+#define OE_Default 11 /* Do whatever the default action is */
1629716331
1629816332
1629916333
/*
1630016334
** An instance of the following structure is passed as the first
1630116335
** argument to sqlite3VdbeKeyCompare and is used to control the
@@ -16738,10 +16772,11 @@
1673816772
char *zSpan; /* Original text of the expression */
1673916773
u8 sortOrder; /* 1 for DESC or 0 for ASC */
1674016774
unsigned done :1; /* A flag to indicate when processing is finished */
1674116775
unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
1674216776
unsigned reusable :1; /* Constant expression is reusable */
16777
+ unsigned bSorterRef :1; /* Defer evaluation until after sorting */
1674316778
union {
1674416779
struct {
1674516780
u16 iOrderByCol; /* For ORDER BY, column number in result set */
1674616781
u16 iAlias; /* Index into Parse.aAlias[] for zName */
1674716782
} x;
@@ -16921,12 +16956,15 @@
1692116956
** subqueries looking for a match.
1692216957
*/
1692316958
struct NameContext {
1692416959
Parse *pParse; /* The parser */
1692516960
SrcList *pSrcList; /* One or more tables used to resolve names */
16926
- ExprList *pEList; /* Optional list of result-set columns */
16927
- AggInfo *pAggInfo; /* Information about aggregates at this level */
16961
+ union {
16962
+ ExprList *pEList; /* Optional list of result-set columns */
16963
+ AggInfo *pAggInfo; /* Information about aggregates at this level */
16964
+ Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */
16965
+ } uNC;
1692816966
NameContext *pNext; /* Next outer name context. NULL for outermost */
1692916967
int nRef; /* Number of names resolved by this context */
1693016968
int nErr; /* Number of errors encountered while resolving names */
1693116969
u16 ncFlags; /* Zero or more NC_* flags defined below */
1693216970
};
@@ -16944,12 +16982,45 @@
1694416982
#define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
1694516983
#define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
1694616984
#define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
1694716985
#define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
1694816986
#define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
16987
+#define NC_UEList 0x0080 /* True if uNC.pEList is used */
16988
+#define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */
16989
+#define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */
1694916990
#define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
1695016991
#define NC_Complex 0x2000 /* True if a function or subquery seen */
16992
+
16993
+/*
16994
+** An instance of the following object describes a single ON CONFLICT
16995
+** clause in an upsert.
16996
+**
16997
+** The pUpsertTarget field is only set if the ON CONFLICT clause includes
16998
+** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the
16999
+** conflict-target clause.) The pUpsertTargetWhere is the optional
17000
+** WHERE clause used to identify partial unique indexes.
17001
+**
17002
+** pUpsertSet is the list of column=expr terms of the UPDATE statement.
17003
+** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
17004
+** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
17005
+** WHERE clause is omitted.
17006
+*/
17007
+struct Upsert {
17008
+ ExprList *pUpsertTarget; /* Optional description of conflicting index */
17009
+ Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
17010
+ ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
17011
+ Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
17012
+ /* The fields above comprise the parse tree for the upsert clause.
17013
+ ** The fields below are used to transfer information from the INSERT
17014
+ ** processing down into the UPDATE processing while generating code.
17015
+ ** Upsert owns the memory allocated above, but not the memory below. */
17016
+ Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */
17017
+ SrcList *pUpsertSrc; /* Table to be updated */
17018
+ int regData; /* First register holding array of VALUES */
17019
+ int iDataCur; /* Index of the data cursor */
17020
+ int iIdxCur; /* Index of the first index cursor */
17021
+};
1695117022
1695217023
/*
1695317024
** An instance of the following structure contains all information
1695417025
** needed to generate code for a single SELECT statement.
1695517026
**
@@ -16975,10 +17046,11 @@
1697517046
LogEst nSelectRow; /* Estimated number of result rows */
1697617047
u32 selFlags; /* Various SF_* values */
1697717048
int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
1697817049
#if SELECTTRACE_ENABLED
1697917050
char zSelName[12]; /* Symbolic name of this SELECT use for debugging */
17051
+ u32 iSelectId; /* EXPLAIN QUERY PLAN select ID */
1698017052
#endif
1698117053
int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */
1698217054
SrcList *pSrc; /* The FROM clause */
1698317055
Expr *pWhere; /* The WHERE clause */
1698417056
ExprList *pGroupBy; /* The GROUP BY clause */
@@ -17446,12 +17518,13 @@
1744617518
u8 orconf; /* OE_Rollback etc. */
1744717519
Trigger *pTrig; /* The trigger that this step is a part of */
1744817520
Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
1744917521
char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
1745017522
Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
17451
- ExprList *pExprList; /* SET clause for UPDATE. */
17523
+ ExprList *pExprList; /* SET clause for UPDATE */
1745217524
IdList *pIdList; /* Column names for INSERT */
17525
+ Upsert *pUpsert; /* Upsert clauses on an INSERT */
1745317526
char *zSpan; /* Original SQL text of this command */
1745417527
TriggerStep *pNext; /* Next in the link-list */
1745517528
TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */
1745617529
};
1745717530
@@ -17559,10 +17632,11 @@
1755917632
#ifndef SQLITE_UNTESTABLE
1756017633
int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
1756117634
#endif
1756217635
int bLocaltimeFault; /* True to fail localtime() calls */
1756317636
int iOnceResetThreshold; /* When to reset OP_Once counters */
17637
+ u32 szSorterRef; /* Min size in bytes to use sorter-refs */
1756417638
};
1756517639
1756617640
/*
1756717641
** This macro is used inside of assert() statements to indicate that
1756817642
** the assert is only valid on a well-formed database. Instead of:
@@ -17979,11 +18053,11 @@
1797918053
SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
1798018054
#else
1798118055
# define sqlite3AutoincrementBegin(X)
1798218056
# define sqlite3AutoincrementEnd(X)
1798318057
#endif
17984
-SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int);
18058
+SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*);
1798518059
SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
1798618060
SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
1798718061
SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
1798818062
SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
1798918063
SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
@@ -18009,11 +18083,12 @@
1800918083
SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
1801018084
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
1801118085
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
1801218086
#endif
1801318087
SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
18014
-SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*);
18088
+SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
18089
+ Upsert*);
1801518090
SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
1801618091
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
1801718092
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
1801818093
SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
1801918094
SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
@@ -18102,11 +18177,11 @@
1810218177
Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int);
1810318178
SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int);
1810418179
SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);
1810518180
SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int);
1810618181
SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int,
18107
- u8,u8,int,int*,int*);
18182
+ u8,u8,int,int*,int*,Upsert*);
1810818183
#ifdef SQLITE_ENABLE_NULL_TRIM
1810918184
SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*);
1811018185
#else
1811118186
# define sqlite3SetMakeRecordP5(A,B)
1811218187
#endif
@@ -18155,11 +18230,12 @@
1815518230
void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
1815618231
SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
1815718232
SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
1815818233
const char*,const char*);
1815918234
SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
18160
- Select*,u8,const char*,const char*);
18235
+ Select*,u8,Upsert*,
18236
+ const char*,const char*);
1816118237
SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8,
1816218238
const char*,const char*);
1816318239
SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*,
1816418240
const char*,const char*);
1816518241
SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
@@ -18341,11 +18417,11 @@
1834118417
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
1834218418
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
1834318419
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
1834418420
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
1834518421
SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
18346
-SQLITE_PRIVATE char sqlite3AffinityType(const char*, u8*);
18422
+SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
1834718423
SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
1834818424
SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*);
1834918425
SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);
1835018426
SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);
1835118427
SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);
@@ -18403,14 +18479,14 @@
1840318479
1840418480
/*
1840518481
** The interface to the LEMON-generated parser
1840618482
*/
1840718483
#ifndef SQLITE_AMALGAMATION
18408
-SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64));
18484
+SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64), Parse*);
1840918485
SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*));
1841018486
#endif
18411
-SQLITE_PRIVATE void sqlite3Parser(void*, int, Token, Parse*);
18487
+SQLITE_PRIVATE void sqlite3Parser(void*, int, Token);
1841218488
#ifdef YYTRACKMAXSTACKDEPTH
1841318489
SQLITE_PRIVATE int sqlite3ParserStackPeak(void*);
1841418490
#endif
1841518491
1841618492
SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*);
@@ -18494,10 +18570,22 @@
1849418570
SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
1849518571
#else
1849618572
#define sqlite3WithPush(x,y,z)
1849718573
#define sqlite3WithDelete(x,y)
1849818574
#endif
18575
+#ifndef SQLITE_OMIT_UPSERT
18576
+SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
18577
+SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
18578
+SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
18579
+SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
18580
+SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
18581
+#else
18582
+#define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
18583
+#define sqlite3UpsertDelete(x,y)
18584
+#define sqlite3UpsertDup(x,y) ((Upsert*)0)
18585
+#endif
18586
+
1849918587
1850018588
/* Declarations for functions in fkey.c. All of these are replaced by
1850118589
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
1850218590
** key functionality is available. If OMIT_TRIGGER is defined but
1850318591
** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
@@ -18926,11 +19014,12 @@
1892619014
#endif
1892719015
#ifndef SQLITE_UNTESTABLE
1892819016
0, /* xTestCallback */
1892919017
#endif
1893019018
0, /* bLocaltimeFault */
18931
- 0x7ffffffe /* iOnceResetThreshold */
19019
+ 0x7ffffffe, /* iOnceResetThreshold */
19020
+ SQLITE_DEFAULT_SORTERREF_SIZE /* szSorterRef */
1893219021
};
1893319022
1893419023
/*
1893519024
** Hash table for global functions - functions common to all
1893619025
** database connections. After initialization, this table is
@@ -27499,15 +27588,17 @@
2749927588
for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){
2750027589
sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4);
2750127590
}
2750227591
sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
2750327592
}
27504
- va_start(ap, zFormat);
27505
- sqlite3VXPrintf(&acc, zFormat, ap);
27506
- va_end(ap);
27507
- assert( acc.nChar>0 );
27508
- if( zBuf[acc.nChar-1]!='\n' ) sqlite3StrAccumAppend(&acc, "\n", 1);
27593
+ if( zFormat!=0 ){
27594
+ va_start(ap, zFormat);
27595
+ sqlite3VXPrintf(&acc, zFormat, ap);
27596
+ va_end(ap);
27597
+ assert( acc.nChar>0 );
27598
+ sqlite3StrAccumAppend(&acc, "\n", 1);
27599
+ }
2750927600
sqlite3StrAccumFinish(&acc);
2751027601
fprintf(stdout,"%s", zBuf);
2751127602
fflush(stdout);
2751227603
}
2751327604
@@ -27576,14 +27667,14 @@
2757627667
sqlite3TreeViewPush(pView, 1);
2757727668
}
2757827669
do{
2757927670
#if SELECTTRACE_ENABLED
2758027671
sqlite3TreeViewLine(pView,
27581
- "SELECT%s%s (%s/%p) selFlags=0x%x nSelectRow=%d",
27672
+ "SELECT%s%s (%s/%d/%p) selFlags=0x%x nSelectRow=%d",
2758227673
((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
2758327674
((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
27584
- p->zSelName, p, p->selFlags,
27675
+ p->zSelName, p->iSelectId, p, p->selFlags,
2758527676
(int)p->nSelectRow
2758627677
);
2758727678
#else
2758827679
sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d",
2758927680
((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
@@ -27973,20 +28064,25 @@
2797328064
int i;
2797428065
sqlite3TreeViewLine(pView, "%s", zLabel);
2797528066
for(i=0; i<pList->nExpr; i++){
2797628067
int j = pList->a[i].u.x.iOrderByCol;
2797728068
char *zName = pList->a[i].zName;
28069
+ int moreToFollow = i<pList->nExpr - 1;
2797828070
if( j || zName ){
27979
- sqlite3TreeViewPush(pView, 0);
27980
- }
27981
- if( zName ){
27982
- sqlite3TreeViewLine(pView, "AS %s", zName);
27983
- }
27984
- if( j ){
27985
- sqlite3TreeViewLine(pView, "iOrderByCol=%d", j);
27986
- }
27987
- sqlite3TreeViewExpr(pView, pList->a[i].pExpr, i<pList->nExpr-1);
28071
+ sqlite3TreeViewPush(pView, moreToFollow);
28072
+ moreToFollow = 0;
28073
+ sqlite3TreeViewLine(pView, 0);
28074
+ if( zName ){
28075
+ fprintf(stdout, "AS %s ", zName);
28076
+ }
28077
+ if( j ){
28078
+ fprintf(stdout, "iOrderByCol=%d", j);
28079
+ }
28080
+ fprintf(stdout, "\n");
28081
+ fflush(stdout);
28082
+ }
28083
+ sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
2798828084
if( j || zName ){
2798928085
sqlite3TreeViewPop(pView);
2799028086
}
2799128087
}
2799228088
}
@@ -30948,26 +31044,26 @@
3094831044
/* 79 */ "CollSeq" OpHelp(""),
3094931045
/* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
3095031046
/* 81 */ "RealAffinity" OpHelp(""),
3095131047
/* 82 */ "Cast" OpHelp("affinity(r[P1])"),
3095231048
/* 83 */ "Permutation" OpHelp(""),
30953
- /* 84 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
30954
- /* 85 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
30955
- /* 86 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
30956
- /* 87 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
30957
- /* 88 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
30958
- /* 89 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
30959
- /* 90 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
30960
- /* 91 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
30961
- /* 92 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
30962
- /* 93 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
30963
- /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
30964
- /* 95 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
30965
- /* 96 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
30966
- /* 97 */ "String8" OpHelp("r[P2]='P4'"),
30967
- /* 98 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
30968
- /* 99 */ "Column" OpHelp("r[P3]=PX"),
31049
+ /* 84 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31050
+ /* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
31051
+ /* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
31052
+ /* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
31053
+ /* 88 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
31054
+ /* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
31055
+ /* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
31056
+ /* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
31057
+ /* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
31058
+ /* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
31059
+ /* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
31060
+ /* 95 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31061
+ /* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
31062
+ /* 97 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31063
+ /* 98 */ "Column" OpHelp("r[P3]=PX"),
31064
+ /* 99 */ "String8" OpHelp("r[P2]='P4'"),
3096931065
/* 100 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
3097031066
/* 101 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
3097131067
/* 102 */ "Count" OpHelp("r[P2]=count()"),
3097231068
/* 103 */ "ReadCookie" OpHelp(""),
3097331069
/* 104 */ "SetCookie" OpHelp(""),
@@ -30996,13 +31092,13 @@
3099631092
/* 127 */ "SeekEnd" OpHelp(""),
3099731093
/* 128 */ "SorterInsert" OpHelp("key=r[P2]"),
3099831094
/* 129 */ "IdxInsert" OpHelp("key=r[P2]"),
3099931095
/* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
3100031096
/* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31001
- /* 132 */ "Real" OpHelp("r[P2]=P4"),
31002
- /* 133 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31003
- /* 134 */ "Destroy" OpHelp(""),
31097
+ /* 132 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31098
+ /* 133 */ "Destroy" OpHelp(""),
31099
+ /* 134 */ "Real" OpHelp("r[P2]=P4"),
3100431100
/* 135 */ "Clear" OpHelp(""),
3100531101
/* 136 */ "ResetSorter" OpHelp(""),
3100631102
/* 137 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
3100731103
/* 138 */ "SqlExec" OpHelp(""),
3100831104
/* 139 */ "ParseSchema" OpHelp(""),
@@ -61480,14 +61576,14 @@
6148061576
if( p && p->sharable ){
6148161577
sqlite3BtreeEnter(p);
6148261578
skipOk = 0;
6148361579
}
6148461580
}
61485
- db->skipBtreeMutex = skipOk;
61581
+ db->noSharedCache = skipOk;
6148661582
}
6148761583
SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
61488
- if( db->skipBtreeMutex==0 ) btreeEnterAll(db);
61584
+ if( db->noSharedCache==0 ) btreeEnterAll(db);
6148961585
}
6149061586
static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){
6149161587
int i;
6149261588
Btree *p;
6149361589
assert( sqlite3_mutex_held(db->mutex) );
@@ -61495,11 +61591,11 @@
6149561591
p = db->aDb[i].pBt;
6149661592
if( p ) sqlite3BtreeLeave(p);
6149761593
}
6149861594
}
6149961595
SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
61500
- if( db->skipBtreeMutex==0 ) btreeLeaveAll(db);
61596
+ if( db->noSharedCache==0 ) btreeLeaveAll(db);
6150161597
}
6150261598
6150361599
#ifndef NDEBUG
6150461600
/*
6150561601
** Return true if the current thread holds the database connection
@@ -73871,16 +73967,20 @@
7387173967
assert( zVal[nVal]=='\'' );
7387273968
sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
7387373969
0, SQLITE_DYNAMIC);
7387473970
}
7387573971
#endif
73876
-
7387773972
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
7387873973
else if( op==TK_FUNCTION && pCtx!=0 ){
7387973974
rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx);
7388073975
}
7388173976
#endif
73977
+ else if( op==TK_TRUEFALSE ){
73978
+ pVal = valueNew(db, pCtx);
73979
+ pVal->flags = MEM_Int;
73980
+ pVal->u.i = pExpr->u.zToken[4]==0;
73981
+ }
7388273982
7388373983
*ppVal = pVal;
7388473984
return rc;
7388573985
7388673986
no_mem:
@@ -74624,14 +74724,33 @@
7462474724
int j = ADDR(x);
7462574725
assert( v->magic==VDBE_MAGIC_INIT );
7462674726
assert( j<p->nLabel );
7462774727
assert( j>=0 );
7462874728
if( p->aLabel ){
74729
+#ifdef SQLITE_DEBUG
74730
+ if( p->db->flags & SQLITE_VdbeAddopTrace ){
74731
+ printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
74732
+ }
74733
+#endif
74734
+ assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
7462974735
p->aLabel[j] = v->nOp;
7463074736
}
7463174737
}
7463274738
74739
+#ifdef SQLITE_COVERAGE_TEST
74740
+/*
74741
+** Return TRUE if and only if the label x has already been resolved.
74742
+** Return FALSE (zero) if label x is still unresolved.
74743
+**
74744
+** This routine is only used inside of testcase() macros, and so it
74745
+** only exists when measuring test coverage.
74746
+*/
74747
+SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe *v, int x){
74748
+ return v->pParse->aLabel && v->pParse->aLabel[ADDR(x)]>=0;
74749
+}
74750
+#endif /* SQLITE_COVERAGE_TEST */
74751
+
7463374752
/*
7463474753
** Mark the VDBE as one that can only be run one time.
7463574754
*/
7463674755
SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
7463774756
p->runOnlyOnce = 1;
@@ -75858,10 +75977,13 @@
7585875977
**
7585975978
** When p->explain==1, each instruction is listed. When
7586075979
** p->explain==2, only OP_Explain instructions are listed and these
7586175980
** are shown in a different format. p->explain==2 is used to implement
7586275981
** EXPLAIN QUERY PLAN.
75982
+** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers
75983
+** are also shown, so that the boundaries between the main program and
75984
+** each trigger are clear.
7586375985
**
7586475986
** When p->explain==1, first the main program is listed, then each of
7586575987
** the trigger subprograms are listed one by one.
7586675988
*/
7586775989
SQLITE_PRIVATE int sqlite3VdbeList(
@@ -75920,11 +76042,11 @@
7592076042
for(i=0; i<nSub; i++){
7592176043
nRow += apSub[i]->nOp;
7592276044
}
7592376045
}
7592476046
75925
- do{
76047
+ while(1){ /* Loop exits via break */
7592676048
i = p->pc++;
7592776049
if( i>=nRow ){
7592876050
p->rc = SQLITE_OK;
7592976051
rc = SQLITE_DONE;
7593076052
break;
@@ -75966,11 +76088,14 @@
7596676088
pSub->flags |= MEM_Blob;
7596776089
pSub->n = nSub*sizeof(SubProgram*);
7596876090
nRow += pOp->p4.pProgram->nOp;
7596976091
}
7597076092
}
75971
- }while( p->explain==2 && pOp->opcode!=OP_Explain );
76093
+ if( p->explain<2 ) break;
76094
+ if( pOp->opcode==OP_Explain ) break;
76095
+ if( pOp->opcode==OP_Init && p->pc>1 ) break;
76096
+ }
7597276097
7597376098
if( rc==SQLITE_OK ){
7597476099
if( db->u1.isInterrupted ){
7597576100
p->rc = SQLITE_INTERRUPT;
7597676101
rc = SQLITE_ERROR;
@@ -92644,11 +92769,11 @@
9264492769
sqlite3 *db = pParse->db; /* The database connection */
9264592770
struct SrcList_item *pItem; /* Use for looping over pSrcList items */
9264692771
struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
9264792772
NameContext *pTopNC = pNC; /* First namecontext in the list */
9264892773
Schema *pSchema = 0; /* Schema of the expression */
92649
- int isTrigger = 0; /* True if resolved to a trigger column */
92774
+ int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
9265092775
Table *pTab = 0; /* Table hold the row */
9265192776
Column *pCol; /* A column of pTab */
9265292777
9265392778
assert( pNC ); /* the name context cannot be NULL. */
9265492779
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
@@ -92749,26 +92874,39 @@
9274992874
}
9275092875
pSchema = pExpr->pTab->pSchema;
9275192876
}
9275292877
} /* if( pSrcList ) */
9275392878
92754
-#ifndef SQLITE_OMIT_TRIGGER
92879
+#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
9275592880
/* If we have not already resolved the name, then maybe
92756
- ** it is a new.* or old.* trigger argument reference
92881
+ ** it is a new.* or old.* trigger argument reference. Or
92882
+ ** maybe it is an excluded.* from an upsert.
9275792883
*/
92758
- if( zDb==0 && zTab!=0 && cntTab==0 && pParse->pTriggerTab!=0 ){
92759
- int op = pParse->eTriggerOp;
92760
- assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
92761
- if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
92762
- pExpr->iTable = 1;
92763
- pTab = pParse->pTriggerTab;
92764
- }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
92765
- pExpr->iTable = 0;
92766
- pTab = pParse->pTriggerTab;
92767
- }else{
92768
- pTab = 0;
92769
- }
92884
+ if( zDb==0 && zTab!=0 && cntTab==0 ){
92885
+ pTab = 0;
92886
+#ifndef SQLITE_OMIT_TRIGGER
92887
+ if( pParse->pTriggerTab!=0 ){
92888
+ int op = pParse->eTriggerOp;
92889
+ assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
92890
+ if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
92891
+ pExpr->iTable = 1;
92892
+ pTab = pParse->pTriggerTab;
92893
+ }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
92894
+ pExpr->iTable = 0;
92895
+ pTab = pParse->pTriggerTab;
92896
+ }
92897
+ }
92898
+#endif /* SQLITE_OMIT_TRIGGER */
92899
+#ifndef SQLITE_OMIT_UPSERT
92900
+ if( (pNC->ncFlags & NC_UUpsert)!=0 ){
92901
+ Upsert *pUpsert = pNC->uNC.pUpsert;
92902
+ if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
92903
+ pTab = pUpsert->pUpsertSrc->a[0].pTab;
92904
+ pExpr->iTable = 2;
92905
+ }
92906
+ }
92907
+#endif /* SQLITE_OMIT_UPSERT */
9277092908
9277192909
if( pTab ){
9277292910
int iCol;
9277392911
pSchema = pTab->pSchema;
9277492912
cntTab++;
@@ -92784,28 +92922,39 @@
9278492922
/* IMP: R-51414-32910 */
9278592923
iCol = -1;
9278692924
}
9278792925
if( iCol<pTab->nCol ){
9278892926
cnt++;
92789
- if( iCol<0 ){
92790
- pExpr->affinity = SQLITE_AFF_INTEGER;
92791
- }else if( pExpr->iTable==0 ){
92792
- testcase( iCol==31 );
92793
- testcase( iCol==32 );
92794
- pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92795
- }else{
92796
- testcase( iCol==31 );
92797
- testcase( iCol==32 );
92798
- pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92799
- }
92800
- pExpr->iColumn = (i16)iCol;
92801
- pExpr->pTab = pTab;
92802
- isTrigger = 1;
92927
+#ifndef SQLITE_OMIT_UPSERT
92928
+ if( pExpr->iTable==2 ){
92929
+ testcase( iCol==(-1) );
92930
+ pExpr->iTable = pNC->uNC.pUpsert->regData + iCol;
92931
+ eNewExprOp = TK_REGISTER;
92932
+ }else
92933
+#endif /* SQLITE_OMIT_UPSERT */
92934
+ {
92935
+#ifndef SQLITE_OMIT_TRIGGER
92936
+ if( iCol<0 ){
92937
+ pExpr->affinity = SQLITE_AFF_INTEGER;
92938
+ }else if( pExpr->iTable==0 ){
92939
+ testcase( iCol==31 );
92940
+ testcase( iCol==32 );
92941
+ pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92942
+ }else{
92943
+ testcase( iCol==31 );
92944
+ testcase( iCol==32 );
92945
+ pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92946
+ }
92947
+ pExpr->pTab = pTab;
92948
+ pExpr->iColumn = (i16)iCol;
92949
+ eNewExprOp = TK_TRIGGER;
92950
+#endif /* SQLITE_OMIT_TRIGGER */
92951
+ }
9280392952
}
9280492953
}
9280592954
}
92806
-#endif /* !defined(SQLITE_OMIT_TRIGGER) */
92955
+#endif /* !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT) */
9280792956
9280892957
/*
9280992958
** Perhaps the name is a reference to the ROWID
9281092959
*/
9281192960
if( cnt==0
@@ -92836,14 +92985,16 @@
9283692985
** or HAVING clauses, or as part of a larger expression in the ORDER BY
9283792986
** clause is not standard SQL. This is a (goofy) SQLite extension, that
9283892987
** is supported for backwards compatibility only. Hence, we issue a warning
9283992988
** on sqlite3_log() whenever the capability is used.
9284092989
*/
92841
- if( (pEList = pNC->pEList)!=0
92842
- && zTab==0
92990
+ if( (pNC->ncFlags & NC_UEList)!=0
9284392991
&& cnt==0
92992
+ && zTab==0
9284492993
){
92994
+ pEList = pNC->uNC.pEList;
92995
+ assert( pEList!=0 );
9284592996
for(j=0; j<pEList->nExpr; j++){
9284692997
char *zAs = pEList->a[j].zName;
9284792998
if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
9284892999
Expr *pOrig;
9284993000
assert( pExpr->pLeft==0 && pExpr->pRight==0 );
@@ -92936,11 +93087,11 @@
9293693087
*/
9293793088
sqlite3ExprDelete(db, pExpr->pLeft);
9293893089
pExpr->pLeft = 0;
9293993090
sqlite3ExprDelete(db, pExpr->pRight);
9294093091
pExpr->pRight = 0;
92941
- pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
93092
+ pExpr->op = eNewExprOp;
9294293093
ExprSetProperty(pExpr, EP_Leaf);
9294393094
lookupname_end:
9294493095
if( cnt==1 ){
9294593096
assert( pNC!=0 );
9294693097
if( !ExprHasProperty(pExpr, EP_Alias) ){
@@ -93368,12 +93519,12 @@
9336893519
/* Resolve all names in the ORDER BY term expression
9336993520
*/
9337093521
memset(&nc, 0, sizeof(nc));
9337193522
nc.pParse = pParse;
9337293523
nc.pSrcList = pSelect->pSrc;
93373
- nc.pEList = pEList;
93374
- nc.ncFlags = NC_AllowAgg;
93524
+ nc.uNC.pEList = pEList;
93525
+ nc.ncFlags = NC_AllowAgg|NC_UEList;
9337593526
nc.nErr = 0;
9337693527
db = pParse->db;
9337793528
savedSuppErr = db->suppressErr;
9337893529
db->suppressErr = 1;
9337993530
rc = sqlite3ResolveExprNames(&nc, pE);
@@ -93752,11 +93903,13 @@
9375293903
** aliases in the result set.
9375393904
**
9375493905
** Minor point: If this is the case, then the expression will be
9375593906
** re-evaluated for each reference to it.
9375693907
*/
93757
- sNC.pEList = p->pEList;
93908
+ assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
93909
+ sNC.uNC.pEList = p->pEList;
93910
+ sNC.ncFlags |= NC_UEList;
9375893911
if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
9375993912
if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
9376093913
9376193914
/* Resolve names in table-valued-function arguments */
9376293915
for(i=0; i<p->pSrc->nSrc; i++){
@@ -93985,11 +94138,11 @@
9398594138
SQLITE_PRIVATE void sqlite3ResolveSelfReference(
9398694139
Parse *pParse, /* Parsing context */
9398794140
Table *pTab, /* The table being referenced */
9398894141
int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */
9398994142
Expr *pExpr, /* Expression to resolve. May be NULL. */
93990
- ExprList *pList /* Expression list to resolve. May be NUL. */
94143
+ ExprList *pList /* Expression list to resolve. May be NULL. */
9399194144
){
9399294145
SrcList sSrc; /* Fake SrcList for pParse->pNewTable */
9399394146
NameContext sNC; /* Name context for pParse->pNewTable */
9399494147
9399594148
assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr );
@@ -95371,10 +95524,11 @@
9537195524
pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
9537295525
pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);
9537395526
pItem->sortOrder = pOldItem->sortOrder;
9537495527
pItem->done = 0;
9537595528
pItem->bSpanIsTab = pOldItem->bSpanIsTab;
95529
+ pItem->bSorterRef = pOldItem->bSorterRef;
9537695530
pItem->u = pOldItem->u;
9537795531
}
9537895532
return pNew;
9537995533
}
9538095534
@@ -95833,10 +95987,12 @@
9583395987
if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
9583495988
return WRC_Continue;
9583595989
}
9583695990
/* Fall through */
9583795991
case TK_IF_NULL_ROW:
95992
+ case TK_REGISTER:
95993
+ testcase( pExpr->op==TK_REGISTER );
9583895994
testcase( pExpr->op==TK_IF_NULL_ROW );
9583995995
pWalker->eCode = 0;
9584095996
return WRC_Abort;
9584195997
case TK_VARIABLE:
9584295998
if( pWalker->eCode==5 ){
@@ -95850,12 +96006,12 @@
9585096006
pWalker->eCode = 0;
9585196007
return WRC_Abort;
9585296008
}
9585396009
/* Fall through */
9585496010
default:
95855
- testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail will disallow */
95856
- testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail will disallow */
96011
+ testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail() disallows */
96012
+ testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail() disallows */
9585796013
return WRC_Continue;
9585896014
}
9585996015
}
9586096016
static int exprIsConst(Expr *p, int initFlag, int iCur){
9586196017
Walker w;
@@ -96614,21 +96770,10 @@
9661496770
*/
9661596771
if( !ExprHasProperty(pExpr, EP_VarSelect) ){
9661696772
jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
9661796773
}
9661896774
96619
-#ifndef SQLITE_OMIT_EXPLAIN
96620
- if( pParse->explain==2 ){
96621
- char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
96622
- jmpIfDynamic>=0?"":"CORRELATED ",
96623
- pExpr->op==TK_IN?"LIST":"SCALAR",
96624
- pParse->iNextSelectId
96625
- );
96626
- sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
96627
- }
96628
-#endif
96629
-
9663096775
switch( pExpr->op ){
9663196776
case TK_IN: {
9663296777
int addr; /* Address of OP_OpenEphemeral instruction */
9663396778
Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */
9663496779
KeyInfo *pKeyInfo = 0; /* Key information */
@@ -96661,10 +96806,21 @@
9666196806
** Generate code to write the results of the select into the temporary
9666296807
** table allocated and opened above.
9666396808
*/
9666496809
Select *pSelect = pExpr->x.pSelect;
9666596810
ExprList *pEList = pSelect->pEList;
96811
+
96812
+#ifndef SQLITE_OMIT_EXPLAIN
96813
+ if( pParse->explain==2 ){
96814
+ char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sLIST SUBQUERY %d",
96815
+ jmpIfDynamic>=0?"":"CORRELATED ",
96816
+ pParse->iNextSelectId
96817
+ );
96818
+ sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg,
96819
+ P4_DYNAMIC);
96820
+ }
96821
+#endif
9666696822
9666796823
assert( !isRowid );
9666896824
/* If the LHS and RHS of the IN operator do not match, that
9666996825
** error will have been caught long before we reach this point. */
9667096826
if( ALWAYS(pEList->nExpr==nVal) ){
@@ -96703,11 +96859,10 @@
9670396859
char affinity; /* Affinity of the LHS of the IN */
9670496860
int i;
9670596861
ExprList *pList = pExpr->x.pList;
9670696862
struct ExprList_item *pItem;
9670796863
int r1, r2, r3;
96708
-
9670996864
affinity = sqlite3ExprAffinity(pLeft);
9671096865
if( !affinity ){
9671196866
affinity = SQLITE_AFF_BLOB;
9671296867
}
9671396868
if( pKeyInfo ){
@@ -96782,10 +96937,21 @@
9678296937
9678396938
testcase( pExpr->op==TK_EXISTS );
9678496939
testcase( pExpr->op==TK_SELECT );
9678596940
assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
9678696941
assert( ExprHasProperty(pExpr, EP_xIsSelect) );
96942
+
96943
+#ifndef SQLITE_OMIT_EXPLAIN
96944
+ if( pParse->explain==2 ){
96945
+ char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sSCALAR SUBQUERY %d",
96946
+ jmpIfDynamic>=0?"":"CORRELATED ",
96947
+ pParse->iNextSelectId
96948
+ );
96949
+ sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg,
96950
+ P4_DYNAMIC);
96951
+ }
96952
+#endif
9678796953
9678896954
pSel = pExpr->x.pSelect;
9678996955
nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
9679096956
sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
9679196957
pParse->nMem += nReg;
@@ -98379,10 +98545,16 @@
9837998545
assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */
9838098546
n = pList->nExpr;
9838198547
if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;
9838298548
for(pItem=pList->a, i=0; i<n; i++, pItem++){
9838398549
Expr *pExpr = pItem->pExpr;
98550
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
98551
+ if( pItem->bSorterRef ){
98552
+ i--;
98553
+ n--;
98554
+ }else
98555
+#endif
9838498556
if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
9838598557
if( flags & SQLITE_ECEL_OMITREF ){
9838698558
i--;
9838798559
n--;
9838898560
}else{
@@ -98907,21 +99079,24 @@
9890799079
return 2;
9890899080
}
9890999081
if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
9891099082
if( pA->op==TK_FUNCTION ){
9891199083
if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
99084
+ }else if( pA->op==TK_COLLATE ){
99085
+ if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
9891299086
}else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
98913
- return pA->op==TK_COLLATE ? 1 : 2;
99087
+ return 2;
9891499088
}
9891599089
}
9891699090
if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
9891799091
if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
9891899092
if( combinedFlags & EP_xIsSelect ) return 2;
9891999093
if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
9892099094
if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
9892199095
if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
98922
- if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){
99096
+ assert( (combinedFlags & EP_Reduced)==0 );
99097
+ if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
9892399098
if( pA->iColumn!=pB->iColumn ) return 2;
9892499099
if( pA->iTable!=pB->iTable
9892599100
&& (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
9892699101
}
9892799102
}
@@ -99263,12 +99438,13 @@
9926399438
static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
9926499439
int i;
9926599440
NameContext *pNC = pWalker->u.pNC;
9926699441
Parse *pParse = pNC->pParse;
9926799442
SrcList *pSrcList = pNC->pSrcList;
99268
- AggInfo *pAggInfo = pNC->pAggInfo;
99443
+ AggInfo *pAggInfo = pNC->uNC.pAggInfo;
9926999444
99445
+ assert( pNC->ncFlags & NC_UAggInfo );
9927099446
switch( pExpr->op ){
9927199447
case TK_AGG_COLUMN:
9927299448
case TK_COLUMN: {
9927399449
testcase( pExpr->op==TK_AGG_COLUMN );
9927499450
testcase( pExpr->op==TK_COLUMN );
@@ -102434,11 +102610,11 @@
102434102610
flags |= SQLITE_OPEN_MAIN_DB;
102435102611
rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
102436102612
sqlite3_free( zPath );
102437102613
db->nDb++;
102438102614
}
102439
- db->skipBtreeMutex = 0;
102615
+ db->noSharedCache = 0;
102440102616
if( rc==SQLITE_CONSTRAINT ){
102441102617
rc = SQLITE_ERROR;
102442102618
zErrDyn = sqlite3MPrintf(db, "database is already attached");
102443102619
}else if( rc==SQLITE_OK ){
102444102620
Pager *pPager;
@@ -102506,10 +102682,11 @@
102506102682
** way we found it.
102507102683
*/
102508102684
if( rc==SQLITE_OK ){
102509102685
sqlite3BtreeEnterAll(db);
102510102686
db->init.iDb = 0;
102687
+ db->mDbFlags &= ~(DBFLAG_SchemaKnownOk);
102511102688
rc = sqlite3Init(db, &zErrDyn);
102512102689
sqlite3BtreeLeaveAll(db);
102513102690
assert( zErrDyn==0 || rc!=SQLITE_OK );
102514102691
}
102515102692
#ifdef SQLITE_USER_AUTHENTICATION
@@ -102778,10 +102955,13 @@
102778102955
}
102779102956
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102780102957
if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
102781102958
if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
102782102959
#endif
102960
+ if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){
102961
+ return 1;
102962
+ }
102783102963
}
102784102964
return 0;
102785102965
}
102786102966
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102787102967
SQLITE_PRIVATE int sqlite3FixSelect(
@@ -102877,10 +103057,22 @@
102877103057
return 1;
102878103058
}
102879103059
if( sqlite3FixExprList(pFix, pStep->pExprList) ){
102880103060
return 1;
102881103061
}
103062
+#ifndef SQLITE_OMIT_UPSERT
103063
+ if( pStep->pUpsert ){
103064
+ Upsert *pUp = pStep->pUpsert;
103065
+ if( sqlite3FixExprList(pFix, pUp->pUpsertTarget)
103066
+ || sqlite3FixExpr(pFix, pUp->pUpsertTargetWhere)
103067
+ || sqlite3FixExprList(pFix, pUp->pUpsertSet)
103068
+ || sqlite3FixExpr(pFix, pUp->pUpsertWhere)
103069
+ ){
103070
+ return 1;
103071
+ }
103072
+ }
103073
+#endif
102882103074
pStep = pStep->pNext;
102883103075
}
102884103076
return 0;
102885103077
}
102886103078
#endif
@@ -103504,28 +103696,31 @@
103504103696
u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */
103505103697
const char *zName, /* Name of the table we are looking for */
103506103698
const char *zDbase /* Name of the database. Might be NULL */
103507103699
){
103508103700
Table *p;
103701
+ sqlite3 *db = pParse->db;
103509103702
103510103703
/* Read the database schema. If an error occurs, leave an error message
103511103704
** and code in pParse and return NULL. */
103512
- if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
103705
+ if( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0
103706
+ && SQLITE_OK!=sqlite3ReadSchema(pParse)
103707
+ ){
103513103708
return 0;
103514103709
}
103515103710
103516
- p = sqlite3FindTable(pParse->db, zName, zDbase);
103711
+ p = sqlite3FindTable(db, zName, zDbase);
103517103712
if( p==0 ){
103518103713
const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table";
103519103714
#ifndef SQLITE_OMIT_VIRTUALTABLE
103520
- if( sqlite3FindDbName(pParse->db, zDbase)<1 ){
103715
+ if( sqlite3FindDbName(db, zDbase)<1 ){
103521103716
/* If zName is the not the name of a table in the schema created using
103522103717
** CREATE, then check to see if it is the name of an virtual table that
103523103718
** can be an eponymous virtual table. */
103524
- Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName);
103719
+ Module *pMod = (Module*)sqlite3HashFind(&db->aModule, zName);
103525103720
if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
103526
- pMod = sqlite3PragmaVtabRegister(pParse->db, zName);
103721
+ pMod = sqlite3PragmaVtabRegister(db, zName);
103527103722
}
103528103723
if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
103529103724
return pMod->pEpoTab;
103530103725
}
103531103726
}
@@ -103686,10 +103881,11 @@
103686103881
103687103882
if( iDb>=0 ){
103688103883
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
103689103884
DbSetProperty(db, iDb, DB_ResetWanted);
103690103885
DbSetProperty(db, 1, DB_ResetWanted);
103886
+ db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
103691103887
}
103692103888
103693103889
if( db->nSchemaLock==0 ){
103694103890
for(i=0; i<db->nDb; i++){
103695103891
if( DbHasProperty(db, i, DB_ResetWanted) ){
@@ -103711,11 +103907,11 @@
103711103907
Db *pDb = &db->aDb[i];
103712103908
if( pDb->pSchema ){
103713103909
sqlite3SchemaClear(pDb->pSchema);
103714103910
}
103715103911
}
103716
- db->mDbFlags &= ~DBFLAG_SchemaChange;
103912
+ db->mDbFlags &= ~(DBFLAG_SchemaChange|DBFLAG_SchemaKnownOk);
103717103913
sqlite3VtabUnlockList(db);
103718103914
sqlite3BtreeLeaveAll(db);
103719103915
sqlite3CollapseDatabaseArray(db);
103720103916
}
103721103917
@@ -104256,19 +104452,24 @@
104256104452
pCol->zName = z;
104257104453
sqlite3ColumnPropertiesFromName(p, pCol);
104258104454
104259104455
if( pType->n==0 ){
104260104456
/* If there is no type specified, columns have the default affinity
104261
- ** 'BLOB'. */
104457
+ ** 'BLOB' with a default size of 4 bytes. */
104262104458
pCol->affinity = SQLITE_AFF_BLOB;
104263104459
pCol->szEst = 1;
104460
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
104461
+ if( 4>=sqlite3GlobalConfig.szSorterRef ){
104462
+ pCol->colFlags |= COLFLAG_SORTERREF;
104463
+ }
104464
+#endif
104264104465
}else{
104265104466
zType = z + sqlite3Strlen30(z) + 1;
104266104467
memcpy(zType, pType->z, pType->n);
104267104468
zType[pType->n] = 0;
104268104469
sqlite3Dequote(zType);
104269
- pCol->affinity = sqlite3AffinityType(zType, &pCol->szEst);
104470
+ pCol->affinity = sqlite3AffinityType(zType, pCol);
104270104471
pCol->colFlags |= COLFLAG_HASTYPE;
104271104472
}
104272104473
p->nCol++;
104273104474
pParse->constraintName.n = 0;
104274104475
}
@@ -104324,11 +104525,11 @@
104324104525
** 'DOUB' | SQLITE_AFF_REAL
104325104526
**
104326104527
** If none of the substrings in the above table are found,
104327104528
** SQLITE_AFF_NUMERIC is returned.
104328104529
*/
104329
-SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, u8 *pszEst){
104530
+SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){
104330104531
u32 h = 0;
104331104532
char aff = SQLITE_AFF_NUMERIC;
104332104533
const char *zChar = 0;
104333104534
104334104535
assert( zIn!=0 );
@@ -104361,31 +104562,36 @@
104361104562
aff = SQLITE_AFF_INTEGER;
104362104563
break;
104363104564
}
104364104565
}
104365104566
104366
- /* If pszEst is not NULL, store an estimate of the field size. The
104567
+ /* If pCol is not NULL, store an estimate of the field size. The
104367104568
** estimate is scaled so that the size of an integer is 1. */
104368
- if( pszEst ){
104369
- *pszEst = 1; /* default size is approx 4 bytes */
104569
+ if( pCol ){
104570
+ int v = 0; /* default size is approx 4 bytes */
104370104571
if( aff<SQLITE_AFF_NUMERIC ){
104371104572
if( zChar ){
104372104573
while( zChar[0] ){
104373104574
if( sqlite3Isdigit(zChar[0]) ){
104374
- int v = 0;
104575
+ /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */
104375104576
sqlite3GetInt32(zChar, &v);
104376
- v = v/4 + 1;
104377
- if( v>255 ) v = 255;
104378
- *pszEst = v; /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */
104379104577
break;
104380104578
}
104381104579
zChar++;
104382104580
}
104383104581
}else{
104384
- *pszEst = 5; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/
104582
+ v = 16; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/
104385104583
}
104386104584
}
104585
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
104586
+ if( v>=sqlite3GlobalConfig.szSorterRef ){
104587
+ pCol->colFlags |= COLFLAG_SORTERREF;
104588
+ }
104589
+#endif
104590
+ v = v/4 + 1;
104591
+ if( v>255 ) v = 255;
104592
+ pCol->szEst = v;
104387104593
}
104388104594
return aff;
104389104595
}
104390104596
104391104597
/*
@@ -108366,11 +108572,11 @@
108366108572
int nIdx; /* Number of indices */
108367108573
sqlite3 *db; /* Main database structure */
108368108574
AuthContext sContext; /* Authorization context */
108369108575
NameContext sNC; /* Name context to resolve expressions in */
108370108576
int iDb; /* Database number */
108371
- int memCnt = -1; /* Memory cell used for change counting */
108577
+ int memCnt = 0; /* Memory cell used for change counting */
108372108578
int rcauth; /* Value returned by authorization callback */
108373108579
int eOnePass; /* ONEPASS_OFF or _SINGLE or _MULTI */
108374108580
int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */
108375108581
u8 *aToOpen = 0; /* Open cursor iTabCur+j if aToOpen[j] is true */
108376108582
Index *pPk; /* The PRIMARY KEY index on the table */
@@ -108471,11 +108677,11 @@
108471108677
v = sqlite3GetVdbe(pParse);
108472108678
if( v==0 ){
108473108679
goto delete_from_cleanup;
108474108680
}
108475108681
if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
108476
- sqlite3BeginWriteOperation(pParse, 1, iDb);
108682
+ sqlite3BeginWriteOperation(pParse, bComplex, iDb);
108477108683
108478108684
/* If we are trying to delete from a view, realize that view into
108479108685
** an ephemeral table.
108480108686
*/
108481108687
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
@@ -108499,11 +108705,14 @@
108499108705
}
108500108706
108501108707
/* Initialize the counter of the number of rows deleted, if
108502108708
** we are counting rows.
108503108709
*/
108504
- if( db->flags & SQLITE_CountRows ){
108710
+ if( (db->flags & SQLITE_CountRows)!=0
108711
+ && !pParse->nested
108712
+ && !pParse->pTriggerTab
108713
+ ){
108505108714
memCnt = ++pParse->nMem;
108506108715
sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
108507108716
}
108508108717
108509108718
#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
@@ -108527,11 +108736,11 @@
108527108736
#endif
108528108737
){
108529108738
assert( !isView );
108530108739
sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
108531108740
if( HasRowid(pTab) ){
108532
- sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
108741
+ sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1,
108533108742
pTab->zName, P4_STATIC);
108534108743
}
108535108744
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108536108745
assert( pIdx->pSchema==pTab->pSchema );
108537108746
sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
@@ -108572,13 +108781,14 @@
108572108781
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1);
108573108782
if( pWInfo==0 ) goto delete_from_cleanup;
108574108783
eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
108575108784
assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
108576108785
assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
108786
+ if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse);
108577108787
108578108788
/* Keep track of the number of rows to be deleted */
108579
- if( db->flags & SQLITE_CountRows ){
108789
+ if( memCnt ){
108580108790
sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
108581108791
}
108582108792
108583108793
/* Extract the rowid or primary key for the current row */
108584108794
if( pPk ){
@@ -108717,11 +108927,11 @@
108717108927
108718108928
/* Return the number of rows that were deleted. If this routine is
108719108929
** generating code because of a call to sqlite3NestedParse(), do not
108720108930
** invoke the callback function.
108721108931
*/
108722
- if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){
108932
+ if( memCnt ){
108723108933
sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);
108724108934
sqlite3VdbeSetNumCols(v, 1);
108725108935
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
108726108936
}
108727108937
@@ -112899,11 +113109,12 @@
112899113109
SQLITE_PRIVATE void sqlite3Insert(
112900113110
Parse *pParse, /* Parser context */
112901113111
SrcList *pTabList, /* Name of table into which we are inserting */
112902113112
Select *pSelect, /* A SELECT statement to use as the data source */
112903113113
IdList *pColumn, /* Column names corresponding to IDLIST. */
112904
- int onError /* How to handle constraint errors */
113114
+ int onError, /* How to handle constraint errors */
113115
+ Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */
112905113116
){
112906113117
sqlite3 *db; /* The main database structure */
112907113118
Table *pTab; /* The table to insert into. aka TABLE */
112908113119
int i, j; /* Loop counters */
112909113120
Vdbe *v; /* Generate code into this virtual machine */
@@ -113194,11 +113405,14 @@
113194113405
goto insert_cleanup;
113195113406
}
113196113407
113197113408
/* Initialize the count of rows to be inserted
113198113409
*/
113199
- if( db->flags & SQLITE_CountRows ){
113410
+ if( (db->flags & SQLITE_CountRows)!=0
113411
+ && !pParse->nested
113412
+ && !pParse->pTriggerTab
113413
+ ){
113200113414
regRowCount = ++pParse->nMem;
113201113415
sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
113202113416
}
113203113417
113204113418
/* If this is not a view, open the table and and all indices */
@@ -113214,10 +113428,23 @@
113214113428
assert( pIdx );
113215113429
aRegIdx[i] = ++pParse->nMem;
113216113430
pParse->nMem += pIdx->nColumn;
113217113431
}
113218113432
}
113433
+#ifndef SQLITE_OMIT_UPSERT
113434
+ if( pUpsert ){
113435
+ pTabList->a[0].iCursor = iDataCur;
113436
+ pUpsert->pUpsertSrc = pTabList;
113437
+ pUpsert->regData = regData;
113438
+ pUpsert->iDataCur = iDataCur;
113439
+ pUpsert->iIdxCur = iIdxCur;
113440
+ if( pUpsert->pUpsertTarget ){
113441
+ sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert);
113442
+ }
113443
+ }
113444
+#endif
113445
+
113219113446
113220113447
/* This is the top of the main insertion loop */
113221113448
if( useTempTable ){
113222113449
/* This block codes the top of loop only. The complete loop is the
113223113450
** following pseudocode (template 4):
@@ -113416,11 +113643,11 @@
113416113643
#endif
113417113644
{
113418113645
int isReplace; /* Set to true if constraints may cause a replace */
113419113646
int bUseSeek; /* True to use OPFLAG_SEEKRESULT */
113420113647
sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
113421
- regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0
113648
+ regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0, pUpsert
113422113649
);
113423113650
sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);
113424113651
113425113652
/* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE
113426113653
** constraints or (b) there are no triggers and this table is not a
@@ -113439,11 +113666,11 @@
113439113666
}
113440113667
}
113441113668
113442113669
/* Update the count of rows that are inserted
113443113670
*/
113444
- if( (db->flags & SQLITE_CountRows)!=0 ){
113671
+ if( regRowCount ){
113445113672
sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
113446113673
}
113447113674
113448113675
if( pTrigger ){
113449113676
/* Code AFTER triggers */
@@ -113476,19 +113703,20 @@
113476113703
/*
113477113704
** Return the number of rows inserted. If this routine is
113478113705
** generating code because of a call to sqlite3NestedParse(), do not
113479113706
** invoke the callback function.
113480113707
*/
113481
- if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){
113708
+ if( regRowCount ){
113482113709
sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
113483113710
sqlite3VdbeSetNumCols(v, 1);
113484113711
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
113485113712
}
113486113713
113487113714
insert_cleanup:
113488113715
sqlite3SrcListDelete(db, pTabList);
113489113716
sqlite3ExprListDelete(db, pList);
113717
+ sqlite3UpsertDelete(db, pUpsert);
113490113718
sqlite3SelectDelete(db, pSelect);
113491113719
sqlite3IdListDelete(db, pColumn);
113492113720
sqlite3DbFree(db, aRegIdx);
113493113721
}
113494113722
@@ -113555,10 +113783,48 @@
113555113783
testcase( w.eCode==CKCNSTRNT_COLUMN );
113556113784
testcase( w.eCode==CKCNSTRNT_ROWID );
113557113785
testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
113558113786
return !w.eCode;
113559113787
}
113788
+
113789
+/*
113790
+** An instance of the ConstraintAddr object remembers the byte-code addresses
113791
+** for sections of the constraint checks that deal with uniqueness constraints
113792
+** on the rowid and on the upsert constraint.
113793
+**
113794
+** This information is passed into checkReorderConstraintChecks() to insert
113795
+** some OP_Goto operations so that the rowid and upsert constraints occur
113796
+** in the correct order relative to other constraints.
113797
+*/
113798
+typedef struct ConstraintAddr ConstraintAddr;
113799
+struct ConstraintAddr {
113800
+ int ipkTop; /* Subroutine for rowid constraint check */
113801
+ int upsertTop; /* Label for upsert constraint check subroutine */
113802
+ int upsertTop2; /* Copy of upsertTop not cleared by the call */
113803
+ int upsertBtm; /* upsert constraint returns to this label */
113804
+ int ipkBtm; /* Return opcode rowid constraint check */
113805
+};
113806
+
113807
+/*
113808
+** Generate any OP_Goto operations needed to cause constraints to be
113809
+** run that haven't already been run.
113810
+*/
113811
+static void reorderConstraintChecks(Vdbe *v, ConstraintAddr *p){
113812
+ if( p->upsertTop ){
113813
+ testcase( sqlite3VdbeLabelHasBeenResolved(v, p->upsertTop) );
113814
+ sqlite3VdbeGoto(v, p->upsertTop);
113815
+ VdbeComment((v, "call upsert subroutine"));
113816
+ sqlite3VdbeResolveLabel(v, p->upsertBtm);
113817
+ p->upsertTop = 0;
113818
+ }
113819
+ if( p->ipkTop ){
113820
+ sqlite3VdbeGoto(v, p->ipkTop);
113821
+ VdbeComment((v, "call rowid unique-check subroutine"));
113822
+ sqlite3VdbeJumpHere(v, p->ipkBtm);
113823
+ p->ipkTop = 0;
113824
+ }
113825
+}
113560113826
113561113827
/*
113562113828
** Generate code to do constraint checks prior to an INSERT or an UPDATE
113563113829
** on table pTab.
113564113830
**
@@ -113651,11 +113917,12 @@
113651113917
int regOldData, /* Previous content. 0 for INSERTs */
113652113918
u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
113653113919
u8 overrideError, /* Override onError to this if not OE_Default */
113654113920
int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
113655113921
int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */
113656
- int *aiChng /* column i is unchanged if aiChng[i]<0 */
113922
+ int *aiChng, /* column i is unchanged if aiChng[i]<0 */
113923
+ Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
113657113924
){
113658113925
Vdbe *v; /* VDBE under constrution */
113659113926
Index *pIdx; /* Pointer to one of the indices */
113660113927
Index *pPk = 0; /* The PRIMARY KEY index */
113661113928
sqlite3 *db; /* Database connection */
@@ -113664,21 +113931,23 @@
113664113931
int nCol; /* Number of columns */
113665113932
int onError; /* Conflict resolution strategy */
113666113933
int addr1; /* Address of jump instruction */
113667113934
int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
113668113935
int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
113669
- int ipkTop = 0; /* Top of the rowid change constraint check */
113670
- int ipkBottom = 0; /* Bottom of the rowid change constraint check */
113936
+ ConstraintAddr sAddr;/* Address information for constraint reordering */
113937
+ Index *pUpIdx = 0; /* Index to which to apply the upsert */
113671113938
u8 isUpdate; /* True if this is an UPDATE operation */
113672113939
u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
113940
+ int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
113673113941
113674113942
isUpdate = regOldData!=0;
113675113943
db = pParse->db;
113676113944
v = sqlite3GetVdbe(pParse);
113677113945
assert( v!=0 );
113678113946
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
113679113947
nCol = pTab->nCol;
113948
+ memset(&sAddr, 0, sizeof(sAddr));
113680113949
113681113950
/* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
113682113951
** normal rowid tables. nPkField is the number of key fields in the
113683113952
** pPk index or 1 for a rowid table. In other words, nPkField is the
113684113953
** number of fields in the true primary key of the table. */
@@ -113773,10 +114042,50 @@
113773114042
sqlite3VdbeResolveLabel(v, allOk);
113774114043
}
113775114044
pParse->iSelfTab = 0;
113776114045
}
113777114046
#endif /* !defined(SQLITE_OMIT_CHECK) */
114047
+
114048
+ /* UNIQUE and PRIMARY KEY constraints should be handled in the following
114049
+ ** order:
114050
+ **
114051
+ ** (1) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
114052
+ ** (2) OE_Update
114053
+ ** (3) OE_Replace
114054
+ **
114055
+ ** OE_Fail and OE_Ignore must happen before any changes are made.
114056
+ ** OE_Update guarantees that only a single row will change, so it
114057
+ ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
114058
+ ** could happen in any order, but they are grouped up front for
114059
+ ** convenience.
114060
+ **
114061
+ ** Constraint checking code is generated in this order:
114062
+ ** (A) The rowid constraint
114063
+ ** (B) Unique index constraints that do not have OE_Replace as their
114064
+ ** default conflict resolution strategy
114065
+ ** (C) Unique index that do use OE_Replace by default.
114066
+ **
114067
+ ** The ordering of (2) and (3) is accomplished by making sure the linked
114068
+ ** list of indexes attached to a table puts all OE_Replace indexes last
114069
+ ** in the list. See sqlite3CreateIndex() for where that happens.
114070
+ */
114071
+
114072
+ if( pUpsert ){
114073
+ if( pUpsert->pUpsertTarget==0 ){
114074
+ /* An ON CONFLICT DO NOTHING clause, without a constraint-target.
114075
+ ** Make all unique constraint resolution be OE_Ignore */
114076
+ assert( pUpsert->pUpsertSet==0 );
114077
+ overrideError = OE_Ignore;
114078
+ pUpsert = 0;
114079
+ }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
114080
+ /* If the constraint-target is on some column other than
114081
+ ** then ROWID, then we might need to move the UPSERT around
114082
+ ** so that it occurs in the correct order. */
114083
+ sAddr.upsertTop = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v);
114084
+ sAddr.upsertBtm = sqlite3VdbeMakeLabel(v);
114085
+ }
114086
+ }
113778114087
113779114088
/* If rowid is changing, make sure the new rowid does not previously
113780114089
** exist in the table.
113781114090
*/
113782114091
if( pkChng && pPk==0 ){
@@ -113787,10 +114096,36 @@
113787114096
if( overrideError!=OE_Default ){
113788114097
onError = overrideError;
113789114098
}else if( onError==OE_Default ){
113790114099
onError = OE_Abort;
113791114100
}
114101
+
114102
+ /* figure out whether or not upsert applies in this case */
114103
+ if( pUpsert && pUpsert->pUpsertIdx==0 ){
114104
+ if( pUpsert->pUpsertSet==0 ){
114105
+ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
114106
+ }else{
114107
+ onError = OE_Update; /* DO UPDATE */
114108
+ }
114109
+ }
114110
+
114111
+ /* If the response to a rowid conflict is REPLACE but the response
114112
+ ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
114113
+ ** to defer the running of the rowid conflict checking until after
114114
+ ** the UNIQUE constraints have run.
114115
+ */
114116
+ assert( OE_Update>OE_Replace );
114117
+ assert( OE_Ignore<OE_Replace );
114118
+ assert( OE_Fail<OE_Replace );
114119
+ assert( OE_Abort<OE_Replace );
114120
+ assert( OE_Rollback<OE_Replace );
114121
+ if( onError>=OE_Replace
114122
+ && (pUpsert || onError!=overrideError)
114123
+ && pTab->pIndex
114124
+ ){
114125
+ sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
114126
+ }
113792114127
113793114128
if( isUpdate ){
113794114129
/* pkChng!=0 does not mean that the rowid has changed, only that
113795114130
** it might have changed. Skip the conflict logic below if the rowid
113796114131
** is unchanged. */
@@ -113797,38 +114132,27 @@
113797114132
sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData);
113798114133
sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
113799114134
VdbeCoverage(v);
113800114135
}
113801114136
113802
- /* If the response to a rowid conflict is REPLACE but the response
113803
- ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
113804
- ** to defer the running of the rowid conflict checking until after
113805
- ** the UNIQUE constraints have run.
113806
- */
113807
- if( onError==OE_Replace && overrideError!=OE_Replace ){
113808
- for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
113809
- if( pIdx->onError==OE_Ignore || pIdx->onError==OE_Fail ){
113810
- ipkTop = sqlite3VdbeAddOp0(v, OP_Goto);
113811
- break;
113812
- }
113813
- }
113814
- }
113815
-
113816114137
/* Check to see if the new rowid already exists in the table. Skip
113817114138
** the following conflict logic if it does not. */
114139
+ VdbeNoopComment((v, "uniqueness check for ROWID"));
113818114140
sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
113819114141
VdbeCoverage(v);
113820114142
113821
- /* Generate code that deals with a rowid collision */
113822114143
switch( onError ){
113823114144
default: {
113824114145
onError = OE_Abort;
113825114146
/* Fall thru into the next case */
113826114147
}
113827114148
case OE_Rollback:
113828114149
case OE_Abort:
113829114150
case OE_Fail: {
114151
+ testcase( onError==OE_Rollback );
114152
+ testcase( onError==OE_Abort );
114153
+ testcase( onError==OE_Fail );
113830114154
sqlite3RowidConstraint(pParse, onError, pTab);
113831114155
break;
113832114156
}
113833114157
case OE_Replace: {
113834114158
/* If there are DELETE triggers on this table and the
@@ -113861,37 +114185,42 @@
113861114185
sqlite3MultiWrite(pParse);
113862114186
sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
113863114187
regNewData, 1, 0, OE_Replace, 1, -1);
113864114188
}else{
113865114189
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
113866
- if( HasRowid(pTab) ){
113867
- /* This OP_Delete opcode fires the pre-update-hook only. It does
113868
- ** not modify the b-tree. It is more efficient to let the coming
113869
- ** OP_Insert replace the existing entry than it is to delete the
113870
- ** existing entry and then insert a new one. */
113871
- sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP);
113872
- sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
113873
- }
114190
+ assert( HasRowid(pTab) );
114191
+ /* This OP_Delete opcode fires the pre-update-hook only. It does
114192
+ ** not modify the b-tree. It is more efficient to let the coming
114193
+ ** OP_Insert replace the existing entry than it is to delete the
114194
+ ** existing entry and then insert a new one. */
114195
+ sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP);
114196
+ sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
113874114197
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
113875114198
if( pTab->pIndex ){
113876114199
sqlite3MultiWrite(pParse);
113877114200
sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
113878114201
}
113879114202
}
113880114203
seenReplace = 1;
113881114204
break;
113882114205
}
114206
+#ifndef SQLITE_OMIT_UPSERT
114207
+ case OE_Update: {
114208
+ sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur);
114209
+ /* Fall through */
114210
+ }
114211
+#endif
113883114212
case OE_Ignore: {
113884
- /*assert( seenReplace==0 );*/
114213
+ testcase( onError==OE_Ignore );
113885114214
sqlite3VdbeGoto(v, ignoreDest);
113886114215
break;
113887114216
}
113888114217
}
113889114218
sqlite3VdbeResolveLabel(v, addrRowidOk);
113890
- if( ipkTop ){
113891
- ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
113892
- sqlite3VdbeJumpHere(v, ipkTop);
114219
+ if( sAddr.ipkTop ){
114220
+ sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto);
114221
+ sqlite3VdbeJumpHere(v, sAddr.ipkTop-1);
113893114222
}
113894114223
}
113895114224
113896114225
/* Test all UNIQUE constraints by creating entries for each UNIQUE
113897114226
** index and making sure that duplicate entries do not already exist.
@@ -113905,16 +114234,25 @@
113905114234
int regR; /* Range of registers holding conflicting PK */
113906114235
int iThisCur; /* Cursor for this UNIQUE index */
113907114236
int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
113908114237
113909114238
if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
114239
+ if( pUpIdx==pIdx ){
114240
+ addrUniqueOk = sAddr.upsertBtm;
114241
+ upsertBypass = sqlite3VdbeGoto(v, 0);
114242
+ VdbeComment((v, "Skip upsert subroutine"));
114243
+ sqlite3VdbeResolveLabel(v, sAddr.upsertTop2);
114244
+ }else{
114245
+ addrUniqueOk = sqlite3VdbeMakeLabel(v);
114246
+ }
114247
+ VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
113910114248
if( bAffinityDone==0 ){
113911114249
sqlite3TableAffinity(v, pTab, regNewData+1);
113912114250
bAffinityDone = 1;
113913114251
}
113914114252
iThisCur = iIdxCur+ix;
113915
- addrUniqueOk = sqlite3VdbeMakeLabel(v);
114253
+
113916114254
113917114255
/* Skip partial indices for which the WHERE clause is not true */
113918114256
if( pIdx->pPartIdxWhere ){
113919114257
sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);
113920114258
pParse->iSelfTab = -(regNewData+1);
@@ -113969,10 +114307,28 @@
113969114307
if( overrideError!=OE_Default ){
113970114308
onError = overrideError;
113971114309
}else if( onError==OE_Default ){
113972114310
onError = OE_Abort;
113973114311
}
114312
+
114313
+ /* Figure out if the upsert clause applies to this index */
114314
+ if( pUpIdx==pIdx ){
114315
+ if( pUpsert->pUpsertSet==0 ){
114316
+ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
114317
+ }else{
114318
+ onError = OE_Update; /* DO UPDATE */
114319
+ }
114320
+ }
114321
+
114322
+ /* Invoke subroutines to handle IPK replace and upsert prior to running
114323
+ ** the first REPLACE constraint check. */
114324
+ if( onError==OE_Replace ){
114325
+ testcase( sAddr.ipkTop );
114326
+ testcase( sAddr.upsertTop
114327
+ && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
114328
+ reorderConstraintChecks(v, &sAddr);
114329
+ }
113974114330
113975114331
/* Collision detection may be omitted if all of the following are true:
113976114332
** (1) The conflict resolution algorithm is REPLACE
113977114333
** (2) The table is a WITHOUT ROWID table
113978114334
** (3) There are no secondary indexes on the table
@@ -114052,19 +114408,29 @@
114052114408
}
114053114409
}
114054114410
114055114411
/* Generate code that executes if the new index entry is not unique */
114056114412
assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
114057
- || onError==OE_Ignore || onError==OE_Replace );
114413
+ || onError==OE_Ignore || onError==OE_Replace || onError==OE_Update );
114058114414
switch( onError ){
114059114415
case OE_Rollback:
114060114416
case OE_Abort:
114061114417
case OE_Fail: {
114418
+ testcase( onError==OE_Rollback );
114419
+ testcase( onError==OE_Abort );
114420
+ testcase( onError==OE_Fail );
114062114421
sqlite3UniqueConstraint(pParse, onError, pIdx);
114063114422
break;
114064114423
}
114424
+#ifndef SQLITE_OMIT_UPSERT
114425
+ case OE_Update: {
114426
+ sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix);
114427
+ /* Fall through */
114428
+ }
114429
+#endif
114065114430
case OE_Ignore: {
114431
+ testcase( onError==OE_Ignore );
114066114432
sqlite3VdbeGoto(v, ignoreDest);
114067114433
break;
114068114434
}
114069114435
default: {
114070114436
Trigger *pTrigger = 0;
@@ -114078,18 +114444,23 @@
114078114444
(pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur);
114079114445
seenReplace = 1;
114080114446
break;
114081114447
}
114082114448
}
114083
- sqlite3VdbeResolveLabel(v, addrUniqueOk);
114449
+ if( pUpIdx==pIdx ){
114450
+ sqlite3VdbeJumpHere(v, upsertBypass);
114451
+ }else{
114452
+ sqlite3VdbeResolveLabel(v, addrUniqueOk);
114453
+ }
114084114454
sqlite3ExprCachePop(pParse);
114085114455
if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
114456
+
114086114457
}
114087
- if( ipkTop ){
114088
- sqlite3VdbeGoto(v, ipkTop+1);
114089
- sqlite3VdbeJumpHere(v, ipkBottom);
114090
- }
114458
+ testcase( sAddr.ipkTop!=0 );
114459
+ testcase( sAddr.upsertTop
114460
+ && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
114461
+ reorderConstraintChecks(v, &sAddr);
114091114462
114092114463
*pbMayReplace = seenReplace;
114093114464
VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
114094114465
}
114095114466
@@ -119511,10 +119882,11 @@
119511119882
int meta[5];
119512119883
InitData initData;
119513119884
const char *zMasterName;
119514119885
int openedTransaction = 0;
119515119886
119887
+ assert( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 );
119516119888
assert( iDb>=0 && iDb<db->nDb );
119517119889
assert( db->aDb[iDb].pSchema );
119518119890
assert( sqlite3_mutex_held(db->mutex) );
119519119891
assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
119520119892
@@ -119740,10 +120112,11 @@
119740120112
rc = sqlite3InitOne(db, 0, pzErrMsg);
119741120113
if( rc ) return rc;
119742120114
}
119743120115
/* All other schemas after the main schema. The "temp" schema must be last */
119744120116
for(i=db->nDb-1; i>0; i--){
120117
+ assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) );
119745120118
if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
119746120119
rc = sqlite3InitOne(db, i, pzErrMsg);
119747120120
if( rc ) return rc;
119748120121
}
119749120122
}
@@ -119761,14 +120134,16 @@
119761120134
int rc = SQLITE_OK;
119762120135
sqlite3 *db = pParse->db;
119763120136
assert( sqlite3_mutex_held(db->mutex) );
119764120137
if( !db->init.busy ){
119765120138
rc = sqlite3Init(db, &pParse->zErrMsg);
119766
- }
119767
- if( rc!=SQLITE_OK ){
119768
- pParse->rc = rc;
119769
- pParse->nErr++;
120139
+ if( rc!=SQLITE_OK ){
120140
+ pParse->rc = rc;
120141
+ pParse->nErr++;
120142
+ }else if( db->noSharedCache ){
120143
+ db->mDbFlags |= DBFLAG_SchemaKnownOk;
120144
+ }
119770120145
}
119771120146
return rc;
119772120147
}
119773120148
119774120149
@@ -120289,11 +120664,11 @@
120289120664
*/
120290120665
#if SELECTTRACE_ENABLED
120291120666
/***/ int sqlite3SelectTrace = 0;
120292120667
# define SELECTTRACE(K,P,S,X) \
120293120668
if(sqlite3SelectTrace&(K)) \
120294
- sqlite3DebugPrintf("%s/%p: ",(S)->zSelName,(S)),\
120669
+ sqlite3DebugPrintf("%s/%d/%p: ",(S)->zSelName,(P)->iSelectId,(S)),\
120295120670
sqlite3DebugPrintf X
120296120671
#else
120297120672
# define SELECTTRACE(K,P,S,X)
120298120673
#endif
120299120674
@@ -120312,10 +120687,24 @@
120312120687
};
120313120688
120314120689
/*
120315120690
** An instance of the following object is used to record information about
120316120691
** the ORDER BY (or GROUP BY) clause of query is being coded.
120692
+**
120693
+** The aDefer[] array is used by the sorter-references optimization. For
120694
+** example, assuming there is no index that can be used for the ORDER BY,
120695
+** for the query:
120696
+**
120697
+** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10;
120698
+**
120699
+** it may be more efficient to add just the "a" values to the sorter, and
120700
+** retrieve the associated "bigblob" values directly from table t1 as the
120701
+** 10 smallest "a" values are extracted from the sorter.
120702
+**
120703
+** When the sorter-reference optimization is used, there is one entry in the
120704
+** aDefer[] array for each database table that may be read as values are
120705
+** extracted from the sorter.
120317120706
*/
120318120707
typedef struct SortCtx SortCtx;
120319120708
struct SortCtx {
120320120709
ExprList *pOrderBy; /* The ORDER BY (or GROUP BY clause) */
120321120710
int nOBSat; /* Number of ORDER BY terms satisfied by indices */
@@ -120324,10 +120713,18 @@
120324120713
int labelBkOut; /* Start label for the block-output subroutine */
120325120714
int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */
120326120715
int labelDone; /* Jump here when done, ex: LIMIT reached */
120327120716
u8 sortFlags; /* Zero or more SORTFLAG_* bits */
120328120717
u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */
120718
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
120719
+ u8 nDefer; /* Number of valid entries in aDefer[] */
120720
+ struct DeferredCsr {
120721
+ Table *pTab; /* Table definition */
120722
+ int iCsr; /* Cursor number for table */
120723
+ int nKey; /* Number of PK columns for table pTab (>=1) */
120724
+ } aDefer[4];
120725
+#endif
120329120726
};
120330120727
#define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */
120331120728
120332120729
/*
120333120730
** Delete all the content of a Select structure. Deallocate the structure
@@ -120946,10 +121343,94 @@
120946121343
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N);
120947121344
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
120948121345
sqlite3ReleaseTempReg(pParse, r1);
120949121346
}
120950121347
121348
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
121349
+/*
121350
+** This function is called as part of inner-loop generation for a SELECT
121351
+** statement with an ORDER BY that is not optimized by an index. It
121352
+** determines the expressions, if any, that the sorter-reference
121353
+** optimization should be used for. The sorter-reference optimization
121354
+** is used for SELECT queries like:
121355
+**
121356
+** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10
121357
+**
121358
+** If the optimization is used for expression "bigblob", then instead of
121359
+** storing values read from that column in the sorter records, the PK of
121360
+** the row from table t1 is stored instead. Then, as records are extracted from
121361
+** the sorter to return to the user, the required value of bigblob is
121362
+** retrieved directly from table t1. If the values are very large, this
121363
+** can be more efficient than storing them directly in the sorter records.
121364
+**
121365
+** The ExprList_item.bSorterRef flag is set for each expression in pEList
121366
+** for which the sorter-reference optimization should be enabled.
121367
+** Additionally, the pSort->aDefer[] array is populated with entries
121368
+** for all cursors required to evaluate all selected expressions. Finally.
121369
+** output variable (*ppExtra) is set to an expression list containing
121370
+** expressions for all extra PK values that should be stored in the
121371
+** sorter records.
121372
+*/
121373
+static void selectExprDefer(
121374
+ Parse *pParse, /* Leave any error here */
121375
+ SortCtx *pSort, /* Sorter context */
121376
+ ExprList *pEList, /* Expressions destined for sorter */
121377
+ ExprList **ppExtra /* Expressions to append to sorter record */
121378
+){
121379
+ int i;
121380
+ int nDefer = 0;
121381
+ ExprList *pExtra = 0;
121382
+ for(i=0; i<pEList->nExpr; i++){
121383
+ struct ExprList_item *pItem = &pEList->a[i];
121384
+ if( pItem->u.x.iOrderByCol==0 ){
121385
+ Expr *pExpr = pItem->pExpr;
121386
+ Table *pTab = pExpr->pTab;
121387
+ if( pExpr->op==TK_COLUMN && pTab && !IsVirtual(pTab)
121388
+ && (pTab->aCol[pExpr->iColumn].colFlags & COLFLAG_SORTERREF)
121389
+#if 0
121390
+ && pTab->pSchema && pTab->pSelect==0 && !IsVirtual(pTab)
121391
+#endif
121392
+ ){
121393
+ int j;
121394
+ for(j=0; j<nDefer; j++){
121395
+ if( pSort->aDefer[j].iCsr==pExpr->iTable ) break;
121396
+ }
121397
+ if( j==nDefer ){
121398
+ if( nDefer==ArraySize(pSort->aDefer) ){
121399
+ continue;
121400
+ }else{
121401
+ int nKey = 1;
121402
+ int k;
121403
+ Index *pPk = 0;
121404
+ if( !HasRowid(pTab) ){
121405
+ pPk = sqlite3PrimaryKeyIndex(pTab);
121406
+ nKey = pPk->nKeyCol;
121407
+ }
121408
+ for(k=0; k<nKey; k++){
121409
+ Expr *pNew = sqlite3PExpr(pParse, TK_COLUMN, 0, 0);
121410
+ if( pNew ){
121411
+ pNew->iTable = pExpr->iTable;
121412
+ pNew->pTab = pExpr->pTab;
121413
+ pNew->iColumn = pPk ? pPk->aiColumn[k] : -1;
121414
+ pExtra = sqlite3ExprListAppend(pParse, pExtra, pNew);
121415
+ }
121416
+ }
121417
+ pSort->aDefer[nDefer].pTab = pExpr->pTab;
121418
+ pSort->aDefer[nDefer].iCsr = pExpr->iTable;
121419
+ pSort->aDefer[nDefer].nKey = nKey;
121420
+ nDefer++;
121421
+ }
121422
+ }
121423
+ pItem->bSorterRef = 1;
121424
+ }
121425
+ }
121426
+ }
121427
+ pSort->nDefer = (u8)nDefer;
121428
+ *ppExtra = pExtra;
121429
+}
121430
+#endif
121431
+
120951121432
/*
120952121433
** This routine generates the code for the inside of the inner loop
120953121434
** of a SELECT.
120954121435
**
120955121436
** If srcTab is negative, then the p->pEList expressions
@@ -121018,10 +121499,13 @@
121018121499
for(i=0; i<nResultCol; i++){
121019121500
sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
121020121501
VdbeComment((v, "%s", p->pEList->a[i].zName));
121021121502
}
121022121503
}else if( eDest!=SRT_Exists ){
121504
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
121505
+ ExprList *pExtra = 0;
121506
+#endif
121023121507
/* If the destination is an EXISTS(...) expression, the actual
121024121508
** values returned by the SELECT are not required.
121025121509
*/
121026121510
u8 ecelFlags;
121027121511
if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
@@ -121041,16 +121525,38 @@
121041121525
int j;
121042121526
if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
121043121527
p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
121044121528
}
121045121529
}
121530
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
121531
+ selectExprDefer(pParse, pSort, p->pEList, &pExtra);
121532
+ if( pExtra && pParse->db->mallocFailed==0 ){
121533
+ /* If there are any extra PK columns to add to the sorter records,
121534
+ ** allocate extra memory cells and adjust the OpenEphemeral
121535
+ ** instruction to account for the larger records. This is only
121536
+ ** required if there are one or more WITHOUT ROWID tables with
121537
+ ** composite primary keys in the SortCtx.aDefer[] array. */
121538
+ VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
121539
+ pOp->p2 += (pExtra->nExpr - pSort->nDefer);
121540
+ pOp->p4.pKeyInfo->nAllField += (pExtra->nExpr - pSort->nDefer);
121541
+ pParse->nMem += pExtra->nExpr;
121542
+ }
121543
+#endif
121046121544
regOrig = 0;
121047121545
assert( eDest==SRT_Set || eDest==SRT_Mem
121048121546
|| eDest==SRT_Coroutine || eDest==SRT_Output );
121049121547
}
121050121548
nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult,
121051121549
0,ecelFlags);
121550
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
121551
+ if( pExtra ){
121552
+ nResultCol += sqlite3ExprCodeExprList(
121553
+ pParse, pExtra, regResult + nResultCol, 0, 0
121554
+ );
121555
+ sqlite3ExprListDelete(pParse->db, pExtra);
121556
+ }
121557
+#endif
121052121558
}
121053121559
121054121560
/* If the DISTINCT keyword was present on the SELECT statement
121055121561
** and this row has been seen before, then do not make this row
121056121562
** part of the result.
@@ -121504,50 +122010,60 @@
121504122010
SelectDest *pDest /* Write the sorted results here */
121505122011
){
121506122012
Vdbe *v = pParse->pVdbe; /* The prepared statement */
121507122013
int addrBreak = pSort->labelDone; /* Jump here to exit loop */
121508122014
int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */
121509
- int addr;
122015
+ int addr; /* Top of output loop. Jump for Next. */
121510122016
int addrOnce = 0;
121511122017
int iTab;
121512122018
ExprList *pOrderBy = pSort->pOrderBy;
121513122019
int eDest = pDest->eDest;
121514122020
int iParm = pDest->iSDParm;
121515122021
int regRow;
121516122022
int regRowid;
121517122023
int iCol;
121518
- int nKey;
122024
+ int nKey; /* Number of key columns in sorter record */
121519122025
int iSortTab; /* Sorter cursor to read from */
121520
- int nSortData; /* Trailing values to read from sorter */
121521122026
int i;
121522122027
int bSeq; /* True if sorter record includes seq. no. */
122028
+ int nRefKey = 0;
121523122029
struct ExprList_item *aOutEx = p->pEList->a;
121524122030
121525122031
assert( addrBreak<0 );
121526122032
if( pSort->labelBkOut ){
121527122033
sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
121528122034
sqlite3VdbeGoto(v, addrBreak);
121529122035
sqlite3VdbeResolveLabel(v, pSort->labelBkOut);
121530122036
}
122037
+
122038
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
122039
+ /* Open any cursors needed for sorter-reference expressions */
122040
+ for(i=0; i<pSort->nDefer; i++){
122041
+ Table *pTab = pSort->aDefer[i].pTab;
122042
+ int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
122043
+ sqlite3OpenTable(pParse, pSort->aDefer[i].iCsr, iDb, pTab, OP_OpenRead);
122044
+ nRefKey = MAX(nRefKey, pSort->aDefer[i].nKey);
122045
+ }
122046
+#endif
122047
+
121531122048
iTab = pSort->iECursor;
121532122049
if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
121533122050
regRowid = 0;
121534122051
regRow = pDest->iSdst;
121535
- nSortData = nColumn;
121536122052
}else{
121537122053
regRowid = sqlite3GetTempReg(pParse);
121538122054
regRow = sqlite3GetTempRange(pParse, nColumn);
121539
- nSortData = nColumn;
121540122055
}
121541122056
nKey = pOrderBy->nExpr - pSort->nOBSat;
121542122057
if( pSort->sortFlags & SORTFLAG_UseSorter ){
121543122058
int regSortOut = ++pParse->nMem;
121544122059
iSortTab = pParse->nTab++;
121545122060
if( pSort->labelBkOut ){
121546122061
addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
121547122062
}
121548
- sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);
122063
+ sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut,
122064
+ nKey+1+nColumn+nRefKey);
121549122065
if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
121550122066
addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
121551122067
VdbeCoverage(v);
121552122068
codeOffset(v, p->iOffset, addrContinue);
121553122069
sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);
@@ -121556,22 +122072,63 @@
121556122072
addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v);
121557122073
codeOffset(v, p->iOffset, addrContinue);
121558122074
iSortTab = iTab;
121559122075
bSeq = 1;
121560122076
}
121561
- for(i=0, iCol=nKey+bSeq-1; i<nSortData; i++){
122077
+ for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){
122078
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
122079
+ if( aOutEx[i].bSorterRef ) continue;
122080
+#endif
121562122081
if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++;
121563122082
}
121564
- for(i=nSortData-1; i>=0; i--){
121565
- int iRead;
121566
- if( aOutEx[i].u.x.iOrderByCol ){
121567
- iRead = aOutEx[i].u.x.iOrderByCol-1;
121568
- }else{
121569
- iRead = iCol--;
121570
- }
121571
- sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
121572
- VdbeComment((v, "%s", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));
122083
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
122084
+ if( pSort->nDefer ){
122085
+ int iKey = iCol+1;
122086
+ int regKey = sqlite3GetTempRange(pParse, nRefKey);
122087
+
122088
+ for(i=0; i<pSort->nDefer; i++){
122089
+ int iCsr = pSort->aDefer[i].iCsr;
122090
+ Table *pTab = pSort->aDefer[i].pTab;
122091
+ int nKey = pSort->aDefer[i].nKey;
122092
+
122093
+ sqlite3VdbeAddOp1(v, OP_NullRow, iCsr);
122094
+ if( HasRowid(pTab) ){
122095
+ sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey);
122096
+ sqlite3VdbeAddOp3(v, OP_SeekRowid, iCsr,
122097
+ sqlite3VdbeCurrentAddr(v)+1, regKey);
122098
+ }else{
122099
+ int k;
122100
+ int iJmp;
122101
+ assert( sqlite3PrimaryKeyIndex(pTab)->nKeyCol==nKey );
122102
+ for(k=0; k<nKey; k++){
122103
+ sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey+k);
122104
+ }
122105
+ iJmp = sqlite3VdbeCurrentAddr(v);
122106
+ sqlite3VdbeAddOp4Int(v, OP_SeekGE, iCsr, iJmp+2, regKey, nKey);
122107
+ sqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, iJmp+3, regKey, nKey);
122108
+ sqlite3VdbeAddOp1(v, OP_NullRow, iCsr);
122109
+ }
122110
+ }
122111
+ sqlite3ReleaseTempRange(pParse, regKey, nRefKey);
122112
+ }
122113
+#endif
122114
+ for(i=nColumn-1; i>=0; i--){
122115
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
122116
+ if( aOutEx[i].bSorterRef ){
122117
+ sqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i);
122118
+ }else
122119
+#endif
122120
+ {
122121
+ int iRead;
122122
+ if( aOutEx[i].u.x.iOrderByCol ){
122123
+ iRead = aOutEx[i].u.x.iOrderByCol-1;
122124
+ }else{
122125
+ iRead = iCol--;
122126
+ }
122127
+ sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
122128
+ VdbeComment((v, "%s", aOutEx[i].zName?aOutEx[i].zName : aOutEx[i].zSpan));
122129
+ }
121573122130
}
121574122131
switch( eDest ){
121575122132
case SRT_Table:
121576122133
case SRT_EphemTab: {
121577122134
sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
@@ -123905,13 +124462,12 @@
123905124462
}else{
123906124463
pNew->pPrior = pPrior;
123907124464
if( pPrior ) pPrior->pNext = pNew;
123908124465
pNew->pNext = p;
123909124466
p->pPrior = pNew;
123910
- SELECTTRACE(2,pParse,p,
123911
- ("compound-subquery flattener creates %s.%p as peer\n",
123912
- pNew->zSelName, pNew));
124467
+ SELECTTRACE(2,pParse,p,("compound-subquery flattener"
124468
+ " creates %s.%p as peer\n",pNew->zSelName, pNew));
123913124469
}
123914124470
if( db->mallocFailed ) return 1;
123915124471
}
123916124472
123917124473
/* Begin flattening the iFrom-th entry of the FROM clause
@@ -125439,11 +125995,14 @@
125439125995
return 1;
125440125996
}
125441125997
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
125442125998
memset(&sAggInfo, 0, sizeof(sAggInfo));
125443125999
#if SELECTTRACE_ENABLED
125444
- SELECTTRACE(1,pParse,p, ("begin processing:\n"));
126000
+#ifndef SQLITE_OMIT_EXPLAIN
126001
+ p->iSelectId = pParse->iSelectId;
126002
+#endif
126003
+ SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->iSelectId));
125445126004
if( sqlite3SelectTrace & 0x100 ){
125446126005
sqlite3TreeViewSelect(0, p, 0);
125447126006
}
125448126007
#endif
125449126008
@@ -125470,12 +126029,12 @@
125470126029
goto select_end;
125471126030
}
125472126031
assert( p->pEList!=0 );
125473126032
isAgg = (p->selFlags & SF_Aggregate)!=0;
125474126033
#if SELECTTRACE_ENABLED
125475
- if( sqlite3SelectTrace & 0x100 ){
125476
- SELECTTRACE(0x100,pParse,p, ("after name resolution:\n"));
126034
+ if( sqlite3SelectTrace & 0x104 ){
126035
+ SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
125477126036
sqlite3TreeViewSelect(0, p, 0);
125478126037
}
125479126038
#endif
125480126039
125481126040
/* Get a pointer the VDBE under construction, allocating a new VDBE if one
@@ -125572,14 +126131,17 @@
125572126131
/* Handle compound SELECT statements using the separate multiSelect()
125573126132
** procedure.
125574126133
*/
125575126134
if( p->pPrior ){
125576126135
rc = multiSelect(pParse, p, pDest);
125577
- explainSetInteger(pParse->iSelectId, iRestoreSelectId);
125578126136
#if SELECTTRACE_ENABLED
125579
- SELECTTRACE(1,pParse,p,("end compound-select processing\n"));
126137
+ SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
126138
+ if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){
126139
+ sqlite3TreeViewSelect(0, p, 0);
126140
+ }
125580126141
#endif
126142
+ explainSetInteger(pParse->iSelectId, iRestoreSelectId);
125581126143
return rc;
125582126144
}
125583126145
#endif
125584126146
125585126147
/* For each term in the FROM clause, do two things:
@@ -125954,11 +126516,12 @@
125954126516
** SELECT statement.
125955126517
*/
125956126518
memset(&sNC, 0, sizeof(sNC));
125957126519
sNC.pParse = pParse;
125958126520
sNC.pSrcList = pTabList;
125959
- sNC.pAggInfo = &sAggInfo;
126521
+ sNC.uNC.pAggInfo = &sAggInfo;
126522
+ VVA_ONLY( sNC.ncFlags = NC_UAggInfo; )
125960126523
sAggInfo.mnReg = pParse->nMem+1;
125961126524
sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
125962126525
sAggInfo.pGroupBy = pGroupBy;
125963126526
sqlite3ExprAnalyzeAggList(&sNC, pEList);
125964126527
sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);
@@ -126343,10 +126906,11 @@
126343126906
** and send them to the callback one by one.
126344126907
*/
126345126908
if( sSort.pOrderBy ){
126346126909
explainTempTable(pParse,
126347126910
sSort.nOBSat>0 ? "RIGHT PART OF ORDER BY":"ORDER BY");
126911
+ assert( p->pEList==pEList );
126348126912
generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);
126349126913
}
126350126914
126351126915
/* Jump here to skip this query
126352126916
*/
@@ -126358,17 +126922,20 @@
126358126922
126359126923
/* Control jumps to here if an error is encountered above, or upon
126360126924
** successful coding of the SELECT.
126361126925
*/
126362126926
select_end:
126363
- explainSetInteger(pParse->iSelectId, iRestoreSelectId);
126364126927
sqlite3ExprListDelete(db, pMinMaxOrderBy);
126365126928
sqlite3DbFree(db, sAggInfo.aCol);
126366126929
sqlite3DbFree(db, sAggInfo.aFunc);
126367126930
#if SELECTTRACE_ENABLED
126368
- SELECTTRACE(1,pParse,p,("end processing\n"));
126931
+ SELECTTRACE(0x1,pParse,p,("end processing\n"));
126932
+ if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){
126933
+ sqlite3TreeViewSelect(0, p, 0);
126934
+ }
126369126935
#endif
126936
+ explainSetInteger(pParse->iSelectId, iRestoreSelectId);
126370126937
return rc;
126371126938
}
126372126939
126373126940
/************** End of select.c **********************************************/
126374126941
/************** Begin file table.c *******************************************/
@@ -126598,10 +127165,11 @@
126598127165
126599127166
sqlite3ExprDelete(db, pTmp->pWhere);
126600127167
sqlite3ExprListDelete(db, pTmp->pExprList);
126601127168
sqlite3SelectDelete(db, pTmp->pSelect);
126602127169
sqlite3IdListDelete(db, pTmp->pIdList);
127170
+ sqlite3UpsertDelete(db, pTmp->pUpsert);
126603127171
sqlite3DbFree(db, pTmp->zSpan);
126604127172
126605127173
sqlite3DbFree(db, pTmp);
126606127174
}
126607127175
}
@@ -126989,10 +127557,11 @@
126989127557
sqlite3 *db, /* The database connection */
126990127558
Token *pTableName, /* Name of the table into which we insert */
126991127559
IdList *pColumn, /* List of columns in pTableName to insert into */
126992127560
Select *pSelect, /* A SELECT statement that supplies values */
126993127561
u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
127562
+ Upsert *pUpsert, /* ON CONFLICT clauses for upsert */
126994127563
const char *zStart, /* Start of SQL text */
126995127564
const char *zEnd /* End of SQL text */
126996127565
){
126997127566
TriggerStep *pTriggerStep;
126998127567
@@ -127000,13 +127569,17 @@
127000127569
127001127570
pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd);
127002127571
if( pTriggerStep ){
127003127572
pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
127004127573
pTriggerStep->pIdList = pColumn;
127574
+ pTriggerStep->pUpsert = pUpsert;
127005127575
pTriggerStep->orconf = orconf;
127006127576
}else{
127577
+ testcase( pColumn );
127007127578
sqlite3IdListDelete(db, pColumn);
127579
+ testcase( pUpsert );
127580
+ sqlite3UpsertDelete(db, pUpsert);
127008127581
}
127009127582
sqlite3SelectDelete(db, pSelect);
127010127583
127011127584
return pTriggerStep;
127012127585
}
@@ -127319,20 +127892,21 @@
127319127892
case TK_UPDATE: {
127320127893
sqlite3Update(pParse,
127321127894
targetSrcList(pParse, pStep),
127322127895
sqlite3ExprListDup(db, pStep->pExprList, 0),
127323127896
sqlite3ExprDup(db, pStep->pWhere, 0),
127324
- pParse->eOrconf, 0, 0
127897
+ pParse->eOrconf, 0, 0, 0
127325127898
);
127326127899
break;
127327127900
}
127328127901
case TK_INSERT: {
127329127902
sqlite3Insert(pParse,
127330127903
targetSrcList(pParse, pStep),
127331127904
sqlite3SelectDup(db, pStep->pSelect, 0),
127332127905
sqlite3IdListDup(db, pStep->pIdList),
127333
- pParse->eOrconf
127906
+ pParse->eOrconf,
127907
+ sqlite3UpsertDup(db, pStep->pUpsert)
127334127908
);
127335127909
break;
127336127910
}
127337127911
case TK_DELETE: {
127338127912
sqlite3DeleteFrom(pParse,
@@ -127806,11 +128380,12 @@
127806128380
SrcList *pTabList, /* The table in which we should change things */
127807128381
ExprList *pChanges, /* Things to be changed */
127808128382
Expr *pWhere, /* The WHERE clause. May be null */
127809128383
int onError, /* How to handle constraint errors */
127810128384
ExprList *pOrderBy, /* ORDER BY clause. May be null */
127811
- Expr *pLimit /* LIMIT clause. May be null */
128385
+ Expr *pLimit, /* LIMIT clause. May be null */
128386
+ Upsert *pUpsert /* ON CONFLICT clause, or null */
127812128387
){
127813128388
int i, j; /* Loop counters */
127814128389
Table *pTab; /* The table to be updated */
127815128390
int addrTop = 0; /* VDBE instruction address of the start of the loop */
127816128391
WhereInfo *pWInfo; /* Information about the WHERE clause */
@@ -127913,20 +128488,27 @@
127913128488
/* Allocate a cursors for the main database table and for all indices.
127914128489
** The index cursors might not be used, but if they are used they
127915128490
** need to occur right after the database cursor. So go ahead and
127916128491
** allocate enough space, just in case.
127917128492
*/
127918
- pTabList->a[0].iCursor = iBaseCur = iDataCur = pParse->nTab++;
128493
+ iBaseCur = iDataCur = pParse->nTab++;
127919128494
iIdxCur = iDataCur+1;
127920128495
pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
128496
+ testcase( pPk!=0 && pPk!=pTab->pIndex );
127921128497
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
127922
- if( IsPrimaryKeyIndex(pIdx) && pPk!=0 ){
128498
+ if( pPk==pIdx ){
127923128499
iDataCur = pParse->nTab;
127924
- pTabList->a[0].iCursor = iDataCur;
127925128500
}
127926128501
pParse->nTab++;
127927128502
}
128503
+ if( pUpsert ){
128504
+ /* On an UPSERT, reuse the same cursors already opened by INSERT */
128505
+ iDataCur = pUpsert->iDataCur;
128506
+ iIdxCur = pUpsert->iIdxCur;
128507
+ pParse->nTab = iBaseCur;
128508
+ }
128509
+ pTabList->a[0].iCursor = iDataCur;
127928128510
127929128511
/* Allocate space for aXRef[], aRegIdx[], and aToOpen[].
127930128512
** Initialize aXRef[] and aToOpen[] to their default values.
127931128513
*/
127932128514
aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
@@ -127939,10 +128521,12 @@
127939128521
127940128522
/* Initialize the name-context */
127941128523
memset(&sNC, 0, sizeof(sNC));
127942128524
sNC.pParse = pParse;
127943128525
sNC.pSrcList = pTabList;
128526
+ sNC.uNC.pUpsert = pUpsert;
128527
+ sNC.ncFlags = NC_UUpsert;
127944128528
127945128529
/* Resolve the column names in all the expressions of the
127946128530
** of the UPDATE statement. Also find the column index
127947128531
** for each column to be updated in the pChanges array. For each
127948128532
** column to be updated, make sure we have authorization to change
@@ -128042,11 +128626,11 @@
128042128626
128043128627
/* Begin generating code. */
128044128628
v = sqlite3GetVdbe(pParse);
128045128629
if( v==0 ) goto update_cleanup;
128046128630
if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
128047
- sqlite3BeginWriteOperation(pParse, 1, iDb);
128631
+ sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
128048128632
128049128633
/* Allocate required registers. */
128050128634
if( !IsVirtual(pTab) ){
128051128635
regRowSet = ++pParse->nMem;
128052128636
regOldRowid = regNewRowid = ++pParse->nMem;
@@ -128093,12 +128677,20 @@
128093128677
pWhere, onError);
128094128678
goto update_cleanup;
128095128679
}
128096128680
#endif
128097128681
128098
- /* Initialize the count of updated rows */
128099
- if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab ){
128682
+ /* Jump to labelBreak to abandon further processing of this UPDATE */
128683
+ labelContinue = labelBreak = sqlite3VdbeMakeLabel(v);
128684
+
128685
+ /* Not an UPSERT. Normal processing. Begin by
128686
+ ** initialize the count of updated rows */
128687
+ if( (db->flags&SQLITE_CountRows)!=0
128688
+ && !pParse->pTriggerTab
128689
+ && !pParse->nested
128690
+ && pUpsert==0
128691
+ ){
128100128692
regRowCount = ++pParse->nMem;
128101128693
sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
128102128694
}
128103128695
128104128696
if( HasRowid(pTab) ){
@@ -128107,50 +128699,65 @@
128107128699
assert( pPk!=0 );
128108128700
nPk = pPk->nKeyCol;
128109128701
iPk = pParse->nMem+1;
128110128702
pParse->nMem += nPk;
128111128703
regKey = ++pParse->nMem;
128112
- iEph = pParse->nTab++;
128113
-
128114
- sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1);
128115
- addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);
128116
- sqlite3VdbeSetP4KeyInfo(pParse, pPk);
128117
- }
128118
-
128119
- /* Begin the database scan.
128120
- **
128121
- ** Do not consider a single-pass strategy for a multi-row update if
128122
- ** there are any triggers or foreign keys to process, or rows may
128123
- ** be deleted as a result of REPLACE conflict handling. Any of these
128124
- ** things might disturb a cursor being used to scan through the table
128125
- ** or index, causing a single-pass approach to malfunction. */
128126
- flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE;
128127
- if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
128128
- flags |= WHERE_ONEPASS_MULTIROW;
128129
- }
128130
- pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur);
128131
- if( pWInfo==0 ) goto update_cleanup;
128132
-
128133
- /* A one-pass strategy that might update more than one row may not
128134
- ** be used if any column of the index used for the scan is being
128135
- ** updated. Otherwise, if there is an index on "b", statements like
128136
- ** the following could create an infinite loop:
128137
- **
128138
- ** UPDATE t1 SET b=b+1 WHERE b>?
128139
- **
128140
- ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI
128141
- ** strategy that uses an index for which one or more columns are being
128142
- ** updated. */
128143
- eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
128144
- if( eOnePass==ONEPASS_MULTI ){
128145
- int iCur = aiCurOnePass[1];
128146
- if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
128147
- eOnePass = ONEPASS_OFF;
128148
- }
128149
- assert( iCur!=iDataCur || !HasRowid(pTab) );
128150
- }
128151
-
128704
+ if( pUpsert==0 ){
128705
+ iEph = pParse->nTab++;
128706
+ sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1);
128707
+ addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);
128708
+ sqlite3VdbeSetP4KeyInfo(pParse, pPk);
128709
+ }
128710
+ }
128711
+
128712
+ if( pUpsert ){
128713
+ /* If this is an UPSERT, then all cursors have already been opened by
128714
+ ** the outer INSERT and the data cursor should be pointing at the row
128715
+ ** that is to be updated. So bypass the code that searches for the
128716
+ ** row(s) to be updated.
128717
+ */
128718
+ pWInfo = 0;
128719
+ eOnePass = ONEPASS_SINGLE;
128720
+ sqlite3ExprIfFalse(pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL);
128721
+ }else{
128722
+ /* Begin the database scan.
128723
+ **
128724
+ ** Do not consider a single-pass strategy for a multi-row update if
128725
+ ** there are any triggers or foreign keys to process, or rows may
128726
+ ** be deleted as a result of REPLACE conflict handling. Any of these
128727
+ ** things might disturb a cursor being used to scan through the table
128728
+ ** or index, causing a single-pass approach to malfunction. */
128729
+ flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE;
128730
+ if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
128731
+ flags |= WHERE_ONEPASS_MULTIROW;
128732
+ }
128733
+ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur);
128734
+ if( pWInfo==0 ) goto update_cleanup;
128735
+
128736
+ /* A one-pass strategy that might update more than one row may not
128737
+ ** be used if any column of the index used for the scan is being
128738
+ ** updated. Otherwise, if there is an index on "b", statements like
128739
+ ** the following could create an infinite loop:
128740
+ **
128741
+ ** UPDATE t1 SET b=b+1 WHERE b>?
128742
+ **
128743
+ ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI
128744
+ ** strategy that uses an index for which one or more columns are being
128745
+ ** updated. */
128746
+ eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
128747
+ if( eOnePass!=ONEPASS_SINGLE ){
128748
+ sqlite3MultiWrite(pParse);
128749
+ if( eOnePass==ONEPASS_MULTI ){
128750
+ int iCur = aiCurOnePass[1];
128751
+ if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
128752
+ eOnePass = ONEPASS_OFF;
128753
+ }
128754
+ assert( iCur!=iDataCur || !HasRowid(pTab) );
128755
+ }
128756
+ }
128757
+ }
128758
+
128152128759
if( HasRowid(pTab) ){
128153128760
/* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
128154128761
** mode, write the rowid into the FIFO. In either of the one-pass modes,
128155128762
** leave it in register regOldRowid. */
128156128763
sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
@@ -128166,73 +128773,72 @@
128166128773
for(i=0; i<nPk; i++){
128167128774
assert( pPk->aiColumn[i]>=0 );
128168128775
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur,pPk->aiColumn[i],iPk+i);
128169128776
}
128170128777
if( eOnePass ){
128171
- sqlite3VdbeChangeToNoop(v, addrOpen);
128778
+ if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen);
128172128779
nKey = nPk;
128173128780
regKey = iPk;
128174128781
}else{
128175128782
sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey,
128176128783
sqlite3IndexAffinityStr(db, pPk), nPk);
128177128784
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk);
128178128785
}
128179128786
}
128180128787
128181
- if( eOnePass!=ONEPASS_MULTI ){
128182
- sqlite3WhereEnd(pWInfo);
128183
- }
128184
-
128185
- labelBreak = sqlite3VdbeMakeLabel(v);
128186
- if( !isView ){
128187
- int addrOnce = 0;
128188
-
128189
- /* Open every index that needs updating. */
128190
- if( eOnePass!=ONEPASS_OFF ){
128191
- if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;
128192
- if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;
128193
- }
128194
-
128195
- if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
128196
- addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128197
- }
128198
- sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, aToOpen,
128199
- 0, 0);
128200
- if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
128201
- }
128202
-
128203
- /* Top of the update loop */
128204
- if( eOnePass!=ONEPASS_OFF ){
128205
- if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
128206
- assert( pPk );
128207
- sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey, nKey);
128208
- VdbeCoverageNeverTaken(v);
128209
- }
128210
- if( eOnePass==ONEPASS_SINGLE ){
128211
- labelContinue = labelBreak;
128212
- }else{
128213
- labelContinue = sqlite3VdbeMakeLabel(v);
128214
- }
128215
- sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);
128216
- VdbeCoverageIf(v, pPk==0);
128217
- VdbeCoverageIf(v, pPk!=0);
128218
- }else if( pPk ){
128219
- labelContinue = sqlite3VdbeMakeLabel(v);
128220
- sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v);
128221
- addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey);
128222
- sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0);
128223
- VdbeCoverage(v);
128224
- }else{
128225
- labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet, labelBreak,
128226
- regOldRowid);
128227
- VdbeCoverage(v);
128228
- sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128229
- VdbeCoverage(v);
128230
- }
128231
-
128232
- /* If the record number will change, set register regNewRowid to
128233
- ** contain the new value. If the record number is not being modified,
128788
+ if( pUpsert==0 ){
128789
+ if( eOnePass!=ONEPASS_MULTI ){
128790
+ sqlite3WhereEnd(pWInfo);
128791
+ }
128792
+
128793
+ if( !isView ){
128794
+ int addrOnce = 0;
128795
+
128796
+ /* Open every index that needs updating. */
128797
+ if( eOnePass!=ONEPASS_OFF ){
128798
+ if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;
128799
+ if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;
128800
+ }
128801
+
128802
+ if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
128803
+ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128804
+ }
128805
+ sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur,
128806
+ aToOpen, 0, 0);
128807
+ if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
128808
+ }
128809
+
128810
+ /* Top of the update loop */
128811
+ if( eOnePass!=ONEPASS_OFF ){
128812
+ if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
128813
+ assert( pPk );
128814
+ sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey,nKey);
128815
+ VdbeCoverageNeverTaken(v);
128816
+ }
128817
+ if( eOnePass!=ONEPASS_SINGLE ){
128818
+ labelContinue = sqlite3VdbeMakeLabel(v);
128819
+ }
128820
+ sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);
128821
+ VdbeCoverageIf(v, pPk==0);
128822
+ VdbeCoverageIf(v, pPk!=0);
128823
+ }else if( pPk ){
128824
+ labelContinue = sqlite3VdbeMakeLabel(v);
128825
+ sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v);
128826
+ addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey);
128827
+ sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0);
128828
+ VdbeCoverage(v);
128829
+ }else{
128830
+ labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet,labelBreak,
128831
+ regOldRowid);
128832
+ VdbeCoverage(v);
128833
+ sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128834
+ VdbeCoverage(v);
128835
+ }
128836
+ }
128837
+
128838
+ /* If the rowid value will change, set register regNewRowid to
128839
+ ** contain the new value. If the rowid is not being modified,
128234128840
** then regNewRowid is the same register as regOldRowid, which is
128235128841
** already populated. */
128236128842
assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid );
128237128843
if( chngRowid ){
128238128844
sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);
@@ -128339,11 +128945,11 @@
128339128945
128340128946
/* Do constraint checks. */
128341128947
assert( regOldRowid>0 );
128342128948
sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
128343128949
regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace,
128344
- aXRef);
128950
+ aXRef, 0);
128345128951
128346128952
/* Do FK constraint checks. */
128347128953
if( hasFK ){
128348128954
sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);
128349128955
}
@@ -128409,11 +129015,11 @@
128409129015
}
128410129016
}
128411129017
128412129018
/* Increment the row counter
128413129019
*/
128414
- if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab){
129020
+ if( regRowCount ){
128415129021
sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
128416129022
}
128417129023
128418129024
sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges,
128419129025
TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);
@@ -128436,20 +129042,19 @@
128436129042
128437129043
/* Update the sqlite_sequence table by storing the content of the
128438129044
** maximum rowid counter values recorded while inserting into
128439129045
** autoincrement tables.
128440129046
*/
128441
- if( pParse->nested==0 && pParse->pTriggerTab==0 ){
129047
+ if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){
128442129048
sqlite3AutoincrementEnd(pParse);
128443129049
}
128444129050
128445129051
/*
128446
- ** Return the number of rows that were changed. If this routine is
128447
- ** generating code because of a call to sqlite3NestedParse(), do not
128448
- ** invoke the callback function.
129052
+ ** Return the number of rows that were changed, if we are tracking
129053
+ ** that information.
128449129054
*/
128450
- if( (db->flags&SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested ){
129055
+ if( regRowCount ){
128451129056
sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
128452129057
sqlite3VdbeSetNumCols(v, 1);
128453129058
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
128454129059
}
128455129060
@@ -128566,19 +129171,16 @@
128566129171
128567129172
bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);
128568129173
128569129174
if( bOnePass ){
128570129175
/* If using the onepass strategy, no-op out the OP_OpenEphemeral coded
128571
- ** above. Also, if this is a top-level parse (not a trigger), clear the
128572
- ** multi-write flag so that the VM does not open a statement journal */
129176
+ ** above. */
128573129177
sqlite3VdbeChangeToNoop(v, addr);
128574
- if( sqlite3IsToplevel(pParse) ){
128575
- pParse->isMultiWrite = 0;
128576
- }
128577129178
}else{
128578129179
/* Create a record from the argument register contents and insert it into
128579129180
** the ephemeral table. */
129181
+ sqlite3MultiWrite(pParse);
128580129182
sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
128581129183
#ifdef SQLITE_DEBUG
128582129184
/* Signal an assert() within OP_MakeRecord that it is allowed to
128583129185
** accept no-change records with serial_type 10 */
128584129186
sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC);
@@ -128617,10 +129219,262 @@
128617129219
}
128618129220
}
128619129221
#endif /* SQLITE_OMIT_VIRTUALTABLE */
128620129222
128621129223
/************** End of update.c **********************************************/
129224
+/************** Begin file upsert.c ******************************************/
129225
+/*
129226
+** 2018-04-12
129227
+**
129228
+** The author disclaims copyright to this source code. In place of
129229
+** a legal notice, here is a blessing:
129230
+**
129231
+** May you do good and not evil.
129232
+** May you find forgiveness for yourself and forgive others.
129233
+** May you share freely, never taking more than you give.
129234
+**
129235
+*************************************************************************
129236
+** This file contains code to implement various aspects of UPSERT
129237
+** processing and handling of the Upsert object.
129238
+*/
129239
+/* #include "sqliteInt.h" */
129240
+
129241
+#ifndef SQLITE_OMIT_UPSERT
129242
+/*
129243
+** Free a list of Upsert objects
129244
+*/
129245
+SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
129246
+ if( p ){
129247
+ sqlite3ExprListDelete(db, p->pUpsertTarget);
129248
+ sqlite3ExprDelete(db, p->pUpsertTargetWhere);
129249
+ sqlite3ExprListDelete(db, p->pUpsertSet);
129250
+ sqlite3ExprDelete(db, p->pUpsertWhere);
129251
+ sqlite3DbFree(db, p);
129252
+ }
129253
+}
129254
+
129255
+/*
129256
+** Duplicate an Upsert object.
129257
+*/
129258
+SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
129259
+ if( p==0 ) return 0;
129260
+ return sqlite3UpsertNew(db,
129261
+ sqlite3ExprListDup(db, p->pUpsertTarget, 0),
129262
+ sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
129263
+ sqlite3ExprListDup(db, p->pUpsertSet, 0),
129264
+ sqlite3ExprDup(db, p->pUpsertWhere, 0)
129265
+ );
129266
+}
129267
+
129268
+/*
129269
+** Create a new Upsert object.
129270
+*/
129271
+SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
129272
+ sqlite3 *db, /* Determines which memory allocator to use */
129273
+ ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
129274
+ Expr *pTargetWhere, /* Optional WHERE clause on the target */
129275
+ ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
129276
+ Expr *pWhere /* WHERE clause for the ON CONFLICT UPDATE */
129277
+){
129278
+ Upsert *pNew;
129279
+ pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
129280
+ if( pNew==0 ){
129281
+ sqlite3ExprListDelete(db, pTarget);
129282
+ sqlite3ExprDelete(db, pTargetWhere);
129283
+ sqlite3ExprListDelete(db, pSet);
129284
+ sqlite3ExprDelete(db, pWhere);
129285
+ return 0;
129286
+ }else{
129287
+ pNew->pUpsertTarget = pTarget;
129288
+ pNew->pUpsertTargetWhere = pTargetWhere;
129289
+ pNew->pUpsertSet = pSet;
129290
+ pNew->pUpsertWhere = pWhere;
129291
+ pNew->pUpsertIdx = 0;
129292
+ }
129293
+ return pNew;
129294
+}
129295
+
129296
+/*
129297
+** Analyze the ON CONFLICT clause described by pUpsert. Resolve all
129298
+** symbols in the conflict-target.
129299
+**
129300
+** Return SQLITE_OK if everything works, or an error code is something
129301
+** is wrong.
129302
+*/
129303
+SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(
129304
+ Parse *pParse, /* The parsing context */
129305
+ SrcList *pTabList, /* Table into which we are inserting */
129306
+ Upsert *pUpsert /* The ON CONFLICT clauses */
129307
+){
129308
+ Table *pTab; /* That table into which we are inserting */
129309
+ int rc; /* Result code */
129310
+ int iCursor; /* Cursor used by pTab */
129311
+ Index *pIdx; /* One of the indexes of pTab */
129312
+ ExprList *pTarget; /* The conflict-target clause */
129313
+ Expr *pTerm; /* One term of the conflict-target clause */
129314
+ NameContext sNC; /* Context for resolving symbolic names */
129315
+ Expr sCol[2]; /* Index column converted into an Expr */
129316
+
129317
+ assert( pTabList->nSrc==1 );
129318
+ assert( pTabList->a[0].pTab!=0 );
129319
+ assert( pUpsert!=0 );
129320
+ assert( pUpsert->pUpsertTarget!=0 );
129321
+
129322
+ /* Resolve all symbolic names in the conflict-target clause, which
129323
+ ** includes both the list of columns and the optional partial-index
129324
+ ** WHERE clause.
129325
+ */
129326
+ memset(&sNC, 0, sizeof(sNC));
129327
+ sNC.pParse = pParse;
129328
+ sNC.pSrcList = pTabList;
129329
+ rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
129330
+ if( rc ) return rc;
129331
+ rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
129332
+ if( rc ) return rc;
129333
+
129334
+ /* Check to see if the conflict target matches the rowid. */
129335
+ pTab = pTabList->a[0].pTab;
129336
+ pTarget = pUpsert->pUpsertTarget;
129337
+ iCursor = pTabList->a[0].iCursor;
129338
+ if( HasRowid(pTab)
129339
+ && pTarget->nExpr==1
129340
+ && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
129341
+ && pTerm->iColumn==XN_ROWID
129342
+ ){
129343
+ /* The conflict-target is the rowid of the primary table */
129344
+ assert( pUpsert->pUpsertIdx==0 );
129345
+ return SQLITE_OK;
129346
+ }
129347
+
129348
+ /* Initialize sCol[0..1] to be an expression parse tree for a
129349
+ ** single column of an index. The sCol[0] node will be the TK_COLLATE
129350
+ ** operator and sCol[1] will be the TK_COLUMN operator. Code below
129351
+ ** will populate the specific collation and column number values
129352
+ ** prior to comparing against the conflict-target expression.
129353
+ */
129354
+ memset(sCol, 0, sizeof(sCol));
129355
+ sCol[0].op = TK_COLLATE;
129356
+ sCol[0].pLeft = &sCol[1];
129357
+ sCol[1].op = TK_COLUMN;
129358
+ sCol[1].iTable = pTabList->a[0].iCursor;
129359
+
129360
+ /* Check for matches against other indexes */
129361
+ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
129362
+ int ii, jj, nn;
129363
+ if( !IsUniqueIndex(pIdx) ) continue;
129364
+ if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
129365
+ if( pIdx->pPartIdxWhere ){
129366
+ if( pUpsert->pUpsertTargetWhere==0 ) continue;
129367
+ if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
129368
+ pIdx->pPartIdxWhere, iCursor)!=0 ){
129369
+ continue;
129370
+ }
129371
+ }
129372
+ nn = pIdx->nKeyCol;
129373
+ for(ii=0; ii<nn; ii++){
129374
+ Expr *pExpr;
129375
+ sCol[0].u.zToken = (char*)pIdx->azColl[ii];
129376
+ if( pIdx->aiColumn[ii]==XN_EXPR ){
129377
+ assert( pIdx->aColExpr!=0 );
129378
+ assert( pIdx->aColExpr->nExpr>ii );
129379
+ pExpr = pIdx->aColExpr->a[ii].pExpr;
129380
+ if( pExpr->op!=TK_COLLATE ){
129381
+ sCol[0].pLeft = pExpr;
129382
+ pExpr = &sCol[0];
129383
+ }
129384
+ }else{
129385
+ sCol[0].pLeft = &sCol[1];
129386
+ sCol[1].iColumn = pIdx->aiColumn[ii];
129387
+ pExpr = &sCol[0];
129388
+ }
129389
+ for(jj=0; jj<nn; jj++){
129390
+ if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
129391
+ break; /* Column ii of the index matches column jj of target */
129392
+ }
129393
+ }
129394
+ if( jj>=nn ){
129395
+ /* The target contains no match for column jj of the index */
129396
+ break;
129397
+ }
129398
+ }
129399
+ if( ii<nn ){
129400
+ /* Column ii of the index did not match any term of the conflict target.
129401
+ ** Continue the search with the next index. */
129402
+ continue;
129403
+ }
129404
+ pUpsert->pUpsertIdx = pIdx;
129405
+ return SQLITE_OK;
129406
+ }
129407
+ sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any "
129408
+ "PRIMARY KEY or UNIQUE constraint");
129409
+ return SQLITE_ERROR;
129410
+}
129411
+
129412
+/*
129413
+** Generate bytecode that does an UPDATE as part of an upsert.
129414
+**
129415
+** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK.
129416
+** In this case parameter iCur is a cursor open on the table b-tree that
129417
+** currently points to the conflicting table row. Otherwise, if pIdx
129418
+** is not NULL, then pIdx is the constraint that failed and iCur is a
129419
+** cursor points to the conflicting row.
129420
+*/
129421
+SQLITE_PRIVATE void sqlite3UpsertDoUpdate(
129422
+ Parse *pParse, /* The parsing and code-generating context */
129423
+ Upsert *pUpsert, /* The ON CONFLICT clause for the upsert */
129424
+ Table *pTab, /* The table being updated */
129425
+ Index *pIdx, /* The UNIQUE constraint that failed */
129426
+ int iCur /* Cursor for pIdx (or pTab if pIdx==NULL) */
129427
+){
129428
+ Vdbe *v = pParse->pVdbe;
129429
+ sqlite3 *db = pParse->db;
129430
+ SrcList *pSrc; /* FROM clause for the UPDATE */
129431
+ int iDataCur = pUpsert->iDataCur;
129432
+
129433
+ assert( v!=0 );
129434
+ VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
129435
+ if( pIdx && iCur!=iDataCur ){
129436
+ if( HasRowid(pTab) ){
129437
+ int regRowid = sqlite3GetTempReg(pParse);
129438
+ sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
129439
+ sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
129440
+ VdbeCoverage(v);
129441
+ sqlite3ReleaseTempReg(pParse, regRowid);
129442
+ }else{
129443
+ Index *pPk = sqlite3PrimaryKeyIndex(pTab);
129444
+ int nPk = pPk->nKeyCol;
129445
+ int iPk = pParse->nMem+1;
129446
+ int i;
129447
+ pParse->nMem += nPk;
129448
+ for(i=0; i<nPk; i++){
129449
+ int k;
129450
+ assert( pPk->aiColumn[i]>=0 );
129451
+ k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
129452
+ sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i);
129453
+ VdbeComment((v, "%s.%s", pIdx->zName,
129454
+ pTab->aCol[pPk->aiColumn[i]].zName));
129455
+ }
129456
+ i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk);
129457
+ VdbeCoverage(v);
129458
+ sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
129459
+ "corrupt database", P4_STATIC);
129460
+ sqlite3VdbeJumpHere(v, i);
129461
+ }
129462
+ }
129463
+ /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So
129464
+ ** we have to make a copy before passing it down into sqlite3Update() */
129465
+ pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
129466
+ sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
129467
+ pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
129468
+ pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */
129469
+ pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */
129470
+ VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
129471
+}
129472
+
129473
+#endif /* SQLITE_OMIT_UPSERT */
129474
+
129475
+/************** End of upsert.c **********************************************/
128622129476
/************** Begin file vacuum.c ******************************************/
128623129477
/*
128624129478
** 2003 April 6
128625129479
**
128626129480
** The author disclaims copyright to this source code. In place of
@@ -132018,10 +132872,13 @@
132018132872
132019132873
/* If this is the right table of a LEFT OUTER JOIN, allocate and
132020132874
** initialize a memory cell that records if this table matches any
132021132875
** row of the left table of the join.
132022132876
*/
132877
+ assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
132878
+ || pLevel->iFrom>0 || (pTabItem[0].fg.jointype & JT_LEFT)==0
132879
+ );
132023132880
if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
132024132881
pLevel->iLeftJoin = ++pParse->nMem;
132025132882
sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
132026132883
VdbeComment((v, "init LEFT JOIN no-match flag"));
132027132884
}
@@ -132551,13 +133408,20 @@
132551133408
}
132552133409
132553133410
/* If pIdx is an index on one or more expressions, then look through
132554133411
** all the expressions in pWInfo and try to transform matching expressions
132555133412
** into reference to index columns.
133413
+ **
133414
+ ** Do not do this for the RHS of a LEFT JOIN. This is because the
133415
+ ** expression may be evaluated after OP_NullRow has been executed on
133416
+ ** the cursor. In this case it is important to do the full evaluation,
133417
+ ** as the result of the expression may not be NULL, even if all table
133418
+ ** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a
132556133419
*/
132557
- whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
132558
-
133420
+ if( pLevel->iLeftJoin==0 ){
133421
+ whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
133422
+ }
132559133423
132560133424
/* Record the instruction used to terminate the loop. */
132561133425
if( pLoop->wsFlags & WHERE_ONEROW ){
132562133426
pLevel->op = OP_Noop;
132563133427
}else if( bRev ){
@@ -132709,11 +133573,10 @@
132709133573
if( pWC->nTerm>1 ){
132710133574
int iTerm;
132711133575
for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
132712133576
Expr *pExpr = pWC->a[iTerm].pExpr;
132713133577
if( &pWC->a[iTerm] == pTerm ) continue;
132714
- if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
132715133578
testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
132716133579
testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
132717133580
if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
132718133581
if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
132719133582
testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
@@ -132734,11 +133597,14 @@
132734133597
WhereTerm *pOrTerm = &pOrWc->a[ii];
132735133598
if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
132736133599
WhereInfo *pSubWInfo; /* Info for single OR-term scan */
132737133600
Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
132738133601
int jmp1 = 0; /* Address of jump operation */
132739
- if( pAndExpr && !ExprHasProperty(pOrExpr, EP_FromJoin) ){
133602
+ assert( (pTabItem[0].fg.jointype & JT_LEFT)==0
133603
+ || ExprHasProperty(pOrExpr, EP_FromJoin)
133604
+ );
133605
+ if( pAndExpr ){
132740133606
pAndExpr->pLeft = pOrExpr;
132741133607
pOrExpr = pAndExpr;
132742133608
}
132743133609
/* Loop through table entries that match term pOrTerm. */
132744133610
WHERETRACE(0xffff, ("Subplan for OR-clause:\n"));
@@ -132917,11 +133783,11 @@
132917133783
pWInfo->untestedTerms = 1;
132918133784
continue;
132919133785
}
132920133786
pE = pTerm->pExpr;
132921133787
assert( pE!=0 );
132922
- if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
133788
+ if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){
132923133789
continue;
132924133790
}
132925133791
132926133792
if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
132927133793
iNext = 2;
@@ -133844,11 +134710,10 @@
133844134710
pTerm = &pWC->a[idxTerm];
133845134711
markTermAsChild(pWC, idxNew, idxTerm);
133846134712
}else{
133847134713
sqlite3ExprListDelete(db, pList);
133848134714
}
133849
- pTerm->eOperator = WO_NOOP; /* case 1 trumps case 3 */
133850134715
}
133851134716
}
133852134717
}
133853134718
#endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */
133854134719
@@ -136981,19 +137846,16 @@
136981137846
136982137847
/* Do not allow the upper bound of a LIKE optimization range constraint
136983137848
** to mix with a lower range bound from some other source */
136984137849
if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
136985137850
136986
- /* Do not allow IS constraints from the WHERE clause to be used by the
137851
+ /* Do not allow constraints from the WHERE clause to be used by the
136987137852
** right table of a LEFT JOIN. Only constraints in the ON clause are
136988137853
** allowed */
136989137854
if( (pSrc->fg.jointype & JT_LEFT)!=0
136990137855
&& !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
136991
- && (eOp & (WO_IS|WO_ISNULL))!=0
136992137856
){
136993
- testcase( eOp & WO_IS );
136994
- testcase( eOp & WO_ISNULL );
136995137857
continue;
136996137858
}
136997137859
136998137860
if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
136999137861
pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
@@ -139983,12 +140845,14 @@
139983140845
** for terminal symbols is called "yy0".
139984140846
** YYSTACKDEPTH is the maximum depth of the parser's stack. If
139985140847
** zero the stack is dynamically sized using realloc()
139986140848
** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument
139987140849
** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument
140850
+** sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter
139988140851
** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser
139989140852
** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
140853
+** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context
139990140854
** YYERRORSYMBOL is the code number of the error symbol. If not
139991140855
** defined, then do no error processing.
139992140856
** YYNSTATE the combined number of states.
139993140857
** YYNRULE the number of rules in the grammar
139994140858
** YYNTOKEN Number of terminal symbols
@@ -140004,48 +140868,55 @@
140004140868
#ifndef INTERFACE
140005140869
# define INTERFACE 1
140006140870
#endif
140007140871
/************* Begin control #defines *****************************************/
140008140872
#define YYCODETYPE unsigned char
140009
-#define YYNOCODE 253
140873
+#define YYNOCODE 255
140010140874
#define YYACTIONTYPE unsigned short int
140011
-#define YYWILDCARD 83
140875
+#define YYWILDCARD 84
140012140876
#define sqlite3ParserTOKENTYPE Token
140013140877
typedef union {
140014140878
int yyinit;
140015140879
sqlite3ParserTOKENTYPE yy0;
140016
- int yy4;
140017
- struct TrigEvent yy90;
140018
- TriggerStep* yy203;
140019
- struct {int value; int mask;} yy215;
140020
- SrcList* yy259;
140021
- Expr* yy314;
140022
- ExprList* yy322;
140023
- const char* yy336;
140024
- IdList* yy384;
140025
- Select* yy387;
140026
- With* yy451;
140880
+ const char* yy36;
140881
+ TriggerStep* yy47;
140882
+ With* yy91;
140883
+ struct {int value; int mask;} yy107;
140884
+ Expr* yy182;
140885
+ Upsert* yy198;
140886
+ ExprList* yy232;
140887
+ struct TrigEvent yy300;
140888
+ Select* yy399;
140889
+ SrcList* yy427;
140890
+ int yy502;
140891
+ IdList* yy510;
140027140892
} YYMINORTYPE;
140028140893
#ifndef YYSTACKDEPTH
140029140894
#define YYSTACKDEPTH 100
140030140895
#endif
140031
-#define sqlite3ParserARG_SDECL Parse *pParse;
140032
-#define sqlite3ParserARG_PDECL ,Parse *pParse
140033
-#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
140034
-#define sqlite3ParserARG_STORE yypParser->pParse = pParse
140896
+#define sqlite3ParserARG_SDECL
140897
+#define sqlite3ParserARG_PDECL
140898
+#define sqlite3ParserARG_PARAM
140899
+#define sqlite3ParserARG_FETCH
140900
+#define sqlite3ParserARG_STORE
140901
+#define sqlite3ParserCTX_SDECL Parse *pParse;
140902
+#define sqlite3ParserCTX_PDECL ,Parse *pParse
140903
+#define sqlite3ParserCTX_PARAM ,pParse
140904
+#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
140905
+#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
140035140906
#define YYFALLBACK 1
140036
-#define YYNSTATE 472
140037
-#define YYNRULE 333
140038
-#define YYNTOKEN 143
140039
-#define YY_MAX_SHIFT 471
140040
-#define YY_MIN_SHIFTREDUCE 681
140041
-#define YY_MAX_SHIFTREDUCE 1013
140042
-#define YY_ERROR_ACTION 1014
140043
-#define YY_ACCEPT_ACTION 1015
140044
-#define YY_NO_ACTION 1016
140045
-#define YY_MIN_REDUCE 1017
140046
-#define YY_MAX_REDUCE 1349
140907
+#define YYNSTATE 490
140908
+#define YYNRULE 341
140909
+#define YYNTOKEN 145
140910
+#define YY_MAX_SHIFT 489
140911
+#define YY_MIN_SHIFTREDUCE 705
140912
+#define YY_MAX_SHIFTREDUCE 1045
140913
+#define YY_ERROR_ACTION 1046
140914
+#define YY_ACCEPT_ACTION 1047
140915
+#define YY_NO_ACTION 1048
140916
+#define YY_MIN_REDUCE 1049
140917
+#define YY_MAX_REDUCE 1389
140047140918
/************* End control #defines *******************************************/
140048140919
140049140920
/* Define the yytestcase() macro to be a no-op if is not already defined
140050140921
** otherwise.
140051140922
**
@@ -140107,485 +140978,507 @@
140107140978
** yy_reduce_ofst[] For each state, the offset into yy_action for
140108140979
** shifting non-terminals after a reduce.
140109140980
** yy_default[] Default action for each state.
140110140981
**
140111140982
*********** Begin parsing tables **********************************************/
140112
-#define YY_ACTTAB_COUNT (1566)
140983
+#define YY_ACTTAB_COUNT (1657)
140113140984
static const YYACTIONTYPE yy_action[] = {
140114
- /* 0 */ 1169, 1015, 167, 167, 1, 168, 466, 1313, 466, 1083,
140115
- /* 10 */ 1062, 466, 97, 94, 183, 1057, 466, 329, 1083, 342,
140116
- /* 20 */ 97, 94, 183, 459, 459, 459, 436, 57, 57, 57,
140117
- /* 30 */ 57, 807, 57, 57, 367, 367, 367, 57, 57, 808,
140118
- /* 40 */ 1270, 1088, 1088, 104, 105, 95, 991, 991, 868, 871,
140119
- /* 50 */ 860, 860, 102, 102, 103, 103, 103, 103, 233, 233,
140120
- /* 60 */ 326, 1011, 449, 437, 449, 446, 351, 449, 461, 1142,
140121
- /* 70 */ 463, 342, 449, 426, 1316, 209, 180, 742, 80, 299,
140122
- /* 80 */ 857, 857, 869, 872, 101, 101, 101, 101, 100, 100,
140123
- /* 90 */ 99, 99, 99, 98, 368, 104, 105, 95, 991, 991,
140124
- /* 100 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140125
- /* 110 */ 99, 99, 99, 98, 368, 355, 97, 94, 183, 228,
140126
- /* 120 */ 106, 1012, 407, 342, 101, 101, 101, 101, 100, 100,
140127
- /* 130 */ 99, 99, 99, 98, 368, 861, 101, 101, 101, 101,
140128
- /* 140 */ 100, 100, 99, 99, 99, 98, 368, 104, 105, 95,
140129
- /* 150 */ 991, 991, 868, 871, 860, 860, 102, 102, 103, 103,
140130
- /* 160 */ 103, 103, 201, 368, 375, 420, 417, 416, 387, 273,
140131
- /* 170 */ 65, 97, 94, 183, 168, 342, 415, 951, 1343, 396,
140132
- /* 180 */ 66, 1343, 320, 959, 371, 970, 334, 340, 101, 101,
140133
- /* 190 */ 101, 101, 100, 100, 99, 99, 99, 98, 368, 104,
140134
- /* 200 */ 105, 95, 991, 991, 868, 871, 860, 860, 102, 102,
140135
- /* 210 */ 103, 103, 103, 103, 373, 100, 100, 99, 99, 99,
140136
- /* 220 */ 98, 368, 970, 971, 972, 201, 1100, 342, 420, 417,
140137
- /* 230 */ 416, 287, 366, 365, 337, 970, 1162, 463, 949, 415,
140138
- /* 240 */ 101, 101, 101, 101, 100, 100, 99, 99, 99, 98,
140139
- /* 250 */ 368, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140140
- /* 260 */ 102, 102, 103, 103, 103, 103, 777, 241, 233, 233,
140141
- /* 270 */ 9, 847, 970, 971, 972, 390, 998, 1141, 998, 342,
140142
- /* 280 */ 463, 252, 829, 719, 98, 368, 840, 298, 338, 142,
140143
- /* 290 */ 839, 339, 101, 101, 101, 101, 100, 100, 99, 99,
140144
- /* 300 */ 99, 98, 368, 104, 105, 95, 991, 991, 868, 871,
140145
- /* 310 */ 860, 860, 102, 102, 103, 103, 103, 103, 272, 466,
140146
- /* 320 */ 392, 839, 839, 841, 97, 94, 183, 390, 1317, 253,
140147
- /* 330 */ 456, 342, 125, 166, 807, 712, 208, 407, 386, 970,
140148
- /* 340 */ 57, 57, 808, 238, 101, 101, 101, 101, 100, 100,
140149
- /* 350 */ 99, 99, 99, 98, 368, 104, 105, 95, 991, 991,
140150
- /* 360 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140151
- /* 370 */ 466, 108, 466, 267, 465, 442, 970, 971, 972, 261,
140152
- /* 380 */ 951, 1344, 909, 342, 1344, 142, 829, 848, 1292, 959,
140153
- /* 390 */ 371, 55, 55, 57, 57, 242, 101, 101, 101, 101,
140154
- /* 400 */ 100, 100, 99, 99, 99, 98, 368, 104, 105, 95,
140155
- /* 410 */ 991, 991, 868, 871, 860, 860, 102, 102, 103, 103,
140156
- /* 420 */ 103, 103, 272, 382, 262, 253, 456, 310, 364, 253,
140157
- /* 430 */ 456, 86, 264, 84, 266, 342, 441, 176, 175, 834,
140158
- /* 440 */ 464, 949, 767, 767, 332, 313, 1094, 396, 101, 101,
140159
- /* 450 */ 101, 101, 100, 100, 99, 99, 99, 98, 368, 104,
140160
- /* 460 */ 105, 95, 991, 991, 868, 871, 860, 860, 102, 102,
140161
- /* 470 */ 103, 103, 103, 103, 227, 227, 233, 233, 233, 233,
140162
- /* 480 */ 387, 273, 234, 234, 326, 950, 463, 342, 463, 298,
140163
- /* 490 */ 463, 914, 914, 404, 463, 1037, 123, 265, 27, 970,
140164
- /* 500 */ 101, 101, 101, 101, 100, 100, 99, 99, 99, 98,
140165
- /* 510 */ 368, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140166
- /* 520 */ 102, 102, 103, 103, 103, 103, 435, 233, 233, 466,
140167
- /* 530 */ 285, 686, 687, 688, 127, 271, 970, 971, 972, 463,
140168
- /* 540 */ 1345, 327, 342, 407, 157, 1012, 988, 13, 13, 181,
140169
- /* 550 */ 41, 41, 101, 101, 101, 101, 100, 100, 99, 99,
140170
- /* 560 */ 99, 98, 368, 715, 794, 378, 104, 105, 95, 991,
140171
- /* 570 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140172
- /* 580 */ 103, 970, 378, 377, 346, 239, 847, 1086, 1086, 280,
140173
- /* 590 */ 1169, 283, 204, 203, 202, 177, 298, 342, 407, 298,
140174
- /* 600 */ 715, 840, 169, 299, 407, 839, 82, 101, 101, 101,
140175
- /* 610 */ 101, 100, 100, 99, 99, 99, 98, 368, 970, 971,
140176
- /* 620 */ 972, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140177
- /* 630 */ 102, 102, 103, 103, 103, 103, 839, 839, 841, 362,
140178
- /* 640 */ 240, 124, 1169, 172, 126, 378, 1269, 1169, 1066, 342,
140179
- /* 650 */ 253, 456, 407, 407, 407, 396, 352, 401, 407, 429,
140180
- /* 660 */ 398, 85, 101, 101, 101, 101, 100, 100, 99, 99,
140181
- /* 670 */ 99, 98, 368, 104, 105, 95, 991, 991, 868, 871,
140182
- /* 680 */ 860, 860, 102, 102, 103, 103, 103, 103, 1169, 466,
140183
- /* 690 */ 230, 233, 233, 792, 1235, 1095, 1091, 1293, 1, 77,
140184
- /* 700 */ 278, 342, 205, 463, 974, 911, 1040, 348, 353, 911,
140185
- /* 710 */ 42, 42, 79, 403, 101, 101, 101, 101, 100, 100,
140186
- /* 720 */ 99, 99, 99, 98, 368, 104, 93, 95, 991, 991,
140187
- /* 730 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140188
- /* 740 */ 402, 9, 974, 243, 772, 458, 348, 232, 180, 771,
140189
- /* 750 */ 946, 312, 342, 328, 363, 349, 143, 831, 389, 1278,
140190
- /* 760 */ 211, 211, 21, 347, 432, 182, 101, 101, 101, 101,
140191
- /* 770 */ 100, 100, 99, 99, 99, 98, 368, 105, 95, 991,
140192
- /* 780 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140193
- /* 790 */ 103, 792, 724, 22, 732, 731, 233, 233, 1239, 256,
140194
- /* 800 */ 391, 274, 342, 211, 79, 360, 257, 413, 463, 397,
140195
- /* 810 */ 207, 288, 260, 450, 79, 1239, 1241, 101, 101, 101,
140196
- /* 820 */ 101, 100, 100, 99, 99, 99, 98, 368, 95, 991,
140197
- /* 830 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140198
- /* 840 */ 103, 91, 457, 296, 3, 233, 233, 5, 438, 212,
140199
- /* 850 */ 331, 394, 739, 740, 295, 898, 894, 463, 460, 207,
140200
- /* 860 */ 801, 1237, 722, 211, 698, 843, 1283, 101, 101, 101,
140201
- /* 870 */ 101, 100, 100, 99, 99, 99, 98, 368, 1239, 380,
140202
- /* 880 */ 357, 369, 233, 233, 989, 219, 236, 297, 423, 292,
140203
- /* 890 */ 422, 206, 454, 898, 463, 970, 91, 457, 290, 3,
140204
- /* 900 */ 722, 142, 268, 843, 847, 466, 1258, 149, 388, 425,
140205
- /* 910 */ 88, 89, 769, 460, 930, 87, 447, 90, 369, 468,
140206
- /* 920 */ 467, 385, 989, 839, 1257, 439, 57, 57, 395, 931,
140207
- /* 930 */ 1065, 158, 970, 971, 972, 772, 369, 471, 1019, 399,
140208
- /* 940 */ 771, 253, 456, 254, 932, 119, 891, 454, 233, 233,
140209
- /* 950 */ 4, 970, 1096, 275, 839, 839, 841, 842, 19, 847,
140210
- /* 960 */ 463, 449, 448, 163, 453, 88, 89, 776, 970, 1127,
140211
- /* 970 */ 279, 930, 90, 369, 468, 467, 91, 457, 839, 3,
140212
- /* 980 */ 235, 1064, 466, 1228, 233, 233, 931, 970, 970, 971,
140213
- /* 990 */ 972, 970, 908, 460, 908, 2, 463, 81, 457, 212,
140214
- /* 1000 */ 3, 932, 282, 10, 10, 970, 971, 972, 189, 839,
140215
- /* 1010 */ 839, 841, 842, 19, 460, 284, 369, 354, 907, 286,
140216
- /* 1020 */ 907, 753, 466, 1079, 970, 971, 972, 454, 970, 971,
140217
- /* 1030 */ 972, 754, 970, 1063, 989, 372, 792, 369, 1118, 847,
140218
- /* 1040 */ 291, 452, 466, 10, 10, 88, 89, 142, 454, 168,
140219
- /* 1050 */ 300, 412, 90, 369, 468, 467, 793, 356, 839, 706,
140220
- /* 1060 */ 847, 341, 121, 10, 10, 301, 88, 89, 379, 970,
140221
- /* 1070 */ 971, 972, 989, 90, 369, 468, 467, 244, 205, 839,
140222
- /* 1080 */ 1306, 245, 1135, 245, 250, 1168, 1114, 253, 456, 839,
140223
- /* 1090 */ 839, 841, 842, 19, 1125, 237, 122, 451, 1174, 733,
140224
- /* 1100 */ 324, 324, 323, 222, 321, 466, 1046, 695, 182, 225,
140225
- /* 1110 */ 839, 839, 841, 842, 19, 103, 103, 103, 103, 96,
140226
- /* 1120 */ 185, 466, 259, 1039, 1028, 170, 10, 10, 1027, 421,
140227
- /* 1130 */ 258, 1029, 1300, 708, 792, 466, 408, 734, 8, 347,
140228
- /* 1140 */ 444, 174, 12, 12, 290, 101, 101, 101, 101, 100,
140229
- /* 1150 */ 100, 99, 99, 99, 98, 368, 32, 32, 466, 187,
140230
- /* 1160 */ 466, 1111, 103, 103, 103, 103, 188, 466, 325, 138,
140231
- /* 1170 */ 186, 708, 303, 305, 307, 358, 970, 270, 393, 43,
140232
- /* 1180 */ 43, 44, 44, 1157, 333, 178, 418, 294, 45, 45,
140233
- /* 1190 */ 1232, 318, 101, 101, 101, 101, 100, 100, 99, 99,
140234
- /* 1200 */ 99, 98, 368, 381, 343, 366, 365, 466, 263, 253,
140235
- /* 1210 */ 456, 466, 1062, 970, 971, 972, 1231, 997, 309, 466,
140236
- /* 1220 */ 455, 466, 427, 466, 995, 173, 996, 1303, 46, 46,
140237
- /* 1230 */ 145, 376, 37, 37, 1006, 1277, 466, 214, 1275, 64,
140238
- /* 1240 */ 47, 47, 33, 33, 34, 34, 1003, 67, 466, 998,
140239
- /* 1250 */ 350, 998, 466, 155, 233, 233, 466, 36, 36, 24,
140240
- /* 1260 */ 140, 77, 1154, 466, 383, 466, 463, 428, 466, 48,
140241
- /* 1270 */ 48, 466, 147, 49, 49, 466, 150, 50, 50, 466,
140242
- /* 1280 */ 151, 152, 466, 384, 11, 11, 51, 51, 466, 110,
140243
- /* 1290 */ 110, 153, 52, 52, 411, 466, 38, 38, 466, 191,
140244
- /* 1300 */ 53, 53, 466, 54, 54, 466, 400, 466, 330, 39,
140245
- /* 1310 */ 39, 466, 1164, 466, 25, 466, 56, 56, 466, 131,
140246
- /* 1320 */ 131, 72, 466, 132, 132, 159, 133, 133, 61, 61,
140247
- /* 1330 */ 1226, 195, 40, 40, 111, 111, 58, 58, 406, 112,
140248
- /* 1340 */ 112, 466, 277, 113, 113, 466, 226, 466, 1246, 466,
140249
- /* 1350 */ 197, 466, 164, 466, 409, 466, 198, 466, 199, 466,
140250
- /* 1360 */ 335, 281, 109, 109, 466, 1030, 130, 130, 129, 129,
140251
- /* 1370 */ 117, 117, 116, 116, 114, 114, 115, 115, 60, 60,
140252
- /* 1380 */ 62, 62, 466, 359, 466, 59, 59, 424, 1082, 1081,
140253
- /* 1390 */ 1080, 724, 1073, 1054, 336, 293, 1053, 1052, 1315, 431,
140254
- /* 1400 */ 361, 76, 248, 31, 31, 35, 35, 1072, 249, 440,
140255
- /* 1410 */ 302, 434, 213, 1122, 6, 311, 1212, 107, 83, 251,
140256
- /* 1420 */ 78, 1123, 445, 220, 443, 1036, 304, 23, 1121, 469,
140257
- /* 1430 */ 965, 221, 223, 1104, 314, 224, 344, 317, 315, 316,
140258
- /* 1440 */ 470, 306, 1025, 1120, 308, 1262, 1020, 134, 120, 246,
140259
- /* 1450 */ 682, 370, 171, 255, 1263, 135, 184, 1261, 1260, 374,
140260
- /* 1460 */ 118, 906, 904, 827, 1050, 146, 136, 137, 148, 1049,
140261
- /* 1470 */ 63, 1047, 756, 190, 269, 920, 154, 156, 68, 69,
140262
- /* 1480 */ 70, 71, 139, 923, 192, 193, 144, 919, 345, 128,
140263
- /* 1490 */ 14, 194, 276, 211, 1000, 405, 196, 161, 912, 160,
140264
- /* 1500 */ 26, 697, 410, 295, 200, 289, 414, 162, 419, 73,
140265
- /* 1510 */ 15, 16, 141, 74, 28, 247, 846, 845, 735, 874,
140266
- /* 1520 */ 954, 75, 430, 955, 29, 433, 179, 229, 231, 800,
140267
- /* 1530 */ 165, 795, 87, 210, 889, 79, 875, 17, 873, 877,
140268
- /* 1540 */ 929, 18, 928, 216, 215, 878, 20, 30, 462, 844,
140269
- /* 1550 */ 707, 92, 766, 770, 7, 322, 217, 218, 319, 1308,
140270
- /* 1560 */ 960, 1016, 1016, 1016, 1016, 1307,
140985
+ /* 0 */ 349, 99, 96, 185, 99, 96, 185, 233, 1047, 1,
140986
+ /* 10 */ 1, 489, 2, 1051, 484, 477, 477, 477, 260, 351,
140987
+ /* 20 */ 121, 1310, 1120, 1120, 1178, 1115, 1094, 1128, 380, 380,
140988
+ /* 30 */ 380, 835, 454, 410, 1115, 59, 59, 1357, 425, 836,
140989
+ /* 40 */ 710, 711, 712, 106, 107, 97, 1023, 1023, 900, 903,
140990
+ /* 50 */ 892, 892, 104, 104, 105, 105, 105, 105, 346, 238,
140991
+ /* 60 */ 238, 99, 96, 185, 238, 238, 889, 889, 901, 904,
140992
+ /* 70 */ 460, 481, 351, 99, 96, 185, 481, 347, 1177, 82,
140993
+ /* 80 */ 388, 214, 182, 23, 194, 103, 103, 103, 103, 102,
140994
+ /* 90 */ 102, 101, 101, 101, 100, 381, 106, 107, 97, 1023,
140995
+ /* 100 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105,
140996
+ /* 110 */ 105, 10, 385, 484, 24, 484, 1333, 489, 2, 1051,
140997
+ /* 120 */ 335, 1043, 108, 893, 260, 351, 121, 99, 96, 185,
140998
+ /* 130 */ 100, 381, 386, 1128, 59, 59, 59, 59, 103, 103,
140999
+ /* 140 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 106,
141000
+ /* 150 */ 107, 97, 1023, 1023, 900, 903, 892, 892, 104, 104,
141001
+ /* 160 */ 105, 105, 105, 105, 360, 238, 238, 170, 170, 467,
141002
+ /* 170 */ 455, 467, 464, 67, 381, 329, 169, 481, 351, 343,
141003
+ /* 180 */ 338, 400, 1044, 68, 101, 101, 101, 100, 381, 393,
141004
+ /* 190 */ 194, 103, 103, 103, 103, 102, 102, 101, 101, 101,
141005
+ /* 200 */ 100, 381, 106, 107, 97, 1023, 1023, 900, 903, 892,
141006
+ /* 210 */ 892, 104, 104, 105, 105, 105, 105, 483, 385, 103,
141007
+ /* 220 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141008
+ /* 230 */ 268, 351, 946, 946, 422, 296, 102, 102, 101, 101,
141009
+ /* 240 */ 101, 100, 381, 861, 103, 103, 103, 103, 102, 102,
141010
+ /* 250 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023,
141011
+ /* 260 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105,
141012
+ /* 270 */ 484, 983, 1383, 206, 1353, 1383, 438, 435, 434, 281,
141013
+ /* 280 */ 396, 269, 1089, 941, 351, 1002, 433, 861, 743, 401,
141014
+ /* 290 */ 282, 57, 57, 482, 145, 791, 791, 103, 103, 103,
141015
+ /* 300 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 107,
141016
+ /* 310 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105,
141017
+ /* 320 */ 105, 105, 105, 281, 1002, 1003, 1004, 206, 879, 319,
141018
+ /* 330 */ 438, 435, 434, 981, 259, 474, 360, 351, 1118, 1118,
141019
+ /* 340 */ 433, 736, 379, 378, 872, 1002, 1356, 322, 871, 766,
141020
+ /* 350 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100,
141021
+ /* 360 */ 381, 106, 107, 97, 1023, 1023, 900, 903, 892, 892,
141022
+ /* 370 */ 104, 104, 105, 105, 105, 105, 484, 801, 484, 871,
141023
+ /* 380 */ 871, 873, 401, 282, 1002, 1003, 1004, 1030, 360, 1030,
141024
+ /* 390 */ 351, 983, 1384, 213, 880, 1384, 145, 59, 59, 59,
141025
+ /* 400 */ 59, 1002, 244, 103, 103, 103, 103, 102, 102, 101,
141026
+ /* 410 */ 101, 101, 100, 381, 106, 107, 97, 1023, 1023, 900,
141027
+ /* 420 */ 903, 892, 892, 104, 104, 105, 105, 105, 105, 274,
141028
+ /* 430 */ 484, 110, 467, 479, 467, 444, 259, 474, 232, 232,
141029
+ /* 440 */ 1002, 1003, 1004, 351, 210, 335, 982, 866, 1385, 336,
141030
+ /* 450 */ 481, 59, 59, 981, 245, 307, 103, 103, 103, 103,
141031
+ /* 460 */ 102, 102, 101, 101, 101, 100, 381, 106, 107, 97,
141032
+ /* 470 */ 1023, 1023, 900, 903, 892, 892, 104, 104, 105, 105,
141033
+ /* 480 */ 105, 105, 453, 459, 484, 408, 377, 259, 474, 271,
141034
+ /* 490 */ 183, 273, 209, 208, 207, 356, 351, 307, 178, 177,
141035
+ /* 500 */ 127, 1006, 1098, 14, 14, 43, 43, 1044, 425, 103,
141036
+ /* 510 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141037
+ /* 520 */ 106, 107, 97, 1023, 1023, 900, 903, 892, 892, 104,
141038
+ /* 530 */ 104, 105, 105, 105, 105, 294, 1132, 408, 160, 484,
141039
+ /* 540 */ 408, 1006, 129, 962, 1209, 239, 239, 481, 307, 425,
141040
+ /* 550 */ 1309, 1097, 351, 235, 243, 272, 820, 481, 963, 425,
141041
+ /* 560 */ 11, 11, 103, 103, 103, 103, 102, 102, 101, 101,
141042
+ /* 570 */ 101, 100, 381, 964, 362, 1002, 106, 107, 97, 1023,
141043
+ /* 580 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105,
141044
+ /* 590 */ 105, 1275, 161, 126, 777, 289, 1209, 292, 1072, 357,
141045
+ /* 600 */ 1209, 1127, 476, 357, 778, 425, 247, 425, 351, 248,
141046
+ /* 610 */ 414, 364, 414, 171, 1002, 1003, 1004, 84, 103, 103,
141047
+ /* 620 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 1002,
141048
+ /* 630 */ 184, 484, 106, 107, 97, 1023, 1023, 900, 903, 892,
141049
+ /* 640 */ 892, 104, 104, 105, 105, 105, 105, 1123, 1209, 287,
141050
+ /* 650 */ 484, 1209, 11, 11, 179, 820, 259, 474, 307, 237,
141051
+ /* 660 */ 182, 351, 321, 365, 414, 308, 367, 366, 1002, 1003,
141052
+ /* 670 */ 1004, 44, 44, 87, 103, 103, 103, 103, 102, 102,
141053
+ /* 680 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023,
141054
+ /* 690 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105,
141055
+ /* 700 */ 246, 368, 280, 128, 10, 358, 146, 796, 835, 258,
141056
+ /* 710 */ 1020, 88, 795, 86, 351, 421, 836, 943, 376, 348,
141057
+ /* 720 */ 191, 943, 1318, 267, 308, 279, 456, 103, 103, 103,
141058
+ /* 730 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 95,
141059
+ /* 740 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105,
141060
+ /* 750 */ 105, 105, 105, 420, 249, 238, 238, 238, 238, 79,
141061
+ /* 760 */ 375, 125, 305, 29, 262, 978, 351, 481, 337, 481,
141062
+ /* 770 */ 756, 755, 304, 278, 415, 15, 81, 940, 1126, 940,
141063
+ /* 780 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100,
141064
+ /* 790 */ 381, 107, 97, 1023, 1023, 900, 903, 892, 892, 104,
141065
+ /* 800 */ 104, 105, 105, 105, 105, 457, 263, 484, 174, 484,
141066
+ /* 810 */ 238, 238, 863, 407, 402, 216, 216, 351, 409, 193,
141067
+ /* 820 */ 283, 216, 481, 81, 763, 764, 266, 5, 13, 13,
141068
+ /* 830 */ 34, 34, 103, 103, 103, 103, 102, 102, 101, 101,
141069
+ /* 840 */ 101, 100, 381, 97, 1023, 1023, 900, 903, 892, 892,
141070
+ /* 850 */ 104, 104, 105, 105, 105, 105, 93, 475, 1002, 4,
141071
+ /* 860 */ 403, 1002, 340, 431, 1002, 297, 212, 1277, 81, 746,
141072
+ /* 870 */ 1163, 152, 926, 478, 166, 212, 757, 829, 930, 939,
141073
+ /* 880 */ 216, 939, 858, 103, 103, 103, 103, 102, 102, 101,
141074
+ /* 890 */ 101, 101, 100, 381, 238, 238, 382, 1002, 1003, 1004,
141075
+ /* 900 */ 1002, 1003, 1004, 1002, 1003, 1004, 481, 439, 472, 746,
141076
+ /* 910 */ 105, 105, 105, 105, 98, 758, 1162, 145, 930, 412,
141077
+ /* 920 */ 879, 406, 793, 81, 395, 89, 90, 91, 105, 105,
141078
+ /* 930 */ 105, 105, 1323, 92, 484, 382, 486, 485, 240, 275,
141079
+ /* 940 */ 871, 103, 103, 103, 103, 102, 102, 101, 101, 101,
141080
+ /* 950 */ 100, 381, 1096, 371, 355, 45, 45, 259, 474, 103,
141081
+ /* 960 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141082
+ /* 970 */ 1150, 871, 871, 873, 874, 21, 1332, 991, 384, 730,
141083
+ /* 980 */ 722, 242, 123, 1298, 124, 875, 333, 333, 332, 227,
141084
+ /* 990 */ 330, 991, 384, 719, 256, 242, 484, 391, 413, 1297,
141085
+ /* 1000 */ 333, 333, 332, 227, 330, 748, 187, 719, 265, 470,
141086
+ /* 1010 */ 1279, 1002, 484, 417, 391, 390, 264, 11, 11, 284,
141087
+ /* 1020 */ 187, 732, 265, 93, 475, 875, 4, 1279, 1281, 419,
141088
+ /* 1030 */ 264, 369, 416, 11, 11, 1159, 288, 484, 399, 1346,
141089
+ /* 1040 */ 478, 379, 378, 291, 484, 293, 189, 250, 295, 1027,
141090
+ /* 1050 */ 1002, 1003, 1004, 190, 1029, 1111, 140, 188, 11, 11,
141091
+ /* 1060 */ 189, 732, 1028, 382, 923, 46, 46, 190, 1095, 230,
141092
+ /* 1070 */ 140, 188, 462, 93, 475, 472, 4, 300, 309, 391,
141093
+ /* 1080 */ 373, 6, 1069, 217, 739, 310, 1030, 879, 1030, 1171,
141094
+ /* 1090 */ 478, 352, 1279, 90, 91, 800, 259, 474, 1208, 484,
141095
+ /* 1100 */ 92, 1268, 382, 486, 485, 352, 1002, 871, 879, 426,
141096
+ /* 1110 */ 259, 474, 172, 382, 238, 238, 1146, 170, 1021, 389,
141097
+ /* 1120 */ 47, 47, 1157, 739, 872, 472, 481, 469, 871, 350,
141098
+ /* 1130 */ 1214, 83, 475, 389, 4, 1078, 1071, 879, 871, 871,
141099
+ /* 1140 */ 873, 874, 21, 90, 91, 1002, 1003, 1004, 478, 251,
141100
+ /* 1150 */ 92, 251, 382, 486, 485, 443, 370, 871, 1021, 871,
141101
+ /* 1160 */ 871, 873, 224, 241, 306, 441, 301, 440, 211, 1060,
141102
+ /* 1170 */ 820, 382, 822, 447, 299, 1059, 484, 1061, 1143, 962,
141103
+ /* 1180 */ 430, 796, 484, 472, 1340, 312, 795, 465, 871, 871,
141104
+ /* 1190 */ 873, 874, 21, 314, 963, 879, 316, 59, 59, 1002,
141105
+ /* 1200 */ 9, 90, 91, 48, 48, 238, 238, 210, 92, 964,
141106
+ /* 1210 */ 382, 486, 485, 176, 334, 871, 242, 481, 1193, 238,
141107
+ /* 1220 */ 238, 333, 333, 332, 227, 330, 394, 270, 719, 277,
141108
+ /* 1230 */ 471, 481, 467, 466, 484, 145, 217, 1201, 1002, 1003,
141109
+ /* 1240 */ 1004, 187, 3, 265, 184, 445, 871, 871, 873, 874,
141110
+ /* 1250 */ 21, 264, 1337, 450, 1051, 39, 39, 392, 356, 260,
141111
+ /* 1260 */ 342, 121, 468, 411, 436, 821, 180, 1094, 1128, 820,
141112
+ /* 1270 */ 303, 1021, 1272, 1271, 299, 259, 474, 238, 238, 1002,
141113
+ /* 1280 */ 473, 189, 484, 318, 327, 238, 238, 484, 190, 481,
141114
+ /* 1290 */ 446, 140, 188, 1343, 238, 238, 1038, 481, 148, 175,
141115
+ /* 1300 */ 238, 238, 484, 49, 49, 219, 481, 484, 35, 35,
141116
+ /* 1310 */ 1317, 1021, 481, 484, 1035, 484, 1315, 484, 1002, 1003,
141117
+ /* 1320 */ 1004, 484, 66, 36, 36, 194, 352, 484, 38, 38,
141118
+ /* 1330 */ 484, 259, 474, 69, 50, 50, 51, 51, 52, 52,
141119
+ /* 1340 */ 359, 484, 12, 12, 484, 1198, 484, 158, 53, 53,
141120
+ /* 1350 */ 405, 112, 112, 385, 389, 484, 26, 484, 143, 484,
141121
+ /* 1360 */ 150, 484, 54, 54, 397, 40, 40, 55, 55, 484,
141122
+ /* 1370 */ 79, 484, 153, 1190, 484, 154, 56, 56, 41, 41,
141123
+ /* 1380 */ 58, 58, 133, 133, 484, 398, 484, 429, 484, 155,
141124
+ /* 1390 */ 134, 134, 135, 135, 484, 63, 63, 484, 341, 484,
141125
+ /* 1400 */ 339, 484, 196, 484, 156, 42, 42, 113, 113, 60,
141126
+ /* 1410 */ 60, 484, 404, 484, 27, 114, 114, 1204, 115, 115,
141127
+ /* 1420 */ 111, 111, 132, 132, 131, 131, 1266, 418, 484, 162,
141128
+ /* 1430 */ 484, 200, 119, 119, 118, 118, 484, 74, 424, 484,
141129
+ /* 1440 */ 1286, 484, 231, 484, 202, 484, 167, 286, 427, 116,
141130
+ /* 1450 */ 116, 117, 117, 290, 203, 442, 1062, 62, 62, 204,
141131
+ /* 1460 */ 64, 64, 61, 61, 33, 33, 37, 37, 344, 372,
141132
+ /* 1470 */ 1114, 1105, 748, 1113, 374, 1112, 254, 458, 1086, 255,
141133
+ /* 1480 */ 345, 1085, 302, 1084, 1355, 78, 1154, 311, 1104, 449,
141134
+ /* 1490 */ 452, 1155, 1153, 218, 7, 313, 315, 320, 1152, 85,
141135
+ /* 1500 */ 1252, 317, 109, 80, 463, 225, 461, 1068, 25, 487,
141136
+ /* 1510 */ 997, 323, 257, 226, 229, 228, 1136, 324, 325, 326,
141137
+ /* 1520 */ 488, 136, 1057, 1052, 1302, 1303, 1301, 706, 1300, 137,
141138
+ /* 1530 */ 122, 138, 383, 173, 1082, 261, 186, 252, 1081, 65,
141139
+ /* 1540 */ 387, 120, 938, 936, 855, 353, 149, 1079, 139, 151,
141140
+ /* 1550 */ 192, 780, 195, 276, 952, 157, 141, 361, 70, 363,
141141
+ /* 1560 */ 859, 159, 71, 72, 142, 73, 955, 354, 147, 197,
141142
+ /* 1570 */ 198, 951, 130, 16, 199, 285, 216, 1032, 201, 423,
141143
+ /* 1580 */ 164, 944, 163, 28, 721, 428, 304, 165, 205, 759,
141144
+ /* 1590 */ 75, 432, 298, 17, 18, 437, 76, 253, 878, 144,
141145
+ /* 1600 */ 877, 906, 77, 986, 30, 448, 987, 31, 451, 181,
141146
+ /* 1610 */ 234, 236, 168, 828, 823, 89, 910, 921, 81, 907,
141147
+ /* 1620 */ 215, 905, 909, 961, 960, 19, 221, 20, 220, 22,
141148
+ /* 1630 */ 32, 331, 876, 731, 94, 790, 794, 8, 992, 222,
141149
+ /* 1640 */ 480, 328, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048,
141150
+ /* 1650 */ 223, 1048, 1048, 1048, 1048, 1348, 1347,
140271141151
};
140272141152
static const YYCODETYPE yy_lookahead[] = {
140273
- /* 0 */ 152, 144, 145, 146, 147, 152, 152, 172, 152, 180,
140274
- /* 10 */ 181, 152, 223, 224, 225, 180, 152, 164, 189, 19,
140275
- /* 20 */ 223, 224, 225, 168, 169, 170, 163, 173, 174, 173,
140276
- /* 30 */ 174, 31, 173, 174, 168, 169, 170, 173, 174, 39,
140277
- /* 40 */ 243, 191, 192, 43, 44, 45, 46, 47, 48, 49,
140278
- /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 195, 196,
140279
- /* 60 */ 22, 23, 208, 209, 208, 209, 218, 208, 209, 176,
140280
- /* 70 */ 207, 19, 208, 209, 23, 212, 213, 26, 26, 152,
140281
- /* 80 */ 46, 47, 48, 49, 84, 85, 86, 87, 88, 89,
140282
- /* 90 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140283
- /* 100 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140284
- /* 110 */ 90, 91, 92, 93, 94, 188, 223, 224, 225, 171,
140285
- /* 120 */ 68, 83, 152, 19, 84, 85, 86, 87, 88, 89,
140286
- /* 130 */ 90, 91, 92, 93, 94, 101, 84, 85, 86, 87,
140287
- /* 140 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
140288
- /* 150 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
140289
- /* 160 */ 56, 57, 99, 94, 194, 102, 103, 104, 109, 110,
140290
- /* 170 */ 66, 223, 224, 225, 152, 19, 113, 22, 23, 152,
140291
- /* 180 */ 24, 26, 160, 1, 2, 59, 164, 173, 84, 85,
140292
- /* 190 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
140293
- /* 200 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
140294
- /* 210 */ 54, 55, 56, 57, 244, 88, 89, 90, 91, 92,
140295
- /* 220 */ 93, 94, 96, 97, 98, 99, 196, 19, 102, 103,
140296
- /* 230 */ 104, 23, 88, 89, 173, 59, 163, 207, 83, 113,
140297
- /* 240 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
140298
- /* 250 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140299
- /* 260 */ 52, 53, 54, 55, 56, 57, 90, 240, 195, 196,
140300
- /* 270 */ 171, 82, 96, 97, 98, 152, 132, 176, 134, 19,
140301
- /* 280 */ 207, 200, 72, 23, 93, 94, 97, 152, 173, 79,
140302
- /* 290 */ 101, 210, 84, 85, 86, 87, 88, 89, 90, 91,
140303
- /* 300 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
140304
- /* 310 */ 50, 51, 52, 53, 54, 55, 56, 57, 108, 152,
140305
- /* 320 */ 152, 132, 133, 134, 223, 224, 225, 152, 186, 119,
140306
- /* 330 */ 120, 19, 197, 234, 31, 23, 26, 152, 239, 59,
140307
- /* 340 */ 173, 174, 39, 220, 84, 85, 86, 87, 88, 89,
140308
- /* 350 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140309
- /* 360 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140310
- /* 370 */ 152, 22, 152, 16, 152, 208, 96, 97, 98, 194,
140311
- /* 380 */ 22, 23, 11, 19, 26, 79, 72, 23, 0, 1,
140312
- /* 390 */ 2, 173, 174, 173, 174, 220, 84, 85, 86, 87,
140313
- /* 400 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
140314
- /* 410 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
140315
- /* 420 */ 56, 57, 108, 109, 110, 119, 120, 152, 208, 119,
140316
- /* 430 */ 120, 137, 75, 139, 77, 19, 152, 88, 89, 23,
140317
- /* 440 */ 115, 83, 117, 118, 163, 227, 163, 152, 84, 85,
140318
- /* 450 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
140319
- /* 460 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
140320
- /* 470 */ 54, 55, 56, 57, 195, 196, 195, 196, 195, 196,
140321
- /* 480 */ 109, 110, 195, 196, 22, 23, 207, 19, 207, 152,
140322
- /* 490 */ 207, 108, 109, 110, 207, 163, 22, 140, 24, 59,
140323
- /* 500 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
140324
- /* 510 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140325
- /* 520 */ 52, 53, 54, 55, 56, 57, 152, 195, 196, 152,
140326
- /* 530 */ 16, 7, 8, 9, 197, 240, 96, 97, 98, 207,
140327
- /* 540 */ 249, 250, 19, 152, 22, 83, 26, 173, 174, 152,
140328
- /* 550 */ 173, 174, 84, 85, 86, 87, 88, 89, 90, 91,
140329
- /* 560 */ 92, 93, 94, 59, 124, 152, 43, 44, 45, 46,
140330
- /* 570 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140331
- /* 580 */ 57, 59, 169, 170, 157, 194, 82, 191, 192, 75,
140332
- /* 590 */ 152, 77, 108, 109, 110, 26, 152, 19, 152, 152,
140333
- /* 600 */ 96, 97, 24, 152, 152, 101, 138, 84, 85, 86,
140334
- /* 610 */ 87, 88, 89, 90, 91, 92, 93, 94, 96, 97,
140335
- /* 620 */ 98, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140336
- /* 630 */ 52, 53, 54, 55, 56, 57, 132, 133, 134, 188,
140337
- /* 640 */ 194, 197, 152, 123, 197, 232, 194, 152, 182, 19,
140338
- /* 650 */ 119, 120, 152, 152, 152, 152, 218, 230, 152, 163,
140339
- /* 660 */ 233, 138, 84, 85, 86, 87, 88, 89, 90, 91,
140340
- /* 670 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
140341
- /* 680 */ 50, 51, 52, 53, 54, 55, 56, 57, 152, 152,
140342
- /* 690 */ 23, 195, 196, 26, 194, 194, 194, 146, 147, 130,
140343
- /* 700 */ 194, 19, 46, 207, 59, 29, 166, 167, 218, 33,
140344
- /* 710 */ 173, 174, 26, 218, 84, 85, 86, 87, 88, 89,
140345
- /* 720 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140346
- /* 730 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140347
- /* 740 */ 64, 171, 97, 240, 116, 166, 167, 212, 213, 121,
140348
- /* 750 */ 23, 152, 19, 26, 218, 247, 248, 23, 23, 152,
140349
- /* 760 */ 26, 26, 22, 107, 163, 98, 84, 85, 86, 87,
140350
- /* 770 */ 88, 89, 90, 91, 92, 93, 94, 44, 45, 46,
140351
- /* 780 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140352
- /* 790 */ 57, 124, 106, 53, 100, 101, 195, 196, 152, 152,
140353
- /* 800 */ 23, 23, 19, 26, 26, 19, 152, 23, 207, 239,
140354
- /* 810 */ 26, 23, 152, 163, 26, 169, 170, 84, 85, 86,
140355
- /* 820 */ 87, 88, 89, 90, 91, 92, 93, 94, 45, 46,
140356
- /* 830 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140357
- /* 840 */ 57, 19, 20, 101, 22, 195, 196, 22, 19, 24,
140358
- /* 850 */ 163, 19, 7, 8, 112, 59, 23, 207, 36, 26,
140359
- /* 860 */ 23, 152, 59, 26, 21, 59, 152, 84, 85, 86,
140360
- /* 870 */ 87, 88, 89, 90, 91, 92, 93, 94, 232, 221,
140361
- /* 880 */ 94, 59, 195, 196, 59, 99, 100, 101, 102, 103,
140362
- /* 890 */ 104, 105, 70, 97, 207, 59, 19, 20, 112, 22,
140363
- /* 900 */ 97, 79, 152, 97, 82, 152, 152, 71, 221, 90,
140364
- /* 910 */ 88, 89, 23, 36, 12, 26, 163, 95, 96, 97,
140365
- /* 920 */ 98, 78, 97, 101, 152, 96, 173, 174, 96, 27,
140366
- /* 930 */ 182, 22, 96, 97, 98, 116, 59, 148, 149, 152,
140367
- /* 940 */ 121, 119, 120, 154, 42, 156, 103, 70, 195, 196,
140368
- /* 950 */ 22, 59, 163, 152, 132, 133, 134, 135, 136, 82,
140369
- /* 960 */ 207, 208, 209, 71, 62, 88, 89, 90, 59, 152,
140370
- /* 970 */ 152, 12, 95, 96, 97, 98, 19, 20, 101, 22,
140371
- /* 980 */ 22, 182, 152, 140, 195, 196, 27, 59, 96, 97,
140372
- /* 990 */ 98, 59, 132, 36, 134, 22, 207, 19, 20, 24,
140373
- /* 1000 */ 22, 42, 152, 173, 174, 96, 97, 98, 219, 132,
140374
- /* 1010 */ 133, 134, 135, 136, 36, 152, 59, 187, 132, 152,
140375
- /* 1020 */ 134, 62, 152, 152, 96, 97, 98, 70, 96, 97,
140376
- /* 1030 */ 98, 72, 59, 152, 59, 246, 26, 59, 214, 82,
140377
- /* 1040 */ 152, 192, 152, 173, 174, 88, 89, 79, 70, 152,
140378
- /* 1050 */ 152, 19, 95, 96, 97, 98, 124, 187, 101, 23,
140379
- /* 1060 */ 82, 164, 26, 173, 174, 152, 88, 89, 100, 96,
140380
- /* 1070 */ 97, 98, 97, 95, 96, 97, 98, 187, 46, 101,
140381
- /* 1080 */ 122, 184, 152, 186, 211, 152, 152, 119, 120, 132,
140382
- /* 1090 */ 133, 134, 135, 136, 152, 5, 22, 152, 152, 35,
140383
- /* 1100 */ 10, 11, 12, 13, 14, 152, 152, 17, 98, 235,
140384
- /* 1110 */ 132, 133, 134, 135, 136, 54, 55, 56, 57, 58,
140385
- /* 1120 */ 30, 152, 32, 152, 152, 198, 173, 174, 152, 65,
140386
- /* 1130 */ 40, 152, 152, 59, 124, 152, 236, 73, 199, 107,
140387
- /* 1140 */ 187, 171, 173, 174, 112, 84, 85, 86, 87, 88,
140388
- /* 1150 */ 89, 90, 91, 92, 93, 94, 173, 174, 152, 69,
140389
- /* 1160 */ 152, 211, 54, 55, 56, 57, 76, 152, 150, 79,
140390
- /* 1170 */ 80, 97, 211, 211, 211, 111, 59, 241, 241, 173,
140391
- /* 1180 */ 174, 173, 174, 202, 202, 185, 177, 176, 173, 174,
140392
- /* 1190 */ 176, 201, 84, 85, 86, 87, 88, 89, 90, 91,
140393
- /* 1200 */ 92, 93, 94, 215, 114, 88, 89, 152, 215, 119,
140394
- /* 1210 */ 120, 152, 181, 96, 97, 98, 176, 100, 215, 152,
140395
- /* 1220 */ 229, 152, 163, 152, 107, 199, 109, 155, 173, 174,
140396
- /* 1230 */ 245, 141, 173, 174, 60, 159, 152, 122, 159, 242,
140397
- /* 1240 */ 173, 174, 173, 174, 173, 174, 38, 242, 152, 132,
140398
- /* 1250 */ 159, 134, 152, 22, 195, 196, 152, 173, 174, 222,
140399
- /* 1260 */ 43, 130, 202, 152, 18, 152, 207, 208, 152, 173,
140400
- /* 1270 */ 174, 152, 190, 173, 174, 152, 193, 173, 174, 152,
140401
- /* 1280 */ 193, 193, 152, 159, 173, 174, 173, 174, 152, 173,
140402
- /* 1290 */ 174, 193, 173, 174, 18, 152, 173, 174, 152, 158,
140403
- /* 1300 */ 173, 174, 152, 173, 174, 152, 159, 152, 202, 173,
140404
- /* 1310 */ 174, 152, 190, 152, 222, 152, 173, 174, 152, 173,
140405
- /* 1320 */ 174, 137, 152, 173, 174, 190, 173, 174, 173, 174,
140406
- /* 1330 */ 202, 158, 173, 174, 173, 174, 173, 174, 61, 173,
140407
- /* 1340 */ 174, 152, 237, 173, 174, 152, 159, 152, 238, 152,
140408
- /* 1350 */ 158, 152, 22, 152, 178, 152, 158, 152, 158, 152,
140409
- /* 1360 */ 178, 159, 173, 174, 152, 159, 173, 174, 173, 174,
140410
- /* 1370 */ 173, 174, 173, 174, 173, 174, 173, 174, 173, 174,
140411
- /* 1380 */ 173, 174, 152, 63, 152, 173, 174, 107, 175, 175,
140412
- /* 1390 */ 175, 106, 183, 175, 178, 175, 177, 175, 175, 178,
140413
- /* 1400 */ 94, 107, 231, 173, 174, 173, 174, 183, 231, 125,
140414
- /* 1410 */ 216, 178, 159, 217, 22, 159, 226, 129, 137, 228,
140415
- /* 1420 */ 128, 217, 126, 25, 127, 162, 216, 26, 217, 161,
140416
- /* 1430 */ 13, 153, 153, 206, 205, 6, 251, 202, 204, 203,
140417
- /* 1440 */ 151, 216, 151, 217, 216, 171, 151, 165, 179, 179,
140418
- /* 1450 */ 4, 3, 22, 142, 171, 165, 15, 171, 171, 81,
140419
- /* 1460 */ 16, 23, 23, 120, 171, 131, 165, 111, 123, 171,
140420
- /* 1470 */ 171, 171, 20, 125, 16, 1, 123, 131, 53, 53,
140421
- /* 1480 */ 53, 53, 111, 96, 34, 122, 248, 1, 251, 5,
140422
- /* 1490 */ 22, 107, 140, 26, 74, 41, 122, 107, 67, 67,
140423
- /* 1500 */ 24, 20, 19, 112, 105, 23, 66, 22, 66, 22,
140424
- /* 1510 */ 22, 22, 37, 22, 22, 66, 23, 23, 28, 23,
140425
- /* 1520 */ 23, 26, 24, 23, 22, 24, 122, 23, 23, 96,
140426
- /* 1530 */ 22, 124, 26, 34, 23, 26, 23, 34, 23, 23,
140427
- /* 1540 */ 23, 34, 23, 22, 26, 11, 22, 22, 26, 23,
140428
- /* 1550 */ 23, 22, 116, 23, 22, 15, 122, 122, 23, 122,
140429
- /* 1560 */ 1, 252, 252, 252, 252, 122, 252, 252, 252, 252,
140430
- /* 1570 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140431
- /* 1580 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140432
- /* 1590 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140433
- /* 1600 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140434
- /* 1610 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140435
- /* 1620 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140436
- /* 1630 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140437
- /* 1640 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140438
- /* 1650 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140439
- /* 1660 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140440
- /* 1670 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140441
- /* 1680 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140442
- /* 1690 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140443
- /* 1700 */ 252, 252, 252, 252, 252, 252, 252, 252, 252,
140444
-};
140445
-#define YY_SHIFT_COUNT (471)
141153
+ /* 0 */ 174, 226, 227, 228, 226, 227, 228, 172, 145, 146,
141154
+ /* 10 */ 147, 148, 149, 150, 153, 169, 170, 171, 155, 19,
141155
+ /* 20 */ 157, 246, 192, 193, 177, 181, 182, 164, 169, 170,
141156
+ /* 30 */ 171, 31, 164, 153, 190, 174, 175, 187, 153, 39,
141157
+ /* 40 */ 7, 8, 9, 43, 44, 45, 46, 47, 48, 49,
141158
+ /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 196,
141159
+ /* 60 */ 197, 226, 227, 228, 196, 197, 46, 47, 48, 49,
141160
+ /* 70 */ 209, 208, 19, 226, 227, 228, 208, 174, 177, 26,
141161
+ /* 80 */ 195, 213, 214, 22, 221, 85, 86, 87, 88, 89,
141162
+ /* 90 */ 90, 91, 92, 93, 94, 95, 43, 44, 45, 46,
141163
+ /* 100 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
141164
+ /* 110 */ 57, 172, 249, 153, 53, 153, 147, 148, 149, 150,
141165
+ /* 120 */ 22, 23, 69, 103, 155, 19, 157, 226, 227, 228,
141166
+ /* 130 */ 94, 95, 247, 164, 174, 175, 174, 175, 85, 86,
141167
+ /* 140 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 43,
141168
+ /* 150 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
141169
+ /* 160 */ 54, 55, 56, 57, 153, 196, 197, 153, 153, 209,
141170
+ /* 170 */ 210, 209, 210, 67, 95, 161, 237, 208, 19, 165,
141171
+ /* 180 */ 165, 242, 84, 24, 91, 92, 93, 94, 95, 223,
141172
+ /* 190 */ 221, 85, 86, 87, 88, 89, 90, 91, 92, 93,
141173
+ /* 200 */ 94, 95, 43, 44, 45, 46, 47, 48, 49, 50,
141174
+ /* 210 */ 51, 52, 53, 54, 55, 56, 57, 153, 249, 85,
141175
+ /* 220 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141176
+ /* 230 */ 219, 19, 109, 110, 111, 23, 89, 90, 91, 92,
141177
+ /* 240 */ 93, 94, 95, 73, 85, 86, 87, 88, 89, 90,
141178
+ /* 250 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47,
141179
+ /* 260 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
141180
+ /* 270 */ 153, 22, 23, 101, 173, 26, 104, 105, 106, 109,
141181
+ /* 280 */ 110, 111, 181, 11, 19, 59, 114, 73, 23, 110,
141182
+ /* 290 */ 111, 174, 175, 116, 80, 118, 119, 85, 86, 87,
141183
+ /* 300 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44,
141184
+ /* 310 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
141185
+ /* 320 */ 55, 56, 57, 109, 98, 99, 100, 101, 83, 153,
141186
+ /* 330 */ 104, 105, 106, 84, 120, 121, 153, 19, 192, 193,
141187
+ /* 340 */ 114, 23, 89, 90, 99, 59, 23, 230, 103, 26,
141188
+ /* 350 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
141189
+ /* 360 */ 95, 43, 44, 45, 46, 47, 48, 49, 50, 51,
141190
+ /* 370 */ 52, 53, 54, 55, 56, 57, 153, 91, 153, 134,
141191
+ /* 380 */ 135, 136, 110, 111, 98, 99, 100, 134, 153, 136,
141192
+ /* 390 */ 19, 22, 23, 26, 23, 26, 80, 174, 175, 174,
141193
+ /* 400 */ 175, 59, 219, 85, 86, 87, 88, 89, 90, 91,
141194
+ /* 410 */ 92, 93, 94, 95, 43, 44, 45, 46, 47, 48,
141195
+ /* 420 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 16,
141196
+ /* 430 */ 153, 22, 209, 210, 209, 210, 120, 121, 196, 197,
141197
+ /* 440 */ 98, 99, 100, 19, 46, 22, 23, 23, 252, 253,
141198
+ /* 450 */ 208, 174, 175, 84, 219, 153, 85, 86, 87, 88,
141199
+ /* 460 */ 89, 90, 91, 92, 93, 94, 95, 43, 44, 45,
141200
+ /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
141201
+ /* 480 */ 56, 57, 153, 153, 153, 153, 209, 120, 121, 76,
141202
+ /* 490 */ 153, 78, 109, 110, 111, 97, 19, 153, 89, 90,
141203
+ /* 500 */ 198, 59, 183, 174, 175, 174, 175, 84, 153, 85,
141204
+ /* 510 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141205
+ /* 520 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
141206
+ /* 530 */ 53, 54, 55, 56, 57, 16, 197, 153, 22, 153,
141207
+ /* 540 */ 153, 99, 198, 12, 153, 196, 197, 208, 153, 153,
141208
+ /* 550 */ 195, 183, 19, 23, 222, 142, 26, 208, 27, 153,
141209
+ /* 560 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92,
141210
+ /* 570 */ 93, 94, 95, 42, 188, 59, 43, 44, 45, 46,
141211
+ /* 580 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
141212
+ /* 590 */ 57, 195, 22, 198, 63, 76, 153, 78, 167, 168,
141213
+ /* 600 */ 153, 195, 167, 168, 73, 153, 222, 153, 19, 222,
141214
+ /* 610 */ 153, 220, 153, 24, 98, 99, 100, 140, 85, 86,
141215
+ /* 620 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 59,
141216
+ /* 630 */ 100, 153, 43, 44, 45, 46, 47, 48, 49, 50,
141217
+ /* 640 */ 51, 52, 53, 54, 55, 56, 57, 195, 153, 195,
141218
+ /* 650 */ 153, 153, 174, 175, 26, 125, 120, 121, 153, 213,
141219
+ /* 660 */ 214, 19, 153, 220, 153, 153, 188, 220, 98, 99,
141220
+ /* 670 */ 100, 174, 175, 140, 85, 86, 87, 88, 89, 90,
141221
+ /* 680 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47,
141222
+ /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
141223
+ /* 700 */ 243, 189, 243, 198, 172, 250, 251, 117, 31, 201,
141224
+ /* 710 */ 26, 139, 122, 141, 19, 220, 39, 29, 220, 211,
141225
+ /* 720 */ 24, 33, 153, 164, 153, 164, 19, 85, 86, 87,
141226
+ /* 730 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44,
141227
+ /* 740 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
141228
+ /* 750 */ 55, 56, 57, 65, 243, 196, 197, 196, 197, 131,
141229
+ /* 760 */ 189, 22, 103, 24, 153, 23, 19, 208, 26, 208,
141230
+ /* 770 */ 102, 103, 113, 23, 242, 22, 26, 134, 164, 136,
141231
+ /* 780 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
141232
+ /* 790 */ 95, 44, 45, 46, 47, 48, 49, 50, 51, 52,
141233
+ /* 800 */ 53, 54, 55, 56, 57, 98, 153, 153, 124, 153,
141234
+ /* 810 */ 196, 197, 23, 23, 61, 26, 26, 19, 23, 123,
141235
+ /* 820 */ 23, 26, 208, 26, 7, 8, 153, 22, 174, 175,
141236
+ /* 830 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92,
141237
+ /* 840 */ 93, 94, 95, 45, 46, 47, 48, 49, 50, 51,
141238
+ /* 850 */ 52, 53, 54, 55, 56, 57, 19, 20, 59, 22,
141239
+ /* 860 */ 111, 59, 164, 23, 59, 23, 26, 153, 26, 59,
141240
+ /* 870 */ 153, 72, 23, 36, 72, 26, 35, 23, 59, 134,
141241
+ /* 880 */ 26, 136, 133, 85, 86, 87, 88, 89, 90, 91,
141242
+ /* 890 */ 92, 93, 94, 95, 196, 197, 59, 98, 99, 100,
141243
+ /* 900 */ 98, 99, 100, 98, 99, 100, 208, 66, 71, 99,
141244
+ /* 910 */ 54, 55, 56, 57, 58, 74, 153, 80, 99, 19,
141245
+ /* 920 */ 83, 223, 23, 26, 153, 26, 89, 90, 54, 55,
141246
+ /* 930 */ 56, 57, 153, 96, 153, 98, 99, 100, 22, 153,
141247
+ /* 940 */ 103, 85, 86, 87, 88, 89, 90, 91, 92, 93,
141248
+ /* 950 */ 94, 95, 183, 112, 158, 174, 175, 120, 121, 85,
141249
+ /* 960 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141250
+ /* 970 */ 215, 134, 135, 136, 137, 138, 0, 1, 2, 23,
141251
+ /* 980 */ 21, 5, 26, 153, 22, 59, 10, 11, 12, 13,
141252
+ /* 990 */ 14, 1, 2, 17, 212, 5, 153, 153, 98, 153,
141253
+ /* 1000 */ 10, 11, 12, 13, 14, 108, 30, 17, 32, 193,
141254
+ /* 1010 */ 153, 59, 153, 153, 170, 171, 40, 174, 175, 153,
141255
+ /* 1020 */ 30, 59, 32, 19, 20, 99, 22, 170, 171, 233,
141256
+ /* 1030 */ 40, 188, 236, 174, 175, 153, 153, 153, 79, 123,
141257
+ /* 1040 */ 36, 89, 90, 153, 153, 153, 70, 188, 153, 97,
141258
+ /* 1050 */ 98, 99, 100, 77, 102, 153, 80, 81, 174, 175,
141259
+ /* 1060 */ 70, 99, 110, 59, 105, 174, 175, 77, 153, 238,
141260
+ /* 1070 */ 80, 81, 188, 19, 20, 71, 22, 153, 153, 235,
141261
+ /* 1080 */ 19, 22, 164, 24, 59, 153, 134, 83, 136, 153,
141262
+ /* 1090 */ 36, 115, 235, 89, 90, 91, 120, 121, 153, 153,
141263
+ /* 1100 */ 96, 142, 98, 99, 100, 115, 59, 103, 83, 239,
141264
+ /* 1110 */ 120, 121, 199, 59, 196, 197, 153, 153, 59, 143,
141265
+ /* 1120 */ 174, 175, 153, 98, 99, 71, 208, 153, 103, 165,
141266
+ /* 1130 */ 153, 19, 20, 143, 22, 153, 153, 83, 134, 135,
141267
+ /* 1140 */ 136, 137, 138, 89, 90, 98, 99, 100, 36, 185,
141268
+ /* 1150 */ 96, 187, 98, 99, 100, 91, 95, 103, 99, 134,
141269
+ /* 1160 */ 135, 136, 101, 102, 103, 104, 105, 106, 107, 153,
141270
+ /* 1170 */ 26, 59, 125, 164, 113, 153, 153, 153, 212, 12,
141271
+ /* 1180 */ 19, 117, 153, 71, 153, 212, 122, 164, 134, 135,
141272
+ /* 1190 */ 136, 137, 138, 212, 27, 83, 212, 174, 175, 59,
141273
+ /* 1200 */ 200, 89, 90, 174, 175, 196, 197, 46, 96, 42,
141274
+ /* 1210 */ 98, 99, 100, 172, 151, 103, 5, 208, 203, 196,
141275
+ /* 1220 */ 197, 10, 11, 12, 13, 14, 216, 216, 17, 244,
141276
+ /* 1230 */ 63, 208, 209, 210, 153, 80, 24, 203, 98, 99,
141277
+ /* 1240 */ 100, 30, 22, 32, 100, 164, 134, 135, 136, 137,
141278
+ /* 1250 */ 138, 40, 148, 164, 150, 174, 175, 102, 97, 155,
141279
+ /* 1260 */ 203, 157, 164, 244, 178, 125, 186, 182, 164, 125,
141280
+ /* 1270 */ 177, 59, 177, 177, 113, 120, 121, 196, 197, 59,
141281
+ /* 1280 */ 232, 70, 153, 216, 202, 196, 197, 153, 77, 208,
141282
+ /* 1290 */ 209, 80, 81, 156, 196, 197, 60, 208, 248, 200,
141283
+ /* 1300 */ 196, 197, 153, 174, 175, 123, 208, 153, 174, 175,
141284
+ /* 1310 */ 160, 99, 208, 153, 38, 153, 160, 153, 98, 99,
141285
+ /* 1320 */ 100, 153, 245, 174, 175, 221, 115, 153, 174, 175,
141286
+ /* 1330 */ 153, 120, 121, 245, 174, 175, 174, 175, 174, 175,
141287
+ /* 1340 */ 160, 153, 174, 175, 153, 225, 153, 22, 174, 175,
141288
+ /* 1350 */ 97, 174, 175, 249, 143, 153, 224, 153, 43, 153,
141289
+ /* 1360 */ 191, 153, 174, 175, 18, 174, 175, 174, 175, 153,
141290
+ /* 1370 */ 131, 153, 194, 203, 153, 194, 174, 175, 174, 175,
141291
+ /* 1380 */ 174, 175, 174, 175, 153, 160, 153, 18, 153, 194,
141292
+ /* 1390 */ 174, 175, 174, 175, 153, 174, 175, 153, 225, 153,
141293
+ /* 1400 */ 203, 153, 159, 153, 194, 174, 175, 174, 175, 174,
141294
+ /* 1410 */ 175, 153, 203, 153, 224, 174, 175, 191, 174, 175,
141295
+ /* 1420 */ 174, 175, 174, 175, 174, 175, 203, 160, 153, 191,
141296
+ /* 1430 */ 153, 159, 174, 175, 174, 175, 153, 139, 62, 153,
141297
+ /* 1440 */ 241, 153, 160, 153, 159, 153, 22, 240, 179, 174,
141298
+ /* 1450 */ 175, 174, 175, 160, 159, 97, 160, 174, 175, 159,
141299
+ /* 1460 */ 174, 175, 174, 175, 174, 175, 174, 175, 179, 64,
141300
+ /* 1470 */ 176, 184, 108, 176, 95, 176, 234, 126, 176, 234,
141301
+ /* 1480 */ 179, 178, 176, 176, 176, 97, 218, 217, 184, 179,
141302
+ /* 1490 */ 179, 218, 218, 160, 22, 217, 217, 160, 218, 139,
141303
+ /* 1500 */ 229, 217, 130, 129, 127, 25, 128, 163, 26, 162,
141304
+ /* 1510 */ 13, 206, 231, 154, 6, 154, 207, 205, 204, 203,
141305
+ /* 1520 */ 152, 166, 152, 152, 172, 172, 172, 4, 172, 166,
141306
+ /* 1530 */ 180, 166, 3, 22, 172, 144, 15, 180, 172, 172,
141307
+ /* 1540 */ 82, 16, 23, 23, 121, 254, 132, 172, 112, 124,
141308
+ /* 1550 */ 24, 20, 126, 16, 1, 124, 112, 61, 53, 37,
141309
+ /* 1560 */ 133, 132, 53, 53, 112, 53, 98, 254, 251, 34,
141310
+ /* 1570 */ 123, 1, 5, 22, 97, 142, 26, 75, 123, 41,
141311
+ /* 1580 */ 97, 68, 68, 24, 20, 19, 113, 22, 107, 28,
141312
+ /* 1590 */ 22, 67, 23, 22, 22, 67, 22, 67, 23, 37,
141313
+ /* 1600 */ 23, 23, 26, 23, 22, 24, 23, 22, 24, 123,
141314
+ /* 1610 */ 23, 23, 22, 98, 125, 26, 11, 23, 26, 23,
141315
+ /* 1620 */ 34, 23, 23, 23, 23, 34, 22, 34, 26, 22,
141316
+ /* 1630 */ 22, 15, 23, 23, 22, 117, 23, 22, 1, 123,
141317
+ /* 1640 */ 26, 23, 255, 255, 255, 255, 255, 255, 255, 255,
141318
+ /* 1650 */ 123, 255, 255, 255, 255, 123, 123, 255, 255, 255,
141319
+ /* 1660 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141320
+ /* 1670 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141321
+ /* 1680 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141322
+ /* 1690 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141323
+ /* 1700 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141324
+ /* 1710 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141325
+ /* 1720 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141326
+ /* 1730 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141327
+ /* 1740 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141328
+ /* 1750 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141329
+ /* 1760 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141330
+ /* 1770 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141331
+ /* 1780 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141332
+ /* 1790 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141333
+ /* 1800 */ 255, 255,
141334
+};
141335
+#define YY_SHIFT_COUNT (489)
140446141336
#define YY_SHIFT_MIN (0)
140447
-#define YY_SHIFT_MAX (1559)
141337
+#define YY_SHIFT_MAX (1637)
140448141338
static const unsigned short int yy_shift_ofst[] = {
140449
- /* 0 */ 182, 1090, 822, 822, 306, 957, 957, 957, 957, 210,
140450
- /* 10 */ 0, 0, 104, 630, 957, 957, 957, 957, 957, 957,
140451
- /* 20 */ 957, 1117, 1117, 126, 968, 306, 306, 306, 306, 306,
140452
- /* 30 */ 306, 52, 156, 208, 260, 312, 364, 416, 468, 523,
140453
- /* 40 */ 578, 630, 630, 630, 630, 630, 630, 630, 630, 630,
140454
- /* 50 */ 630, 630, 630, 630, 630, 630, 630, 630, 682, 630,
140455
- /* 60 */ 733, 783, 783, 877, 957, 957, 957, 957, 957, 957,
140456
- /* 70 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
140457
- /* 80 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
140458
- /* 90 */ 957, 957, 957, 957, 957, 978, 957, 957, 957, 957,
140459
- /* 100 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 1061,
140460
- /* 110 */ 1108, 1108, 1108, 1108, 1108, 40, 127, 20, 280, 843,
140461
- /* 120 */ 1032, 144, 144, 280, 310, 310, 310, 310, 59, 191,
140462
- /* 130 */ 69, 1566, 1566, 1566, 786, 786, 786, 522, 836, 522,
140463
- /* 140 */ 959, 959, 892, 155, 358, 280, 280, 280, 280, 280,
140464
- /* 150 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
140465
- /* 160 */ 280, 280, 280, 280, 280, 280, 371, 388, 645, 645,
140466
- /* 170 */ 531, 1566, 1566, 1566, 504, 189, 189, 909, 63, 176,
140467
- /* 180 */ 928, 440, 932, 973, 280, 280, 280, 280, 280, 314,
140468
- /* 190 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
140469
- /* 200 */ 280, 280, 1064, 1064, 1064, 280, 280, 280, 280, 667,
140470
- /* 210 */ 280, 280, 280, 825, 280, 280, 902, 280, 280, 280,
140471
- /* 220 */ 280, 280, 280, 280, 280, 383, 676, 325, 975, 975,
140472
- /* 230 */ 975, 975, 1010, 325, 325, 819, 349, 524, 569, 829,
140473
- /* 240 */ 829, 832, 569, 832, 686, 51, 656, 303, 303, 303,
140474
- /* 250 */ 829, 294, 520, 628, 474, 1174, 1115, 1115, 1208, 1208,
140475
- /* 260 */ 1115, 1231, 1217, 1131, 1246, 1246, 1246, 1246, 1115, 1276,
140476
- /* 270 */ 1131, 1231, 1217, 1217, 1131, 1115, 1276, 1184, 1277, 1115,
140477
- /* 280 */ 1276, 1330, 1115, 1276, 1115, 1276, 1330, 1280, 1280, 1280,
140478
- /* 290 */ 1320, 1330, 1280, 1285, 1280, 1320, 1280, 1280, 1330, 1306,
140479
- /* 300 */ 1306, 1330, 1284, 1294, 1284, 1294, 1284, 1294, 1284, 1294,
140480
- /* 310 */ 1115, 1392, 1115, 1281, 1288, 1296, 1292, 1297, 1131, 1398,
140481
- /* 320 */ 1401, 1417, 1417, 1429, 1429, 1429, 1566, 1566, 1566, 1566,
140482
- /* 330 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
140483
- /* 340 */ 1566, 1566, 34, 357, 38, 462, 514, 484, 1074, 727,
140484
- /* 350 */ 740, 734, 735, 777, 778, 784, 788, 803, 694, 845,
140485
- /* 360 */ 742, 796, 833, 837, 889, 860, 886, 1036, 806, 958,
140486
- /* 370 */ 1446, 1448, 1430, 1311, 1441, 1378, 1444, 1438, 1439, 1343,
140487
- /* 380 */ 1334, 1356, 1345, 1452, 1348, 1458, 1474, 1353, 1346, 1425,
140488
- /* 390 */ 1426, 1427, 1428, 1371, 1387, 1450, 1363, 1486, 1484, 1468,
140489
- /* 400 */ 1384, 1352, 1431, 1467, 1432, 1420, 1454, 1374, 1390, 1476,
140490
- /* 410 */ 1481, 1483, 1391, 1399, 1485, 1440, 1487, 1488, 1482, 1489,
140491
- /* 420 */ 1442, 1490, 1491, 1449, 1475, 1493, 1494, 1496, 1495, 1497,
140492
- /* 430 */ 1492, 1498, 1500, 1502, 1501, 1404, 1504, 1505, 1433, 1499,
140493
- /* 440 */ 1508, 1407, 1506, 1503, 1509, 1507, 1511, 1513, 1515, 1506,
140494
- /* 450 */ 1516, 1517, 1518, 1519, 1521, 1534, 1524, 1525, 1526, 1527,
140495
- /* 460 */ 1529, 1530, 1532, 1522, 1436, 1434, 1435, 1437, 1443, 1535,
140496
- /* 470 */ 1540, 1559,
140497
-};
140498
-#define YY_REDUCE_COUNT (341)
140499
-#define YY_REDUCE_MIN (-211)
140500
-#define YY_REDUCE_MAX (1301)
141339
+ /* 0 */ 990, 976, 1211, 837, 837, 316, 1054, 1054, 1054, 1054,
141340
+ /* 10 */ 214, 0, 0, 106, 642, 1054, 1054, 1054, 1054, 1054,
141341
+ /* 20 */ 1054, 1054, 1054, 952, 952, 226, 1155, 316, 316, 316,
141342
+ /* 30 */ 316, 316, 316, 53, 159, 212, 265, 318, 371, 424,
141343
+ /* 40 */ 477, 533, 589, 642, 642, 642, 642, 642, 642, 642,
141344
+ /* 50 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
141345
+ /* 60 */ 695, 642, 747, 798, 798, 1004, 1054, 1054, 1054, 1054,
141346
+ /* 70 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141347
+ /* 80 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141348
+ /* 90 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1112, 1054, 1054,
141349
+ /* 100 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141350
+ /* 110 */ 1054, 856, 874, 874, 874, 874, 874, 134, 147, 93,
141351
+ /* 120 */ 342, 959, 1161, 253, 253, 342, 367, 367, 367, 367,
141352
+ /* 130 */ 179, 36, 79, 1657, 1657, 1657, 1061, 1061, 1061, 516,
141353
+ /* 140 */ 799, 516, 516, 531, 531, 802, 249, 369, 342, 342,
141354
+ /* 150 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
141355
+ /* 160 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 272,
141356
+ /* 170 */ 442, 442, 536, 1657, 1657, 1657, 1025, 245, 245, 570,
141357
+ /* 180 */ 172, 286, 805, 1047, 1140, 1220, 342, 342, 342, 342,
141358
+ /* 190 */ 342, 342, 342, 342, 170, 342, 342, 342, 342, 342,
141359
+ /* 200 */ 342, 342, 342, 342, 342, 342, 342, 841, 841, 841,
141360
+ /* 210 */ 342, 342, 342, 342, 530, 342, 342, 342, 1059, 342,
141361
+ /* 220 */ 342, 1167, 342, 342, 342, 342, 342, 342, 342, 342,
141362
+ /* 230 */ 123, 688, 177, 1212, 1212, 1212, 1212, 1144, 177, 177,
141363
+ /* 240 */ 1064, 409, 33, 628, 707, 707, 900, 628, 628, 900,
141364
+ /* 250 */ 897, 323, 398, 677, 677, 677, 707, 572, 684, 590,
141365
+ /* 260 */ 739, 1236, 1182, 1182, 1276, 1276, 1182, 1253, 1325, 1315,
141366
+ /* 270 */ 1239, 1346, 1346, 1346, 1346, 1182, 1369, 1239, 1239, 1253,
141367
+ /* 280 */ 1325, 1315, 1315, 1239, 1182, 1369, 1298, 1376, 1182, 1369,
141368
+ /* 290 */ 1424, 1182, 1369, 1182, 1369, 1424, 1358, 1358, 1358, 1405,
141369
+ /* 300 */ 1424, 1358, 1364, 1358, 1405, 1358, 1358, 1424, 1379, 1379,
141370
+ /* 310 */ 1424, 1351, 1388, 1351, 1388, 1351, 1388, 1351, 1388, 1182,
141371
+ /* 320 */ 1472, 1182, 1360, 1372, 1377, 1374, 1378, 1239, 1480, 1482,
141372
+ /* 330 */ 1497, 1497, 1508, 1508, 1508, 1657, 1657, 1657, 1657, 1657,
141373
+ /* 340 */ 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657,
141374
+ /* 350 */ 1657, 20, 413, 98, 423, 519, 383, 962, 742, 61,
141375
+ /* 360 */ 696, 749, 750, 753, 789, 790, 795, 797, 840, 842,
141376
+ /* 370 */ 810, 668, 817, 659, 819, 849, 854, 899, 643, 745,
141377
+ /* 380 */ 956, 926, 916, 1523, 1529, 1511, 1391, 1521, 1458, 1525,
141378
+ /* 390 */ 1519, 1520, 1423, 1414, 1436, 1526, 1425, 1531, 1426, 1537,
141379
+ /* 400 */ 1553, 1431, 1427, 1444, 1496, 1522, 1429, 1505, 1509, 1510,
141380
+ /* 410 */ 1512, 1452, 1468, 1535, 1447, 1570, 1567, 1551, 1477, 1433,
141381
+ /* 420 */ 1513, 1550, 1514, 1502, 1538, 1455, 1483, 1559, 1564, 1566,
141382
+ /* 430 */ 1473, 1481, 1565, 1524, 1568, 1571, 1569, 1572, 1528, 1561,
141383
+ /* 440 */ 1574, 1530, 1562, 1575, 1577, 1578, 1576, 1580, 1582, 1581,
141384
+ /* 450 */ 1583, 1585, 1584, 1486, 1587, 1588, 1515, 1586, 1590, 1489,
141385
+ /* 460 */ 1589, 1591, 1592, 1593, 1594, 1596, 1598, 1589, 1599, 1600,
141386
+ /* 470 */ 1602, 1601, 1604, 1605, 1607, 1608, 1609, 1610, 1612, 1613,
141387
+ /* 480 */ 1615, 1614, 1518, 1516, 1527, 1532, 1533, 1618, 1616, 1637,
141388
+};
141389
+#define YY_REDUCE_COUNT (350)
141390
+#define YY_REDUCE_MIN (-225)
141391
+#define YY_REDUCE_MAX (1375)
140501141392
static const short yy_reduce_ofst[] = {
140502
- /* 0 */ -143, 789, 753, 1059, -137, -146, -144, -141, -136, 687,
140503
- /* 10 */ -107, 101, -203, -52, 830, 870, 890, 167, 953, 218,
140504
- /* 20 */ 220, 413, 646, 897, 73, 281, 283, 332, 496, 601,
140505
- /* 30 */ 650, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140506
- /* 40 */ -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140507
- /* 50 */ -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140508
- /* 60 */ -211, -211, -211, 374, 377, 537, 969, 983, 1006, 1008,
140509
- /* 70 */ 1015, 1055, 1067, 1069, 1071, 1084, 1096, 1100, 1104, 1111,
140510
- /* 80 */ 1113, 1116, 1119, 1123, 1127, 1130, 1136, 1143, 1146, 1150,
140511
- /* 90 */ 1153, 1155, 1159, 1161, 1163, 1166, 1170, 1189, 1193, 1195,
140512
- /* 100 */ 1197, 1199, 1201, 1203, 1205, 1207, 1212, 1230, 1232, -211,
140513
- /* 110 */ -211, -211, -211, -211, -211, -211, -211, -211, -30, 427,
140514
- /* 120 */ -171, -145, -134, 22, 279, 287, 279, 287, 99, -211,
140515
- /* 130 */ -211, -211, -211, -211, -165, -165, -165, 123, 135, 175,
140516
- /* 140 */ -150, 396, 337, 291, 291, -147, 185, 391, 446, 444,
140517
- /* 150 */ 452, 500, 501, 502, 27, -152, 295, 438, 490, 503,
140518
- /* 160 */ 495, 506, -73, 447, 451, 536, 570, 551, 540, 579,
140519
- /* 170 */ 30, 508, 535, 81, 14, 61, 115, 168, 142, 222,
140520
- /* 180 */ 275, 284, 397, 599, 607, 647, 654, 660, 709, 658,
140521
- /* 190 */ 714, 750, 754, 772, 787, 801, 817, 818, 850, 863,
140522
- /* 200 */ 867, 871, 466, 748, 799, 881, 888, 898, 913, 824,
140523
- /* 210 */ 930, 933, 934, 873, 942, 945, 849, 946, 222, 954,
140524
- /* 220 */ 971, 972, 976, 979, 980, 900, 874, 927, 950, 961,
140525
- /* 230 */ 962, 963, 824, 927, 927, 939, 970, 1018, 981, 988,
140526
- /* 240 */ 993, 936, 982, 937, 1009, 1000, 1031, 1011, 1014, 1040,
140527
- /* 250 */ 1003, 991, 990, 1026, 1072, 985, 1076, 1079, 997, 1005,
140528
- /* 260 */ 1091, 1037, 1082, 1060, 1083, 1087, 1088, 1098, 1124, 1141,
140529
- /* 270 */ 1106, 1092, 1122, 1135, 1128, 1147, 1173, 1110, 1105, 1187,
140530
- /* 280 */ 1192, 1176, 1202, 1198, 1206, 1200, 1182, 1213, 1214, 1215,
140531
- /* 290 */ 1209, 1216, 1218, 1219, 1220, 1224, 1222, 1223, 1221, 1171,
140532
- /* 300 */ 1177, 1233, 1196, 1194, 1204, 1210, 1211, 1225, 1226, 1228,
140533
- /* 310 */ 1253, 1190, 1256, 1191, 1227, 1229, 1234, 1236, 1235, 1263,
140534
- /* 320 */ 1268, 1278, 1279, 1289, 1291, 1295, 1185, 1237, 1238, 1282,
140535
- /* 330 */ 1274, 1283, 1286, 1287, 1290, 1269, 1270, 1293, 1298, 1299,
140536
- /* 340 */ 1300, 1301,
141393
+ /* 0 */ -137, -31, 1104, 1023, 1081, -132, -40, -38, 223, 225,
141394
+ /* 10 */ 698, -153, -99, -225, -165, 386, 478, 843, 859, -139,
141395
+ /* 20 */ 884, 117, 277, 844, 857, 964, 559, 561, 614, 918,
141396
+ /* 30 */ 1009, 1089, 1098, -222, -222, -222, -222, -222, -222, -222,
141397
+ /* 40 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141398
+ /* 50 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141399
+ /* 60 */ -222, -222, -222, -222, -222, 329, 331, 497, 654, 656,
141400
+ /* 70 */ 781, 891, 946, 1029, 1129, 1134, 1149, 1154, 1160, 1162,
141401
+ /* 80 */ 1164, 1168, 1174, 1177, 1188, 1191, 1193, 1202, 1204, 1206,
141402
+ /* 90 */ 1208, 1216, 1218, 1221, 1231, 1233, 1235, 1241, 1244, 1246,
141403
+ /* 100 */ 1248, 1250, 1258, 1260, 1275, 1277, 1283, 1286, 1288, 1290,
141404
+ /* 110 */ 1292, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141405
+ /* 120 */ -115, 796, -156, -154, -141, 14, 242, 349, 242, 349,
141406
+ /* 130 */ -61, -222, -222, -222, -222, -222, 101, 101, 101, 332,
141407
+ /* 140 */ 302, 384, 387, -170, 146, 344, 196, 196, 15, 11,
141408
+ /* 150 */ 183, 235, 395, 355, 396, 406, 452, 457, 391, 459,
141409
+ /* 160 */ 443, 447, 511, 495, 454, 512, 505, 571, 498, 532,
141410
+ /* 170 */ 431, 435, 339, 455, 446, 508, -174, -116, -97, -120,
141411
+ /* 180 */ -150, 64, 176, 330, 337, 509, 569, 611, 653, 673,
141412
+ /* 190 */ 714, 717, 763, 771, -34, 779, 786, 830, 846, 860,
141413
+ /* 200 */ 866, 882, 883, 890, 892, 895, 902, 319, 368, 769,
141414
+ /* 210 */ 915, 924, 925, 932, 755, 936, 945, 963, 782, 969,
141415
+ /* 220 */ 974, 816, 977, 64, 982, 983, 1016, 1022, 1024, 1031,
141416
+ /* 230 */ 870, 831, 913, 966, 973, 981, 984, 755, 913, 913,
141417
+ /* 240 */ 1000, 1041, 1063, 1015, 1010, 1011, 985, 1034, 1057, 1019,
141418
+ /* 250 */ 1086, 1080, 1085, 1093, 1095, 1096, 1067, 1048, 1082, 1099,
141419
+ /* 260 */ 1137, 1050, 1150, 1156, 1077, 1088, 1180, 1120, 1132, 1169,
141420
+ /* 270 */ 1170, 1178, 1181, 1195, 1210, 1225, 1243, 1197, 1209, 1173,
141421
+ /* 280 */ 1190, 1226, 1238, 1223, 1267, 1272, 1199, 1207, 1282, 1285,
141422
+ /* 290 */ 1269, 1293, 1295, 1296, 1300, 1289, 1294, 1297, 1299, 1287,
141423
+ /* 300 */ 1301, 1302, 1303, 1306, 1304, 1307, 1308, 1310, 1242, 1245,
141424
+ /* 310 */ 1311, 1268, 1270, 1273, 1278, 1274, 1279, 1280, 1284, 1333,
141425
+ /* 320 */ 1271, 1337, 1281, 1309, 1305, 1312, 1314, 1316, 1344, 1347,
141426
+ /* 330 */ 1359, 1361, 1368, 1370, 1371, 1291, 1313, 1317, 1355, 1352,
141427
+ /* 340 */ 1353, 1354, 1356, 1363, 1350, 1357, 1362, 1366, 1367, 1375,
141428
+ /* 350 */ 1365,
140537141429
};
140538141430
static const YYACTIONTYPE yy_default[] = {
140539
- /* 0 */ 1297, 1349, 1221, 1014, 1119, 1221, 1221, 1221, 1221, 1014,
140540
- /* 10 */ 1145, 1145, 1272, 1045, 1014, 1014, 1014, 1014, 1014, 1220,
140541
- /* 20 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140542
- /* 30 */ 1014, 1151, 1014, 1014, 1014, 1014, 1222, 1223, 1014, 1014,
140543
- /* 40 */ 1014, 1271, 1273, 1161, 1160, 1159, 1158, 1254, 1132, 1156,
140544
- /* 50 */ 1149, 1153, 1216, 1217, 1215, 1219, 1222, 1223, 1014, 1152,
140545
- /* 60 */ 1186, 1200, 1185, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140546
- /* 70 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140547
- /* 80 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140548
- /* 90 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140549
- /* 100 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1194,
140550
- /* 110 */ 1199, 1206, 1198, 1195, 1188, 1187, 1189, 1190, 1014, 1035,
140551
- /* 120 */ 1084, 1014, 1014, 1014, 1289, 1288, 1014, 1014, 1045, 1191,
140552
- /* 130 */ 1192, 1203, 1202, 1201, 1279, 1305, 1304, 1014, 1014, 1014,
140553
- /* 140 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140554
- /* 150 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140555
- /* 160 */ 1014, 1014, 1014, 1014, 1014, 1014, 1045, 1297, 1041, 1041,
140556
- /* 170 */ 1014, 1284, 1119, 1110, 1014, 1014, 1014, 1014, 1014, 1014,
140557
- /* 180 */ 1014, 1014, 1014, 1014, 1014, 1276, 1274, 1014, 1236, 1014,
140558
- /* 190 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140559
- /* 200 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140560
- /* 210 */ 1014, 1014, 1014, 1115, 1014, 1014, 1014, 1014, 1014, 1014,
140561
- /* 220 */ 1014, 1014, 1014, 1014, 1299, 1014, 1249, 1098, 1115, 1115,
140562
- /* 230 */ 1115, 1115, 1117, 1099, 1097, 1109, 1045, 1021, 1155, 1134,
140563
- /* 240 */ 1134, 1338, 1155, 1338, 1059, 1319, 1056, 1145, 1145, 1145,
140564
- /* 250 */ 1134, 1218, 1116, 1109, 1014, 1341, 1124, 1124, 1340, 1340,
140565
- /* 260 */ 1124, 1166, 1087, 1155, 1093, 1093, 1093, 1093, 1124, 1032,
140566
- /* 270 */ 1155, 1166, 1087, 1087, 1155, 1124, 1032, 1253, 1335, 1124,
140567
- /* 280 */ 1032, 1229, 1124, 1032, 1124, 1032, 1229, 1085, 1085, 1085,
140568
- /* 290 */ 1074, 1229, 1085, 1059, 1085, 1074, 1085, 1085, 1229, 1233,
140569
- /* 300 */ 1233, 1229, 1138, 1133, 1138, 1133, 1138, 1133, 1138, 1133,
140570
- /* 310 */ 1124, 1224, 1124, 1014, 1150, 1139, 1148, 1146, 1155, 1038,
140571
- /* 320 */ 1077, 1302, 1302, 1298, 1298, 1298, 1346, 1346, 1284, 1314,
140572
- /* 330 */ 1045, 1045, 1045, 1045, 1314, 1061, 1061, 1045, 1045, 1045,
140573
- /* 340 */ 1045, 1314, 1014, 1014, 1014, 1014, 1014, 1014, 1309, 1014,
140574
- /* 350 */ 1238, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140575
- /* 360 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1171,
140576
- /* 370 */ 1014, 1017, 1281, 1014, 1014, 1280, 1014, 1014, 1014, 1014,
140577
- /* 380 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140578
- /* 390 */ 1014, 1014, 1014, 1014, 1014, 1014, 1337, 1014, 1014, 1014,
140579
- /* 400 */ 1014, 1014, 1014, 1252, 1251, 1014, 1014, 1126, 1014, 1014,
140580
- /* 410 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140581
- /* 420 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140582
- /* 430 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140583
- /* 440 */ 1014, 1014, 1147, 1014, 1140, 1014, 1014, 1014, 1014, 1328,
140584
- /* 450 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140585
- /* 460 */ 1014, 1014, 1014, 1323, 1101, 1173, 1014, 1172, 1176, 1014,
140586
- /* 470 */ 1026, 1014,
141431
+ /* 0 */ 1389, 1389, 1389, 1261, 1046, 1151, 1261, 1261, 1261, 1261,
141432
+ /* 10 */ 1046, 1181, 1181, 1312, 1077, 1046, 1046, 1046, 1046, 1046,
141433
+ /* 20 */ 1046, 1260, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141434
+ /* 30 */ 1046, 1046, 1046, 1187, 1046, 1046, 1046, 1046, 1262, 1263,
141435
+ /* 40 */ 1046, 1046, 1046, 1311, 1313, 1197, 1196, 1195, 1194, 1294,
141436
+ /* 50 */ 1168, 1192, 1185, 1189, 1256, 1257, 1255, 1259, 1262, 1263,
141437
+ /* 60 */ 1046, 1188, 1226, 1240, 1225, 1046, 1046, 1046, 1046, 1046,
141438
+ /* 70 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141439
+ /* 80 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141440
+ /* 90 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141441
+ /* 100 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141442
+ /* 110 */ 1046, 1234, 1239, 1246, 1238, 1235, 1228, 1227, 1229, 1230,
141443
+ /* 120 */ 1046, 1067, 1116, 1046, 1046, 1046, 1329, 1328, 1046, 1046,
141444
+ /* 130 */ 1077, 1231, 1232, 1243, 1242, 1241, 1319, 1345, 1344, 1046,
141445
+ /* 140 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141446
+ /* 150 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141447
+ /* 160 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1077,
141448
+ /* 170 */ 1073, 1073, 1046, 1324, 1151, 1142, 1046, 1046, 1046, 1046,
141449
+ /* 180 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1316, 1314, 1046,
141450
+ /* 190 */ 1276, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141451
+ /* 200 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141452
+ /* 210 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1147, 1046,
141453
+ /* 220 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1339,
141454
+ /* 230 */ 1046, 1289, 1130, 1147, 1147, 1147, 1147, 1149, 1131, 1129,
141455
+ /* 240 */ 1141, 1077, 1053, 1191, 1170, 1170, 1378, 1191, 1191, 1378,
141456
+ /* 250 */ 1091, 1359, 1088, 1181, 1181, 1181, 1170, 1258, 1148, 1141,
141457
+ /* 260 */ 1046, 1381, 1156, 1156, 1380, 1380, 1156, 1200, 1206, 1119,
141458
+ /* 270 */ 1191, 1125, 1125, 1125, 1125, 1156, 1064, 1191, 1191, 1200,
141459
+ /* 280 */ 1206, 1119, 1119, 1191, 1156, 1064, 1293, 1375, 1156, 1064,
141460
+ /* 290 */ 1269, 1156, 1064, 1156, 1064, 1269, 1117, 1117, 1117, 1106,
141461
+ /* 300 */ 1269, 1117, 1091, 1117, 1106, 1117, 1117, 1269, 1273, 1273,
141462
+ /* 310 */ 1269, 1174, 1169, 1174, 1169, 1174, 1169, 1174, 1169, 1156,
141463
+ /* 320 */ 1264, 1156, 1046, 1186, 1175, 1184, 1182, 1191, 1070, 1109,
141464
+ /* 330 */ 1342, 1342, 1338, 1338, 1338, 1386, 1386, 1324, 1354, 1077,
141465
+ /* 340 */ 1077, 1077, 1077, 1354, 1093, 1093, 1077, 1077, 1077, 1077,
141466
+ /* 350 */ 1354, 1046, 1046, 1046, 1046, 1046, 1046, 1349, 1046, 1278,
141467
+ /* 360 */ 1160, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141468
+ /* 370 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141469
+ /* 380 */ 1046, 1046, 1211, 1046, 1049, 1321, 1046, 1046, 1320, 1046,
141470
+ /* 390 */ 1046, 1046, 1046, 1046, 1046, 1161, 1046, 1046, 1046, 1046,
141471
+ /* 400 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141472
+ /* 410 */ 1046, 1046, 1046, 1046, 1377, 1046, 1046, 1046, 1046, 1046,
141473
+ /* 420 */ 1046, 1292, 1291, 1046, 1046, 1158, 1046, 1046, 1046, 1046,
141474
+ /* 430 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141475
+ /* 440 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141476
+ /* 450 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141477
+ /* 460 */ 1183, 1046, 1176, 1046, 1046, 1046, 1046, 1368, 1046, 1046,
141478
+ /* 470 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141479
+ /* 480 */ 1046, 1363, 1133, 1213, 1046, 1212, 1216, 1046, 1058, 1046,
140587141480
};
140588141481
/********** End of lemon-generated parsing tables *****************************/
140589141482
140590141483
/* The next table maps tokens (terminal symbols) into fallback tokens.
140591141484
** If a construct like the following:
@@ -140662,10 +141555,11 @@
140662141555
0, /* LT => nothing */
140663141556
0, /* GE => nothing */
140664141557
0, /* ESCAPE => nothing */
140665141558
0, /* ID => nothing */
140666141559
59, /* COLUMNKW => ID */
141560
+ 59, /* DO => ID */
140667141561
59, /* FOR => ID */
140668141562
59, /* IGNORE => ID */
140669141563
59, /* INITIALLY => ID */
140670141564
59, /* INSTEAD => ID */
140671141565
59, /* NO => ID */
@@ -140723,10 +141617,11 @@
140723141617
#endif
140724141618
#ifndef YYNOERRORRECOVERY
140725141619
int yyerrcnt; /* Shifts left before out of the error */
140726141620
#endif
140727141621
sqlite3ParserARG_SDECL /* A place to hold %extra_argument */
141622
+ sqlite3ParserCTX_SDECL /* A place to hold %extra_context */
140728141623
#if YYSTACKDEPTH<=0
140729141624
int yystksz; /* Current side of the stack */
140730141625
yyStackEntry *yystack; /* The parser's stack */
140731141626
yyStackEntry yystk0; /* First stack entry */
140732141627
#else
@@ -140831,201 +141726,204 @@
140831141726
/* 56 */ "LT",
140832141727
/* 57 */ "GE",
140833141728
/* 58 */ "ESCAPE",
140834141729
/* 59 */ "ID",
140835141730
/* 60 */ "COLUMNKW",
140836
- /* 61 */ "FOR",
140837
- /* 62 */ "IGNORE",
140838
- /* 63 */ "INITIALLY",
140839
- /* 64 */ "INSTEAD",
140840
- /* 65 */ "NO",
140841
- /* 66 */ "KEY",
140842
- /* 67 */ "OF",
140843
- /* 68 */ "OFFSET",
140844
- /* 69 */ "PRAGMA",
140845
- /* 70 */ "RAISE",
140846
- /* 71 */ "RECURSIVE",
140847
- /* 72 */ "REPLACE",
140848
- /* 73 */ "RESTRICT",
140849
- /* 74 */ "ROW",
140850
- /* 75 */ "TRIGGER",
140851
- /* 76 */ "VACUUM",
140852
- /* 77 */ "VIEW",
140853
- /* 78 */ "VIRTUAL",
140854
- /* 79 */ "WITH",
140855
- /* 80 */ "REINDEX",
140856
- /* 81 */ "RENAME",
140857
- /* 82 */ "CTIME_KW",
140858
- /* 83 */ "ANY",
140859
- /* 84 */ "BITAND",
140860
- /* 85 */ "BITOR",
140861
- /* 86 */ "LSHIFT",
140862
- /* 87 */ "RSHIFT",
140863
- /* 88 */ "PLUS",
140864
- /* 89 */ "MINUS",
140865
- /* 90 */ "STAR",
140866
- /* 91 */ "SLASH",
140867
- /* 92 */ "REM",
140868
- /* 93 */ "CONCAT",
140869
- /* 94 */ "COLLATE",
140870
- /* 95 */ "BITNOT",
140871
- /* 96 */ "INDEXED",
140872
- /* 97 */ "STRING",
140873
- /* 98 */ "JOIN_KW",
140874
- /* 99 */ "CONSTRAINT",
140875
- /* 100 */ "DEFAULT",
140876
- /* 101 */ "NULL",
140877
- /* 102 */ "PRIMARY",
140878
- /* 103 */ "UNIQUE",
140879
- /* 104 */ "CHECK",
140880
- /* 105 */ "REFERENCES",
140881
- /* 106 */ "AUTOINCR",
140882
- /* 107 */ "ON",
140883
- /* 108 */ "INSERT",
140884
- /* 109 */ "DELETE",
140885
- /* 110 */ "UPDATE",
140886
- /* 111 */ "SET",
140887
- /* 112 */ "DEFERRABLE",
140888
- /* 113 */ "FOREIGN",
140889
- /* 114 */ "DROP",
140890
- /* 115 */ "UNION",
140891
- /* 116 */ "ALL",
140892
- /* 117 */ "EXCEPT",
140893
- /* 118 */ "INTERSECT",
140894
- /* 119 */ "SELECT",
140895
- /* 120 */ "VALUES",
140896
- /* 121 */ "DISTINCT",
140897
- /* 122 */ "DOT",
140898
- /* 123 */ "FROM",
140899
- /* 124 */ "JOIN",
140900
- /* 125 */ "USING",
140901
- /* 126 */ "ORDER",
140902
- /* 127 */ "GROUP",
140903
- /* 128 */ "HAVING",
140904
- /* 129 */ "LIMIT",
140905
- /* 130 */ "WHERE",
140906
- /* 131 */ "INTO",
140907
- /* 132 */ "FLOAT",
140908
- /* 133 */ "BLOB",
140909
- /* 134 */ "INTEGER",
140910
- /* 135 */ "VARIABLE",
140911
- /* 136 */ "CASE",
140912
- /* 137 */ "WHEN",
140913
- /* 138 */ "THEN",
140914
- /* 139 */ "ELSE",
140915
- /* 140 */ "INDEX",
140916
- /* 141 */ "ALTER",
140917
- /* 142 */ "ADD",
140918
- /* 143 */ "error",
140919
- /* 144 */ "input",
140920
- /* 145 */ "cmdlist",
140921
- /* 146 */ "ecmd",
140922
- /* 147 */ "explain",
141731
+ /* 61 */ "DO",
141732
+ /* 62 */ "FOR",
141733
+ /* 63 */ "IGNORE",
141734
+ /* 64 */ "INITIALLY",
141735
+ /* 65 */ "INSTEAD",
141736
+ /* 66 */ "NO",
141737
+ /* 67 */ "KEY",
141738
+ /* 68 */ "OF",
141739
+ /* 69 */ "OFFSET",
141740
+ /* 70 */ "PRAGMA",
141741
+ /* 71 */ "RAISE",
141742
+ /* 72 */ "RECURSIVE",
141743
+ /* 73 */ "REPLACE",
141744
+ /* 74 */ "RESTRICT",
141745
+ /* 75 */ "ROW",
141746
+ /* 76 */ "TRIGGER",
141747
+ /* 77 */ "VACUUM",
141748
+ /* 78 */ "VIEW",
141749
+ /* 79 */ "VIRTUAL",
141750
+ /* 80 */ "WITH",
141751
+ /* 81 */ "REINDEX",
141752
+ /* 82 */ "RENAME",
141753
+ /* 83 */ "CTIME_KW",
141754
+ /* 84 */ "ANY",
141755
+ /* 85 */ "BITAND",
141756
+ /* 86 */ "BITOR",
141757
+ /* 87 */ "LSHIFT",
141758
+ /* 88 */ "RSHIFT",
141759
+ /* 89 */ "PLUS",
141760
+ /* 90 */ "MINUS",
141761
+ /* 91 */ "STAR",
141762
+ /* 92 */ "SLASH",
141763
+ /* 93 */ "REM",
141764
+ /* 94 */ "CONCAT",
141765
+ /* 95 */ "COLLATE",
141766
+ /* 96 */ "BITNOT",
141767
+ /* 97 */ "ON",
141768
+ /* 98 */ "INDEXED",
141769
+ /* 99 */ "STRING",
141770
+ /* 100 */ "JOIN_KW",
141771
+ /* 101 */ "CONSTRAINT",
141772
+ /* 102 */ "DEFAULT",
141773
+ /* 103 */ "NULL",
141774
+ /* 104 */ "PRIMARY",
141775
+ /* 105 */ "UNIQUE",
141776
+ /* 106 */ "CHECK",
141777
+ /* 107 */ "REFERENCES",
141778
+ /* 108 */ "AUTOINCR",
141779
+ /* 109 */ "INSERT",
141780
+ /* 110 */ "DELETE",
141781
+ /* 111 */ "UPDATE",
141782
+ /* 112 */ "SET",
141783
+ /* 113 */ "DEFERRABLE",
141784
+ /* 114 */ "FOREIGN",
141785
+ /* 115 */ "DROP",
141786
+ /* 116 */ "UNION",
141787
+ /* 117 */ "ALL",
141788
+ /* 118 */ "EXCEPT",
141789
+ /* 119 */ "INTERSECT",
141790
+ /* 120 */ "SELECT",
141791
+ /* 121 */ "VALUES",
141792
+ /* 122 */ "DISTINCT",
141793
+ /* 123 */ "DOT",
141794
+ /* 124 */ "FROM",
141795
+ /* 125 */ "JOIN",
141796
+ /* 126 */ "USING",
141797
+ /* 127 */ "ORDER",
141798
+ /* 128 */ "GROUP",
141799
+ /* 129 */ "HAVING",
141800
+ /* 130 */ "LIMIT",
141801
+ /* 131 */ "WHERE",
141802
+ /* 132 */ "INTO",
141803
+ /* 133 */ "NOTHING",
141804
+ /* 134 */ "FLOAT",
141805
+ /* 135 */ "BLOB",
141806
+ /* 136 */ "INTEGER",
141807
+ /* 137 */ "VARIABLE",
141808
+ /* 138 */ "CASE",
141809
+ /* 139 */ "WHEN",
141810
+ /* 140 */ "THEN",
141811
+ /* 141 */ "ELSE",
141812
+ /* 142 */ "INDEX",
141813
+ /* 143 */ "ALTER",
141814
+ /* 144 */ "ADD",
141815
+ /* 145 */ "input",
141816
+ /* 146 */ "cmdlist",
141817
+ /* 147 */ "ecmd",
140923141818
/* 148 */ "cmdx",
140924
- /* 149 */ "cmd",
140925
- /* 150 */ "transtype",
140926
- /* 151 */ "trans_opt",
140927
- /* 152 */ "nm",
140928
- /* 153 */ "savepoint_opt",
140929
- /* 154 */ "create_table",
140930
- /* 155 */ "create_table_args",
140931
- /* 156 */ "createkw",
140932
- /* 157 */ "temp",
140933
- /* 158 */ "ifnotexists",
140934
- /* 159 */ "dbnm",
140935
- /* 160 */ "columnlist",
140936
- /* 161 */ "conslist_opt",
140937
- /* 162 */ "table_options",
140938
- /* 163 */ "select",
140939
- /* 164 */ "columnname",
140940
- /* 165 */ "carglist",
140941
- /* 166 */ "typetoken",
140942
- /* 167 */ "typename",
140943
- /* 168 */ "signed",
140944
- /* 169 */ "plus_num",
140945
- /* 170 */ "minus_num",
140946
- /* 171 */ "scanpt",
140947
- /* 172 */ "ccons",
140948
- /* 173 */ "term",
140949
- /* 174 */ "expr",
140950
- /* 175 */ "onconf",
140951
- /* 176 */ "sortorder",
140952
- /* 177 */ "autoinc",
140953
- /* 178 */ "eidlist_opt",
140954
- /* 179 */ "refargs",
140955
- /* 180 */ "defer_subclause",
140956
- /* 181 */ "refarg",
140957
- /* 182 */ "refact",
140958
- /* 183 */ "init_deferred_pred_opt",
140959
- /* 184 */ "conslist",
140960
- /* 185 */ "tconscomma",
140961
- /* 186 */ "tcons",
140962
- /* 187 */ "sortlist",
140963
- /* 188 */ "eidlist",
140964
- /* 189 */ "defer_subclause_opt",
140965
- /* 190 */ "orconf",
140966
- /* 191 */ "resolvetype",
140967
- /* 192 */ "raisetype",
140968
- /* 193 */ "ifexists",
140969
- /* 194 */ "fullname",
140970
- /* 195 */ "selectnowith",
140971
- /* 196 */ "oneselect",
140972
- /* 197 */ "wqlist",
140973
- /* 198 */ "multiselect_op",
140974
- /* 199 */ "distinct",
140975
- /* 200 */ "selcollist",
140976
- /* 201 */ "from",
140977
- /* 202 */ "where_opt",
140978
- /* 203 */ "groupby_opt",
140979
- /* 204 */ "having_opt",
140980
- /* 205 */ "orderby_opt",
140981
- /* 206 */ "limit_opt",
140982
- /* 207 */ "values",
140983
- /* 208 */ "nexprlist",
140984
- /* 209 */ "exprlist",
140985
- /* 210 */ "sclp",
140986
- /* 211 */ "as",
140987
- /* 212 */ "seltablist",
140988
- /* 213 */ "stl_prefix",
140989
- /* 214 */ "joinop",
140990
- /* 215 */ "indexed_opt",
140991
- /* 216 */ "on_opt",
140992
- /* 217 */ "using_opt",
140993
- /* 218 */ "idlist",
140994
- /* 219 */ "with",
140995
- /* 220 */ "setlist",
140996
- /* 221 */ "insert_cmd",
140997
- /* 222 */ "idlist_opt",
140998
- /* 223 */ "likeop",
140999
- /* 224 */ "between_op",
141000
- /* 225 */ "in_op",
141001
- /* 226 */ "paren_exprlist",
141002
- /* 227 */ "case_operand",
141003
- /* 228 */ "case_exprlist",
141004
- /* 229 */ "case_else",
141005
- /* 230 */ "uniqueflag",
141006
- /* 231 */ "collate",
141007
- /* 232 */ "nmnum",
141008
- /* 233 */ "trigger_decl",
141009
- /* 234 */ "trigger_cmd_list",
141010
- /* 235 */ "trigger_time",
141011
- /* 236 */ "trigger_event",
141012
- /* 237 */ "foreach_clause",
141013
- /* 238 */ "when_clause",
141014
- /* 239 */ "trigger_cmd",
141015
- /* 240 */ "trnm",
141016
- /* 241 */ "tridxby",
141017
- /* 242 */ "database_kw_opt",
141018
- /* 243 */ "key_opt",
141019
- /* 244 */ "add_column_fullname",
141020
- /* 245 */ "kwcolumn_opt",
141021
- /* 246 */ "create_vtab",
141022
- /* 247 */ "vtabarglist",
141023
- /* 248 */ "vtabarg",
141024
- /* 249 */ "vtabargtoken",
141025
- /* 250 */ "lp",
141026
- /* 251 */ "anylist",
141819
+ /* 149 */ "explain",
141820
+ /* 150 */ "cmd",
141821
+ /* 151 */ "transtype",
141822
+ /* 152 */ "trans_opt",
141823
+ /* 153 */ "nm",
141824
+ /* 154 */ "savepoint_opt",
141825
+ /* 155 */ "create_table",
141826
+ /* 156 */ "create_table_args",
141827
+ /* 157 */ "createkw",
141828
+ /* 158 */ "temp",
141829
+ /* 159 */ "ifnotexists",
141830
+ /* 160 */ "dbnm",
141831
+ /* 161 */ "columnlist",
141832
+ /* 162 */ "conslist_opt",
141833
+ /* 163 */ "table_options",
141834
+ /* 164 */ "select",
141835
+ /* 165 */ "columnname",
141836
+ /* 166 */ "carglist",
141837
+ /* 167 */ "typetoken",
141838
+ /* 168 */ "typename",
141839
+ /* 169 */ "signed",
141840
+ /* 170 */ "plus_num",
141841
+ /* 171 */ "minus_num",
141842
+ /* 172 */ "scanpt",
141843
+ /* 173 */ "ccons",
141844
+ /* 174 */ "term",
141845
+ /* 175 */ "expr",
141846
+ /* 176 */ "onconf",
141847
+ /* 177 */ "sortorder",
141848
+ /* 178 */ "autoinc",
141849
+ /* 179 */ "eidlist_opt",
141850
+ /* 180 */ "refargs",
141851
+ /* 181 */ "defer_subclause",
141852
+ /* 182 */ "refarg",
141853
+ /* 183 */ "refact",
141854
+ /* 184 */ "init_deferred_pred_opt",
141855
+ /* 185 */ "conslist",
141856
+ /* 186 */ "tconscomma",
141857
+ /* 187 */ "tcons",
141858
+ /* 188 */ "sortlist",
141859
+ /* 189 */ "eidlist",
141860
+ /* 190 */ "defer_subclause_opt",
141861
+ /* 191 */ "orconf",
141862
+ /* 192 */ "resolvetype",
141863
+ /* 193 */ "raisetype",
141864
+ /* 194 */ "ifexists",
141865
+ /* 195 */ "fullname",
141866
+ /* 196 */ "selectnowith",
141867
+ /* 197 */ "oneselect",
141868
+ /* 198 */ "wqlist",
141869
+ /* 199 */ "multiselect_op",
141870
+ /* 200 */ "distinct",
141871
+ /* 201 */ "selcollist",
141872
+ /* 202 */ "from",
141873
+ /* 203 */ "where_opt",
141874
+ /* 204 */ "groupby_opt",
141875
+ /* 205 */ "having_opt",
141876
+ /* 206 */ "orderby_opt",
141877
+ /* 207 */ "limit_opt",
141878
+ /* 208 */ "values",
141879
+ /* 209 */ "nexprlist",
141880
+ /* 210 */ "exprlist",
141881
+ /* 211 */ "sclp",
141882
+ /* 212 */ "as",
141883
+ /* 213 */ "seltablist",
141884
+ /* 214 */ "stl_prefix",
141885
+ /* 215 */ "joinop",
141886
+ /* 216 */ "indexed_opt",
141887
+ /* 217 */ "on_opt",
141888
+ /* 218 */ "using_opt",
141889
+ /* 219 */ "xfullname",
141890
+ /* 220 */ "idlist",
141891
+ /* 221 */ "with",
141892
+ /* 222 */ "setlist",
141893
+ /* 223 */ "insert_cmd",
141894
+ /* 224 */ "idlist_opt",
141895
+ /* 225 */ "upsert",
141896
+ /* 226 */ "likeop",
141897
+ /* 227 */ "between_op",
141898
+ /* 228 */ "in_op",
141899
+ /* 229 */ "paren_exprlist",
141900
+ /* 230 */ "case_operand",
141901
+ /* 231 */ "case_exprlist",
141902
+ /* 232 */ "case_else",
141903
+ /* 233 */ "uniqueflag",
141904
+ /* 234 */ "collate",
141905
+ /* 235 */ "nmnum",
141906
+ /* 236 */ "trigger_decl",
141907
+ /* 237 */ "trigger_cmd_list",
141908
+ /* 238 */ "trigger_time",
141909
+ /* 239 */ "trigger_event",
141910
+ /* 240 */ "foreach_clause",
141911
+ /* 241 */ "when_clause",
141912
+ /* 242 */ "trigger_cmd",
141913
+ /* 243 */ "trnm",
141914
+ /* 244 */ "tridxby",
141915
+ /* 245 */ "database_kw_opt",
141916
+ /* 246 */ "key_opt",
141917
+ /* 247 */ "add_column_fullname",
141918
+ /* 248 */ "kwcolumn_opt",
141919
+ /* 249 */ "create_vtab",
141920
+ /* 250 */ "vtabarglist",
141921
+ /* 251 */ "vtabarg",
141922
+ /* 252 */ "vtabargtoken",
141923
+ /* 253 */ "lp",
141924
+ /* 254 */ "anylist",
141027141925
};
141028141926
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
141029141927
141030141928
#ifndef NDEBUG
141031141929
/* For tracing reduce actions, the names of all rules are required.
@@ -141140,232 +142038,240 @@
141140142038
/* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
141141142039
/* 107 */ "dbnm ::=",
141142142040
/* 108 */ "dbnm ::= DOT nm",
141143142041
/* 109 */ "fullname ::= nm",
141144142042
/* 110 */ "fullname ::= nm DOT nm",
141145
- /* 111 */ "joinop ::= COMMA|JOIN",
141146
- /* 112 */ "joinop ::= JOIN_KW JOIN",
141147
- /* 113 */ "joinop ::= JOIN_KW nm JOIN",
141148
- /* 114 */ "joinop ::= JOIN_KW nm nm JOIN",
141149
- /* 115 */ "on_opt ::= ON expr",
141150
- /* 116 */ "on_opt ::=",
141151
- /* 117 */ "indexed_opt ::=",
141152
- /* 118 */ "indexed_opt ::= INDEXED BY nm",
141153
- /* 119 */ "indexed_opt ::= NOT INDEXED",
141154
- /* 120 */ "using_opt ::= USING LP idlist RP",
141155
- /* 121 */ "using_opt ::=",
141156
- /* 122 */ "orderby_opt ::=",
141157
- /* 123 */ "orderby_opt ::= ORDER BY sortlist",
141158
- /* 124 */ "sortlist ::= sortlist COMMA expr sortorder",
141159
- /* 125 */ "sortlist ::= expr sortorder",
141160
- /* 126 */ "sortorder ::= ASC",
141161
- /* 127 */ "sortorder ::= DESC",
141162
- /* 128 */ "sortorder ::=",
141163
- /* 129 */ "groupby_opt ::=",
141164
- /* 130 */ "groupby_opt ::= GROUP BY nexprlist",
141165
- /* 131 */ "having_opt ::=",
141166
- /* 132 */ "having_opt ::= HAVING expr",
141167
- /* 133 */ "limit_opt ::=",
141168
- /* 134 */ "limit_opt ::= LIMIT expr",
141169
- /* 135 */ "limit_opt ::= LIMIT expr OFFSET expr",
141170
- /* 136 */ "limit_opt ::= LIMIT expr COMMA expr",
141171
- /* 137 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
141172
- /* 138 */ "where_opt ::=",
141173
- /* 139 */ "where_opt ::= WHERE expr",
141174
- /* 140 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
141175
- /* 141 */ "setlist ::= setlist COMMA nm EQ expr",
141176
- /* 142 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
141177
- /* 143 */ "setlist ::= nm EQ expr",
141178
- /* 144 */ "setlist ::= LP idlist RP EQ expr",
141179
- /* 145 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
141180
- /* 146 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
141181
- /* 147 */ "insert_cmd ::= INSERT orconf",
141182
- /* 148 */ "insert_cmd ::= REPLACE",
141183
- /* 149 */ "idlist_opt ::=",
141184
- /* 150 */ "idlist_opt ::= LP idlist RP",
141185
- /* 151 */ "idlist ::= idlist COMMA nm",
141186
- /* 152 */ "idlist ::= nm",
141187
- /* 153 */ "expr ::= LP expr RP",
141188
- /* 154 */ "expr ::= ID|INDEXED",
141189
- /* 155 */ "expr ::= JOIN_KW",
141190
- /* 156 */ "expr ::= nm DOT nm",
141191
- /* 157 */ "expr ::= nm DOT nm DOT nm",
141192
- /* 158 */ "term ::= NULL|FLOAT|BLOB",
141193
- /* 159 */ "term ::= STRING",
141194
- /* 160 */ "term ::= INTEGER",
141195
- /* 161 */ "expr ::= VARIABLE",
141196
- /* 162 */ "expr ::= expr COLLATE ID|STRING",
141197
- /* 163 */ "expr ::= CAST LP expr AS typetoken RP",
141198
- /* 164 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
141199
- /* 165 */ "expr ::= ID|INDEXED LP STAR RP",
141200
- /* 166 */ "term ::= CTIME_KW",
141201
- /* 167 */ "expr ::= LP nexprlist COMMA expr RP",
141202
- /* 168 */ "expr ::= expr AND expr",
141203
- /* 169 */ "expr ::= expr OR expr",
141204
- /* 170 */ "expr ::= expr LT|GT|GE|LE expr",
141205
- /* 171 */ "expr ::= expr EQ|NE expr",
141206
- /* 172 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
141207
- /* 173 */ "expr ::= expr PLUS|MINUS expr",
141208
- /* 174 */ "expr ::= expr STAR|SLASH|REM expr",
141209
- /* 175 */ "expr ::= expr CONCAT expr",
141210
- /* 176 */ "likeop ::= NOT LIKE_KW|MATCH",
141211
- /* 177 */ "expr ::= expr likeop expr",
141212
- /* 178 */ "expr ::= expr likeop expr ESCAPE expr",
141213
- /* 179 */ "expr ::= expr ISNULL|NOTNULL",
141214
- /* 180 */ "expr ::= expr NOT NULL",
141215
- /* 181 */ "expr ::= expr IS expr",
141216
- /* 182 */ "expr ::= expr IS NOT expr",
141217
- /* 183 */ "expr ::= NOT expr",
141218
- /* 184 */ "expr ::= BITNOT expr",
141219
- /* 185 */ "expr ::= MINUS expr",
141220
- /* 186 */ "expr ::= PLUS expr",
141221
- /* 187 */ "between_op ::= BETWEEN",
141222
- /* 188 */ "between_op ::= NOT BETWEEN",
141223
- /* 189 */ "expr ::= expr between_op expr AND expr",
141224
- /* 190 */ "in_op ::= IN",
141225
- /* 191 */ "in_op ::= NOT IN",
141226
- /* 192 */ "expr ::= expr in_op LP exprlist RP",
141227
- /* 193 */ "expr ::= LP select RP",
141228
- /* 194 */ "expr ::= expr in_op LP select RP",
141229
- /* 195 */ "expr ::= expr in_op nm dbnm paren_exprlist",
141230
- /* 196 */ "expr ::= EXISTS LP select RP",
141231
- /* 197 */ "expr ::= CASE case_operand case_exprlist case_else END",
141232
- /* 198 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
141233
- /* 199 */ "case_exprlist ::= WHEN expr THEN expr",
141234
- /* 200 */ "case_else ::= ELSE expr",
141235
- /* 201 */ "case_else ::=",
141236
- /* 202 */ "case_operand ::= expr",
141237
- /* 203 */ "case_operand ::=",
141238
- /* 204 */ "exprlist ::=",
141239
- /* 205 */ "nexprlist ::= nexprlist COMMA expr",
141240
- /* 206 */ "nexprlist ::= expr",
141241
- /* 207 */ "paren_exprlist ::=",
141242
- /* 208 */ "paren_exprlist ::= LP exprlist RP",
141243
- /* 209 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
141244
- /* 210 */ "uniqueflag ::= UNIQUE",
141245
- /* 211 */ "uniqueflag ::=",
141246
- /* 212 */ "eidlist_opt ::=",
141247
- /* 213 */ "eidlist_opt ::= LP eidlist RP",
141248
- /* 214 */ "eidlist ::= eidlist COMMA nm collate sortorder",
141249
- /* 215 */ "eidlist ::= nm collate sortorder",
141250
- /* 216 */ "collate ::=",
141251
- /* 217 */ "collate ::= COLLATE ID|STRING",
141252
- /* 218 */ "cmd ::= DROP INDEX ifexists fullname",
141253
- /* 219 */ "cmd ::= VACUUM",
141254
- /* 220 */ "cmd ::= VACUUM nm",
141255
- /* 221 */ "cmd ::= PRAGMA nm dbnm",
141256
- /* 222 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
141257
- /* 223 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
141258
- /* 224 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
141259
- /* 225 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
141260
- /* 226 */ "plus_num ::= PLUS INTEGER|FLOAT",
141261
- /* 227 */ "minus_num ::= MINUS INTEGER|FLOAT",
141262
- /* 228 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
141263
- /* 229 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
141264
- /* 230 */ "trigger_time ::= BEFORE|AFTER",
141265
- /* 231 */ "trigger_time ::= INSTEAD OF",
141266
- /* 232 */ "trigger_time ::=",
141267
- /* 233 */ "trigger_event ::= DELETE|INSERT",
141268
- /* 234 */ "trigger_event ::= UPDATE",
141269
- /* 235 */ "trigger_event ::= UPDATE OF idlist",
141270
- /* 236 */ "when_clause ::=",
141271
- /* 237 */ "when_clause ::= WHEN expr",
141272
- /* 238 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
141273
- /* 239 */ "trigger_cmd_list ::= trigger_cmd SEMI",
141274
- /* 240 */ "trnm ::= nm DOT nm",
141275
- /* 241 */ "tridxby ::= INDEXED BY nm",
141276
- /* 242 */ "tridxby ::= NOT INDEXED",
141277
- /* 243 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
141278
- /* 244 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt",
141279
- /* 245 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
141280
- /* 246 */ "trigger_cmd ::= scanpt select scanpt",
141281
- /* 247 */ "expr ::= RAISE LP IGNORE RP",
141282
- /* 248 */ "expr ::= RAISE LP raisetype COMMA nm RP",
141283
- /* 249 */ "raisetype ::= ROLLBACK",
141284
- /* 250 */ "raisetype ::= ABORT",
141285
- /* 251 */ "raisetype ::= FAIL",
141286
- /* 252 */ "cmd ::= DROP TRIGGER ifexists fullname",
141287
- /* 253 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
141288
- /* 254 */ "cmd ::= DETACH database_kw_opt expr",
141289
- /* 255 */ "key_opt ::=",
141290
- /* 256 */ "key_opt ::= KEY expr",
141291
- /* 257 */ "cmd ::= REINDEX",
141292
- /* 258 */ "cmd ::= REINDEX nm dbnm",
141293
- /* 259 */ "cmd ::= ANALYZE",
141294
- /* 260 */ "cmd ::= ANALYZE nm dbnm",
141295
- /* 261 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
141296
- /* 262 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
141297
- /* 263 */ "add_column_fullname ::= fullname",
141298
- /* 264 */ "cmd ::= create_vtab",
141299
- /* 265 */ "cmd ::= create_vtab LP vtabarglist RP",
141300
- /* 266 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
141301
- /* 267 */ "vtabarg ::=",
141302
- /* 268 */ "vtabargtoken ::= ANY",
141303
- /* 269 */ "vtabargtoken ::= lp anylist RP",
141304
- /* 270 */ "lp ::= LP",
141305
- /* 271 */ "with ::= WITH wqlist",
141306
- /* 272 */ "with ::= WITH RECURSIVE wqlist",
141307
- /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
141308
- /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
141309
- /* 275 */ "input ::= cmdlist",
141310
- /* 276 */ "cmdlist ::= cmdlist ecmd",
141311
- /* 277 */ "cmdlist ::= ecmd",
141312
- /* 278 */ "ecmd ::= SEMI",
141313
- /* 279 */ "ecmd ::= explain cmdx SEMI",
141314
- /* 280 */ "explain ::=",
141315
- /* 281 */ "trans_opt ::=",
141316
- /* 282 */ "trans_opt ::= TRANSACTION",
141317
- /* 283 */ "trans_opt ::= TRANSACTION nm",
141318
- /* 284 */ "savepoint_opt ::= SAVEPOINT",
141319
- /* 285 */ "savepoint_opt ::=",
141320
- /* 286 */ "cmd ::= create_table create_table_args",
141321
- /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
141322
- /* 288 */ "columnlist ::= columnname carglist",
141323
- /* 289 */ "nm ::= ID|INDEXED",
141324
- /* 290 */ "nm ::= STRING",
141325
- /* 291 */ "nm ::= JOIN_KW",
141326
- /* 292 */ "typetoken ::= typename",
141327
- /* 293 */ "typename ::= ID|STRING",
141328
- /* 294 */ "signed ::= plus_num",
141329
- /* 295 */ "signed ::= minus_num",
141330
- /* 296 */ "carglist ::= carglist ccons",
141331
- /* 297 */ "carglist ::=",
141332
- /* 298 */ "ccons ::= NULL onconf",
141333
- /* 299 */ "conslist_opt ::= COMMA conslist",
141334
- /* 300 */ "conslist ::= conslist tconscomma tcons",
141335
- /* 301 */ "conslist ::= tcons",
141336
- /* 302 */ "tconscomma ::=",
141337
- /* 303 */ "defer_subclause_opt ::= defer_subclause",
141338
- /* 304 */ "resolvetype ::= raisetype",
141339
- /* 305 */ "selectnowith ::= oneselect",
141340
- /* 306 */ "oneselect ::= values",
141341
- /* 307 */ "sclp ::= selcollist COMMA",
141342
- /* 308 */ "as ::= ID|STRING",
141343
- /* 309 */ "expr ::= term",
141344
- /* 310 */ "likeop ::= LIKE_KW|MATCH",
141345
- /* 311 */ "exprlist ::= nexprlist",
141346
- /* 312 */ "nmnum ::= plus_num",
141347
- /* 313 */ "nmnum ::= nm",
141348
- /* 314 */ "nmnum ::= ON",
141349
- /* 315 */ "nmnum ::= DELETE",
141350
- /* 316 */ "nmnum ::= DEFAULT",
141351
- /* 317 */ "plus_num ::= INTEGER|FLOAT",
141352
- /* 318 */ "foreach_clause ::=",
141353
- /* 319 */ "foreach_clause ::= FOR EACH ROW",
141354
- /* 320 */ "trnm ::= nm",
141355
- /* 321 */ "tridxby ::=",
141356
- /* 322 */ "database_kw_opt ::= DATABASE",
141357
- /* 323 */ "database_kw_opt ::=",
141358
- /* 324 */ "kwcolumn_opt ::=",
141359
- /* 325 */ "kwcolumn_opt ::= COLUMNKW",
141360
- /* 326 */ "vtabarglist ::= vtabarg",
141361
- /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
141362
- /* 328 */ "vtabarg ::= vtabarg vtabargtoken",
141363
- /* 329 */ "anylist ::=",
141364
- /* 330 */ "anylist ::= anylist LP anylist RP",
141365
- /* 331 */ "anylist ::= anylist ANY",
141366
- /* 332 */ "with ::=",
142043
+ /* 111 */ "xfullname ::= nm",
142044
+ /* 112 */ "xfullname ::= nm DOT nm",
142045
+ /* 113 */ "xfullname ::= nm DOT nm AS nm",
142046
+ /* 114 */ "xfullname ::= nm AS nm",
142047
+ /* 115 */ "joinop ::= COMMA|JOIN",
142048
+ /* 116 */ "joinop ::= JOIN_KW JOIN",
142049
+ /* 117 */ "joinop ::= JOIN_KW nm JOIN",
142050
+ /* 118 */ "joinop ::= JOIN_KW nm nm JOIN",
142051
+ /* 119 */ "on_opt ::= ON expr",
142052
+ /* 120 */ "on_opt ::=",
142053
+ /* 121 */ "indexed_opt ::=",
142054
+ /* 122 */ "indexed_opt ::= INDEXED BY nm",
142055
+ /* 123 */ "indexed_opt ::= NOT INDEXED",
142056
+ /* 124 */ "using_opt ::= USING LP idlist RP",
142057
+ /* 125 */ "using_opt ::=",
142058
+ /* 126 */ "orderby_opt ::=",
142059
+ /* 127 */ "orderby_opt ::= ORDER BY sortlist",
142060
+ /* 128 */ "sortlist ::= sortlist COMMA expr sortorder",
142061
+ /* 129 */ "sortlist ::= expr sortorder",
142062
+ /* 130 */ "sortorder ::= ASC",
142063
+ /* 131 */ "sortorder ::= DESC",
142064
+ /* 132 */ "sortorder ::=",
142065
+ /* 133 */ "groupby_opt ::=",
142066
+ /* 134 */ "groupby_opt ::= GROUP BY nexprlist",
142067
+ /* 135 */ "having_opt ::=",
142068
+ /* 136 */ "having_opt ::= HAVING expr",
142069
+ /* 137 */ "limit_opt ::=",
142070
+ /* 138 */ "limit_opt ::= LIMIT expr",
142071
+ /* 139 */ "limit_opt ::= LIMIT expr OFFSET expr",
142072
+ /* 140 */ "limit_opt ::= LIMIT expr COMMA expr",
142073
+ /* 141 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
142074
+ /* 142 */ "where_opt ::=",
142075
+ /* 143 */ "where_opt ::= WHERE expr",
142076
+ /* 144 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
142077
+ /* 145 */ "setlist ::= setlist COMMA nm EQ expr",
142078
+ /* 146 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
142079
+ /* 147 */ "setlist ::= nm EQ expr",
142080
+ /* 148 */ "setlist ::= LP idlist RP EQ expr",
142081
+ /* 149 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
142082
+ /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
142083
+ /* 151 */ "upsert ::=",
142084
+ /* 152 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
142085
+ /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
142086
+ /* 154 */ "upsert ::= ON CONFLICT DO NOTHING",
142087
+ /* 155 */ "insert_cmd ::= INSERT orconf",
142088
+ /* 156 */ "insert_cmd ::= REPLACE",
142089
+ /* 157 */ "idlist_opt ::=",
142090
+ /* 158 */ "idlist_opt ::= LP idlist RP",
142091
+ /* 159 */ "idlist ::= idlist COMMA nm",
142092
+ /* 160 */ "idlist ::= nm",
142093
+ /* 161 */ "expr ::= LP expr RP",
142094
+ /* 162 */ "expr ::= ID|INDEXED",
142095
+ /* 163 */ "expr ::= JOIN_KW",
142096
+ /* 164 */ "expr ::= nm DOT nm",
142097
+ /* 165 */ "expr ::= nm DOT nm DOT nm",
142098
+ /* 166 */ "term ::= NULL|FLOAT|BLOB",
142099
+ /* 167 */ "term ::= STRING",
142100
+ /* 168 */ "term ::= INTEGER",
142101
+ /* 169 */ "expr ::= VARIABLE",
142102
+ /* 170 */ "expr ::= expr COLLATE ID|STRING",
142103
+ /* 171 */ "expr ::= CAST LP expr AS typetoken RP",
142104
+ /* 172 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
142105
+ /* 173 */ "expr ::= ID|INDEXED LP STAR RP",
142106
+ /* 174 */ "term ::= CTIME_KW",
142107
+ /* 175 */ "expr ::= LP nexprlist COMMA expr RP",
142108
+ /* 176 */ "expr ::= expr AND expr",
142109
+ /* 177 */ "expr ::= expr OR expr",
142110
+ /* 178 */ "expr ::= expr LT|GT|GE|LE expr",
142111
+ /* 179 */ "expr ::= expr EQ|NE expr",
142112
+ /* 180 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
142113
+ /* 181 */ "expr ::= expr PLUS|MINUS expr",
142114
+ /* 182 */ "expr ::= expr STAR|SLASH|REM expr",
142115
+ /* 183 */ "expr ::= expr CONCAT expr",
142116
+ /* 184 */ "likeop ::= NOT LIKE_KW|MATCH",
142117
+ /* 185 */ "expr ::= expr likeop expr",
142118
+ /* 186 */ "expr ::= expr likeop expr ESCAPE expr",
142119
+ /* 187 */ "expr ::= expr ISNULL|NOTNULL",
142120
+ /* 188 */ "expr ::= expr NOT NULL",
142121
+ /* 189 */ "expr ::= expr IS expr",
142122
+ /* 190 */ "expr ::= expr IS NOT expr",
142123
+ /* 191 */ "expr ::= NOT expr",
142124
+ /* 192 */ "expr ::= BITNOT expr",
142125
+ /* 193 */ "expr ::= MINUS expr",
142126
+ /* 194 */ "expr ::= PLUS expr",
142127
+ /* 195 */ "between_op ::= BETWEEN",
142128
+ /* 196 */ "between_op ::= NOT BETWEEN",
142129
+ /* 197 */ "expr ::= expr between_op expr AND expr",
142130
+ /* 198 */ "in_op ::= IN",
142131
+ /* 199 */ "in_op ::= NOT IN",
142132
+ /* 200 */ "expr ::= expr in_op LP exprlist RP",
142133
+ /* 201 */ "expr ::= LP select RP",
142134
+ /* 202 */ "expr ::= expr in_op LP select RP",
142135
+ /* 203 */ "expr ::= expr in_op nm dbnm paren_exprlist",
142136
+ /* 204 */ "expr ::= EXISTS LP select RP",
142137
+ /* 205 */ "expr ::= CASE case_operand case_exprlist case_else END",
142138
+ /* 206 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
142139
+ /* 207 */ "case_exprlist ::= WHEN expr THEN expr",
142140
+ /* 208 */ "case_else ::= ELSE expr",
142141
+ /* 209 */ "case_else ::=",
142142
+ /* 210 */ "case_operand ::= expr",
142143
+ /* 211 */ "case_operand ::=",
142144
+ /* 212 */ "exprlist ::=",
142145
+ /* 213 */ "nexprlist ::= nexprlist COMMA expr",
142146
+ /* 214 */ "nexprlist ::= expr",
142147
+ /* 215 */ "paren_exprlist ::=",
142148
+ /* 216 */ "paren_exprlist ::= LP exprlist RP",
142149
+ /* 217 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
142150
+ /* 218 */ "uniqueflag ::= UNIQUE",
142151
+ /* 219 */ "uniqueflag ::=",
142152
+ /* 220 */ "eidlist_opt ::=",
142153
+ /* 221 */ "eidlist_opt ::= LP eidlist RP",
142154
+ /* 222 */ "eidlist ::= eidlist COMMA nm collate sortorder",
142155
+ /* 223 */ "eidlist ::= nm collate sortorder",
142156
+ /* 224 */ "collate ::=",
142157
+ /* 225 */ "collate ::= COLLATE ID|STRING",
142158
+ /* 226 */ "cmd ::= DROP INDEX ifexists fullname",
142159
+ /* 227 */ "cmd ::= VACUUM",
142160
+ /* 228 */ "cmd ::= VACUUM nm",
142161
+ /* 229 */ "cmd ::= PRAGMA nm dbnm",
142162
+ /* 230 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
142163
+ /* 231 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
142164
+ /* 232 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
142165
+ /* 233 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
142166
+ /* 234 */ "plus_num ::= PLUS INTEGER|FLOAT",
142167
+ /* 235 */ "minus_num ::= MINUS INTEGER|FLOAT",
142168
+ /* 236 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
142169
+ /* 237 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
142170
+ /* 238 */ "trigger_time ::= BEFORE|AFTER",
142171
+ /* 239 */ "trigger_time ::= INSTEAD OF",
142172
+ /* 240 */ "trigger_time ::=",
142173
+ /* 241 */ "trigger_event ::= DELETE|INSERT",
142174
+ /* 242 */ "trigger_event ::= UPDATE",
142175
+ /* 243 */ "trigger_event ::= UPDATE OF idlist",
142176
+ /* 244 */ "when_clause ::=",
142177
+ /* 245 */ "when_clause ::= WHEN expr",
142178
+ /* 246 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
142179
+ /* 247 */ "trigger_cmd_list ::= trigger_cmd SEMI",
142180
+ /* 248 */ "trnm ::= nm DOT nm",
142181
+ /* 249 */ "tridxby ::= INDEXED BY nm",
142182
+ /* 250 */ "tridxby ::= NOT INDEXED",
142183
+ /* 251 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
142184
+ /* 252 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
142185
+ /* 253 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
142186
+ /* 254 */ "trigger_cmd ::= scanpt select scanpt",
142187
+ /* 255 */ "expr ::= RAISE LP IGNORE RP",
142188
+ /* 256 */ "expr ::= RAISE LP raisetype COMMA nm RP",
142189
+ /* 257 */ "raisetype ::= ROLLBACK",
142190
+ /* 258 */ "raisetype ::= ABORT",
142191
+ /* 259 */ "raisetype ::= FAIL",
142192
+ /* 260 */ "cmd ::= DROP TRIGGER ifexists fullname",
142193
+ /* 261 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
142194
+ /* 262 */ "cmd ::= DETACH database_kw_opt expr",
142195
+ /* 263 */ "key_opt ::=",
142196
+ /* 264 */ "key_opt ::= KEY expr",
142197
+ /* 265 */ "cmd ::= REINDEX",
142198
+ /* 266 */ "cmd ::= REINDEX nm dbnm",
142199
+ /* 267 */ "cmd ::= ANALYZE",
142200
+ /* 268 */ "cmd ::= ANALYZE nm dbnm",
142201
+ /* 269 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
142202
+ /* 270 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
142203
+ /* 271 */ "add_column_fullname ::= fullname",
142204
+ /* 272 */ "cmd ::= create_vtab",
142205
+ /* 273 */ "cmd ::= create_vtab LP vtabarglist RP",
142206
+ /* 274 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
142207
+ /* 275 */ "vtabarg ::=",
142208
+ /* 276 */ "vtabargtoken ::= ANY",
142209
+ /* 277 */ "vtabargtoken ::= lp anylist RP",
142210
+ /* 278 */ "lp ::= LP",
142211
+ /* 279 */ "with ::= WITH wqlist",
142212
+ /* 280 */ "with ::= WITH RECURSIVE wqlist",
142213
+ /* 281 */ "wqlist ::= nm eidlist_opt AS LP select RP",
142214
+ /* 282 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
142215
+ /* 283 */ "input ::= cmdlist",
142216
+ /* 284 */ "cmdlist ::= cmdlist ecmd",
142217
+ /* 285 */ "cmdlist ::= ecmd",
142218
+ /* 286 */ "ecmd ::= SEMI",
142219
+ /* 287 */ "ecmd ::= cmdx SEMI",
142220
+ /* 288 */ "ecmd ::= explain cmdx",
142221
+ /* 289 */ "trans_opt ::=",
142222
+ /* 290 */ "trans_opt ::= TRANSACTION",
142223
+ /* 291 */ "trans_opt ::= TRANSACTION nm",
142224
+ /* 292 */ "savepoint_opt ::= SAVEPOINT",
142225
+ /* 293 */ "savepoint_opt ::=",
142226
+ /* 294 */ "cmd ::= create_table create_table_args",
142227
+ /* 295 */ "columnlist ::= columnlist COMMA columnname carglist",
142228
+ /* 296 */ "columnlist ::= columnname carglist",
142229
+ /* 297 */ "nm ::= ID|INDEXED",
142230
+ /* 298 */ "nm ::= STRING",
142231
+ /* 299 */ "nm ::= JOIN_KW",
142232
+ /* 300 */ "typetoken ::= typename",
142233
+ /* 301 */ "typename ::= ID|STRING",
142234
+ /* 302 */ "signed ::= plus_num",
142235
+ /* 303 */ "signed ::= minus_num",
142236
+ /* 304 */ "carglist ::= carglist ccons",
142237
+ /* 305 */ "carglist ::=",
142238
+ /* 306 */ "ccons ::= NULL onconf",
142239
+ /* 307 */ "conslist_opt ::= COMMA conslist",
142240
+ /* 308 */ "conslist ::= conslist tconscomma tcons",
142241
+ /* 309 */ "conslist ::= tcons",
142242
+ /* 310 */ "tconscomma ::=",
142243
+ /* 311 */ "defer_subclause_opt ::= defer_subclause",
142244
+ /* 312 */ "resolvetype ::= raisetype",
142245
+ /* 313 */ "selectnowith ::= oneselect",
142246
+ /* 314 */ "oneselect ::= values",
142247
+ /* 315 */ "sclp ::= selcollist COMMA",
142248
+ /* 316 */ "as ::= ID|STRING",
142249
+ /* 317 */ "expr ::= term",
142250
+ /* 318 */ "likeop ::= LIKE_KW|MATCH",
142251
+ /* 319 */ "exprlist ::= nexprlist",
142252
+ /* 320 */ "nmnum ::= plus_num",
142253
+ /* 321 */ "nmnum ::= nm",
142254
+ /* 322 */ "nmnum ::= ON",
142255
+ /* 323 */ "nmnum ::= DELETE",
142256
+ /* 324 */ "nmnum ::= DEFAULT",
142257
+ /* 325 */ "plus_num ::= INTEGER|FLOAT",
142258
+ /* 326 */ "foreach_clause ::=",
142259
+ /* 327 */ "foreach_clause ::= FOR EACH ROW",
142260
+ /* 328 */ "trnm ::= nm",
142261
+ /* 329 */ "tridxby ::=",
142262
+ /* 330 */ "database_kw_opt ::= DATABASE",
142263
+ /* 331 */ "database_kw_opt ::=",
142264
+ /* 332 */ "kwcolumn_opt ::=",
142265
+ /* 333 */ "kwcolumn_opt ::= COLUMNKW",
142266
+ /* 334 */ "vtabarglist ::= vtabarg",
142267
+ /* 335 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
142268
+ /* 336 */ "vtabarg ::= vtabarg vtabargtoken",
142269
+ /* 337 */ "anylist ::=",
142270
+ /* 338 */ "anylist ::= anylist LP anylist RP",
142271
+ /* 339 */ "anylist ::= anylist ANY",
142272
+ /* 340 */ "with ::=",
141367142273
};
141368142274
#endif /* NDEBUG */
141369142275
141370142276
141371142277
#if YYSTACKDEPTH<=0
@@ -141410,32 +142316,33 @@
141410142316
# define YYMALLOCARGTYPE size_t
141411142317
#endif
141412142318
141413142319
/* Initialize a new parser that has already been allocated.
141414142320
*/
141415
-SQLITE_PRIVATE void sqlite3ParserInit(void *yypParser){
141416
- yyParser *pParser = (yyParser*)yypParser;
142321
+SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL){
142322
+ yyParser *yypParser = (yyParser*)yypRawParser;
142323
+ sqlite3ParserCTX_STORE
141417142324
#ifdef YYTRACKMAXSTACKDEPTH
141418
- pParser->yyhwm = 0;
142325
+ yypParser->yyhwm = 0;
141419142326
#endif
141420142327
#if YYSTACKDEPTH<=0
141421
- pParser->yytos = NULL;
141422
- pParser->yystack = NULL;
141423
- pParser->yystksz = 0;
141424
- if( yyGrowStack(pParser) ){
141425
- pParser->yystack = &pParser->yystk0;
141426
- pParser->yystksz = 1;
142328
+ yypParser->yytos = NULL;
142329
+ yypParser->yystack = NULL;
142330
+ yypParser->yystksz = 0;
142331
+ if( yyGrowStack(yypParser) ){
142332
+ yypParser->yystack = &yypParser->yystk0;
142333
+ yypParser->yystksz = 1;
141427142334
}
141428142335
#endif
141429142336
#ifndef YYNOERRORRECOVERY
141430
- pParser->yyerrcnt = -1;
142337
+ yypParser->yyerrcnt = -1;
141431142338
#endif
141432
- pParser->yytos = pParser->yystack;
141433
- pParser->yystack[0].stateno = 0;
141434
- pParser->yystack[0].major = 0;
142339
+ yypParser->yytos = yypParser->yystack;
142340
+ yypParser->yystack[0].stateno = 0;
142341
+ yypParser->yystack[0].major = 0;
141435142342
#if YYSTACKDEPTH>0
141436
- pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
142343
+ yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
141437142344
#endif
141438142345
}
141439142346
141440142347
#ifndef sqlite3Parser_ENGINEALWAYSONSTACK
141441142348
/*
@@ -141448,15 +142355,18 @@
141448142355
**
141449142356
** Outputs:
141450142357
** A pointer to a parser. This pointer is used in subsequent calls
141451142358
** to sqlite3Parser and sqlite3ParserFree.
141452142359
*/
141453
-SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
141454
- yyParser *pParser;
141455
- pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
141456
- if( pParser ) sqlite3ParserInit(pParser);
141457
- return pParser;
142360
+SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) sqlite3ParserCTX_PDECL){
142361
+ yyParser *yypParser;
142362
+ yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
142363
+ if( yypParser ){
142364
+ sqlite3ParserCTX_STORE
142365
+ sqlite3ParserInit(yypParser sqlite3ParserCTX_PARAM);
142366
+ }
142367
+ return (void*)yypParser;
141458142368
}
141459142369
#endif /* sqlite3Parser_ENGINEALWAYSONSTACK */
141460142370
141461142371
141462142372
/* The following function deletes the "minor type" or semantic value
@@ -141469,11 +142379,12 @@
141469142379
static void yy_destructor(
141470142380
yyParser *yypParser, /* The parser */
141471142381
YYCODETYPE yymajor, /* Type code for object to destroy */
141472142382
YYMINORTYPE *yypminor /* The object to be destroyed */
141473142383
){
141474
- sqlite3ParserARG_FETCH;
142384
+ sqlite3ParserARG_FETCH
142385
+ sqlite3ParserCTX_FETCH
141475142386
switch( yymajor ){
141476142387
/* Here is inserted the actions which take place when a
141477142388
** terminal or non-terminal is destroyed. This can happen
141478142389
** when the symbol is popped from the stack during a
141479142390
** reduce or during error processing or when a parser is
@@ -141482,76 +142393,77 @@
141482142393
** Note: during a reduce, the only symbols destroyed are those
141483142394
** which appear on the RHS of the rule, but which are *not* used
141484142395
** inside the C code.
141485142396
*/
141486142397
/********* Begin destructor definitions ***************************************/
141487
- case 163: /* select */
141488
- case 195: /* selectnowith */
141489
- case 196: /* oneselect */
141490
- case 207: /* values */
141491
-{
141492
-sqlite3SelectDelete(pParse->db, (yypminor->yy387));
141493
-}
141494
- break;
141495
- case 173: /* term */
141496
- case 174: /* expr */
141497
- case 202: /* where_opt */
141498
- case 204: /* having_opt */
141499
- case 216: /* on_opt */
141500
- case 227: /* case_operand */
141501
- case 229: /* case_else */
141502
- case 238: /* when_clause */
141503
- case 243: /* key_opt */
141504
-{
141505
-sqlite3ExprDelete(pParse->db, (yypminor->yy314));
141506
-}
141507
- break;
141508
- case 178: /* eidlist_opt */
141509
- case 187: /* sortlist */
141510
- case 188: /* eidlist */
141511
- case 200: /* selcollist */
141512
- case 203: /* groupby_opt */
141513
- case 205: /* orderby_opt */
141514
- case 208: /* nexprlist */
141515
- case 209: /* exprlist */
141516
- case 210: /* sclp */
141517
- case 220: /* setlist */
141518
- case 226: /* paren_exprlist */
141519
- case 228: /* case_exprlist */
141520
-{
141521
-sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
141522
-}
141523
- break;
141524
- case 194: /* fullname */
141525
- case 201: /* from */
141526
- case 212: /* seltablist */
141527
- case 213: /* stl_prefix */
141528
-{
141529
-sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
141530
-}
141531
- break;
141532
- case 197: /* wqlist */
141533
-{
141534
-sqlite3WithDelete(pParse->db, (yypminor->yy451));
141535
-}
141536
- break;
141537
- case 217: /* using_opt */
141538
- case 218: /* idlist */
141539
- case 222: /* idlist_opt */
141540
-{
141541
-sqlite3IdListDelete(pParse->db, (yypminor->yy384));
141542
-}
141543
- break;
141544
- case 234: /* trigger_cmd_list */
141545
- case 239: /* trigger_cmd */
141546
-{
141547
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
141548
-}
141549
- break;
141550
- case 236: /* trigger_event */
141551
-{
141552
-sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
142398
+ case 164: /* select */
142399
+ case 196: /* selectnowith */
142400
+ case 197: /* oneselect */
142401
+ case 208: /* values */
142402
+{
142403
+sqlite3SelectDelete(pParse->db, (yypminor->yy399));
142404
+}
142405
+ break;
142406
+ case 174: /* term */
142407
+ case 175: /* expr */
142408
+ case 203: /* where_opt */
142409
+ case 205: /* having_opt */
142410
+ case 217: /* on_opt */
142411
+ case 230: /* case_operand */
142412
+ case 232: /* case_else */
142413
+ case 241: /* when_clause */
142414
+ case 246: /* key_opt */
142415
+{
142416
+sqlite3ExprDelete(pParse->db, (yypminor->yy182));
142417
+}
142418
+ break;
142419
+ case 179: /* eidlist_opt */
142420
+ case 188: /* sortlist */
142421
+ case 189: /* eidlist */
142422
+ case 201: /* selcollist */
142423
+ case 204: /* groupby_opt */
142424
+ case 206: /* orderby_opt */
142425
+ case 209: /* nexprlist */
142426
+ case 210: /* exprlist */
142427
+ case 211: /* sclp */
142428
+ case 222: /* setlist */
142429
+ case 229: /* paren_exprlist */
142430
+ case 231: /* case_exprlist */
142431
+{
142432
+sqlite3ExprListDelete(pParse->db, (yypminor->yy232));
142433
+}
142434
+ break;
142435
+ case 195: /* fullname */
142436
+ case 202: /* from */
142437
+ case 213: /* seltablist */
142438
+ case 214: /* stl_prefix */
142439
+ case 219: /* xfullname */
142440
+{
142441
+sqlite3SrcListDelete(pParse->db, (yypminor->yy427));
142442
+}
142443
+ break;
142444
+ case 198: /* wqlist */
142445
+{
142446
+sqlite3WithDelete(pParse->db, (yypminor->yy91));
142447
+}
142448
+ break;
142449
+ case 218: /* using_opt */
142450
+ case 220: /* idlist */
142451
+ case 224: /* idlist_opt */
142452
+{
142453
+sqlite3IdListDelete(pParse->db, (yypminor->yy510));
142454
+}
142455
+ break;
142456
+ case 237: /* trigger_cmd_list */
142457
+ case 242: /* trigger_cmd */
142458
+{
142459
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy47));
142460
+}
142461
+ break;
142462
+ case 239: /* trigger_event */
142463
+{
142464
+sqlite3IdListDelete(pParse->db, (yypminor->yy300).b);
141553142465
}
141554142466
break;
141555142467
/********* End destructor definitions *****************************************/
141556142468
default: break; /* If no destructor action specified: do nothing */
141557142469
}
@@ -141659,17 +142571,16 @@
141659142571
141660142572
/*
141661142573
** Find the appropriate action for a parser given the terminal
141662142574
** look-ahead token iLookAhead.
141663142575
*/
141664
-static unsigned int yy_find_shift_action(
141665
- yyParser *pParser, /* The parser */
141666
- YYCODETYPE iLookAhead /* The look-ahead token */
142576
+static YYACTIONTYPE yy_find_shift_action(
142577
+ YYCODETYPE iLookAhead, /* The look-ahead token */
142578
+ YYACTIONTYPE stateno /* Current state number */
141667142579
){
141668142580
int i;
141669
- int stateno = pParser->yytos->stateno;
141670
-
142581
+
141671142582
if( stateno>YY_MAX_SHIFT ) return stateno;
141672142583
assert( stateno <= YY_SHIFT_COUNT );
141673142584
#if defined(YYCOVERAGE)
141674142585
yycoverage[stateno][iLookAhead] = 1;
141675142586
#endif
@@ -141729,11 +142640,11 @@
141729142640
/*
141730142641
** Find the appropriate action for a parser given the non-terminal
141731142642
** look-ahead token iLookAhead.
141732142643
*/
141733142644
static int yy_find_reduce_action(
141734
- int stateno, /* Current state number */
142645
+ YYACTIONTYPE stateno, /* Current state number */
141735142646
YYCODETYPE iLookAhead /* The look-ahead token */
141736142647
){
141737142648
int i;
141738142649
#ifdef YYERRORSYMBOL
141739142650
if( stateno>YY_REDUCE_COUNT ){
@@ -141758,11 +142669,12 @@
141758142669
141759142670
/*
141760142671
** The following routine is called if the stack overflows.
141761142672
*/
141762142673
static void yyStackOverflow(yyParser *yypParser){
141763
- sqlite3ParserARG_FETCH;
142674
+ sqlite3ParserARG_FETCH
142675
+ sqlite3ParserCTX_FETCH
141764142676
#ifndef NDEBUG
141765142677
if( yyTraceFILE ){
141766142678
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
141767142679
}
141768142680
#endif
@@ -141771,11 +142683,12 @@
141771142683
** stack every overflows */
141772142684
/******** Begin %stack_overflow code ******************************************/
141773142685
141774142686
sqlite3ErrorMsg(pParse, "parser stack overflow");
141775142687
/******** End %stack_overflow code ********************************************/
141776
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
142688
+ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
142689
+ sqlite3ParserCTX_STORE
141777142690
}
141778142691
141779142692
/*
141780142693
** Print tracing information for a SHIFT action
141781142694
*/
@@ -141800,12 +142713,12 @@
141800142713
/*
141801142714
** Perform a shift action.
141802142715
*/
141803142716
static void yy_shift(
141804142717
yyParser *yypParser, /* The parser to be shifted */
141805
- int yyNewState, /* The new state to shift in */
141806
- int yyMajor, /* The major token to shift in */
142718
+ YYACTIONTYPE yyNewState, /* The new state to shift in */
142719
+ YYCODETYPE yyMajor, /* The major token to shift in */
141807142720
sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */
141808142721
){
141809142722
yyStackEntry *yytos;
141810142723
yypParser->yytos++;
141811142724
#ifdef YYTRACKMAXSTACKDEPTH
@@ -141831,12 +142744,12 @@
141831142744
#endif
141832142745
if( yyNewState > YY_MAX_SHIFT ){
141833142746
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
141834142747
}
141835142748
yytos = yypParser->yytos;
141836
- yytos->stateno = (YYACTIONTYPE)yyNewState;
141837
- yytos->major = (YYCODETYPE)yyMajor;
142749
+ yytos->stateno = yyNewState;
142750
+ yytos->major = yyMajor;
141838142751
yytos->minor.yy0 = yyMinor;
141839142752
yyTraceShift(yypParser, yyNewState, "Shift");
141840142753
}
141841142754
141842142755
/* The following table contains information about every rule that
@@ -141844,343 +142757,351 @@
141844142757
*/
141845142758
static const struct {
141846142759
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
141847142760
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
141848142761
} yyRuleInfo[] = {
141849
- { 147, -1 }, /* (0) explain ::= EXPLAIN */
141850
- { 147, -3 }, /* (1) explain ::= EXPLAIN QUERY PLAN */
142762
+ { 149, -1 }, /* (0) explain ::= EXPLAIN */
142763
+ { 149, -3 }, /* (1) explain ::= EXPLAIN QUERY PLAN */
141851142764
{ 148, -1 }, /* (2) cmdx ::= cmd */
141852
- { 149, -3 }, /* (3) cmd ::= BEGIN transtype trans_opt */
141853
- { 150, 0 }, /* (4) transtype ::= */
141854
- { 150, -1 }, /* (5) transtype ::= DEFERRED */
141855
- { 150, -1 }, /* (6) transtype ::= IMMEDIATE */
141856
- { 150, -1 }, /* (7) transtype ::= EXCLUSIVE */
141857
- { 149, -2 }, /* (8) cmd ::= COMMIT|END trans_opt */
141858
- { 149, -2 }, /* (9) cmd ::= ROLLBACK trans_opt */
141859
- { 149, -2 }, /* (10) cmd ::= SAVEPOINT nm */
141860
- { 149, -3 }, /* (11) cmd ::= RELEASE savepoint_opt nm */
141861
- { 149, -5 }, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
141862
- { 154, -6 }, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
141863
- { 156, -1 }, /* (14) createkw ::= CREATE */
141864
- { 158, 0 }, /* (15) ifnotexists ::= */
141865
- { 158, -3 }, /* (16) ifnotexists ::= IF NOT EXISTS */
141866
- { 157, -1 }, /* (17) temp ::= TEMP */
141867
- { 157, 0 }, /* (18) temp ::= */
141868
- { 155, -5 }, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
141869
- { 155, -2 }, /* (20) create_table_args ::= AS select */
141870
- { 162, 0 }, /* (21) table_options ::= */
141871
- { 162, -2 }, /* (22) table_options ::= WITHOUT nm */
141872
- { 164, -2 }, /* (23) columnname ::= nm typetoken */
141873
- { 166, 0 }, /* (24) typetoken ::= */
141874
- { 166, -4 }, /* (25) typetoken ::= typename LP signed RP */
141875
- { 166, -6 }, /* (26) typetoken ::= typename LP signed COMMA signed RP */
141876
- { 167, -2 }, /* (27) typename ::= typename ID|STRING */
141877
- { 171, 0 }, /* (28) scanpt ::= */
141878
- { 172, -2 }, /* (29) ccons ::= CONSTRAINT nm */
141879
- { 172, -4 }, /* (30) ccons ::= DEFAULT scanpt term scanpt */
141880
- { 172, -4 }, /* (31) ccons ::= DEFAULT LP expr RP */
141881
- { 172, -4 }, /* (32) ccons ::= DEFAULT PLUS term scanpt */
141882
- { 172, -4 }, /* (33) ccons ::= DEFAULT MINUS term scanpt */
141883
- { 172, -3 }, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
141884
- { 172, -3 }, /* (35) ccons ::= NOT NULL onconf */
141885
- { 172, -5 }, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
141886
- { 172, -2 }, /* (37) ccons ::= UNIQUE onconf */
141887
- { 172, -4 }, /* (38) ccons ::= CHECK LP expr RP */
141888
- { 172, -4 }, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
141889
- { 172, -1 }, /* (40) ccons ::= defer_subclause */
141890
- { 172, -2 }, /* (41) ccons ::= COLLATE ID|STRING */
141891
- { 177, 0 }, /* (42) autoinc ::= */
141892
- { 177, -1 }, /* (43) autoinc ::= AUTOINCR */
141893
- { 179, 0 }, /* (44) refargs ::= */
141894
- { 179, -2 }, /* (45) refargs ::= refargs refarg */
141895
- { 181, -2 }, /* (46) refarg ::= MATCH nm */
141896
- { 181, -3 }, /* (47) refarg ::= ON INSERT refact */
141897
- { 181, -3 }, /* (48) refarg ::= ON DELETE refact */
141898
- { 181, -3 }, /* (49) refarg ::= ON UPDATE refact */
141899
- { 182, -2 }, /* (50) refact ::= SET NULL */
141900
- { 182, -2 }, /* (51) refact ::= SET DEFAULT */
141901
- { 182, -1 }, /* (52) refact ::= CASCADE */
141902
- { 182, -1 }, /* (53) refact ::= RESTRICT */
141903
- { 182, -2 }, /* (54) refact ::= NO ACTION */
141904
- { 180, -3 }, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
141905
- { 180, -2 }, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
141906
- { 183, 0 }, /* (57) init_deferred_pred_opt ::= */
141907
- { 183, -2 }, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
141908
- { 183, -2 }, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
141909
- { 161, 0 }, /* (60) conslist_opt ::= */
141910
- { 185, -1 }, /* (61) tconscomma ::= COMMA */
141911
- { 186, -2 }, /* (62) tcons ::= CONSTRAINT nm */
141912
- { 186, -7 }, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
141913
- { 186, -5 }, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
141914
- { 186, -5 }, /* (65) tcons ::= CHECK LP expr RP onconf */
141915
- { 186, -10 }, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
141916
- { 189, 0 }, /* (67) defer_subclause_opt ::= */
141917
- { 175, 0 }, /* (68) onconf ::= */
141918
- { 175, -3 }, /* (69) onconf ::= ON CONFLICT resolvetype */
141919
- { 190, 0 }, /* (70) orconf ::= */
141920
- { 190, -2 }, /* (71) orconf ::= OR resolvetype */
141921
- { 191, -1 }, /* (72) resolvetype ::= IGNORE */
141922
- { 191, -1 }, /* (73) resolvetype ::= REPLACE */
141923
- { 149, -4 }, /* (74) cmd ::= DROP TABLE ifexists fullname */
141924
- { 193, -2 }, /* (75) ifexists ::= IF EXISTS */
141925
- { 193, 0 }, /* (76) ifexists ::= */
141926
- { 149, -9 }, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
141927
- { 149, -4 }, /* (78) cmd ::= DROP VIEW ifexists fullname */
141928
- { 149, -1 }, /* (79) cmd ::= select */
141929
- { 163, -3 }, /* (80) select ::= WITH wqlist selectnowith */
141930
- { 163, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
141931
- { 163, -1 }, /* (82) select ::= selectnowith */
141932
- { 195, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
141933
- { 198, -1 }, /* (84) multiselect_op ::= UNION */
141934
- { 198, -2 }, /* (85) multiselect_op ::= UNION ALL */
141935
- { 198, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
141936
- { 196, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
141937
- { 207, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
141938
- { 207, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
141939
- { 199, -1 }, /* (90) distinct ::= DISTINCT */
141940
- { 199, -1 }, /* (91) distinct ::= ALL */
141941
- { 199, 0 }, /* (92) distinct ::= */
141942
- { 210, 0 }, /* (93) sclp ::= */
141943
- { 200, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
141944
- { 200, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
141945
- { 200, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
141946
- { 211, -2 }, /* (97) as ::= AS nm */
141947
- { 211, 0 }, /* (98) as ::= */
141948
- { 201, 0 }, /* (99) from ::= */
141949
- { 201, -2 }, /* (100) from ::= FROM seltablist */
141950
- { 213, -2 }, /* (101) stl_prefix ::= seltablist joinop */
141951
- { 213, 0 }, /* (102) stl_prefix ::= */
141952
- { 212, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
141953
- { 212, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
141954
- { 212, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
141955
- { 212, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
141956
- { 159, 0 }, /* (107) dbnm ::= */
141957
- { 159, -2 }, /* (108) dbnm ::= DOT nm */
141958
- { 194, -1 }, /* (109) fullname ::= nm */
141959
- { 194, -3 }, /* (110) fullname ::= nm DOT nm */
141960
- { 214, -1 }, /* (111) joinop ::= COMMA|JOIN */
141961
- { 214, -2 }, /* (112) joinop ::= JOIN_KW JOIN */
141962
- { 214, -3 }, /* (113) joinop ::= JOIN_KW nm JOIN */
141963
- { 214, -4 }, /* (114) joinop ::= JOIN_KW nm nm JOIN */
141964
- { 216, -2 }, /* (115) on_opt ::= ON expr */
141965
- { 216, 0 }, /* (116) on_opt ::= */
141966
- { 215, 0 }, /* (117) indexed_opt ::= */
141967
- { 215, -3 }, /* (118) indexed_opt ::= INDEXED BY nm */
141968
- { 215, -2 }, /* (119) indexed_opt ::= NOT INDEXED */
141969
- { 217, -4 }, /* (120) using_opt ::= USING LP idlist RP */
141970
- { 217, 0 }, /* (121) using_opt ::= */
141971
- { 205, 0 }, /* (122) orderby_opt ::= */
141972
- { 205, -3 }, /* (123) orderby_opt ::= ORDER BY sortlist */
141973
- { 187, -4 }, /* (124) sortlist ::= sortlist COMMA expr sortorder */
141974
- { 187, -2 }, /* (125) sortlist ::= expr sortorder */
141975
- { 176, -1 }, /* (126) sortorder ::= ASC */
141976
- { 176, -1 }, /* (127) sortorder ::= DESC */
141977
- { 176, 0 }, /* (128) sortorder ::= */
141978
- { 203, 0 }, /* (129) groupby_opt ::= */
141979
- { 203, -3 }, /* (130) groupby_opt ::= GROUP BY nexprlist */
141980
- { 204, 0 }, /* (131) having_opt ::= */
141981
- { 204, -2 }, /* (132) having_opt ::= HAVING expr */
141982
- { 206, 0 }, /* (133) limit_opt ::= */
141983
- { 206, -2 }, /* (134) limit_opt ::= LIMIT expr */
141984
- { 206, -4 }, /* (135) limit_opt ::= LIMIT expr OFFSET expr */
141985
- { 206, -4 }, /* (136) limit_opt ::= LIMIT expr COMMA expr */
141986
- { 149, -6 }, /* (137) cmd ::= with DELETE FROM fullname indexed_opt where_opt */
141987
- { 202, 0 }, /* (138) where_opt ::= */
141988
- { 202, -2 }, /* (139) where_opt ::= WHERE expr */
141989
- { 149, -8 }, /* (140) cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
141990
- { 220, -5 }, /* (141) setlist ::= setlist COMMA nm EQ expr */
141991
- { 220, -7 }, /* (142) setlist ::= setlist COMMA LP idlist RP EQ expr */
141992
- { 220, -3 }, /* (143) setlist ::= nm EQ expr */
141993
- { 220, -5 }, /* (144) setlist ::= LP idlist RP EQ expr */
141994
- { 149, -6 }, /* (145) cmd ::= with insert_cmd INTO fullname idlist_opt select */
141995
- { 149, -7 }, /* (146) cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
141996
- { 221, -2 }, /* (147) insert_cmd ::= INSERT orconf */
141997
- { 221, -1 }, /* (148) insert_cmd ::= REPLACE */
141998
- { 222, 0 }, /* (149) idlist_opt ::= */
141999
- { 222, -3 }, /* (150) idlist_opt ::= LP idlist RP */
142000
- { 218, -3 }, /* (151) idlist ::= idlist COMMA nm */
142001
- { 218, -1 }, /* (152) idlist ::= nm */
142002
- { 174, -3 }, /* (153) expr ::= LP expr RP */
142003
- { 174, -1 }, /* (154) expr ::= ID|INDEXED */
142004
- { 174, -1 }, /* (155) expr ::= JOIN_KW */
142005
- { 174, -3 }, /* (156) expr ::= nm DOT nm */
142006
- { 174, -5 }, /* (157) expr ::= nm DOT nm DOT nm */
142007
- { 173, -1 }, /* (158) term ::= NULL|FLOAT|BLOB */
142008
- { 173, -1 }, /* (159) term ::= STRING */
142009
- { 173, -1 }, /* (160) term ::= INTEGER */
142010
- { 174, -1 }, /* (161) expr ::= VARIABLE */
142011
- { 174, -3 }, /* (162) expr ::= expr COLLATE ID|STRING */
142012
- { 174, -6 }, /* (163) expr ::= CAST LP expr AS typetoken RP */
142013
- { 174, -5 }, /* (164) expr ::= ID|INDEXED LP distinct exprlist RP */
142014
- { 174, -4 }, /* (165) expr ::= ID|INDEXED LP STAR RP */
142015
- { 173, -1 }, /* (166) term ::= CTIME_KW */
142016
- { 174, -5 }, /* (167) expr ::= LP nexprlist COMMA expr RP */
142017
- { 174, -3 }, /* (168) expr ::= expr AND expr */
142018
- { 174, -3 }, /* (169) expr ::= expr OR expr */
142019
- { 174, -3 }, /* (170) expr ::= expr LT|GT|GE|LE expr */
142020
- { 174, -3 }, /* (171) expr ::= expr EQ|NE expr */
142021
- { 174, -3 }, /* (172) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
142022
- { 174, -3 }, /* (173) expr ::= expr PLUS|MINUS expr */
142023
- { 174, -3 }, /* (174) expr ::= expr STAR|SLASH|REM expr */
142024
- { 174, -3 }, /* (175) expr ::= expr CONCAT expr */
142025
- { 223, -2 }, /* (176) likeop ::= NOT LIKE_KW|MATCH */
142026
- { 174, -3 }, /* (177) expr ::= expr likeop expr */
142027
- { 174, -5 }, /* (178) expr ::= expr likeop expr ESCAPE expr */
142028
- { 174, -2 }, /* (179) expr ::= expr ISNULL|NOTNULL */
142029
- { 174, -3 }, /* (180) expr ::= expr NOT NULL */
142030
- { 174, -3 }, /* (181) expr ::= expr IS expr */
142031
- { 174, -4 }, /* (182) expr ::= expr IS NOT expr */
142032
- { 174, -2 }, /* (183) expr ::= NOT expr */
142033
- { 174, -2 }, /* (184) expr ::= BITNOT expr */
142034
- { 174, -2 }, /* (185) expr ::= MINUS expr */
142035
- { 174, -2 }, /* (186) expr ::= PLUS expr */
142036
- { 224, -1 }, /* (187) between_op ::= BETWEEN */
142037
- { 224, -2 }, /* (188) between_op ::= NOT BETWEEN */
142038
- { 174, -5 }, /* (189) expr ::= expr between_op expr AND expr */
142039
- { 225, -1 }, /* (190) in_op ::= IN */
142040
- { 225, -2 }, /* (191) in_op ::= NOT IN */
142041
- { 174, -5 }, /* (192) expr ::= expr in_op LP exprlist RP */
142042
- { 174, -3 }, /* (193) expr ::= LP select RP */
142043
- { 174, -5 }, /* (194) expr ::= expr in_op LP select RP */
142044
- { 174, -5 }, /* (195) expr ::= expr in_op nm dbnm paren_exprlist */
142045
- { 174, -4 }, /* (196) expr ::= EXISTS LP select RP */
142046
- { 174, -5 }, /* (197) expr ::= CASE case_operand case_exprlist case_else END */
142047
- { 228, -5 }, /* (198) case_exprlist ::= case_exprlist WHEN expr THEN expr */
142048
- { 228, -4 }, /* (199) case_exprlist ::= WHEN expr THEN expr */
142049
- { 229, -2 }, /* (200) case_else ::= ELSE expr */
142050
- { 229, 0 }, /* (201) case_else ::= */
142051
- { 227, -1 }, /* (202) case_operand ::= expr */
142052
- { 227, 0 }, /* (203) case_operand ::= */
142053
- { 209, 0 }, /* (204) exprlist ::= */
142054
- { 208, -3 }, /* (205) nexprlist ::= nexprlist COMMA expr */
142055
- { 208, -1 }, /* (206) nexprlist ::= expr */
142056
- { 226, 0 }, /* (207) paren_exprlist ::= */
142057
- { 226, -3 }, /* (208) paren_exprlist ::= LP exprlist RP */
142058
- { 149, -12 }, /* (209) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
142059
- { 230, -1 }, /* (210) uniqueflag ::= UNIQUE */
142060
- { 230, 0 }, /* (211) uniqueflag ::= */
142061
- { 178, 0 }, /* (212) eidlist_opt ::= */
142062
- { 178, -3 }, /* (213) eidlist_opt ::= LP eidlist RP */
142063
- { 188, -5 }, /* (214) eidlist ::= eidlist COMMA nm collate sortorder */
142064
- { 188, -3 }, /* (215) eidlist ::= nm collate sortorder */
142065
- { 231, 0 }, /* (216) collate ::= */
142066
- { 231, -2 }, /* (217) collate ::= COLLATE ID|STRING */
142067
- { 149, -4 }, /* (218) cmd ::= DROP INDEX ifexists fullname */
142068
- { 149, -1 }, /* (219) cmd ::= VACUUM */
142069
- { 149, -2 }, /* (220) cmd ::= VACUUM nm */
142070
- { 149, -3 }, /* (221) cmd ::= PRAGMA nm dbnm */
142071
- { 149, -5 }, /* (222) cmd ::= PRAGMA nm dbnm EQ nmnum */
142072
- { 149, -6 }, /* (223) cmd ::= PRAGMA nm dbnm LP nmnum RP */
142073
- { 149, -5 }, /* (224) cmd ::= PRAGMA nm dbnm EQ minus_num */
142074
- { 149, -6 }, /* (225) cmd ::= PRAGMA nm dbnm LP minus_num RP */
142075
- { 169, -2 }, /* (226) plus_num ::= PLUS INTEGER|FLOAT */
142076
- { 170, -2 }, /* (227) minus_num ::= MINUS INTEGER|FLOAT */
142077
- { 149, -5 }, /* (228) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
142078
- { 233, -11 }, /* (229) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
142079
- { 235, -1 }, /* (230) trigger_time ::= BEFORE|AFTER */
142080
- { 235, -2 }, /* (231) trigger_time ::= INSTEAD OF */
142081
- { 235, 0 }, /* (232) trigger_time ::= */
142082
- { 236, -1 }, /* (233) trigger_event ::= DELETE|INSERT */
142083
- { 236, -1 }, /* (234) trigger_event ::= UPDATE */
142084
- { 236, -3 }, /* (235) trigger_event ::= UPDATE OF idlist */
142085
- { 238, 0 }, /* (236) when_clause ::= */
142086
- { 238, -2 }, /* (237) when_clause ::= WHEN expr */
142087
- { 234, -3 }, /* (238) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
142088
- { 234, -2 }, /* (239) trigger_cmd_list ::= trigger_cmd SEMI */
142089
- { 240, -3 }, /* (240) trnm ::= nm DOT nm */
142090
- { 241, -3 }, /* (241) tridxby ::= INDEXED BY nm */
142091
- { 241, -2 }, /* (242) tridxby ::= NOT INDEXED */
142092
- { 239, -8 }, /* (243) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
142093
- { 239, -7 }, /* (244) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt */
142094
- { 239, -6 }, /* (245) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
142095
- { 239, -3 }, /* (246) trigger_cmd ::= scanpt select scanpt */
142096
- { 174, -4 }, /* (247) expr ::= RAISE LP IGNORE RP */
142097
- { 174, -6 }, /* (248) expr ::= RAISE LP raisetype COMMA nm RP */
142098
- { 192, -1 }, /* (249) raisetype ::= ROLLBACK */
142099
- { 192, -1 }, /* (250) raisetype ::= ABORT */
142100
- { 192, -1 }, /* (251) raisetype ::= FAIL */
142101
- { 149, -4 }, /* (252) cmd ::= DROP TRIGGER ifexists fullname */
142102
- { 149, -6 }, /* (253) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
142103
- { 149, -3 }, /* (254) cmd ::= DETACH database_kw_opt expr */
142104
- { 243, 0 }, /* (255) key_opt ::= */
142105
- { 243, -2 }, /* (256) key_opt ::= KEY expr */
142106
- { 149, -1 }, /* (257) cmd ::= REINDEX */
142107
- { 149, -3 }, /* (258) cmd ::= REINDEX nm dbnm */
142108
- { 149, -1 }, /* (259) cmd ::= ANALYZE */
142109
- { 149, -3 }, /* (260) cmd ::= ANALYZE nm dbnm */
142110
- { 149, -6 }, /* (261) cmd ::= ALTER TABLE fullname RENAME TO nm */
142111
- { 149, -7 }, /* (262) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
142112
- { 244, -1 }, /* (263) add_column_fullname ::= fullname */
142113
- { 149, -1 }, /* (264) cmd ::= create_vtab */
142114
- { 149, -4 }, /* (265) cmd ::= create_vtab LP vtabarglist RP */
142115
- { 246, -8 }, /* (266) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
142116
- { 248, 0 }, /* (267) vtabarg ::= */
142117
- { 249, -1 }, /* (268) vtabargtoken ::= ANY */
142118
- { 249, -3 }, /* (269) vtabargtoken ::= lp anylist RP */
142119
- { 250, -1 }, /* (270) lp ::= LP */
142120
- { 219, -2 }, /* (271) with ::= WITH wqlist */
142121
- { 219, -3 }, /* (272) with ::= WITH RECURSIVE wqlist */
142122
- { 197, -6 }, /* (273) wqlist ::= nm eidlist_opt AS LP select RP */
142123
- { 197, -8 }, /* (274) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
142124
- { 144, -1 }, /* (275) input ::= cmdlist */
142125
- { 145, -2 }, /* (276) cmdlist ::= cmdlist ecmd */
142126
- { 145, -1 }, /* (277) cmdlist ::= ecmd */
142127
- { 146, -1 }, /* (278) ecmd ::= SEMI */
142128
- { 146, -3 }, /* (279) ecmd ::= explain cmdx SEMI */
142129
- { 147, 0 }, /* (280) explain ::= */
142130
- { 151, 0 }, /* (281) trans_opt ::= */
142131
- { 151, -1 }, /* (282) trans_opt ::= TRANSACTION */
142132
- { 151, -2 }, /* (283) trans_opt ::= TRANSACTION nm */
142133
- { 153, -1 }, /* (284) savepoint_opt ::= SAVEPOINT */
142134
- { 153, 0 }, /* (285) savepoint_opt ::= */
142135
- { 149, -2 }, /* (286) cmd ::= create_table create_table_args */
142136
- { 160, -4 }, /* (287) columnlist ::= columnlist COMMA columnname carglist */
142137
- { 160, -2 }, /* (288) columnlist ::= columnname carglist */
142138
- { 152, -1 }, /* (289) nm ::= ID|INDEXED */
142139
- { 152, -1 }, /* (290) nm ::= STRING */
142140
- { 152, -1 }, /* (291) nm ::= JOIN_KW */
142141
- { 166, -1 }, /* (292) typetoken ::= typename */
142142
- { 167, -1 }, /* (293) typename ::= ID|STRING */
142143
- { 168, -1 }, /* (294) signed ::= plus_num */
142144
- { 168, -1 }, /* (295) signed ::= minus_num */
142145
- { 165, -2 }, /* (296) carglist ::= carglist ccons */
142146
- { 165, 0 }, /* (297) carglist ::= */
142147
- { 172, -2 }, /* (298) ccons ::= NULL onconf */
142148
- { 161, -2 }, /* (299) conslist_opt ::= COMMA conslist */
142149
- { 184, -3 }, /* (300) conslist ::= conslist tconscomma tcons */
142150
- { 184, -1 }, /* (301) conslist ::= tcons */
142151
- { 185, 0 }, /* (302) tconscomma ::= */
142152
- { 189, -1 }, /* (303) defer_subclause_opt ::= defer_subclause */
142153
- { 191, -1 }, /* (304) resolvetype ::= raisetype */
142154
- { 195, -1 }, /* (305) selectnowith ::= oneselect */
142155
- { 196, -1 }, /* (306) oneselect ::= values */
142156
- { 210, -2 }, /* (307) sclp ::= selcollist COMMA */
142157
- { 211, -1 }, /* (308) as ::= ID|STRING */
142158
- { 174, -1 }, /* (309) expr ::= term */
142159
- { 223, -1 }, /* (310) likeop ::= LIKE_KW|MATCH */
142160
- { 209, -1 }, /* (311) exprlist ::= nexprlist */
142161
- { 232, -1 }, /* (312) nmnum ::= plus_num */
142162
- { 232, -1 }, /* (313) nmnum ::= nm */
142163
- { 232, -1 }, /* (314) nmnum ::= ON */
142164
- { 232, -1 }, /* (315) nmnum ::= DELETE */
142165
- { 232, -1 }, /* (316) nmnum ::= DEFAULT */
142166
- { 169, -1 }, /* (317) plus_num ::= INTEGER|FLOAT */
142167
- { 237, 0 }, /* (318) foreach_clause ::= */
142168
- { 237, -3 }, /* (319) foreach_clause ::= FOR EACH ROW */
142169
- { 240, -1 }, /* (320) trnm ::= nm */
142170
- { 241, 0 }, /* (321) tridxby ::= */
142171
- { 242, -1 }, /* (322) database_kw_opt ::= DATABASE */
142172
- { 242, 0 }, /* (323) database_kw_opt ::= */
142173
- { 245, 0 }, /* (324) kwcolumn_opt ::= */
142174
- { 245, -1 }, /* (325) kwcolumn_opt ::= COLUMNKW */
142175
- { 247, -1 }, /* (326) vtabarglist ::= vtabarg */
142176
- { 247, -3 }, /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */
142177
- { 248, -2 }, /* (328) vtabarg ::= vtabarg vtabargtoken */
142178
- { 251, 0 }, /* (329) anylist ::= */
142179
- { 251, -4 }, /* (330) anylist ::= anylist LP anylist RP */
142180
- { 251, -2 }, /* (331) anylist ::= anylist ANY */
142181
- { 219, 0 }, /* (332) with ::= */
142765
+ { 150, -3 }, /* (3) cmd ::= BEGIN transtype trans_opt */
142766
+ { 151, 0 }, /* (4) transtype ::= */
142767
+ { 151, -1 }, /* (5) transtype ::= DEFERRED */
142768
+ { 151, -1 }, /* (6) transtype ::= IMMEDIATE */
142769
+ { 151, -1 }, /* (7) transtype ::= EXCLUSIVE */
142770
+ { 150, -2 }, /* (8) cmd ::= COMMIT|END trans_opt */
142771
+ { 150, -2 }, /* (9) cmd ::= ROLLBACK trans_opt */
142772
+ { 150, -2 }, /* (10) cmd ::= SAVEPOINT nm */
142773
+ { 150, -3 }, /* (11) cmd ::= RELEASE savepoint_opt nm */
142774
+ { 150, -5 }, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
142775
+ { 155, -6 }, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
142776
+ { 157, -1 }, /* (14) createkw ::= CREATE */
142777
+ { 159, 0 }, /* (15) ifnotexists ::= */
142778
+ { 159, -3 }, /* (16) ifnotexists ::= IF NOT EXISTS */
142779
+ { 158, -1 }, /* (17) temp ::= TEMP */
142780
+ { 158, 0 }, /* (18) temp ::= */
142781
+ { 156, -5 }, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
142782
+ { 156, -2 }, /* (20) create_table_args ::= AS select */
142783
+ { 163, 0 }, /* (21) table_options ::= */
142784
+ { 163, -2 }, /* (22) table_options ::= WITHOUT nm */
142785
+ { 165, -2 }, /* (23) columnname ::= nm typetoken */
142786
+ { 167, 0 }, /* (24) typetoken ::= */
142787
+ { 167, -4 }, /* (25) typetoken ::= typename LP signed RP */
142788
+ { 167, -6 }, /* (26) typetoken ::= typename LP signed COMMA signed RP */
142789
+ { 168, -2 }, /* (27) typename ::= typename ID|STRING */
142790
+ { 172, 0 }, /* (28) scanpt ::= */
142791
+ { 173, -2 }, /* (29) ccons ::= CONSTRAINT nm */
142792
+ { 173, -4 }, /* (30) ccons ::= DEFAULT scanpt term scanpt */
142793
+ { 173, -4 }, /* (31) ccons ::= DEFAULT LP expr RP */
142794
+ { 173, -4 }, /* (32) ccons ::= DEFAULT PLUS term scanpt */
142795
+ { 173, -4 }, /* (33) ccons ::= DEFAULT MINUS term scanpt */
142796
+ { 173, -3 }, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
142797
+ { 173, -3 }, /* (35) ccons ::= NOT NULL onconf */
142798
+ { 173, -5 }, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
142799
+ { 173, -2 }, /* (37) ccons ::= UNIQUE onconf */
142800
+ { 173, -4 }, /* (38) ccons ::= CHECK LP expr RP */
142801
+ { 173, -4 }, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
142802
+ { 173, -1 }, /* (40) ccons ::= defer_subclause */
142803
+ { 173, -2 }, /* (41) ccons ::= COLLATE ID|STRING */
142804
+ { 178, 0 }, /* (42) autoinc ::= */
142805
+ { 178, -1 }, /* (43) autoinc ::= AUTOINCR */
142806
+ { 180, 0 }, /* (44) refargs ::= */
142807
+ { 180, -2 }, /* (45) refargs ::= refargs refarg */
142808
+ { 182, -2 }, /* (46) refarg ::= MATCH nm */
142809
+ { 182, -3 }, /* (47) refarg ::= ON INSERT refact */
142810
+ { 182, -3 }, /* (48) refarg ::= ON DELETE refact */
142811
+ { 182, -3 }, /* (49) refarg ::= ON UPDATE refact */
142812
+ { 183, -2 }, /* (50) refact ::= SET NULL */
142813
+ { 183, -2 }, /* (51) refact ::= SET DEFAULT */
142814
+ { 183, -1 }, /* (52) refact ::= CASCADE */
142815
+ { 183, -1 }, /* (53) refact ::= RESTRICT */
142816
+ { 183, -2 }, /* (54) refact ::= NO ACTION */
142817
+ { 181, -3 }, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
142818
+ { 181, -2 }, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
142819
+ { 184, 0 }, /* (57) init_deferred_pred_opt ::= */
142820
+ { 184, -2 }, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
142821
+ { 184, -2 }, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
142822
+ { 162, 0 }, /* (60) conslist_opt ::= */
142823
+ { 186, -1 }, /* (61) tconscomma ::= COMMA */
142824
+ { 187, -2 }, /* (62) tcons ::= CONSTRAINT nm */
142825
+ { 187, -7 }, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
142826
+ { 187, -5 }, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
142827
+ { 187, -5 }, /* (65) tcons ::= CHECK LP expr RP onconf */
142828
+ { 187, -10 }, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
142829
+ { 190, 0 }, /* (67) defer_subclause_opt ::= */
142830
+ { 176, 0 }, /* (68) onconf ::= */
142831
+ { 176, -3 }, /* (69) onconf ::= ON CONFLICT resolvetype */
142832
+ { 191, 0 }, /* (70) orconf ::= */
142833
+ { 191, -2 }, /* (71) orconf ::= OR resolvetype */
142834
+ { 192, -1 }, /* (72) resolvetype ::= IGNORE */
142835
+ { 192, -1 }, /* (73) resolvetype ::= REPLACE */
142836
+ { 150, -4 }, /* (74) cmd ::= DROP TABLE ifexists fullname */
142837
+ { 194, -2 }, /* (75) ifexists ::= IF EXISTS */
142838
+ { 194, 0 }, /* (76) ifexists ::= */
142839
+ { 150, -9 }, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
142840
+ { 150, -4 }, /* (78) cmd ::= DROP VIEW ifexists fullname */
142841
+ { 150, -1 }, /* (79) cmd ::= select */
142842
+ { 164, -3 }, /* (80) select ::= WITH wqlist selectnowith */
142843
+ { 164, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
142844
+ { 164, -1 }, /* (82) select ::= selectnowith */
142845
+ { 196, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
142846
+ { 199, -1 }, /* (84) multiselect_op ::= UNION */
142847
+ { 199, -2 }, /* (85) multiselect_op ::= UNION ALL */
142848
+ { 199, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
142849
+ { 197, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
142850
+ { 208, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
142851
+ { 208, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
142852
+ { 200, -1 }, /* (90) distinct ::= DISTINCT */
142853
+ { 200, -1 }, /* (91) distinct ::= ALL */
142854
+ { 200, 0 }, /* (92) distinct ::= */
142855
+ { 211, 0 }, /* (93) sclp ::= */
142856
+ { 201, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
142857
+ { 201, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
142858
+ { 201, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
142859
+ { 212, -2 }, /* (97) as ::= AS nm */
142860
+ { 212, 0 }, /* (98) as ::= */
142861
+ { 202, 0 }, /* (99) from ::= */
142862
+ { 202, -2 }, /* (100) from ::= FROM seltablist */
142863
+ { 214, -2 }, /* (101) stl_prefix ::= seltablist joinop */
142864
+ { 214, 0 }, /* (102) stl_prefix ::= */
142865
+ { 213, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
142866
+ { 213, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
142867
+ { 213, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
142868
+ { 213, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
142869
+ { 160, 0 }, /* (107) dbnm ::= */
142870
+ { 160, -2 }, /* (108) dbnm ::= DOT nm */
142871
+ { 195, -1 }, /* (109) fullname ::= nm */
142872
+ { 195, -3 }, /* (110) fullname ::= nm DOT nm */
142873
+ { 219, -1 }, /* (111) xfullname ::= nm */
142874
+ { 219, -3 }, /* (112) xfullname ::= nm DOT nm */
142875
+ { 219, -5 }, /* (113) xfullname ::= nm DOT nm AS nm */
142876
+ { 219, -3 }, /* (114) xfullname ::= nm AS nm */
142877
+ { 215, -1 }, /* (115) joinop ::= COMMA|JOIN */
142878
+ { 215, -2 }, /* (116) joinop ::= JOIN_KW JOIN */
142879
+ { 215, -3 }, /* (117) joinop ::= JOIN_KW nm JOIN */
142880
+ { 215, -4 }, /* (118) joinop ::= JOIN_KW nm nm JOIN */
142881
+ { 217, -2 }, /* (119) on_opt ::= ON expr */
142882
+ { 217, 0 }, /* (120) on_opt ::= */
142883
+ { 216, 0 }, /* (121) indexed_opt ::= */
142884
+ { 216, -3 }, /* (122) indexed_opt ::= INDEXED BY nm */
142885
+ { 216, -2 }, /* (123) indexed_opt ::= NOT INDEXED */
142886
+ { 218, -4 }, /* (124) using_opt ::= USING LP idlist RP */
142887
+ { 218, 0 }, /* (125) using_opt ::= */
142888
+ { 206, 0 }, /* (126) orderby_opt ::= */
142889
+ { 206, -3 }, /* (127) orderby_opt ::= ORDER BY sortlist */
142890
+ { 188, -4 }, /* (128) sortlist ::= sortlist COMMA expr sortorder */
142891
+ { 188, -2 }, /* (129) sortlist ::= expr sortorder */
142892
+ { 177, -1 }, /* (130) sortorder ::= ASC */
142893
+ { 177, -1 }, /* (131) sortorder ::= DESC */
142894
+ { 177, 0 }, /* (132) sortorder ::= */
142895
+ { 204, 0 }, /* (133) groupby_opt ::= */
142896
+ { 204, -3 }, /* (134) groupby_opt ::= GROUP BY nexprlist */
142897
+ { 205, 0 }, /* (135) having_opt ::= */
142898
+ { 205, -2 }, /* (136) having_opt ::= HAVING expr */
142899
+ { 207, 0 }, /* (137) limit_opt ::= */
142900
+ { 207, -2 }, /* (138) limit_opt ::= LIMIT expr */
142901
+ { 207, -4 }, /* (139) limit_opt ::= LIMIT expr OFFSET expr */
142902
+ { 207, -4 }, /* (140) limit_opt ::= LIMIT expr COMMA expr */
142903
+ { 150, -6 }, /* (141) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
142904
+ { 203, 0 }, /* (142) where_opt ::= */
142905
+ { 203, -2 }, /* (143) where_opt ::= WHERE expr */
142906
+ { 150, -8 }, /* (144) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
142907
+ { 222, -5 }, /* (145) setlist ::= setlist COMMA nm EQ expr */
142908
+ { 222, -7 }, /* (146) setlist ::= setlist COMMA LP idlist RP EQ expr */
142909
+ { 222, -3 }, /* (147) setlist ::= nm EQ expr */
142910
+ { 222, -5 }, /* (148) setlist ::= LP idlist RP EQ expr */
142911
+ { 150, -7 }, /* (149) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
142912
+ { 150, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
142913
+ { 225, 0 }, /* (151) upsert ::= */
142914
+ { 225, -11 }, /* (152) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
142915
+ { 225, -8 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
142916
+ { 225, -4 }, /* (154) upsert ::= ON CONFLICT DO NOTHING */
142917
+ { 223, -2 }, /* (155) insert_cmd ::= INSERT orconf */
142918
+ { 223, -1 }, /* (156) insert_cmd ::= REPLACE */
142919
+ { 224, 0 }, /* (157) idlist_opt ::= */
142920
+ { 224, -3 }, /* (158) idlist_opt ::= LP idlist RP */
142921
+ { 220, -3 }, /* (159) idlist ::= idlist COMMA nm */
142922
+ { 220, -1 }, /* (160) idlist ::= nm */
142923
+ { 175, -3 }, /* (161) expr ::= LP expr RP */
142924
+ { 175, -1 }, /* (162) expr ::= ID|INDEXED */
142925
+ { 175, -1 }, /* (163) expr ::= JOIN_KW */
142926
+ { 175, -3 }, /* (164) expr ::= nm DOT nm */
142927
+ { 175, -5 }, /* (165) expr ::= nm DOT nm DOT nm */
142928
+ { 174, -1 }, /* (166) term ::= NULL|FLOAT|BLOB */
142929
+ { 174, -1 }, /* (167) term ::= STRING */
142930
+ { 174, -1 }, /* (168) term ::= INTEGER */
142931
+ { 175, -1 }, /* (169) expr ::= VARIABLE */
142932
+ { 175, -3 }, /* (170) expr ::= expr COLLATE ID|STRING */
142933
+ { 175, -6 }, /* (171) expr ::= CAST LP expr AS typetoken RP */
142934
+ { 175, -5 }, /* (172) expr ::= ID|INDEXED LP distinct exprlist RP */
142935
+ { 175, -4 }, /* (173) expr ::= ID|INDEXED LP STAR RP */
142936
+ { 174, -1 }, /* (174) term ::= CTIME_KW */
142937
+ { 175, -5 }, /* (175) expr ::= LP nexprlist COMMA expr RP */
142938
+ { 175, -3 }, /* (176) expr ::= expr AND expr */
142939
+ { 175, -3 }, /* (177) expr ::= expr OR expr */
142940
+ { 175, -3 }, /* (178) expr ::= expr LT|GT|GE|LE expr */
142941
+ { 175, -3 }, /* (179) expr ::= expr EQ|NE expr */
142942
+ { 175, -3 }, /* (180) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
142943
+ { 175, -3 }, /* (181) expr ::= expr PLUS|MINUS expr */
142944
+ { 175, -3 }, /* (182) expr ::= expr STAR|SLASH|REM expr */
142945
+ { 175, -3 }, /* (183) expr ::= expr CONCAT expr */
142946
+ { 226, -2 }, /* (184) likeop ::= NOT LIKE_KW|MATCH */
142947
+ { 175, -3 }, /* (185) expr ::= expr likeop expr */
142948
+ { 175, -5 }, /* (186) expr ::= expr likeop expr ESCAPE expr */
142949
+ { 175, -2 }, /* (187) expr ::= expr ISNULL|NOTNULL */
142950
+ { 175, -3 }, /* (188) expr ::= expr NOT NULL */
142951
+ { 175, -3 }, /* (189) expr ::= expr IS expr */
142952
+ { 175, -4 }, /* (190) expr ::= expr IS NOT expr */
142953
+ { 175, -2 }, /* (191) expr ::= NOT expr */
142954
+ { 175, -2 }, /* (192) expr ::= BITNOT expr */
142955
+ { 175, -2 }, /* (193) expr ::= MINUS expr */
142956
+ { 175, -2 }, /* (194) expr ::= PLUS expr */
142957
+ { 227, -1 }, /* (195) between_op ::= BETWEEN */
142958
+ { 227, -2 }, /* (196) between_op ::= NOT BETWEEN */
142959
+ { 175, -5 }, /* (197) expr ::= expr between_op expr AND expr */
142960
+ { 228, -1 }, /* (198) in_op ::= IN */
142961
+ { 228, -2 }, /* (199) in_op ::= NOT IN */
142962
+ { 175, -5 }, /* (200) expr ::= expr in_op LP exprlist RP */
142963
+ { 175, -3 }, /* (201) expr ::= LP select RP */
142964
+ { 175, -5 }, /* (202) expr ::= expr in_op LP select RP */
142965
+ { 175, -5 }, /* (203) expr ::= expr in_op nm dbnm paren_exprlist */
142966
+ { 175, -4 }, /* (204) expr ::= EXISTS LP select RP */
142967
+ { 175, -5 }, /* (205) expr ::= CASE case_operand case_exprlist case_else END */
142968
+ { 231, -5 }, /* (206) case_exprlist ::= case_exprlist WHEN expr THEN expr */
142969
+ { 231, -4 }, /* (207) case_exprlist ::= WHEN expr THEN expr */
142970
+ { 232, -2 }, /* (208) case_else ::= ELSE expr */
142971
+ { 232, 0 }, /* (209) case_else ::= */
142972
+ { 230, -1 }, /* (210) case_operand ::= expr */
142973
+ { 230, 0 }, /* (211) case_operand ::= */
142974
+ { 210, 0 }, /* (212) exprlist ::= */
142975
+ { 209, -3 }, /* (213) nexprlist ::= nexprlist COMMA expr */
142976
+ { 209, -1 }, /* (214) nexprlist ::= expr */
142977
+ { 229, 0 }, /* (215) paren_exprlist ::= */
142978
+ { 229, -3 }, /* (216) paren_exprlist ::= LP exprlist RP */
142979
+ { 150, -12 }, /* (217) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
142980
+ { 233, -1 }, /* (218) uniqueflag ::= UNIQUE */
142981
+ { 233, 0 }, /* (219) uniqueflag ::= */
142982
+ { 179, 0 }, /* (220) eidlist_opt ::= */
142983
+ { 179, -3 }, /* (221) eidlist_opt ::= LP eidlist RP */
142984
+ { 189, -5 }, /* (222) eidlist ::= eidlist COMMA nm collate sortorder */
142985
+ { 189, -3 }, /* (223) eidlist ::= nm collate sortorder */
142986
+ { 234, 0 }, /* (224) collate ::= */
142987
+ { 234, -2 }, /* (225) collate ::= COLLATE ID|STRING */
142988
+ { 150, -4 }, /* (226) cmd ::= DROP INDEX ifexists fullname */
142989
+ { 150, -1 }, /* (227) cmd ::= VACUUM */
142990
+ { 150, -2 }, /* (228) cmd ::= VACUUM nm */
142991
+ { 150, -3 }, /* (229) cmd ::= PRAGMA nm dbnm */
142992
+ { 150, -5 }, /* (230) cmd ::= PRAGMA nm dbnm EQ nmnum */
142993
+ { 150, -6 }, /* (231) cmd ::= PRAGMA nm dbnm LP nmnum RP */
142994
+ { 150, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ minus_num */
142995
+ { 150, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP minus_num RP */
142996
+ { 170, -2 }, /* (234) plus_num ::= PLUS INTEGER|FLOAT */
142997
+ { 171, -2 }, /* (235) minus_num ::= MINUS INTEGER|FLOAT */
142998
+ { 150, -5 }, /* (236) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
142999
+ { 236, -11 }, /* (237) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
143000
+ { 238, -1 }, /* (238) trigger_time ::= BEFORE|AFTER */
143001
+ { 238, -2 }, /* (239) trigger_time ::= INSTEAD OF */
143002
+ { 238, 0 }, /* (240) trigger_time ::= */
143003
+ { 239, -1 }, /* (241) trigger_event ::= DELETE|INSERT */
143004
+ { 239, -1 }, /* (242) trigger_event ::= UPDATE */
143005
+ { 239, -3 }, /* (243) trigger_event ::= UPDATE OF idlist */
143006
+ { 241, 0 }, /* (244) when_clause ::= */
143007
+ { 241, -2 }, /* (245) when_clause ::= WHEN expr */
143008
+ { 237, -3 }, /* (246) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
143009
+ { 237, -2 }, /* (247) trigger_cmd_list ::= trigger_cmd SEMI */
143010
+ { 243, -3 }, /* (248) trnm ::= nm DOT nm */
143011
+ { 244, -3 }, /* (249) tridxby ::= INDEXED BY nm */
143012
+ { 244, -2 }, /* (250) tridxby ::= NOT INDEXED */
143013
+ { 242, -8 }, /* (251) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
143014
+ { 242, -8 }, /* (252) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
143015
+ { 242, -6 }, /* (253) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
143016
+ { 242, -3 }, /* (254) trigger_cmd ::= scanpt select scanpt */
143017
+ { 175, -4 }, /* (255) expr ::= RAISE LP IGNORE RP */
143018
+ { 175, -6 }, /* (256) expr ::= RAISE LP raisetype COMMA nm RP */
143019
+ { 193, -1 }, /* (257) raisetype ::= ROLLBACK */
143020
+ { 193, -1 }, /* (258) raisetype ::= ABORT */
143021
+ { 193, -1 }, /* (259) raisetype ::= FAIL */
143022
+ { 150, -4 }, /* (260) cmd ::= DROP TRIGGER ifexists fullname */
143023
+ { 150, -6 }, /* (261) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
143024
+ { 150, -3 }, /* (262) cmd ::= DETACH database_kw_opt expr */
143025
+ { 246, 0 }, /* (263) key_opt ::= */
143026
+ { 246, -2 }, /* (264) key_opt ::= KEY expr */
143027
+ { 150, -1 }, /* (265) cmd ::= REINDEX */
143028
+ { 150, -3 }, /* (266) cmd ::= REINDEX nm dbnm */
143029
+ { 150, -1 }, /* (267) cmd ::= ANALYZE */
143030
+ { 150, -3 }, /* (268) cmd ::= ANALYZE nm dbnm */
143031
+ { 150, -6 }, /* (269) cmd ::= ALTER TABLE fullname RENAME TO nm */
143032
+ { 150, -7 }, /* (270) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
143033
+ { 247, -1 }, /* (271) add_column_fullname ::= fullname */
143034
+ { 150, -1 }, /* (272) cmd ::= create_vtab */
143035
+ { 150, -4 }, /* (273) cmd ::= create_vtab LP vtabarglist RP */
143036
+ { 249, -8 }, /* (274) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
143037
+ { 251, 0 }, /* (275) vtabarg ::= */
143038
+ { 252, -1 }, /* (276) vtabargtoken ::= ANY */
143039
+ { 252, -3 }, /* (277) vtabargtoken ::= lp anylist RP */
143040
+ { 253, -1 }, /* (278) lp ::= LP */
143041
+ { 221, -2 }, /* (279) with ::= WITH wqlist */
143042
+ { 221, -3 }, /* (280) with ::= WITH RECURSIVE wqlist */
143043
+ { 198, -6 }, /* (281) wqlist ::= nm eidlist_opt AS LP select RP */
143044
+ { 198, -8 }, /* (282) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
143045
+ { 145, -1 }, /* (283) input ::= cmdlist */
143046
+ { 146, -2 }, /* (284) cmdlist ::= cmdlist ecmd */
143047
+ { 146, -1 }, /* (285) cmdlist ::= ecmd */
143048
+ { 147, -1 }, /* (286) ecmd ::= SEMI */
143049
+ { 147, -2 }, /* (287) ecmd ::= cmdx SEMI */
143050
+ { 147, -2 }, /* (288) ecmd ::= explain cmdx */
143051
+ { 152, 0 }, /* (289) trans_opt ::= */
143052
+ { 152, -1 }, /* (290) trans_opt ::= TRANSACTION */
143053
+ { 152, -2 }, /* (291) trans_opt ::= TRANSACTION nm */
143054
+ { 154, -1 }, /* (292) savepoint_opt ::= SAVEPOINT */
143055
+ { 154, 0 }, /* (293) savepoint_opt ::= */
143056
+ { 150, -2 }, /* (294) cmd ::= create_table create_table_args */
143057
+ { 161, -4 }, /* (295) columnlist ::= columnlist COMMA columnname carglist */
143058
+ { 161, -2 }, /* (296) columnlist ::= columnname carglist */
143059
+ { 153, -1 }, /* (297) nm ::= ID|INDEXED */
143060
+ { 153, -1 }, /* (298) nm ::= STRING */
143061
+ { 153, -1 }, /* (299) nm ::= JOIN_KW */
143062
+ { 167, -1 }, /* (300) typetoken ::= typename */
143063
+ { 168, -1 }, /* (301) typename ::= ID|STRING */
143064
+ { 169, -1 }, /* (302) signed ::= plus_num */
143065
+ { 169, -1 }, /* (303) signed ::= minus_num */
143066
+ { 166, -2 }, /* (304) carglist ::= carglist ccons */
143067
+ { 166, 0 }, /* (305) carglist ::= */
143068
+ { 173, -2 }, /* (306) ccons ::= NULL onconf */
143069
+ { 162, -2 }, /* (307) conslist_opt ::= COMMA conslist */
143070
+ { 185, -3 }, /* (308) conslist ::= conslist tconscomma tcons */
143071
+ { 185, -1 }, /* (309) conslist ::= tcons */
143072
+ { 186, 0 }, /* (310) tconscomma ::= */
143073
+ { 190, -1 }, /* (311) defer_subclause_opt ::= defer_subclause */
143074
+ { 192, -1 }, /* (312) resolvetype ::= raisetype */
143075
+ { 196, -1 }, /* (313) selectnowith ::= oneselect */
143076
+ { 197, -1 }, /* (314) oneselect ::= values */
143077
+ { 211, -2 }, /* (315) sclp ::= selcollist COMMA */
143078
+ { 212, -1 }, /* (316) as ::= ID|STRING */
143079
+ { 175, -1 }, /* (317) expr ::= term */
143080
+ { 226, -1 }, /* (318) likeop ::= LIKE_KW|MATCH */
143081
+ { 210, -1 }, /* (319) exprlist ::= nexprlist */
143082
+ { 235, -1 }, /* (320) nmnum ::= plus_num */
143083
+ { 235, -1 }, /* (321) nmnum ::= nm */
143084
+ { 235, -1 }, /* (322) nmnum ::= ON */
143085
+ { 235, -1 }, /* (323) nmnum ::= DELETE */
143086
+ { 235, -1 }, /* (324) nmnum ::= DEFAULT */
143087
+ { 170, -1 }, /* (325) plus_num ::= INTEGER|FLOAT */
143088
+ { 240, 0 }, /* (326) foreach_clause ::= */
143089
+ { 240, -3 }, /* (327) foreach_clause ::= FOR EACH ROW */
143090
+ { 243, -1 }, /* (328) trnm ::= nm */
143091
+ { 244, 0 }, /* (329) tridxby ::= */
143092
+ { 245, -1 }, /* (330) database_kw_opt ::= DATABASE */
143093
+ { 245, 0 }, /* (331) database_kw_opt ::= */
143094
+ { 248, 0 }, /* (332) kwcolumn_opt ::= */
143095
+ { 248, -1 }, /* (333) kwcolumn_opt ::= COLUMNKW */
143096
+ { 250, -1 }, /* (334) vtabarglist ::= vtabarg */
143097
+ { 250, -3 }, /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */
143098
+ { 251, -2 }, /* (336) vtabarg ::= vtabarg vtabargtoken */
143099
+ { 254, 0 }, /* (337) anylist ::= */
143100
+ { 254, -4 }, /* (338) anylist ::= anylist LP anylist RP */
143101
+ { 254, -2 }, /* (339) anylist ::= anylist ANY */
143102
+ { 221, 0 }, /* (340) with ::= */
142182143103
};
142183143104
142184143105
static void yy_accept(yyParser*); /* Forward Declaration */
142185143106
142186143107
/*
@@ -142191,21 +143112,22 @@
142191143112
** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
142192143113
** if the lookahead token has already been consumed. As this procedure is
142193143114
** only called from one place, optimizing compilers will in-line it, which
142194143115
** means that the extra parameters have no performance impact.
142195143116
*/
142196
-static void yy_reduce(
143117
+static YYACTIONTYPE yy_reduce(
142197143118
yyParser *yypParser, /* The parser */
142198143119
unsigned int yyruleno, /* Number of the rule by which to reduce */
142199143120
int yyLookahead, /* Lookahead token, or YYNOCODE if none */
142200143121
sqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
143122
+ sqlite3ParserCTX_PDECL /* %extra_context */
142201143123
){
142202143124
int yygoto; /* The next state */
142203143125
int yyact; /* The next action */
142204143126
yyStackEntry *yymsp; /* The top of the parser's stack */
142205143127
int yysize; /* Amount to pop the stack */
142206
- sqlite3ParserARG_FETCH;
143128
+ sqlite3ParserARG_FETCH
142207143129
(void)yyLookahead;
142208143130
(void)yyLookaheadToken;
142209143131
yymsp = yypParser->yytos;
142210143132
#ifndef NDEBUG
142211143133
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
@@ -142232,17 +143154,23 @@
142232143154
}
142233143155
#endif
142234143156
#if YYSTACKDEPTH>0
142235143157
if( yypParser->yytos>=yypParser->yystackEnd ){
142236143158
yyStackOverflow(yypParser);
142237
- return;
143159
+ /* The call to yyStackOverflow() above pops the stack until it is
143160
+ ** empty, causing the main parser loop to exit. So the return value
143161
+ ** is never used and does not matter. */
143162
+ return 0;
142238143163
}
142239143164
#else
142240143165
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
142241143166
if( yyGrowStack(yypParser) ){
142242143167
yyStackOverflow(yypParser);
142243
- return;
143168
+ /* The call to yyStackOverflow() above pops the stack until it is
143169
+ ** empty, causing the main parser loop to exit. So the return value
143170
+ ** is never used and does not matter. */
143171
+ return 0;
142244143172
}
142245143173
yymsp = yypParser->yytos;
142246143174
}
142247143175
#endif
142248143176
}
@@ -142266,19 +143194,19 @@
142266143194
break;
142267143195
case 2: /* cmdx ::= cmd */
142268143196
{ sqlite3FinishCoding(pParse); }
142269143197
break;
142270143198
case 3: /* cmd ::= BEGIN transtype trans_opt */
142271
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
143199
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);}
142272143200
break;
142273143201
case 4: /* transtype ::= */
142274
-{yymsp[1].minor.yy4 = TK_DEFERRED;}
143202
+{yymsp[1].minor.yy502 = TK_DEFERRED;}
142275143203
break;
142276143204
case 5: /* transtype ::= DEFERRED */
142277143205
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
142278143206
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
142279
-{yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-X*/}
143207
+{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/}
142280143208
break;
142281143209
case 8: /* cmd ::= COMMIT|END trans_opt */
142282143210
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
142283143211
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
142284143212
break;
@@ -142297,11 +143225,11 @@
142297143225
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
142298143226
}
142299143227
break;
142300143228
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
142301143229
{
142302
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
143230
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502);
142303143231
}
142304143232
break;
142305143233
case 14: /* createkw ::= CREATE */
142306143234
{disableLookaside(pParse);}
142307143235
break;
@@ -142311,37 +143239,37 @@
142311143239
case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
142312143240
case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
142313143241
case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
142314143242
case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
142315143243
case 92: /* distinct ::= */ yytestcase(yyruleno==92);
142316
- case 216: /* collate ::= */ yytestcase(yyruleno==216);
142317
-{yymsp[1].minor.yy4 = 0;}
143244
+ case 224: /* collate ::= */ yytestcase(yyruleno==224);
143245
+{yymsp[1].minor.yy502 = 0;}
142318143246
break;
142319143247
case 16: /* ifnotexists ::= IF NOT EXISTS */
142320
-{yymsp[-2].minor.yy4 = 1;}
143248
+{yymsp[-2].minor.yy502 = 1;}
142321143249
break;
142322143250
case 17: /* temp ::= TEMP */
142323143251
case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
142324
-{yymsp[0].minor.yy4 = 1;}
143252
+{yymsp[0].minor.yy502 = 1;}
142325143253
break;
142326143254
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
142327143255
{
142328
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy4,0);
143256
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy502,0);
142329143257
}
142330143258
break;
142331143259
case 20: /* create_table_args ::= AS select */
142332143260
{
142333
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy387);
142334
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
143261
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy399);
143262
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399);
142335143263
}
142336143264
break;
142337143265
case 22: /* table_options ::= WITHOUT nm */
142338143266
{
142339143267
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
142340
- yymsp[-1].minor.yy4 = TF_WithoutRowid | TF_NoVisibleRowid;
143268
+ yymsp[-1].minor.yy502 = TF_WithoutRowid | TF_NoVisibleRowid;
142341143269
}else{
142342
- yymsp[-1].minor.yy4 = 0;
143270
+ yymsp[-1].minor.yy502 = 0;
142343143271
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
142344143272
}
142345143273
}
142346143274
break;
142347143275
case 23: /* columnname ::= nm typetoken */
@@ -142366,30 +143294,30 @@
142366143294
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
142367143295
break;
142368143296
case 28: /* scanpt ::= */
142369143297
{
142370143298
assert( yyLookahead!=YYNOCODE );
142371
- yymsp[1].minor.yy336 = yyLookaheadToken.z;
143299
+ yymsp[1].minor.yy36 = yyLookaheadToken.z;
142372143300
}
142373143301
break;
142374143302
case 29: /* ccons ::= CONSTRAINT nm */
142375143303
case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
142376143304
{pParse->constraintName = yymsp[0].minor.yy0;}
142377143305
break;
142378143306
case 30: /* ccons ::= DEFAULT scanpt term scanpt */
142379
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy336,yymsp[0].minor.yy336);}
143307
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy36,yymsp[0].minor.yy36);}
142380143308
break;
142381143309
case 31: /* ccons ::= DEFAULT LP expr RP */
142382
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
143310
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
142383143311
break;
142384143312
case 32: /* ccons ::= DEFAULT PLUS term scanpt */
142385
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy336);}
143313
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36);}
142386143314
break;
142387143315
case 33: /* ccons ::= DEFAULT MINUS term scanpt */
142388143316
{
142389
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy314, 0);
142390
- sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy336);
143317
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy182, 0);
143318
+ sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36);
142391143319
}
142392143320
break;
142393143321
case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
142394143322
{
142395143323
Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
@@ -142399,207 +143327,207 @@
142399143327
}
142400143328
sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
142401143329
}
142402143330
break;
142403143331
case 35: /* ccons ::= NOT NULL onconf */
142404
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
143332
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);}
142405143333
break;
142406143334
case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
142407
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
143335
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);}
142408143336
break;
142409143337
case 37: /* ccons ::= UNIQUE onconf */
142410
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0,
143338
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0,
142411143339
SQLITE_IDXTYPE_UNIQUE);}
142412143340
break;
142413143341
case 38: /* ccons ::= CHECK LP expr RP */
142414
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy314);}
143342
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy182);}
142415143343
break;
142416143344
case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
142417
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
143345
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy232,yymsp[0].minor.yy502);}
142418143346
break;
142419143347
case 40: /* ccons ::= defer_subclause */
142420
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
143348
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);}
142421143349
break;
142422143350
case 41: /* ccons ::= COLLATE ID|STRING */
142423143351
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
142424143352
break;
142425143353
case 44: /* refargs ::= */
142426
-{ yymsp[1].minor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
143354
+{ yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */}
142427143355
break;
142428143356
case 45: /* refargs ::= refargs refarg */
142429
-{ yymsp[-1].minor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
143357
+{ yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy107.mask) | yymsp[0].minor.yy107.value; }
142430143358
break;
142431143359
case 46: /* refarg ::= MATCH nm */
142432
-{ yymsp[-1].minor.yy215.value = 0; yymsp[-1].minor.yy215.mask = 0x000000; }
143360
+{ yymsp[-1].minor.yy107.value = 0; yymsp[-1].minor.yy107.mask = 0x000000; }
142433143361
break;
142434143362
case 47: /* refarg ::= ON INSERT refact */
142435
-{ yymsp[-2].minor.yy215.value = 0; yymsp[-2].minor.yy215.mask = 0x000000; }
143363
+{ yymsp[-2].minor.yy107.value = 0; yymsp[-2].minor.yy107.mask = 0x000000; }
142436143364
break;
142437143365
case 48: /* refarg ::= ON DELETE refact */
142438
-{ yymsp[-2].minor.yy215.value = yymsp[0].minor.yy4; yymsp[-2].minor.yy215.mask = 0x0000ff; }
143366
+{ yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy107.mask = 0x0000ff; }
142439143367
break;
142440143368
case 49: /* refarg ::= ON UPDATE refact */
142441
-{ yymsp[-2].minor.yy215.value = yymsp[0].minor.yy4<<8; yymsp[-2].minor.yy215.mask = 0x00ff00; }
143369
+{ yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy107.mask = 0x00ff00; }
142442143370
break;
142443143371
case 50: /* refact ::= SET NULL */
142444
-{ yymsp[-1].minor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
143372
+{ yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */}
142445143373
break;
142446143374
case 51: /* refact ::= SET DEFAULT */
142447
-{ yymsp[-1].minor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
143375
+{ yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */}
142448143376
break;
142449143377
case 52: /* refact ::= CASCADE */
142450
-{ yymsp[0].minor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
143378
+{ yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */}
142451143379
break;
142452143380
case 53: /* refact ::= RESTRICT */
142453
-{ yymsp[0].minor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
143381
+{ yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */}
142454143382
break;
142455143383
case 54: /* refact ::= NO ACTION */
142456
-{ yymsp[-1].minor.yy4 = OE_None; /* EV: R-33326-45252 */}
143384
+{ yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */}
142457143385
break;
142458143386
case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
142459
-{yymsp[-2].minor.yy4 = 0;}
143387
+{yymsp[-2].minor.yy502 = 0;}
142460143388
break;
142461143389
case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
142462143390
case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
142463
- case 147: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==147);
142464
-{yymsp[-1].minor.yy4 = yymsp[0].minor.yy4;}
143391
+ case 155: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==155);
143392
+{yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;}
142465143393
break;
142466143394
case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
142467143395
case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
142468
- case 188: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==188);
142469
- case 191: /* in_op ::= NOT IN */ yytestcase(yyruleno==191);
142470
- case 217: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==217);
142471
-{yymsp[-1].minor.yy4 = 1;}
143396
+ case 196: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==196);
143397
+ case 199: /* in_op ::= NOT IN */ yytestcase(yyruleno==199);
143398
+ case 225: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==225);
143399
+{yymsp[-1].minor.yy502 = 1;}
142472143400
break;
142473143401
case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
142474
-{yymsp[-1].minor.yy4 = 0;}
143402
+{yymsp[-1].minor.yy502 = 0;}
142475143403
break;
142476143404
case 61: /* tconscomma ::= COMMA */
142477143405
{pParse->constraintName.n = 0;}
142478143406
break;
142479143407
case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
142480
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
143408
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy232,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);}
142481143409
break;
142482143410
case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
142483
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0,
143411
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy232,yymsp[0].minor.yy502,0,0,0,0,
142484143412
SQLITE_IDXTYPE_UNIQUE);}
142485143413
break;
142486143414
case 65: /* tcons ::= CHECK LP expr RP onconf */
142487
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy314);}
143415
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy182);}
142488143416
break;
142489143417
case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
142490143418
{
142491
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
142492
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
143419
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy232, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy502);
143420
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502);
142493143421
}
142494143422
break;
142495143423
case 68: /* onconf ::= */
142496143424
case 70: /* orconf ::= */ yytestcase(yyruleno==70);
142497
-{yymsp[1].minor.yy4 = OE_Default;}
143425
+{yymsp[1].minor.yy502 = OE_Default;}
142498143426
break;
142499143427
case 69: /* onconf ::= ON CONFLICT resolvetype */
142500
-{yymsp[-2].minor.yy4 = yymsp[0].minor.yy4;}
143428
+{yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;}
142501143429
break;
142502143430
case 72: /* resolvetype ::= IGNORE */
142503
-{yymsp[0].minor.yy4 = OE_Ignore;}
143431
+{yymsp[0].minor.yy502 = OE_Ignore;}
142504143432
break;
142505143433
case 73: /* resolvetype ::= REPLACE */
142506
- case 148: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==148);
142507
-{yymsp[0].minor.yy4 = OE_Replace;}
143434
+ case 156: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==156);
143435
+{yymsp[0].minor.yy502 = OE_Replace;}
142508143436
break;
142509143437
case 74: /* cmd ::= DROP TABLE ifexists fullname */
142510143438
{
142511
- sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
143439
+ sqlite3DropTable(pParse, yymsp[0].minor.yy427, 0, yymsp[-1].minor.yy502);
142512143440
}
142513143441
break;
142514143442
case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
142515143443
{
142516
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy387, yymsp[-7].minor.yy4, yymsp[-5].minor.yy4);
143444
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[0].minor.yy399, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502);
142517143445
}
142518143446
break;
142519143447
case 78: /* cmd ::= DROP VIEW ifexists fullname */
142520143448
{
142521
- sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
143449
+ sqlite3DropTable(pParse, yymsp[0].minor.yy427, 1, yymsp[-1].minor.yy502);
142522143450
}
142523143451
break;
142524143452
case 79: /* cmd ::= select */
142525143453
{
142526143454
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
142527
- sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
142528
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
143455
+ sqlite3Select(pParse, yymsp[0].minor.yy399, &dest);
143456
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399);
142529143457
}
142530143458
break;
142531143459
case 80: /* select ::= WITH wqlist selectnowith */
142532143460
{
142533
- Select *p = yymsp[0].minor.yy387;
143461
+ Select *p = yymsp[0].minor.yy399;
142534143462
if( p ){
142535
- p->pWith = yymsp[-1].minor.yy451;
143463
+ p->pWith = yymsp[-1].minor.yy91;
142536143464
parserDoubleLinkSelect(pParse, p);
142537143465
}else{
142538
- sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy451);
143466
+ sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91);
142539143467
}
142540
- yymsp[-2].minor.yy387 = p;
143468
+ yymsp[-2].minor.yy399 = p;
142541143469
}
142542143470
break;
142543143471
case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
142544143472
{
142545
- Select *p = yymsp[0].minor.yy387;
143473
+ Select *p = yymsp[0].minor.yy399;
142546143474
if( p ){
142547
- p->pWith = yymsp[-1].minor.yy451;
143475
+ p->pWith = yymsp[-1].minor.yy91;
142548143476
parserDoubleLinkSelect(pParse, p);
142549143477
}else{
142550
- sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy451);
143478
+ sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91);
142551143479
}
142552
- yymsp[-3].minor.yy387 = p;
143480
+ yymsp[-3].minor.yy399 = p;
142553143481
}
142554143482
break;
142555143483
case 82: /* select ::= selectnowith */
142556143484
{
142557
- Select *p = yymsp[0].minor.yy387;
143485
+ Select *p = yymsp[0].minor.yy399;
142558143486
if( p ){
142559143487
parserDoubleLinkSelect(pParse, p);
142560143488
}
142561
- yymsp[0].minor.yy387 = p; /*A-overwrites-X*/
143489
+ yymsp[0].minor.yy399 = p; /*A-overwrites-X*/
142562143490
}
142563143491
break;
142564143492
case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
142565143493
{
142566
- Select *pRhs = yymsp[0].minor.yy387;
142567
- Select *pLhs = yymsp[-2].minor.yy387;
143494
+ Select *pRhs = yymsp[0].minor.yy399;
143495
+ Select *pLhs = yymsp[-2].minor.yy399;
142568143496
if( pRhs && pRhs->pPrior ){
142569143497
SrcList *pFrom;
142570143498
Token x;
142571143499
x.n = 0;
142572143500
parserDoubleLinkSelect(pParse, pRhs);
142573143501
pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
142574143502
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
142575143503
}
142576143504
if( pRhs ){
142577
- pRhs->op = (u8)yymsp[-1].minor.yy4;
143505
+ pRhs->op = (u8)yymsp[-1].minor.yy502;
142578143506
pRhs->pPrior = pLhs;
142579143507
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
142580143508
pRhs->selFlags &= ~SF_MultiValue;
142581
- if( yymsp[-1].minor.yy4!=TK_ALL ) pParse->hasCompound = 1;
143509
+ if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1;
142582143510
}else{
142583143511
sqlite3SelectDelete(pParse->db, pLhs);
142584143512
}
142585
- yymsp[-2].minor.yy387 = pRhs;
143513
+ yymsp[-2].minor.yy399 = pRhs;
142586143514
}
142587143515
break;
142588143516
case 84: /* multiselect_op ::= UNION */
142589143517
case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
142590
-{yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-OP*/}
143518
+{yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/}
142591143519
break;
142592143520
case 85: /* multiselect_op ::= UNION ALL */
142593
-{yymsp[-1].minor.yy4 = TK_ALL;}
143521
+{yymsp[-1].minor.yy502 = TK_ALL;}
142594143522
break;
142595143523
case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
142596143524
{
142597143525
#if SELECTTRACE_ENABLED
142598143526
Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
142599143527
#endif
142600
- yymsp[-8].minor.yy387 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy259,yymsp[-4].minor.yy314,yymsp[-3].minor.yy322,yymsp[-2].minor.yy314,yymsp[-1].minor.yy322,yymsp[-7].minor.yy4,yymsp[0].minor.yy314);
143528
+ yymsp[-8].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy232,yymsp[-5].minor.yy427,yymsp[-4].minor.yy182,yymsp[-3].minor.yy232,yymsp[-2].minor.yy182,yymsp[-1].minor.yy232,yymsp[-7].minor.yy502,yymsp[0].minor.yy182);
142601143529
#if SELECTTRACE_ENABLED
142602143530
/* Populate the Select.zSelName[] string that is used to help with
142603143531
** query planner debugging, to differentiate between multiple Select
142604143532
** objects in a complex query.
142605143533
**
@@ -142606,481 +143534,507 @@
142606143534
** If the SELECT keyword is immediately followed by a C-style comment
142607143535
** then extract the first few alphanumeric characters from within that
142608143536
** comment to be the zSelName value. Otherwise, the label is #N where
142609143537
** is an integer that is incremented with each SELECT statement seen.
142610143538
*/
142611
- if( yymsp[-8].minor.yy387!=0 ){
143539
+ if( yymsp[-8].minor.yy399!=0 ){
142612143540
const char *z = s.z+6;
142613143541
int i;
142614
- sqlite3_snprintf(sizeof(yymsp[-8].minor.yy387->zSelName), yymsp[-8].minor.yy387->zSelName,"#%d",++pParse->nSelect);
143542
+ sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName,"#%d",++pParse->nSelect);
142615143543
while( z[0]==' ' ) z++;
142616143544
if( z[0]=='/' && z[1]=='*' ){
142617143545
z += 2;
142618143546
while( z[0]==' ' ) z++;
142619143547
for(i=0; sqlite3Isalnum(z[i]); i++){}
142620
- sqlite3_snprintf(sizeof(yymsp[-8].minor.yy387->zSelName), yymsp[-8].minor.yy387->zSelName, "%.*s", i, z);
143548
+ sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName, "%.*s", i, z);
142621143549
}
142622143550
}
142623143551
#endif /* SELECTRACE_ENABLED */
142624143552
}
142625143553
break;
142626143554
case 88: /* values ::= VALUES LP nexprlist RP */
142627143555
{
142628
- yymsp[-3].minor.yy387 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
143556
+ yymsp[-3].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values,0);
142629143557
}
142630143558
break;
142631143559
case 89: /* values ::= values COMMA LP exprlist RP */
142632143560
{
142633
- Select *pRight, *pLeft = yymsp[-4].minor.yy387;
142634
- pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
143561
+ Select *pRight, *pLeft = yymsp[-4].minor.yy399;
143562
+ pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values|SF_MultiValue,0);
142635143563
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
142636143564
if( pRight ){
142637143565
pRight->op = TK_ALL;
142638143566
pRight->pPrior = pLeft;
142639
- yymsp[-4].minor.yy387 = pRight;
143567
+ yymsp[-4].minor.yy399 = pRight;
142640143568
}else{
142641
- yymsp[-4].minor.yy387 = pLeft;
143569
+ yymsp[-4].minor.yy399 = pLeft;
142642143570
}
142643143571
}
142644143572
break;
142645143573
case 90: /* distinct ::= DISTINCT */
142646
-{yymsp[0].minor.yy4 = SF_Distinct;}
143574
+{yymsp[0].minor.yy502 = SF_Distinct;}
142647143575
break;
142648143576
case 91: /* distinct ::= ALL */
142649
-{yymsp[0].minor.yy4 = SF_All;}
143577
+{yymsp[0].minor.yy502 = SF_All;}
142650143578
break;
142651143579
case 93: /* sclp ::= */
142652
- case 122: /* orderby_opt ::= */ yytestcase(yyruleno==122);
142653
- case 129: /* groupby_opt ::= */ yytestcase(yyruleno==129);
142654
- case 204: /* exprlist ::= */ yytestcase(yyruleno==204);
142655
- case 207: /* paren_exprlist ::= */ yytestcase(yyruleno==207);
142656
- case 212: /* eidlist_opt ::= */ yytestcase(yyruleno==212);
142657
-{yymsp[1].minor.yy322 = 0;}
143580
+ case 126: /* orderby_opt ::= */ yytestcase(yyruleno==126);
143581
+ case 133: /* groupby_opt ::= */ yytestcase(yyruleno==133);
143582
+ case 212: /* exprlist ::= */ yytestcase(yyruleno==212);
143583
+ case 215: /* paren_exprlist ::= */ yytestcase(yyruleno==215);
143584
+ case 220: /* eidlist_opt ::= */ yytestcase(yyruleno==220);
143585
+{yymsp[1].minor.yy232 = 0;}
142658143586
break;
142659143587
case 94: /* selcollist ::= sclp scanpt expr scanpt as */
142660143588
{
142661
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy314);
142662
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1);
142663
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy336,yymsp[-1].minor.yy336);
143589
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[-2].minor.yy182);
143590
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[0].minor.yy0, 1);
143591
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy232,yymsp[-3].minor.yy36,yymsp[-1].minor.yy36);
142664143592
}
142665143593
break;
142666143594
case 95: /* selcollist ::= sclp scanpt STAR */
142667143595
{
142668143596
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
142669
- yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
143597
+ yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy232, p);
142670143598
}
142671143599
break;
142672143600
case 96: /* selcollist ::= sclp scanpt nm DOT STAR */
142673143601
{
142674143602
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
142675143603
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142676143604
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
142677
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
143605
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, pDot);
142678143606
}
142679143607
break;
142680143608
case 97: /* as ::= AS nm */
142681143609
case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108);
142682
- case 226: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==226);
142683
- case 227: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==227);
143610
+ case 234: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==234);
143611
+ case 235: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==235);
142684143612
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
142685143613
break;
142686143614
case 99: /* from ::= */
142687
-{yymsp[1].minor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy259));}
143615
+{yymsp[1].minor.yy427 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy427));}
142688143616
break;
142689143617
case 100: /* from ::= FROM seltablist */
142690143618
{
142691
- yymsp[-1].minor.yy259 = yymsp[0].minor.yy259;
142692
- sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy259);
143619
+ yymsp[-1].minor.yy427 = yymsp[0].minor.yy427;
143620
+ sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy427);
142693143621
}
142694143622
break;
142695143623
case 101: /* stl_prefix ::= seltablist joinop */
142696143624
{
142697
- if( ALWAYS(yymsp[-1].minor.yy259 && yymsp[-1].minor.yy259->nSrc>0) ) yymsp[-1].minor.yy259->a[yymsp[-1].minor.yy259->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy4;
143625
+ if( ALWAYS(yymsp[-1].minor.yy427 && yymsp[-1].minor.yy427->nSrc>0) ) yymsp[-1].minor.yy427->a[yymsp[-1].minor.yy427->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502;
142698143626
}
142699143627
break;
142700143628
case 102: /* stl_prefix ::= */
142701
-{yymsp[1].minor.yy259 = 0;}
143629
+{yymsp[1].minor.yy427 = 0;}
142702143630
break;
142703143631
case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
142704143632
{
142705
- yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142706
- sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy259, &yymsp[-2].minor.yy0);
143633
+ yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143634
+ sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy427, &yymsp[-2].minor.yy0);
142707143635
}
142708143636
break;
142709143637
case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
142710143638
{
142711
- yymsp[-8].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy259,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142712
- sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy259, yymsp[-4].minor.yy322);
143639
+ yymsp[-8].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy427,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143640
+ sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy427, yymsp[-4].minor.yy232);
142713143641
}
142714143642
break;
142715143643
case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
142716143644
{
142717
- yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy387,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
143645
+ yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy399,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
142718143646
}
142719143647
break;
142720143648
case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
142721143649
{
142722
- if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
142723
- yymsp[-6].minor.yy259 = yymsp[-4].minor.yy259;
142724
- }else if( yymsp[-4].minor.yy259->nSrc==1 ){
142725
- yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142726
- if( yymsp[-6].minor.yy259 ){
142727
- struct SrcList_item *pNew = &yymsp[-6].minor.yy259->a[yymsp[-6].minor.yy259->nSrc-1];
142728
- struct SrcList_item *pOld = yymsp[-4].minor.yy259->a;
143650
+ if( yymsp[-6].minor.yy427==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy182==0 && yymsp[0].minor.yy510==0 ){
143651
+ yymsp[-6].minor.yy427 = yymsp[-4].minor.yy427;
143652
+ }else if( yymsp[-4].minor.yy427->nSrc==1 ){
143653
+ yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143654
+ if( yymsp[-6].minor.yy427 ){
143655
+ struct SrcList_item *pNew = &yymsp[-6].minor.yy427->a[yymsp[-6].minor.yy427->nSrc-1];
143656
+ struct SrcList_item *pOld = yymsp[-4].minor.yy427->a;
142729143657
pNew->zName = pOld->zName;
142730143658
pNew->zDatabase = pOld->zDatabase;
142731143659
pNew->pSelect = pOld->pSelect;
142732143660
pOld->zName = pOld->zDatabase = 0;
142733143661
pOld->pSelect = 0;
142734143662
}
142735
- sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy259);
143663
+ sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy427);
142736143664
}else{
142737143665
Select *pSubquery;
142738
- sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
142739
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,SF_NestedFrom,0);
142740
- yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
143666
+ sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy427);
143667
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy427,0,0,0,0,SF_NestedFrom,0);
143668
+ yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
142741143669
}
142742143670
}
142743143671
break;
142744143672
case 107: /* dbnm ::= */
142745
- case 117: /* indexed_opt ::= */ yytestcase(yyruleno==117);
143673
+ case 121: /* indexed_opt ::= */ yytestcase(yyruleno==121);
142746143674
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
142747143675
break;
142748143676
case 109: /* fullname ::= nm */
142749
-{yymsp[0].minor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
143677
+ case 111: /* xfullname ::= nm */ yytestcase(yyruleno==111);
143678
+{yymsp[0].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
142750143679
break;
142751143680
case 110: /* fullname ::= nm DOT nm */
142752
-{yymsp[-2].minor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
142753
- break;
142754
- case 111: /* joinop ::= COMMA|JOIN */
142755
-{ yymsp[0].minor.yy4 = JT_INNER; }
142756
- break;
142757
- case 112: /* joinop ::= JOIN_KW JOIN */
142758
-{yymsp[-1].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
142759
- break;
142760
- case 113: /* joinop ::= JOIN_KW nm JOIN */
142761
-{yymsp[-2].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
142762
- break;
142763
- case 114: /* joinop ::= JOIN_KW nm nm JOIN */
142764
-{yymsp[-3].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
142765
- break;
142766
- case 115: /* on_opt ::= ON expr */
142767
- case 132: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==132);
142768
- case 139: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==139);
142769
- case 200: /* case_else ::= ELSE expr */ yytestcase(yyruleno==200);
142770
-{yymsp[-1].minor.yy314 = yymsp[0].minor.yy314;}
142771
- break;
142772
- case 116: /* on_opt ::= */
142773
- case 131: /* having_opt ::= */ yytestcase(yyruleno==131);
142774
- case 133: /* limit_opt ::= */ yytestcase(yyruleno==133);
142775
- case 138: /* where_opt ::= */ yytestcase(yyruleno==138);
142776
- case 201: /* case_else ::= */ yytestcase(yyruleno==201);
142777
- case 203: /* case_operand ::= */ yytestcase(yyruleno==203);
142778
-{yymsp[1].minor.yy314 = 0;}
142779
- break;
142780
- case 118: /* indexed_opt ::= INDEXED BY nm */
143681
+ case 112: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==112);
143682
+{yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
143683
+ break;
143684
+ case 113: /* xfullname ::= nm DOT nm AS nm */
143685
+{
143686
+ yymsp[-4].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
143687
+ if( yymsp[-4].minor.yy427 ) yymsp[-4].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
143688
+}
143689
+ break;
143690
+ case 114: /* xfullname ::= nm AS nm */
143691
+{
143692
+ yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
143693
+ if( yymsp[-2].minor.yy427 ) yymsp[-2].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
143694
+}
143695
+ break;
143696
+ case 115: /* joinop ::= COMMA|JOIN */
143697
+{ yymsp[0].minor.yy502 = JT_INNER; }
143698
+ break;
143699
+ case 116: /* joinop ::= JOIN_KW JOIN */
143700
+{yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
143701
+ break;
143702
+ case 117: /* joinop ::= JOIN_KW nm JOIN */
143703
+{yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
143704
+ break;
143705
+ case 118: /* joinop ::= JOIN_KW nm nm JOIN */
143706
+{yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
143707
+ break;
143708
+ case 119: /* on_opt ::= ON expr */
143709
+ case 136: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==136);
143710
+ case 143: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==143);
143711
+ case 208: /* case_else ::= ELSE expr */ yytestcase(yyruleno==208);
143712
+{yymsp[-1].minor.yy182 = yymsp[0].minor.yy182;}
143713
+ break;
143714
+ case 120: /* on_opt ::= */
143715
+ case 135: /* having_opt ::= */ yytestcase(yyruleno==135);
143716
+ case 137: /* limit_opt ::= */ yytestcase(yyruleno==137);
143717
+ case 142: /* where_opt ::= */ yytestcase(yyruleno==142);
143718
+ case 209: /* case_else ::= */ yytestcase(yyruleno==209);
143719
+ case 211: /* case_operand ::= */ yytestcase(yyruleno==211);
143720
+{yymsp[1].minor.yy182 = 0;}
143721
+ break;
143722
+ case 122: /* indexed_opt ::= INDEXED BY nm */
142781143723
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
142782143724
break;
142783
- case 119: /* indexed_opt ::= NOT INDEXED */
143725
+ case 123: /* indexed_opt ::= NOT INDEXED */
142784143726
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
142785143727
break;
142786
- case 120: /* using_opt ::= USING LP idlist RP */
142787
-{yymsp[-3].minor.yy384 = yymsp[-1].minor.yy384;}
142788
- break;
142789
- case 121: /* using_opt ::= */
142790
- case 149: /* idlist_opt ::= */ yytestcase(yyruleno==149);
142791
-{yymsp[1].minor.yy384 = 0;}
142792
- break;
142793
- case 123: /* orderby_opt ::= ORDER BY sortlist */
142794
- case 130: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==130);
142795
-{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
142796
- break;
142797
- case 124: /* sortlist ::= sortlist COMMA expr sortorder */
142798
-{
142799
- yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
142800
- sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy322,yymsp[0].minor.yy4);
142801
-}
142802
- break;
142803
- case 125: /* sortlist ::= expr sortorder */
142804
-{
142805
- yymsp[-1].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314); /*A-overwrites-Y*/
142806
- sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy322,yymsp[0].minor.yy4);
142807
-}
142808
- break;
142809
- case 126: /* sortorder ::= ASC */
142810
-{yymsp[0].minor.yy4 = SQLITE_SO_ASC;}
142811
- break;
142812
- case 127: /* sortorder ::= DESC */
142813
-{yymsp[0].minor.yy4 = SQLITE_SO_DESC;}
142814
- break;
142815
- case 128: /* sortorder ::= */
142816
-{yymsp[1].minor.yy4 = SQLITE_SO_UNDEFINED;}
142817
- break;
142818
- case 134: /* limit_opt ::= LIMIT expr */
142819
-{yymsp[-1].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy314,0);}
142820
- break;
142821
- case 135: /* limit_opt ::= LIMIT expr OFFSET expr */
142822
-{yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);}
142823
- break;
142824
- case 136: /* limit_opt ::= LIMIT expr COMMA expr */
142825
-{yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy314,yymsp[-2].minor.yy314);}
142826
- break;
142827
- case 137: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
142828
-{
142829
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
142830
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314,0,0);
142831
-}
142832
- break;
142833
- case 140: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
142834
-{
142835
- sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
142836
- sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
142837
- sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy4,0,0);
142838
-}
142839
- break;
142840
- case 141: /* setlist ::= setlist COMMA nm EQ expr */
142841
-{
142842
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy314);
142843
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
142844
-}
142845
- break;
142846
- case 142: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
142847
-{
142848
- yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy384, yymsp[0].minor.yy314);
142849
-}
142850
- break;
142851
- case 143: /* setlist ::= nm EQ expr */
142852
-{
142853
- yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy314);
142854
- sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
142855
-}
142856
- yymsp[-2].minor.yy322 = yylhsminor.yy322;
142857
- break;
142858
- case 144: /* setlist ::= LP idlist RP EQ expr */
142859
-{
142860
- yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy384, yymsp[0].minor.yy314);
142861
-}
142862
- break;
142863
- case 145: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
142864
-{
142865
- sqlite3Insert(pParse, yymsp[-2].minor.yy259, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy4);
142866
-}
142867
- break;
142868
- case 146: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
142869
-{
142870
- sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy4);
142871
-}
142872
- break;
142873
- case 150: /* idlist_opt ::= LP idlist RP */
142874
-{yymsp[-2].minor.yy384 = yymsp[-1].minor.yy384;}
142875
- break;
142876
- case 151: /* idlist ::= idlist COMMA nm */
142877
-{yymsp[-2].minor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
142878
- break;
142879
- case 152: /* idlist ::= nm */
142880
-{yymsp[0].minor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
142881
- break;
142882
- case 153: /* expr ::= LP expr RP */
142883
-{yymsp[-2].minor.yy314 = yymsp[-1].minor.yy314;}
142884
- break;
142885
- case 154: /* expr ::= ID|INDEXED */
142886
- case 155: /* expr ::= JOIN_KW */ yytestcase(yyruleno==155);
142887
-{yymsp[0].minor.yy314=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
142888
- break;
142889
- case 156: /* expr ::= nm DOT nm */
143728
+ case 124: /* using_opt ::= USING LP idlist RP */
143729
+{yymsp[-3].minor.yy510 = yymsp[-1].minor.yy510;}
143730
+ break;
143731
+ case 125: /* using_opt ::= */
143732
+ case 157: /* idlist_opt ::= */ yytestcase(yyruleno==157);
143733
+{yymsp[1].minor.yy510 = 0;}
143734
+ break;
143735
+ case 127: /* orderby_opt ::= ORDER BY sortlist */
143736
+ case 134: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==134);
143737
+{yymsp[-2].minor.yy232 = yymsp[0].minor.yy232;}
143738
+ break;
143739
+ case 128: /* sortlist ::= sortlist COMMA expr sortorder */
143740
+{
143741
+ yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232,yymsp[-1].minor.yy182);
143742
+ sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy232,yymsp[0].minor.yy502);
143743
+}
143744
+ break;
143745
+ case 129: /* sortlist ::= expr sortorder */
143746
+{
143747
+ yymsp[-1].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy182); /*A-overwrites-Y*/
143748
+ sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy232,yymsp[0].minor.yy502);
143749
+}
143750
+ break;
143751
+ case 130: /* sortorder ::= ASC */
143752
+{yymsp[0].minor.yy502 = SQLITE_SO_ASC;}
143753
+ break;
143754
+ case 131: /* sortorder ::= DESC */
143755
+{yymsp[0].minor.yy502 = SQLITE_SO_DESC;}
143756
+ break;
143757
+ case 132: /* sortorder ::= */
143758
+{yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;}
143759
+ break;
143760
+ case 138: /* limit_opt ::= LIMIT expr */
143761
+{yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,0);}
143762
+ break;
143763
+ case 139: /* limit_opt ::= LIMIT expr OFFSET expr */
143764
+{yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);}
143765
+ break;
143766
+ case 140: /* limit_opt ::= LIMIT expr COMMA expr */
143767
+{yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,yymsp[-2].minor.yy182);}
143768
+ break;
143769
+ case 141: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
143770
+{
143771
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy427, &yymsp[-1].minor.yy0);
143772
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy427,yymsp[0].minor.yy182,0,0);
143773
+}
143774
+ break;
143775
+ case 144: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
143776
+{
143777
+ sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy427, &yymsp[-3].minor.yy0);
143778
+ sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy232,"set list");
143779
+ sqlite3Update(pParse,yymsp[-4].minor.yy427,yymsp[-1].minor.yy232,yymsp[0].minor.yy182,yymsp[-5].minor.yy502,0,0,0);
143780
+}
143781
+ break;
143782
+ case 145: /* setlist ::= setlist COMMA nm EQ expr */
143783
+{
143784
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[0].minor.yy182);
143785
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, 1);
143786
+}
143787
+ break;
143788
+ case 146: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
143789
+{
143790
+ yymsp[-6].minor.yy232 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy232, yymsp[-3].minor.yy510, yymsp[0].minor.yy182);
143791
+}
143792
+ break;
143793
+ case 147: /* setlist ::= nm EQ expr */
143794
+{
143795
+ yylhsminor.yy232 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy182);
143796
+ sqlite3ExprListSetName(pParse, yylhsminor.yy232, &yymsp[-2].minor.yy0, 1);
143797
+}
143798
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
143799
+ break;
143800
+ case 148: /* setlist ::= LP idlist RP EQ expr */
143801
+{
143802
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy510, yymsp[0].minor.yy182);
143803
+}
143804
+ break;
143805
+ case 149: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
143806
+{
143807
+ sqlite3Insert(pParse, yymsp[-3].minor.yy427, yymsp[-1].minor.yy399, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, yymsp[0].minor.yy198);
143808
+}
143809
+ break;
143810
+ case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
143811
+{
143812
+ sqlite3Insert(pParse, yymsp[-3].minor.yy427, 0, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, 0);
143813
+}
143814
+ break;
143815
+ case 151: /* upsert ::= */
143816
+{ yymsp[1].minor.yy198 = 0; }
143817
+ break;
143818
+ case 152: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
143819
+{ yymsp[-10].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy232,yymsp[-5].minor.yy182,yymsp[-1].minor.yy232,yymsp[0].minor.yy182);}
143820
+ break;
143821
+ case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
143822
+{ yymsp[-7].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy232,yymsp[-2].minor.yy182,0,0); }
143823
+ break;
143824
+ case 154: /* upsert ::= ON CONFLICT DO NOTHING */
143825
+{ yymsp[-3].minor.yy198 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
143826
+ break;
143827
+ case 158: /* idlist_opt ::= LP idlist RP */
143828
+{yymsp[-2].minor.yy510 = yymsp[-1].minor.yy510;}
143829
+ break;
143830
+ case 159: /* idlist ::= idlist COMMA nm */
143831
+{yymsp[-2].minor.yy510 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy510,&yymsp[0].minor.yy0);}
143832
+ break;
143833
+ case 160: /* idlist ::= nm */
143834
+{yymsp[0].minor.yy510 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
143835
+ break;
143836
+ case 161: /* expr ::= LP expr RP */
143837
+{yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182;}
143838
+ break;
143839
+ case 162: /* expr ::= ID|INDEXED */
143840
+ case 163: /* expr ::= JOIN_KW */ yytestcase(yyruleno==163);
143841
+{yymsp[0].minor.yy182=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
143842
+ break;
143843
+ case 164: /* expr ::= nm DOT nm */
142890143844
{
142891143845
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142892143846
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
142893
- yylhsminor.yy314 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
143847
+ yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
142894143848
}
142895
- yymsp[-2].minor.yy314 = yylhsminor.yy314;
143849
+ yymsp[-2].minor.yy182 = yylhsminor.yy182;
142896143850
break;
142897
- case 157: /* expr ::= nm DOT nm DOT nm */
143851
+ case 165: /* expr ::= nm DOT nm DOT nm */
142898143852
{
142899143853
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
142900143854
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142901143855
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
142902143856
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
142903
- yylhsminor.yy314 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
142904
-}
142905
- yymsp[-4].minor.yy314 = yylhsminor.yy314;
142906
- break;
142907
- case 158: /* term ::= NULL|FLOAT|BLOB */
142908
- case 159: /* term ::= STRING */ yytestcase(yyruleno==159);
142909
-{yymsp[0].minor.yy314=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
142910
- break;
142911
- case 160: /* term ::= INTEGER */
142912
-{
142913
- yylhsminor.yy314 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
142914
-}
142915
- yymsp[0].minor.yy314 = yylhsminor.yy314;
142916
- break;
142917
- case 161: /* expr ::= VARIABLE */
143857
+ yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
143858
+}
143859
+ yymsp[-4].minor.yy182 = yylhsminor.yy182;
143860
+ break;
143861
+ case 166: /* term ::= NULL|FLOAT|BLOB */
143862
+ case 167: /* term ::= STRING */ yytestcase(yyruleno==167);
143863
+{yymsp[0].minor.yy182=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
143864
+ break;
143865
+ case 168: /* term ::= INTEGER */
143866
+{
143867
+ yylhsminor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
143868
+}
143869
+ yymsp[0].minor.yy182 = yylhsminor.yy182;
143870
+ break;
143871
+ case 169: /* expr ::= VARIABLE */
142918143872
{
142919143873
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
142920143874
u32 n = yymsp[0].minor.yy0.n;
142921
- yymsp[0].minor.yy314 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
142922
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy314, n);
143875
+ yymsp[0].minor.yy182 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
143876
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy182, n);
142923143877
}else{
142924143878
/* When doing a nested parse, one can include terms in an expression
142925143879
** that look like this: #1 #2 ... These terms refer to registers
142926143880
** in the virtual machine. #N is the N-th register. */
142927143881
Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
142928143882
assert( t.n>=2 );
142929143883
if( pParse->nested==0 ){
142930143884
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
142931
- yymsp[0].minor.yy314 = 0;
142932
- }else{
142933
- yymsp[0].minor.yy314 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
142934
- if( yymsp[0].minor.yy314 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy314->iTable);
142935
- }
142936
- }
142937
-}
142938
- break;
142939
- case 162: /* expr ::= expr COLLATE ID|STRING */
142940
-{
142941
- yymsp[-2].minor.yy314 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy314, &yymsp[0].minor.yy0, 1);
142942
-}
142943
- break;
142944
- case 163: /* expr ::= CAST LP expr AS typetoken RP */
142945
-{
142946
- yymsp[-5].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
142947
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy314, yymsp[-3].minor.yy314, 0);
142948
-}
142949
- break;
142950
- case 164: /* expr ::= ID|INDEXED LP distinct exprlist RP */
142951
-{
142952
- if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
143885
+ yymsp[0].minor.yy182 = 0;
143886
+ }else{
143887
+ yymsp[0].minor.yy182 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
143888
+ if( yymsp[0].minor.yy182 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy182->iTable);
143889
+ }
143890
+ }
143891
+}
143892
+ break;
143893
+ case 170: /* expr ::= expr COLLATE ID|STRING */
143894
+{
143895
+ yymsp[-2].minor.yy182 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy182, &yymsp[0].minor.yy0, 1);
143896
+}
143897
+ break;
143898
+ case 171: /* expr ::= CAST LP expr AS typetoken RP */
143899
+{
143900
+ yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
143901
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy182, yymsp[-3].minor.yy182, 0);
143902
+}
143903
+ break;
143904
+ case 172: /* expr ::= ID|INDEXED LP distinct exprlist RP */
143905
+{
143906
+ if( yymsp[-1].minor.yy232 && yymsp[-1].minor.yy232->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
142953143907
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
142954143908
}
142955
- yylhsminor.yy314 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
142956
- if( yymsp[-2].minor.yy4==SF_Distinct && yylhsminor.yy314 ){
142957
- yylhsminor.yy314->flags |= EP_Distinct;
142958
- }
142959
-}
142960
- yymsp[-4].minor.yy314 = yylhsminor.yy314;
142961
- break;
142962
- case 165: /* expr ::= ID|INDEXED LP STAR RP */
142963
-{
142964
- yylhsminor.yy314 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
142965
-}
142966
- yymsp[-3].minor.yy314 = yylhsminor.yy314;
142967
- break;
142968
- case 166: /* term ::= CTIME_KW */
142969
-{
142970
- yylhsminor.yy314 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
142971
-}
142972
- yymsp[0].minor.yy314 = yylhsminor.yy314;
142973
- break;
142974
- case 167: /* expr ::= LP nexprlist COMMA expr RP */
142975
-{
142976
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy314);
142977
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
142978
- if( yymsp[-4].minor.yy314 ){
142979
- yymsp[-4].minor.yy314->x.pList = pList;
143909
+ yylhsminor.yy182 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy232, &yymsp[-4].minor.yy0);
143910
+ if( yymsp[-2].minor.yy502==SF_Distinct && yylhsminor.yy182 ){
143911
+ yylhsminor.yy182->flags |= EP_Distinct;
143912
+ }
143913
+}
143914
+ yymsp[-4].minor.yy182 = yylhsminor.yy182;
143915
+ break;
143916
+ case 173: /* expr ::= ID|INDEXED LP STAR RP */
143917
+{
143918
+ yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
143919
+}
143920
+ yymsp[-3].minor.yy182 = yylhsminor.yy182;
143921
+ break;
143922
+ case 174: /* term ::= CTIME_KW */
143923
+{
143924
+ yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
143925
+}
143926
+ yymsp[0].minor.yy182 = yylhsminor.yy182;
143927
+ break;
143928
+ case 175: /* expr ::= LP nexprlist COMMA expr RP */
143929
+{
143930
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy232, yymsp[-1].minor.yy182);
143931
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
143932
+ if( yymsp[-4].minor.yy182 ){
143933
+ yymsp[-4].minor.yy182->x.pList = pList;
142980143934
}else{
142981143935
sqlite3ExprListDelete(pParse->db, pList);
142982143936
}
142983143937
}
142984143938
break;
142985
- case 168: /* expr ::= expr AND expr */
142986
- case 169: /* expr ::= expr OR expr */ yytestcase(yyruleno==169);
142987
- case 170: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==170);
142988
- case 171: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==171);
142989
- case 172: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==172);
142990
- case 173: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==173);
142991
- case 174: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==174);
142992
- case 175: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==175);
142993
-{yymsp[-2].minor.yy314=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);}
143939
+ case 176: /* expr ::= expr AND expr */
143940
+ case 177: /* expr ::= expr OR expr */ yytestcase(yyruleno==177);
143941
+ case 178: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==178);
143942
+ case 179: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==179);
143943
+ case 180: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==180);
143944
+ case 181: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==181);
143945
+ case 182: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==182);
143946
+ case 183: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==183);
143947
+{yymsp[-2].minor.yy182=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);}
142994143948
break;
142995
- case 176: /* likeop ::= NOT LIKE_KW|MATCH */
143949
+ case 184: /* likeop ::= NOT LIKE_KW|MATCH */
142996143950
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
142997143951
break;
142998
- case 177: /* expr ::= expr likeop expr */
143952
+ case 185: /* expr ::= expr likeop expr */
142999143953
{
143000143954
ExprList *pList;
143001143955
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
143002143956
yymsp[-1].minor.yy0.n &= 0x7fffffff;
143003
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy314);
143004
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy314);
143005
- yymsp[-2].minor.yy314 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
143006
- if( bNot ) yymsp[-2].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy314, 0);
143007
- if( yymsp[-2].minor.yy314 ) yymsp[-2].minor.yy314->flags |= EP_InfixFunc;
143957
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy182);
143958
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy182);
143959
+ yymsp[-2].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
143960
+ if( bNot ) yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy182, 0);
143961
+ if( yymsp[-2].minor.yy182 ) yymsp[-2].minor.yy182->flags |= EP_InfixFunc;
143008143962
}
143009143963
break;
143010
- case 178: /* expr ::= expr likeop expr ESCAPE expr */
143964
+ case 186: /* expr ::= expr likeop expr ESCAPE expr */
143011143965
{
143012143966
ExprList *pList;
143013143967
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
143014143968
yymsp[-3].minor.yy0.n &= 0x7fffffff;
143015
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143016
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy314);
143017
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy314);
143018
- yymsp[-4].minor.yy314 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
143019
- if( bNot ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143020
- if( yymsp[-4].minor.yy314 ) yymsp[-4].minor.yy314->flags |= EP_InfixFunc;
143021
-}
143022
- break;
143023
- case 179: /* expr ::= expr ISNULL|NOTNULL */
143024
-{yymsp[-1].minor.yy314 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy314,0);}
143025
- break;
143026
- case 180: /* expr ::= expr NOT NULL */
143027
-{yymsp[-2].minor.yy314 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy314,0);}
143028
- break;
143029
- case 181: /* expr ::= expr IS expr */
143030
-{
143031
- yymsp[-2].minor.yy314 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);
143032
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy314, yymsp[-2].minor.yy314, TK_ISNULL);
143033
-}
143034
- break;
143035
- case 182: /* expr ::= expr IS NOT expr */
143036
-{
143037
- yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy314,yymsp[0].minor.yy314);
143038
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy314, yymsp[-3].minor.yy314, TK_NOTNULL);
143039
-}
143040
- break;
143041
- case 183: /* expr ::= NOT expr */
143042
- case 184: /* expr ::= BITNOT expr */ yytestcase(yyruleno==184);
143043
-{yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy314, 0);/*A-overwrites-B*/}
143044
- break;
143045
- case 185: /* expr ::= MINUS expr */
143046
-{yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy314, 0);}
143047
- break;
143048
- case 186: /* expr ::= PLUS expr */
143049
-{yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy314, 0);}
143050
- break;
143051
- case 187: /* between_op ::= BETWEEN */
143052
- case 190: /* in_op ::= IN */ yytestcase(yyruleno==190);
143053
-{yymsp[0].minor.yy4 = 0;}
143054
- break;
143055
- case 189: /* expr ::= expr between_op expr AND expr */
143056
-{
143057
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143058
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy314);
143059
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy314, 0);
143060
- if( yymsp[-4].minor.yy314 ){
143061
- yymsp[-4].minor.yy314->x.pList = pList;
143969
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
143970
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy182);
143971
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182);
143972
+ yymsp[-4].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
143973
+ if( bNot ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
143974
+ if( yymsp[-4].minor.yy182 ) yymsp[-4].minor.yy182->flags |= EP_InfixFunc;
143975
+}
143976
+ break;
143977
+ case 187: /* expr ::= expr ISNULL|NOTNULL */
143978
+{yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy182,0);}
143979
+ break;
143980
+ case 188: /* expr ::= expr NOT NULL */
143981
+{yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy182,0);}
143982
+ break;
143983
+ case 189: /* expr ::= expr IS expr */
143984
+{
143985
+ yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);
143986
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-2].minor.yy182, TK_ISNULL);
143987
+}
143988
+ break;
143989
+ case 190: /* expr ::= expr IS NOT expr */
143990
+{
143991
+ yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy182,yymsp[0].minor.yy182);
143992
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-3].minor.yy182, TK_NOTNULL);
143993
+}
143994
+ break;
143995
+ case 191: /* expr ::= NOT expr */
143996
+ case 192: /* expr ::= BITNOT expr */ yytestcase(yyruleno==192);
143997
+{yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy182, 0);/*A-overwrites-B*/}
143998
+ break;
143999
+ case 193: /* expr ::= MINUS expr */
144000
+{yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy182, 0);}
144001
+ break;
144002
+ case 194: /* expr ::= PLUS expr */
144003
+{yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy182, 0);}
144004
+ break;
144005
+ case 195: /* between_op ::= BETWEEN */
144006
+ case 198: /* in_op ::= IN */ yytestcase(yyruleno==198);
144007
+{yymsp[0].minor.yy502 = 0;}
144008
+ break;
144009
+ case 197: /* expr ::= expr between_op expr AND expr */
144010
+{
144011
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
144012
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182);
144013
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy182, 0);
144014
+ if( yymsp[-4].minor.yy182 ){
144015
+ yymsp[-4].minor.yy182->x.pList = pList;
143062144016
}else{
143063144017
sqlite3ExprListDelete(pParse->db, pList);
143064144018
}
143065
- if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
144019
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
143066144020
}
143067144021
break;
143068
- case 192: /* expr ::= expr in_op LP exprlist RP */
144022
+ case 200: /* expr ::= expr in_op LP exprlist RP */
143069144023
{
143070
- if( yymsp[-1].minor.yy322==0 ){
144024
+ if( yymsp[-1].minor.yy232==0 ){
143071144025
/* Expressions of the form
143072144026
**
143073144027
** expr1 IN ()
143074144028
** expr1 NOT IN ()
143075144029
**
143076144030
** simplify to constants 0 (false) and 1 (true), respectively,
143077144031
** regardless of the value of expr1.
143078144032
*/
143079
- sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy314);
143080
- yymsp[-4].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy4],1);
143081
- }else if( yymsp[-1].minor.yy322->nExpr==1 ){
144033
+ sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy182);
144034
+ yymsp[-4].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy502],1);
144035
+ }else if( yymsp[-1].minor.yy232->nExpr==1 ){
143082144036
/* Expressions of the form:
143083144037
**
143084144038
** expr1 IN (?1)
143085144039
** expr1 NOT IN (?2)
143086144040
**
@@ -143093,394 +144047,396 @@
143093144047
** But, the RHS of the == or <> is marked with the EP_Generic flag
143094144048
** so that it may not contribute to the computation of comparison
143095144049
** affinity or the collating sequence to use for comparison. Otherwise,
143096144050
** the semantics would be subtly different from IN or NOT IN.
143097144051
*/
143098
- Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
143099
- yymsp[-1].minor.yy322->a[0].pExpr = 0;
143100
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
144052
+ Expr *pRHS = yymsp[-1].minor.yy232->a[0].pExpr;
144053
+ yymsp[-1].minor.yy232->a[0].pExpr = 0;
144054
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232);
143101144055
/* pRHS cannot be NULL because a malloc error would have been detected
143102144056
** before now and control would have never reached this point */
143103144057
if( ALWAYS(pRHS) ){
143104144058
pRHS->flags &= ~EP_Collate;
143105144059
pRHS->flags |= EP_Generic;
143106144060
}
143107
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, yymsp[-3].minor.yy4 ? TK_NE : TK_EQ, yymsp[-4].minor.yy314, pRHS);
143108
- }else{
143109
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143110
- if( yymsp[-4].minor.yy314 ){
143111
- yymsp[-4].minor.yy314->x.pList = yymsp[-1].minor.yy322;
143112
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy314);
143113
- }else{
143114
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
143115
- }
143116
- if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143117
- }
143118
- }
143119
- break;
143120
- case 193: /* expr ::= LP select RP */
143121
-{
143122
- yymsp[-2].minor.yy314 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
143123
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy314, yymsp[-1].minor.yy387);
143124
- }
143125
- break;
143126
- case 194: /* expr ::= expr in_op LP select RP */
143127
-{
143128
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143129
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy314, yymsp[-1].minor.yy387);
143130
- if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143131
- }
143132
- break;
143133
- case 195: /* expr ::= expr in_op nm dbnm paren_exprlist */
144061
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_NE : TK_EQ, yymsp[-4].minor.yy182, pRHS);
144062
+ }else{
144063
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144064
+ if( yymsp[-4].minor.yy182 ){
144065
+ yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy232;
144066
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182);
144067
+ }else{
144068
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232);
144069
+ }
144070
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144071
+ }
144072
+ }
144073
+ break;
144074
+ case 201: /* expr ::= LP select RP */
144075
+{
144076
+ yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
144077
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy182, yymsp[-1].minor.yy399);
144078
+ }
144079
+ break;
144080
+ case 202: /* expr ::= expr in_op LP select RP */
144081
+{
144082
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144083
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, yymsp[-1].minor.yy399);
144084
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144085
+ }
144086
+ break;
144087
+ case 203: /* expr ::= expr in_op nm dbnm paren_exprlist */
143134144088
{
143135144089
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
143136144090
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
143137
- if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
143138
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143139
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy314, pSelect);
143140
- if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
144091
+ if( yymsp[0].minor.yy232 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy232);
144092
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144093
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, pSelect);
144094
+ if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
143141144095
}
143142144096
break;
143143
- case 196: /* expr ::= EXISTS LP select RP */
144097
+ case 204: /* expr ::= EXISTS LP select RP */
143144144098
{
143145144099
Expr *p;
143146
- p = yymsp[-3].minor.yy314 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
143147
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy387);
143148
- }
143149
- break;
143150
- case 197: /* expr ::= CASE case_operand case_exprlist case_else END */
143151
-{
143152
- yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, 0);
143153
- if( yymsp[-4].minor.yy314 ){
143154
- yymsp[-4].minor.yy314->x.pList = yymsp[-1].minor.yy314 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy314) : yymsp[-2].minor.yy322;
143155
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy314);
143156
- }else{
143157
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
143158
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy314);
143159
- }
143160
-}
143161
- break;
143162
- case 198: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
143163
-{
143164
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy314);
143165
- yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy314);
143166
-}
143167
- break;
143168
- case 199: /* case_exprlist ::= WHEN expr THEN expr */
143169
-{
143170
- yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143171
- yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy314);
143172
-}
143173
- break;
143174
- case 202: /* case_operand ::= expr */
143175
-{yymsp[0].minor.yy314 = yymsp[0].minor.yy314; /*A-overwrites-X*/}
143176
- break;
143177
- case 205: /* nexprlist ::= nexprlist COMMA expr */
143178
-{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy314);}
143179
- break;
143180
- case 206: /* nexprlist ::= expr */
143181
-{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy314); /*A-overwrites-Y*/}
143182
- break;
143183
- case 208: /* paren_exprlist ::= LP exprlist RP */
143184
- case 213: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==213);
143185
-{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
143186
- break;
143187
- case 209: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
144100
+ p = yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
144101
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy399);
144102
+ }
144103
+ break;
144104
+ case 205: /* expr ::= CASE case_operand case_exprlist case_else END */
144105
+{
144106
+ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy182, 0);
144107
+ if( yymsp[-4].minor.yy182 ){
144108
+ yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy182 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[-1].minor.yy182) : yymsp[-2].minor.yy232;
144109
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182);
144110
+ }else{
144111
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy232);
144112
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy182);
144113
+ }
144114
+}
144115
+ break;
144116
+ case 206: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
144117
+{
144118
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[-2].minor.yy182);
144119
+ yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[0].minor.yy182);
144120
+}
144121
+ break;
144122
+ case 207: /* case_exprlist ::= WHEN expr THEN expr */
144123
+{
144124
+ yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
144125
+ yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232, yymsp[0].minor.yy182);
144126
+}
144127
+ break;
144128
+ case 210: /* case_operand ::= expr */
144129
+{yymsp[0].minor.yy182 = yymsp[0].minor.yy182; /*A-overwrites-X*/}
144130
+ break;
144131
+ case 213: /* nexprlist ::= nexprlist COMMA expr */
144132
+{yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[0].minor.yy182);}
144133
+ break;
144134
+ case 214: /* nexprlist ::= expr */
144135
+{yymsp[0].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy182); /*A-overwrites-Y*/}
144136
+ break;
144137
+ case 216: /* paren_exprlist ::= LP exprlist RP */
144138
+ case 221: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==221);
144139
+{yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232;}
144140
+ break;
144141
+ case 217: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
143188144142
{
143189144143
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
143190
- sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy4,
143191
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy314, SQLITE_SO_ASC, yymsp[-8].minor.yy4, SQLITE_IDXTYPE_APPDEF);
143192
-}
143193
- break;
143194
- case 210: /* uniqueflag ::= UNIQUE */
143195
- case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);
143196
-{yymsp[0].minor.yy4 = OE_Abort;}
143197
- break;
143198
- case 211: /* uniqueflag ::= */
143199
-{yymsp[1].minor.yy4 = OE_None;}
143200
- break;
143201
- case 214: /* eidlist ::= eidlist COMMA nm collate sortorder */
143202
-{
143203
- yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy4, yymsp[0].minor.yy4);
143204
-}
143205
- break;
143206
- case 215: /* eidlist ::= nm collate sortorder */
143207
-{
143208
- yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy4, yymsp[0].minor.yy4); /*A-overwrites-Y*/
143209
-}
143210
- break;
143211
- case 218: /* cmd ::= DROP INDEX ifexists fullname */
143212
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
143213
- break;
143214
- case 219: /* cmd ::= VACUUM */
144144
+ sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy232, yymsp[-10].minor.yy502,
144145
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy182, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF);
144146
+}
144147
+ break;
144148
+ case 218: /* uniqueflag ::= UNIQUE */
144149
+ case 258: /* raisetype ::= ABORT */ yytestcase(yyruleno==258);
144150
+{yymsp[0].minor.yy502 = OE_Abort;}
144151
+ break;
144152
+ case 219: /* uniqueflag ::= */
144153
+{yymsp[1].minor.yy502 = OE_None;}
144154
+ break;
144155
+ case 222: /* eidlist ::= eidlist COMMA nm collate sortorder */
144156
+{
144157
+ yymsp[-4].minor.yy232 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502);
144158
+}
144159
+ break;
144160
+ case 223: /* eidlist ::= nm collate sortorder */
144161
+{
144162
+ yymsp[-2].minor.yy232 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/
144163
+}
144164
+ break;
144165
+ case 226: /* cmd ::= DROP INDEX ifexists fullname */
144166
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy427, yymsp[-1].minor.yy502);}
144167
+ break;
144168
+ case 227: /* cmd ::= VACUUM */
143215144169
{sqlite3Vacuum(pParse,0);}
143216144170
break;
143217
- case 220: /* cmd ::= VACUUM nm */
144171
+ case 228: /* cmd ::= VACUUM nm */
143218144172
{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
143219144173
break;
143220
- case 221: /* cmd ::= PRAGMA nm dbnm */
144174
+ case 229: /* cmd ::= PRAGMA nm dbnm */
143221144175
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
143222144176
break;
143223
- case 222: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
144177
+ case 230: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
143224144178
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
143225144179
break;
143226
- case 223: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
144180
+ case 231: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
143227144181
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
143228144182
break;
143229
- case 224: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
144183
+ case 232: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
143230144184
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
143231144185
break;
143232
- case 225: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
144186
+ case 233: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
143233144187
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
143234144188
break;
143235
- case 228: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
144189
+ case 236: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
143236144190
{
143237144191
Token all;
143238144192
all.z = yymsp[-3].minor.yy0.z;
143239144193
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
143240
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
144194
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy47, &all);
143241144195
}
143242144196
break;
143243
- case 229: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
144197
+ case 237: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
143244144198
{
143245
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy4, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy259, yymsp[0].minor.yy314, yymsp[-10].minor.yy4, yymsp[-8].minor.yy4);
144199
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy502, yymsp[-4].minor.yy300.a, yymsp[-4].minor.yy300.b, yymsp[-2].minor.yy427, yymsp[0].minor.yy182, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502);
143246144200
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
143247144201
}
143248144202
break;
143249
- case 230: /* trigger_time ::= BEFORE|AFTER */
143250
-{ yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-X*/ }
143251
- break;
143252
- case 231: /* trigger_time ::= INSTEAD OF */
143253
-{ yymsp[-1].minor.yy4 = TK_INSTEAD;}
143254
- break;
143255
- case 232: /* trigger_time ::= */
143256
-{ yymsp[1].minor.yy4 = TK_BEFORE; }
143257
- break;
143258
- case 233: /* trigger_event ::= DELETE|INSERT */
143259
- case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);
143260
-{yymsp[0].minor.yy90.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy90.b = 0;}
143261
- break;
143262
- case 235: /* trigger_event ::= UPDATE OF idlist */
143263
-{yymsp[-2].minor.yy90.a = TK_UPDATE; yymsp[-2].minor.yy90.b = yymsp[0].minor.yy384;}
143264
- break;
143265
- case 236: /* when_clause ::= */
143266
- case 255: /* key_opt ::= */ yytestcase(yyruleno==255);
143267
-{ yymsp[1].minor.yy314 = 0; }
143268
- break;
143269
- case 237: /* when_clause ::= WHEN expr */
143270
- case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);
143271
-{ yymsp[-1].minor.yy314 = yymsp[0].minor.yy314; }
143272
- break;
143273
- case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
143274
-{
143275
- assert( yymsp[-2].minor.yy203!=0 );
143276
- yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
143277
- yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
143278
-}
143279
- break;
143280
- case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */
143281
-{
143282
- assert( yymsp[-1].minor.yy203!=0 );
143283
- yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
143284
-}
143285
- break;
143286
- case 240: /* trnm ::= nm DOT nm */
144203
+ case 238: /* trigger_time ::= BEFORE|AFTER */
144204
+{ yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ }
144205
+ break;
144206
+ case 239: /* trigger_time ::= INSTEAD OF */
144207
+{ yymsp[-1].minor.yy502 = TK_INSTEAD;}
144208
+ break;
144209
+ case 240: /* trigger_time ::= */
144210
+{ yymsp[1].minor.yy502 = TK_BEFORE; }
144211
+ break;
144212
+ case 241: /* trigger_event ::= DELETE|INSERT */
144213
+ case 242: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==242);
144214
+{yymsp[0].minor.yy300.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy300.b = 0;}
144215
+ break;
144216
+ case 243: /* trigger_event ::= UPDATE OF idlist */
144217
+{yymsp[-2].minor.yy300.a = TK_UPDATE; yymsp[-2].minor.yy300.b = yymsp[0].minor.yy510;}
144218
+ break;
144219
+ case 244: /* when_clause ::= */
144220
+ case 263: /* key_opt ::= */ yytestcase(yyruleno==263);
144221
+{ yymsp[1].minor.yy182 = 0; }
144222
+ break;
144223
+ case 245: /* when_clause ::= WHEN expr */
144224
+ case 264: /* key_opt ::= KEY expr */ yytestcase(yyruleno==264);
144225
+{ yymsp[-1].minor.yy182 = yymsp[0].minor.yy182; }
144226
+ break;
144227
+ case 246: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
144228
+{
144229
+ assert( yymsp[-2].minor.yy47!=0 );
144230
+ yymsp[-2].minor.yy47->pLast->pNext = yymsp[-1].minor.yy47;
144231
+ yymsp[-2].minor.yy47->pLast = yymsp[-1].minor.yy47;
144232
+}
144233
+ break;
144234
+ case 247: /* trigger_cmd_list ::= trigger_cmd SEMI */
144235
+{
144236
+ assert( yymsp[-1].minor.yy47!=0 );
144237
+ yymsp[-1].minor.yy47->pLast = yymsp[-1].minor.yy47;
144238
+}
144239
+ break;
144240
+ case 248: /* trnm ::= nm DOT nm */
143287144241
{
143288144242
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
143289144243
sqlite3ErrorMsg(pParse,
143290144244
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
143291144245
"statements within triggers");
143292144246
}
143293144247
break;
143294
- case 241: /* tridxby ::= INDEXED BY nm */
144248
+ case 249: /* tridxby ::= INDEXED BY nm */
143295144249
{
143296144250
sqlite3ErrorMsg(pParse,
143297144251
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
143298144252
"within triggers");
143299144253
}
143300144254
break;
143301
- case 242: /* tridxby ::= NOT INDEXED */
144255
+ case 250: /* tridxby ::= NOT INDEXED */
143302144256
{
143303144257
sqlite3ErrorMsg(pParse,
143304144258
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
143305144259
"within triggers");
143306144260
}
143307144261
break;
143308
- case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
143309
-{yylhsminor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy314, yymsp[-6].minor.yy4, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy336);}
143310
- yymsp[-7].minor.yy203 = yylhsminor.yy203;
143311
- break;
143312
- case 244: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt */
143313
-{yylhsminor.yy203 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-3].minor.yy0,yymsp[-2].minor.yy384,yymsp[-1].minor.yy387,yymsp[-5].minor.yy4,yymsp[-6].minor.yy336,yymsp[0].minor.yy336);/*yylhsminor.yy203-overwrites-yymsp[-5].minor.yy4*/}
143314
- yymsp[-6].minor.yy203 = yylhsminor.yy203;
143315
- break;
143316
- case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
143317
-{yylhsminor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy314, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy336);}
143318
- yymsp[-5].minor.yy203 = yylhsminor.yy203;
143319
- break;
143320
- case 246: /* trigger_cmd ::= scanpt select scanpt */
143321
-{yylhsminor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy387, yymsp[-2].minor.yy336, yymsp[0].minor.yy336); /*yylhsminor.yy203-overwrites-yymsp[-1].minor.yy387*/}
143322
- yymsp[-2].minor.yy203 = yylhsminor.yy203;
143323
- break;
143324
- case 247: /* expr ::= RAISE LP IGNORE RP */
143325
-{
143326
- yymsp[-3].minor.yy314 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
143327
- if( yymsp[-3].minor.yy314 ){
143328
- yymsp[-3].minor.yy314->affinity = OE_Ignore;
143329
- }
143330
-}
143331
- break;
143332
- case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */
143333
-{
143334
- yymsp[-5].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
143335
- if( yymsp[-5].minor.yy314 ) {
143336
- yymsp[-5].minor.yy314->affinity = (char)yymsp[-3].minor.yy4;
143337
- }
143338
-}
143339
- break;
143340
- case 249: /* raisetype ::= ROLLBACK */
143341
-{yymsp[0].minor.yy4 = OE_Rollback;}
143342
- break;
143343
- case 251: /* raisetype ::= FAIL */
143344
-{yymsp[0].minor.yy4 = OE_Fail;}
143345
- break;
143346
- case 252: /* cmd ::= DROP TRIGGER ifexists fullname */
143347
-{
143348
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
143349
-}
143350
- break;
143351
- case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
143352
-{
143353
- sqlite3Attach(pParse, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, yymsp[0].minor.yy314);
143354
-}
143355
- break;
143356
- case 254: /* cmd ::= DETACH database_kw_opt expr */
143357
-{
143358
- sqlite3Detach(pParse, yymsp[0].minor.yy314);
143359
-}
143360
- break;
143361
- case 257: /* cmd ::= REINDEX */
144262
+ case 251: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
144263
+{yylhsminor.yy47 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy182, yymsp[-6].minor.yy502, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy36);}
144264
+ yymsp[-7].minor.yy47 = yylhsminor.yy47;
144265
+ break;
144266
+ case 252: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
144267
+{
144268
+ yylhsminor.yy47 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy510,yymsp[-2].minor.yy399,yymsp[-6].minor.yy502,yymsp[-1].minor.yy198,yymsp[-7].minor.yy36,yymsp[0].minor.yy36);/*yylhsminor.yy47-overwrites-yymsp[-6].minor.yy502*/
144269
+}
144270
+ yymsp[-7].minor.yy47 = yylhsminor.yy47;
144271
+ break;
144272
+ case 253: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
144273
+{yylhsminor.yy47 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy182, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy36);}
144274
+ yymsp[-5].minor.yy47 = yylhsminor.yy47;
144275
+ break;
144276
+ case 254: /* trigger_cmd ::= scanpt select scanpt */
144277
+{yylhsminor.yy47 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy399, yymsp[-2].minor.yy36, yymsp[0].minor.yy36); /*yylhsminor.yy47-overwrites-yymsp[-1].minor.yy399*/}
144278
+ yymsp[-2].minor.yy47 = yylhsminor.yy47;
144279
+ break;
144280
+ case 255: /* expr ::= RAISE LP IGNORE RP */
144281
+{
144282
+ yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
144283
+ if( yymsp[-3].minor.yy182 ){
144284
+ yymsp[-3].minor.yy182->affinity = OE_Ignore;
144285
+ }
144286
+}
144287
+ break;
144288
+ case 256: /* expr ::= RAISE LP raisetype COMMA nm RP */
144289
+{
144290
+ yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
144291
+ if( yymsp[-5].minor.yy182 ) {
144292
+ yymsp[-5].minor.yy182->affinity = (char)yymsp[-3].minor.yy502;
144293
+ }
144294
+}
144295
+ break;
144296
+ case 257: /* raisetype ::= ROLLBACK */
144297
+{yymsp[0].minor.yy502 = OE_Rollback;}
144298
+ break;
144299
+ case 259: /* raisetype ::= FAIL */
144300
+{yymsp[0].minor.yy502 = OE_Fail;}
144301
+ break;
144302
+ case 260: /* cmd ::= DROP TRIGGER ifexists fullname */
144303
+{
144304
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy427,yymsp[-1].minor.yy502);
144305
+}
144306
+ break;
144307
+ case 261: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
144308
+{
144309
+ sqlite3Attach(pParse, yymsp[-3].minor.yy182, yymsp[-1].minor.yy182, yymsp[0].minor.yy182);
144310
+}
144311
+ break;
144312
+ case 262: /* cmd ::= DETACH database_kw_opt expr */
144313
+{
144314
+ sqlite3Detach(pParse, yymsp[0].minor.yy182);
144315
+}
144316
+ break;
144317
+ case 265: /* cmd ::= REINDEX */
143362144318
{sqlite3Reindex(pParse, 0, 0);}
143363144319
break;
143364
- case 258: /* cmd ::= REINDEX nm dbnm */
144320
+ case 266: /* cmd ::= REINDEX nm dbnm */
143365144321
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
143366144322
break;
143367
- case 259: /* cmd ::= ANALYZE */
144323
+ case 267: /* cmd ::= ANALYZE */
143368144324
{sqlite3Analyze(pParse, 0, 0);}
143369144325
break;
143370
- case 260: /* cmd ::= ANALYZE nm dbnm */
144326
+ case 268: /* cmd ::= ANALYZE nm dbnm */
143371144327
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
143372144328
break;
143373
- case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
144329
+ case 269: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
143374144330
{
143375
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
144331
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy427,&yymsp[0].minor.yy0);
143376144332
}
143377144333
break;
143378
- case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
144334
+ case 270: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
143379144335
{
143380144336
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
143381144337
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
143382144338
}
143383144339
break;
143384
- case 263: /* add_column_fullname ::= fullname */
144340
+ case 271: /* add_column_fullname ::= fullname */
143385144341
{
143386144342
disableLookaside(pParse);
143387
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
144343
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy427);
143388144344
}
143389144345
break;
143390
- case 264: /* cmd ::= create_vtab */
144346
+ case 272: /* cmd ::= create_vtab */
143391144347
{sqlite3VtabFinishParse(pParse,0);}
143392144348
break;
143393
- case 265: /* cmd ::= create_vtab LP vtabarglist RP */
144349
+ case 273: /* cmd ::= create_vtab LP vtabarglist RP */
143394144350
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
143395144351
break;
143396
- case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
144352
+ case 274: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
143397144353
{
143398
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy4);
144354
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy502);
143399144355
}
143400144356
break;
143401
- case 267: /* vtabarg ::= */
144357
+ case 275: /* vtabarg ::= */
143402144358
{sqlite3VtabArgInit(pParse);}
143403144359
break;
143404
- case 268: /* vtabargtoken ::= ANY */
143405
- case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);
143406
- case 270: /* lp ::= LP */ yytestcase(yyruleno==270);
144360
+ case 276: /* vtabargtoken ::= ANY */
144361
+ case 277: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==277);
144362
+ case 278: /* lp ::= LP */ yytestcase(yyruleno==278);
143407144363
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
143408144364
break;
143409
- case 271: /* with ::= WITH wqlist */
143410
- case 272: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==272);
143411
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy451, 1); }
143412
- break;
143413
- case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
143414
-{
143415
- yymsp[-5].minor.yy451 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy387); /*A-overwrites-X*/
143416
-}
143417
- break;
143418
- case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
143419
-{
143420
- yymsp[-7].minor.yy451 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy451, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy387);
144365
+ case 279: /* with ::= WITH wqlist */
144366
+ case 280: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==280);
144367
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy91, 1); }
144368
+ break;
144369
+ case 281: /* wqlist ::= nm eidlist_opt AS LP select RP */
144370
+{
144371
+ yymsp[-5].minor.yy91 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399); /*A-overwrites-X*/
144372
+}
144373
+ break;
144374
+ case 282: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
144375
+{
144376
+ yymsp[-7].minor.yy91 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy91, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399);
143421144377
}
143422144378
break;
143423144379
default:
143424
- /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
143425
- /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
143426
- /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
143427
- /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
143428
- /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
143429
- /* (280) explain ::= */ yytestcase(yyruleno==280);
143430
- /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
143431
- /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
143432
- /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
143433
- /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
143434
- /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
143435
- /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
143436
- /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
143437
- /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
143438
- /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
143439
- /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
143440
- /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
143441
- /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
143442
- /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
143443
- /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
143444
- /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
143445
- /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
143446
- /* (297) carglist ::= */ yytestcase(yyruleno==297);
143447
- /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
143448
- /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
143449
- /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
143450
- /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
143451
- /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
143452
- /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
143453
- /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
143454
- /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
143455
- /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
143456
- /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
143457
- /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
143458
- /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
143459
- /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310);
143460
- /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
143461
- /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
143462
- /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
143463
- /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
143464
- /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
143465
- /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316);
143466
- /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317);
143467
- /* (318) foreach_clause ::= */ yytestcase(yyruleno==318);
143468
- /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319);
143469
- /* (320) trnm ::= nm */ yytestcase(yyruleno==320);
143470
- /* (321) tridxby ::= */ yytestcase(yyruleno==321);
143471
- /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322);
143472
- /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323);
143473
- /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324);
143474
- /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325);
143475
- /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326);
143476
- /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327);
143477
- /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328);
143478
- /* (329) anylist ::= */ yytestcase(yyruleno==329);
143479
- /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330);
143480
- /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331);
143481
- /* (332) with ::= */ yytestcase(yyruleno==332);
144380
+ /* (283) input ::= cmdlist */ yytestcase(yyruleno==283);
144381
+ /* (284) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==284);
144382
+ /* (285) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=285);
144383
+ /* (286) ecmd ::= SEMI */ yytestcase(yyruleno==286);
144384
+ /* (287) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==287);
144385
+ /* (288) ecmd ::= explain cmdx */ yytestcase(yyruleno==288);
144386
+ /* (289) trans_opt ::= */ yytestcase(yyruleno==289);
144387
+ /* (290) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==290);
144388
+ /* (291) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==291);
144389
+ /* (292) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==292);
144390
+ /* (293) savepoint_opt ::= */ yytestcase(yyruleno==293);
144391
+ /* (294) cmd ::= create_table create_table_args */ yytestcase(yyruleno==294);
144392
+ /* (295) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==295);
144393
+ /* (296) columnlist ::= columnname carglist */ yytestcase(yyruleno==296);
144394
+ /* (297) nm ::= ID|INDEXED */ yytestcase(yyruleno==297);
144395
+ /* (298) nm ::= STRING */ yytestcase(yyruleno==298);
144396
+ /* (299) nm ::= JOIN_KW */ yytestcase(yyruleno==299);
144397
+ /* (300) typetoken ::= typename */ yytestcase(yyruleno==300);
144398
+ /* (301) typename ::= ID|STRING */ yytestcase(yyruleno==301);
144399
+ /* (302) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=302);
144400
+ /* (303) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=303);
144401
+ /* (304) carglist ::= carglist ccons */ yytestcase(yyruleno==304);
144402
+ /* (305) carglist ::= */ yytestcase(yyruleno==305);
144403
+ /* (306) ccons ::= NULL onconf */ yytestcase(yyruleno==306);
144404
+ /* (307) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==307);
144405
+ /* (308) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==308);
144406
+ /* (309) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=309);
144407
+ /* (310) tconscomma ::= */ yytestcase(yyruleno==310);
144408
+ /* (311) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=311);
144409
+ /* (312) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=312);
144410
+ /* (313) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=313);
144411
+ /* (314) oneselect ::= values */ yytestcase(yyruleno==314);
144412
+ /* (315) sclp ::= selcollist COMMA */ yytestcase(yyruleno==315);
144413
+ /* (316) as ::= ID|STRING */ yytestcase(yyruleno==316);
144414
+ /* (317) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=317);
144415
+ /* (318) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==318);
144416
+ /* (319) exprlist ::= nexprlist */ yytestcase(yyruleno==319);
144417
+ /* (320) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=320);
144418
+ /* (321) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=321);
144419
+ /* (322) nmnum ::= ON */ yytestcase(yyruleno==322);
144420
+ /* (323) nmnum ::= DELETE */ yytestcase(yyruleno==323);
144421
+ /* (324) nmnum ::= DEFAULT */ yytestcase(yyruleno==324);
144422
+ /* (325) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==325);
144423
+ /* (326) foreach_clause ::= */ yytestcase(yyruleno==326);
144424
+ /* (327) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==327);
144425
+ /* (328) trnm ::= nm */ yytestcase(yyruleno==328);
144426
+ /* (329) tridxby ::= */ yytestcase(yyruleno==329);
144427
+ /* (330) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==330);
144428
+ /* (331) database_kw_opt ::= */ yytestcase(yyruleno==331);
144429
+ /* (332) kwcolumn_opt ::= */ yytestcase(yyruleno==332);
144430
+ /* (333) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==333);
144431
+ /* (334) vtabarglist ::= vtabarg */ yytestcase(yyruleno==334);
144432
+ /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==335);
144433
+ /* (336) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==336);
144434
+ /* (337) anylist ::= */ yytestcase(yyruleno==337);
144435
+ /* (338) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==338);
144436
+ /* (339) anylist ::= anylist ANY */ yytestcase(yyruleno==339);
144437
+ /* (340) with ::= */ yytestcase(yyruleno==340);
143482144438
break;
143483144439
/********** End reduce actions ************************************************/
143484144440
};
143485144441
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
143486144442
yygoto = yyRuleInfo[yyruleno].lhs;
@@ -143497,20 +144453,22 @@
143497144453
yymsp += yysize+1;
143498144454
yypParser->yytos = yymsp;
143499144455
yymsp->stateno = (YYACTIONTYPE)yyact;
143500144456
yymsp->major = (YYCODETYPE)yygoto;
143501144457
yyTraceShift(yypParser, yyact, "... then shift");
144458
+ return yyact;
143502144459
}
143503144460
143504144461
/*
143505144462
** The following code executes when the parse fails
143506144463
*/
143507144464
#ifndef YYNOERRORRECOVERY
143508144465
static void yy_parse_failed(
143509144466
yyParser *yypParser /* The parser */
143510144467
){
143511
- sqlite3ParserARG_FETCH;
144468
+ sqlite3ParserARG_FETCH
144469
+ sqlite3ParserCTX_FETCH
143512144470
#ifndef NDEBUG
143513144471
if( yyTraceFILE ){
143514144472
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
143515144473
}
143516144474
#endif
@@ -143517,11 +144475,12 @@
143517144475
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
143518144476
/* Here code is inserted which will be executed whenever the
143519144477
** parser fails */
143520144478
/************ Begin %parse_failure code ***************************************/
143521144479
/************ End %parse_failure code *****************************************/
143522
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
144480
+ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144481
+ sqlite3ParserCTX_STORE
143523144482
}
143524144483
#endif /* YYNOERRORRECOVERY */
143525144484
143526144485
/*
143527144486
** The following code executes when a syntax error first occurs.
@@ -143529,11 +144488,12 @@
143529144488
static void yy_syntax_error(
143530144489
yyParser *yypParser, /* The parser */
143531144490
int yymajor, /* The major type of the error token */
143532144491
sqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */
143533144492
){
143534
- sqlite3ParserARG_FETCH;
144493
+ sqlite3ParserARG_FETCH
144494
+ sqlite3ParserCTX_FETCH
143535144495
#define TOKEN yyminor
143536144496
/************ Begin %syntax_error code ****************************************/
143537144497
143538144498
UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
143539144499
if( TOKEN.z[0] ){
@@ -143540,20 +144500,22 @@
143540144500
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
143541144501
}else{
143542144502
sqlite3ErrorMsg(pParse, "incomplete input");
143543144503
}
143544144504
/************ End %syntax_error code ******************************************/
143545
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
144505
+ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144506
+ sqlite3ParserCTX_STORE
143546144507
}
143547144508
143548144509
/*
143549144510
** The following is executed when the parser accepts
143550144511
*/
143551144512
static void yy_accept(
143552144513
yyParser *yypParser /* The parser */
143553144514
){
143554
- sqlite3ParserARG_FETCH;
144515
+ sqlite3ParserARG_FETCH
144516
+ sqlite3ParserCTX_FETCH
143555144517
#ifndef NDEBUG
143556144518
if( yyTraceFILE ){
143557144519
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
143558144520
}
143559144521
#endif
@@ -143563,11 +144525,12 @@
143563144525
assert( yypParser->yytos==yypParser->yystack );
143564144526
/* Here code is inserted which will be executed whenever the
143565144527
** parser accepts */
143566144528
/*********** Begin %parse_accept code *****************************************/
143567144529
/*********** End %parse_accept code *******************************************/
143568
- sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
144530
+ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144531
+ sqlite3ParserCTX_STORE
143569144532
}
143570144533
143571144534
/* The main parser program.
143572144535
** The first argument is a pointer to a structure obtained from
143573144536
** "sqlite3ParserAlloc" which describes the current state of the parser.
@@ -143592,49 +144555,51 @@
143592144555
int yymajor, /* The major token code number */
143593144556
sqlite3ParserTOKENTYPE yyminor /* The value for the token */
143594144557
sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */
143595144558
){
143596144559
YYMINORTYPE yyminorunion;
143597
- unsigned int yyact; /* The parser action. */
144560
+ YYACTIONTYPE yyact; /* The parser action. */
143598144561
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
143599144562
int yyendofinput; /* True if we are at the end of input */
143600144563
#endif
143601144564
#ifdef YYERRORSYMBOL
143602144565
int yyerrorhit = 0; /* True if yymajor has invoked an error */
143603144566
#endif
143604
- yyParser *yypParser; /* The parser */
144567
+ yyParser *yypParser = (yyParser*)yyp; /* The parser */
144568
+ sqlite3ParserCTX_FETCH
144569
+ sqlite3ParserARG_STORE
143605144570
143606
- yypParser = (yyParser*)yyp;
143607144571
assert( yypParser->yytos!=0 );
143608144572
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
143609144573
yyendofinput = (yymajor==0);
143610144574
#endif
143611
- sqlite3ParserARG_STORE;
143612144575
144576
+ yyact = yypParser->yytos->stateno;
143613144577
#ifndef NDEBUG
143614144578
if( yyTraceFILE ){
143615
- int stateno = yypParser->yytos->stateno;
143616
- if( stateno < YY_MIN_REDUCE ){
144579
+ if( yyact < YY_MIN_REDUCE ){
143617144580
fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
143618
- yyTracePrompt,yyTokenName[yymajor],stateno);
144581
+ yyTracePrompt,yyTokenName[yymajor],yyact);
143619144582
}else{
143620144583
fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
143621
- yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
144584
+ yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
143622144585
}
143623144586
}
143624144587
#endif
143625144588
143626144589
do{
143627
- yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
144590
+ assert( yyact==yypParser->yytos->stateno );
144591
+ yyact = yy_find_shift_action(yymajor,yyact);
143628144592
if( yyact >= YY_MIN_REDUCE ){
143629
- yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
144593
+ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
144594
+ yyminor sqlite3ParserCTX_PARAM);
143630144595
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
143631144596
yy_shift(yypParser,yyact,yymajor,yyminor);
143632144597
#ifndef YYNOERRORRECOVERY
143633144598
yypParser->yyerrcnt--;
143634144599
#endif
143635
- yymajor = YYNOCODE;
144600
+ break;
143636144601
}else if( yyact==YY_ACCEPT_ACTION ){
143637144602
yypParser->yytos--;
143638144603
yy_accept(yypParser);
143639144604
return;
143640144605
}else{
@@ -143701,10 +144666,12 @@
143701144666
yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
143702144667
}
143703144668
}
143704144669
yypParser->yyerrcnt = 3;
143705144670
yyerrorhit = 1;
144671
+ if( yymajor==YYNOCODE ) break;
144672
+ yyact = yypParser->yytos->stateno;
143706144673
#elif defined(YYNOERRORRECOVERY)
143707144674
/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
143708144675
** do any kind of error recovery. Instead, simply invoke the syntax
143709144676
** error routine and continue going as if nothing had happened.
143710144677
**
@@ -143711,12 +144678,11 @@
143711144678
** Applications can set this macro (for example inside %include) if
143712144679
** they intend to abandon the parse upon the first syntax error seen.
143713144680
*/
143714144681
yy_syntax_error(yypParser,yymajor, yyminor);
143715144682
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
143716
- yymajor = YYNOCODE;
143717
-
144683
+ break;
143718144684
#else /* YYERRORSYMBOL is not defined */
143719144685
/* This is what we do if the grammar does not define ERROR:
143720144686
**
143721144687
** * Report an error message, and throw away the input token.
143722144688
**
@@ -143734,14 +144700,14 @@
143734144700
yy_parse_failed(yypParser);
143735144701
#ifndef YYNOERRORRECOVERY
143736144702
yypParser->yyerrcnt = -1;
143737144703
#endif
143738144704
}
143739
- yymajor = YYNOCODE;
144705
+ break;
143740144706
#endif
143741144707
}
143742
- }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
144708
+ }while( yypParser->yytos>yypParser->yystack );
143743144709
#ifndef NDEBUG
143744144710
if( yyTraceFILE ){
143745144711
yyStackEntry *i;
143746144712
char cDiv = '[';
143747144713
fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -143914,23 +144880,23 @@
143914144880
** might be implemented more directly using a hand-written hash table.
143915144881
** But by using this automatically generated code, the size of the code
143916144882
** is substantially reduced. This is important for embedded applications
143917144883
** on platforms with limited memory.
143918144884
*/
143919
-/* Hash score: 182 */
143920
-/* zKWText[] encodes 834 bytes of keyword text in 554 bytes */
144885
+/* Hash score: 185 */
144886
+/* zKWText[] encodes 845 bytes of keyword text in 561 bytes */
143921144887
/* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
143922144888
/* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
143923144889
/* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
143924144890
/* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
143925
-/* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
143926
-/* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
143927
-/* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
143928
-/* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
143929
-/* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
143930
-/* VACUUMVIEWINITIALLY */
143931
-static const char zKWText[553] = {
144891
+/* BETWEENOTHINGLOBYCASCADELETECASECOLLATECREATECURRENT_DATE */
144892
+/* DETACHIMMEDIATEJOINSERTLIKEMATCHPLANALYZEPRAGMABORTVALUES */
144893
+/* VIRTUALIMITWHENOTNULLWHERENAMEAFTEREPLACEANDEFAULT */
144894
+/* AUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP */
144895
+/* RIMARYDEFERREDISTINCTDORDERESTRICTDROPFAILFROMFULLIFISNULL */
144896
+/* RIGHTROLLBACKROWUNIONUSINGVACUUMVIEWINITIALLY */
144897
+static const char zKWText[560] = {
143932144898
'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
143933144899
'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
143934144900
'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
143935144901
'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
143936144902
'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
@@ -143940,86 +144906,87 @@
143940144906
'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
143941144907
'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
143942144908
'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
143943144909
'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
143944144910
'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
143945
- 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
143946
- 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
143947
- 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
143948
- 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
143949
- 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
143950
- 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
143951
- 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
143952
- 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
143953
- 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
143954
- 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
143955
- 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
143956
- 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
143957
- 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
143958
- 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
143959
- 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
143960
- 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
143961
- 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
143962
- 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
144911
+ 'B','E','T','W','E','E','N','O','T','H','I','N','G','L','O','B','Y','C',
144912
+ 'A','S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L',
144913
+ 'A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D',
144914
+ 'A','T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E',
144915
+ 'J','O','I','N','S','E','R','T','L','I','K','E','M','A','T','C','H','P',
144916
+ 'L','A','N','A','L','Y','Z','E','P','R','A','G','M','A','B','O','R','T',
144917
+ 'V','A','L','U','E','S','V','I','R','T','U','A','L','I','M','I','T','W',
144918
+ 'H','E','N','O','T','N','U','L','L','W','H','E','R','E','N','A','M','E',
144919
+ 'A','F','T','E','R','E','P','L','A','C','E','A','N','D','E','F','A','U',
144920
+ 'L','T','A','U','T','O','I','N','C','R','E','M','E','N','T','C','A','S',
144921
+ 'T','C','O','L','U','M','N','C','O','M','M','I','T','C','O','N','F','L',
144922
+ 'I','C','T','C','R','O','S','S','C','U','R','R','E','N','T','_','T','I',
144923
+ 'M','E','S','T','A','M','P','R','I','M','A','R','Y','D','E','F','E','R',
144924
+ 'R','E','D','I','S','T','I','N','C','T','D','O','R','D','E','R','E','S',
144925
+ 'T','R','I','C','T','D','R','O','P','F','A','I','L','F','R','O','M','F',
144926
+ 'U','L','L','I','F','I','S','N','U','L','L','R','I','G','H','T','R','O',
144927
+ 'L','L','B','A','C','K','R','O','W','U','N','I','O','N','U','S','I','N',
144928
+ 'G','V','A','C','U','U','M','V','I','E','W','I','N','I','T','I','A','L',
144929
+ 'L','Y',
143963144930
};
143964144931
/* aKWHash[i] is the hash value for the i-th keyword */
143965144932
static const unsigned char aKWHash[127] = {
143966
- 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
143967
- 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
143968
- 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
143969
- 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
143970
- 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
143971
- 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
143972
- 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
143973
- 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
143974
- 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
143975
- 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
144933
+ 74, 108, 119, 72, 0, 45, 0, 0, 81, 0, 76, 61, 0,
144934
+ 42, 12, 77, 15, 0, 118, 84, 54, 116, 0, 19, 0, 0,
144935
+ 123, 0, 121, 111, 0, 22, 96, 0, 9, 0, 0, 68, 69,
144936
+ 0, 67, 6, 0, 48, 93, 105, 0, 120, 104, 0, 0, 44,
144937
+ 0, 106, 24, 0, 17, 0, 124, 53, 23, 0, 5, 62, 25,
144938
+ 99, 0, 0, 126, 112, 60, 125, 57, 28, 55, 0, 94, 0,
144939
+ 103, 26, 0, 102, 0, 0, 0, 98, 95, 100, 91, 115, 14,
144940
+ 39, 114, 0, 80, 0, 109, 92, 90, 32, 0, 122, 79, 117,
144941
+ 86, 46, 83, 0, 0, 97, 40, 59, 110, 0, 36, 0, 0,
144942
+ 29, 0, 89, 87, 88, 0, 20, 85, 0, 56,
143976144943
};
143977144944
/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
143978144945
** then the i-th keyword has no more hash collisions. Otherwise,
143979144946
** the next keyword with the same hash is aKWHash[i]-1. */
143980
-static const unsigned char aKWNext[124] = {
144947
+static const unsigned char aKWNext[126] = {
143981144948
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
143982144949
0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
143983144950
0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
143984144951
0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
143985
- 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
143986
- 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
143987
- 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
143988
- 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
143989
- 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
143990
- 73, 83, 0, 35, 68, 0, 0,
144952
+ 0, 43, 3, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144953
+ 0, 1, 64, 0, 0, 65, 0, 41, 0, 38, 0, 0, 0,
144954
+ 0, 0, 49, 75, 0, 0, 30, 0, 58, 0, 0, 63, 31,
144955
+ 52, 16, 34, 10, 0, 0, 0, 0, 0, 0, 0, 11, 70,
144956
+ 78, 0, 8, 0, 18, 51, 0, 107, 101, 0, 113, 0, 73,
144957
+ 27, 37, 71, 82, 0, 35, 66, 0, 0,
143991144958
};
143992144959
/* aKWLen[i] is the length (in bytes) of the i-th keyword */
143993
-static const unsigned char aKWLen[124] = {
144960
+static const unsigned char aKWLen[126] = {
143994144961
7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
143995144962
7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
143996144963
11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
143997144964
4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
143998
- 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
143999
- 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
144000
- 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
144001
- 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
144002
- 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
144003
- 3, 5, 5, 6, 4, 9, 3,
144965
+ 6, 6, 5, 6, 5, 5, 9, 7, 7, 4, 2, 7, 3,
144966
+ 6, 4, 7, 6, 12, 6, 9, 4, 6, 4, 5, 4, 7,
144967
+ 6, 5, 6, 7, 5, 4, 7, 3, 2, 4, 5, 6, 5,
144968
+ 7, 3, 7, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12,
144969
+ 7, 8, 8, 2, 2, 5, 8, 4, 4, 4, 4, 2, 6,
144970
+ 5, 8, 3, 5, 5, 6, 4, 9, 3,
144004144971
};
144005144972
/* aKWOffset[i] is the index into zKWText[] of the start of
144006144973
** the text for the i-th keyword. */
144007
-static const unsigned short int aKWOffset[124] = {
144974
+static const unsigned short int aKWOffset[126] = {
144008144975
0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
144009144976
36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
144010144977
86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
144011144978
159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
144012
- 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
144013
- 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
144014
- 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
144015
- 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
144016
- 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
144017
- 521, 524, 529, 534, 540, 544, 549,
144979
+ 199, 204, 209, 212, 218, 221, 225, 234, 240, 246, 249, 251, 252,
144980
+ 256, 262, 266, 273, 279, 291, 297, 306, 308, 314, 318, 323, 325,
144981
+ 332, 337, 342, 348, 354, 359, 362, 362, 362, 365, 369, 372, 378,
144982
+ 382, 389, 391, 398, 400, 402, 411, 415, 421, 427, 435, 440, 440,
144983
+ 456, 463, 470, 471, 478, 479, 483, 491, 495, 499, 503, 507, 509,
144984
+ 515, 520, 528, 531, 536, 541, 547, 551, 556,
144018144985
};
144019144986
/* aKWCode[i] is the parser symbol code for the i-th keyword */
144020
-static const unsigned char aKWCode[124] = {
144987
+static const unsigned char aKWCode[126] = {
144021144988
TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
144022144989
TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
144023144990
TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
144024144991
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
144025144992
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -144028,23 +144995,24 @@
144028144995
TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
144029144996
TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
144030144997
TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
144031144998
TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
144032144999
TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
144033
- TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
144034
- TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
144035
- TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
144036
- TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
144037
- TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
144038
- TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
144039
- TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
144040
- TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
144041
- TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
144042
- TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
144043
- TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
144044
- TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
144045
- TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
145000
+ TK_NOTHING, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC,
145001
+ TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE, TK_CTIME_KW,
145002
+ TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_LIKE_KW,
145003
+ TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT,
145004
+ TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, TK_NOTNULL,
145005
+ TK_NOT, TK_NO, TK_NULL, TK_WHERE, TK_RENAME,
145006
+ TK_AFTER, TK_REPLACE, TK_AND, TK_DEFAULT, TK_AUTOINCR,
145007
+ TK_TO, TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT,
145008
+ TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_PRIMARY,
145009
+ TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DO, TK_ORDER,
145010
+ TK_RESTRICT, TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW,
145011
+ TK_IF, TK_ISNULL, TK_JOIN_KW, TK_ROLLBACK, TK_ROW,
145012
+ TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_INITIALLY,
145013
+ TK_ALL,
144046145014
};
144047145015
/* Check to see if z[0..n-1] is a keyword. If it is, write the
144048145016
** parser symbol code for that keyword into *pType. Always
144049145017
** return the integer n (the length of the token). */
144050145018
static int keywordCode(const char *z, int n, int *pType){
@@ -144121,74 +145089,76 @@
144121145089
testcase( i==55 ); /* UPDATE */
144122145090
testcase( i==56 ); /* BEGIN */
144123145091
testcase( i==57 ); /* INNER */
144124145092
testcase( i==58 ); /* RECURSIVE */
144125145093
testcase( i==59 ); /* BETWEEN */
144126
- testcase( i==60 ); /* NOTNULL */
144127
- testcase( i==61 ); /* NOT */
144128
- testcase( i==62 ); /* NO */
144129
- testcase( i==63 ); /* NULL */
144130
- testcase( i==64 ); /* LIKE */
144131
- testcase( i==65 ); /* CASCADE */
144132
- testcase( i==66 ); /* ASC */
144133
- testcase( i==67 ); /* DELETE */
144134
- testcase( i==68 ); /* CASE */
144135
- testcase( i==69 ); /* COLLATE */
144136
- testcase( i==70 ); /* CREATE */
144137
- testcase( i==71 ); /* CURRENT_DATE */
144138
- testcase( i==72 ); /* DETACH */
144139
- testcase( i==73 ); /* IMMEDIATE */
144140
- testcase( i==74 ); /* JOIN */
144141
- testcase( i==75 ); /* INSERT */
144142
- testcase( i==76 ); /* MATCH */
144143
- testcase( i==77 ); /* PLAN */
144144
- testcase( i==78 ); /* ANALYZE */
144145
- testcase( i==79 ); /* PRAGMA */
144146
- testcase( i==80 ); /* ABORT */
144147
- testcase( i==81 ); /* VALUES */
144148
- testcase( i==82 ); /* VIRTUAL */
144149
- testcase( i==83 ); /* LIMIT */
144150
- testcase( i==84 ); /* WHEN */
144151
- testcase( i==85 ); /* WHERE */
144152
- testcase( i==86 ); /* RENAME */
144153
- testcase( i==87 ); /* AFTER */
144154
- testcase( i==88 ); /* REPLACE */
144155
- testcase( i==89 ); /* AND */
144156
- testcase( i==90 ); /* DEFAULT */
144157
- testcase( i==91 ); /* AUTOINCREMENT */
144158
- testcase( i==92 ); /* TO */
144159
- testcase( i==93 ); /* IN */
144160
- testcase( i==94 ); /* CAST */
144161
- testcase( i==95 ); /* COLUMN */
144162
- testcase( i==96 ); /* COMMIT */
144163
- testcase( i==97 ); /* CONFLICT */
144164
- testcase( i==98 ); /* CROSS */
144165
- testcase( i==99 ); /* CURRENT_TIMESTAMP */
144166
- testcase( i==100 ); /* CURRENT_TIME */
144167
- testcase( i==101 ); /* PRIMARY */
144168
- testcase( i==102 ); /* DEFERRED */
144169
- testcase( i==103 ); /* DISTINCT */
144170
- testcase( i==104 ); /* IS */
144171
- testcase( i==105 ); /* DROP */
144172
- testcase( i==106 ); /* FAIL */
144173
- testcase( i==107 ); /* FROM */
144174
- testcase( i==108 ); /* FULL */
144175
- testcase( i==109 ); /* GLOB */
144176
- testcase( i==110 ); /* BY */
144177
- testcase( i==111 ); /* IF */
144178
- testcase( i==112 ); /* ISNULL */
144179
- testcase( i==113 ); /* ORDER */
144180
- testcase( i==114 ); /* RESTRICT */
144181
- testcase( i==115 ); /* RIGHT */
144182
- testcase( i==116 ); /* ROLLBACK */
144183
- testcase( i==117 ); /* ROW */
144184
- testcase( i==118 ); /* UNION */
144185
- testcase( i==119 ); /* USING */
144186
- testcase( i==120 ); /* VACUUM */
144187
- testcase( i==121 ); /* VIEW */
144188
- testcase( i==122 ); /* INITIALLY */
144189
- testcase( i==123 ); /* ALL */
145094
+ testcase( i==60 ); /* NOTHING */
145095
+ testcase( i==61 ); /* GLOB */
145096
+ testcase( i==62 ); /* BY */
145097
+ testcase( i==63 ); /* CASCADE */
145098
+ testcase( i==64 ); /* ASC */
145099
+ testcase( i==65 ); /* DELETE */
145100
+ testcase( i==66 ); /* CASE */
145101
+ testcase( i==67 ); /* COLLATE */
145102
+ testcase( i==68 ); /* CREATE */
145103
+ testcase( i==69 ); /* CURRENT_DATE */
145104
+ testcase( i==70 ); /* DETACH */
145105
+ testcase( i==71 ); /* IMMEDIATE */
145106
+ testcase( i==72 ); /* JOIN */
145107
+ testcase( i==73 ); /* INSERT */
145108
+ testcase( i==74 ); /* LIKE */
145109
+ testcase( i==75 ); /* MATCH */
145110
+ testcase( i==76 ); /* PLAN */
145111
+ testcase( i==77 ); /* ANALYZE */
145112
+ testcase( i==78 ); /* PRAGMA */
145113
+ testcase( i==79 ); /* ABORT */
145114
+ testcase( i==80 ); /* VALUES */
145115
+ testcase( i==81 ); /* VIRTUAL */
145116
+ testcase( i==82 ); /* LIMIT */
145117
+ testcase( i==83 ); /* WHEN */
145118
+ testcase( i==84 ); /* NOTNULL */
145119
+ testcase( i==85 ); /* NOT */
145120
+ testcase( i==86 ); /* NO */
145121
+ testcase( i==87 ); /* NULL */
145122
+ testcase( i==88 ); /* WHERE */
145123
+ testcase( i==89 ); /* RENAME */
145124
+ testcase( i==90 ); /* AFTER */
145125
+ testcase( i==91 ); /* REPLACE */
145126
+ testcase( i==92 ); /* AND */
145127
+ testcase( i==93 ); /* DEFAULT */
145128
+ testcase( i==94 ); /* AUTOINCREMENT */
145129
+ testcase( i==95 ); /* TO */
145130
+ testcase( i==96 ); /* IN */
145131
+ testcase( i==97 ); /* CAST */
145132
+ testcase( i==98 ); /* COLUMN */
145133
+ testcase( i==99 ); /* COMMIT */
145134
+ testcase( i==100 ); /* CONFLICT */
145135
+ testcase( i==101 ); /* CROSS */
145136
+ testcase( i==102 ); /* CURRENT_TIMESTAMP */
145137
+ testcase( i==103 ); /* CURRENT_TIME */
145138
+ testcase( i==104 ); /* PRIMARY */
145139
+ testcase( i==105 ); /* DEFERRED */
145140
+ testcase( i==106 ); /* DISTINCT */
145141
+ testcase( i==107 ); /* IS */
145142
+ testcase( i==108 ); /* DO */
145143
+ testcase( i==109 ); /* ORDER */
145144
+ testcase( i==110 ); /* RESTRICT */
145145
+ testcase( i==111 ); /* DROP */
145146
+ testcase( i==112 ); /* FAIL */
145147
+ testcase( i==113 ); /* FROM */
145148
+ testcase( i==114 ); /* FULL */
145149
+ testcase( i==115 ); /* IF */
145150
+ testcase( i==116 ); /* ISNULL */
145151
+ testcase( i==117 ); /* RIGHT */
145152
+ testcase( i==118 ); /* ROLLBACK */
145153
+ testcase( i==119 ); /* ROW */
145154
+ testcase( i==120 ); /* UNION */
145155
+ testcase( i==121 ); /* USING */
145156
+ testcase( i==122 ); /* VACUUM */
145157
+ testcase( i==123 ); /* VIEW */
145158
+ testcase( i==124 ); /* INITIALLY */
145159
+ testcase( i==125 ); /* ALL */
144190145160
*pType = aKWCode[i];
144191145161
break;
144192145162
}
144193145163
}
144194145164
return n;
@@ -144196,11 +145166,11 @@
144196145166
SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
144197145167
int id = TK_ID;
144198145168
keywordCode((char*)z, n, &id);
144199145169
return id;
144200145170
}
144201
-#define SQLITE_N_KEYWORD 124
145171
+#define SQLITE_N_KEYWORD 126
144202145172
144203145173
/************** End of keywordhash.h *****************************************/
144204145174
/************** Continuing where we left off in tokenize.c *******************/
144205145175
144206145176
@@ -144553,13 +145523,13 @@
144553145523
pParse->zTail = zSql;
144554145524
assert( pzErrMsg!=0 );
144555145525
/* sqlite3ParserTrace(stdout, "parser: "); */
144556145526
#ifdef sqlite3Parser_ENGINEALWAYSONSTACK
144557145527
pEngine = &sEngine;
144558
- sqlite3ParserInit(pEngine);
145528
+ sqlite3ParserInit(pEngine, pParse);
144559145529
#else
144560
- pEngine = sqlite3ParserAlloc(sqlite3Malloc);
145530
+ pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse);
144561145531
if( pEngine==0 ){
144562145532
sqlite3OomFault(db);
144563145533
return SQLITE_NOMEM_BKPT;
144564145534
}
144565145535
#endif
@@ -144599,11 +145569,11 @@
144599145569
}
144600145570
zSql += n;
144601145571
}else{
144602145572
pParse->sLastToken.z = zSql;
144603145573
pParse->sLastToken.n = n;
144604
- sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);
145574
+ sqlite3Parser(pEngine, tokenType, pParse->sLastToken);
144605145575
lastTokenParsed = tokenType;
144606145576
zSql += n;
144607145577
if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
144608145578
}
144609145579
}
@@ -145706,10 +146676,21 @@
145706146676
case SQLITE_CONFIG_STMTJRNL_SPILL: {
145707146677
sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int);
145708146678
break;
145709146679
}
145710146680
146681
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
146682
+ case SQLITE_CONFIG_SORTERREF_SIZE: {
146683
+ int iVal = va_arg(ap, int);
146684
+ if( iVal<0 ){
146685
+ iVal = SQLITE_DEFAULT_SORTERREF_SIZE;
146686
+ }
146687
+ sqlite3GlobalConfig.szSorterRef = (u32)iVal;
146688
+ break;
146689
+ }
146690
+#endif /* SQLITE_ENABLE_SORTER_REFERENCES */
146691
+
145711146692
default: {
145712146693
rc = SQLITE_ERROR;
145713146694
break;
145714146695
}
145715146696
}
@@ -189765,12 +190746,14 @@
189765190746
** for terminal symbols is called "fts5yy0".
189766190747
** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If
189767190748
** zero the stack is dynamically sized using realloc()
189768190749
** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument
189769190750
** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument
190751
+** sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter
189770190752
** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser
189771190753
** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
190754
+** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context
189772190755
** fts5YYERRORSYMBOL is the code number of the error symbol. If not
189773190756
** defined, then do no error processing.
189774190757
** fts5YYNSTATE the combined number of states.
189775190758
** fts5YYNRULE the number of rules in the grammar
189776190759
** fts5YYNFTS5TOKEN Number of terminal symbols
@@ -189786,29 +190769,35 @@
189786190769
#ifndef INTERFACE
189787190770
# define INTERFACE 1
189788190771
#endif
189789190772
/************* Begin control #defines *****************************************/
189790190773
#define fts5YYCODETYPE unsigned char
189791
-#define fts5YYNOCODE 29
190774
+#define fts5YYNOCODE 27
189792190775
#define fts5YYACTIONTYPE unsigned char
189793190776
#define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token
189794190777
typedef union {
189795190778
int fts5yyinit;
189796190779
sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0;
189797190780
int fts5yy4;
189798
- Fts5ExprPhrase* fts5yy11;
189799
- Fts5ExprNearset* fts5yy14;
189800
- Fts5Colset* fts5yy43;
189801
- Fts5ExprNode* fts5yy54;
190781
+ Fts5Colset* fts5yy11;
190782
+ Fts5ExprNode* fts5yy24;
190783
+ Fts5ExprNearset* fts5yy46;
190784
+ Fts5ExprPhrase* fts5yy53;
189802190785
} fts5YYMINORTYPE;
189803190786
#ifndef fts5YYSTACKDEPTH
189804190787
#define fts5YYSTACKDEPTH 100
189805190788
#endif
189806190789
#define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse;
189807190790
#define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse
189808
-#define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse = fts5yypParser->pParse
189809
-#define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse = pParse
190791
+#define sqlite3Fts5ParserARG_PARAM ,pParse
190792
+#define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse;
190793
+#define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse;
190794
+#define sqlite3Fts5ParserCTX_SDECL
190795
+#define sqlite3Fts5ParserCTX_PDECL
190796
+#define sqlite3Fts5ParserCTX_PARAM
190797
+#define sqlite3Fts5ParserCTX_FETCH
190798
+#define sqlite3Fts5ParserCTX_STORE
189810190799
#define fts5YYNSTATE 35
189811190800
#define fts5YYNRULE 28
189812190801
#define fts5YYNFTS5TOKEN 16
189813190802
#define fts5YY_MAX_SHIFT 34
189814190803
#define fts5YY_MIN_SHIFTREDUCE 52
@@ -189885,50 +190874,50 @@
189885190874
*********** Begin parsing tables **********************************************/
189886190875
#define fts5YY_ACTTAB_COUNT (105)
189887190876
static const fts5YYACTIONTYPE fts5yy_action[] = {
189888190877
/* 0 */ 81, 20, 96, 6, 28, 99, 98, 26, 26, 18,
189889190878
/* 10 */ 96, 6, 28, 17, 98, 56, 26, 19, 96, 6,
189890
- /* 20 */ 28, 14, 98, 108, 26, 92, 96, 6, 28, 25,
189891
- /* 30 */ 98, 78, 26, 21, 96, 6, 28, 107, 98, 58,
189892
- /* 40 */ 26, 29, 96, 6, 28, 32, 98, 22, 26, 24,
189893
- /* 50 */ 16, 23, 11, 1, 14, 13, 24, 16, 31, 11,
189894
- /* 60 */ 3, 97, 13, 27, 8, 98, 82, 26, 7, 4,
189895
- /* 70 */ 5, 3, 4, 5, 3, 83, 4, 5, 3, 63,
189896
- /* 80 */ 33, 34, 62, 12, 2, 86, 13, 10, 12, 71,
189897
- /* 90 */ 10, 13, 78, 5, 3, 78, 9, 30, 75, 82,
189898
- /* 100 */ 54, 57, 53, 57, 15,
190879
+ /* 20 */ 28, 14, 98, 14, 26, 31, 92, 96, 6, 28,
190880
+ /* 30 */ 108, 98, 25, 26, 21, 96, 6, 28, 78, 98,
190881
+ /* 40 */ 58, 26, 29, 96, 6, 28, 107, 98, 22, 26,
190882
+ /* 50 */ 24, 16, 12, 11, 1, 13, 13, 24, 16, 23,
190883
+ /* 60 */ 11, 33, 34, 13, 97, 8, 27, 32, 98, 7,
190884
+ /* 70 */ 26, 3, 4, 5, 3, 4, 5, 3, 83, 4,
190885
+ /* 80 */ 5, 3, 63, 5, 3, 62, 12, 2, 86, 13,
190886
+ /* 90 */ 9, 30, 10, 10, 54, 57, 75, 78, 78, 53,
190887
+ /* 100 */ 57, 15, 82, 82, 71,
189899190888
};
189900190889
static const fts5YYCODETYPE fts5yy_lookahead[] = {
189901
- /* 0 */ 17, 18, 19, 20, 21, 23, 23, 25, 25, 18,
189902
- /* 10 */ 19, 20, 21, 7, 23, 9, 25, 18, 19, 20,
189903
- /* 20 */ 21, 9, 23, 27, 25, 18, 19, 20, 21, 25,
189904
- /* 30 */ 23, 15, 25, 18, 19, 20, 21, 27, 23, 9,
189905
- /* 40 */ 25, 18, 19, 20, 21, 14, 23, 22, 25, 6,
189906
- /* 50 */ 7, 22, 9, 10, 9, 12, 6, 7, 13, 9,
189907
- /* 60 */ 3, 19, 12, 21, 5, 23, 28, 25, 5, 1,
189908
- /* 70 */ 2, 3, 1, 2, 3, 0, 1, 2, 3, 11,
189909
- /* 80 */ 25, 26, 11, 9, 10, 5, 12, 10, 9, 11,
189910
- /* 90 */ 10, 12, 15, 2, 3, 15, 24, 25, 9, 28,
189911
- /* 100 */ 8, 9, 8, 9, 9, 28, 28, 28, 28, 28,
189912
- /* 110 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
189913
- /* 120 */ 28,
190890
+ /* 0 */ 16, 17, 18, 19, 20, 22, 22, 24, 24, 17,
190891
+ /* 10 */ 18, 19, 20, 7, 22, 9, 24, 17, 18, 19,
190892
+ /* 20 */ 20, 9, 22, 9, 24, 13, 17, 18, 19, 20,
190893
+ /* 30 */ 26, 22, 24, 24, 17, 18, 19, 20, 15, 22,
190894
+ /* 40 */ 9, 24, 17, 18, 19, 20, 26, 22, 21, 24,
190895
+ /* 50 */ 6, 7, 9, 9, 10, 12, 12, 6, 7, 21,
190896
+ /* 60 */ 9, 24, 25, 12, 18, 5, 20, 14, 22, 5,
190897
+ /* 70 */ 24, 3, 1, 2, 3, 1, 2, 3, 0, 1,
190898
+ /* 80 */ 2, 3, 11, 2, 3, 11, 9, 10, 5, 12,
190899
+ /* 90 */ 23, 24, 10, 10, 8, 9, 9, 15, 15, 8,
190900
+ /* 100 */ 9, 9, 27, 27, 11, 27, 27, 27, 27, 27,
190901
+ /* 110 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
190902
+ /* 120 */ 27,
189914190903
};
189915190904
#define fts5YY_SHIFT_COUNT (34)
189916190905
#define fts5YY_SHIFT_MIN (0)
189917
-#define fts5YY_SHIFT_MAX (95)
190906
+#define fts5YY_SHIFT_MAX (93)
189918190907
static const unsigned char fts5yy_shift_ofst[] = {
189919
- /* 0 */ 43, 43, 43, 43, 43, 43, 50, 74, 79, 45,
189920
- /* 10 */ 12, 80, 77, 12, 16, 16, 30, 30, 68, 71,
189921
- /* 20 */ 75, 91, 92, 94, 6, 31, 31, 59, 63, 57,
189922
- /* 30 */ 31, 89, 95, 31, 78,
190908
+ /* 0 */ 44, 44, 44, 44, 44, 44, 51, 77, 43, 12,
190909
+ /* 10 */ 14, 83, 82, 14, 23, 23, 31, 31, 71, 74,
190910
+ /* 20 */ 78, 81, 86, 91, 6, 53, 53, 60, 64, 68,
190911
+ /* 30 */ 53, 87, 92, 53, 93,
189923190912
};
189924190913
#define fts5YY_REDUCE_COUNT (17)
189925
-#define fts5YY_REDUCE_MIN (-18)
189926
-#define fts5YY_REDUCE_MAX (72)
190914
+#define fts5YY_REDUCE_MIN (-17)
190915
+#define fts5YY_REDUCE_MAX (67)
189927190916
static const signed char fts5yy_reduce_ofst[] = {
189928
- /* 0 */ -17, -9, -1, 7, 15, 23, 42, -18, -18, 55,
189929
- /* 10 */ 72, -4, -4, 4, -4, 10, 25, 29,
190917
+ /* 0 */ -16, -8, 0, 9, 17, 25, 46, -17, -17, 37,
190918
+ /* 10 */ 67, 4, 4, 8, 4, 20, 27, 38,
189930190919
};
189931190920
static const fts5YYACTIONTYPE fts5yy_default[] = {
189932190921
/* 0 */ 80, 80, 80, 80, 80, 80, 95, 80, 80, 105,
189933190922
/* 10 */ 80, 110, 110, 80, 110, 110, 80, 80, 80, 80,
189934190923
/* 20 */ 80, 91, 80, 80, 80, 101, 100, 80, 80, 90,
@@ -189989,10 +190978,11 @@
189989190978
#endif
189990190979
#ifndef fts5YYNOERRORRECOVERY
189991190980
int fts5yyerrcnt; /* Shifts left before out of the error */
189992190981
#endif
189993190982
sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */
190983
+ sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */
189994190984
#if fts5YYSTACKDEPTH<=0
189995190985
int fts5yystksz; /* Current side of the stack */
189996190986
fts5yyStackEntry *fts5yystack; /* The parser's stack */
189997190987
fts5yyStackEntry fts5yystk0; /* First stack entry */
189998190988
#else
@@ -190052,22 +191042,21 @@
190052191042
/* 11 */ "RP",
190053191043
/* 12 */ "CARET",
190054191044
/* 13 */ "COMMA",
190055191045
/* 14 */ "PLUS",
190056191046
/* 15 */ "STAR",
190057
- /* 16 */ "error",
190058
- /* 17 */ "input",
190059
- /* 18 */ "expr",
190060
- /* 19 */ "cnearset",
190061
- /* 20 */ "exprlist",
190062
- /* 21 */ "colset",
190063
- /* 22 */ "colsetlist",
190064
- /* 23 */ "nearset",
190065
- /* 24 */ "nearphrases",
190066
- /* 25 */ "phrase",
190067
- /* 26 */ "neardist_opt",
190068
- /* 27 */ "star_opt",
191047
+ /* 16 */ "input",
191048
+ /* 17 */ "expr",
191049
+ /* 18 */ "cnearset",
191050
+ /* 19 */ "exprlist",
191051
+ /* 20 */ "colset",
191052
+ /* 21 */ "colsetlist",
191053
+ /* 22 */ "nearset",
191054
+ /* 23 */ "nearphrases",
191055
+ /* 24 */ "phrase",
191056
+ /* 25 */ "neardist_opt",
191057
+ /* 26 */ "star_opt",
190069191058
};
190070191059
#endif /* defined(fts5YYCOVERAGE) || !defined(NDEBUG) */
190071191060
190072191061
#ifndef NDEBUG
190073191062
/* For tracing reduce actions, the names of all rules are required.
@@ -190147,32 +191136,33 @@
190147191136
# define fts5YYMALLOCARGTYPE size_t
190148191137
#endif
190149191138
190150191139
/* Initialize a new parser that has already been allocated.
190151191140
*/
190152
-static void sqlite3Fts5ParserInit(void *fts5yypParser){
190153
- fts5yyParser *pParser = (fts5yyParser*)fts5yypParser;
191141
+static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PDECL){
191142
+ fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yypRawParser;
191143
+ sqlite3Fts5ParserCTX_STORE
190154191144
#ifdef fts5YYTRACKMAXSTACKDEPTH
190155
- pParser->fts5yyhwm = 0;
191145
+ fts5yypParser->fts5yyhwm = 0;
190156191146
#endif
190157191147
#if fts5YYSTACKDEPTH<=0
190158
- pParser->fts5yytos = NULL;
190159
- pParser->fts5yystack = NULL;
190160
- pParser->fts5yystksz = 0;
190161
- if( fts5yyGrowStack(pParser) ){
190162
- pParser->fts5yystack = &pParser->fts5yystk0;
190163
- pParser->fts5yystksz = 1;
191148
+ fts5yypParser->fts5yytos = NULL;
191149
+ fts5yypParser->fts5yystack = NULL;
191150
+ fts5yypParser->fts5yystksz = 0;
191151
+ if( fts5yyGrowStack(fts5yypParser) ){
191152
+ fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0;
191153
+ fts5yypParser->fts5yystksz = 1;
190164191154
}
190165191155
#endif
190166191156
#ifndef fts5YYNOERRORRECOVERY
190167
- pParser->fts5yyerrcnt = -1;
191157
+ fts5yypParser->fts5yyerrcnt = -1;
190168191158
#endif
190169
- pParser->fts5yytos = pParser->fts5yystack;
190170
- pParser->fts5yystack[0].stateno = 0;
190171
- pParser->fts5yystack[0].major = 0;
191159
+ fts5yypParser->fts5yytos = fts5yypParser->fts5yystack;
191160
+ fts5yypParser->fts5yystack[0].stateno = 0;
191161
+ fts5yypParser->fts5yystack[0].major = 0;
190172191162
#if fts5YYSTACKDEPTH>0
190173
- pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
191163
+ fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1];
190174191164
#endif
190175191165
}
190176191166
190177191167
#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
190178191168
/*
@@ -190185,15 +191175,18 @@
190185191175
**
190186191176
** Outputs:
190187191177
** A pointer to a parser. This pointer is used in subsequent calls
190188191178
** to sqlite3Fts5Parser and sqlite3Fts5ParserFree.
190189191179
*/
190190
-static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){
190191
- fts5yyParser *pParser;
190192
- pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) );
190193
- if( pParser ) sqlite3Fts5ParserInit(pParser);
190194
- return pParser;
191180
+static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE) sqlite3Fts5ParserCTX_PDECL){
191181
+ fts5yyParser *fts5yypParser;
191182
+ fts5yypParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) );
191183
+ if( fts5yypParser ){
191184
+ sqlite3Fts5ParserCTX_STORE
191185
+ sqlite3Fts5ParserInit(fts5yypParser sqlite3Fts5ParserCTX_PARAM);
191186
+ }
191187
+ return (void*)fts5yypParser;
190195191188
}
190196191189
#endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */
190197191190
190198191191
190199191192
/* The following function deletes the "minor type" or semantic value
@@ -190206,11 +191199,12 @@
190206191199
static void fts5yy_destructor(
190207191200
fts5yyParser *fts5yypParser, /* The parser */
190208191201
fts5YYCODETYPE fts5yymajor, /* Type code for object to destroy */
190209191202
fts5YYMINORTYPE *fts5yypminor /* The object to be destroyed */
190210191203
){
190211
- sqlite3Fts5ParserARG_FETCH;
191204
+ sqlite3Fts5ParserARG_FETCH
191205
+ sqlite3Fts5ParserCTX_FETCH
190212191206
switch( fts5yymajor ){
190213191207
/* Here is inserted the actions which take place when a
190214191208
** terminal or non-terminal is destroyed. This can happen
190215191209
** when the symbol is popped from the stack during a
190216191210
** reduce or during error processing or when a parser is
@@ -190219,37 +191213,37 @@
190219191213
** Note: during a reduce, the only symbols destroyed are those
190220191214
** which appear on the RHS of the rule, but which are *not* used
190221191215
** inside the C code.
190222191216
*/
190223191217
/********* Begin destructor definitions ***************************************/
190224
- case 17: /* input */
191218
+ case 16: /* input */
190225191219
{
190226191220
(void)pParse;
190227191221
}
190228191222
break;
190229
- case 18: /* expr */
190230
- case 19: /* cnearset */
190231
- case 20: /* exprlist */
190232
-{
190233
- sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy54));
190234
-}
190235
- break;
190236
- case 21: /* colset */
190237
- case 22: /* colsetlist */
190238
-{
190239
- sqlite3_free((fts5yypminor->fts5yy43));
190240
-}
190241
- break;
190242
- case 23: /* nearset */
190243
- case 24: /* nearphrases */
190244
-{
190245
- sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy14));
190246
-}
190247
- break;
190248
- case 25: /* phrase */
190249
-{
190250
- sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy11));
191223
+ case 17: /* expr */
191224
+ case 18: /* cnearset */
191225
+ case 19: /* exprlist */
191226
+{
191227
+ sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24));
191228
+}
191229
+ break;
191230
+ case 20: /* colset */
191231
+ case 21: /* colsetlist */
191232
+{
191233
+ sqlite3_free((fts5yypminor->fts5yy11));
191234
+}
191235
+ break;
191236
+ case 22: /* nearset */
191237
+ case 23: /* nearphrases */
191238
+{
191239
+ sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46));
191240
+}
191241
+ break;
191242
+ case 24: /* phrase */
191243
+{
191244
+ sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53));
190251191245
}
190252191246
break;
190253191247
/********* End destructor definitions *****************************************/
190254191248
default: break; /* If no destructor action specified: do nothing */
190255191249
}
@@ -190357,17 +191351,16 @@
190357191351
190358191352
/*
190359191353
** Find the appropriate action for a parser given the terminal
190360191354
** look-ahead token iLookAhead.
190361191355
*/
190362
-static unsigned int fts5yy_find_shift_action(
190363
- fts5yyParser *pParser, /* The parser */
190364
- fts5YYCODETYPE iLookAhead /* The look-ahead token */
191356
+static fts5YYACTIONTYPE fts5yy_find_shift_action(
191357
+ fts5YYCODETYPE iLookAhead, /* The look-ahead token */
191358
+ fts5YYACTIONTYPE stateno /* Current state number */
190365191359
){
190366191360
int i;
190367
- int stateno = pParser->fts5yytos->stateno;
190368
-
191361
+
190369191362
if( stateno>fts5YY_MAX_SHIFT ) return stateno;
190370191363
assert( stateno <= fts5YY_SHIFT_COUNT );
190371191364
#if defined(fts5YYCOVERAGE)
190372191365
fts5yycoverage[stateno][iLookAhead] = 1;
190373191366
#endif
@@ -190427,11 +191420,11 @@
190427191420
/*
190428191421
** Find the appropriate action for a parser given the non-terminal
190429191422
** look-ahead token iLookAhead.
190430191423
*/
190431191424
static int fts5yy_find_reduce_action(
190432
- int stateno, /* Current state number */
191425
+ fts5YYACTIONTYPE stateno, /* Current state number */
190433191426
fts5YYCODETYPE iLookAhead /* The look-ahead token */
190434191427
){
190435191428
int i;
190436191429
#ifdef fts5YYERRORSYMBOL
190437191430
if( stateno>fts5YY_REDUCE_COUNT ){
@@ -190456,11 +191449,12 @@
190456191449
190457191450
/*
190458191451
** The following routine is called if the stack overflows.
190459191452
*/
190460191453
static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){
190461
- sqlite3Fts5ParserARG_FETCH;
191454
+ sqlite3Fts5ParserARG_FETCH
191455
+ sqlite3Fts5ParserCTX_FETCH
190462191456
#ifndef NDEBUG
190463191457
if( fts5yyTraceFILE ){
190464191458
fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt);
190465191459
}
190466191460
#endif
@@ -190469,11 +191463,12 @@
190469191463
** stack every overflows */
190470191464
/******** Begin %stack_overflow code ******************************************/
190471191465
190472191466
sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
190473191467
/******** End %stack_overflow code ********************************************/
190474
- sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
191468
+ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
191469
+ sqlite3Fts5ParserCTX_STORE
190475191470
}
190476191471
190477191472
/*
190478191473
** Print tracing information for a SHIFT action
190479191474
*/
@@ -190498,12 +191493,12 @@
190498191493
/*
190499191494
** Perform a shift action.
190500191495
*/
190501191496
static void fts5yy_shift(
190502191497
fts5yyParser *fts5yypParser, /* The parser to be shifted */
190503
- int fts5yyNewState, /* The new state to shift in */
190504
- int fts5yyMajor, /* The major token to shift in */
191498
+ fts5YYACTIONTYPE fts5yyNewState, /* The new state to shift in */
191499
+ fts5YYCODETYPE fts5yyMajor, /* The major token to shift in */
190505191500
sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */
190506191501
){
190507191502
fts5yyStackEntry *fts5yytos;
190508191503
fts5yypParser->fts5yytos++;
190509191504
#ifdef fts5YYTRACKMAXSTACKDEPTH
@@ -190529,12 +191524,12 @@
190529191524
#endif
190530191525
if( fts5yyNewState > fts5YY_MAX_SHIFT ){
190531191526
fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;
190532191527
}
190533191528
fts5yytos = fts5yypParser->fts5yytos;
190534
- fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState;
190535
- fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor;
191529
+ fts5yytos->stateno = fts5yyNewState;
191530
+ fts5yytos->major = fts5yyMajor;
190536191531
fts5yytos->minor.fts5yy0 = fts5yyMinor;
190537191532
fts5yyTraceShift(fts5yypParser, fts5yyNewState, "Shift");
190538191533
}
190539191534
190540191535
/* The following table contains information about every rule that
@@ -190542,38 +191537,38 @@
190542191537
*/
190543191538
static const struct {
190544191539
fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
190545191540
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
190546191541
} fts5yyRuleInfo[] = {
190547
- { 17, -1 }, /* (0) input ::= expr */
190548
- { 21, -4 }, /* (1) colset ::= MINUS LCP colsetlist RCP */
190549
- { 21, -3 }, /* (2) colset ::= LCP colsetlist RCP */
190550
- { 21, -1 }, /* (3) colset ::= STRING */
190551
- { 21, -2 }, /* (4) colset ::= MINUS STRING */
190552
- { 22, -2 }, /* (5) colsetlist ::= colsetlist STRING */
190553
- { 22, -1 }, /* (6) colsetlist ::= STRING */
190554
- { 18, -3 }, /* (7) expr ::= expr AND expr */
190555
- { 18, -3 }, /* (8) expr ::= expr OR expr */
190556
- { 18, -3 }, /* (9) expr ::= expr NOT expr */
190557
- { 18, -5 }, /* (10) expr ::= colset COLON LP expr RP */
190558
- { 18, -3 }, /* (11) expr ::= LP expr RP */
190559
- { 18, -1 }, /* (12) expr ::= exprlist */
190560
- { 20, -1 }, /* (13) exprlist ::= cnearset */
190561
- { 20, -2 }, /* (14) exprlist ::= exprlist cnearset */
190562
- { 19, -1 }, /* (15) cnearset ::= nearset */
190563
- { 19, -3 }, /* (16) cnearset ::= colset COLON nearset */
190564
- { 23, -1 }, /* (17) nearset ::= phrase */
190565
- { 23, -2 }, /* (18) nearset ::= CARET phrase */
190566
- { 23, -5 }, /* (19) nearset ::= STRING LP nearphrases neardist_opt RP */
190567
- { 24, -1 }, /* (20) nearphrases ::= phrase */
190568
- { 24, -2 }, /* (21) nearphrases ::= nearphrases phrase */
190569
- { 26, 0 }, /* (22) neardist_opt ::= */
190570
- { 26, -2 }, /* (23) neardist_opt ::= COMMA STRING */
190571
- { 25, -4 }, /* (24) phrase ::= phrase PLUS STRING star_opt */
190572
- { 25, -2 }, /* (25) phrase ::= STRING star_opt */
190573
- { 27, -1 }, /* (26) star_opt ::= STAR */
190574
- { 27, 0 }, /* (27) star_opt ::= */
191542
+ { 16, -1 }, /* (0) input ::= expr */
191543
+ { 20, -4 }, /* (1) colset ::= MINUS LCP colsetlist RCP */
191544
+ { 20, -3 }, /* (2) colset ::= LCP colsetlist RCP */
191545
+ { 20, -1 }, /* (3) colset ::= STRING */
191546
+ { 20, -2 }, /* (4) colset ::= MINUS STRING */
191547
+ { 21, -2 }, /* (5) colsetlist ::= colsetlist STRING */
191548
+ { 21, -1 }, /* (6) colsetlist ::= STRING */
191549
+ { 17, -3 }, /* (7) expr ::= expr AND expr */
191550
+ { 17, -3 }, /* (8) expr ::= expr OR expr */
191551
+ { 17, -3 }, /* (9) expr ::= expr NOT expr */
191552
+ { 17, -5 }, /* (10) expr ::= colset COLON LP expr RP */
191553
+ { 17, -3 }, /* (11) expr ::= LP expr RP */
191554
+ { 17, -1 }, /* (12) expr ::= exprlist */
191555
+ { 19, -1 }, /* (13) exprlist ::= cnearset */
191556
+ { 19, -2 }, /* (14) exprlist ::= exprlist cnearset */
191557
+ { 18, -1 }, /* (15) cnearset ::= nearset */
191558
+ { 18, -3 }, /* (16) cnearset ::= colset COLON nearset */
191559
+ { 22, -1 }, /* (17) nearset ::= phrase */
191560
+ { 22, -2 }, /* (18) nearset ::= CARET phrase */
191561
+ { 22, -5 }, /* (19) nearset ::= STRING LP nearphrases neardist_opt RP */
191562
+ { 23, -1 }, /* (20) nearphrases ::= phrase */
191563
+ { 23, -2 }, /* (21) nearphrases ::= nearphrases phrase */
191564
+ { 25, 0 }, /* (22) neardist_opt ::= */
191565
+ { 25, -2 }, /* (23) neardist_opt ::= COMMA STRING */
191566
+ { 24, -4 }, /* (24) phrase ::= phrase PLUS STRING star_opt */
191567
+ { 24, -2 }, /* (25) phrase ::= STRING star_opt */
191568
+ { 26, -1 }, /* (26) star_opt ::= STAR */
191569
+ { 26, 0 }, /* (27) star_opt ::= */
190575191570
};
190576191571
190577191572
static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */
190578191573
190579191574
/*
@@ -190584,21 +191579,22 @@
190584191579
** access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE
190585191580
** if the lookahead token has already been consumed. As this procedure is
190586191581
** only called from one place, optimizing compilers will in-line it, which
190587191582
** means that the extra parameters have no performance impact.
190588191583
*/
190589
-static void fts5yy_reduce(
191584
+static fts5YYACTIONTYPE fts5yy_reduce(
190590191585
fts5yyParser *fts5yypParser, /* The parser */
190591191586
unsigned int fts5yyruleno, /* Number of the rule by which to reduce */
190592191587
int fts5yyLookahead, /* Lookahead token, or fts5YYNOCODE if none */
190593191588
sqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */
191589
+ sqlite3Fts5ParserCTX_PDECL /* %extra_context */
190594191590
){
190595191591
int fts5yygoto; /* The next state */
190596191592
int fts5yyact; /* The next action */
190597191593
fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */
190598191594
int fts5yysize; /* Amount to pop the stack */
190599
- sqlite3Fts5ParserARG_FETCH;
191595
+ sqlite3Fts5ParserARG_FETCH
190600191596
(void)fts5yyLookahead;
190601191597
(void)fts5yyLookaheadToken;
190602191598
fts5yymsp = fts5yypParser->fts5yytos;
190603191599
#ifndef NDEBUG
190604191600
if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
@@ -190625,17 +191621,23 @@
190625191621
}
190626191622
#endif
190627191623
#if fts5YYSTACKDEPTH>0
190628191624
if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
190629191625
fts5yyStackOverflow(fts5yypParser);
190630
- return;
191626
+ /* The call to fts5yyStackOverflow() above pops the stack until it is
191627
+ ** empty, causing the main parser loop to exit. So the return value
191628
+ ** is never used and does not matter. */
191629
+ return 0;
190631191630
}
190632191631
#else
190633191632
if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
190634191633
if( fts5yyGrowStack(fts5yypParser) ){
190635191634
fts5yyStackOverflow(fts5yypParser);
190636
- return;
191635
+ /* The call to fts5yyStackOverflow() above pops the stack until it is
191636
+ ** empty, causing the main parser loop to exit. So the return value
191637
+ ** is never used and does not matter. */
191638
+ return 0;
190637191639
}
190638191640
fts5yymsp = fts5yypParser->fts5yytos;
190639191641
}
190640191642
#endif
190641191643
}
@@ -190650,142 +191652,142 @@
190650191652
** break;
190651191653
*/
190652191654
/********** Begin reduce actions **********************************************/
190653191655
fts5YYMINORTYPE fts5yylhsminor;
190654191656
case 0: /* input ::= expr */
190655
-{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy54); }
191657
+{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
190656191658
break;
190657191659
case 1: /* colset ::= MINUS LCP colsetlist RCP */
190658191660
{
190659
- fts5yymsp[-3].minor.fts5yy43 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy43);
191661
+ fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
190660191662
}
190661191663
break;
190662191664
case 2: /* colset ::= LCP colsetlist RCP */
190663
-{ fts5yymsp[-2].minor.fts5yy43 = fts5yymsp[-1].minor.fts5yy43; }
191665
+{ fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
190664191666
break;
190665191667
case 3: /* colset ::= STRING */
190666191668
{
190667
- fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191669
+ fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190668191670
}
190669
- fts5yymsp[0].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
191671
+ fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
190670191672
break;
190671191673
case 4: /* colset ::= MINUS STRING */
190672191674
{
190673
- fts5yymsp[-1].minor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190674
- fts5yymsp[-1].minor.fts5yy43 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy43);
191675
+ fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191676
+ fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
190675191677
}
190676191678
break;
190677191679
case 5: /* colsetlist ::= colsetlist STRING */
190678191680
{
190679
- fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy43, &fts5yymsp[0].minor.fts5yy0); }
190680
- fts5yymsp[-1].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
191681
+ fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
191682
+ fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
190681191683
break;
190682191684
case 6: /* colsetlist ::= STRING */
190683191685
{
190684
- fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191686
+ fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190685191687
}
190686
- fts5yymsp[0].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
191688
+ fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
190687191689
break;
190688191690
case 7: /* expr ::= expr AND expr */
190689191691
{
190690
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
191692
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
190691191693
}
190692
- fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191694
+ fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190693191695
break;
190694191696
case 8: /* expr ::= expr OR expr */
190695191697
{
190696
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
191698
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
190697191699
}
190698
- fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191700
+ fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190699191701
break;
190700191702
case 9: /* expr ::= expr NOT expr */
190701191703
{
190702
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
191704
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
190703191705
}
190704
- fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191706
+ fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190705191707
break;
190706191708
case 10: /* expr ::= colset COLON LP expr RP */
190707191709
{
190708
- sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy54, fts5yymsp[-4].minor.fts5yy43);
190709
- fts5yylhsminor.fts5yy54 = fts5yymsp[-1].minor.fts5yy54;
191710
+ sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
191711
+ fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
190710191712
}
190711
- fts5yymsp[-4].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191713
+ fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190712191714
break;
190713191715
case 11: /* expr ::= LP expr RP */
190714
-{fts5yymsp[-2].minor.fts5yy54 = fts5yymsp[-1].minor.fts5yy54;}
191716
+{fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
190715191717
break;
190716191718
case 12: /* expr ::= exprlist */
190717191719
case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
190718
-{fts5yylhsminor.fts5yy54 = fts5yymsp[0].minor.fts5yy54;}
190719
- fts5yymsp[0].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191720
+{fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
191721
+ fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190720191722
break;
190721191723
case 14: /* exprlist ::= exprlist cnearset */
190722191724
{
190723
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54);
191725
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
190724191726
}
190725
- fts5yymsp[-1].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191727
+ fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190726191728
break;
190727191729
case 15: /* cnearset ::= nearset */
190728191730
{
190729
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy14);
191731
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
190730191732
}
190731
- fts5yymsp[0].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191733
+ fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190732191734
break;
190733191735
case 16: /* cnearset ::= colset COLON nearset */
190734191736
{
190735
- fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy14);
190736
- sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy54, fts5yymsp[-2].minor.fts5yy43);
191737
+ fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
191738
+ sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
190737191739
}
190738
- fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
191740
+ fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
190739191741
break;
190740191742
case 17: /* nearset ::= phrase */
190741
-{ fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11); }
190742
- fts5yymsp[0].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
191743
+{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
191744
+ fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
190743191745
break;
190744191746
case 18: /* nearset ::= CARET phrase */
190745191747
{
190746
- sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy11);
190747
- fts5yymsp[-1].minor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11);
191748
+ sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
191749
+ fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
190748191750
}
190749191751
break;
190750191752
case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
190751191753
{
190752191754
sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
190753
- sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy14, &fts5yymsp[-1].minor.fts5yy0);
190754
- fts5yylhsminor.fts5yy14 = fts5yymsp[-2].minor.fts5yy14;
191755
+ sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
191756
+ fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
190755191757
}
190756
- fts5yymsp[-4].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
191758
+ fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
190757191759
break;
190758191760
case 20: /* nearphrases ::= phrase */
190759191761
{
190760
- fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11);
191762
+ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
190761191763
}
190762
- fts5yymsp[0].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
191764
+ fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
190763191765
break;
190764191766
case 21: /* nearphrases ::= nearphrases phrase */
190765191767
{
190766
- fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy14, fts5yymsp[0].minor.fts5yy11);
191768
+ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
190767191769
}
190768
- fts5yymsp[-1].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
191770
+ fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
190769191771
break;
190770191772
case 22: /* neardist_opt ::= */
190771191773
{ fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
190772191774
break;
190773191775
case 23: /* neardist_opt ::= COMMA STRING */
190774191776
{ fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
190775191777
break;
190776191778
case 24: /* phrase ::= phrase PLUS STRING star_opt */
190777191779
{
190778
- fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy11, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
191780
+ fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
190779191781
}
190780
- fts5yymsp[-3].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
191782
+ fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
190781191783
break;
190782191784
case 25: /* phrase ::= STRING star_opt */
190783191785
{
190784
- fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
191786
+ fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
190785191787
}
190786
- fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
191788
+ fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
190787191789
break;
190788191790
case 26: /* star_opt ::= STAR */
190789191791
{ fts5yymsp[0].minor.fts5yy4 = 1; }
190790191792
break;
190791191793
case 27: /* star_opt ::= */
@@ -190810,20 +191812,22 @@
190810191812
fts5yymsp += fts5yysize+1;
190811191813
fts5yypParser->fts5yytos = fts5yymsp;
190812191814
fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact;
190813191815
fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto;
190814191816
fts5yyTraceShift(fts5yypParser, fts5yyact, "... then shift");
191817
+ return fts5yyact;
190815191818
}
190816191819
190817191820
/*
190818191821
** The following code executes when the parse fails
190819191822
*/
190820191823
#ifndef fts5YYNOERRORRECOVERY
190821191824
static void fts5yy_parse_failed(
190822191825
fts5yyParser *fts5yypParser /* The parser */
190823191826
){
190824
- sqlite3Fts5ParserARG_FETCH;
191827
+ sqlite3Fts5ParserARG_FETCH
191828
+ sqlite3Fts5ParserCTX_FETCH
190825191829
#ifndef NDEBUG
190826191830
if( fts5yyTraceFILE ){
190827191831
fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt);
190828191832
}
190829191833
#endif
@@ -190830,11 +191834,12 @@
190830191834
while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
190831191835
/* Here code is inserted which will be executed whenever the
190832191836
** parser fails */
190833191837
/************ Begin %parse_failure code ***************************************/
190834191838
/************ End %parse_failure code *****************************************/
190835
- sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
191839
+ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191840
+ sqlite3Fts5ParserCTX_STORE
190836191841
}
190837191842
#endif /* fts5YYNOERRORRECOVERY */
190838191843
190839191844
/*
190840191845
** The following code executes when a syntax error first occurs.
@@ -190842,29 +191847,32 @@
190842191847
static void fts5yy_syntax_error(
190843191848
fts5yyParser *fts5yypParser, /* The parser */
190844191849
int fts5yymajor, /* The major type of the error token */
190845191850
sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */
190846191851
){
190847
- sqlite3Fts5ParserARG_FETCH;
191852
+ sqlite3Fts5ParserARG_FETCH
191853
+ sqlite3Fts5ParserCTX_FETCH
190848191854
#define FTS5TOKEN fts5yyminor
190849191855
/************ Begin %syntax_error code ****************************************/
190850191856
190851191857
UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
190852191858
sqlite3Fts5ParseError(
190853191859
pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
190854191860
);
190855191861
/************ End %syntax_error code ******************************************/
190856
- sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
191862
+ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191863
+ sqlite3Fts5ParserCTX_STORE
190857191864
}
190858191865
190859191866
/*
190860191867
** The following is executed when the parser accepts
190861191868
*/
190862191869
static void fts5yy_accept(
190863191870
fts5yyParser *fts5yypParser /* The parser */
190864191871
){
190865
- sqlite3Fts5ParserARG_FETCH;
191872
+ sqlite3Fts5ParserARG_FETCH
191873
+ sqlite3Fts5ParserCTX_FETCH
190866191874
#ifndef NDEBUG
190867191875
if( fts5yyTraceFILE ){
190868191876
fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt);
190869191877
}
190870191878
#endif
@@ -190874,11 +191882,12 @@
190874191882
assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack );
190875191883
/* Here code is inserted which will be executed whenever the
190876191884
** parser accepts */
190877191885
/*********** Begin %parse_accept code *****************************************/
190878191886
/*********** End %parse_accept code *******************************************/
190879
- sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
191887
+ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191888
+ sqlite3Fts5ParserCTX_STORE
190880191889
}
190881191890
190882191891
/* The main parser program.
190883191892
** The first argument is a pointer to a structure obtained from
190884191893
** "sqlite3Fts5ParserAlloc" which describes the current state of the parser.
@@ -190903,49 +191912,51 @@
190903191912
int fts5yymajor, /* The major token code number */
190904191913
sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */
190905191914
sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */
190906191915
){
190907191916
fts5YYMINORTYPE fts5yyminorunion;
190908
- unsigned int fts5yyact; /* The parser action. */
191917
+ fts5YYACTIONTYPE fts5yyact; /* The parser action. */
190909191918
#if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
190910191919
int fts5yyendofinput; /* True if we are at the end of input */
190911191920
#endif
190912191921
#ifdef fts5YYERRORSYMBOL
190913191922
int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */
190914191923
#endif
190915
- fts5yyParser *fts5yypParser; /* The parser */
191924
+ fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yyp; /* The parser */
191925
+ sqlite3Fts5ParserCTX_FETCH
191926
+ sqlite3Fts5ParserARG_STORE
190916191927
190917
- fts5yypParser = (fts5yyParser*)fts5yyp;
190918191928
assert( fts5yypParser->fts5yytos!=0 );
190919191929
#if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
190920191930
fts5yyendofinput = (fts5yymajor==0);
190921191931
#endif
190922
- sqlite3Fts5ParserARG_STORE;
190923191932
191933
+ fts5yyact = fts5yypParser->fts5yytos->stateno;
190924191934
#ifndef NDEBUG
190925191935
if( fts5yyTraceFILE ){
190926
- int stateno = fts5yypParser->fts5yytos->stateno;
190927
- if( stateno < fts5YY_MIN_REDUCE ){
191936
+ if( fts5yyact < fts5YY_MIN_REDUCE ){
190928191937
fprintf(fts5yyTraceFILE,"%sInput '%s' in state %d\n",
190929
- fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],stateno);
191938
+ fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact);
190930191939
}else{
190931191940
fprintf(fts5yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
190932
- fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],stateno-fts5YY_MIN_REDUCE);
191941
+ fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE);
190933191942
}
190934191943
}
190935191944
#endif
190936191945
190937191946
do{
190938
- fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor);
191947
+ assert( fts5yyact==fts5yypParser->fts5yytos->stateno );
191948
+ fts5yyact = fts5yy_find_shift_action(fts5yymajor,fts5yyact);
190939191949
if( fts5yyact >= fts5YY_MIN_REDUCE ){
190940
- fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,fts5yyminor);
191950
+ fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,
191951
+ fts5yyminor sqlite3Fts5ParserCTX_PARAM);
190941191952
}else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
190942191953
fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor);
190943191954
#ifndef fts5YYNOERRORRECOVERY
190944191955
fts5yypParser->fts5yyerrcnt--;
190945191956
#endif
190946
- fts5yymajor = fts5YYNOCODE;
191957
+ break;
190947191958
}else if( fts5yyact==fts5YY_ACCEPT_ACTION ){
190948191959
fts5yypParser->fts5yytos--;
190949191960
fts5yy_accept(fts5yypParser);
190950191961
return;
190951191962
}else{
@@ -191012,10 +192023,12 @@
191012192023
fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor);
191013192024
}
191014192025
}
191015192026
fts5yypParser->fts5yyerrcnt = 3;
191016192027
fts5yyerrorhit = 1;
192028
+ if( fts5yymajor==fts5YYNOCODE ) break;
192029
+ fts5yyact = fts5yypParser->fts5yytos->stateno;
191017192030
#elif defined(fts5YYNOERRORRECOVERY)
191018192031
/* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to
191019192032
** do any kind of error recovery. Instead, simply invoke the syntax
191020192033
** error routine and continue going as if nothing had happened.
191021192034
**
@@ -191022,12 +192035,11 @@
191022192035
** Applications can set this macro (for example inside %include) if
191023192036
** they intend to abandon the parse upon the first syntax error seen.
191024192037
*/
191025192038
fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor);
191026192039
fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);
191027
- fts5yymajor = fts5YYNOCODE;
191028
-
192040
+ break;
191029192041
#else /* fts5YYERRORSYMBOL is not defined */
191030192042
/* This is what we do if the grammar does not define ERROR:
191031192043
**
191032192044
** * Report an error message, and throw away the input token.
191033192045
**
@@ -191045,14 +192057,14 @@
191045192057
fts5yy_parse_failed(fts5yypParser);
191046192058
#ifndef fts5YYNOERRORRECOVERY
191047192059
fts5yypParser->fts5yyerrcnt = -1;
191048192060
#endif
191049192061
}
191050
- fts5yymajor = fts5YYNOCODE;
192062
+ break;
191051192063
#endif
191052192064
}
191053
- }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
192065
+ }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
191054192066
#ifndef NDEBUG
191055192067
if( fts5yyTraceFILE ){
191056192068
fts5yyStackEntry *i;
191057192069
char cDiv = '[';
191058192070
fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -205660,11 +206672,11 @@
205660206672
int nArg, /* Number of args */
205661206673
sqlite3_value **apUnused /* Function arguments */
205662206674
){
205663206675
assert( nArg==0 );
205664206676
UNUSED_PARAM2(nArg, apUnused);
205665
- sqlite3_result_text(pCtx, "fts5: 2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b", -1, SQLITE_TRANSIENT);
206677
+ sqlite3_result_text(pCtx, "fts5: 2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3", -1, SQLITE_TRANSIENT);
205666206678
}
205667206679
205668206680
static int fts5Init(sqlite3 *db){
205669206681
static const sqlite3_module fts5Mod = {
205670206682
/* iVersion */ 2,
@@ -209930,12 +210942,12 @@
209930210942
}
209931210943
#endif /* SQLITE_CORE */
209932210944
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
209933210945
209934210946
/************** End of stmt.c ************************************************/
209935
-#if __LINE__!=209935
210947
+#if __LINE__!=210947
209936210948
#undef SQLITE_SOURCE_ID
209937
-#define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd14alt2"
210949
+#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8alt2"
209938210950
#endif
209939210951
/* Return the source-id for this library */
209940210952
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
209941210953
/************************** End of sqlite3.c ******************************/
209942210954
--- 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.23.1. 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.
@@ -308,10 +308,13 @@
308 #if SQLITE_ENABLE_SESSION
309 "ENABLE_SESSION",
310 #endif
311 #if SQLITE_ENABLE_SNAPSHOT
312 "ENABLE_SNAPSHOT",
 
 
 
313 #endif
314 #if SQLITE_ENABLE_SQLLOG
315 "ENABLE_SQLLOG",
316 #endif
317 #if defined(SQLITE_ENABLE_STAT4)
@@ -1145,13 +1148,13 @@
1145 **
1146 ** See also: [sqlite3_libversion()],
1147 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1148 ** [sqlite_version()] and [sqlite_source_id()].
1149 */
1150 #define SQLITE_VERSION "3.23.1"
1151 #define SQLITE_VERSION_NUMBER 3023001
1152 #define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b"
1153
1154 /*
1155 ** CAPI3REF: Run-Time Library Version Numbers
1156 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1157 **
@@ -2952,10 +2955,26 @@
2952 ** Since many statement journals never become large, setting the spill
2953 ** threshold to a value such as 64KiB can greatly reduce the amount of
2954 ** I/O required to support statement rollback.
2955 ** The default value for this setting is controlled by the
2956 ** [SQLITE_STMTJRNL_SPILL] compile-time option.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2957 ** </dl>
2958 */
2959 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2960 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2961 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -2981,10 +3000,11 @@
2981 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2982 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2983 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
2984 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
2985 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
 
2986
2987 /*
2988 ** CAPI3REF: Database Connection Configuration Options
2989 **
2990 ** These constants are the available integer configuration options that
@@ -12939,111 +12959,113 @@
12939 #define TK_LT 56
12940 #define TK_GE 57
12941 #define TK_ESCAPE 58
12942 #define TK_ID 59
12943 #define TK_COLUMNKW 60
12944 #define TK_FOR 61
12945 #define TK_IGNORE 62
12946 #define TK_INITIALLY 63
12947 #define TK_INSTEAD 64
12948 #define TK_NO 65
12949 #define TK_KEY 66
12950 #define TK_OF 67
12951 #define TK_OFFSET 68
12952 #define TK_PRAGMA 69
12953 #define TK_RAISE 70
12954 #define TK_RECURSIVE 71
12955 #define TK_REPLACE 72
12956 #define TK_RESTRICT 73
12957 #define TK_ROW 74
12958 #define TK_TRIGGER 75
12959 #define TK_VACUUM 76
12960 #define TK_VIEW 77
12961 #define TK_VIRTUAL 78
12962 #define TK_WITH 79
12963 #define TK_REINDEX 80
12964 #define TK_RENAME 81
12965 #define TK_CTIME_KW 82
12966 #define TK_ANY 83
12967 #define TK_BITAND 84
12968 #define TK_BITOR 85
12969 #define TK_LSHIFT 86
12970 #define TK_RSHIFT 87
12971 #define TK_PLUS 88
12972 #define TK_MINUS 89
12973 #define TK_STAR 90
12974 #define TK_SLASH 91
12975 #define TK_REM 92
12976 #define TK_CONCAT 93
12977 #define TK_COLLATE 94
12978 #define TK_BITNOT 95
12979 #define TK_INDEXED 96
12980 #define TK_STRING 97
12981 #define TK_JOIN_KW 98
12982 #define TK_CONSTRAINT 99
12983 #define TK_DEFAULT 100
12984 #define TK_NULL 101
12985 #define TK_PRIMARY 102
12986 #define TK_UNIQUE 103
12987 #define TK_CHECK 104
12988 #define TK_REFERENCES 105
12989 #define TK_AUTOINCR 106
12990 #define TK_ON 107
12991 #define TK_INSERT 108
12992 #define TK_DELETE 109
12993 #define TK_UPDATE 110
12994 #define TK_SET 111
12995 #define TK_DEFERRABLE 112
12996 #define TK_FOREIGN 113
12997 #define TK_DROP 114
12998 #define TK_UNION 115
12999 #define TK_ALL 116
13000 #define TK_EXCEPT 117
13001 #define TK_INTERSECT 118
13002 #define TK_SELECT 119
13003 #define TK_VALUES 120
13004 #define TK_DISTINCT 121
13005 #define TK_DOT 122
13006 #define TK_FROM 123
13007 #define TK_JOIN 124
13008 #define TK_USING 125
13009 #define TK_ORDER 126
13010 #define TK_GROUP 127
13011 #define TK_HAVING 128
13012 #define TK_LIMIT 129
13013 #define TK_WHERE 130
13014 #define TK_INTO 131
13015 #define TK_FLOAT 132
13016 #define TK_BLOB 133
13017 #define TK_INTEGER 134
13018 #define TK_VARIABLE 135
13019 #define TK_CASE 136
13020 #define TK_WHEN 137
13021 #define TK_THEN 138
13022 #define TK_ELSE 139
13023 #define TK_INDEX 140
13024 #define TK_ALTER 141
13025 #define TK_ADD 142
13026 #define TK_TRUEFALSE 143
13027 #define TK_ISNOT 144
13028 #define TK_FUNCTION 145
13029 #define TK_COLUMN 146
13030 #define TK_AGG_FUNCTION 147
13031 #define TK_AGG_COLUMN 148
13032 #define TK_UMINUS 149
13033 #define TK_UPLUS 150
13034 #define TK_TRUTH 151
13035 #define TK_REGISTER 152
13036 #define TK_VECTOR 153
13037 #define TK_SELECT_COLUMN 154
13038 #define TK_IF_NULL_ROW 155
13039 #define TK_ASTERISK 156
13040 #define TK_SPAN 157
13041 #define TK_END_OF_FILE 158
13042 #define TK_UNCLOSED_STRING 159
13043 #define TK_SPACE 160
13044 #define TK_ILLEGAL 161
 
 
13045
13046 /* The token codes above must all fit in 8 bits */
13047 #define TKFLG_MASK 0xff
13048
13049 /* Flags that can be added to a token code when it is not
@@ -13159,10 +13181,17 @@
13159 */
13160 #ifndef SQLITE_DEFAULT_PCACHE_INITSZ
13161 # define SQLITE_DEFAULT_PCACHE_INITSZ 20
13162 #endif
13163
 
 
 
 
 
 
 
13164 /*
13165 ** The compile-time options SQLITE_MMAP_READWRITE and
13166 ** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
13167 ** You must choose one or the other (or neither) but not both.
13168 */
@@ -13617,10 +13646,11 @@
13617 typedef struct TreeView TreeView;
13618 typedef struct Trigger Trigger;
13619 typedef struct TriggerPrg TriggerPrg;
13620 typedef struct TriggerStep TriggerStep;
13621 typedef struct UnpackedRecord UnpackedRecord;
 
13622 typedef struct VTable VTable;
13623 typedef struct VtabCtx VtabCtx;
13624 typedef struct Walker Walker;
13625 typedef struct WhereInfo WhereInfo;
13626 typedef struct With With;
@@ -14274,26 +14304,26 @@
14274 #define OP_CollSeq 79
14275 #define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */
14276 #define OP_RealAffinity 81
14277 #define OP_Cast 82 /* synopsis: affinity(r[P1]) */
14278 #define OP_Permutation 83
14279 #define OP_BitAnd 84 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14280 #define OP_BitOr 85 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14281 #define OP_ShiftLeft 86 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14282 #define OP_ShiftRight 87 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14283 #define OP_Add 88 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
14284 #define OP_Subtract 89 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14285 #define OP_Multiply 90 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14286 #define OP_Divide 91 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14287 #define OP_Remainder 92 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14288 #define OP_Concat 93 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14289 #define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14290 #define OP_BitNot 95 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
14291 #define OP_IsTrue 96 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14292 #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
14293 #define OP_Offset 98 /* synopsis: r[P3] = sqlite_offset(P1) */
14294 #define OP_Column 99 /* synopsis: r[P3]=PX */
14295 #define OP_Affinity 100 /* synopsis: affinity(r[P1@P2]) */
14296 #define OP_MakeRecord 101 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
14297 #define OP_Count 102 /* synopsis: r[P2]=count() */
14298 #define OP_ReadCookie 103
14299 #define OP_SetCookie 104
@@ -14322,13 +14352,13 @@
14322 #define OP_SeekEnd 127
14323 #define OP_SorterInsert 128 /* synopsis: key=r[P2] */
14324 #define OP_IdxInsert 129 /* synopsis: key=r[P2] */
14325 #define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */
14326 #define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */
14327 #define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14328 #define OP_IdxRowid 133 /* synopsis: r[P2]=rowid */
14329 #define OP_Destroy 134
14330 #define OP_Clear 135
14331 #define OP_ResetSorter 136
14332 #define OP_CreateBtree 137 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14333 #define OP_SqlExec 138
14334 #define OP_ParseSchema 139
@@ -14383,13 +14413,13 @@
14383 /* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\
14384 /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
14385 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\
14386 /* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\
14387 /* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14388 /* 80 */ 0x02, 0x02, 0x02, 0x00, 0x26, 0x26, 0x26, 0x26,\
14389 /* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
14390 /* 96 */ 0x12, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10,\
14391 /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14392 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14393 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14394 /* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\
14395 /* 136 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
@@ -14459,10 +14489,13 @@
14459 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
14460 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
14461 SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
14462 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
14463 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
 
 
 
14464 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
14465 #ifdef SQLITE_DEBUG
14466 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
14467 #endif
14468 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15593,11 +15626,11 @@
15593 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
15594 u8 suppressErr; /* Do not issue error messages if true */
15595 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
15596 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
15597 u8 mTrace; /* zero or more SQLITE_TRACE flags */
15598 u8 skipBtreeMutex; /* True if no shared-cache backends */
15599 u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
15600 int nextPagesize; /* Pagesize after VACUUM if >0 */
15601 u32 magic; /* Magic number for detect library misuse */
15602 int nChange; /* Value returned by sqlite3_changes() */
15603 int nTotalChange; /* Value returned by sqlite3_total_changes() */
@@ -15753,10 +15786,11 @@
15753 ** Allowed values for sqlite3.mDbFlags
15754 */
15755 #define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */
15756 #define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */
15757 #define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */
 
15758
15759 /*
15760 ** Bits of the sqlite3.dbOptFlags field that are used by the
15761 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
15762 ** selectively disable various optimizations.
@@ -15998,10 +16032,11 @@
15998 */
15999 #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
16000 #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
16001 #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
16002 #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
 
16003
16004 /*
16005 ** A "Collating Sequence" is defined by an instance of the following
16006 ** structure. Conceptually, a collating sequence consists of a name and
16007 ** a comparison routine that defines the order of that sequence.
@@ -16285,17 +16320,16 @@
16285 #define OE_Rollback 1 /* Fail the operation and rollback the transaction */
16286 #define OE_Abort 2 /* Back out changes but do no rollback transaction */
16287 #define OE_Fail 3 /* Stop the operation but leave all prior changes */
16288 #define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */
16289 #define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */
16290
16291 #define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
16292 #define OE_SetNull 7 /* Set the foreign key value to NULL */
16293 #define OE_SetDflt 8 /* Set the foreign key value to its default */
16294 #define OE_Cascade 9 /* Cascade the changes */
16295
16296 #define OE_Default 10 /* Do whatever the default action is */
16297
16298
16299 /*
16300 ** An instance of the following structure is passed as the first
16301 ** argument to sqlite3VdbeKeyCompare and is used to control the
@@ -16738,10 +16772,11 @@
16738 char *zSpan; /* Original text of the expression */
16739 u8 sortOrder; /* 1 for DESC or 0 for ASC */
16740 unsigned done :1; /* A flag to indicate when processing is finished */
16741 unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
16742 unsigned reusable :1; /* Constant expression is reusable */
 
16743 union {
16744 struct {
16745 u16 iOrderByCol; /* For ORDER BY, column number in result set */
16746 u16 iAlias; /* Index into Parse.aAlias[] for zName */
16747 } x;
@@ -16921,12 +16956,15 @@
16921 ** subqueries looking for a match.
16922 */
16923 struct NameContext {
16924 Parse *pParse; /* The parser */
16925 SrcList *pSrcList; /* One or more tables used to resolve names */
16926 ExprList *pEList; /* Optional list of result-set columns */
16927 AggInfo *pAggInfo; /* Information about aggregates at this level */
 
 
 
16928 NameContext *pNext; /* Next outer name context. NULL for outermost */
16929 int nRef; /* Number of names resolved by this context */
16930 int nErr; /* Number of errors encountered while resolving names */
16931 u16 ncFlags; /* Zero or more NC_* flags defined below */
16932 };
@@ -16944,12 +16982,45 @@
16944 #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
16945 #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
16946 #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
16947 #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
16948 #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
 
 
 
16949 #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
16950 #define NC_Complex 0x2000 /* True if a function or subquery seen */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16951
16952 /*
16953 ** An instance of the following structure contains all information
16954 ** needed to generate code for a single SELECT statement.
16955 **
@@ -16975,10 +17046,11 @@
16975 LogEst nSelectRow; /* Estimated number of result rows */
16976 u32 selFlags; /* Various SF_* values */
16977 int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
16978 #if SELECTTRACE_ENABLED
16979 char zSelName[12]; /* Symbolic name of this SELECT use for debugging */
 
16980 #endif
16981 int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */
16982 SrcList *pSrc; /* The FROM clause */
16983 Expr *pWhere; /* The WHERE clause */
16984 ExprList *pGroupBy; /* The GROUP BY clause */
@@ -17446,12 +17518,13 @@
17446 u8 orconf; /* OE_Rollback etc. */
17447 Trigger *pTrig; /* The trigger that this step is a part of */
17448 Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
17449 char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
17450 Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
17451 ExprList *pExprList; /* SET clause for UPDATE. */
17452 IdList *pIdList; /* Column names for INSERT */
 
17453 char *zSpan; /* Original SQL text of this command */
17454 TriggerStep *pNext; /* Next in the link-list */
17455 TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */
17456 };
17457
@@ -17559,10 +17632,11 @@
17559 #ifndef SQLITE_UNTESTABLE
17560 int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
17561 #endif
17562 int bLocaltimeFault; /* True to fail localtime() calls */
17563 int iOnceResetThreshold; /* When to reset OP_Once counters */
 
17564 };
17565
17566 /*
17567 ** This macro is used inside of assert() statements to indicate that
17568 ** the assert is only valid on a well-formed database. Instead of:
@@ -17979,11 +18053,11 @@
17979 SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
17980 #else
17981 # define sqlite3AutoincrementBegin(X)
17982 # define sqlite3AutoincrementEnd(X)
17983 #endif
17984 SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int);
17985 SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
17986 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
17987 SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
17988 SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
17989 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
@@ -18009,11 +18083,12 @@
18009 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
18010 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
18011 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
18012 #endif
18013 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
18014 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*);
 
18015 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
18016 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
18017 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
18018 SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
18019 SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
@@ -18102,11 +18177,11 @@
18102 Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int);
18103 SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int);
18104 SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);
18105 SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int);
18106 SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int,
18107 u8,u8,int,int*,int*);
18108 #ifdef SQLITE_ENABLE_NULL_TRIM
18109 SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*);
18110 #else
18111 # define sqlite3SetMakeRecordP5(A,B)
18112 #endif
@@ -18155,11 +18230,12 @@
18155 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
18156 SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
18157 SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
18158 const char*,const char*);
18159 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
18160 Select*,u8,const char*,const char*);
 
18161 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8,
18162 const char*,const char*);
18163 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*,
18164 const char*,const char*);
18165 SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
@@ -18341,11 +18417,11 @@
18341 SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
18342 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
18343 SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
18344 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
18345 SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
18346 SQLITE_PRIVATE char sqlite3AffinityType(const char*, u8*);
18347 SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
18348 SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*);
18349 SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);
18350 SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);
18351 SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);
@@ -18403,14 +18479,14 @@
18403
18404 /*
18405 ** The interface to the LEMON-generated parser
18406 */
18407 #ifndef SQLITE_AMALGAMATION
18408 SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64));
18409 SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*));
18410 #endif
18411 SQLITE_PRIVATE void sqlite3Parser(void*, int, Token, Parse*);
18412 #ifdef YYTRACKMAXSTACKDEPTH
18413 SQLITE_PRIVATE int sqlite3ParserStackPeak(void*);
18414 #endif
18415
18416 SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*);
@@ -18494,10 +18570,22 @@
18494 SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
18495 #else
18496 #define sqlite3WithPush(x,y,z)
18497 #define sqlite3WithDelete(x,y)
18498 #endif
 
 
 
 
 
 
 
 
 
 
 
 
18499
18500 /* Declarations for functions in fkey.c. All of these are replaced by
18501 ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
18502 ** key functionality is available. If OMIT_TRIGGER is defined but
18503 ** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
@@ -18926,11 +19014,12 @@
18926 #endif
18927 #ifndef SQLITE_UNTESTABLE
18928 0, /* xTestCallback */
18929 #endif
18930 0, /* bLocaltimeFault */
18931 0x7ffffffe /* iOnceResetThreshold */
 
18932 };
18933
18934 /*
18935 ** Hash table for global functions - functions common to all
18936 ** database connections. After initialization, this table is
@@ -27499,15 +27588,17 @@
27499 for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){
27500 sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4);
27501 }
27502 sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
27503 }
27504 va_start(ap, zFormat);
27505 sqlite3VXPrintf(&acc, zFormat, ap);
27506 va_end(ap);
27507 assert( acc.nChar>0 );
27508 if( zBuf[acc.nChar-1]!='\n' ) sqlite3StrAccumAppend(&acc, "\n", 1);
 
 
27509 sqlite3StrAccumFinish(&acc);
27510 fprintf(stdout,"%s", zBuf);
27511 fflush(stdout);
27512 }
27513
@@ -27576,14 +27667,14 @@
27576 sqlite3TreeViewPush(pView, 1);
27577 }
27578 do{
27579 #if SELECTTRACE_ENABLED
27580 sqlite3TreeViewLine(pView,
27581 "SELECT%s%s (%s/%p) selFlags=0x%x nSelectRow=%d",
27582 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
27583 ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
27584 p->zSelName, p, p->selFlags,
27585 (int)p->nSelectRow
27586 );
27587 #else
27588 sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d",
27589 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
@@ -27973,20 +28064,25 @@
27973 int i;
27974 sqlite3TreeViewLine(pView, "%s", zLabel);
27975 for(i=0; i<pList->nExpr; i++){
27976 int j = pList->a[i].u.x.iOrderByCol;
27977 char *zName = pList->a[i].zName;
 
27978 if( j || zName ){
27979 sqlite3TreeViewPush(pView, 0);
27980 }
27981 if( zName ){
27982 sqlite3TreeViewLine(pView, "AS %s", zName);
27983 }
27984 if( j ){
27985 sqlite3TreeViewLine(pView, "iOrderByCol=%d", j);
27986 }
27987 sqlite3TreeViewExpr(pView, pList->a[i].pExpr, i<pList->nExpr-1);
 
 
 
 
27988 if( j || zName ){
27989 sqlite3TreeViewPop(pView);
27990 }
27991 }
27992 }
@@ -30948,26 +31044,26 @@
30948 /* 79 */ "CollSeq" OpHelp(""),
30949 /* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
30950 /* 81 */ "RealAffinity" OpHelp(""),
30951 /* 82 */ "Cast" OpHelp("affinity(r[P1])"),
30952 /* 83 */ "Permutation" OpHelp(""),
30953 /* 84 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
30954 /* 85 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
30955 /* 86 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
30956 /* 87 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
30957 /* 88 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
30958 /* 89 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
30959 /* 90 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
30960 /* 91 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
30961 /* 92 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
30962 /* 93 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
30963 /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
30964 /* 95 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
30965 /* 96 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
30966 /* 97 */ "String8" OpHelp("r[P2]='P4'"),
30967 /* 98 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
30968 /* 99 */ "Column" OpHelp("r[P3]=PX"),
30969 /* 100 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
30970 /* 101 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
30971 /* 102 */ "Count" OpHelp("r[P2]=count()"),
30972 /* 103 */ "ReadCookie" OpHelp(""),
30973 /* 104 */ "SetCookie" OpHelp(""),
@@ -30996,13 +31092,13 @@
30996 /* 127 */ "SeekEnd" OpHelp(""),
30997 /* 128 */ "SorterInsert" OpHelp("key=r[P2]"),
30998 /* 129 */ "IdxInsert" OpHelp("key=r[P2]"),
30999 /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31000 /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31001 /* 132 */ "Real" OpHelp("r[P2]=P4"),
31002 /* 133 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31003 /* 134 */ "Destroy" OpHelp(""),
31004 /* 135 */ "Clear" OpHelp(""),
31005 /* 136 */ "ResetSorter" OpHelp(""),
31006 /* 137 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
31007 /* 138 */ "SqlExec" OpHelp(""),
31008 /* 139 */ "ParseSchema" OpHelp(""),
@@ -61480,14 +61576,14 @@
61480 if( p && p->sharable ){
61481 sqlite3BtreeEnter(p);
61482 skipOk = 0;
61483 }
61484 }
61485 db->skipBtreeMutex = skipOk;
61486 }
61487 SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
61488 if( db->skipBtreeMutex==0 ) btreeEnterAll(db);
61489 }
61490 static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){
61491 int i;
61492 Btree *p;
61493 assert( sqlite3_mutex_held(db->mutex) );
@@ -61495,11 +61591,11 @@
61495 p = db->aDb[i].pBt;
61496 if( p ) sqlite3BtreeLeave(p);
61497 }
61498 }
61499 SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
61500 if( db->skipBtreeMutex==0 ) btreeLeaveAll(db);
61501 }
61502
61503 #ifndef NDEBUG
61504 /*
61505 ** Return true if the current thread holds the database connection
@@ -73871,16 +73967,20 @@
73871 assert( zVal[nVal]=='\'' );
73872 sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
73873 0, SQLITE_DYNAMIC);
73874 }
73875 #endif
73876
73877 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
73878 else if( op==TK_FUNCTION && pCtx!=0 ){
73879 rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx);
73880 }
73881 #endif
 
 
 
 
 
73882
73883 *ppVal = pVal;
73884 return rc;
73885
73886 no_mem:
@@ -74624,14 +74724,33 @@
74624 int j = ADDR(x);
74625 assert( v->magic==VDBE_MAGIC_INIT );
74626 assert( j<p->nLabel );
74627 assert( j>=0 );
74628 if( p->aLabel ){
 
 
 
 
 
 
74629 p->aLabel[j] = v->nOp;
74630 }
74631 }
74632
 
 
 
 
 
 
 
 
 
 
 
 
 
74633 /*
74634 ** Mark the VDBE as one that can only be run one time.
74635 */
74636 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
74637 p->runOnlyOnce = 1;
@@ -75858,10 +75977,13 @@
75858 **
75859 ** When p->explain==1, each instruction is listed. When
75860 ** p->explain==2, only OP_Explain instructions are listed and these
75861 ** are shown in a different format. p->explain==2 is used to implement
75862 ** EXPLAIN QUERY PLAN.
 
 
 
75863 **
75864 ** When p->explain==1, first the main program is listed, then each of
75865 ** the trigger subprograms are listed one by one.
75866 */
75867 SQLITE_PRIVATE int sqlite3VdbeList(
@@ -75920,11 +76042,11 @@
75920 for(i=0; i<nSub; i++){
75921 nRow += apSub[i]->nOp;
75922 }
75923 }
75924
75925 do{
75926 i = p->pc++;
75927 if( i>=nRow ){
75928 p->rc = SQLITE_OK;
75929 rc = SQLITE_DONE;
75930 break;
@@ -75966,11 +76088,14 @@
75966 pSub->flags |= MEM_Blob;
75967 pSub->n = nSub*sizeof(SubProgram*);
75968 nRow += pOp->p4.pProgram->nOp;
75969 }
75970 }
75971 }while( p->explain==2 && pOp->opcode!=OP_Explain );
 
 
 
75972
75973 if( rc==SQLITE_OK ){
75974 if( db->u1.isInterrupted ){
75975 p->rc = SQLITE_INTERRUPT;
75976 rc = SQLITE_ERROR;
@@ -92644,11 +92769,11 @@
92644 sqlite3 *db = pParse->db; /* The database connection */
92645 struct SrcList_item *pItem; /* Use for looping over pSrcList items */
92646 struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
92647 NameContext *pTopNC = pNC; /* First namecontext in the list */
92648 Schema *pSchema = 0; /* Schema of the expression */
92649 int isTrigger = 0; /* True if resolved to a trigger column */
92650 Table *pTab = 0; /* Table hold the row */
92651 Column *pCol; /* A column of pTab */
92652
92653 assert( pNC ); /* the name context cannot be NULL. */
92654 assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
@@ -92749,26 +92874,39 @@
92749 }
92750 pSchema = pExpr->pTab->pSchema;
92751 }
92752 } /* if( pSrcList ) */
92753
92754 #ifndef SQLITE_OMIT_TRIGGER
92755 /* If we have not already resolved the name, then maybe
92756 ** it is a new.* or old.* trigger argument reference
 
92757 */
92758 if( zDb==0 && zTab!=0 && cntTab==0 && pParse->pTriggerTab!=0 ){
92759 int op = pParse->eTriggerOp;
92760 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
92761 if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
92762 pExpr->iTable = 1;
92763 pTab = pParse->pTriggerTab;
92764 }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
92765 pExpr->iTable = 0;
92766 pTab = pParse->pTriggerTab;
92767 }else{
92768 pTab = 0;
92769 }
 
 
 
 
 
 
 
 
 
 
 
 
92770
92771 if( pTab ){
92772 int iCol;
92773 pSchema = pTab->pSchema;
92774 cntTab++;
@@ -92784,28 +92922,39 @@
92784 /* IMP: R-51414-32910 */
92785 iCol = -1;
92786 }
92787 if( iCol<pTab->nCol ){
92788 cnt++;
92789 if( iCol<0 ){
92790 pExpr->affinity = SQLITE_AFF_INTEGER;
92791 }else if( pExpr->iTable==0 ){
92792 testcase( iCol==31 );
92793 testcase( iCol==32 );
92794 pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92795 }else{
92796 testcase( iCol==31 );
92797 testcase( iCol==32 );
92798 pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92799 }
92800 pExpr->iColumn = (i16)iCol;
92801 pExpr->pTab = pTab;
92802 isTrigger = 1;
 
 
 
 
 
 
 
 
 
 
 
92803 }
92804 }
92805 }
92806 #endif /* !defined(SQLITE_OMIT_TRIGGER) */
92807
92808 /*
92809 ** Perhaps the name is a reference to the ROWID
92810 */
92811 if( cnt==0
@@ -92836,14 +92985,16 @@
92836 ** or HAVING clauses, or as part of a larger expression in the ORDER BY
92837 ** clause is not standard SQL. This is a (goofy) SQLite extension, that
92838 ** is supported for backwards compatibility only. Hence, we issue a warning
92839 ** on sqlite3_log() whenever the capability is used.
92840 */
92841 if( (pEList = pNC->pEList)!=0
92842 && zTab==0
92843 && cnt==0
 
92844 ){
 
 
92845 for(j=0; j<pEList->nExpr; j++){
92846 char *zAs = pEList->a[j].zName;
92847 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
92848 Expr *pOrig;
92849 assert( pExpr->pLeft==0 && pExpr->pRight==0 );
@@ -92936,11 +93087,11 @@
92936 */
92937 sqlite3ExprDelete(db, pExpr->pLeft);
92938 pExpr->pLeft = 0;
92939 sqlite3ExprDelete(db, pExpr->pRight);
92940 pExpr->pRight = 0;
92941 pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
92942 ExprSetProperty(pExpr, EP_Leaf);
92943 lookupname_end:
92944 if( cnt==1 ){
92945 assert( pNC!=0 );
92946 if( !ExprHasProperty(pExpr, EP_Alias) ){
@@ -93368,12 +93519,12 @@
93368 /* Resolve all names in the ORDER BY term expression
93369 */
93370 memset(&nc, 0, sizeof(nc));
93371 nc.pParse = pParse;
93372 nc.pSrcList = pSelect->pSrc;
93373 nc.pEList = pEList;
93374 nc.ncFlags = NC_AllowAgg;
93375 nc.nErr = 0;
93376 db = pParse->db;
93377 savedSuppErr = db->suppressErr;
93378 db->suppressErr = 1;
93379 rc = sqlite3ResolveExprNames(&nc, pE);
@@ -93752,11 +93903,13 @@
93752 ** aliases in the result set.
93753 **
93754 ** Minor point: If this is the case, then the expression will be
93755 ** re-evaluated for each reference to it.
93756 */
93757 sNC.pEList = p->pEList;
 
 
93758 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
93759 if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
93760
93761 /* Resolve names in table-valued-function arguments */
93762 for(i=0; i<p->pSrc->nSrc; i++){
@@ -93985,11 +94138,11 @@
93985 SQLITE_PRIVATE void sqlite3ResolveSelfReference(
93986 Parse *pParse, /* Parsing context */
93987 Table *pTab, /* The table being referenced */
93988 int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */
93989 Expr *pExpr, /* Expression to resolve. May be NULL. */
93990 ExprList *pList /* Expression list to resolve. May be NUL. */
93991 ){
93992 SrcList sSrc; /* Fake SrcList for pParse->pNewTable */
93993 NameContext sNC; /* Name context for pParse->pNewTable */
93994
93995 assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr );
@@ -95371,10 +95524,11 @@
95371 pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
95372 pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);
95373 pItem->sortOrder = pOldItem->sortOrder;
95374 pItem->done = 0;
95375 pItem->bSpanIsTab = pOldItem->bSpanIsTab;
 
95376 pItem->u = pOldItem->u;
95377 }
95378 return pNew;
95379 }
95380
@@ -95833,10 +95987,12 @@
95833 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
95834 return WRC_Continue;
95835 }
95836 /* Fall through */
95837 case TK_IF_NULL_ROW:
 
 
95838 testcase( pExpr->op==TK_IF_NULL_ROW );
95839 pWalker->eCode = 0;
95840 return WRC_Abort;
95841 case TK_VARIABLE:
95842 if( pWalker->eCode==5 ){
@@ -95850,12 +96006,12 @@
95850 pWalker->eCode = 0;
95851 return WRC_Abort;
95852 }
95853 /* Fall through */
95854 default:
95855 testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail will disallow */
95856 testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail will disallow */
95857 return WRC_Continue;
95858 }
95859 }
95860 static int exprIsConst(Expr *p, int initFlag, int iCur){
95861 Walker w;
@@ -96614,21 +96770,10 @@
96614 */
96615 if( !ExprHasProperty(pExpr, EP_VarSelect) ){
96616 jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
96617 }
96618
96619 #ifndef SQLITE_OMIT_EXPLAIN
96620 if( pParse->explain==2 ){
96621 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
96622 jmpIfDynamic>=0?"":"CORRELATED ",
96623 pExpr->op==TK_IN?"LIST":"SCALAR",
96624 pParse->iNextSelectId
96625 );
96626 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
96627 }
96628 #endif
96629
96630 switch( pExpr->op ){
96631 case TK_IN: {
96632 int addr; /* Address of OP_OpenEphemeral instruction */
96633 Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */
96634 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -96661,10 +96806,21 @@
96661 ** Generate code to write the results of the select into the temporary
96662 ** table allocated and opened above.
96663 */
96664 Select *pSelect = pExpr->x.pSelect;
96665 ExprList *pEList = pSelect->pEList;
 
 
 
 
 
 
 
 
 
 
 
96666
96667 assert( !isRowid );
96668 /* If the LHS and RHS of the IN operator do not match, that
96669 ** error will have been caught long before we reach this point. */
96670 if( ALWAYS(pEList->nExpr==nVal) ){
@@ -96703,11 +96859,10 @@
96703 char affinity; /* Affinity of the LHS of the IN */
96704 int i;
96705 ExprList *pList = pExpr->x.pList;
96706 struct ExprList_item *pItem;
96707 int r1, r2, r3;
96708
96709 affinity = sqlite3ExprAffinity(pLeft);
96710 if( !affinity ){
96711 affinity = SQLITE_AFF_BLOB;
96712 }
96713 if( pKeyInfo ){
@@ -96782,10 +96937,21 @@
96782
96783 testcase( pExpr->op==TK_EXISTS );
96784 testcase( pExpr->op==TK_SELECT );
96785 assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
96786 assert( ExprHasProperty(pExpr, EP_xIsSelect) );
 
 
 
 
 
 
 
 
 
 
 
96787
96788 pSel = pExpr->x.pSelect;
96789 nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
96790 sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
96791 pParse->nMem += nReg;
@@ -98379,10 +98545,16 @@
98379 assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */
98380 n = pList->nExpr;
98381 if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;
98382 for(pItem=pList->a, i=0; i<n; i++, pItem++){
98383 Expr *pExpr = pItem->pExpr;
 
 
 
 
 
 
98384 if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
98385 if( flags & SQLITE_ECEL_OMITREF ){
98386 i--;
98387 n--;
98388 }else{
@@ -98907,21 +99079,24 @@
98907 return 2;
98908 }
98909 if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
98910 if( pA->op==TK_FUNCTION ){
98911 if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
 
 
98912 }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
98913 return pA->op==TK_COLLATE ? 1 : 2;
98914 }
98915 }
98916 if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
98917 if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
98918 if( combinedFlags & EP_xIsSelect ) return 2;
98919 if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
98920 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
98921 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
98922 if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){
 
98923 if( pA->iColumn!=pB->iColumn ) return 2;
98924 if( pA->iTable!=pB->iTable
98925 && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
98926 }
98927 }
@@ -99263,12 +99438,13 @@
99263 static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
99264 int i;
99265 NameContext *pNC = pWalker->u.pNC;
99266 Parse *pParse = pNC->pParse;
99267 SrcList *pSrcList = pNC->pSrcList;
99268 AggInfo *pAggInfo = pNC->pAggInfo;
99269
 
99270 switch( pExpr->op ){
99271 case TK_AGG_COLUMN:
99272 case TK_COLUMN: {
99273 testcase( pExpr->op==TK_AGG_COLUMN );
99274 testcase( pExpr->op==TK_COLUMN );
@@ -102434,11 +102610,11 @@
102434 flags |= SQLITE_OPEN_MAIN_DB;
102435 rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
102436 sqlite3_free( zPath );
102437 db->nDb++;
102438 }
102439 db->skipBtreeMutex = 0;
102440 if( rc==SQLITE_CONSTRAINT ){
102441 rc = SQLITE_ERROR;
102442 zErrDyn = sqlite3MPrintf(db, "database is already attached");
102443 }else if( rc==SQLITE_OK ){
102444 Pager *pPager;
@@ -102506,10 +102682,11 @@
102506 ** way we found it.
102507 */
102508 if( rc==SQLITE_OK ){
102509 sqlite3BtreeEnterAll(db);
102510 db->init.iDb = 0;
 
102511 rc = sqlite3Init(db, &zErrDyn);
102512 sqlite3BtreeLeaveAll(db);
102513 assert( zErrDyn==0 || rc!=SQLITE_OK );
102514 }
102515 #ifdef SQLITE_USER_AUTHENTICATION
@@ -102778,10 +102955,13 @@
102778 }
102779 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102780 if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
102781 if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
102782 #endif
 
 
 
102783 }
102784 return 0;
102785 }
102786 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102787 SQLITE_PRIVATE int sqlite3FixSelect(
@@ -102877,10 +103057,22 @@
102877 return 1;
102878 }
102879 if( sqlite3FixExprList(pFix, pStep->pExprList) ){
102880 return 1;
102881 }
 
 
 
 
 
 
 
 
 
 
 
 
102882 pStep = pStep->pNext;
102883 }
102884 return 0;
102885 }
102886 #endif
@@ -103504,28 +103696,31 @@
103504 u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */
103505 const char *zName, /* Name of the table we are looking for */
103506 const char *zDbase /* Name of the database. Might be NULL */
103507 ){
103508 Table *p;
 
103509
103510 /* Read the database schema. If an error occurs, leave an error message
103511 ** and code in pParse and return NULL. */
103512 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
 
 
103513 return 0;
103514 }
103515
103516 p = sqlite3FindTable(pParse->db, zName, zDbase);
103517 if( p==0 ){
103518 const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table";
103519 #ifndef SQLITE_OMIT_VIRTUALTABLE
103520 if( sqlite3FindDbName(pParse->db, zDbase)<1 ){
103521 /* If zName is the not the name of a table in the schema created using
103522 ** CREATE, then check to see if it is the name of an virtual table that
103523 ** can be an eponymous virtual table. */
103524 Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName);
103525 if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
103526 pMod = sqlite3PragmaVtabRegister(pParse->db, zName);
103527 }
103528 if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
103529 return pMod->pEpoTab;
103530 }
103531 }
@@ -103686,10 +103881,11 @@
103686
103687 if( iDb>=0 ){
103688 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
103689 DbSetProperty(db, iDb, DB_ResetWanted);
103690 DbSetProperty(db, 1, DB_ResetWanted);
 
103691 }
103692
103693 if( db->nSchemaLock==0 ){
103694 for(i=0; i<db->nDb; i++){
103695 if( DbHasProperty(db, i, DB_ResetWanted) ){
@@ -103711,11 +103907,11 @@
103711 Db *pDb = &db->aDb[i];
103712 if( pDb->pSchema ){
103713 sqlite3SchemaClear(pDb->pSchema);
103714 }
103715 }
103716 db->mDbFlags &= ~DBFLAG_SchemaChange;
103717 sqlite3VtabUnlockList(db);
103718 sqlite3BtreeLeaveAll(db);
103719 sqlite3CollapseDatabaseArray(db);
103720 }
103721
@@ -104256,19 +104452,24 @@
104256 pCol->zName = z;
104257 sqlite3ColumnPropertiesFromName(p, pCol);
104258
104259 if( pType->n==0 ){
104260 /* If there is no type specified, columns have the default affinity
104261 ** 'BLOB'. */
104262 pCol->affinity = SQLITE_AFF_BLOB;
104263 pCol->szEst = 1;
 
 
 
 
 
104264 }else{
104265 zType = z + sqlite3Strlen30(z) + 1;
104266 memcpy(zType, pType->z, pType->n);
104267 zType[pType->n] = 0;
104268 sqlite3Dequote(zType);
104269 pCol->affinity = sqlite3AffinityType(zType, &pCol->szEst);
104270 pCol->colFlags |= COLFLAG_HASTYPE;
104271 }
104272 p->nCol++;
104273 pParse->constraintName.n = 0;
104274 }
@@ -104324,11 +104525,11 @@
104324 ** 'DOUB' | SQLITE_AFF_REAL
104325 **
104326 ** If none of the substrings in the above table are found,
104327 ** SQLITE_AFF_NUMERIC is returned.
104328 */
104329 SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, u8 *pszEst){
104330 u32 h = 0;
104331 char aff = SQLITE_AFF_NUMERIC;
104332 const char *zChar = 0;
104333
104334 assert( zIn!=0 );
@@ -104361,31 +104562,36 @@
104361 aff = SQLITE_AFF_INTEGER;
104362 break;
104363 }
104364 }
104365
104366 /* If pszEst is not NULL, store an estimate of the field size. The
104367 ** estimate is scaled so that the size of an integer is 1. */
104368 if( pszEst ){
104369 *pszEst = 1; /* default size is approx 4 bytes */
104370 if( aff<SQLITE_AFF_NUMERIC ){
104371 if( zChar ){
104372 while( zChar[0] ){
104373 if( sqlite3Isdigit(zChar[0]) ){
104374 int v = 0;
104375 sqlite3GetInt32(zChar, &v);
104376 v = v/4 + 1;
104377 if( v>255 ) v = 255;
104378 *pszEst = v; /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */
104379 break;
104380 }
104381 zChar++;
104382 }
104383 }else{
104384 *pszEst = 5; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/
104385 }
104386 }
 
 
 
 
 
 
 
 
104387 }
104388 return aff;
104389 }
104390
104391 /*
@@ -108366,11 +108572,11 @@
108366 int nIdx; /* Number of indices */
108367 sqlite3 *db; /* Main database structure */
108368 AuthContext sContext; /* Authorization context */
108369 NameContext sNC; /* Name context to resolve expressions in */
108370 int iDb; /* Database number */
108371 int memCnt = -1; /* Memory cell used for change counting */
108372 int rcauth; /* Value returned by authorization callback */
108373 int eOnePass; /* ONEPASS_OFF or _SINGLE or _MULTI */
108374 int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */
108375 u8 *aToOpen = 0; /* Open cursor iTabCur+j if aToOpen[j] is true */
108376 Index *pPk; /* The PRIMARY KEY index on the table */
@@ -108471,11 +108677,11 @@
108471 v = sqlite3GetVdbe(pParse);
108472 if( v==0 ){
108473 goto delete_from_cleanup;
108474 }
108475 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
108476 sqlite3BeginWriteOperation(pParse, 1, iDb);
108477
108478 /* If we are trying to delete from a view, realize that view into
108479 ** an ephemeral table.
108480 */
108481 #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
@@ -108499,11 +108705,14 @@
108499 }
108500
108501 /* Initialize the counter of the number of rows deleted, if
108502 ** we are counting rows.
108503 */
108504 if( db->flags & SQLITE_CountRows ){
 
 
 
108505 memCnt = ++pParse->nMem;
108506 sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
108507 }
108508
108509 #ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
@@ -108527,11 +108736,11 @@
108527 #endif
108528 ){
108529 assert( !isView );
108530 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
108531 if( HasRowid(pTab) ){
108532 sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
108533 pTab->zName, P4_STATIC);
108534 }
108535 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108536 assert( pIdx->pSchema==pTab->pSchema );
108537 sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
@@ -108572,13 +108781,14 @@
108572 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1);
108573 if( pWInfo==0 ) goto delete_from_cleanup;
108574 eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
108575 assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
108576 assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
 
108577
108578 /* Keep track of the number of rows to be deleted */
108579 if( db->flags & SQLITE_CountRows ){
108580 sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
108581 }
108582
108583 /* Extract the rowid or primary key for the current row */
108584 if( pPk ){
@@ -108717,11 +108927,11 @@
108717
108718 /* Return the number of rows that were deleted. If this routine is
108719 ** generating code because of a call to sqlite3NestedParse(), do not
108720 ** invoke the callback function.
108721 */
108722 if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){
108723 sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);
108724 sqlite3VdbeSetNumCols(v, 1);
108725 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
108726 }
108727
@@ -112899,11 +113109,12 @@
112899 SQLITE_PRIVATE void sqlite3Insert(
112900 Parse *pParse, /* Parser context */
112901 SrcList *pTabList, /* Name of table into which we are inserting */
112902 Select *pSelect, /* A SELECT statement to use as the data source */
112903 IdList *pColumn, /* Column names corresponding to IDLIST. */
112904 int onError /* How to handle constraint errors */
 
112905 ){
112906 sqlite3 *db; /* The main database structure */
112907 Table *pTab; /* The table to insert into. aka TABLE */
112908 int i, j; /* Loop counters */
112909 Vdbe *v; /* Generate code into this virtual machine */
@@ -113194,11 +113405,14 @@
113194 goto insert_cleanup;
113195 }
113196
113197 /* Initialize the count of rows to be inserted
113198 */
113199 if( db->flags & SQLITE_CountRows ){
 
 
 
113200 regRowCount = ++pParse->nMem;
113201 sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
113202 }
113203
113204 /* If this is not a view, open the table and and all indices */
@@ -113214,10 +113428,23 @@
113214 assert( pIdx );
113215 aRegIdx[i] = ++pParse->nMem;
113216 pParse->nMem += pIdx->nColumn;
113217 }
113218 }
 
 
 
 
 
 
 
 
 
 
 
 
 
113219
113220 /* This is the top of the main insertion loop */
113221 if( useTempTable ){
113222 /* This block codes the top of loop only. The complete loop is the
113223 ** following pseudocode (template 4):
@@ -113416,11 +113643,11 @@
113416 #endif
113417 {
113418 int isReplace; /* Set to true if constraints may cause a replace */
113419 int bUseSeek; /* True to use OPFLAG_SEEKRESULT */
113420 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
113421 regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0
113422 );
113423 sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);
113424
113425 /* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE
113426 ** constraints or (b) there are no triggers and this table is not a
@@ -113439,11 +113666,11 @@
113439 }
113440 }
113441
113442 /* Update the count of rows that are inserted
113443 */
113444 if( (db->flags & SQLITE_CountRows)!=0 ){
113445 sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
113446 }
113447
113448 if( pTrigger ){
113449 /* Code AFTER triggers */
@@ -113476,19 +113703,20 @@
113476 /*
113477 ** Return the number of rows inserted. If this routine is
113478 ** generating code because of a call to sqlite3NestedParse(), do not
113479 ** invoke the callback function.
113480 */
113481 if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){
113482 sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
113483 sqlite3VdbeSetNumCols(v, 1);
113484 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
113485 }
113486
113487 insert_cleanup:
113488 sqlite3SrcListDelete(db, pTabList);
113489 sqlite3ExprListDelete(db, pList);
 
113490 sqlite3SelectDelete(db, pSelect);
113491 sqlite3IdListDelete(db, pColumn);
113492 sqlite3DbFree(db, aRegIdx);
113493 }
113494
@@ -113555,10 +113783,48 @@
113555 testcase( w.eCode==CKCNSTRNT_COLUMN );
113556 testcase( w.eCode==CKCNSTRNT_ROWID );
113557 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
113558 return !w.eCode;
113559 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113560
113561 /*
113562 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
113563 ** on table pTab.
113564 **
@@ -113651,11 +113917,12 @@
113651 int regOldData, /* Previous content. 0 for INSERTs */
113652 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
113653 u8 overrideError, /* Override onError to this if not OE_Default */
113654 int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
113655 int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */
113656 int *aiChng /* column i is unchanged if aiChng[i]<0 */
 
113657 ){
113658 Vdbe *v; /* VDBE under constrution */
113659 Index *pIdx; /* Pointer to one of the indices */
113660 Index *pPk = 0; /* The PRIMARY KEY index */
113661 sqlite3 *db; /* Database connection */
@@ -113664,21 +113931,23 @@
113664 int nCol; /* Number of columns */
113665 int onError; /* Conflict resolution strategy */
113666 int addr1; /* Address of jump instruction */
113667 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
113668 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
113669 int ipkTop = 0; /* Top of the rowid change constraint check */
113670 int ipkBottom = 0; /* Bottom of the rowid change constraint check */
113671 u8 isUpdate; /* True if this is an UPDATE operation */
113672 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
 
113673
113674 isUpdate = regOldData!=0;
113675 db = pParse->db;
113676 v = sqlite3GetVdbe(pParse);
113677 assert( v!=0 );
113678 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
113679 nCol = pTab->nCol;
 
113680
113681 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
113682 ** normal rowid tables. nPkField is the number of key fields in the
113683 ** pPk index or 1 for a rowid table. In other words, nPkField is the
113684 ** number of fields in the true primary key of the table. */
@@ -113773,10 +114042,50 @@
113773 sqlite3VdbeResolveLabel(v, allOk);
113774 }
113775 pParse->iSelfTab = 0;
113776 }
113777 #endif /* !defined(SQLITE_OMIT_CHECK) */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113778
113779 /* If rowid is changing, make sure the new rowid does not previously
113780 ** exist in the table.
113781 */
113782 if( pkChng && pPk==0 ){
@@ -113787,10 +114096,36 @@
113787 if( overrideError!=OE_Default ){
113788 onError = overrideError;
113789 }else if( onError==OE_Default ){
113790 onError = OE_Abort;
113791 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113792
113793 if( isUpdate ){
113794 /* pkChng!=0 does not mean that the rowid has changed, only that
113795 ** it might have changed. Skip the conflict logic below if the rowid
113796 ** is unchanged. */
@@ -113797,38 +114132,27 @@
113797 sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData);
113798 sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
113799 VdbeCoverage(v);
113800 }
113801
113802 /* If the response to a rowid conflict is REPLACE but the response
113803 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
113804 ** to defer the running of the rowid conflict checking until after
113805 ** the UNIQUE constraints have run.
113806 */
113807 if( onError==OE_Replace && overrideError!=OE_Replace ){
113808 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
113809 if( pIdx->onError==OE_Ignore || pIdx->onError==OE_Fail ){
113810 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto);
113811 break;
113812 }
113813 }
113814 }
113815
113816 /* Check to see if the new rowid already exists in the table. Skip
113817 ** the following conflict logic if it does not. */
 
113818 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
113819 VdbeCoverage(v);
113820
113821 /* Generate code that deals with a rowid collision */
113822 switch( onError ){
113823 default: {
113824 onError = OE_Abort;
113825 /* Fall thru into the next case */
113826 }
113827 case OE_Rollback:
113828 case OE_Abort:
113829 case OE_Fail: {
 
 
 
113830 sqlite3RowidConstraint(pParse, onError, pTab);
113831 break;
113832 }
113833 case OE_Replace: {
113834 /* If there are DELETE triggers on this table and the
@@ -113861,37 +114185,42 @@
113861 sqlite3MultiWrite(pParse);
113862 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
113863 regNewData, 1, 0, OE_Replace, 1, -1);
113864 }else{
113865 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
113866 if( HasRowid(pTab) ){
113867 /* This OP_Delete opcode fires the pre-update-hook only. It does
113868 ** not modify the b-tree. It is more efficient to let the coming
113869 ** OP_Insert replace the existing entry than it is to delete the
113870 ** existing entry and then insert a new one. */
113871 sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP);
113872 sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
113873 }
113874 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
113875 if( pTab->pIndex ){
113876 sqlite3MultiWrite(pParse);
113877 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
113878 }
113879 }
113880 seenReplace = 1;
113881 break;
113882 }
 
 
 
 
 
 
113883 case OE_Ignore: {
113884 /*assert( seenReplace==0 );*/
113885 sqlite3VdbeGoto(v, ignoreDest);
113886 break;
113887 }
113888 }
113889 sqlite3VdbeResolveLabel(v, addrRowidOk);
113890 if( ipkTop ){
113891 ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
113892 sqlite3VdbeJumpHere(v, ipkTop);
113893 }
113894 }
113895
113896 /* Test all UNIQUE constraints by creating entries for each UNIQUE
113897 ** index and making sure that duplicate entries do not already exist.
@@ -113905,16 +114234,25 @@
113905 int regR; /* Range of registers holding conflicting PK */
113906 int iThisCur; /* Cursor for this UNIQUE index */
113907 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
113908
113909 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
 
 
 
 
 
 
 
 
 
113910 if( bAffinityDone==0 ){
113911 sqlite3TableAffinity(v, pTab, regNewData+1);
113912 bAffinityDone = 1;
113913 }
113914 iThisCur = iIdxCur+ix;
113915 addrUniqueOk = sqlite3VdbeMakeLabel(v);
113916
113917 /* Skip partial indices for which the WHERE clause is not true */
113918 if( pIdx->pPartIdxWhere ){
113919 sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);
113920 pParse->iSelfTab = -(regNewData+1);
@@ -113969,10 +114307,28 @@
113969 if( overrideError!=OE_Default ){
113970 onError = overrideError;
113971 }else if( onError==OE_Default ){
113972 onError = OE_Abort;
113973 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113974
113975 /* Collision detection may be omitted if all of the following are true:
113976 ** (1) The conflict resolution algorithm is REPLACE
113977 ** (2) The table is a WITHOUT ROWID table
113978 ** (3) There are no secondary indexes on the table
@@ -114052,19 +114408,29 @@
114052 }
114053 }
114054
114055 /* Generate code that executes if the new index entry is not unique */
114056 assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
114057 || onError==OE_Ignore || onError==OE_Replace );
114058 switch( onError ){
114059 case OE_Rollback:
114060 case OE_Abort:
114061 case OE_Fail: {
 
 
 
114062 sqlite3UniqueConstraint(pParse, onError, pIdx);
114063 break;
114064 }
 
 
 
 
 
 
114065 case OE_Ignore: {
 
114066 sqlite3VdbeGoto(v, ignoreDest);
114067 break;
114068 }
114069 default: {
114070 Trigger *pTrigger = 0;
@@ -114078,18 +114444,23 @@
114078 (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur);
114079 seenReplace = 1;
114080 break;
114081 }
114082 }
114083 sqlite3VdbeResolveLabel(v, addrUniqueOk);
 
 
 
 
114084 sqlite3ExprCachePop(pParse);
114085 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
 
114086 }
114087 if( ipkTop ){
114088 sqlite3VdbeGoto(v, ipkTop+1);
114089 sqlite3VdbeJumpHere(v, ipkBottom);
114090 }
114091
114092 *pbMayReplace = seenReplace;
114093 VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
114094 }
114095
@@ -119511,10 +119882,11 @@
119511 int meta[5];
119512 InitData initData;
119513 const char *zMasterName;
119514 int openedTransaction = 0;
119515
 
119516 assert( iDb>=0 && iDb<db->nDb );
119517 assert( db->aDb[iDb].pSchema );
119518 assert( sqlite3_mutex_held(db->mutex) );
119519 assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
119520
@@ -119740,10 +120112,11 @@
119740 rc = sqlite3InitOne(db, 0, pzErrMsg);
119741 if( rc ) return rc;
119742 }
119743 /* All other schemas after the main schema. The "temp" schema must be last */
119744 for(i=db->nDb-1; i>0; i--){
 
119745 if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
119746 rc = sqlite3InitOne(db, i, pzErrMsg);
119747 if( rc ) return rc;
119748 }
119749 }
@@ -119761,14 +120134,16 @@
119761 int rc = SQLITE_OK;
119762 sqlite3 *db = pParse->db;
119763 assert( sqlite3_mutex_held(db->mutex) );
119764 if( !db->init.busy ){
119765 rc = sqlite3Init(db, &pParse->zErrMsg);
119766 }
119767 if( rc!=SQLITE_OK ){
119768 pParse->rc = rc;
119769 pParse->nErr++;
 
 
119770 }
119771 return rc;
119772 }
119773
119774
@@ -120289,11 +120664,11 @@
120289 */
120290 #if SELECTTRACE_ENABLED
120291 /***/ int sqlite3SelectTrace = 0;
120292 # define SELECTTRACE(K,P,S,X) \
120293 if(sqlite3SelectTrace&(K)) \
120294 sqlite3DebugPrintf("%s/%p: ",(S)->zSelName,(S)),\
120295 sqlite3DebugPrintf X
120296 #else
120297 # define SELECTTRACE(K,P,S,X)
120298 #endif
120299
@@ -120312,10 +120687,24 @@
120312 };
120313
120314 /*
120315 ** An instance of the following object is used to record information about
120316 ** the ORDER BY (or GROUP BY) clause of query is being coded.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120317 */
120318 typedef struct SortCtx SortCtx;
120319 struct SortCtx {
120320 ExprList *pOrderBy; /* The ORDER BY (or GROUP BY clause) */
120321 int nOBSat; /* Number of ORDER BY terms satisfied by indices */
@@ -120324,10 +120713,18 @@
120324 int labelBkOut; /* Start label for the block-output subroutine */
120325 int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */
120326 int labelDone; /* Jump here when done, ex: LIMIT reached */
120327 u8 sortFlags; /* Zero or more SORTFLAG_* bits */
120328 u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */
 
 
 
 
 
 
 
 
120329 };
120330 #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */
120331
120332 /*
120333 ** Delete all the content of a Select structure. Deallocate the structure
@@ -120946,10 +121343,94 @@
120946 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N);
120947 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
120948 sqlite3ReleaseTempReg(pParse, r1);
120949 }
120950
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120951 /*
120952 ** This routine generates the code for the inside of the inner loop
120953 ** of a SELECT.
120954 **
120955 ** If srcTab is negative, then the p->pEList expressions
@@ -121018,10 +121499,13 @@
121018 for(i=0; i<nResultCol; i++){
121019 sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
121020 VdbeComment((v, "%s", p->pEList->a[i].zName));
121021 }
121022 }else if( eDest!=SRT_Exists ){
 
 
 
121023 /* If the destination is an EXISTS(...) expression, the actual
121024 ** values returned by the SELECT are not required.
121025 */
121026 u8 ecelFlags;
121027 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
@@ -121041,16 +121525,38 @@
121041 int j;
121042 if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
121043 p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
121044 }
121045 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121046 regOrig = 0;
121047 assert( eDest==SRT_Set || eDest==SRT_Mem
121048 || eDest==SRT_Coroutine || eDest==SRT_Output );
121049 }
121050 nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult,
121051 0,ecelFlags);
 
 
 
 
 
 
 
 
121052 }
121053
121054 /* If the DISTINCT keyword was present on the SELECT statement
121055 ** and this row has been seen before, then do not make this row
121056 ** part of the result.
@@ -121504,50 +122010,60 @@
121504 SelectDest *pDest /* Write the sorted results here */
121505 ){
121506 Vdbe *v = pParse->pVdbe; /* The prepared statement */
121507 int addrBreak = pSort->labelDone; /* Jump here to exit loop */
121508 int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */
121509 int addr;
121510 int addrOnce = 0;
121511 int iTab;
121512 ExprList *pOrderBy = pSort->pOrderBy;
121513 int eDest = pDest->eDest;
121514 int iParm = pDest->iSDParm;
121515 int regRow;
121516 int regRowid;
121517 int iCol;
121518 int nKey;
121519 int iSortTab; /* Sorter cursor to read from */
121520 int nSortData; /* Trailing values to read from sorter */
121521 int i;
121522 int bSeq; /* True if sorter record includes seq. no. */
 
121523 struct ExprList_item *aOutEx = p->pEList->a;
121524
121525 assert( addrBreak<0 );
121526 if( pSort->labelBkOut ){
121527 sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
121528 sqlite3VdbeGoto(v, addrBreak);
121529 sqlite3VdbeResolveLabel(v, pSort->labelBkOut);
121530 }
 
 
 
 
 
 
 
 
 
 
 
121531 iTab = pSort->iECursor;
121532 if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
121533 regRowid = 0;
121534 regRow = pDest->iSdst;
121535 nSortData = nColumn;
121536 }else{
121537 regRowid = sqlite3GetTempReg(pParse);
121538 regRow = sqlite3GetTempRange(pParse, nColumn);
121539 nSortData = nColumn;
121540 }
121541 nKey = pOrderBy->nExpr - pSort->nOBSat;
121542 if( pSort->sortFlags & SORTFLAG_UseSorter ){
121543 int regSortOut = ++pParse->nMem;
121544 iSortTab = pParse->nTab++;
121545 if( pSort->labelBkOut ){
121546 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
121547 }
121548 sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);
 
121549 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
121550 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
121551 VdbeCoverage(v);
121552 codeOffset(v, p->iOffset, addrContinue);
121553 sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);
@@ -121556,22 +122072,63 @@
121556 addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v);
121557 codeOffset(v, p->iOffset, addrContinue);
121558 iSortTab = iTab;
121559 bSeq = 1;
121560 }
121561 for(i=0, iCol=nKey+bSeq-1; i<nSortData; i++){
 
 
 
121562 if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++;
121563 }
121564 for(i=nSortData-1; i>=0; i--){
121565 int iRead;
121566 if( aOutEx[i].u.x.iOrderByCol ){
121567 iRead = aOutEx[i].u.x.iOrderByCol-1;
121568 }else{
121569 iRead = iCol--;
121570 }
121571 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
121572 VdbeComment((v, "%s", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121573 }
121574 switch( eDest ){
121575 case SRT_Table:
121576 case SRT_EphemTab: {
121577 sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
@@ -123905,13 +124462,12 @@
123905 }else{
123906 pNew->pPrior = pPrior;
123907 if( pPrior ) pPrior->pNext = pNew;
123908 pNew->pNext = p;
123909 p->pPrior = pNew;
123910 SELECTTRACE(2,pParse,p,
123911 ("compound-subquery flattener creates %s.%p as peer\n",
123912 pNew->zSelName, pNew));
123913 }
123914 if( db->mallocFailed ) return 1;
123915 }
123916
123917 /* Begin flattening the iFrom-th entry of the FROM clause
@@ -125439,11 +125995,14 @@
125439 return 1;
125440 }
125441 if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
125442 memset(&sAggInfo, 0, sizeof(sAggInfo));
125443 #if SELECTTRACE_ENABLED
125444 SELECTTRACE(1,pParse,p, ("begin processing:\n"));
 
 
 
125445 if( sqlite3SelectTrace & 0x100 ){
125446 sqlite3TreeViewSelect(0, p, 0);
125447 }
125448 #endif
125449
@@ -125470,12 +126029,12 @@
125470 goto select_end;
125471 }
125472 assert( p->pEList!=0 );
125473 isAgg = (p->selFlags & SF_Aggregate)!=0;
125474 #if SELECTTRACE_ENABLED
125475 if( sqlite3SelectTrace & 0x100 ){
125476 SELECTTRACE(0x100,pParse,p, ("after name resolution:\n"));
125477 sqlite3TreeViewSelect(0, p, 0);
125478 }
125479 #endif
125480
125481 /* Get a pointer the VDBE under construction, allocating a new VDBE if one
@@ -125572,14 +126131,17 @@
125572 /* Handle compound SELECT statements using the separate multiSelect()
125573 ** procedure.
125574 */
125575 if( p->pPrior ){
125576 rc = multiSelect(pParse, p, pDest);
125577 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
125578 #if SELECTTRACE_ENABLED
125579 SELECTTRACE(1,pParse,p,("end compound-select processing\n"));
 
 
 
125580 #endif
 
125581 return rc;
125582 }
125583 #endif
125584
125585 /* For each term in the FROM clause, do two things:
@@ -125954,11 +126516,12 @@
125954 ** SELECT statement.
125955 */
125956 memset(&sNC, 0, sizeof(sNC));
125957 sNC.pParse = pParse;
125958 sNC.pSrcList = pTabList;
125959 sNC.pAggInfo = &sAggInfo;
 
125960 sAggInfo.mnReg = pParse->nMem+1;
125961 sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
125962 sAggInfo.pGroupBy = pGroupBy;
125963 sqlite3ExprAnalyzeAggList(&sNC, pEList);
125964 sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);
@@ -126343,10 +126906,11 @@
126343 ** and send them to the callback one by one.
126344 */
126345 if( sSort.pOrderBy ){
126346 explainTempTable(pParse,
126347 sSort.nOBSat>0 ? "RIGHT PART OF ORDER BY":"ORDER BY");
 
126348 generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);
126349 }
126350
126351 /* Jump here to skip this query
126352 */
@@ -126358,17 +126922,20 @@
126358
126359 /* Control jumps to here if an error is encountered above, or upon
126360 ** successful coding of the SELECT.
126361 */
126362 select_end:
126363 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
126364 sqlite3ExprListDelete(db, pMinMaxOrderBy);
126365 sqlite3DbFree(db, sAggInfo.aCol);
126366 sqlite3DbFree(db, sAggInfo.aFunc);
126367 #if SELECTTRACE_ENABLED
126368 SELECTTRACE(1,pParse,p,("end processing\n"));
 
 
 
126369 #endif
 
126370 return rc;
126371 }
126372
126373 /************** End of select.c **********************************************/
126374 /************** Begin file table.c *******************************************/
@@ -126598,10 +127165,11 @@
126598
126599 sqlite3ExprDelete(db, pTmp->pWhere);
126600 sqlite3ExprListDelete(db, pTmp->pExprList);
126601 sqlite3SelectDelete(db, pTmp->pSelect);
126602 sqlite3IdListDelete(db, pTmp->pIdList);
 
126603 sqlite3DbFree(db, pTmp->zSpan);
126604
126605 sqlite3DbFree(db, pTmp);
126606 }
126607 }
@@ -126989,10 +127557,11 @@
126989 sqlite3 *db, /* The database connection */
126990 Token *pTableName, /* Name of the table into which we insert */
126991 IdList *pColumn, /* List of columns in pTableName to insert into */
126992 Select *pSelect, /* A SELECT statement that supplies values */
126993 u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
 
126994 const char *zStart, /* Start of SQL text */
126995 const char *zEnd /* End of SQL text */
126996 ){
126997 TriggerStep *pTriggerStep;
126998
@@ -127000,13 +127569,17 @@
127000
127001 pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd);
127002 if( pTriggerStep ){
127003 pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
127004 pTriggerStep->pIdList = pColumn;
 
127005 pTriggerStep->orconf = orconf;
127006 }else{
 
127007 sqlite3IdListDelete(db, pColumn);
 
 
127008 }
127009 sqlite3SelectDelete(db, pSelect);
127010
127011 return pTriggerStep;
127012 }
@@ -127319,20 +127892,21 @@
127319 case TK_UPDATE: {
127320 sqlite3Update(pParse,
127321 targetSrcList(pParse, pStep),
127322 sqlite3ExprListDup(db, pStep->pExprList, 0),
127323 sqlite3ExprDup(db, pStep->pWhere, 0),
127324 pParse->eOrconf, 0, 0
127325 );
127326 break;
127327 }
127328 case TK_INSERT: {
127329 sqlite3Insert(pParse,
127330 targetSrcList(pParse, pStep),
127331 sqlite3SelectDup(db, pStep->pSelect, 0),
127332 sqlite3IdListDup(db, pStep->pIdList),
127333 pParse->eOrconf
 
127334 );
127335 break;
127336 }
127337 case TK_DELETE: {
127338 sqlite3DeleteFrom(pParse,
@@ -127806,11 +128380,12 @@
127806 SrcList *pTabList, /* The table in which we should change things */
127807 ExprList *pChanges, /* Things to be changed */
127808 Expr *pWhere, /* The WHERE clause. May be null */
127809 int onError, /* How to handle constraint errors */
127810 ExprList *pOrderBy, /* ORDER BY clause. May be null */
127811 Expr *pLimit /* LIMIT clause. May be null */
 
127812 ){
127813 int i, j; /* Loop counters */
127814 Table *pTab; /* The table to be updated */
127815 int addrTop = 0; /* VDBE instruction address of the start of the loop */
127816 WhereInfo *pWInfo; /* Information about the WHERE clause */
@@ -127913,20 +128488,27 @@
127913 /* Allocate a cursors for the main database table and for all indices.
127914 ** The index cursors might not be used, but if they are used they
127915 ** need to occur right after the database cursor. So go ahead and
127916 ** allocate enough space, just in case.
127917 */
127918 pTabList->a[0].iCursor = iBaseCur = iDataCur = pParse->nTab++;
127919 iIdxCur = iDataCur+1;
127920 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
 
127921 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
127922 if( IsPrimaryKeyIndex(pIdx) && pPk!=0 ){
127923 iDataCur = pParse->nTab;
127924 pTabList->a[0].iCursor = iDataCur;
127925 }
127926 pParse->nTab++;
127927 }
 
 
 
 
 
 
 
127928
127929 /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].
127930 ** Initialize aXRef[] and aToOpen[] to their default values.
127931 */
127932 aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
@@ -127939,10 +128521,12 @@
127939
127940 /* Initialize the name-context */
127941 memset(&sNC, 0, sizeof(sNC));
127942 sNC.pParse = pParse;
127943 sNC.pSrcList = pTabList;
 
 
127944
127945 /* Resolve the column names in all the expressions of the
127946 ** of the UPDATE statement. Also find the column index
127947 ** for each column to be updated in the pChanges array. For each
127948 ** column to be updated, make sure we have authorization to change
@@ -128042,11 +128626,11 @@
128042
128043 /* Begin generating code. */
128044 v = sqlite3GetVdbe(pParse);
128045 if( v==0 ) goto update_cleanup;
128046 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
128047 sqlite3BeginWriteOperation(pParse, 1, iDb);
128048
128049 /* Allocate required registers. */
128050 if( !IsVirtual(pTab) ){
128051 regRowSet = ++pParse->nMem;
128052 regOldRowid = regNewRowid = ++pParse->nMem;
@@ -128093,12 +128677,20 @@
128093 pWhere, onError);
128094 goto update_cleanup;
128095 }
128096 #endif
128097
128098 /* Initialize the count of updated rows */
128099 if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab ){
 
 
 
 
 
 
 
 
128100 regRowCount = ++pParse->nMem;
128101 sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
128102 }
128103
128104 if( HasRowid(pTab) ){
@@ -128107,50 +128699,65 @@
128107 assert( pPk!=0 );
128108 nPk = pPk->nKeyCol;
128109 iPk = pParse->nMem+1;
128110 pParse->nMem += nPk;
128111 regKey = ++pParse->nMem;
128112 iEph = pParse->nTab++;
128113
128114 sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1);
128115 addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);
128116 sqlite3VdbeSetP4KeyInfo(pParse, pPk);
128117 }
128118
128119 /* Begin the database scan.
128120 **
128121 ** Do not consider a single-pass strategy for a multi-row update if
128122 ** there are any triggers or foreign keys to process, or rows may
128123 ** be deleted as a result of REPLACE conflict handling. Any of these
128124 ** things might disturb a cursor being used to scan through the table
128125 ** or index, causing a single-pass approach to malfunction. */
128126 flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE;
128127 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
128128 flags |= WHERE_ONEPASS_MULTIROW;
128129 }
128130 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur);
128131 if( pWInfo==0 ) goto update_cleanup;
128132
128133 /* A one-pass strategy that might update more than one row may not
128134 ** be used if any column of the index used for the scan is being
128135 ** updated. Otherwise, if there is an index on "b", statements like
128136 ** the following could create an infinite loop:
128137 **
128138 ** UPDATE t1 SET b=b+1 WHERE b>?
128139 **
128140 ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI
128141 ** strategy that uses an index for which one or more columns are being
128142 ** updated. */
128143 eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
128144 if( eOnePass==ONEPASS_MULTI ){
128145 int iCur = aiCurOnePass[1];
128146 if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
128147 eOnePass = ONEPASS_OFF;
128148 }
128149 assert( iCur!=iDataCur || !HasRowid(pTab) );
128150 }
128151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128152 if( HasRowid(pTab) ){
128153 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
128154 ** mode, write the rowid into the FIFO. In either of the one-pass modes,
128155 ** leave it in register regOldRowid. */
128156 sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
@@ -128166,73 +128773,72 @@
128166 for(i=0; i<nPk; i++){
128167 assert( pPk->aiColumn[i]>=0 );
128168 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur,pPk->aiColumn[i],iPk+i);
128169 }
128170 if( eOnePass ){
128171 sqlite3VdbeChangeToNoop(v, addrOpen);
128172 nKey = nPk;
128173 regKey = iPk;
128174 }else{
128175 sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey,
128176 sqlite3IndexAffinityStr(db, pPk), nPk);
128177 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk);
128178 }
128179 }
128180
128181 if( eOnePass!=ONEPASS_MULTI ){
128182 sqlite3WhereEnd(pWInfo);
128183 }
128184
128185 labelBreak = sqlite3VdbeMakeLabel(v);
128186 if( !isView ){
128187 int addrOnce = 0;
128188
128189 /* Open every index that needs updating. */
128190 if( eOnePass!=ONEPASS_OFF ){
128191 if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;
128192 if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;
128193 }
128194
128195 if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
128196 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128197 }
128198 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, aToOpen,
128199 0, 0);
128200 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
128201 }
128202
128203 /* Top of the update loop */
128204 if( eOnePass!=ONEPASS_OFF ){
128205 if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
128206 assert( pPk );
128207 sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey, nKey);
128208 VdbeCoverageNeverTaken(v);
128209 }
128210 if( eOnePass==ONEPASS_SINGLE ){
128211 labelContinue = labelBreak;
128212 }else{
128213 labelContinue = sqlite3VdbeMakeLabel(v);
128214 }
128215 sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);
128216 VdbeCoverageIf(v, pPk==0);
128217 VdbeCoverageIf(v, pPk!=0);
128218 }else if( pPk ){
128219 labelContinue = sqlite3VdbeMakeLabel(v);
128220 sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v);
128221 addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey);
128222 sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0);
128223 VdbeCoverage(v);
128224 }else{
128225 labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet, labelBreak,
128226 regOldRowid);
128227 VdbeCoverage(v);
128228 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128229 VdbeCoverage(v);
128230 }
128231
128232 /* If the record number will change, set register regNewRowid to
128233 ** contain the new value. If the record number is not being modified,
128234 ** then regNewRowid is the same register as regOldRowid, which is
128235 ** already populated. */
128236 assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid );
128237 if( chngRowid ){
128238 sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);
@@ -128339,11 +128945,11 @@
128339
128340 /* Do constraint checks. */
128341 assert( regOldRowid>0 );
128342 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
128343 regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace,
128344 aXRef);
128345
128346 /* Do FK constraint checks. */
128347 if( hasFK ){
128348 sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);
128349 }
@@ -128409,11 +129015,11 @@
128409 }
128410 }
128411
128412 /* Increment the row counter
128413 */
128414 if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab){
128415 sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
128416 }
128417
128418 sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges,
128419 TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);
@@ -128436,20 +129042,19 @@
128436
128437 /* Update the sqlite_sequence table by storing the content of the
128438 ** maximum rowid counter values recorded while inserting into
128439 ** autoincrement tables.
128440 */
128441 if( pParse->nested==0 && pParse->pTriggerTab==0 ){
128442 sqlite3AutoincrementEnd(pParse);
128443 }
128444
128445 /*
128446 ** Return the number of rows that were changed. If this routine is
128447 ** generating code because of a call to sqlite3NestedParse(), do not
128448 ** invoke the callback function.
128449 */
128450 if( (db->flags&SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested ){
128451 sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
128452 sqlite3VdbeSetNumCols(v, 1);
128453 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
128454 }
128455
@@ -128566,19 +129171,16 @@
128566
128567 bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);
128568
128569 if( bOnePass ){
128570 /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded
128571 ** above. Also, if this is a top-level parse (not a trigger), clear the
128572 ** multi-write flag so that the VM does not open a statement journal */
128573 sqlite3VdbeChangeToNoop(v, addr);
128574 if( sqlite3IsToplevel(pParse) ){
128575 pParse->isMultiWrite = 0;
128576 }
128577 }else{
128578 /* Create a record from the argument register contents and insert it into
128579 ** the ephemeral table. */
 
128580 sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
128581 #ifdef SQLITE_DEBUG
128582 /* Signal an assert() within OP_MakeRecord that it is allowed to
128583 ** accept no-change records with serial_type 10 */
128584 sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC);
@@ -128617,10 +129219,262 @@
128617 }
128618 }
128619 #endif /* SQLITE_OMIT_VIRTUALTABLE */
128620
128621 /************** End of update.c **********************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128622 /************** Begin file vacuum.c ******************************************/
128623 /*
128624 ** 2003 April 6
128625 **
128626 ** The author disclaims copyright to this source code. In place of
@@ -132018,10 +132872,13 @@
132018
132019 /* If this is the right table of a LEFT OUTER JOIN, allocate and
132020 ** initialize a memory cell that records if this table matches any
132021 ** row of the left table of the join.
132022 */
 
 
 
132023 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
132024 pLevel->iLeftJoin = ++pParse->nMem;
132025 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
132026 VdbeComment((v, "init LEFT JOIN no-match flag"));
132027 }
@@ -132551,13 +133408,20 @@
132551 }
132552
132553 /* If pIdx is an index on one or more expressions, then look through
132554 ** all the expressions in pWInfo and try to transform matching expressions
132555 ** into reference to index columns.
 
 
 
 
 
 
132556 */
132557 whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
132558
 
132559
132560 /* Record the instruction used to terminate the loop. */
132561 if( pLoop->wsFlags & WHERE_ONEROW ){
132562 pLevel->op = OP_Noop;
132563 }else if( bRev ){
@@ -132709,11 +133573,10 @@
132709 if( pWC->nTerm>1 ){
132710 int iTerm;
132711 for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
132712 Expr *pExpr = pWC->a[iTerm].pExpr;
132713 if( &pWC->a[iTerm] == pTerm ) continue;
132714 if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;
132715 testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
132716 testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
132717 if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
132718 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
132719 testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
@@ -132734,11 +133597,14 @@
132734 WhereTerm *pOrTerm = &pOrWc->a[ii];
132735 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
132736 WhereInfo *pSubWInfo; /* Info for single OR-term scan */
132737 Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
132738 int jmp1 = 0; /* Address of jump operation */
132739 if( pAndExpr && !ExprHasProperty(pOrExpr, EP_FromJoin) ){
 
 
 
132740 pAndExpr->pLeft = pOrExpr;
132741 pOrExpr = pAndExpr;
132742 }
132743 /* Loop through table entries that match term pOrTerm. */
132744 WHERETRACE(0xffff, ("Subplan for OR-clause:\n"));
@@ -132917,11 +133783,11 @@
132917 pWInfo->untestedTerms = 1;
132918 continue;
132919 }
132920 pE = pTerm->pExpr;
132921 assert( pE!=0 );
132922 if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
132923 continue;
132924 }
132925
132926 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
132927 iNext = 2;
@@ -133844,11 +134710,10 @@
133844 pTerm = &pWC->a[idxTerm];
133845 markTermAsChild(pWC, idxNew, idxTerm);
133846 }else{
133847 sqlite3ExprListDelete(db, pList);
133848 }
133849 pTerm->eOperator = WO_NOOP; /* case 1 trumps case 3 */
133850 }
133851 }
133852 }
133853 #endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */
133854
@@ -136981,19 +137846,16 @@
136981
136982 /* Do not allow the upper bound of a LIKE optimization range constraint
136983 ** to mix with a lower range bound from some other source */
136984 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
136985
136986 /* Do not allow IS constraints from the WHERE clause to be used by the
136987 ** right table of a LEFT JOIN. Only constraints in the ON clause are
136988 ** allowed */
136989 if( (pSrc->fg.jointype & JT_LEFT)!=0
136990 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
136991 && (eOp & (WO_IS|WO_ISNULL))!=0
136992 ){
136993 testcase( eOp & WO_IS );
136994 testcase( eOp & WO_ISNULL );
136995 continue;
136996 }
136997
136998 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
136999 pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
@@ -139983,12 +140845,14 @@
139983 ** for terminal symbols is called "yy0".
139984 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
139985 ** zero the stack is dynamically sized using realloc()
139986 ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument
139987 ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument
 
139988 ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser
139989 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
 
139990 ** YYERRORSYMBOL is the code number of the error symbol. If not
139991 ** defined, then do no error processing.
139992 ** YYNSTATE the combined number of states.
139993 ** YYNRULE the number of rules in the grammar
139994 ** YYNTOKEN Number of terminal symbols
@@ -140004,48 +140868,55 @@
140004 #ifndef INTERFACE
140005 # define INTERFACE 1
140006 #endif
140007 /************* Begin control #defines *****************************************/
140008 #define YYCODETYPE unsigned char
140009 #define YYNOCODE 253
140010 #define YYACTIONTYPE unsigned short int
140011 #define YYWILDCARD 83
140012 #define sqlite3ParserTOKENTYPE Token
140013 typedef union {
140014 int yyinit;
140015 sqlite3ParserTOKENTYPE yy0;
140016 int yy4;
140017 struct TrigEvent yy90;
140018 TriggerStep* yy203;
140019 struct {int value; int mask;} yy215;
140020 SrcList* yy259;
140021 Expr* yy314;
140022 ExprList* yy322;
140023 const char* yy336;
140024 IdList* yy384;
140025 Select* yy387;
140026 With* yy451;
 
140027 } YYMINORTYPE;
140028 #ifndef YYSTACKDEPTH
140029 #define YYSTACKDEPTH 100
140030 #endif
140031 #define sqlite3ParserARG_SDECL Parse *pParse;
140032 #define sqlite3ParserARG_PDECL ,Parse *pParse
140033 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
140034 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
 
 
 
 
 
 
140035 #define YYFALLBACK 1
140036 #define YYNSTATE 472
140037 #define YYNRULE 333
140038 #define YYNTOKEN 143
140039 #define YY_MAX_SHIFT 471
140040 #define YY_MIN_SHIFTREDUCE 681
140041 #define YY_MAX_SHIFTREDUCE 1013
140042 #define YY_ERROR_ACTION 1014
140043 #define YY_ACCEPT_ACTION 1015
140044 #define YY_NO_ACTION 1016
140045 #define YY_MIN_REDUCE 1017
140046 #define YY_MAX_REDUCE 1349
140047 /************* End control #defines *******************************************/
140048
140049 /* Define the yytestcase() macro to be a no-op if is not already defined
140050 ** otherwise.
140051 **
@@ -140107,485 +140978,507 @@
140107 ** yy_reduce_ofst[] For each state, the offset into yy_action for
140108 ** shifting non-terminals after a reduce.
140109 ** yy_default[] Default action for each state.
140110 **
140111 *********** Begin parsing tables **********************************************/
140112 #define YY_ACTTAB_COUNT (1566)
140113 static const YYACTIONTYPE yy_action[] = {
140114 /* 0 */ 1169, 1015, 167, 167, 1, 168, 466, 1313, 466, 1083,
140115 /* 10 */ 1062, 466, 97, 94, 183, 1057, 466, 329, 1083, 342,
140116 /* 20 */ 97, 94, 183, 459, 459, 459, 436, 57, 57, 57,
140117 /* 30 */ 57, 807, 57, 57, 367, 367, 367, 57, 57, 808,
140118 /* 40 */ 1270, 1088, 1088, 104, 105, 95, 991, 991, 868, 871,
140119 /* 50 */ 860, 860, 102, 102, 103, 103, 103, 103, 233, 233,
140120 /* 60 */ 326, 1011, 449, 437, 449, 446, 351, 449, 461, 1142,
140121 /* 70 */ 463, 342, 449, 426, 1316, 209, 180, 742, 80, 299,
140122 /* 80 */ 857, 857, 869, 872, 101, 101, 101, 101, 100, 100,
140123 /* 90 */ 99, 99, 99, 98, 368, 104, 105, 95, 991, 991,
140124 /* 100 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140125 /* 110 */ 99, 99, 99, 98, 368, 355, 97, 94, 183, 228,
140126 /* 120 */ 106, 1012, 407, 342, 101, 101, 101, 101, 100, 100,
140127 /* 130 */ 99, 99, 99, 98, 368, 861, 101, 101, 101, 101,
140128 /* 140 */ 100, 100, 99, 99, 99, 98, 368, 104, 105, 95,
140129 /* 150 */ 991, 991, 868, 871, 860, 860, 102, 102, 103, 103,
140130 /* 160 */ 103, 103, 201, 368, 375, 420, 417, 416, 387, 273,
140131 /* 170 */ 65, 97, 94, 183, 168, 342, 415, 951, 1343, 396,
140132 /* 180 */ 66, 1343, 320, 959, 371, 970, 334, 340, 101, 101,
140133 /* 190 */ 101, 101, 100, 100, 99, 99, 99, 98, 368, 104,
140134 /* 200 */ 105, 95, 991, 991, 868, 871, 860, 860, 102, 102,
140135 /* 210 */ 103, 103, 103, 103, 373, 100, 100, 99, 99, 99,
140136 /* 220 */ 98, 368, 970, 971, 972, 201, 1100, 342, 420, 417,
140137 /* 230 */ 416, 287, 366, 365, 337, 970, 1162, 463, 949, 415,
140138 /* 240 */ 101, 101, 101, 101, 100, 100, 99, 99, 99, 98,
140139 /* 250 */ 368, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140140 /* 260 */ 102, 102, 103, 103, 103, 103, 777, 241, 233, 233,
140141 /* 270 */ 9, 847, 970, 971, 972, 390, 998, 1141, 998, 342,
140142 /* 280 */ 463, 252, 829, 719, 98, 368, 840, 298, 338, 142,
140143 /* 290 */ 839, 339, 101, 101, 101, 101, 100, 100, 99, 99,
140144 /* 300 */ 99, 98, 368, 104, 105, 95, 991, 991, 868, 871,
140145 /* 310 */ 860, 860, 102, 102, 103, 103, 103, 103, 272, 466,
140146 /* 320 */ 392, 839, 839, 841, 97, 94, 183, 390, 1317, 253,
140147 /* 330 */ 456, 342, 125, 166, 807, 712, 208, 407, 386, 970,
140148 /* 340 */ 57, 57, 808, 238, 101, 101, 101, 101, 100, 100,
140149 /* 350 */ 99, 99, 99, 98, 368, 104, 105, 95, 991, 991,
140150 /* 360 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140151 /* 370 */ 466, 108, 466, 267, 465, 442, 970, 971, 972, 261,
140152 /* 380 */ 951, 1344, 909, 342, 1344, 142, 829, 848, 1292, 959,
140153 /* 390 */ 371, 55, 55, 57, 57, 242, 101, 101, 101, 101,
140154 /* 400 */ 100, 100, 99, 99, 99, 98, 368, 104, 105, 95,
140155 /* 410 */ 991, 991, 868, 871, 860, 860, 102, 102, 103, 103,
140156 /* 420 */ 103, 103, 272, 382, 262, 253, 456, 310, 364, 253,
140157 /* 430 */ 456, 86, 264, 84, 266, 342, 441, 176, 175, 834,
140158 /* 440 */ 464, 949, 767, 767, 332, 313, 1094, 396, 101, 101,
140159 /* 450 */ 101, 101, 100, 100, 99, 99, 99, 98, 368, 104,
140160 /* 460 */ 105, 95, 991, 991, 868, 871, 860, 860, 102, 102,
140161 /* 470 */ 103, 103, 103, 103, 227, 227, 233, 233, 233, 233,
140162 /* 480 */ 387, 273, 234, 234, 326, 950, 463, 342, 463, 298,
140163 /* 490 */ 463, 914, 914, 404, 463, 1037, 123, 265, 27, 970,
140164 /* 500 */ 101, 101, 101, 101, 100, 100, 99, 99, 99, 98,
140165 /* 510 */ 368, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140166 /* 520 */ 102, 102, 103, 103, 103, 103, 435, 233, 233, 466,
140167 /* 530 */ 285, 686, 687, 688, 127, 271, 970, 971, 972, 463,
140168 /* 540 */ 1345, 327, 342, 407, 157, 1012, 988, 13, 13, 181,
140169 /* 550 */ 41, 41, 101, 101, 101, 101, 100, 100, 99, 99,
140170 /* 560 */ 99, 98, 368, 715, 794, 378, 104, 105, 95, 991,
140171 /* 570 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140172 /* 580 */ 103, 970, 378, 377, 346, 239, 847, 1086, 1086, 280,
140173 /* 590 */ 1169, 283, 204, 203, 202, 177, 298, 342, 407, 298,
140174 /* 600 */ 715, 840, 169, 299, 407, 839, 82, 101, 101, 101,
140175 /* 610 */ 101, 100, 100, 99, 99, 99, 98, 368, 970, 971,
140176 /* 620 */ 972, 104, 105, 95, 991, 991, 868, 871, 860, 860,
140177 /* 630 */ 102, 102, 103, 103, 103, 103, 839, 839, 841, 362,
140178 /* 640 */ 240, 124, 1169, 172, 126, 378, 1269, 1169, 1066, 342,
140179 /* 650 */ 253, 456, 407, 407, 407, 396, 352, 401, 407, 429,
140180 /* 660 */ 398, 85, 101, 101, 101, 101, 100, 100, 99, 99,
140181 /* 670 */ 99, 98, 368, 104, 105, 95, 991, 991, 868, 871,
140182 /* 680 */ 860, 860, 102, 102, 103, 103, 103, 103, 1169, 466,
140183 /* 690 */ 230, 233, 233, 792, 1235, 1095, 1091, 1293, 1, 77,
140184 /* 700 */ 278, 342, 205, 463, 974, 911, 1040, 348, 353, 911,
140185 /* 710 */ 42, 42, 79, 403, 101, 101, 101, 101, 100, 100,
140186 /* 720 */ 99, 99, 99, 98, 368, 104, 93, 95, 991, 991,
140187 /* 730 */ 868, 871, 860, 860, 102, 102, 103, 103, 103, 103,
140188 /* 740 */ 402, 9, 974, 243, 772, 458, 348, 232, 180, 771,
140189 /* 750 */ 946, 312, 342, 328, 363, 349, 143, 831, 389, 1278,
140190 /* 760 */ 211, 211, 21, 347, 432, 182, 101, 101, 101, 101,
140191 /* 770 */ 100, 100, 99, 99, 99, 98, 368, 105, 95, 991,
140192 /* 780 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140193 /* 790 */ 103, 792, 724, 22, 732, 731, 233, 233, 1239, 256,
140194 /* 800 */ 391, 274, 342, 211, 79, 360, 257, 413, 463, 397,
140195 /* 810 */ 207, 288, 260, 450, 79, 1239, 1241, 101, 101, 101,
140196 /* 820 */ 101, 100, 100, 99, 99, 99, 98, 368, 95, 991,
140197 /* 830 */ 991, 868, 871, 860, 860, 102, 102, 103, 103, 103,
140198 /* 840 */ 103, 91, 457, 296, 3, 233, 233, 5, 438, 212,
140199 /* 850 */ 331, 394, 739, 740, 295, 898, 894, 463, 460, 207,
140200 /* 860 */ 801, 1237, 722, 211, 698, 843, 1283, 101, 101, 101,
140201 /* 870 */ 101, 100, 100, 99, 99, 99, 98, 368, 1239, 380,
140202 /* 880 */ 357, 369, 233, 233, 989, 219, 236, 297, 423, 292,
140203 /* 890 */ 422, 206, 454, 898, 463, 970, 91, 457, 290, 3,
140204 /* 900 */ 722, 142, 268, 843, 847, 466, 1258, 149, 388, 425,
140205 /* 910 */ 88, 89, 769, 460, 930, 87, 447, 90, 369, 468,
140206 /* 920 */ 467, 385, 989, 839, 1257, 439, 57, 57, 395, 931,
140207 /* 930 */ 1065, 158, 970, 971, 972, 772, 369, 471, 1019, 399,
140208 /* 940 */ 771, 253, 456, 254, 932, 119, 891, 454, 233, 233,
140209 /* 950 */ 4, 970, 1096, 275, 839, 839, 841, 842, 19, 847,
140210 /* 960 */ 463, 449, 448, 163, 453, 88, 89, 776, 970, 1127,
140211 /* 970 */ 279, 930, 90, 369, 468, 467, 91, 457, 839, 3,
140212 /* 980 */ 235, 1064, 466, 1228, 233, 233, 931, 970, 970, 971,
140213 /* 990 */ 972, 970, 908, 460, 908, 2, 463, 81, 457, 212,
140214 /* 1000 */ 3, 932, 282, 10, 10, 970, 971, 972, 189, 839,
140215 /* 1010 */ 839, 841, 842, 19, 460, 284, 369, 354, 907, 286,
140216 /* 1020 */ 907, 753, 466, 1079, 970, 971, 972, 454, 970, 971,
140217 /* 1030 */ 972, 754, 970, 1063, 989, 372, 792, 369, 1118, 847,
140218 /* 1040 */ 291, 452, 466, 10, 10, 88, 89, 142, 454, 168,
140219 /* 1050 */ 300, 412, 90, 369, 468, 467, 793, 356, 839, 706,
140220 /* 1060 */ 847, 341, 121, 10, 10, 301, 88, 89, 379, 970,
140221 /* 1070 */ 971, 972, 989, 90, 369, 468, 467, 244, 205, 839,
140222 /* 1080 */ 1306, 245, 1135, 245, 250, 1168, 1114, 253, 456, 839,
140223 /* 1090 */ 839, 841, 842, 19, 1125, 237, 122, 451, 1174, 733,
140224 /* 1100 */ 324, 324, 323, 222, 321, 466, 1046, 695, 182, 225,
140225 /* 1110 */ 839, 839, 841, 842, 19, 103, 103, 103, 103, 96,
140226 /* 1120 */ 185, 466, 259, 1039, 1028, 170, 10, 10, 1027, 421,
140227 /* 1130 */ 258, 1029, 1300, 708, 792, 466, 408, 734, 8, 347,
140228 /* 1140 */ 444, 174, 12, 12, 290, 101, 101, 101, 101, 100,
140229 /* 1150 */ 100, 99, 99, 99, 98, 368, 32, 32, 466, 187,
140230 /* 1160 */ 466, 1111, 103, 103, 103, 103, 188, 466, 325, 138,
140231 /* 1170 */ 186, 708, 303, 305, 307, 358, 970, 270, 393, 43,
140232 /* 1180 */ 43, 44, 44, 1157, 333, 178, 418, 294, 45, 45,
140233 /* 1190 */ 1232, 318, 101, 101, 101, 101, 100, 100, 99, 99,
140234 /* 1200 */ 99, 98, 368, 381, 343, 366, 365, 466, 263, 253,
140235 /* 1210 */ 456, 466, 1062, 970, 971, 972, 1231, 997, 309, 466,
140236 /* 1220 */ 455, 466, 427, 466, 995, 173, 996, 1303, 46, 46,
140237 /* 1230 */ 145, 376, 37, 37, 1006, 1277, 466, 214, 1275, 64,
140238 /* 1240 */ 47, 47, 33, 33, 34, 34, 1003, 67, 466, 998,
140239 /* 1250 */ 350, 998, 466, 155, 233, 233, 466, 36, 36, 24,
140240 /* 1260 */ 140, 77, 1154, 466, 383, 466, 463, 428, 466, 48,
140241 /* 1270 */ 48, 466, 147, 49, 49, 466, 150, 50, 50, 466,
140242 /* 1280 */ 151, 152, 466, 384, 11, 11, 51, 51, 466, 110,
140243 /* 1290 */ 110, 153, 52, 52, 411, 466, 38, 38, 466, 191,
140244 /* 1300 */ 53, 53, 466, 54, 54, 466, 400, 466, 330, 39,
140245 /* 1310 */ 39, 466, 1164, 466, 25, 466, 56, 56, 466, 131,
140246 /* 1320 */ 131, 72, 466, 132, 132, 159, 133, 133, 61, 61,
140247 /* 1330 */ 1226, 195, 40, 40, 111, 111, 58, 58, 406, 112,
140248 /* 1340 */ 112, 466, 277, 113, 113, 466, 226, 466, 1246, 466,
140249 /* 1350 */ 197, 466, 164, 466, 409, 466, 198, 466, 199, 466,
140250 /* 1360 */ 335, 281, 109, 109, 466, 1030, 130, 130, 129, 129,
140251 /* 1370 */ 117, 117, 116, 116, 114, 114, 115, 115, 60, 60,
140252 /* 1380 */ 62, 62, 466, 359, 466, 59, 59, 424, 1082, 1081,
140253 /* 1390 */ 1080, 724, 1073, 1054, 336, 293, 1053, 1052, 1315, 431,
140254 /* 1400 */ 361, 76, 248, 31, 31, 35, 35, 1072, 249, 440,
140255 /* 1410 */ 302, 434, 213, 1122, 6, 311, 1212, 107, 83, 251,
140256 /* 1420 */ 78, 1123, 445, 220, 443, 1036, 304, 23, 1121, 469,
140257 /* 1430 */ 965, 221, 223, 1104, 314, 224, 344, 317, 315, 316,
140258 /* 1440 */ 470, 306, 1025, 1120, 308, 1262, 1020, 134, 120, 246,
140259 /* 1450 */ 682, 370, 171, 255, 1263, 135, 184, 1261, 1260, 374,
140260 /* 1460 */ 118, 906, 904, 827, 1050, 146, 136, 137, 148, 1049,
140261 /* 1470 */ 63, 1047, 756, 190, 269, 920, 154, 156, 68, 69,
140262 /* 1480 */ 70, 71, 139, 923, 192, 193, 144, 919, 345, 128,
140263 /* 1490 */ 14, 194, 276, 211, 1000, 405, 196, 161, 912, 160,
140264 /* 1500 */ 26, 697, 410, 295, 200, 289, 414, 162, 419, 73,
140265 /* 1510 */ 15, 16, 141, 74, 28, 247, 846, 845, 735, 874,
140266 /* 1520 */ 954, 75, 430, 955, 29, 433, 179, 229, 231, 800,
140267 /* 1530 */ 165, 795, 87, 210, 889, 79, 875, 17, 873, 877,
140268 /* 1540 */ 929, 18, 928, 216, 215, 878, 20, 30, 462, 844,
140269 /* 1550 */ 707, 92, 766, 770, 7, 322, 217, 218, 319, 1308,
140270 /* 1560 */ 960, 1016, 1016, 1016, 1016, 1307,
 
 
 
 
 
 
 
 
 
140271 };
140272 static const YYCODETYPE yy_lookahead[] = {
140273 /* 0 */ 152, 144, 145, 146, 147, 152, 152, 172, 152, 180,
140274 /* 10 */ 181, 152, 223, 224, 225, 180, 152, 164, 189, 19,
140275 /* 20 */ 223, 224, 225, 168, 169, 170, 163, 173, 174, 173,
140276 /* 30 */ 174, 31, 173, 174, 168, 169, 170, 173, 174, 39,
140277 /* 40 */ 243, 191, 192, 43, 44, 45, 46, 47, 48, 49,
140278 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 195, 196,
140279 /* 60 */ 22, 23, 208, 209, 208, 209, 218, 208, 209, 176,
140280 /* 70 */ 207, 19, 208, 209, 23, 212, 213, 26, 26, 152,
140281 /* 80 */ 46, 47, 48, 49, 84, 85, 86, 87, 88, 89,
140282 /* 90 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140283 /* 100 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140284 /* 110 */ 90, 91, 92, 93, 94, 188, 223, 224, 225, 171,
140285 /* 120 */ 68, 83, 152, 19, 84, 85, 86, 87, 88, 89,
140286 /* 130 */ 90, 91, 92, 93, 94, 101, 84, 85, 86, 87,
140287 /* 140 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
140288 /* 150 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
140289 /* 160 */ 56, 57, 99, 94, 194, 102, 103, 104, 109, 110,
140290 /* 170 */ 66, 223, 224, 225, 152, 19, 113, 22, 23, 152,
140291 /* 180 */ 24, 26, 160, 1, 2, 59, 164, 173, 84, 85,
140292 /* 190 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
140293 /* 200 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
140294 /* 210 */ 54, 55, 56, 57, 244, 88, 89, 90, 91, 92,
140295 /* 220 */ 93, 94, 96, 97, 98, 99, 196, 19, 102, 103,
140296 /* 230 */ 104, 23, 88, 89, 173, 59, 163, 207, 83, 113,
140297 /* 240 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
140298 /* 250 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140299 /* 260 */ 52, 53, 54, 55, 56, 57, 90, 240, 195, 196,
140300 /* 270 */ 171, 82, 96, 97, 98, 152, 132, 176, 134, 19,
140301 /* 280 */ 207, 200, 72, 23, 93, 94, 97, 152, 173, 79,
140302 /* 290 */ 101, 210, 84, 85, 86, 87, 88, 89, 90, 91,
140303 /* 300 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
140304 /* 310 */ 50, 51, 52, 53, 54, 55, 56, 57, 108, 152,
140305 /* 320 */ 152, 132, 133, 134, 223, 224, 225, 152, 186, 119,
140306 /* 330 */ 120, 19, 197, 234, 31, 23, 26, 152, 239, 59,
140307 /* 340 */ 173, 174, 39, 220, 84, 85, 86, 87, 88, 89,
140308 /* 350 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140309 /* 360 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140310 /* 370 */ 152, 22, 152, 16, 152, 208, 96, 97, 98, 194,
140311 /* 380 */ 22, 23, 11, 19, 26, 79, 72, 23, 0, 1,
140312 /* 390 */ 2, 173, 174, 173, 174, 220, 84, 85, 86, 87,
140313 /* 400 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
140314 /* 410 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
140315 /* 420 */ 56, 57, 108, 109, 110, 119, 120, 152, 208, 119,
140316 /* 430 */ 120, 137, 75, 139, 77, 19, 152, 88, 89, 23,
140317 /* 440 */ 115, 83, 117, 118, 163, 227, 163, 152, 84, 85,
140318 /* 450 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
140319 /* 460 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
140320 /* 470 */ 54, 55, 56, 57, 195, 196, 195, 196, 195, 196,
140321 /* 480 */ 109, 110, 195, 196, 22, 23, 207, 19, 207, 152,
140322 /* 490 */ 207, 108, 109, 110, 207, 163, 22, 140, 24, 59,
140323 /* 500 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
140324 /* 510 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140325 /* 520 */ 52, 53, 54, 55, 56, 57, 152, 195, 196, 152,
140326 /* 530 */ 16, 7, 8, 9, 197, 240, 96, 97, 98, 207,
140327 /* 540 */ 249, 250, 19, 152, 22, 83, 26, 173, 174, 152,
140328 /* 550 */ 173, 174, 84, 85, 86, 87, 88, 89, 90, 91,
140329 /* 560 */ 92, 93, 94, 59, 124, 152, 43, 44, 45, 46,
140330 /* 570 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140331 /* 580 */ 57, 59, 169, 170, 157, 194, 82, 191, 192, 75,
140332 /* 590 */ 152, 77, 108, 109, 110, 26, 152, 19, 152, 152,
140333 /* 600 */ 96, 97, 24, 152, 152, 101, 138, 84, 85, 86,
140334 /* 610 */ 87, 88, 89, 90, 91, 92, 93, 94, 96, 97,
140335 /* 620 */ 98, 43, 44, 45, 46, 47, 48, 49, 50, 51,
140336 /* 630 */ 52, 53, 54, 55, 56, 57, 132, 133, 134, 188,
140337 /* 640 */ 194, 197, 152, 123, 197, 232, 194, 152, 182, 19,
140338 /* 650 */ 119, 120, 152, 152, 152, 152, 218, 230, 152, 163,
140339 /* 660 */ 233, 138, 84, 85, 86, 87, 88, 89, 90, 91,
140340 /* 670 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
140341 /* 680 */ 50, 51, 52, 53, 54, 55, 56, 57, 152, 152,
140342 /* 690 */ 23, 195, 196, 26, 194, 194, 194, 146, 147, 130,
140343 /* 700 */ 194, 19, 46, 207, 59, 29, 166, 167, 218, 33,
140344 /* 710 */ 173, 174, 26, 218, 84, 85, 86, 87, 88, 89,
140345 /* 720 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
140346 /* 730 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
140347 /* 740 */ 64, 171, 97, 240, 116, 166, 167, 212, 213, 121,
140348 /* 750 */ 23, 152, 19, 26, 218, 247, 248, 23, 23, 152,
140349 /* 760 */ 26, 26, 22, 107, 163, 98, 84, 85, 86, 87,
140350 /* 770 */ 88, 89, 90, 91, 92, 93, 94, 44, 45, 46,
140351 /* 780 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140352 /* 790 */ 57, 124, 106, 53, 100, 101, 195, 196, 152, 152,
140353 /* 800 */ 23, 23, 19, 26, 26, 19, 152, 23, 207, 239,
140354 /* 810 */ 26, 23, 152, 163, 26, 169, 170, 84, 85, 86,
140355 /* 820 */ 87, 88, 89, 90, 91, 92, 93, 94, 45, 46,
140356 /* 830 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
140357 /* 840 */ 57, 19, 20, 101, 22, 195, 196, 22, 19, 24,
140358 /* 850 */ 163, 19, 7, 8, 112, 59, 23, 207, 36, 26,
140359 /* 860 */ 23, 152, 59, 26, 21, 59, 152, 84, 85, 86,
140360 /* 870 */ 87, 88, 89, 90, 91, 92, 93, 94, 232, 221,
140361 /* 880 */ 94, 59, 195, 196, 59, 99, 100, 101, 102, 103,
140362 /* 890 */ 104, 105, 70, 97, 207, 59, 19, 20, 112, 22,
140363 /* 900 */ 97, 79, 152, 97, 82, 152, 152, 71, 221, 90,
140364 /* 910 */ 88, 89, 23, 36, 12, 26, 163, 95, 96, 97,
140365 /* 920 */ 98, 78, 97, 101, 152, 96, 173, 174, 96, 27,
140366 /* 930 */ 182, 22, 96, 97, 98, 116, 59, 148, 149, 152,
140367 /* 940 */ 121, 119, 120, 154, 42, 156, 103, 70, 195, 196,
140368 /* 950 */ 22, 59, 163, 152, 132, 133, 134, 135, 136, 82,
140369 /* 960 */ 207, 208, 209, 71, 62, 88, 89, 90, 59, 152,
140370 /* 970 */ 152, 12, 95, 96, 97, 98, 19, 20, 101, 22,
140371 /* 980 */ 22, 182, 152, 140, 195, 196, 27, 59, 96, 97,
140372 /* 990 */ 98, 59, 132, 36, 134, 22, 207, 19, 20, 24,
140373 /* 1000 */ 22, 42, 152, 173, 174, 96, 97, 98, 219, 132,
140374 /* 1010 */ 133, 134, 135, 136, 36, 152, 59, 187, 132, 152,
140375 /* 1020 */ 134, 62, 152, 152, 96, 97, 98, 70, 96, 97,
140376 /* 1030 */ 98, 72, 59, 152, 59, 246, 26, 59, 214, 82,
140377 /* 1040 */ 152, 192, 152, 173, 174, 88, 89, 79, 70, 152,
140378 /* 1050 */ 152, 19, 95, 96, 97, 98, 124, 187, 101, 23,
140379 /* 1060 */ 82, 164, 26, 173, 174, 152, 88, 89, 100, 96,
140380 /* 1070 */ 97, 98, 97, 95, 96, 97, 98, 187, 46, 101,
140381 /* 1080 */ 122, 184, 152, 186, 211, 152, 152, 119, 120, 132,
140382 /* 1090 */ 133, 134, 135, 136, 152, 5, 22, 152, 152, 35,
140383 /* 1100 */ 10, 11, 12, 13, 14, 152, 152, 17, 98, 235,
140384 /* 1110 */ 132, 133, 134, 135, 136, 54, 55, 56, 57, 58,
140385 /* 1120 */ 30, 152, 32, 152, 152, 198, 173, 174, 152, 65,
140386 /* 1130 */ 40, 152, 152, 59, 124, 152, 236, 73, 199, 107,
140387 /* 1140 */ 187, 171, 173, 174, 112, 84, 85, 86, 87, 88,
140388 /* 1150 */ 89, 90, 91, 92, 93, 94, 173, 174, 152, 69,
140389 /* 1160 */ 152, 211, 54, 55, 56, 57, 76, 152, 150, 79,
140390 /* 1170 */ 80, 97, 211, 211, 211, 111, 59, 241, 241, 173,
140391 /* 1180 */ 174, 173, 174, 202, 202, 185, 177, 176, 173, 174,
140392 /* 1190 */ 176, 201, 84, 85, 86, 87, 88, 89, 90, 91,
140393 /* 1200 */ 92, 93, 94, 215, 114, 88, 89, 152, 215, 119,
140394 /* 1210 */ 120, 152, 181, 96, 97, 98, 176, 100, 215, 152,
140395 /* 1220 */ 229, 152, 163, 152, 107, 199, 109, 155, 173, 174,
140396 /* 1230 */ 245, 141, 173, 174, 60, 159, 152, 122, 159, 242,
140397 /* 1240 */ 173, 174, 173, 174, 173, 174, 38, 242, 152, 132,
140398 /* 1250 */ 159, 134, 152, 22, 195, 196, 152, 173, 174, 222,
140399 /* 1260 */ 43, 130, 202, 152, 18, 152, 207, 208, 152, 173,
140400 /* 1270 */ 174, 152, 190, 173, 174, 152, 193, 173, 174, 152,
140401 /* 1280 */ 193, 193, 152, 159, 173, 174, 173, 174, 152, 173,
140402 /* 1290 */ 174, 193, 173, 174, 18, 152, 173, 174, 152, 158,
140403 /* 1300 */ 173, 174, 152, 173, 174, 152, 159, 152, 202, 173,
140404 /* 1310 */ 174, 152, 190, 152, 222, 152, 173, 174, 152, 173,
140405 /* 1320 */ 174, 137, 152, 173, 174, 190, 173, 174, 173, 174,
140406 /* 1330 */ 202, 158, 173, 174, 173, 174, 173, 174, 61, 173,
140407 /* 1340 */ 174, 152, 237, 173, 174, 152, 159, 152, 238, 152,
140408 /* 1350 */ 158, 152, 22, 152, 178, 152, 158, 152, 158, 152,
140409 /* 1360 */ 178, 159, 173, 174, 152, 159, 173, 174, 173, 174,
140410 /* 1370 */ 173, 174, 173, 174, 173, 174, 173, 174, 173, 174,
140411 /* 1380 */ 173, 174, 152, 63, 152, 173, 174, 107, 175, 175,
140412 /* 1390 */ 175, 106, 183, 175, 178, 175, 177, 175, 175, 178,
140413 /* 1400 */ 94, 107, 231, 173, 174, 173, 174, 183, 231, 125,
140414 /* 1410 */ 216, 178, 159, 217, 22, 159, 226, 129, 137, 228,
140415 /* 1420 */ 128, 217, 126, 25, 127, 162, 216, 26, 217, 161,
140416 /* 1430 */ 13, 153, 153, 206, 205, 6, 251, 202, 204, 203,
140417 /* 1440 */ 151, 216, 151, 217, 216, 171, 151, 165, 179, 179,
140418 /* 1450 */ 4, 3, 22, 142, 171, 165, 15, 171, 171, 81,
140419 /* 1460 */ 16, 23, 23, 120, 171, 131, 165, 111, 123, 171,
140420 /* 1470 */ 171, 171, 20, 125, 16, 1, 123, 131, 53, 53,
140421 /* 1480 */ 53, 53, 111, 96, 34, 122, 248, 1, 251, 5,
140422 /* 1490 */ 22, 107, 140, 26, 74, 41, 122, 107, 67, 67,
140423 /* 1500 */ 24, 20, 19, 112, 105, 23, 66, 22, 66, 22,
140424 /* 1510 */ 22, 22, 37, 22, 22, 66, 23, 23, 28, 23,
140425 /* 1520 */ 23, 26, 24, 23, 22, 24, 122, 23, 23, 96,
140426 /* 1530 */ 22, 124, 26, 34, 23, 26, 23, 34, 23, 23,
140427 /* 1540 */ 23, 34, 23, 22, 26, 11, 22, 22, 26, 23,
140428 /* 1550 */ 23, 22, 116, 23, 22, 15, 122, 122, 23, 122,
140429 /* 1560 */ 1, 252, 252, 252, 252, 122, 252, 252, 252, 252,
140430 /* 1570 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140431 /* 1580 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140432 /* 1590 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140433 /* 1600 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140434 /* 1610 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140435 /* 1620 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140436 /* 1630 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140437 /* 1640 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140438 /* 1650 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140439 /* 1660 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140440 /* 1670 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140441 /* 1680 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140442 /* 1690 */ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
140443 /* 1700 */ 252, 252, 252, 252, 252, 252, 252, 252, 252,
140444 };
140445 #define YY_SHIFT_COUNT (471)
 
 
 
 
 
 
 
 
 
 
140446 #define YY_SHIFT_MIN (0)
140447 #define YY_SHIFT_MAX (1559)
140448 static const unsigned short int yy_shift_ofst[] = {
140449 /* 0 */ 182, 1090, 822, 822, 306, 957, 957, 957, 957, 210,
140450 /* 10 */ 0, 0, 104, 630, 957, 957, 957, 957, 957, 957,
140451 /* 20 */ 957, 1117, 1117, 126, 968, 306, 306, 306, 306, 306,
140452 /* 30 */ 306, 52, 156, 208, 260, 312, 364, 416, 468, 523,
140453 /* 40 */ 578, 630, 630, 630, 630, 630, 630, 630, 630, 630,
140454 /* 50 */ 630, 630, 630, 630, 630, 630, 630, 630, 682, 630,
140455 /* 60 */ 733, 783, 783, 877, 957, 957, 957, 957, 957, 957,
140456 /* 70 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
140457 /* 80 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
140458 /* 90 */ 957, 957, 957, 957, 957, 978, 957, 957, 957, 957,
140459 /* 100 */ 957, 957, 957, 957, 957, 957, 957, 957, 957, 1061,
140460 /* 110 */ 1108, 1108, 1108, 1108, 1108, 40, 127, 20, 280, 843,
140461 /* 120 */ 1032, 144, 144, 280, 310, 310, 310, 310, 59, 191,
140462 /* 130 */ 69, 1566, 1566, 1566, 786, 786, 786, 522, 836, 522,
140463 /* 140 */ 959, 959, 892, 155, 358, 280, 280, 280, 280, 280,
140464 /* 150 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
140465 /* 160 */ 280, 280, 280, 280, 280, 280, 371, 388, 645, 645,
140466 /* 170 */ 531, 1566, 1566, 1566, 504, 189, 189, 909, 63, 176,
140467 /* 180 */ 928, 440, 932, 973, 280, 280, 280, 280, 280, 314,
140468 /* 190 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
140469 /* 200 */ 280, 280, 1064, 1064, 1064, 280, 280, 280, 280, 667,
140470 /* 210 */ 280, 280, 280, 825, 280, 280, 902, 280, 280, 280,
140471 /* 220 */ 280, 280, 280, 280, 280, 383, 676, 325, 975, 975,
140472 /* 230 */ 975, 975, 1010, 325, 325, 819, 349, 524, 569, 829,
140473 /* 240 */ 829, 832, 569, 832, 686, 51, 656, 303, 303, 303,
140474 /* 250 */ 829, 294, 520, 628, 474, 1174, 1115, 1115, 1208, 1208,
140475 /* 260 */ 1115, 1231, 1217, 1131, 1246, 1246, 1246, 1246, 1115, 1276,
140476 /* 270 */ 1131, 1231, 1217, 1217, 1131, 1115, 1276, 1184, 1277, 1115,
140477 /* 280 */ 1276, 1330, 1115, 1276, 1115, 1276, 1330, 1280, 1280, 1280,
140478 /* 290 */ 1320, 1330, 1280, 1285, 1280, 1320, 1280, 1280, 1330, 1306,
140479 /* 300 */ 1306, 1330, 1284, 1294, 1284, 1294, 1284, 1294, 1284, 1294,
140480 /* 310 */ 1115, 1392, 1115, 1281, 1288, 1296, 1292, 1297, 1131, 1398,
140481 /* 320 */ 1401, 1417, 1417, 1429, 1429, 1429, 1566, 1566, 1566, 1566,
140482 /* 330 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
140483 /* 340 */ 1566, 1566, 34, 357, 38, 462, 514, 484, 1074, 727,
140484 /* 350 */ 740, 734, 735, 777, 778, 784, 788, 803, 694, 845,
140485 /* 360 */ 742, 796, 833, 837, 889, 860, 886, 1036, 806, 958,
140486 /* 370 */ 1446, 1448, 1430, 1311, 1441, 1378, 1444, 1438, 1439, 1343,
140487 /* 380 */ 1334, 1356, 1345, 1452, 1348, 1458, 1474, 1353, 1346, 1425,
140488 /* 390 */ 1426, 1427, 1428, 1371, 1387, 1450, 1363, 1486, 1484, 1468,
140489 /* 400 */ 1384, 1352, 1431, 1467, 1432, 1420, 1454, 1374, 1390, 1476,
140490 /* 410 */ 1481, 1483, 1391, 1399, 1485, 1440, 1487, 1488, 1482, 1489,
140491 /* 420 */ 1442, 1490, 1491, 1449, 1475, 1493, 1494, 1496, 1495, 1497,
140492 /* 430 */ 1492, 1498, 1500, 1502, 1501, 1404, 1504, 1505, 1433, 1499,
140493 /* 440 */ 1508, 1407, 1506, 1503, 1509, 1507, 1511, 1513, 1515, 1506,
140494 /* 450 */ 1516, 1517, 1518, 1519, 1521, 1534, 1524, 1525, 1526, 1527,
140495 /* 460 */ 1529, 1530, 1532, 1522, 1436, 1434, 1435, 1437, 1443, 1535,
140496 /* 470 */ 1540, 1559,
140497 };
140498 #define YY_REDUCE_COUNT (341)
140499 #define YY_REDUCE_MIN (-211)
140500 #define YY_REDUCE_MAX (1301)
 
140501 static const short yy_reduce_ofst[] = {
140502 /* 0 */ -143, 789, 753, 1059, -137, -146, -144, -141, -136, 687,
140503 /* 10 */ -107, 101, -203, -52, 830, 870, 890, 167, 953, 218,
140504 /* 20 */ 220, 413, 646, 897, 73, 281, 283, 332, 496, 601,
140505 /* 30 */ 650, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140506 /* 40 */ -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140507 /* 50 */ -211, -211, -211, -211, -211, -211, -211, -211, -211, -211,
140508 /* 60 */ -211, -211, -211, 374, 377, 537, 969, 983, 1006, 1008,
140509 /* 70 */ 1015, 1055, 1067, 1069, 1071, 1084, 1096, 1100, 1104, 1111,
140510 /* 80 */ 1113, 1116, 1119, 1123, 1127, 1130, 1136, 1143, 1146, 1150,
140511 /* 90 */ 1153, 1155, 1159, 1161, 1163, 1166, 1170, 1189, 1193, 1195,
140512 /* 100 */ 1197, 1199, 1201, 1203, 1205, 1207, 1212, 1230, 1232, -211,
140513 /* 110 */ -211, -211, -211, -211, -211, -211, -211, -211, -30, 427,
140514 /* 120 */ -171, -145, -134, 22, 279, 287, 279, 287, 99, -211,
140515 /* 130 */ -211, -211, -211, -211, -165, -165, -165, 123, 135, 175,
140516 /* 140 */ -150, 396, 337, 291, 291, -147, 185, 391, 446, 444,
140517 /* 150 */ 452, 500, 501, 502, 27, -152, 295, 438, 490, 503,
140518 /* 160 */ 495, 506, -73, 447, 451, 536, 570, 551, 540, 579,
140519 /* 170 */ 30, 508, 535, 81, 14, 61, 115, 168, 142, 222,
140520 /* 180 */ 275, 284, 397, 599, 607, 647, 654, 660, 709, 658,
140521 /* 190 */ 714, 750, 754, 772, 787, 801, 817, 818, 850, 863,
140522 /* 200 */ 867, 871, 466, 748, 799, 881, 888, 898, 913, 824,
140523 /* 210 */ 930, 933, 934, 873, 942, 945, 849, 946, 222, 954,
140524 /* 220 */ 971, 972, 976, 979, 980, 900, 874, 927, 950, 961,
140525 /* 230 */ 962, 963, 824, 927, 927, 939, 970, 1018, 981, 988,
140526 /* 240 */ 993, 936, 982, 937, 1009, 1000, 1031, 1011, 1014, 1040,
140527 /* 250 */ 1003, 991, 990, 1026, 1072, 985, 1076, 1079, 997, 1005,
140528 /* 260 */ 1091, 1037, 1082, 1060, 1083, 1087, 1088, 1098, 1124, 1141,
140529 /* 270 */ 1106, 1092, 1122, 1135, 1128, 1147, 1173, 1110, 1105, 1187,
140530 /* 280 */ 1192, 1176, 1202, 1198, 1206, 1200, 1182, 1213, 1214, 1215,
140531 /* 290 */ 1209, 1216, 1218, 1219, 1220, 1224, 1222, 1223, 1221, 1171,
140532 /* 300 */ 1177, 1233, 1196, 1194, 1204, 1210, 1211, 1225, 1226, 1228,
140533 /* 310 */ 1253, 1190, 1256, 1191, 1227, 1229, 1234, 1236, 1235, 1263,
140534 /* 320 */ 1268, 1278, 1279, 1289, 1291, 1295, 1185, 1237, 1238, 1282,
140535 /* 330 */ 1274, 1283, 1286, 1287, 1290, 1269, 1270, 1293, 1298, 1299,
140536 /* 340 */ 1300, 1301,
 
140537 };
140538 static const YYACTIONTYPE yy_default[] = {
140539 /* 0 */ 1297, 1349, 1221, 1014, 1119, 1221, 1221, 1221, 1221, 1014,
140540 /* 10 */ 1145, 1145, 1272, 1045, 1014, 1014, 1014, 1014, 1014, 1220,
140541 /* 20 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140542 /* 30 */ 1014, 1151, 1014, 1014, 1014, 1014, 1222, 1223, 1014, 1014,
140543 /* 40 */ 1014, 1271, 1273, 1161, 1160, 1159, 1158, 1254, 1132, 1156,
140544 /* 50 */ 1149, 1153, 1216, 1217, 1215, 1219, 1222, 1223, 1014, 1152,
140545 /* 60 */ 1186, 1200, 1185, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140546 /* 70 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140547 /* 80 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140548 /* 90 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140549 /* 100 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1194,
140550 /* 110 */ 1199, 1206, 1198, 1195, 1188, 1187, 1189, 1190, 1014, 1035,
140551 /* 120 */ 1084, 1014, 1014, 1014, 1289, 1288, 1014, 1014, 1045, 1191,
140552 /* 130 */ 1192, 1203, 1202, 1201, 1279, 1305, 1304, 1014, 1014, 1014,
140553 /* 140 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140554 /* 150 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140555 /* 160 */ 1014, 1014, 1014, 1014, 1014, 1014, 1045, 1297, 1041, 1041,
140556 /* 170 */ 1014, 1284, 1119, 1110, 1014, 1014, 1014, 1014, 1014, 1014,
140557 /* 180 */ 1014, 1014, 1014, 1014, 1014, 1276, 1274, 1014, 1236, 1014,
140558 /* 190 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140559 /* 200 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140560 /* 210 */ 1014, 1014, 1014, 1115, 1014, 1014, 1014, 1014, 1014, 1014,
140561 /* 220 */ 1014, 1014, 1014, 1014, 1299, 1014, 1249, 1098, 1115, 1115,
140562 /* 230 */ 1115, 1115, 1117, 1099, 1097, 1109, 1045, 1021, 1155, 1134,
140563 /* 240 */ 1134, 1338, 1155, 1338, 1059, 1319, 1056, 1145, 1145, 1145,
140564 /* 250 */ 1134, 1218, 1116, 1109, 1014, 1341, 1124, 1124, 1340, 1340,
140565 /* 260 */ 1124, 1166, 1087, 1155, 1093, 1093, 1093, 1093, 1124, 1032,
140566 /* 270 */ 1155, 1166, 1087, 1087, 1155, 1124, 1032, 1253, 1335, 1124,
140567 /* 280 */ 1032, 1229, 1124, 1032, 1124, 1032, 1229, 1085, 1085, 1085,
140568 /* 290 */ 1074, 1229, 1085, 1059, 1085, 1074, 1085, 1085, 1229, 1233,
140569 /* 300 */ 1233, 1229, 1138, 1133, 1138, 1133, 1138, 1133, 1138, 1133,
140570 /* 310 */ 1124, 1224, 1124, 1014, 1150, 1139, 1148, 1146, 1155, 1038,
140571 /* 320 */ 1077, 1302, 1302, 1298, 1298, 1298, 1346, 1346, 1284, 1314,
140572 /* 330 */ 1045, 1045, 1045, 1045, 1314, 1061, 1061, 1045, 1045, 1045,
140573 /* 340 */ 1045, 1314, 1014, 1014, 1014, 1014, 1014, 1014, 1309, 1014,
140574 /* 350 */ 1238, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140575 /* 360 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1171,
140576 /* 370 */ 1014, 1017, 1281, 1014, 1014, 1280, 1014, 1014, 1014, 1014,
140577 /* 380 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140578 /* 390 */ 1014, 1014, 1014, 1014, 1014, 1014, 1337, 1014, 1014, 1014,
140579 /* 400 */ 1014, 1014, 1014, 1252, 1251, 1014, 1014, 1126, 1014, 1014,
140580 /* 410 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140581 /* 420 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140582 /* 430 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140583 /* 440 */ 1014, 1014, 1147, 1014, 1140, 1014, 1014, 1014, 1014, 1328,
140584 /* 450 */ 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
140585 /* 460 */ 1014, 1014, 1014, 1323, 1101, 1173, 1014, 1172, 1176, 1014,
140586 /* 470 */ 1026, 1014,
 
140587 };
140588 /********** End of lemon-generated parsing tables *****************************/
140589
140590 /* The next table maps tokens (terminal symbols) into fallback tokens.
140591 ** If a construct like the following:
@@ -140662,10 +141555,11 @@
140662 0, /* LT => nothing */
140663 0, /* GE => nothing */
140664 0, /* ESCAPE => nothing */
140665 0, /* ID => nothing */
140666 59, /* COLUMNKW => ID */
 
140667 59, /* FOR => ID */
140668 59, /* IGNORE => ID */
140669 59, /* INITIALLY => ID */
140670 59, /* INSTEAD => ID */
140671 59, /* NO => ID */
@@ -140723,10 +141617,11 @@
140723 #endif
140724 #ifndef YYNOERRORRECOVERY
140725 int yyerrcnt; /* Shifts left before out of the error */
140726 #endif
140727 sqlite3ParserARG_SDECL /* A place to hold %extra_argument */
 
140728 #if YYSTACKDEPTH<=0
140729 int yystksz; /* Current side of the stack */
140730 yyStackEntry *yystack; /* The parser's stack */
140731 yyStackEntry yystk0; /* First stack entry */
140732 #else
@@ -140831,201 +141726,204 @@
140831 /* 56 */ "LT",
140832 /* 57 */ "GE",
140833 /* 58 */ "ESCAPE",
140834 /* 59 */ "ID",
140835 /* 60 */ "COLUMNKW",
140836 /* 61 */ "FOR",
140837 /* 62 */ "IGNORE",
140838 /* 63 */ "INITIALLY",
140839 /* 64 */ "INSTEAD",
140840 /* 65 */ "NO",
140841 /* 66 */ "KEY",
140842 /* 67 */ "OF",
140843 /* 68 */ "OFFSET",
140844 /* 69 */ "PRAGMA",
140845 /* 70 */ "RAISE",
140846 /* 71 */ "RECURSIVE",
140847 /* 72 */ "REPLACE",
140848 /* 73 */ "RESTRICT",
140849 /* 74 */ "ROW",
140850 /* 75 */ "TRIGGER",
140851 /* 76 */ "VACUUM",
140852 /* 77 */ "VIEW",
140853 /* 78 */ "VIRTUAL",
140854 /* 79 */ "WITH",
140855 /* 80 */ "REINDEX",
140856 /* 81 */ "RENAME",
140857 /* 82 */ "CTIME_KW",
140858 /* 83 */ "ANY",
140859 /* 84 */ "BITAND",
140860 /* 85 */ "BITOR",
140861 /* 86 */ "LSHIFT",
140862 /* 87 */ "RSHIFT",
140863 /* 88 */ "PLUS",
140864 /* 89 */ "MINUS",
140865 /* 90 */ "STAR",
140866 /* 91 */ "SLASH",
140867 /* 92 */ "REM",
140868 /* 93 */ "CONCAT",
140869 /* 94 */ "COLLATE",
140870 /* 95 */ "BITNOT",
140871 /* 96 */ "INDEXED",
140872 /* 97 */ "STRING",
140873 /* 98 */ "JOIN_KW",
140874 /* 99 */ "CONSTRAINT",
140875 /* 100 */ "DEFAULT",
140876 /* 101 */ "NULL",
140877 /* 102 */ "PRIMARY",
140878 /* 103 */ "UNIQUE",
140879 /* 104 */ "CHECK",
140880 /* 105 */ "REFERENCES",
140881 /* 106 */ "AUTOINCR",
140882 /* 107 */ "ON",
140883 /* 108 */ "INSERT",
140884 /* 109 */ "DELETE",
140885 /* 110 */ "UPDATE",
140886 /* 111 */ "SET",
140887 /* 112 */ "DEFERRABLE",
140888 /* 113 */ "FOREIGN",
140889 /* 114 */ "DROP",
140890 /* 115 */ "UNION",
140891 /* 116 */ "ALL",
140892 /* 117 */ "EXCEPT",
140893 /* 118 */ "INTERSECT",
140894 /* 119 */ "SELECT",
140895 /* 120 */ "VALUES",
140896 /* 121 */ "DISTINCT",
140897 /* 122 */ "DOT",
140898 /* 123 */ "FROM",
140899 /* 124 */ "JOIN",
140900 /* 125 */ "USING",
140901 /* 126 */ "ORDER",
140902 /* 127 */ "GROUP",
140903 /* 128 */ "HAVING",
140904 /* 129 */ "LIMIT",
140905 /* 130 */ "WHERE",
140906 /* 131 */ "INTO",
140907 /* 132 */ "FLOAT",
140908 /* 133 */ "BLOB",
140909 /* 134 */ "INTEGER",
140910 /* 135 */ "VARIABLE",
140911 /* 136 */ "CASE",
140912 /* 137 */ "WHEN",
140913 /* 138 */ "THEN",
140914 /* 139 */ "ELSE",
140915 /* 140 */ "INDEX",
140916 /* 141 */ "ALTER",
140917 /* 142 */ "ADD",
140918 /* 143 */ "error",
140919 /* 144 */ "input",
140920 /* 145 */ "cmdlist",
140921 /* 146 */ "ecmd",
140922 /* 147 */ "explain",
140923 /* 148 */ "cmdx",
140924 /* 149 */ "cmd",
140925 /* 150 */ "transtype",
140926 /* 151 */ "trans_opt",
140927 /* 152 */ "nm",
140928 /* 153 */ "savepoint_opt",
140929 /* 154 */ "create_table",
140930 /* 155 */ "create_table_args",
140931 /* 156 */ "createkw",
140932 /* 157 */ "temp",
140933 /* 158 */ "ifnotexists",
140934 /* 159 */ "dbnm",
140935 /* 160 */ "columnlist",
140936 /* 161 */ "conslist_opt",
140937 /* 162 */ "table_options",
140938 /* 163 */ "select",
140939 /* 164 */ "columnname",
140940 /* 165 */ "carglist",
140941 /* 166 */ "typetoken",
140942 /* 167 */ "typename",
140943 /* 168 */ "signed",
140944 /* 169 */ "plus_num",
140945 /* 170 */ "minus_num",
140946 /* 171 */ "scanpt",
140947 /* 172 */ "ccons",
140948 /* 173 */ "term",
140949 /* 174 */ "expr",
140950 /* 175 */ "onconf",
140951 /* 176 */ "sortorder",
140952 /* 177 */ "autoinc",
140953 /* 178 */ "eidlist_opt",
140954 /* 179 */ "refargs",
140955 /* 180 */ "defer_subclause",
140956 /* 181 */ "refarg",
140957 /* 182 */ "refact",
140958 /* 183 */ "init_deferred_pred_opt",
140959 /* 184 */ "conslist",
140960 /* 185 */ "tconscomma",
140961 /* 186 */ "tcons",
140962 /* 187 */ "sortlist",
140963 /* 188 */ "eidlist",
140964 /* 189 */ "defer_subclause_opt",
140965 /* 190 */ "orconf",
140966 /* 191 */ "resolvetype",
140967 /* 192 */ "raisetype",
140968 /* 193 */ "ifexists",
140969 /* 194 */ "fullname",
140970 /* 195 */ "selectnowith",
140971 /* 196 */ "oneselect",
140972 /* 197 */ "wqlist",
140973 /* 198 */ "multiselect_op",
140974 /* 199 */ "distinct",
140975 /* 200 */ "selcollist",
140976 /* 201 */ "from",
140977 /* 202 */ "where_opt",
140978 /* 203 */ "groupby_opt",
140979 /* 204 */ "having_opt",
140980 /* 205 */ "orderby_opt",
140981 /* 206 */ "limit_opt",
140982 /* 207 */ "values",
140983 /* 208 */ "nexprlist",
140984 /* 209 */ "exprlist",
140985 /* 210 */ "sclp",
140986 /* 211 */ "as",
140987 /* 212 */ "seltablist",
140988 /* 213 */ "stl_prefix",
140989 /* 214 */ "joinop",
140990 /* 215 */ "indexed_opt",
140991 /* 216 */ "on_opt",
140992 /* 217 */ "using_opt",
140993 /* 218 */ "idlist",
140994 /* 219 */ "with",
140995 /* 220 */ "setlist",
140996 /* 221 */ "insert_cmd",
140997 /* 222 */ "idlist_opt",
140998 /* 223 */ "likeop",
140999 /* 224 */ "between_op",
141000 /* 225 */ "in_op",
141001 /* 226 */ "paren_exprlist",
141002 /* 227 */ "case_operand",
141003 /* 228 */ "case_exprlist",
141004 /* 229 */ "case_else",
141005 /* 230 */ "uniqueflag",
141006 /* 231 */ "collate",
141007 /* 232 */ "nmnum",
141008 /* 233 */ "trigger_decl",
141009 /* 234 */ "trigger_cmd_list",
141010 /* 235 */ "trigger_time",
141011 /* 236 */ "trigger_event",
141012 /* 237 */ "foreach_clause",
141013 /* 238 */ "when_clause",
141014 /* 239 */ "trigger_cmd",
141015 /* 240 */ "trnm",
141016 /* 241 */ "tridxby",
141017 /* 242 */ "database_kw_opt",
141018 /* 243 */ "key_opt",
141019 /* 244 */ "add_column_fullname",
141020 /* 245 */ "kwcolumn_opt",
141021 /* 246 */ "create_vtab",
141022 /* 247 */ "vtabarglist",
141023 /* 248 */ "vtabarg",
141024 /* 249 */ "vtabargtoken",
141025 /* 250 */ "lp",
141026 /* 251 */ "anylist",
 
 
 
141027 };
141028 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
141029
141030 #ifndef NDEBUG
141031 /* For tracing reduce actions, the names of all rules are required.
@@ -141140,232 +142038,240 @@
141140 /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
141141 /* 107 */ "dbnm ::=",
141142 /* 108 */ "dbnm ::= DOT nm",
141143 /* 109 */ "fullname ::= nm",
141144 /* 110 */ "fullname ::= nm DOT nm",
141145 /* 111 */ "joinop ::= COMMA|JOIN",
141146 /* 112 */ "joinop ::= JOIN_KW JOIN",
141147 /* 113 */ "joinop ::= JOIN_KW nm JOIN",
141148 /* 114 */ "joinop ::= JOIN_KW nm nm JOIN",
141149 /* 115 */ "on_opt ::= ON expr",
141150 /* 116 */ "on_opt ::=",
141151 /* 117 */ "indexed_opt ::=",
141152 /* 118 */ "indexed_opt ::= INDEXED BY nm",
141153 /* 119 */ "indexed_opt ::= NOT INDEXED",
141154 /* 120 */ "using_opt ::= USING LP idlist RP",
141155 /* 121 */ "using_opt ::=",
141156 /* 122 */ "orderby_opt ::=",
141157 /* 123 */ "orderby_opt ::= ORDER BY sortlist",
141158 /* 124 */ "sortlist ::= sortlist COMMA expr sortorder",
141159 /* 125 */ "sortlist ::= expr sortorder",
141160 /* 126 */ "sortorder ::= ASC",
141161 /* 127 */ "sortorder ::= DESC",
141162 /* 128 */ "sortorder ::=",
141163 /* 129 */ "groupby_opt ::=",
141164 /* 130 */ "groupby_opt ::= GROUP BY nexprlist",
141165 /* 131 */ "having_opt ::=",
141166 /* 132 */ "having_opt ::= HAVING expr",
141167 /* 133 */ "limit_opt ::=",
141168 /* 134 */ "limit_opt ::= LIMIT expr",
141169 /* 135 */ "limit_opt ::= LIMIT expr OFFSET expr",
141170 /* 136 */ "limit_opt ::= LIMIT expr COMMA expr",
141171 /* 137 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
141172 /* 138 */ "where_opt ::=",
141173 /* 139 */ "where_opt ::= WHERE expr",
141174 /* 140 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
141175 /* 141 */ "setlist ::= setlist COMMA nm EQ expr",
141176 /* 142 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
141177 /* 143 */ "setlist ::= nm EQ expr",
141178 /* 144 */ "setlist ::= LP idlist RP EQ expr",
141179 /* 145 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
141180 /* 146 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
141181 /* 147 */ "insert_cmd ::= INSERT orconf",
141182 /* 148 */ "insert_cmd ::= REPLACE",
141183 /* 149 */ "idlist_opt ::=",
141184 /* 150 */ "idlist_opt ::= LP idlist RP",
141185 /* 151 */ "idlist ::= idlist COMMA nm",
141186 /* 152 */ "idlist ::= nm",
141187 /* 153 */ "expr ::= LP expr RP",
141188 /* 154 */ "expr ::= ID|INDEXED",
141189 /* 155 */ "expr ::= JOIN_KW",
141190 /* 156 */ "expr ::= nm DOT nm",
141191 /* 157 */ "expr ::= nm DOT nm DOT nm",
141192 /* 158 */ "term ::= NULL|FLOAT|BLOB",
141193 /* 159 */ "term ::= STRING",
141194 /* 160 */ "term ::= INTEGER",
141195 /* 161 */ "expr ::= VARIABLE",
141196 /* 162 */ "expr ::= expr COLLATE ID|STRING",
141197 /* 163 */ "expr ::= CAST LP expr AS typetoken RP",
141198 /* 164 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
141199 /* 165 */ "expr ::= ID|INDEXED LP STAR RP",
141200 /* 166 */ "term ::= CTIME_KW",
141201 /* 167 */ "expr ::= LP nexprlist COMMA expr RP",
141202 /* 168 */ "expr ::= expr AND expr",
141203 /* 169 */ "expr ::= expr OR expr",
141204 /* 170 */ "expr ::= expr LT|GT|GE|LE expr",
141205 /* 171 */ "expr ::= expr EQ|NE expr",
141206 /* 172 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
141207 /* 173 */ "expr ::= expr PLUS|MINUS expr",
141208 /* 174 */ "expr ::= expr STAR|SLASH|REM expr",
141209 /* 175 */ "expr ::= expr CONCAT expr",
141210 /* 176 */ "likeop ::= NOT LIKE_KW|MATCH",
141211 /* 177 */ "expr ::= expr likeop expr",
141212 /* 178 */ "expr ::= expr likeop expr ESCAPE expr",
141213 /* 179 */ "expr ::= expr ISNULL|NOTNULL",
141214 /* 180 */ "expr ::= expr NOT NULL",
141215 /* 181 */ "expr ::= expr IS expr",
141216 /* 182 */ "expr ::= expr IS NOT expr",
141217 /* 183 */ "expr ::= NOT expr",
141218 /* 184 */ "expr ::= BITNOT expr",
141219 /* 185 */ "expr ::= MINUS expr",
141220 /* 186 */ "expr ::= PLUS expr",
141221 /* 187 */ "between_op ::= BETWEEN",
141222 /* 188 */ "between_op ::= NOT BETWEEN",
141223 /* 189 */ "expr ::= expr between_op expr AND expr",
141224 /* 190 */ "in_op ::= IN",
141225 /* 191 */ "in_op ::= NOT IN",
141226 /* 192 */ "expr ::= expr in_op LP exprlist RP",
141227 /* 193 */ "expr ::= LP select RP",
141228 /* 194 */ "expr ::= expr in_op LP select RP",
141229 /* 195 */ "expr ::= expr in_op nm dbnm paren_exprlist",
141230 /* 196 */ "expr ::= EXISTS LP select RP",
141231 /* 197 */ "expr ::= CASE case_operand case_exprlist case_else END",
141232 /* 198 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
141233 /* 199 */ "case_exprlist ::= WHEN expr THEN expr",
141234 /* 200 */ "case_else ::= ELSE expr",
141235 /* 201 */ "case_else ::=",
141236 /* 202 */ "case_operand ::= expr",
141237 /* 203 */ "case_operand ::=",
141238 /* 204 */ "exprlist ::=",
141239 /* 205 */ "nexprlist ::= nexprlist COMMA expr",
141240 /* 206 */ "nexprlist ::= expr",
141241 /* 207 */ "paren_exprlist ::=",
141242 /* 208 */ "paren_exprlist ::= LP exprlist RP",
141243 /* 209 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
141244 /* 210 */ "uniqueflag ::= UNIQUE",
141245 /* 211 */ "uniqueflag ::=",
141246 /* 212 */ "eidlist_opt ::=",
141247 /* 213 */ "eidlist_opt ::= LP eidlist RP",
141248 /* 214 */ "eidlist ::= eidlist COMMA nm collate sortorder",
141249 /* 215 */ "eidlist ::= nm collate sortorder",
141250 /* 216 */ "collate ::=",
141251 /* 217 */ "collate ::= COLLATE ID|STRING",
141252 /* 218 */ "cmd ::= DROP INDEX ifexists fullname",
141253 /* 219 */ "cmd ::= VACUUM",
141254 /* 220 */ "cmd ::= VACUUM nm",
141255 /* 221 */ "cmd ::= PRAGMA nm dbnm",
141256 /* 222 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
141257 /* 223 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
141258 /* 224 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
141259 /* 225 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
141260 /* 226 */ "plus_num ::= PLUS INTEGER|FLOAT",
141261 /* 227 */ "minus_num ::= MINUS INTEGER|FLOAT",
141262 /* 228 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
141263 /* 229 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
141264 /* 230 */ "trigger_time ::= BEFORE|AFTER",
141265 /* 231 */ "trigger_time ::= INSTEAD OF",
141266 /* 232 */ "trigger_time ::=",
141267 /* 233 */ "trigger_event ::= DELETE|INSERT",
141268 /* 234 */ "trigger_event ::= UPDATE",
141269 /* 235 */ "trigger_event ::= UPDATE OF idlist",
141270 /* 236 */ "when_clause ::=",
141271 /* 237 */ "when_clause ::= WHEN expr",
141272 /* 238 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
141273 /* 239 */ "trigger_cmd_list ::= trigger_cmd SEMI",
141274 /* 240 */ "trnm ::= nm DOT nm",
141275 /* 241 */ "tridxby ::= INDEXED BY nm",
141276 /* 242 */ "tridxby ::= NOT INDEXED",
141277 /* 243 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
141278 /* 244 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt",
141279 /* 245 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
141280 /* 246 */ "trigger_cmd ::= scanpt select scanpt",
141281 /* 247 */ "expr ::= RAISE LP IGNORE RP",
141282 /* 248 */ "expr ::= RAISE LP raisetype COMMA nm RP",
141283 /* 249 */ "raisetype ::= ROLLBACK",
141284 /* 250 */ "raisetype ::= ABORT",
141285 /* 251 */ "raisetype ::= FAIL",
141286 /* 252 */ "cmd ::= DROP TRIGGER ifexists fullname",
141287 /* 253 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
141288 /* 254 */ "cmd ::= DETACH database_kw_opt expr",
141289 /* 255 */ "key_opt ::=",
141290 /* 256 */ "key_opt ::= KEY expr",
141291 /* 257 */ "cmd ::= REINDEX",
141292 /* 258 */ "cmd ::= REINDEX nm dbnm",
141293 /* 259 */ "cmd ::= ANALYZE",
141294 /* 260 */ "cmd ::= ANALYZE nm dbnm",
141295 /* 261 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
141296 /* 262 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
141297 /* 263 */ "add_column_fullname ::= fullname",
141298 /* 264 */ "cmd ::= create_vtab",
141299 /* 265 */ "cmd ::= create_vtab LP vtabarglist RP",
141300 /* 266 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
141301 /* 267 */ "vtabarg ::=",
141302 /* 268 */ "vtabargtoken ::= ANY",
141303 /* 269 */ "vtabargtoken ::= lp anylist RP",
141304 /* 270 */ "lp ::= LP",
141305 /* 271 */ "with ::= WITH wqlist",
141306 /* 272 */ "with ::= WITH RECURSIVE wqlist",
141307 /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
141308 /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
141309 /* 275 */ "input ::= cmdlist",
141310 /* 276 */ "cmdlist ::= cmdlist ecmd",
141311 /* 277 */ "cmdlist ::= ecmd",
141312 /* 278 */ "ecmd ::= SEMI",
141313 /* 279 */ "ecmd ::= explain cmdx SEMI",
141314 /* 280 */ "explain ::=",
141315 /* 281 */ "trans_opt ::=",
141316 /* 282 */ "trans_opt ::= TRANSACTION",
141317 /* 283 */ "trans_opt ::= TRANSACTION nm",
141318 /* 284 */ "savepoint_opt ::= SAVEPOINT",
141319 /* 285 */ "savepoint_opt ::=",
141320 /* 286 */ "cmd ::= create_table create_table_args",
141321 /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
141322 /* 288 */ "columnlist ::= columnname carglist",
141323 /* 289 */ "nm ::= ID|INDEXED",
141324 /* 290 */ "nm ::= STRING",
141325 /* 291 */ "nm ::= JOIN_KW",
141326 /* 292 */ "typetoken ::= typename",
141327 /* 293 */ "typename ::= ID|STRING",
141328 /* 294 */ "signed ::= plus_num",
141329 /* 295 */ "signed ::= minus_num",
141330 /* 296 */ "carglist ::= carglist ccons",
141331 /* 297 */ "carglist ::=",
141332 /* 298 */ "ccons ::= NULL onconf",
141333 /* 299 */ "conslist_opt ::= COMMA conslist",
141334 /* 300 */ "conslist ::= conslist tconscomma tcons",
141335 /* 301 */ "conslist ::= tcons",
141336 /* 302 */ "tconscomma ::=",
141337 /* 303 */ "defer_subclause_opt ::= defer_subclause",
141338 /* 304 */ "resolvetype ::= raisetype",
141339 /* 305 */ "selectnowith ::= oneselect",
141340 /* 306 */ "oneselect ::= values",
141341 /* 307 */ "sclp ::= selcollist COMMA",
141342 /* 308 */ "as ::= ID|STRING",
141343 /* 309 */ "expr ::= term",
141344 /* 310 */ "likeop ::= LIKE_KW|MATCH",
141345 /* 311 */ "exprlist ::= nexprlist",
141346 /* 312 */ "nmnum ::= plus_num",
141347 /* 313 */ "nmnum ::= nm",
141348 /* 314 */ "nmnum ::= ON",
141349 /* 315 */ "nmnum ::= DELETE",
141350 /* 316 */ "nmnum ::= DEFAULT",
141351 /* 317 */ "plus_num ::= INTEGER|FLOAT",
141352 /* 318 */ "foreach_clause ::=",
141353 /* 319 */ "foreach_clause ::= FOR EACH ROW",
141354 /* 320 */ "trnm ::= nm",
141355 /* 321 */ "tridxby ::=",
141356 /* 322 */ "database_kw_opt ::= DATABASE",
141357 /* 323 */ "database_kw_opt ::=",
141358 /* 324 */ "kwcolumn_opt ::=",
141359 /* 325 */ "kwcolumn_opt ::= COLUMNKW",
141360 /* 326 */ "vtabarglist ::= vtabarg",
141361 /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
141362 /* 328 */ "vtabarg ::= vtabarg vtabargtoken",
141363 /* 329 */ "anylist ::=",
141364 /* 330 */ "anylist ::= anylist LP anylist RP",
141365 /* 331 */ "anylist ::= anylist ANY",
141366 /* 332 */ "with ::=",
 
 
 
 
 
 
 
 
141367 };
141368 #endif /* NDEBUG */
141369
141370
141371 #if YYSTACKDEPTH<=0
@@ -141410,32 +142316,33 @@
141410 # define YYMALLOCARGTYPE size_t
141411 #endif
141412
141413 /* Initialize a new parser that has already been allocated.
141414 */
141415 SQLITE_PRIVATE void sqlite3ParserInit(void *yypParser){
141416 yyParser *pParser = (yyParser*)yypParser;
 
141417 #ifdef YYTRACKMAXSTACKDEPTH
141418 pParser->yyhwm = 0;
141419 #endif
141420 #if YYSTACKDEPTH<=0
141421 pParser->yytos = NULL;
141422 pParser->yystack = NULL;
141423 pParser->yystksz = 0;
141424 if( yyGrowStack(pParser) ){
141425 pParser->yystack = &pParser->yystk0;
141426 pParser->yystksz = 1;
141427 }
141428 #endif
141429 #ifndef YYNOERRORRECOVERY
141430 pParser->yyerrcnt = -1;
141431 #endif
141432 pParser->yytos = pParser->yystack;
141433 pParser->yystack[0].stateno = 0;
141434 pParser->yystack[0].major = 0;
141435 #if YYSTACKDEPTH>0
141436 pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
141437 #endif
141438 }
141439
141440 #ifndef sqlite3Parser_ENGINEALWAYSONSTACK
141441 /*
@@ -141448,15 +142355,18 @@
141448 **
141449 ** Outputs:
141450 ** A pointer to a parser. This pointer is used in subsequent calls
141451 ** to sqlite3Parser and sqlite3ParserFree.
141452 */
141453 SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
141454 yyParser *pParser;
141455 pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
141456 if( pParser ) sqlite3ParserInit(pParser);
141457 return pParser;
 
 
 
141458 }
141459 #endif /* sqlite3Parser_ENGINEALWAYSONSTACK */
141460
141461
141462 /* The following function deletes the "minor type" or semantic value
@@ -141469,11 +142379,12 @@
141469 static void yy_destructor(
141470 yyParser *yypParser, /* The parser */
141471 YYCODETYPE yymajor, /* Type code for object to destroy */
141472 YYMINORTYPE *yypminor /* The object to be destroyed */
141473 ){
141474 sqlite3ParserARG_FETCH;
 
141475 switch( yymajor ){
141476 /* Here is inserted the actions which take place when a
141477 ** terminal or non-terminal is destroyed. This can happen
141478 ** when the symbol is popped from the stack during a
141479 ** reduce or during error processing or when a parser is
@@ -141482,76 +142393,77 @@
141482 ** Note: during a reduce, the only symbols destroyed are those
141483 ** which appear on the RHS of the rule, but which are *not* used
141484 ** inside the C code.
141485 */
141486 /********* Begin destructor definitions ***************************************/
141487 case 163: /* select */
141488 case 195: /* selectnowith */
141489 case 196: /* oneselect */
141490 case 207: /* values */
141491 {
141492 sqlite3SelectDelete(pParse->db, (yypminor->yy387));
141493 }
141494 break;
141495 case 173: /* term */
141496 case 174: /* expr */
141497 case 202: /* where_opt */
141498 case 204: /* having_opt */
141499 case 216: /* on_opt */
141500 case 227: /* case_operand */
141501 case 229: /* case_else */
141502 case 238: /* when_clause */
141503 case 243: /* key_opt */
141504 {
141505 sqlite3ExprDelete(pParse->db, (yypminor->yy314));
141506 }
141507 break;
141508 case 178: /* eidlist_opt */
141509 case 187: /* sortlist */
141510 case 188: /* eidlist */
141511 case 200: /* selcollist */
141512 case 203: /* groupby_opt */
141513 case 205: /* orderby_opt */
141514 case 208: /* nexprlist */
141515 case 209: /* exprlist */
141516 case 210: /* sclp */
141517 case 220: /* setlist */
141518 case 226: /* paren_exprlist */
141519 case 228: /* case_exprlist */
141520 {
141521 sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
141522 }
141523 break;
141524 case 194: /* fullname */
141525 case 201: /* from */
141526 case 212: /* seltablist */
141527 case 213: /* stl_prefix */
141528 {
141529 sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
141530 }
141531 break;
141532 case 197: /* wqlist */
141533 {
141534 sqlite3WithDelete(pParse->db, (yypminor->yy451));
141535 }
141536 break;
141537 case 217: /* using_opt */
141538 case 218: /* idlist */
141539 case 222: /* idlist_opt */
141540 {
141541 sqlite3IdListDelete(pParse->db, (yypminor->yy384));
141542 }
141543 break;
141544 case 234: /* trigger_cmd_list */
141545 case 239: /* trigger_cmd */
141546 {
141547 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
141548 }
141549 break;
141550 case 236: /* trigger_event */
141551 {
141552 sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
 
141553 }
141554 break;
141555 /********* End destructor definitions *****************************************/
141556 default: break; /* If no destructor action specified: do nothing */
141557 }
@@ -141659,17 +142571,16 @@
141659
141660 /*
141661 ** Find the appropriate action for a parser given the terminal
141662 ** look-ahead token iLookAhead.
141663 */
141664 static unsigned int yy_find_shift_action(
141665 yyParser *pParser, /* The parser */
141666 YYCODETYPE iLookAhead /* The look-ahead token */
141667 ){
141668 int i;
141669 int stateno = pParser->yytos->stateno;
141670
141671 if( stateno>YY_MAX_SHIFT ) return stateno;
141672 assert( stateno <= YY_SHIFT_COUNT );
141673 #if defined(YYCOVERAGE)
141674 yycoverage[stateno][iLookAhead] = 1;
141675 #endif
@@ -141729,11 +142640,11 @@
141729 /*
141730 ** Find the appropriate action for a parser given the non-terminal
141731 ** look-ahead token iLookAhead.
141732 */
141733 static int yy_find_reduce_action(
141734 int stateno, /* Current state number */
141735 YYCODETYPE iLookAhead /* The look-ahead token */
141736 ){
141737 int i;
141738 #ifdef YYERRORSYMBOL
141739 if( stateno>YY_REDUCE_COUNT ){
@@ -141758,11 +142669,12 @@
141758
141759 /*
141760 ** The following routine is called if the stack overflows.
141761 */
141762 static void yyStackOverflow(yyParser *yypParser){
141763 sqlite3ParserARG_FETCH;
 
141764 #ifndef NDEBUG
141765 if( yyTraceFILE ){
141766 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
141767 }
141768 #endif
@@ -141771,11 +142683,12 @@
141771 ** stack every overflows */
141772 /******** Begin %stack_overflow code ******************************************/
141773
141774 sqlite3ErrorMsg(pParse, "parser stack overflow");
141775 /******** End %stack_overflow code ********************************************/
141776 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
 
141777 }
141778
141779 /*
141780 ** Print tracing information for a SHIFT action
141781 */
@@ -141800,12 +142713,12 @@
141800 /*
141801 ** Perform a shift action.
141802 */
141803 static void yy_shift(
141804 yyParser *yypParser, /* The parser to be shifted */
141805 int yyNewState, /* The new state to shift in */
141806 int yyMajor, /* The major token to shift in */
141807 sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */
141808 ){
141809 yyStackEntry *yytos;
141810 yypParser->yytos++;
141811 #ifdef YYTRACKMAXSTACKDEPTH
@@ -141831,12 +142744,12 @@
141831 #endif
141832 if( yyNewState > YY_MAX_SHIFT ){
141833 yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
141834 }
141835 yytos = yypParser->yytos;
141836 yytos->stateno = (YYACTIONTYPE)yyNewState;
141837 yytos->major = (YYCODETYPE)yyMajor;
141838 yytos->minor.yy0 = yyMinor;
141839 yyTraceShift(yypParser, yyNewState, "Shift");
141840 }
141841
141842 /* The following table contains information about every rule that
@@ -141844,343 +142757,351 @@
141844 */
141845 static const struct {
141846 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
141847 signed char nrhs; /* Negative of the number of RHS symbols in the rule */
141848 } yyRuleInfo[] = {
141849 { 147, -1 }, /* (0) explain ::= EXPLAIN */
141850 { 147, -3 }, /* (1) explain ::= EXPLAIN QUERY PLAN */
141851 { 148, -1 }, /* (2) cmdx ::= cmd */
141852 { 149, -3 }, /* (3) cmd ::= BEGIN transtype trans_opt */
141853 { 150, 0 }, /* (4) transtype ::= */
141854 { 150, -1 }, /* (5) transtype ::= DEFERRED */
141855 { 150, -1 }, /* (6) transtype ::= IMMEDIATE */
141856 { 150, -1 }, /* (7) transtype ::= EXCLUSIVE */
141857 { 149, -2 }, /* (8) cmd ::= COMMIT|END trans_opt */
141858 { 149, -2 }, /* (9) cmd ::= ROLLBACK trans_opt */
141859 { 149, -2 }, /* (10) cmd ::= SAVEPOINT nm */
141860 { 149, -3 }, /* (11) cmd ::= RELEASE savepoint_opt nm */
141861 { 149, -5 }, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
141862 { 154, -6 }, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
141863 { 156, -1 }, /* (14) createkw ::= CREATE */
141864 { 158, 0 }, /* (15) ifnotexists ::= */
141865 { 158, -3 }, /* (16) ifnotexists ::= IF NOT EXISTS */
141866 { 157, -1 }, /* (17) temp ::= TEMP */
141867 { 157, 0 }, /* (18) temp ::= */
141868 { 155, -5 }, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
141869 { 155, -2 }, /* (20) create_table_args ::= AS select */
141870 { 162, 0 }, /* (21) table_options ::= */
141871 { 162, -2 }, /* (22) table_options ::= WITHOUT nm */
141872 { 164, -2 }, /* (23) columnname ::= nm typetoken */
141873 { 166, 0 }, /* (24) typetoken ::= */
141874 { 166, -4 }, /* (25) typetoken ::= typename LP signed RP */
141875 { 166, -6 }, /* (26) typetoken ::= typename LP signed COMMA signed RP */
141876 { 167, -2 }, /* (27) typename ::= typename ID|STRING */
141877 { 171, 0 }, /* (28) scanpt ::= */
141878 { 172, -2 }, /* (29) ccons ::= CONSTRAINT nm */
141879 { 172, -4 }, /* (30) ccons ::= DEFAULT scanpt term scanpt */
141880 { 172, -4 }, /* (31) ccons ::= DEFAULT LP expr RP */
141881 { 172, -4 }, /* (32) ccons ::= DEFAULT PLUS term scanpt */
141882 { 172, -4 }, /* (33) ccons ::= DEFAULT MINUS term scanpt */
141883 { 172, -3 }, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
141884 { 172, -3 }, /* (35) ccons ::= NOT NULL onconf */
141885 { 172, -5 }, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
141886 { 172, -2 }, /* (37) ccons ::= UNIQUE onconf */
141887 { 172, -4 }, /* (38) ccons ::= CHECK LP expr RP */
141888 { 172, -4 }, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
141889 { 172, -1 }, /* (40) ccons ::= defer_subclause */
141890 { 172, -2 }, /* (41) ccons ::= COLLATE ID|STRING */
141891 { 177, 0 }, /* (42) autoinc ::= */
141892 { 177, -1 }, /* (43) autoinc ::= AUTOINCR */
141893 { 179, 0 }, /* (44) refargs ::= */
141894 { 179, -2 }, /* (45) refargs ::= refargs refarg */
141895 { 181, -2 }, /* (46) refarg ::= MATCH nm */
141896 { 181, -3 }, /* (47) refarg ::= ON INSERT refact */
141897 { 181, -3 }, /* (48) refarg ::= ON DELETE refact */
141898 { 181, -3 }, /* (49) refarg ::= ON UPDATE refact */
141899 { 182, -2 }, /* (50) refact ::= SET NULL */
141900 { 182, -2 }, /* (51) refact ::= SET DEFAULT */
141901 { 182, -1 }, /* (52) refact ::= CASCADE */
141902 { 182, -1 }, /* (53) refact ::= RESTRICT */
141903 { 182, -2 }, /* (54) refact ::= NO ACTION */
141904 { 180, -3 }, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
141905 { 180, -2 }, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
141906 { 183, 0 }, /* (57) init_deferred_pred_opt ::= */
141907 { 183, -2 }, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
141908 { 183, -2 }, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
141909 { 161, 0 }, /* (60) conslist_opt ::= */
141910 { 185, -1 }, /* (61) tconscomma ::= COMMA */
141911 { 186, -2 }, /* (62) tcons ::= CONSTRAINT nm */
141912 { 186, -7 }, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
141913 { 186, -5 }, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
141914 { 186, -5 }, /* (65) tcons ::= CHECK LP expr RP onconf */
141915 { 186, -10 }, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
141916 { 189, 0 }, /* (67) defer_subclause_opt ::= */
141917 { 175, 0 }, /* (68) onconf ::= */
141918 { 175, -3 }, /* (69) onconf ::= ON CONFLICT resolvetype */
141919 { 190, 0 }, /* (70) orconf ::= */
141920 { 190, -2 }, /* (71) orconf ::= OR resolvetype */
141921 { 191, -1 }, /* (72) resolvetype ::= IGNORE */
141922 { 191, -1 }, /* (73) resolvetype ::= REPLACE */
141923 { 149, -4 }, /* (74) cmd ::= DROP TABLE ifexists fullname */
141924 { 193, -2 }, /* (75) ifexists ::= IF EXISTS */
141925 { 193, 0 }, /* (76) ifexists ::= */
141926 { 149, -9 }, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
141927 { 149, -4 }, /* (78) cmd ::= DROP VIEW ifexists fullname */
141928 { 149, -1 }, /* (79) cmd ::= select */
141929 { 163, -3 }, /* (80) select ::= WITH wqlist selectnowith */
141930 { 163, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
141931 { 163, -1 }, /* (82) select ::= selectnowith */
141932 { 195, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
141933 { 198, -1 }, /* (84) multiselect_op ::= UNION */
141934 { 198, -2 }, /* (85) multiselect_op ::= UNION ALL */
141935 { 198, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
141936 { 196, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
141937 { 207, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
141938 { 207, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
141939 { 199, -1 }, /* (90) distinct ::= DISTINCT */
141940 { 199, -1 }, /* (91) distinct ::= ALL */
141941 { 199, 0 }, /* (92) distinct ::= */
141942 { 210, 0 }, /* (93) sclp ::= */
141943 { 200, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
141944 { 200, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
141945 { 200, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
141946 { 211, -2 }, /* (97) as ::= AS nm */
141947 { 211, 0 }, /* (98) as ::= */
141948 { 201, 0 }, /* (99) from ::= */
141949 { 201, -2 }, /* (100) from ::= FROM seltablist */
141950 { 213, -2 }, /* (101) stl_prefix ::= seltablist joinop */
141951 { 213, 0 }, /* (102) stl_prefix ::= */
141952 { 212, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
141953 { 212, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
141954 { 212, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
141955 { 212, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
141956 { 159, 0 }, /* (107) dbnm ::= */
141957 { 159, -2 }, /* (108) dbnm ::= DOT nm */
141958 { 194, -1 }, /* (109) fullname ::= nm */
141959 { 194, -3 }, /* (110) fullname ::= nm DOT nm */
141960 { 214, -1 }, /* (111) joinop ::= COMMA|JOIN */
141961 { 214, -2 }, /* (112) joinop ::= JOIN_KW JOIN */
141962 { 214, -3 }, /* (113) joinop ::= JOIN_KW nm JOIN */
141963 { 214, -4 }, /* (114) joinop ::= JOIN_KW nm nm JOIN */
141964 { 216, -2 }, /* (115) on_opt ::= ON expr */
141965 { 216, 0 }, /* (116) on_opt ::= */
141966 { 215, 0 }, /* (117) indexed_opt ::= */
141967 { 215, -3 }, /* (118) indexed_opt ::= INDEXED BY nm */
141968 { 215, -2 }, /* (119) indexed_opt ::= NOT INDEXED */
141969 { 217, -4 }, /* (120) using_opt ::= USING LP idlist RP */
141970 { 217, 0 }, /* (121) using_opt ::= */
141971 { 205, 0 }, /* (122) orderby_opt ::= */
141972 { 205, -3 }, /* (123) orderby_opt ::= ORDER BY sortlist */
141973 { 187, -4 }, /* (124) sortlist ::= sortlist COMMA expr sortorder */
141974 { 187, -2 }, /* (125) sortlist ::= expr sortorder */
141975 { 176, -1 }, /* (126) sortorder ::= ASC */
141976 { 176, -1 }, /* (127) sortorder ::= DESC */
141977 { 176, 0 }, /* (128) sortorder ::= */
141978 { 203, 0 }, /* (129) groupby_opt ::= */
141979 { 203, -3 }, /* (130) groupby_opt ::= GROUP BY nexprlist */
141980 { 204, 0 }, /* (131) having_opt ::= */
141981 { 204, -2 }, /* (132) having_opt ::= HAVING expr */
141982 { 206, 0 }, /* (133) limit_opt ::= */
141983 { 206, -2 }, /* (134) limit_opt ::= LIMIT expr */
141984 { 206, -4 }, /* (135) limit_opt ::= LIMIT expr OFFSET expr */
141985 { 206, -4 }, /* (136) limit_opt ::= LIMIT expr COMMA expr */
141986 { 149, -6 }, /* (137) cmd ::= with DELETE FROM fullname indexed_opt where_opt */
141987 { 202, 0 }, /* (138) where_opt ::= */
141988 { 202, -2 }, /* (139) where_opt ::= WHERE expr */
141989 { 149, -8 }, /* (140) cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
141990 { 220, -5 }, /* (141) setlist ::= setlist COMMA nm EQ expr */
141991 { 220, -7 }, /* (142) setlist ::= setlist COMMA LP idlist RP EQ expr */
141992 { 220, -3 }, /* (143) setlist ::= nm EQ expr */
141993 { 220, -5 }, /* (144) setlist ::= LP idlist RP EQ expr */
141994 { 149, -6 }, /* (145) cmd ::= with insert_cmd INTO fullname idlist_opt select */
141995 { 149, -7 }, /* (146) cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
141996 { 221, -2 }, /* (147) insert_cmd ::= INSERT orconf */
141997 { 221, -1 }, /* (148) insert_cmd ::= REPLACE */
141998 { 222, 0 }, /* (149) idlist_opt ::= */
141999 { 222, -3 }, /* (150) idlist_opt ::= LP idlist RP */
142000 { 218, -3 }, /* (151) idlist ::= idlist COMMA nm */
142001 { 218, -1 }, /* (152) idlist ::= nm */
142002 { 174, -3 }, /* (153) expr ::= LP expr RP */
142003 { 174, -1 }, /* (154) expr ::= ID|INDEXED */
142004 { 174, -1 }, /* (155) expr ::= JOIN_KW */
142005 { 174, -3 }, /* (156) expr ::= nm DOT nm */
142006 { 174, -5 }, /* (157) expr ::= nm DOT nm DOT nm */
142007 { 173, -1 }, /* (158) term ::= NULL|FLOAT|BLOB */
142008 { 173, -1 }, /* (159) term ::= STRING */
142009 { 173, -1 }, /* (160) term ::= INTEGER */
142010 { 174, -1 }, /* (161) expr ::= VARIABLE */
142011 { 174, -3 }, /* (162) expr ::= expr COLLATE ID|STRING */
142012 { 174, -6 }, /* (163) expr ::= CAST LP expr AS typetoken RP */
142013 { 174, -5 }, /* (164) expr ::= ID|INDEXED LP distinct exprlist RP */
142014 { 174, -4 }, /* (165) expr ::= ID|INDEXED LP STAR RP */
142015 { 173, -1 }, /* (166) term ::= CTIME_KW */
142016 { 174, -5 }, /* (167) expr ::= LP nexprlist COMMA expr RP */
142017 { 174, -3 }, /* (168) expr ::= expr AND expr */
142018 { 174, -3 }, /* (169) expr ::= expr OR expr */
142019 { 174, -3 }, /* (170) expr ::= expr LT|GT|GE|LE expr */
142020 { 174, -3 }, /* (171) expr ::= expr EQ|NE expr */
142021 { 174, -3 }, /* (172) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
142022 { 174, -3 }, /* (173) expr ::= expr PLUS|MINUS expr */
142023 { 174, -3 }, /* (174) expr ::= expr STAR|SLASH|REM expr */
142024 { 174, -3 }, /* (175) expr ::= expr CONCAT expr */
142025 { 223, -2 }, /* (176) likeop ::= NOT LIKE_KW|MATCH */
142026 { 174, -3 }, /* (177) expr ::= expr likeop expr */
142027 { 174, -5 }, /* (178) expr ::= expr likeop expr ESCAPE expr */
142028 { 174, -2 }, /* (179) expr ::= expr ISNULL|NOTNULL */
142029 { 174, -3 }, /* (180) expr ::= expr NOT NULL */
142030 { 174, -3 }, /* (181) expr ::= expr IS expr */
142031 { 174, -4 }, /* (182) expr ::= expr IS NOT expr */
142032 { 174, -2 }, /* (183) expr ::= NOT expr */
142033 { 174, -2 }, /* (184) expr ::= BITNOT expr */
142034 { 174, -2 }, /* (185) expr ::= MINUS expr */
142035 { 174, -2 }, /* (186) expr ::= PLUS expr */
142036 { 224, -1 }, /* (187) between_op ::= BETWEEN */
142037 { 224, -2 }, /* (188) between_op ::= NOT BETWEEN */
142038 { 174, -5 }, /* (189) expr ::= expr between_op expr AND expr */
142039 { 225, -1 }, /* (190) in_op ::= IN */
142040 { 225, -2 }, /* (191) in_op ::= NOT IN */
142041 { 174, -5 }, /* (192) expr ::= expr in_op LP exprlist RP */
142042 { 174, -3 }, /* (193) expr ::= LP select RP */
142043 { 174, -5 }, /* (194) expr ::= expr in_op LP select RP */
142044 { 174, -5 }, /* (195) expr ::= expr in_op nm dbnm paren_exprlist */
142045 { 174, -4 }, /* (196) expr ::= EXISTS LP select RP */
142046 { 174, -5 }, /* (197) expr ::= CASE case_operand case_exprlist case_else END */
142047 { 228, -5 }, /* (198) case_exprlist ::= case_exprlist WHEN expr THEN expr */
142048 { 228, -4 }, /* (199) case_exprlist ::= WHEN expr THEN expr */
142049 { 229, -2 }, /* (200) case_else ::= ELSE expr */
142050 { 229, 0 }, /* (201) case_else ::= */
142051 { 227, -1 }, /* (202) case_operand ::= expr */
142052 { 227, 0 }, /* (203) case_operand ::= */
142053 { 209, 0 }, /* (204) exprlist ::= */
142054 { 208, -3 }, /* (205) nexprlist ::= nexprlist COMMA expr */
142055 { 208, -1 }, /* (206) nexprlist ::= expr */
142056 { 226, 0 }, /* (207) paren_exprlist ::= */
142057 { 226, -3 }, /* (208) paren_exprlist ::= LP exprlist RP */
142058 { 149, -12 }, /* (209) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
142059 { 230, -1 }, /* (210) uniqueflag ::= UNIQUE */
142060 { 230, 0 }, /* (211) uniqueflag ::= */
142061 { 178, 0 }, /* (212) eidlist_opt ::= */
142062 { 178, -3 }, /* (213) eidlist_opt ::= LP eidlist RP */
142063 { 188, -5 }, /* (214) eidlist ::= eidlist COMMA nm collate sortorder */
142064 { 188, -3 }, /* (215) eidlist ::= nm collate sortorder */
142065 { 231, 0 }, /* (216) collate ::= */
142066 { 231, -2 }, /* (217) collate ::= COLLATE ID|STRING */
142067 { 149, -4 }, /* (218) cmd ::= DROP INDEX ifexists fullname */
142068 { 149, -1 }, /* (219) cmd ::= VACUUM */
142069 { 149, -2 }, /* (220) cmd ::= VACUUM nm */
142070 { 149, -3 }, /* (221) cmd ::= PRAGMA nm dbnm */
142071 { 149, -5 }, /* (222) cmd ::= PRAGMA nm dbnm EQ nmnum */
142072 { 149, -6 }, /* (223) cmd ::= PRAGMA nm dbnm LP nmnum RP */
142073 { 149, -5 }, /* (224) cmd ::= PRAGMA nm dbnm EQ minus_num */
142074 { 149, -6 }, /* (225) cmd ::= PRAGMA nm dbnm LP minus_num RP */
142075 { 169, -2 }, /* (226) plus_num ::= PLUS INTEGER|FLOAT */
142076 { 170, -2 }, /* (227) minus_num ::= MINUS INTEGER|FLOAT */
142077 { 149, -5 }, /* (228) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
142078 { 233, -11 }, /* (229) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
142079 { 235, -1 }, /* (230) trigger_time ::= BEFORE|AFTER */
142080 { 235, -2 }, /* (231) trigger_time ::= INSTEAD OF */
142081 { 235, 0 }, /* (232) trigger_time ::= */
142082 { 236, -1 }, /* (233) trigger_event ::= DELETE|INSERT */
142083 { 236, -1 }, /* (234) trigger_event ::= UPDATE */
142084 { 236, -3 }, /* (235) trigger_event ::= UPDATE OF idlist */
142085 { 238, 0 }, /* (236) when_clause ::= */
142086 { 238, -2 }, /* (237) when_clause ::= WHEN expr */
142087 { 234, -3 }, /* (238) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
142088 { 234, -2 }, /* (239) trigger_cmd_list ::= trigger_cmd SEMI */
142089 { 240, -3 }, /* (240) trnm ::= nm DOT nm */
142090 { 241, -3 }, /* (241) tridxby ::= INDEXED BY nm */
142091 { 241, -2 }, /* (242) tridxby ::= NOT INDEXED */
142092 { 239, -8 }, /* (243) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
142093 { 239, -7 }, /* (244) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt */
142094 { 239, -6 }, /* (245) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
142095 { 239, -3 }, /* (246) trigger_cmd ::= scanpt select scanpt */
142096 { 174, -4 }, /* (247) expr ::= RAISE LP IGNORE RP */
142097 { 174, -6 }, /* (248) expr ::= RAISE LP raisetype COMMA nm RP */
142098 { 192, -1 }, /* (249) raisetype ::= ROLLBACK */
142099 { 192, -1 }, /* (250) raisetype ::= ABORT */
142100 { 192, -1 }, /* (251) raisetype ::= FAIL */
142101 { 149, -4 }, /* (252) cmd ::= DROP TRIGGER ifexists fullname */
142102 { 149, -6 }, /* (253) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
142103 { 149, -3 }, /* (254) cmd ::= DETACH database_kw_opt expr */
142104 { 243, 0 }, /* (255) key_opt ::= */
142105 { 243, -2 }, /* (256) key_opt ::= KEY expr */
142106 { 149, -1 }, /* (257) cmd ::= REINDEX */
142107 { 149, -3 }, /* (258) cmd ::= REINDEX nm dbnm */
142108 { 149, -1 }, /* (259) cmd ::= ANALYZE */
142109 { 149, -3 }, /* (260) cmd ::= ANALYZE nm dbnm */
142110 { 149, -6 }, /* (261) cmd ::= ALTER TABLE fullname RENAME TO nm */
142111 { 149, -7 }, /* (262) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
142112 { 244, -1 }, /* (263) add_column_fullname ::= fullname */
142113 { 149, -1 }, /* (264) cmd ::= create_vtab */
142114 { 149, -4 }, /* (265) cmd ::= create_vtab LP vtabarglist RP */
142115 { 246, -8 }, /* (266) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
142116 { 248, 0 }, /* (267) vtabarg ::= */
142117 { 249, -1 }, /* (268) vtabargtoken ::= ANY */
142118 { 249, -3 }, /* (269) vtabargtoken ::= lp anylist RP */
142119 { 250, -1 }, /* (270) lp ::= LP */
142120 { 219, -2 }, /* (271) with ::= WITH wqlist */
142121 { 219, -3 }, /* (272) with ::= WITH RECURSIVE wqlist */
142122 { 197, -6 }, /* (273) wqlist ::= nm eidlist_opt AS LP select RP */
142123 { 197, -8 }, /* (274) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
142124 { 144, -1 }, /* (275) input ::= cmdlist */
142125 { 145, -2 }, /* (276) cmdlist ::= cmdlist ecmd */
142126 { 145, -1 }, /* (277) cmdlist ::= ecmd */
142127 { 146, -1 }, /* (278) ecmd ::= SEMI */
142128 { 146, -3 }, /* (279) ecmd ::= explain cmdx SEMI */
142129 { 147, 0 }, /* (280) explain ::= */
142130 { 151, 0 }, /* (281) trans_opt ::= */
142131 { 151, -1 }, /* (282) trans_opt ::= TRANSACTION */
142132 { 151, -2 }, /* (283) trans_opt ::= TRANSACTION nm */
142133 { 153, -1 }, /* (284) savepoint_opt ::= SAVEPOINT */
142134 { 153, 0 }, /* (285) savepoint_opt ::= */
142135 { 149, -2 }, /* (286) cmd ::= create_table create_table_args */
142136 { 160, -4 }, /* (287) columnlist ::= columnlist COMMA columnname carglist */
142137 { 160, -2 }, /* (288) columnlist ::= columnname carglist */
142138 { 152, -1 }, /* (289) nm ::= ID|INDEXED */
142139 { 152, -1 }, /* (290) nm ::= STRING */
142140 { 152, -1 }, /* (291) nm ::= JOIN_KW */
142141 { 166, -1 }, /* (292) typetoken ::= typename */
142142 { 167, -1 }, /* (293) typename ::= ID|STRING */
142143 { 168, -1 }, /* (294) signed ::= plus_num */
142144 { 168, -1 }, /* (295) signed ::= minus_num */
142145 { 165, -2 }, /* (296) carglist ::= carglist ccons */
142146 { 165, 0 }, /* (297) carglist ::= */
142147 { 172, -2 }, /* (298) ccons ::= NULL onconf */
142148 { 161, -2 }, /* (299) conslist_opt ::= COMMA conslist */
142149 { 184, -3 }, /* (300) conslist ::= conslist tconscomma tcons */
142150 { 184, -1 }, /* (301) conslist ::= tcons */
142151 { 185, 0 }, /* (302) tconscomma ::= */
142152 { 189, -1 }, /* (303) defer_subclause_opt ::= defer_subclause */
142153 { 191, -1 }, /* (304) resolvetype ::= raisetype */
142154 { 195, -1 }, /* (305) selectnowith ::= oneselect */
142155 { 196, -1 }, /* (306) oneselect ::= values */
142156 { 210, -2 }, /* (307) sclp ::= selcollist COMMA */
142157 { 211, -1 }, /* (308) as ::= ID|STRING */
142158 { 174, -1 }, /* (309) expr ::= term */
142159 { 223, -1 }, /* (310) likeop ::= LIKE_KW|MATCH */
142160 { 209, -1 }, /* (311) exprlist ::= nexprlist */
142161 { 232, -1 }, /* (312) nmnum ::= plus_num */
142162 { 232, -1 }, /* (313) nmnum ::= nm */
142163 { 232, -1 }, /* (314) nmnum ::= ON */
142164 { 232, -1 }, /* (315) nmnum ::= DELETE */
142165 { 232, -1 }, /* (316) nmnum ::= DEFAULT */
142166 { 169, -1 }, /* (317) plus_num ::= INTEGER|FLOAT */
142167 { 237, 0 }, /* (318) foreach_clause ::= */
142168 { 237, -3 }, /* (319) foreach_clause ::= FOR EACH ROW */
142169 { 240, -1 }, /* (320) trnm ::= nm */
142170 { 241, 0 }, /* (321) tridxby ::= */
142171 { 242, -1 }, /* (322) database_kw_opt ::= DATABASE */
142172 { 242, 0 }, /* (323) database_kw_opt ::= */
142173 { 245, 0 }, /* (324) kwcolumn_opt ::= */
142174 { 245, -1 }, /* (325) kwcolumn_opt ::= COLUMNKW */
142175 { 247, -1 }, /* (326) vtabarglist ::= vtabarg */
142176 { 247, -3 }, /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */
142177 { 248, -2 }, /* (328) vtabarg ::= vtabarg vtabargtoken */
142178 { 251, 0 }, /* (329) anylist ::= */
142179 { 251, -4 }, /* (330) anylist ::= anylist LP anylist RP */
142180 { 251, -2 }, /* (331) anylist ::= anylist ANY */
142181 { 219, 0 }, /* (332) with ::= */
 
 
 
 
 
 
 
 
142182 };
142183
142184 static void yy_accept(yyParser*); /* Forward Declaration */
142185
142186 /*
@@ -142191,21 +143112,22 @@
142191 ** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
142192 ** if the lookahead token has already been consumed. As this procedure is
142193 ** only called from one place, optimizing compilers will in-line it, which
142194 ** means that the extra parameters have no performance impact.
142195 */
142196 static void yy_reduce(
142197 yyParser *yypParser, /* The parser */
142198 unsigned int yyruleno, /* Number of the rule by which to reduce */
142199 int yyLookahead, /* Lookahead token, or YYNOCODE if none */
142200 sqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
 
142201 ){
142202 int yygoto; /* The next state */
142203 int yyact; /* The next action */
142204 yyStackEntry *yymsp; /* The top of the parser's stack */
142205 int yysize; /* Amount to pop the stack */
142206 sqlite3ParserARG_FETCH;
142207 (void)yyLookahead;
142208 (void)yyLookaheadToken;
142209 yymsp = yypParser->yytos;
142210 #ifndef NDEBUG
142211 if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
@@ -142232,17 +143154,23 @@
142232 }
142233 #endif
142234 #if YYSTACKDEPTH>0
142235 if( yypParser->yytos>=yypParser->yystackEnd ){
142236 yyStackOverflow(yypParser);
142237 return;
 
 
 
142238 }
142239 #else
142240 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
142241 if( yyGrowStack(yypParser) ){
142242 yyStackOverflow(yypParser);
142243 return;
 
 
 
142244 }
142245 yymsp = yypParser->yytos;
142246 }
142247 #endif
142248 }
@@ -142266,19 +143194,19 @@
142266 break;
142267 case 2: /* cmdx ::= cmd */
142268 { sqlite3FinishCoding(pParse); }
142269 break;
142270 case 3: /* cmd ::= BEGIN transtype trans_opt */
142271 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
142272 break;
142273 case 4: /* transtype ::= */
142274 {yymsp[1].minor.yy4 = TK_DEFERRED;}
142275 break;
142276 case 5: /* transtype ::= DEFERRED */
142277 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
142278 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
142279 {yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-X*/}
142280 break;
142281 case 8: /* cmd ::= COMMIT|END trans_opt */
142282 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
142283 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
142284 break;
@@ -142297,11 +143225,11 @@
142297 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
142298 }
142299 break;
142300 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
142301 {
142302 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
142303 }
142304 break;
142305 case 14: /* createkw ::= CREATE */
142306 {disableLookaside(pParse);}
142307 break;
@@ -142311,37 +143239,37 @@
142311 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
142312 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
142313 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
142314 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
142315 case 92: /* distinct ::= */ yytestcase(yyruleno==92);
142316 case 216: /* collate ::= */ yytestcase(yyruleno==216);
142317 {yymsp[1].minor.yy4 = 0;}
142318 break;
142319 case 16: /* ifnotexists ::= IF NOT EXISTS */
142320 {yymsp[-2].minor.yy4 = 1;}
142321 break;
142322 case 17: /* temp ::= TEMP */
142323 case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
142324 {yymsp[0].minor.yy4 = 1;}
142325 break;
142326 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
142327 {
142328 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy4,0);
142329 }
142330 break;
142331 case 20: /* create_table_args ::= AS select */
142332 {
142333 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy387);
142334 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
142335 }
142336 break;
142337 case 22: /* table_options ::= WITHOUT nm */
142338 {
142339 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
142340 yymsp[-1].minor.yy4 = TF_WithoutRowid | TF_NoVisibleRowid;
142341 }else{
142342 yymsp[-1].minor.yy4 = 0;
142343 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
142344 }
142345 }
142346 break;
142347 case 23: /* columnname ::= nm typetoken */
@@ -142366,30 +143294,30 @@
142366 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
142367 break;
142368 case 28: /* scanpt ::= */
142369 {
142370 assert( yyLookahead!=YYNOCODE );
142371 yymsp[1].minor.yy336 = yyLookaheadToken.z;
142372 }
142373 break;
142374 case 29: /* ccons ::= CONSTRAINT nm */
142375 case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
142376 {pParse->constraintName = yymsp[0].minor.yy0;}
142377 break;
142378 case 30: /* ccons ::= DEFAULT scanpt term scanpt */
142379 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy336,yymsp[0].minor.yy336);}
142380 break;
142381 case 31: /* ccons ::= DEFAULT LP expr RP */
142382 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
142383 break;
142384 case 32: /* ccons ::= DEFAULT PLUS term scanpt */
142385 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy314,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy336);}
142386 break;
142387 case 33: /* ccons ::= DEFAULT MINUS term scanpt */
142388 {
142389 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy314, 0);
142390 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy336);
142391 }
142392 break;
142393 case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
142394 {
142395 Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
@@ -142399,207 +143327,207 @@
142399 }
142400 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
142401 }
142402 break;
142403 case 35: /* ccons ::= NOT NULL onconf */
142404 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
142405 break;
142406 case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
142407 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
142408 break;
142409 case 37: /* ccons ::= UNIQUE onconf */
142410 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0,
142411 SQLITE_IDXTYPE_UNIQUE);}
142412 break;
142413 case 38: /* ccons ::= CHECK LP expr RP */
142414 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy314);}
142415 break;
142416 case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
142417 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
142418 break;
142419 case 40: /* ccons ::= defer_subclause */
142420 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
142421 break;
142422 case 41: /* ccons ::= COLLATE ID|STRING */
142423 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
142424 break;
142425 case 44: /* refargs ::= */
142426 { yymsp[1].minor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
142427 break;
142428 case 45: /* refargs ::= refargs refarg */
142429 { yymsp[-1].minor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
142430 break;
142431 case 46: /* refarg ::= MATCH nm */
142432 { yymsp[-1].minor.yy215.value = 0; yymsp[-1].minor.yy215.mask = 0x000000; }
142433 break;
142434 case 47: /* refarg ::= ON INSERT refact */
142435 { yymsp[-2].minor.yy215.value = 0; yymsp[-2].minor.yy215.mask = 0x000000; }
142436 break;
142437 case 48: /* refarg ::= ON DELETE refact */
142438 { yymsp[-2].minor.yy215.value = yymsp[0].minor.yy4; yymsp[-2].minor.yy215.mask = 0x0000ff; }
142439 break;
142440 case 49: /* refarg ::= ON UPDATE refact */
142441 { yymsp[-2].minor.yy215.value = yymsp[0].minor.yy4<<8; yymsp[-2].minor.yy215.mask = 0x00ff00; }
142442 break;
142443 case 50: /* refact ::= SET NULL */
142444 { yymsp[-1].minor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
142445 break;
142446 case 51: /* refact ::= SET DEFAULT */
142447 { yymsp[-1].minor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
142448 break;
142449 case 52: /* refact ::= CASCADE */
142450 { yymsp[0].minor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
142451 break;
142452 case 53: /* refact ::= RESTRICT */
142453 { yymsp[0].minor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
142454 break;
142455 case 54: /* refact ::= NO ACTION */
142456 { yymsp[-1].minor.yy4 = OE_None; /* EV: R-33326-45252 */}
142457 break;
142458 case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
142459 {yymsp[-2].minor.yy4 = 0;}
142460 break;
142461 case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
142462 case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
142463 case 147: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==147);
142464 {yymsp[-1].minor.yy4 = yymsp[0].minor.yy4;}
142465 break;
142466 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
142467 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
142468 case 188: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==188);
142469 case 191: /* in_op ::= NOT IN */ yytestcase(yyruleno==191);
142470 case 217: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==217);
142471 {yymsp[-1].minor.yy4 = 1;}
142472 break;
142473 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
142474 {yymsp[-1].minor.yy4 = 0;}
142475 break;
142476 case 61: /* tconscomma ::= COMMA */
142477 {pParse->constraintName.n = 0;}
142478 break;
142479 case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
142480 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
142481 break;
142482 case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
142483 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0,
142484 SQLITE_IDXTYPE_UNIQUE);}
142485 break;
142486 case 65: /* tcons ::= CHECK LP expr RP onconf */
142487 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy314);}
142488 break;
142489 case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
142490 {
142491 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
142492 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
142493 }
142494 break;
142495 case 68: /* onconf ::= */
142496 case 70: /* orconf ::= */ yytestcase(yyruleno==70);
142497 {yymsp[1].minor.yy4 = OE_Default;}
142498 break;
142499 case 69: /* onconf ::= ON CONFLICT resolvetype */
142500 {yymsp[-2].minor.yy4 = yymsp[0].minor.yy4;}
142501 break;
142502 case 72: /* resolvetype ::= IGNORE */
142503 {yymsp[0].minor.yy4 = OE_Ignore;}
142504 break;
142505 case 73: /* resolvetype ::= REPLACE */
142506 case 148: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==148);
142507 {yymsp[0].minor.yy4 = OE_Replace;}
142508 break;
142509 case 74: /* cmd ::= DROP TABLE ifexists fullname */
142510 {
142511 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
142512 }
142513 break;
142514 case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
142515 {
142516 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy387, yymsp[-7].minor.yy4, yymsp[-5].minor.yy4);
142517 }
142518 break;
142519 case 78: /* cmd ::= DROP VIEW ifexists fullname */
142520 {
142521 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
142522 }
142523 break;
142524 case 79: /* cmd ::= select */
142525 {
142526 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
142527 sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
142528 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
142529 }
142530 break;
142531 case 80: /* select ::= WITH wqlist selectnowith */
142532 {
142533 Select *p = yymsp[0].minor.yy387;
142534 if( p ){
142535 p->pWith = yymsp[-1].minor.yy451;
142536 parserDoubleLinkSelect(pParse, p);
142537 }else{
142538 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy451);
142539 }
142540 yymsp[-2].minor.yy387 = p;
142541 }
142542 break;
142543 case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
142544 {
142545 Select *p = yymsp[0].minor.yy387;
142546 if( p ){
142547 p->pWith = yymsp[-1].minor.yy451;
142548 parserDoubleLinkSelect(pParse, p);
142549 }else{
142550 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy451);
142551 }
142552 yymsp[-3].minor.yy387 = p;
142553 }
142554 break;
142555 case 82: /* select ::= selectnowith */
142556 {
142557 Select *p = yymsp[0].minor.yy387;
142558 if( p ){
142559 parserDoubleLinkSelect(pParse, p);
142560 }
142561 yymsp[0].minor.yy387 = p; /*A-overwrites-X*/
142562 }
142563 break;
142564 case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
142565 {
142566 Select *pRhs = yymsp[0].minor.yy387;
142567 Select *pLhs = yymsp[-2].minor.yy387;
142568 if( pRhs && pRhs->pPrior ){
142569 SrcList *pFrom;
142570 Token x;
142571 x.n = 0;
142572 parserDoubleLinkSelect(pParse, pRhs);
142573 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
142574 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
142575 }
142576 if( pRhs ){
142577 pRhs->op = (u8)yymsp[-1].minor.yy4;
142578 pRhs->pPrior = pLhs;
142579 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
142580 pRhs->selFlags &= ~SF_MultiValue;
142581 if( yymsp[-1].minor.yy4!=TK_ALL ) pParse->hasCompound = 1;
142582 }else{
142583 sqlite3SelectDelete(pParse->db, pLhs);
142584 }
142585 yymsp[-2].minor.yy387 = pRhs;
142586 }
142587 break;
142588 case 84: /* multiselect_op ::= UNION */
142589 case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
142590 {yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-OP*/}
142591 break;
142592 case 85: /* multiselect_op ::= UNION ALL */
142593 {yymsp[-1].minor.yy4 = TK_ALL;}
142594 break;
142595 case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
142596 {
142597 #if SELECTTRACE_ENABLED
142598 Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
142599 #endif
142600 yymsp[-8].minor.yy387 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy259,yymsp[-4].minor.yy314,yymsp[-3].minor.yy322,yymsp[-2].minor.yy314,yymsp[-1].minor.yy322,yymsp[-7].minor.yy4,yymsp[0].minor.yy314);
142601 #if SELECTTRACE_ENABLED
142602 /* Populate the Select.zSelName[] string that is used to help with
142603 ** query planner debugging, to differentiate between multiple Select
142604 ** objects in a complex query.
142605 **
@@ -142606,481 +143534,507 @@
142606 ** If the SELECT keyword is immediately followed by a C-style comment
142607 ** then extract the first few alphanumeric characters from within that
142608 ** comment to be the zSelName value. Otherwise, the label is #N where
142609 ** is an integer that is incremented with each SELECT statement seen.
142610 */
142611 if( yymsp[-8].minor.yy387!=0 ){
142612 const char *z = s.z+6;
142613 int i;
142614 sqlite3_snprintf(sizeof(yymsp[-8].minor.yy387->zSelName), yymsp[-8].minor.yy387->zSelName,"#%d",++pParse->nSelect);
142615 while( z[0]==' ' ) z++;
142616 if( z[0]=='/' && z[1]=='*' ){
142617 z += 2;
142618 while( z[0]==' ' ) z++;
142619 for(i=0; sqlite3Isalnum(z[i]); i++){}
142620 sqlite3_snprintf(sizeof(yymsp[-8].minor.yy387->zSelName), yymsp[-8].minor.yy387->zSelName, "%.*s", i, z);
142621 }
142622 }
142623 #endif /* SELECTRACE_ENABLED */
142624 }
142625 break;
142626 case 88: /* values ::= VALUES LP nexprlist RP */
142627 {
142628 yymsp[-3].minor.yy387 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
142629 }
142630 break;
142631 case 89: /* values ::= values COMMA LP exprlist RP */
142632 {
142633 Select *pRight, *pLeft = yymsp[-4].minor.yy387;
142634 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
142635 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
142636 if( pRight ){
142637 pRight->op = TK_ALL;
142638 pRight->pPrior = pLeft;
142639 yymsp[-4].minor.yy387 = pRight;
142640 }else{
142641 yymsp[-4].minor.yy387 = pLeft;
142642 }
142643 }
142644 break;
142645 case 90: /* distinct ::= DISTINCT */
142646 {yymsp[0].minor.yy4 = SF_Distinct;}
142647 break;
142648 case 91: /* distinct ::= ALL */
142649 {yymsp[0].minor.yy4 = SF_All;}
142650 break;
142651 case 93: /* sclp ::= */
142652 case 122: /* orderby_opt ::= */ yytestcase(yyruleno==122);
142653 case 129: /* groupby_opt ::= */ yytestcase(yyruleno==129);
142654 case 204: /* exprlist ::= */ yytestcase(yyruleno==204);
142655 case 207: /* paren_exprlist ::= */ yytestcase(yyruleno==207);
142656 case 212: /* eidlist_opt ::= */ yytestcase(yyruleno==212);
142657 {yymsp[1].minor.yy322 = 0;}
142658 break;
142659 case 94: /* selcollist ::= sclp scanpt expr scanpt as */
142660 {
142661 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy314);
142662 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1);
142663 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy336,yymsp[-1].minor.yy336);
142664 }
142665 break;
142666 case 95: /* selcollist ::= sclp scanpt STAR */
142667 {
142668 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
142669 yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
142670 }
142671 break;
142672 case 96: /* selcollist ::= sclp scanpt nm DOT STAR */
142673 {
142674 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
142675 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142676 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
142677 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
142678 }
142679 break;
142680 case 97: /* as ::= AS nm */
142681 case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108);
142682 case 226: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==226);
142683 case 227: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==227);
142684 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
142685 break;
142686 case 99: /* from ::= */
142687 {yymsp[1].minor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy259));}
142688 break;
142689 case 100: /* from ::= FROM seltablist */
142690 {
142691 yymsp[-1].minor.yy259 = yymsp[0].minor.yy259;
142692 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy259);
142693 }
142694 break;
142695 case 101: /* stl_prefix ::= seltablist joinop */
142696 {
142697 if( ALWAYS(yymsp[-1].minor.yy259 && yymsp[-1].minor.yy259->nSrc>0) ) yymsp[-1].minor.yy259->a[yymsp[-1].minor.yy259->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy4;
142698 }
142699 break;
142700 case 102: /* stl_prefix ::= */
142701 {yymsp[1].minor.yy259 = 0;}
142702 break;
142703 case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
142704 {
142705 yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142706 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy259, &yymsp[-2].minor.yy0);
142707 }
142708 break;
142709 case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
142710 {
142711 yymsp[-8].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy259,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142712 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy259, yymsp[-4].minor.yy322);
142713 }
142714 break;
142715 case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
142716 {
142717 yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy387,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142718 }
142719 break;
142720 case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
142721 {
142722 if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
142723 yymsp[-6].minor.yy259 = yymsp[-4].minor.yy259;
142724 }else if( yymsp[-4].minor.yy259->nSrc==1 ){
142725 yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142726 if( yymsp[-6].minor.yy259 ){
142727 struct SrcList_item *pNew = &yymsp[-6].minor.yy259->a[yymsp[-6].minor.yy259->nSrc-1];
142728 struct SrcList_item *pOld = yymsp[-4].minor.yy259->a;
142729 pNew->zName = pOld->zName;
142730 pNew->zDatabase = pOld->zDatabase;
142731 pNew->pSelect = pOld->pSelect;
142732 pOld->zName = pOld->zDatabase = 0;
142733 pOld->pSelect = 0;
142734 }
142735 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy259);
142736 }else{
142737 Select *pSubquery;
142738 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
142739 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,SF_NestedFrom,0);
142740 yymsp[-6].minor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
142741 }
142742 }
142743 break;
142744 case 107: /* dbnm ::= */
142745 case 117: /* indexed_opt ::= */ yytestcase(yyruleno==117);
142746 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
142747 break;
142748 case 109: /* fullname ::= nm */
142749 {yymsp[0].minor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
 
142750 break;
142751 case 110: /* fullname ::= nm DOT nm */
142752 {yymsp[-2].minor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
142753 break;
142754 case 111: /* joinop ::= COMMA|JOIN */
142755 { yymsp[0].minor.yy4 = JT_INNER; }
142756 break;
142757 case 112: /* joinop ::= JOIN_KW JOIN */
142758 {yymsp[-1].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
142759 break;
142760 case 113: /* joinop ::= JOIN_KW nm JOIN */
142761 {yymsp[-2].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
142762 break;
142763 case 114: /* joinop ::= JOIN_KW nm nm JOIN */
142764 {yymsp[-3].minor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
142765 break;
142766 case 115: /* on_opt ::= ON expr */
142767 case 132: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==132);
142768 case 139: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==139);
142769 case 200: /* case_else ::= ELSE expr */ yytestcase(yyruleno==200);
142770 {yymsp[-1].minor.yy314 = yymsp[0].minor.yy314;}
142771 break;
142772 case 116: /* on_opt ::= */
142773 case 131: /* having_opt ::= */ yytestcase(yyruleno==131);
142774 case 133: /* limit_opt ::= */ yytestcase(yyruleno==133);
142775 case 138: /* where_opt ::= */ yytestcase(yyruleno==138);
142776 case 201: /* case_else ::= */ yytestcase(yyruleno==201);
142777 case 203: /* case_operand ::= */ yytestcase(yyruleno==203);
142778 {yymsp[1].minor.yy314 = 0;}
142779 break;
142780 case 118: /* indexed_opt ::= INDEXED BY nm */
 
 
 
 
 
 
 
 
 
 
 
 
 
142781 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
142782 break;
142783 case 119: /* indexed_opt ::= NOT INDEXED */
142784 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
142785 break;
142786 case 120: /* using_opt ::= USING LP idlist RP */
142787 {yymsp[-3].minor.yy384 = yymsp[-1].minor.yy384;}
142788 break;
142789 case 121: /* using_opt ::= */
142790 case 149: /* idlist_opt ::= */ yytestcase(yyruleno==149);
142791 {yymsp[1].minor.yy384 = 0;}
142792 break;
142793 case 123: /* orderby_opt ::= ORDER BY sortlist */
142794 case 130: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==130);
142795 {yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
142796 break;
142797 case 124: /* sortlist ::= sortlist COMMA expr sortorder */
142798 {
142799 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
142800 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy322,yymsp[0].minor.yy4);
142801 }
142802 break;
142803 case 125: /* sortlist ::= expr sortorder */
142804 {
142805 yymsp[-1].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314); /*A-overwrites-Y*/
142806 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy322,yymsp[0].minor.yy4);
142807 }
142808 break;
142809 case 126: /* sortorder ::= ASC */
142810 {yymsp[0].minor.yy4 = SQLITE_SO_ASC;}
142811 break;
142812 case 127: /* sortorder ::= DESC */
142813 {yymsp[0].minor.yy4 = SQLITE_SO_DESC;}
142814 break;
142815 case 128: /* sortorder ::= */
142816 {yymsp[1].minor.yy4 = SQLITE_SO_UNDEFINED;}
142817 break;
142818 case 134: /* limit_opt ::= LIMIT expr */
142819 {yymsp[-1].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy314,0);}
142820 break;
142821 case 135: /* limit_opt ::= LIMIT expr OFFSET expr */
142822 {yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);}
142823 break;
142824 case 136: /* limit_opt ::= LIMIT expr COMMA expr */
142825 {yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy314,yymsp[-2].minor.yy314);}
142826 break;
142827 case 137: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
142828 {
142829 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
142830 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314,0,0);
142831 }
142832 break;
142833 case 140: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
142834 {
142835 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
142836 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
142837 sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy4,0,0);
142838 }
142839 break;
142840 case 141: /* setlist ::= setlist COMMA nm EQ expr */
142841 {
142842 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy314);
142843 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
142844 }
142845 break;
142846 case 142: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
142847 {
142848 yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy384, yymsp[0].minor.yy314);
142849 }
142850 break;
142851 case 143: /* setlist ::= nm EQ expr */
142852 {
142853 yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy314);
142854 sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
142855 }
142856 yymsp[-2].minor.yy322 = yylhsminor.yy322;
142857 break;
142858 case 144: /* setlist ::= LP idlist RP EQ expr */
142859 {
142860 yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy384, yymsp[0].minor.yy314);
142861 }
142862 break;
142863 case 145: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
142864 {
142865 sqlite3Insert(pParse, yymsp[-2].minor.yy259, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy4);
142866 }
142867 break;
142868 case 146: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
142869 {
142870 sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy4);
142871 }
142872 break;
142873 case 150: /* idlist_opt ::= LP idlist RP */
142874 {yymsp[-2].minor.yy384 = yymsp[-1].minor.yy384;}
142875 break;
142876 case 151: /* idlist ::= idlist COMMA nm */
142877 {yymsp[-2].minor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
142878 break;
142879 case 152: /* idlist ::= nm */
142880 {yymsp[0].minor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
142881 break;
142882 case 153: /* expr ::= LP expr RP */
142883 {yymsp[-2].minor.yy314 = yymsp[-1].minor.yy314;}
142884 break;
142885 case 154: /* expr ::= ID|INDEXED */
142886 case 155: /* expr ::= JOIN_KW */ yytestcase(yyruleno==155);
142887 {yymsp[0].minor.yy314=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
142888 break;
142889 case 156: /* expr ::= nm DOT nm */
 
 
 
 
 
 
 
 
 
 
 
 
142890 {
142891 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142892 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
142893 yylhsminor.yy314 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
142894 }
142895 yymsp[-2].minor.yy314 = yylhsminor.yy314;
142896 break;
142897 case 157: /* expr ::= nm DOT nm DOT nm */
142898 {
142899 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
142900 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
142901 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
142902 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
142903 yylhsminor.yy314 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
142904 }
142905 yymsp[-4].minor.yy314 = yylhsminor.yy314;
142906 break;
142907 case 158: /* term ::= NULL|FLOAT|BLOB */
142908 case 159: /* term ::= STRING */ yytestcase(yyruleno==159);
142909 {yymsp[0].minor.yy314=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
142910 break;
142911 case 160: /* term ::= INTEGER */
142912 {
142913 yylhsminor.yy314 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
142914 }
142915 yymsp[0].minor.yy314 = yylhsminor.yy314;
142916 break;
142917 case 161: /* expr ::= VARIABLE */
142918 {
142919 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
142920 u32 n = yymsp[0].minor.yy0.n;
142921 yymsp[0].minor.yy314 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
142922 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy314, n);
142923 }else{
142924 /* When doing a nested parse, one can include terms in an expression
142925 ** that look like this: #1 #2 ... These terms refer to registers
142926 ** in the virtual machine. #N is the N-th register. */
142927 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
142928 assert( t.n>=2 );
142929 if( pParse->nested==0 ){
142930 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
142931 yymsp[0].minor.yy314 = 0;
142932 }else{
142933 yymsp[0].minor.yy314 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
142934 if( yymsp[0].minor.yy314 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy314->iTable);
142935 }
142936 }
142937 }
142938 break;
142939 case 162: /* expr ::= expr COLLATE ID|STRING */
142940 {
142941 yymsp[-2].minor.yy314 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy314, &yymsp[0].minor.yy0, 1);
142942 }
142943 break;
142944 case 163: /* expr ::= CAST LP expr AS typetoken RP */
142945 {
142946 yymsp[-5].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
142947 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy314, yymsp[-3].minor.yy314, 0);
142948 }
142949 break;
142950 case 164: /* expr ::= ID|INDEXED LP distinct exprlist RP */
142951 {
142952 if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
142953 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
142954 }
142955 yylhsminor.yy314 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
142956 if( yymsp[-2].minor.yy4==SF_Distinct && yylhsminor.yy314 ){
142957 yylhsminor.yy314->flags |= EP_Distinct;
142958 }
142959 }
142960 yymsp[-4].minor.yy314 = yylhsminor.yy314;
142961 break;
142962 case 165: /* expr ::= ID|INDEXED LP STAR RP */
142963 {
142964 yylhsminor.yy314 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
142965 }
142966 yymsp[-3].minor.yy314 = yylhsminor.yy314;
142967 break;
142968 case 166: /* term ::= CTIME_KW */
142969 {
142970 yylhsminor.yy314 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
142971 }
142972 yymsp[0].minor.yy314 = yylhsminor.yy314;
142973 break;
142974 case 167: /* expr ::= LP nexprlist COMMA expr RP */
142975 {
142976 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy314);
142977 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
142978 if( yymsp[-4].minor.yy314 ){
142979 yymsp[-4].minor.yy314->x.pList = pList;
142980 }else{
142981 sqlite3ExprListDelete(pParse->db, pList);
142982 }
142983 }
142984 break;
142985 case 168: /* expr ::= expr AND expr */
142986 case 169: /* expr ::= expr OR expr */ yytestcase(yyruleno==169);
142987 case 170: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==170);
142988 case 171: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==171);
142989 case 172: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==172);
142990 case 173: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==173);
142991 case 174: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==174);
142992 case 175: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==175);
142993 {yymsp[-2].minor.yy314=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);}
142994 break;
142995 case 176: /* likeop ::= NOT LIKE_KW|MATCH */
142996 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
142997 break;
142998 case 177: /* expr ::= expr likeop expr */
142999 {
143000 ExprList *pList;
143001 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
143002 yymsp[-1].minor.yy0.n &= 0x7fffffff;
143003 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy314);
143004 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy314);
143005 yymsp[-2].minor.yy314 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
143006 if( bNot ) yymsp[-2].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy314, 0);
143007 if( yymsp[-2].minor.yy314 ) yymsp[-2].minor.yy314->flags |= EP_InfixFunc;
143008 }
143009 break;
143010 case 178: /* expr ::= expr likeop expr ESCAPE expr */
143011 {
143012 ExprList *pList;
143013 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
143014 yymsp[-3].minor.yy0.n &= 0x7fffffff;
143015 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143016 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy314);
143017 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy314);
143018 yymsp[-4].minor.yy314 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
143019 if( bNot ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143020 if( yymsp[-4].minor.yy314 ) yymsp[-4].minor.yy314->flags |= EP_InfixFunc;
143021 }
143022 break;
143023 case 179: /* expr ::= expr ISNULL|NOTNULL */
143024 {yymsp[-1].minor.yy314 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy314,0);}
143025 break;
143026 case 180: /* expr ::= expr NOT NULL */
143027 {yymsp[-2].minor.yy314 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy314,0);}
143028 break;
143029 case 181: /* expr ::= expr IS expr */
143030 {
143031 yymsp[-2].minor.yy314 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy314,yymsp[0].minor.yy314);
143032 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy314, yymsp[-2].minor.yy314, TK_ISNULL);
143033 }
143034 break;
143035 case 182: /* expr ::= expr IS NOT expr */
143036 {
143037 yymsp[-3].minor.yy314 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy314,yymsp[0].minor.yy314);
143038 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy314, yymsp[-3].minor.yy314, TK_NOTNULL);
143039 }
143040 break;
143041 case 183: /* expr ::= NOT expr */
143042 case 184: /* expr ::= BITNOT expr */ yytestcase(yyruleno==184);
143043 {yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy314, 0);/*A-overwrites-B*/}
143044 break;
143045 case 185: /* expr ::= MINUS expr */
143046 {yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy314, 0);}
143047 break;
143048 case 186: /* expr ::= PLUS expr */
143049 {yymsp[-1].minor.yy314 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy314, 0);}
143050 break;
143051 case 187: /* between_op ::= BETWEEN */
143052 case 190: /* in_op ::= IN */ yytestcase(yyruleno==190);
143053 {yymsp[0].minor.yy4 = 0;}
143054 break;
143055 case 189: /* expr ::= expr between_op expr AND expr */
143056 {
143057 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143058 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy314);
143059 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy314, 0);
143060 if( yymsp[-4].minor.yy314 ){
143061 yymsp[-4].minor.yy314->x.pList = pList;
143062 }else{
143063 sqlite3ExprListDelete(pParse->db, pList);
143064 }
143065 if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143066 }
143067 break;
143068 case 192: /* expr ::= expr in_op LP exprlist RP */
143069 {
143070 if( yymsp[-1].minor.yy322==0 ){
143071 /* Expressions of the form
143072 **
143073 ** expr1 IN ()
143074 ** expr1 NOT IN ()
143075 **
143076 ** simplify to constants 0 (false) and 1 (true), respectively,
143077 ** regardless of the value of expr1.
143078 */
143079 sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy314);
143080 yymsp[-4].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy4],1);
143081 }else if( yymsp[-1].minor.yy322->nExpr==1 ){
143082 /* Expressions of the form:
143083 **
143084 ** expr1 IN (?1)
143085 ** expr1 NOT IN (?2)
143086 **
@@ -143093,394 +144047,396 @@
143093 ** But, the RHS of the == or <> is marked with the EP_Generic flag
143094 ** so that it may not contribute to the computation of comparison
143095 ** affinity or the collating sequence to use for comparison. Otherwise,
143096 ** the semantics would be subtly different from IN or NOT IN.
143097 */
143098 Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
143099 yymsp[-1].minor.yy322->a[0].pExpr = 0;
143100 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
143101 /* pRHS cannot be NULL because a malloc error would have been detected
143102 ** before now and control would have never reached this point */
143103 if( ALWAYS(pRHS) ){
143104 pRHS->flags &= ~EP_Collate;
143105 pRHS->flags |= EP_Generic;
143106 }
143107 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, yymsp[-3].minor.yy4 ? TK_NE : TK_EQ, yymsp[-4].minor.yy314, pRHS);
143108 }else{
143109 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143110 if( yymsp[-4].minor.yy314 ){
143111 yymsp[-4].minor.yy314->x.pList = yymsp[-1].minor.yy322;
143112 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy314);
143113 }else{
143114 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
143115 }
143116 if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143117 }
143118 }
143119 break;
143120 case 193: /* expr ::= LP select RP */
143121 {
143122 yymsp[-2].minor.yy314 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
143123 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy314, yymsp[-1].minor.yy387);
143124 }
143125 break;
143126 case 194: /* expr ::= expr in_op LP select RP */
143127 {
143128 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143129 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy314, yymsp[-1].minor.yy387);
143130 if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143131 }
143132 break;
143133 case 195: /* expr ::= expr in_op nm dbnm paren_exprlist */
143134 {
143135 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
143136 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
143137 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
143138 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy314, 0);
143139 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy314, pSelect);
143140 if( yymsp[-3].minor.yy4 ) yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy314, 0);
143141 }
143142 break;
143143 case 196: /* expr ::= EXISTS LP select RP */
143144 {
143145 Expr *p;
143146 p = yymsp[-3].minor.yy314 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
143147 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy387);
143148 }
143149 break;
143150 case 197: /* expr ::= CASE case_operand case_exprlist case_else END */
143151 {
143152 yymsp[-4].minor.yy314 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, 0);
143153 if( yymsp[-4].minor.yy314 ){
143154 yymsp[-4].minor.yy314->x.pList = yymsp[-1].minor.yy314 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy314) : yymsp[-2].minor.yy322;
143155 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy314);
143156 }else{
143157 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
143158 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy314);
143159 }
143160 }
143161 break;
143162 case 198: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
143163 {
143164 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy314);
143165 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy314);
143166 }
143167 break;
143168 case 199: /* case_exprlist ::= WHEN expr THEN expr */
143169 {
143170 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy314);
143171 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy314);
143172 }
143173 break;
143174 case 202: /* case_operand ::= expr */
143175 {yymsp[0].minor.yy314 = yymsp[0].minor.yy314; /*A-overwrites-X*/}
143176 break;
143177 case 205: /* nexprlist ::= nexprlist COMMA expr */
143178 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy314);}
143179 break;
143180 case 206: /* nexprlist ::= expr */
143181 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy314); /*A-overwrites-Y*/}
143182 break;
143183 case 208: /* paren_exprlist ::= LP exprlist RP */
143184 case 213: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==213);
143185 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
143186 break;
143187 case 209: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
143188 {
143189 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
143190 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy4,
143191 &yymsp[-11].minor.yy0, yymsp[0].minor.yy314, SQLITE_SO_ASC, yymsp[-8].minor.yy4, SQLITE_IDXTYPE_APPDEF);
143192 }
143193 break;
143194 case 210: /* uniqueflag ::= UNIQUE */
143195 case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);
143196 {yymsp[0].minor.yy4 = OE_Abort;}
143197 break;
143198 case 211: /* uniqueflag ::= */
143199 {yymsp[1].minor.yy4 = OE_None;}
143200 break;
143201 case 214: /* eidlist ::= eidlist COMMA nm collate sortorder */
143202 {
143203 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy4, yymsp[0].minor.yy4);
143204 }
143205 break;
143206 case 215: /* eidlist ::= nm collate sortorder */
143207 {
143208 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy4, yymsp[0].minor.yy4); /*A-overwrites-Y*/
143209 }
143210 break;
143211 case 218: /* cmd ::= DROP INDEX ifexists fullname */
143212 {sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
143213 break;
143214 case 219: /* cmd ::= VACUUM */
143215 {sqlite3Vacuum(pParse,0);}
143216 break;
143217 case 220: /* cmd ::= VACUUM nm */
143218 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
143219 break;
143220 case 221: /* cmd ::= PRAGMA nm dbnm */
143221 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
143222 break;
143223 case 222: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
143224 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
143225 break;
143226 case 223: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
143227 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
143228 break;
143229 case 224: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
143230 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
143231 break;
143232 case 225: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
143233 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
143234 break;
143235 case 228: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
143236 {
143237 Token all;
143238 all.z = yymsp[-3].minor.yy0.z;
143239 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
143240 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
143241 }
143242 break;
143243 case 229: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
143244 {
143245 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy4, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy259, yymsp[0].minor.yy314, yymsp[-10].minor.yy4, yymsp[-8].minor.yy4);
143246 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
143247 }
143248 break;
143249 case 230: /* trigger_time ::= BEFORE|AFTER */
143250 { yymsp[0].minor.yy4 = yymsp[0].major; /*A-overwrites-X*/ }
143251 break;
143252 case 231: /* trigger_time ::= INSTEAD OF */
143253 { yymsp[-1].minor.yy4 = TK_INSTEAD;}
143254 break;
143255 case 232: /* trigger_time ::= */
143256 { yymsp[1].minor.yy4 = TK_BEFORE; }
143257 break;
143258 case 233: /* trigger_event ::= DELETE|INSERT */
143259 case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);
143260 {yymsp[0].minor.yy90.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy90.b = 0;}
143261 break;
143262 case 235: /* trigger_event ::= UPDATE OF idlist */
143263 {yymsp[-2].minor.yy90.a = TK_UPDATE; yymsp[-2].minor.yy90.b = yymsp[0].minor.yy384;}
143264 break;
143265 case 236: /* when_clause ::= */
143266 case 255: /* key_opt ::= */ yytestcase(yyruleno==255);
143267 { yymsp[1].minor.yy314 = 0; }
143268 break;
143269 case 237: /* when_clause ::= WHEN expr */
143270 case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);
143271 { yymsp[-1].minor.yy314 = yymsp[0].minor.yy314; }
143272 break;
143273 case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
143274 {
143275 assert( yymsp[-2].minor.yy203!=0 );
143276 yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
143277 yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
143278 }
143279 break;
143280 case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */
143281 {
143282 assert( yymsp[-1].minor.yy203!=0 );
143283 yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
143284 }
143285 break;
143286 case 240: /* trnm ::= nm DOT nm */
143287 {
143288 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
143289 sqlite3ErrorMsg(pParse,
143290 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
143291 "statements within triggers");
143292 }
143293 break;
143294 case 241: /* tridxby ::= INDEXED BY nm */
143295 {
143296 sqlite3ErrorMsg(pParse,
143297 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
143298 "within triggers");
143299 }
143300 break;
143301 case 242: /* tridxby ::= NOT INDEXED */
143302 {
143303 sqlite3ErrorMsg(pParse,
143304 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
143305 "within triggers");
143306 }
143307 break;
143308 case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
143309 {yylhsminor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy314, yymsp[-6].minor.yy4, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy336);}
143310 yymsp[-7].minor.yy203 = yylhsminor.yy203;
143311 break;
143312 case 244: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select scanpt */
143313 {yylhsminor.yy203 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-3].minor.yy0,yymsp[-2].minor.yy384,yymsp[-1].minor.yy387,yymsp[-5].minor.yy4,yymsp[-6].minor.yy336,yymsp[0].minor.yy336);/*yylhsminor.yy203-overwrites-yymsp[-5].minor.yy4*/}
143314 yymsp[-6].minor.yy203 = yylhsminor.yy203;
143315 break;
143316 case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
143317 {yylhsminor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy314, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy336);}
143318 yymsp[-5].minor.yy203 = yylhsminor.yy203;
143319 break;
143320 case 246: /* trigger_cmd ::= scanpt select scanpt */
143321 {yylhsminor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy387, yymsp[-2].minor.yy336, yymsp[0].minor.yy336); /*yylhsminor.yy203-overwrites-yymsp[-1].minor.yy387*/}
143322 yymsp[-2].minor.yy203 = yylhsminor.yy203;
143323 break;
143324 case 247: /* expr ::= RAISE LP IGNORE RP */
143325 {
143326 yymsp[-3].minor.yy314 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
143327 if( yymsp[-3].minor.yy314 ){
143328 yymsp[-3].minor.yy314->affinity = OE_Ignore;
143329 }
143330 }
143331 break;
143332 case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */
143333 {
143334 yymsp[-5].minor.yy314 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
143335 if( yymsp[-5].minor.yy314 ) {
143336 yymsp[-5].minor.yy314->affinity = (char)yymsp[-3].minor.yy4;
143337 }
143338 }
143339 break;
143340 case 249: /* raisetype ::= ROLLBACK */
143341 {yymsp[0].minor.yy4 = OE_Rollback;}
143342 break;
143343 case 251: /* raisetype ::= FAIL */
143344 {yymsp[0].minor.yy4 = OE_Fail;}
143345 break;
143346 case 252: /* cmd ::= DROP TRIGGER ifexists fullname */
143347 {
143348 sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
143349 }
143350 break;
143351 case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
143352 {
143353 sqlite3Attach(pParse, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, yymsp[0].minor.yy314);
143354 }
143355 break;
143356 case 254: /* cmd ::= DETACH database_kw_opt expr */
143357 {
143358 sqlite3Detach(pParse, yymsp[0].minor.yy314);
143359 }
143360 break;
143361 case 257: /* cmd ::= REINDEX */
 
 
143362 {sqlite3Reindex(pParse, 0, 0);}
143363 break;
143364 case 258: /* cmd ::= REINDEX nm dbnm */
143365 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
143366 break;
143367 case 259: /* cmd ::= ANALYZE */
143368 {sqlite3Analyze(pParse, 0, 0);}
143369 break;
143370 case 260: /* cmd ::= ANALYZE nm dbnm */
143371 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
143372 break;
143373 case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
143374 {
143375 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
143376 }
143377 break;
143378 case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
143379 {
143380 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
143381 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
143382 }
143383 break;
143384 case 263: /* add_column_fullname ::= fullname */
143385 {
143386 disableLookaside(pParse);
143387 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
143388 }
143389 break;
143390 case 264: /* cmd ::= create_vtab */
143391 {sqlite3VtabFinishParse(pParse,0);}
143392 break;
143393 case 265: /* cmd ::= create_vtab LP vtabarglist RP */
143394 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
143395 break;
143396 case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
143397 {
143398 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy4);
143399 }
143400 break;
143401 case 267: /* vtabarg ::= */
143402 {sqlite3VtabArgInit(pParse);}
143403 break;
143404 case 268: /* vtabargtoken ::= ANY */
143405 case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);
143406 case 270: /* lp ::= LP */ yytestcase(yyruleno==270);
143407 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
143408 break;
143409 case 271: /* with ::= WITH wqlist */
143410 case 272: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==272);
143411 { sqlite3WithPush(pParse, yymsp[0].minor.yy451, 1); }
143412 break;
143413 case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
143414 {
143415 yymsp[-5].minor.yy451 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy387); /*A-overwrites-X*/
143416 }
143417 break;
143418 case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
143419 {
143420 yymsp[-7].minor.yy451 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy451, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy387);
143421 }
143422 break;
143423 default:
143424 /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
143425 /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
143426 /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
143427 /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
143428 /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
143429 /* (280) explain ::= */ yytestcase(yyruleno==280);
143430 /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
143431 /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
143432 /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
143433 /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
143434 /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
143435 /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
143436 /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
143437 /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
143438 /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
143439 /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
143440 /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
143441 /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
143442 /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
143443 /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
143444 /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
143445 /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
143446 /* (297) carglist ::= */ yytestcase(yyruleno==297);
143447 /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
143448 /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
143449 /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
143450 /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
143451 /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
143452 /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
143453 /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
143454 /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
143455 /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
143456 /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
143457 /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
143458 /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
143459 /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310);
143460 /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
143461 /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
143462 /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
143463 /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
143464 /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
143465 /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316);
143466 /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317);
143467 /* (318) foreach_clause ::= */ yytestcase(yyruleno==318);
143468 /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319);
143469 /* (320) trnm ::= nm */ yytestcase(yyruleno==320);
143470 /* (321) tridxby ::= */ yytestcase(yyruleno==321);
143471 /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322);
143472 /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323);
143473 /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324);
143474 /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325);
143475 /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326);
143476 /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327);
143477 /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328);
143478 /* (329) anylist ::= */ yytestcase(yyruleno==329);
143479 /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330);
143480 /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331);
143481 /* (332) with ::= */ yytestcase(yyruleno==332);
143482 break;
143483 /********** End reduce actions ************************************************/
143484 };
143485 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
143486 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -143497,20 +144453,22 @@
143497 yymsp += yysize+1;
143498 yypParser->yytos = yymsp;
143499 yymsp->stateno = (YYACTIONTYPE)yyact;
143500 yymsp->major = (YYCODETYPE)yygoto;
143501 yyTraceShift(yypParser, yyact, "... then shift");
 
143502 }
143503
143504 /*
143505 ** The following code executes when the parse fails
143506 */
143507 #ifndef YYNOERRORRECOVERY
143508 static void yy_parse_failed(
143509 yyParser *yypParser /* The parser */
143510 ){
143511 sqlite3ParserARG_FETCH;
 
143512 #ifndef NDEBUG
143513 if( yyTraceFILE ){
143514 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
143515 }
143516 #endif
@@ -143517,11 +144475,12 @@
143517 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
143518 /* Here code is inserted which will be executed whenever the
143519 ** parser fails */
143520 /************ Begin %parse_failure code ***************************************/
143521 /************ End %parse_failure code *****************************************/
143522 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
143523 }
143524 #endif /* YYNOERRORRECOVERY */
143525
143526 /*
143527 ** The following code executes when a syntax error first occurs.
@@ -143529,11 +144488,12 @@
143529 static void yy_syntax_error(
143530 yyParser *yypParser, /* The parser */
143531 int yymajor, /* The major type of the error token */
143532 sqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */
143533 ){
143534 sqlite3ParserARG_FETCH;
 
143535 #define TOKEN yyminor
143536 /************ Begin %syntax_error code ****************************************/
143537
143538 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
143539 if( TOKEN.z[0] ){
@@ -143540,20 +144500,22 @@
143540 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
143541 }else{
143542 sqlite3ErrorMsg(pParse, "incomplete input");
143543 }
143544 /************ End %syntax_error code ******************************************/
143545 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
143546 }
143547
143548 /*
143549 ** The following is executed when the parser accepts
143550 */
143551 static void yy_accept(
143552 yyParser *yypParser /* The parser */
143553 ){
143554 sqlite3ParserARG_FETCH;
 
143555 #ifndef NDEBUG
143556 if( yyTraceFILE ){
143557 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
143558 }
143559 #endif
@@ -143563,11 +144525,12 @@
143563 assert( yypParser->yytos==yypParser->yystack );
143564 /* Here code is inserted which will be executed whenever the
143565 ** parser accepts */
143566 /*********** Begin %parse_accept code *****************************************/
143567 /*********** End %parse_accept code *******************************************/
143568 sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
143569 }
143570
143571 /* The main parser program.
143572 ** The first argument is a pointer to a structure obtained from
143573 ** "sqlite3ParserAlloc" which describes the current state of the parser.
@@ -143592,49 +144555,51 @@
143592 int yymajor, /* The major token code number */
143593 sqlite3ParserTOKENTYPE yyminor /* The value for the token */
143594 sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */
143595 ){
143596 YYMINORTYPE yyminorunion;
143597 unsigned int yyact; /* The parser action. */
143598 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
143599 int yyendofinput; /* True if we are at the end of input */
143600 #endif
143601 #ifdef YYERRORSYMBOL
143602 int yyerrorhit = 0; /* True if yymajor has invoked an error */
143603 #endif
143604 yyParser *yypParser; /* The parser */
 
 
143605
143606 yypParser = (yyParser*)yyp;
143607 assert( yypParser->yytos!=0 );
143608 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
143609 yyendofinput = (yymajor==0);
143610 #endif
143611 sqlite3ParserARG_STORE;
143612
 
143613 #ifndef NDEBUG
143614 if( yyTraceFILE ){
143615 int stateno = yypParser->yytos->stateno;
143616 if( stateno < YY_MIN_REDUCE ){
143617 fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
143618 yyTracePrompt,yyTokenName[yymajor],stateno);
143619 }else{
143620 fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
143621 yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
143622 }
143623 }
143624 #endif
143625
143626 do{
143627 yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
 
143628 if( yyact >= YY_MIN_REDUCE ){
143629 yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
 
143630 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
143631 yy_shift(yypParser,yyact,yymajor,yyminor);
143632 #ifndef YYNOERRORRECOVERY
143633 yypParser->yyerrcnt--;
143634 #endif
143635 yymajor = YYNOCODE;
143636 }else if( yyact==YY_ACCEPT_ACTION ){
143637 yypParser->yytos--;
143638 yy_accept(yypParser);
143639 return;
143640 }else{
@@ -143701,10 +144666,12 @@
143701 yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
143702 }
143703 }
143704 yypParser->yyerrcnt = 3;
143705 yyerrorhit = 1;
 
 
143706 #elif defined(YYNOERRORRECOVERY)
143707 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
143708 ** do any kind of error recovery. Instead, simply invoke the syntax
143709 ** error routine and continue going as if nothing had happened.
143710 **
@@ -143711,12 +144678,11 @@
143711 ** Applications can set this macro (for example inside %include) if
143712 ** they intend to abandon the parse upon the first syntax error seen.
143713 */
143714 yy_syntax_error(yypParser,yymajor, yyminor);
143715 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
143716 yymajor = YYNOCODE;
143717
143718 #else /* YYERRORSYMBOL is not defined */
143719 /* This is what we do if the grammar does not define ERROR:
143720 **
143721 ** * Report an error message, and throw away the input token.
143722 **
@@ -143734,14 +144700,14 @@
143734 yy_parse_failed(yypParser);
143735 #ifndef YYNOERRORRECOVERY
143736 yypParser->yyerrcnt = -1;
143737 #endif
143738 }
143739 yymajor = YYNOCODE;
143740 #endif
143741 }
143742 }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
143743 #ifndef NDEBUG
143744 if( yyTraceFILE ){
143745 yyStackEntry *i;
143746 char cDiv = '[';
143747 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -143914,23 +144880,23 @@
143914 ** might be implemented more directly using a hand-written hash table.
143915 ** But by using this automatically generated code, the size of the code
143916 ** is substantially reduced. This is important for embedded applications
143917 ** on platforms with limited memory.
143918 */
143919 /* Hash score: 182 */
143920 /* zKWText[] encodes 834 bytes of keyword text in 554 bytes */
143921 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
143922 /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
143923 /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
143924 /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
143925 /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
143926 /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
143927 /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
143928 /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
143929 /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
143930 /* VACUUMVIEWINITIALLY */
143931 static const char zKWText[553] = {
143932 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
143933 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
143934 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
143935 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
143936 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
@@ -143940,86 +144906,87 @@
143940 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
143941 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
143942 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
143943 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
143944 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
143945 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
143946 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
143947 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
143948 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
143949 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
143950 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
143951 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
143952 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
143953 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
143954 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
143955 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
143956 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
143957 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
143958 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
143959 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
143960 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
143961 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
143962 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
 
143963 };
143964 /* aKWHash[i] is the hash value for the i-th keyword */
143965 static const unsigned char aKWHash[127] = {
143966 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
143967 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
143968 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
143969 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
143970 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
143971 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
143972 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
143973 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
143974 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
143975 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
143976 };
143977 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
143978 ** then the i-th keyword has no more hash collisions. Otherwise,
143979 ** the next keyword with the same hash is aKWHash[i]-1. */
143980 static const unsigned char aKWNext[124] = {
143981 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
143982 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
143983 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
143984 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
143985 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
143986 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
143987 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
143988 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
143989 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
143990 73, 83, 0, 35, 68, 0, 0,
143991 };
143992 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
143993 static const unsigned char aKWLen[124] = {
143994 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
143995 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
143996 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
143997 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
143998 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
143999 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
144000 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
144001 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
144002 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
144003 3, 5, 5, 6, 4, 9, 3,
144004 };
144005 /* aKWOffset[i] is the index into zKWText[] of the start of
144006 ** the text for the i-th keyword. */
144007 static const unsigned short int aKWOffset[124] = {
144008 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
144009 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
144010 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
144011 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
144012 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
144013 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
144014 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
144015 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
144016 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
144017 521, 524, 529, 534, 540, 544, 549,
144018 };
144019 /* aKWCode[i] is the parser symbol code for the i-th keyword */
144020 static const unsigned char aKWCode[124] = {
144021 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
144022 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
144023 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
144024 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
144025 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -144028,23 +144995,24 @@
144028 TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
144029 TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
144030 TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
144031 TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
144032 TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
144033 TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
144034 TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
144035 TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
144036 TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
144037 TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
144038 TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
144039 TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
144040 TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
144041 TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
144042 TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
144043 TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
144044 TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
144045 TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
 
144046 };
144047 /* Check to see if z[0..n-1] is a keyword. If it is, write the
144048 ** parser symbol code for that keyword into *pType. Always
144049 ** return the integer n (the length of the token). */
144050 static int keywordCode(const char *z, int n, int *pType){
@@ -144121,74 +145089,76 @@
144121 testcase( i==55 ); /* UPDATE */
144122 testcase( i==56 ); /* BEGIN */
144123 testcase( i==57 ); /* INNER */
144124 testcase( i==58 ); /* RECURSIVE */
144125 testcase( i==59 ); /* BETWEEN */
144126 testcase( i==60 ); /* NOTNULL */
144127 testcase( i==61 ); /* NOT */
144128 testcase( i==62 ); /* NO */
144129 testcase( i==63 ); /* NULL */
144130 testcase( i==64 ); /* LIKE */
144131 testcase( i==65 ); /* CASCADE */
144132 testcase( i==66 ); /* ASC */
144133 testcase( i==67 ); /* DELETE */
144134 testcase( i==68 ); /* CASE */
144135 testcase( i==69 ); /* COLLATE */
144136 testcase( i==70 ); /* CREATE */
144137 testcase( i==71 ); /* CURRENT_DATE */
144138 testcase( i==72 ); /* DETACH */
144139 testcase( i==73 ); /* IMMEDIATE */
144140 testcase( i==74 ); /* JOIN */
144141 testcase( i==75 ); /* INSERT */
144142 testcase( i==76 ); /* MATCH */
144143 testcase( i==77 ); /* PLAN */
144144 testcase( i==78 ); /* ANALYZE */
144145 testcase( i==79 ); /* PRAGMA */
144146 testcase( i==80 ); /* ABORT */
144147 testcase( i==81 ); /* VALUES */
144148 testcase( i==82 ); /* VIRTUAL */
144149 testcase( i==83 ); /* LIMIT */
144150 testcase( i==84 ); /* WHEN */
144151 testcase( i==85 ); /* WHERE */
144152 testcase( i==86 ); /* RENAME */
144153 testcase( i==87 ); /* AFTER */
144154 testcase( i==88 ); /* REPLACE */
144155 testcase( i==89 ); /* AND */
144156 testcase( i==90 ); /* DEFAULT */
144157 testcase( i==91 ); /* AUTOINCREMENT */
144158 testcase( i==92 ); /* TO */
144159 testcase( i==93 ); /* IN */
144160 testcase( i==94 ); /* CAST */
144161 testcase( i==95 ); /* COLUMN */
144162 testcase( i==96 ); /* COMMIT */
144163 testcase( i==97 ); /* CONFLICT */
144164 testcase( i==98 ); /* CROSS */
144165 testcase( i==99 ); /* CURRENT_TIMESTAMP */
144166 testcase( i==100 ); /* CURRENT_TIME */
144167 testcase( i==101 ); /* PRIMARY */
144168 testcase( i==102 ); /* DEFERRED */
144169 testcase( i==103 ); /* DISTINCT */
144170 testcase( i==104 ); /* IS */
144171 testcase( i==105 ); /* DROP */
144172 testcase( i==106 ); /* FAIL */
144173 testcase( i==107 ); /* FROM */
144174 testcase( i==108 ); /* FULL */
144175 testcase( i==109 ); /* GLOB */
144176 testcase( i==110 ); /* BY */
144177 testcase( i==111 ); /* IF */
144178 testcase( i==112 ); /* ISNULL */
144179 testcase( i==113 ); /* ORDER */
144180 testcase( i==114 ); /* RESTRICT */
144181 testcase( i==115 ); /* RIGHT */
144182 testcase( i==116 ); /* ROLLBACK */
144183 testcase( i==117 ); /* ROW */
144184 testcase( i==118 ); /* UNION */
144185 testcase( i==119 ); /* USING */
144186 testcase( i==120 ); /* VACUUM */
144187 testcase( i==121 ); /* VIEW */
144188 testcase( i==122 ); /* INITIALLY */
144189 testcase( i==123 ); /* ALL */
 
 
144190 *pType = aKWCode[i];
144191 break;
144192 }
144193 }
144194 return n;
@@ -144196,11 +145166,11 @@
144196 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
144197 int id = TK_ID;
144198 keywordCode((char*)z, n, &id);
144199 return id;
144200 }
144201 #define SQLITE_N_KEYWORD 124
144202
144203 /************** End of keywordhash.h *****************************************/
144204 /************** Continuing where we left off in tokenize.c *******************/
144205
144206
@@ -144553,13 +145523,13 @@
144553 pParse->zTail = zSql;
144554 assert( pzErrMsg!=0 );
144555 /* sqlite3ParserTrace(stdout, "parser: "); */
144556 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
144557 pEngine = &sEngine;
144558 sqlite3ParserInit(pEngine);
144559 #else
144560 pEngine = sqlite3ParserAlloc(sqlite3Malloc);
144561 if( pEngine==0 ){
144562 sqlite3OomFault(db);
144563 return SQLITE_NOMEM_BKPT;
144564 }
144565 #endif
@@ -144599,11 +145569,11 @@
144599 }
144600 zSql += n;
144601 }else{
144602 pParse->sLastToken.z = zSql;
144603 pParse->sLastToken.n = n;
144604 sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);
144605 lastTokenParsed = tokenType;
144606 zSql += n;
144607 if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
144608 }
144609 }
@@ -145706,10 +146676,21 @@
145706 case SQLITE_CONFIG_STMTJRNL_SPILL: {
145707 sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int);
145708 break;
145709 }
145710
 
 
 
 
 
 
 
 
 
 
 
145711 default: {
145712 rc = SQLITE_ERROR;
145713 break;
145714 }
145715 }
@@ -189765,12 +190746,14 @@
189765 ** for terminal symbols is called "fts5yy0".
189766 ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If
189767 ** zero the stack is dynamically sized using realloc()
189768 ** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument
189769 ** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument
 
189770 ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser
189771 ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
 
189772 ** fts5YYERRORSYMBOL is the code number of the error symbol. If not
189773 ** defined, then do no error processing.
189774 ** fts5YYNSTATE the combined number of states.
189775 ** fts5YYNRULE the number of rules in the grammar
189776 ** fts5YYNFTS5TOKEN Number of terminal symbols
@@ -189786,29 +190769,35 @@
189786 #ifndef INTERFACE
189787 # define INTERFACE 1
189788 #endif
189789 /************* Begin control #defines *****************************************/
189790 #define fts5YYCODETYPE unsigned char
189791 #define fts5YYNOCODE 29
189792 #define fts5YYACTIONTYPE unsigned char
189793 #define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token
189794 typedef union {
189795 int fts5yyinit;
189796 sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0;
189797 int fts5yy4;
189798 Fts5ExprPhrase* fts5yy11;
189799 Fts5ExprNearset* fts5yy14;
189800 Fts5Colset* fts5yy43;
189801 Fts5ExprNode* fts5yy54;
189802 } fts5YYMINORTYPE;
189803 #ifndef fts5YYSTACKDEPTH
189804 #define fts5YYSTACKDEPTH 100
189805 #endif
189806 #define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse;
189807 #define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse
189808 #define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse = fts5yypParser->pParse
189809 #define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse = pParse
 
 
 
 
 
 
189810 #define fts5YYNSTATE 35
189811 #define fts5YYNRULE 28
189812 #define fts5YYNFTS5TOKEN 16
189813 #define fts5YY_MAX_SHIFT 34
189814 #define fts5YY_MIN_SHIFTREDUCE 52
@@ -189885,50 +190874,50 @@
189885 *********** Begin parsing tables **********************************************/
189886 #define fts5YY_ACTTAB_COUNT (105)
189887 static const fts5YYACTIONTYPE fts5yy_action[] = {
189888 /* 0 */ 81, 20, 96, 6, 28, 99, 98, 26, 26, 18,
189889 /* 10 */ 96, 6, 28, 17, 98, 56, 26, 19, 96, 6,
189890 /* 20 */ 28, 14, 98, 108, 26, 92, 96, 6, 28, 25,
189891 /* 30 */ 98, 78, 26, 21, 96, 6, 28, 107, 98, 58,
189892 /* 40 */ 26, 29, 96, 6, 28, 32, 98, 22, 26, 24,
189893 /* 50 */ 16, 23, 11, 1, 14, 13, 24, 16, 31, 11,
189894 /* 60 */ 3, 97, 13, 27, 8, 98, 82, 26, 7, 4,
189895 /* 70 */ 5, 3, 4, 5, 3, 83, 4, 5, 3, 63,
189896 /* 80 */ 33, 34, 62, 12, 2, 86, 13, 10, 12, 71,
189897 /* 90 */ 10, 13, 78, 5, 3, 78, 9, 30, 75, 82,
189898 /* 100 */ 54, 57, 53, 57, 15,
189899 };
189900 static const fts5YYCODETYPE fts5yy_lookahead[] = {
189901 /* 0 */ 17, 18, 19, 20, 21, 23, 23, 25, 25, 18,
189902 /* 10 */ 19, 20, 21, 7, 23, 9, 25, 18, 19, 20,
189903 /* 20 */ 21, 9, 23, 27, 25, 18, 19, 20, 21, 25,
189904 /* 30 */ 23, 15, 25, 18, 19, 20, 21, 27, 23, 9,
189905 /* 40 */ 25, 18, 19, 20, 21, 14, 23, 22, 25, 6,
189906 /* 50 */ 7, 22, 9, 10, 9, 12, 6, 7, 13, 9,
189907 /* 60 */ 3, 19, 12, 21, 5, 23, 28, 25, 5, 1,
189908 /* 70 */ 2, 3, 1, 2, 3, 0, 1, 2, 3, 11,
189909 /* 80 */ 25, 26, 11, 9, 10, 5, 12, 10, 9, 11,
189910 /* 90 */ 10, 12, 15, 2, 3, 15, 24, 25, 9, 28,
189911 /* 100 */ 8, 9, 8, 9, 9, 28, 28, 28, 28, 28,
189912 /* 110 */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
189913 /* 120 */ 28,
189914 };
189915 #define fts5YY_SHIFT_COUNT (34)
189916 #define fts5YY_SHIFT_MIN (0)
189917 #define fts5YY_SHIFT_MAX (95)
189918 static const unsigned char fts5yy_shift_ofst[] = {
189919 /* 0 */ 43, 43, 43, 43, 43, 43, 50, 74, 79, 45,
189920 /* 10 */ 12, 80, 77, 12, 16, 16, 30, 30, 68, 71,
189921 /* 20 */ 75, 91, 92, 94, 6, 31, 31, 59, 63, 57,
189922 /* 30 */ 31, 89, 95, 31, 78,
189923 };
189924 #define fts5YY_REDUCE_COUNT (17)
189925 #define fts5YY_REDUCE_MIN (-18)
189926 #define fts5YY_REDUCE_MAX (72)
189927 static const signed char fts5yy_reduce_ofst[] = {
189928 /* 0 */ -17, -9, -1, 7, 15, 23, 42, -18, -18, 55,
189929 /* 10 */ 72, -4, -4, 4, -4, 10, 25, 29,
189930 };
189931 static const fts5YYACTIONTYPE fts5yy_default[] = {
189932 /* 0 */ 80, 80, 80, 80, 80, 80, 95, 80, 80, 105,
189933 /* 10 */ 80, 110, 110, 80, 110, 110, 80, 80, 80, 80,
189934 /* 20 */ 80, 91, 80, 80, 80, 101, 100, 80, 80, 90,
@@ -189989,10 +190978,11 @@
189989 #endif
189990 #ifndef fts5YYNOERRORRECOVERY
189991 int fts5yyerrcnt; /* Shifts left before out of the error */
189992 #endif
189993 sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */
 
189994 #if fts5YYSTACKDEPTH<=0
189995 int fts5yystksz; /* Current side of the stack */
189996 fts5yyStackEntry *fts5yystack; /* The parser's stack */
189997 fts5yyStackEntry fts5yystk0; /* First stack entry */
189998 #else
@@ -190052,22 +191042,21 @@
190052 /* 11 */ "RP",
190053 /* 12 */ "CARET",
190054 /* 13 */ "COMMA",
190055 /* 14 */ "PLUS",
190056 /* 15 */ "STAR",
190057 /* 16 */ "error",
190058 /* 17 */ "input",
190059 /* 18 */ "expr",
190060 /* 19 */ "cnearset",
190061 /* 20 */ "exprlist",
190062 /* 21 */ "colset",
190063 /* 22 */ "colsetlist",
190064 /* 23 */ "nearset",
190065 /* 24 */ "nearphrases",
190066 /* 25 */ "phrase",
190067 /* 26 */ "neardist_opt",
190068 /* 27 */ "star_opt",
190069 };
190070 #endif /* defined(fts5YYCOVERAGE) || !defined(NDEBUG) */
190071
190072 #ifndef NDEBUG
190073 /* For tracing reduce actions, the names of all rules are required.
@@ -190147,32 +191136,33 @@
190147 # define fts5YYMALLOCARGTYPE size_t
190148 #endif
190149
190150 /* Initialize a new parser that has already been allocated.
190151 */
190152 static void sqlite3Fts5ParserInit(void *fts5yypParser){
190153 fts5yyParser *pParser = (fts5yyParser*)fts5yypParser;
 
190154 #ifdef fts5YYTRACKMAXSTACKDEPTH
190155 pParser->fts5yyhwm = 0;
190156 #endif
190157 #if fts5YYSTACKDEPTH<=0
190158 pParser->fts5yytos = NULL;
190159 pParser->fts5yystack = NULL;
190160 pParser->fts5yystksz = 0;
190161 if( fts5yyGrowStack(pParser) ){
190162 pParser->fts5yystack = &pParser->fts5yystk0;
190163 pParser->fts5yystksz = 1;
190164 }
190165 #endif
190166 #ifndef fts5YYNOERRORRECOVERY
190167 pParser->fts5yyerrcnt = -1;
190168 #endif
190169 pParser->fts5yytos = pParser->fts5yystack;
190170 pParser->fts5yystack[0].stateno = 0;
190171 pParser->fts5yystack[0].major = 0;
190172 #if fts5YYSTACKDEPTH>0
190173 pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
190174 #endif
190175 }
190176
190177 #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
190178 /*
@@ -190185,15 +191175,18 @@
190185 **
190186 ** Outputs:
190187 ** A pointer to a parser. This pointer is used in subsequent calls
190188 ** to sqlite3Fts5Parser and sqlite3Fts5ParserFree.
190189 */
190190 static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){
190191 fts5yyParser *pParser;
190192 pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) );
190193 if( pParser ) sqlite3Fts5ParserInit(pParser);
190194 return pParser;
 
 
 
190195 }
190196 #endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */
190197
190198
190199 /* The following function deletes the "minor type" or semantic value
@@ -190206,11 +191199,12 @@
190206 static void fts5yy_destructor(
190207 fts5yyParser *fts5yypParser, /* The parser */
190208 fts5YYCODETYPE fts5yymajor, /* Type code for object to destroy */
190209 fts5YYMINORTYPE *fts5yypminor /* The object to be destroyed */
190210 ){
190211 sqlite3Fts5ParserARG_FETCH;
 
190212 switch( fts5yymajor ){
190213 /* Here is inserted the actions which take place when a
190214 ** terminal or non-terminal is destroyed. This can happen
190215 ** when the symbol is popped from the stack during a
190216 ** reduce or during error processing or when a parser is
@@ -190219,37 +191213,37 @@
190219 ** Note: during a reduce, the only symbols destroyed are those
190220 ** which appear on the RHS of the rule, but which are *not* used
190221 ** inside the C code.
190222 */
190223 /********* Begin destructor definitions ***************************************/
190224 case 17: /* input */
190225 {
190226 (void)pParse;
190227 }
190228 break;
190229 case 18: /* expr */
190230 case 19: /* cnearset */
190231 case 20: /* exprlist */
190232 {
190233 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy54));
190234 }
190235 break;
190236 case 21: /* colset */
190237 case 22: /* colsetlist */
190238 {
190239 sqlite3_free((fts5yypminor->fts5yy43));
190240 }
190241 break;
190242 case 23: /* nearset */
190243 case 24: /* nearphrases */
190244 {
190245 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy14));
190246 }
190247 break;
190248 case 25: /* phrase */
190249 {
190250 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy11));
190251 }
190252 break;
190253 /********* End destructor definitions *****************************************/
190254 default: break; /* If no destructor action specified: do nothing */
190255 }
@@ -190357,17 +191351,16 @@
190357
190358 /*
190359 ** Find the appropriate action for a parser given the terminal
190360 ** look-ahead token iLookAhead.
190361 */
190362 static unsigned int fts5yy_find_shift_action(
190363 fts5yyParser *pParser, /* The parser */
190364 fts5YYCODETYPE iLookAhead /* The look-ahead token */
190365 ){
190366 int i;
190367 int stateno = pParser->fts5yytos->stateno;
190368
190369 if( stateno>fts5YY_MAX_SHIFT ) return stateno;
190370 assert( stateno <= fts5YY_SHIFT_COUNT );
190371 #if defined(fts5YYCOVERAGE)
190372 fts5yycoverage[stateno][iLookAhead] = 1;
190373 #endif
@@ -190427,11 +191420,11 @@
190427 /*
190428 ** Find the appropriate action for a parser given the non-terminal
190429 ** look-ahead token iLookAhead.
190430 */
190431 static int fts5yy_find_reduce_action(
190432 int stateno, /* Current state number */
190433 fts5YYCODETYPE iLookAhead /* The look-ahead token */
190434 ){
190435 int i;
190436 #ifdef fts5YYERRORSYMBOL
190437 if( stateno>fts5YY_REDUCE_COUNT ){
@@ -190456,11 +191449,12 @@
190456
190457 /*
190458 ** The following routine is called if the stack overflows.
190459 */
190460 static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){
190461 sqlite3Fts5ParserARG_FETCH;
 
190462 #ifndef NDEBUG
190463 if( fts5yyTraceFILE ){
190464 fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt);
190465 }
190466 #endif
@@ -190469,11 +191463,12 @@
190469 ** stack every overflows */
190470 /******** Begin %stack_overflow code ******************************************/
190471
190472 sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
190473 /******** End %stack_overflow code ********************************************/
190474 sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
 
190475 }
190476
190477 /*
190478 ** Print tracing information for a SHIFT action
190479 */
@@ -190498,12 +191493,12 @@
190498 /*
190499 ** Perform a shift action.
190500 */
190501 static void fts5yy_shift(
190502 fts5yyParser *fts5yypParser, /* The parser to be shifted */
190503 int fts5yyNewState, /* The new state to shift in */
190504 int fts5yyMajor, /* The major token to shift in */
190505 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */
190506 ){
190507 fts5yyStackEntry *fts5yytos;
190508 fts5yypParser->fts5yytos++;
190509 #ifdef fts5YYTRACKMAXSTACKDEPTH
@@ -190529,12 +191524,12 @@
190529 #endif
190530 if( fts5yyNewState > fts5YY_MAX_SHIFT ){
190531 fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;
190532 }
190533 fts5yytos = fts5yypParser->fts5yytos;
190534 fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState;
190535 fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor;
190536 fts5yytos->minor.fts5yy0 = fts5yyMinor;
190537 fts5yyTraceShift(fts5yypParser, fts5yyNewState, "Shift");
190538 }
190539
190540 /* The following table contains information about every rule that
@@ -190542,38 +191537,38 @@
190542 */
190543 static const struct {
190544 fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
190545 signed char nrhs; /* Negative of the number of RHS symbols in the rule */
190546 } fts5yyRuleInfo[] = {
190547 { 17, -1 }, /* (0) input ::= expr */
190548 { 21, -4 }, /* (1) colset ::= MINUS LCP colsetlist RCP */
190549 { 21, -3 }, /* (2) colset ::= LCP colsetlist RCP */
190550 { 21, -1 }, /* (3) colset ::= STRING */
190551 { 21, -2 }, /* (4) colset ::= MINUS STRING */
190552 { 22, -2 }, /* (5) colsetlist ::= colsetlist STRING */
190553 { 22, -1 }, /* (6) colsetlist ::= STRING */
190554 { 18, -3 }, /* (7) expr ::= expr AND expr */
190555 { 18, -3 }, /* (8) expr ::= expr OR expr */
190556 { 18, -3 }, /* (9) expr ::= expr NOT expr */
190557 { 18, -5 }, /* (10) expr ::= colset COLON LP expr RP */
190558 { 18, -3 }, /* (11) expr ::= LP expr RP */
190559 { 18, -1 }, /* (12) expr ::= exprlist */
190560 { 20, -1 }, /* (13) exprlist ::= cnearset */
190561 { 20, -2 }, /* (14) exprlist ::= exprlist cnearset */
190562 { 19, -1 }, /* (15) cnearset ::= nearset */
190563 { 19, -3 }, /* (16) cnearset ::= colset COLON nearset */
190564 { 23, -1 }, /* (17) nearset ::= phrase */
190565 { 23, -2 }, /* (18) nearset ::= CARET phrase */
190566 { 23, -5 }, /* (19) nearset ::= STRING LP nearphrases neardist_opt RP */
190567 { 24, -1 }, /* (20) nearphrases ::= phrase */
190568 { 24, -2 }, /* (21) nearphrases ::= nearphrases phrase */
190569 { 26, 0 }, /* (22) neardist_opt ::= */
190570 { 26, -2 }, /* (23) neardist_opt ::= COMMA STRING */
190571 { 25, -4 }, /* (24) phrase ::= phrase PLUS STRING star_opt */
190572 { 25, -2 }, /* (25) phrase ::= STRING star_opt */
190573 { 27, -1 }, /* (26) star_opt ::= STAR */
190574 { 27, 0 }, /* (27) star_opt ::= */
190575 };
190576
190577 static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */
190578
190579 /*
@@ -190584,21 +191579,22 @@
190584 ** access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE
190585 ** if the lookahead token has already been consumed. As this procedure is
190586 ** only called from one place, optimizing compilers will in-line it, which
190587 ** means that the extra parameters have no performance impact.
190588 */
190589 static void fts5yy_reduce(
190590 fts5yyParser *fts5yypParser, /* The parser */
190591 unsigned int fts5yyruleno, /* Number of the rule by which to reduce */
190592 int fts5yyLookahead, /* Lookahead token, or fts5YYNOCODE if none */
190593 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */
 
190594 ){
190595 int fts5yygoto; /* The next state */
190596 int fts5yyact; /* The next action */
190597 fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */
190598 int fts5yysize; /* Amount to pop the stack */
190599 sqlite3Fts5ParserARG_FETCH;
190600 (void)fts5yyLookahead;
190601 (void)fts5yyLookaheadToken;
190602 fts5yymsp = fts5yypParser->fts5yytos;
190603 #ifndef NDEBUG
190604 if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
@@ -190625,17 +191621,23 @@
190625 }
190626 #endif
190627 #if fts5YYSTACKDEPTH>0
190628 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
190629 fts5yyStackOverflow(fts5yypParser);
190630 return;
 
 
 
190631 }
190632 #else
190633 if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
190634 if( fts5yyGrowStack(fts5yypParser) ){
190635 fts5yyStackOverflow(fts5yypParser);
190636 return;
 
 
 
190637 }
190638 fts5yymsp = fts5yypParser->fts5yytos;
190639 }
190640 #endif
190641 }
@@ -190650,142 +191652,142 @@
190650 ** break;
190651 */
190652 /********** Begin reduce actions **********************************************/
190653 fts5YYMINORTYPE fts5yylhsminor;
190654 case 0: /* input ::= expr */
190655 { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy54); }
190656 break;
190657 case 1: /* colset ::= MINUS LCP colsetlist RCP */
190658 {
190659 fts5yymsp[-3].minor.fts5yy43 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy43);
190660 }
190661 break;
190662 case 2: /* colset ::= LCP colsetlist RCP */
190663 { fts5yymsp[-2].minor.fts5yy43 = fts5yymsp[-1].minor.fts5yy43; }
190664 break;
190665 case 3: /* colset ::= STRING */
190666 {
190667 fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190668 }
190669 fts5yymsp[0].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
190670 break;
190671 case 4: /* colset ::= MINUS STRING */
190672 {
190673 fts5yymsp[-1].minor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190674 fts5yymsp[-1].minor.fts5yy43 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy43);
190675 }
190676 break;
190677 case 5: /* colsetlist ::= colsetlist STRING */
190678 {
190679 fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy43, &fts5yymsp[0].minor.fts5yy0); }
190680 fts5yymsp[-1].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
190681 break;
190682 case 6: /* colsetlist ::= STRING */
190683 {
190684 fts5yylhsminor.fts5yy43 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
190685 }
190686 fts5yymsp[0].minor.fts5yy43 = fts5yylhsminor.fts5yy43;
190687 break;
190688 case 7: /* expr ::= expr AND expr */
190689 {
190690 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
190691 }
190692 fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190693 break;
190694 case 8: /* expr ::= expr OR expr */
190695 {
190696 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
190697 }
190698 fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190699 break;
190700 case 9: /* expr ::= expr NOT expr */
190701 {
190702 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54, 0);
190703 }
190704 fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190705 break;
190706 case 10: /* expr ::= colset COLON LP expr RP */
190707 {
190708 sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy54, fts5yymsp[-4].minor.fts5yy43);
190709 fts5yylhsminor.fts5yy54 = fts5yymsp[-1].minor.fts5yy54;
190710 }
190711 fts5yymsp[-4].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190712 break;
190713 case 11: /* expr ::= LP expr RP */
190714 {fts5yymsp[-2].minor.fts5yy54 = fts5yymsp[-1].minor.fts5yy54;}
190715 break;
190716 case 12: /* expr ::= exprlist */
190717 case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
190718 {fts5yylhsminor.fts5yy54 = fts5yymsp[0].minor.fts5yy54;}
190719 fts5yymsp[0].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190720 break;
190721 case 14: /* exprlist ::= exprlist cnearset */
190722 {
190723 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy54, fts5yymsp[0].minor.fts5yy54);
190724 }
190725 fts5yymsp[-1].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190726 break;
190727 case 15: /* cnearset ::= nearset */
190728 {
190729 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy14);
190730 }
190731 fts5yymsp[0].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190732 break;
190733 case 16: /* cnearset ::= colset COLON nearset */
190734 {
190735 fts5yylhsminor.fts5yy54 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy14);
190736 sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy54, fts5yymsp[-2].minor.fts5yy43);
190737 }
190738 fts5yymsp[-2].minor.fts5yy54 = fts5yylhsminor.fts5yy54;
190739 break;
190740 case 17: /* nearset ::= phrase */
190741 { fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11); }
190742 fts5yymsp[0].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
190743 break;
190744 case 18: /* nearset ::= CARET phrase */
190745 {
190746 sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy11);
190747 fts5yymsp[-1].minor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11);
190748 }
190749 break;
190750 case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
190751 {
190752 sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
190753 sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy14, &fts5yymsp[-1].minor.fts5yy0);
190754 fts5yylhsminor.fts5yy14 = fts5yymsp[-2].minor.fts5yy14;
190755 }
190756 fts5yymsp[-4].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
190757 break;
190758 case 20: /* nearphrases ::= phrase */
190759 {
190760 fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy11);
190761 }
190762 fts5yymsp[0].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
190763 break;
190764 case 21: /* nearphrases ::= nearphrases phrase */
190765 {
190766 fts5yylhsminor.fts5yy14 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy14, fts5yymsp[0].minor.fts5yy11);
190767 }
190768 fts5yymsp[-1].minor.fts5yy14 = fts5yylhsminor.fts5yy14;
190769 break;
190770 case 22: /* neardist_opt ::= */
190771 { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
190772 break;
190773 case 23: /* neardist_opt ::= COMMA STRING */
190774 { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
190775 break;
190776 case 24: /* phrase ::= phrase PLUS STRING star_opt */
190777 {
190778 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy11, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
190779 }
190780 fts5yymsp[-3].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
190781 break;
190782 case 25: /* phrase ::= STRING star_opt */
190783 {
190784 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
190785 }
190786 fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
190787 break;
190788 case 26: /* star_opt ::= STAR */
190789 { fts5yymsp[0].minor.fts5yy4 = 1; }
190790 break;
190791 case 27: /* star_opt ::= */
@@ -190810,20 +191812,22 @@
190810 fts5yymsp += fts5yysize+1;
190811 fts5yypParser->fts5yytos = fts5yymsp;
190812 fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact;
190813 fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto;
190814 fts5yyTraceShift(fts5yypParser, fts5yyact, "... then shift");
 
190815 }
190816
190817 /*
190818 ** The following code executes when the parse fails
190819 */
190820 #ifndef fts5YYNOERRORRECOVERY
190821 static void fts5yy_parse_failed(
190822 fts5yyParser *fts5yypParser /* The parser */
190823 ){
190824 sqlite3Fts5ParserARG_FETCH;
 
190825 #ifndef NDEBUG
190826 if( fts5yyTraceFILE ){
190827 fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt);
190828 }
190829 #endif
@@ -190830,11 +191834,12 @@
190830 while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
190831 /* Here code is inserted which will be executed whenever the
190832 ** parser fails */
190833 /************ Begin %parse_failure code ***************************************/
190834 /************ End %parse_failure code *****************************************/
190835 sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
190836 }
190837 #endif /* fts5YYNOERRORRECOVERY */
190838
190839 /*
190840 ** The following code executes when a syntax error first occurs.
@@ -190842,29 +191847,32 @@
190842 static void fts5yy_syntax_error(
190843 fts5yyParser *fts5yypParser, /* The parser */
190844 int fts5yymajor, /* The major type of the error token */
190845 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */
190846 ){
190847 sqlite3Fts5ParserARG_FETCH;
 
190848 #define FTS5TOKEN fts5yyminor
190849 /************ Begin %syntax_error code ****************************************/
190850
190851 UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
190852 sqlite3Fts5ParseError(
190853 pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
190854 );
190855 /************ End %syntax_error code ******************************************/
190856 sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
190857 }
190858
190859 /*
190860 ** The following is executed when the parser accepts
190861 */
190862 static void fts5yy_accept(
190863 fts5yyParser *fts5yypParser /* The parser */
190864 ){
190865 sqlite3Fts5ParserARG_FETCH;
 
190866 #ifndef NDEBUG
190867 if( fts5yyTraceFILE ){
190868 fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt);
190869 }
190870 #endif
@@ -190874,11 +191882,12 @@
190874 assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack );
190875 /* Here code is inserted which will be executed whenever the
190876 ** parser accepts */
190877 /*********** Begin %parse_accept code *****************************************/
190878 /*********** End %parse_accept code *******************************************/
190879 sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
 
190880 }
190881
190882 /* The main parser program.
190883 ** The first argument is a pointer to a structure obtained from
190884 ** "sqlite3Fts5ParserAlloc" which describes the current state of the parser.
@@ -190903,49 +191912,51 @@
190903 int fts5yymajor, /* The major token code number */
190904 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */
190905 sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */
190906 ){
190907 fts5YYMINORTYPE fts5yyminorunion;
190908 unsigned int fts5yyact; /* The parser action. */
190909 #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
190910 int fts5yyendofinput; /* True if we are at the end of input */
190911 #endif
190912 #ifdef fts5YYERRORSYMBOL
190913 int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */
190914 #endif
190915 fts5yyParser *fts5yypParser; /* The parser */
 
 
190916
190917 fts5yypParser = (fts5yyParser*)fts5yyp;
190918 assert( fts5yypParser->fts5yytos!=0 );
190919 #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
190920 fts5yyendofinput = (fts5yymajor==0);
190921 #endif
190922 sqlite3Fts5ParserARG_STORE;
190923
 
190924 #ifndef NDEBUG
190925 if( fts5yyTraceFILE ){
190926 int stateno = fts5yypParser->fts5yytos->stateno;
190927 if( stateno < fts5YY_MIN_REDUCE ){
190928 fprintf(fts5yyTraceFILE,"%sInput '%s' in state %d\n",
190929 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],stateno);
190930 }else{
190931 fprintf(fts5yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
190932 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],stateno-fts5YY_MIN_REDUCE);
190933 }
190934 }
190935 #endif
190936
190937 do{
190938 fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor);
 
190939 if( fts5yyact >= fts5YY_MIN_REDUCE ){
190940 fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,fts5yyminor);
 
190941 }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
190942 fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor);
190943 #ifndef fts5YYNOERRORRECOVERY
190944 fts5yypParser->fts5yyerrcnt--;
190945 #endif
190946 fts5yymajor = fts5YYNOCODE;
190947 }else if( fts5yyact==fts5YY_ACCEPT_ACTION ){
190948 fts5yypParser->fts5yytos--;
190949 fts5yy_accept(fts5yypParser);
190950 return;
190951 }else{
@@ -191012,10 +192023,12 @@
191012 fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor);
191013 }
191014 }
191015 fts5yypParser->fts5yyerrcnt = 3;
191016 fts5yyerrorhit = 1;
 
 
191017 #elif defined(fts5YYNOERRORRECOVERY)
191018 /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to
191019 ** do any kind of error recovery. Instead, simply invoke the syntax
191020 ** error routine and continue going as if nothing had happened.
191021 **
@@ -191022,12 +192035,11 @@
191022 ** Applications can set this macro (for example inside %include) if
191023 ** they intend to abandon the parse upon the first syntax error seen.
191024 */
191025 fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor);
191026 fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);
191027 fts5yymajor = fts5YYNOCODE;
191028
191029 #else /* fts5YYERRORSYMBOL is not defined */
191030 /* This is what we do if the grammar does not define ERROR:
191031 **
191032 ** * Report an error message, and throw away the input token.
191033 **
@@ -191045,14 +192057,14 @@
191045 fts5yy_parse_failed(fts5yypParser);
191046 #ifndef fts5YYNOERRORRECOVERY
191047 fts5yypParser->fts5yyerrcnt = -1;
191048 #endif
191049 }
191050 fts5yymajor = fts5YYNOCODE;
191051 #endif
191052 }
191053 }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
191054 #ifndef NDEBUG
191055 if( fts5yyTraceFILE ){
191056 fts5yyStackEntry *i;
191057 char cDiv = '[';
191058 fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -205660,11 +206672,11 @@
205660 int nArg, /* Number of args */
205661 sqlite3_value **apUnused /* Function arguments */
205662 ){
205663 assert( nArg==0 );
205664 UNUSED_PARAM2(nArg, apUnused);
205665 sqlite3_result_text(pCtx, "fts5: 2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b", -1, SQLITE_TRANSIENT);
205666 }
205667
205668 static int fts5Init(sqlite3 *db){
205669 static const sqlite3_module fts5Mod = {
205670 /* iVersion */ 2,
@@ -209930,12 +210942,12 @@
209930 }
209931 #endif /* SQLITE_CORE */
209932 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
209933
209934 /************** End of stmt.c ************************************************/
209935 #if __LINE__!=209935
209936 #undef SQLITE_SOURCE_ID
209937 #define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd14alt2"
209938 #endif
209939 /* Return the source-id for this library */
209940 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
209941 /************************** End of sqlite3.c ******************************/
209942
--- 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.24.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.
@@ -308,10 +308,13 @@
308 #if SQLITE_ENABLE_SESSION
309 "ENABLE_SESSION",
310 #endif
311 #if SQLITE_ENABLE_SNAPSHOT
312 "ENABLE_SNAPSHOT",
313 #endif
314 #if SQLITE_ENABLE_SORTER_REFERENCES
315 "ENABLE_SORTER_REFERENCES",
316 #endif
317 #if SQLITE_ENABLE_SQLLOG
318 "ENABLE_SQLLOG",
319 #endif
320 #if defined(SQLITE_ENABLE_STAT4)
@@ -1145,13 +1148,13 @@
1148 **
1149 ** See also: [sqlite3_libversion()],
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.24.0"
1154 #define SQLITE_VERSION_NUMBER 3024000
1155 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -2952,10 +2955,26 @@
2955 ** Since many statement journals never become large, setting the spill
2956 ** threshold to a value such as 64KiB can greatly reduce the amount of
2957 ** I/O required to support statement rollback.
2958 ** The default value for this setting is controlled by the
2959 ** [SQLITE_STMTJRNL_SPILL] compile-time option.
2960 **
2961 ** [[SQLITE_CONFIG_SORTERREF_SIZE]]
2962 ** <dt>SQLITE_CONFIG_SORTERREF_SIZE
2963 ** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
2964 ** of type (int) - the new value of the sorter-reference size threshold.
2965 ** Usually, when SQLite uses an external sort to order records according
2966 ** to an ORDER BY clause, all fields required by the caller are present in the
2967 ** sorted records. However, if SQLite determines based on the declared type
2968 ** of a table column that its values are likely to be very large - larger
2969 ** than the configured sorter-reference size threshold - then a reference
2970 ** is stored in each sorted record and the required column values loaded
2971 ** from the database as records are returned in sorted order. The default
2972 ** value for this option is to never use this optimization. Specifying a
2973 ** negative value for this option restores the default behaviour.
2974 ** This option is only available if SQLite is compiled with the
2975 ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
2976 ** </dl>
2977 */
2978 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2979 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2980 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -2981,10 +3000,11 @@
3000 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
3001 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
3002 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
3003 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
3004 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
3005 #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
3006
3007 /*
3008 ** CAPI3REF: Database Connection Configuration Options
3009 **
3010 ** These constants are the available integer configuration options that
@@ -12939,111 +12959,113 @@
12959 #define TK_LT 56
12960 #define TK_GE 57
12961 #define TK_ESCAPE 58
12962 #define TK_ID 59
12963 #define TK_COLUMNKW 60
12964 #define TK_DO 61
12965 #define TK_FOR 62
12966 #define TK_IGNORE 63
12967 #define TK_INITIALLY 64
12968 #define TK_INSTEAD 65
12969 #define TK_NO 66
12970 #define TK_KEY 67
12971 #define TK_OF 68
12972 #define TK_OFFSET 69
12973 #define TK_PRAGMA 70
12974 #define TK_RAISE 71
12975 #define TK_RECURSIVE 72
12976 #define TK_REPLACE 73
12977 #define TK_RESTRICT 74
12978 #define TK_ROW 75
12979 #define TK_TRIGGER 76
12980 #define TK_VACUUM 77
12981 #define TK_VIEW 78
12982 #define TK_VIRTUAL 79
12983 #define TK_WITH 80
12984 #define TK_REINDEX 81
12985 #define TK_RENAME 82
12986 #define TK_CTIME_KW 83
12987 #define TK_ANY 84
12988 #define TK_BITAND 85
12989 #define TK_BITOR 86
12990 #define TK_LSHIFT 87
12991 #define TK_RSHIFT 88
12992 #define TK_PLUS 89
12993 #define TK_MINUS 90
12994 #define TK_STAR 91
12995 #define TK_SLASH 92
12996 #define TK_REM 93
12997 #define TK_CONCAT 94
12998 #define TK_COLLATE 95
12999 #define TK_BITNOT 96
13000 #define TK_ON 97
13001 #define TK_INDEXED 98
13002 #define TK_STRING 99
13003 #define TK_JOIN_KW 100
13004 #define TK_CONSTRAINT 101
13005 #define TK_DEFAULT 102
13006 #define TK_NULL 103
13007 #define TK_PRIMARY 104
13008 #define TK_UNIQUE 105
13009 #define TK_CHECK 106
13010 #define TK_REFERENCES 107
13011 #define TK_AUTOINCR 108
13012 #define TK_INSERT 109
13013 #define TK_DELETE 110
13014 #define TK_UPDATE 111
13015 #define TK_SET 112
13016 #define TK_DEFERRABLE 113
13017 #define TK_FOREIGN 114
13018 #define TK_DROP 115
13019 #define TK_UNION 116
13020 #define TK_ALL 117
13021 #define TK_EXCEPT 118
13022 #define TK_INTERSECT 119
13023 #define TK_SELECT 120
13024 #define TK_VALUES 121
13025 #define TK_DISTINCT 122
13026 #define TK_DOT 123
13027 #define TK_FROM 124
13028 #define TK_JOIN 125
13029 #define TK_USING 126
13030 #define TK_ORDER 127
13031 #define TK_GROUP 128
13032 #define TK_HAVING 129
13033 #define TK_LIMIT 130
13034 #define TK_WHERE 131
13035 #define TK_INTO 132
13036 #define TK_NOTHING 133
13037 #define TK_FLOAT 134
13038 #define TK_BLOB 135
13039 #define TK_INTEGER 136
13040 #define TK_VARIABLE 137
13041 #define TK_CASE 138
13042 #define TK_WHEN 139
13043 #define TK_THEN 140
13044 #define TK_ELSE 141
13045 #define TK_INDEX 142
13046 #define TK_ALTER 143
13047 #define TK_ADD 144
13048 #define TK_TRUEFALSE 145
13049 #define TK_ISNOT 146
13050 #define TK_FUNCTION 147
13051 #define TK_COLUMN 148
13052 #define TK_AGG_FUNCTION 149
13053 #define TK_AGG_COLUMN 150
13054 #define TK_UMINUS 151
13055 #define TK_UPLUS 152
13056 #define TK_TRUTH 153
13057 #define TK_REGISTER 154
13058 #define TK_VECTOR 155
13059 #define TK_SELECT_COLUMN 156
13060 #define TK_IF_NULL_ROW 157
13061 #define TK_ASTERISK 158
13062 #define TK_SPAN 159
13063 #define TK_END_OF_FILE 160
13064 #define TK_UNCLOSED_STRING 161
13065 #define TK_SPACE 162
13066 #define TK_ILLEGAL 163
13067
13068 /* The token codes above must all fit in 8 bits */
13069 #define TKFLG_MASK 0xff
13070
13071 /* Flags that can be added to a token code when it is not
@@ -13159,10 +13181,17 @@
13181 */
13182 #ifndef SQLITE_DEFAULT_PCACHE_INITSZ
13183 # define SQLITE_DEFAULT_PCACHE_INITSZ 20
13184 #endif
13185
13186 /*
13187 ** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option.
13188 */
13189 #ifndef SQLITE_DEFAULT_SORTERREF_SIZE
13190 # define SQLITE_DEFAULT_SORTERREF_SIZE 0x7fffffff
13191 #endif
13192
13193 /*
13194 ** The compile-time options SQLITE_MMAP_READWRITE and
13195 ** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
13196 ** You must choose one or the other (or neither) but not both.
13197 */
@@ -13617,10 +13646,11 @@
13646 typedef struct TreeView TreeView;
13647 typedef struct Trigger Trigger;
13648 typedef struct TriggerPrg TriggerPrg;
13649 typedef struct TriggerStep TriggerStep;
13650 typedef struct UnpackedRecord UnpackedRecord;
13651 typedef struct Upsert Upsert;
13652 typedef struct VTable VTable;
13653 typedef struct VtabCtx VtabCtx;
13654 typedef struct Walker Walker;
13655 typedef struct WhereInfo WhereInfo;
13656 typedef struct With With;
@@ -14274,26 +14304,26 @@
14304 #define OP_CollSeq 79
14305 #define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */
14306 #define OP_RealAffinity 81
14307 #define OP_Cast 82 /* synopsis: affinity(r[P1]) */
14308 #define OP_Permutation 83
14309 #define OP_Compare 84 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14310 #define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14311 #define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14312 #define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14313 #define OP_ShiftRight 88 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14314 #define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
14315 #define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14316 #define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14317 #define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14318 #define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14319 #define OP_Concat 94 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14320 #define OP_IsTrue 95 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14321 #define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
14322 #define OP_Offset 97 /* synopsis: r[P3] = sqlite_offset(P1) */
14323 #define OP_Column 98 /* synopsis: r[P3]=PX */
14324 #define OP_String8 99 /* same as TK_STRING, synopsis: r[P2]='P4' */
14325 #define OP_Affinity 100 /* synopsis: affinity(r[P1@P2]) */
14326 #define OP_MakeRecord 101 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
14327 #define OP_Count 102 /* synopsis: r[P2]=count() */
14328 #define OP_ReadCookie 103
14329 #define OP_SetCookie 104
@@ -14322,13 +14352,13 @@
14352 #define OP_SeekEnd 127
14353 #define OP_SorterInsert 128 /* synopsis: key=r[P2] */
14354 #define OP_IdxInsert 129 /* synopsis: key=r[P2] */
14355 #define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */
14356 #define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */
14357 #define OP_IdxRowid 132 /* synopsis: r[P2]=rowid */
14358 #define OP_Destroy 133
14359 #define OP_Real 134 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14360 #define OP_Clear 135
14361 #define OP_ResetSorter 136
14362 #define OP_CreateBtree 137 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14363 #define OP_SqlExec 138
14364 #define OP_ParseSchema 139
@@ -14383,13 +14413,13 @@
14413 /* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\
14414 /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
14415 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\
14416 /* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\
14417 /* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14418 /* 80 */ 0x02, 0x02, 0x02, 0x00, 0x00, 0x26, 0x26, 0x26,\
14419 /* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x12,\
14420 /* 96 */ 0x12, 0x20, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10,\
14421 /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14422 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14423 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14424 /* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\
14425 /* 136 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
@@ -14459,10 +14489,13 @@
14489 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
14490 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
14491 SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
14492 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
14493 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
14494 #ifdef SQLITE_COVERAGE_TEST
14495 SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe*,int);
14496 #endif
14497 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
14498 #ifdef SQLITE_DEBUG
14499 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
14500 #endif
14501 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15593,11 +15626,11 @@
15626 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
15627 u8 suppressErr; /* Do not issue error messages if true */
15628 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
15629 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
15630 u8 mTrace; /* zero or more SQLITE_TRACE flags */
15631 u8 noSharedCache; /* True if no shared-cache backends */
15632 u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
15633 int nextPagesize; /* Pagesize after VACUUM if >0 */
15634 u32 magic; /* Magic number for detect library misuse */
15635 int nChange; /* Value returned by sqlite3_changes() */
15636 int nTotalChange; /* Value returned by sqlite3_total_changes() */
@@ -15753,10 +15786,11 @@
15786 ** Allowed values for sqlite3.mDbFlags
15787 */
15788 #define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */
15789 #define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */
15790 #define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */
15791 #define DBFLAG_SchemaKnownOk 0x0008 /* Schema is known to be valid */
15792
15793 /*
15794 ** Bits of the sqlite3.dbOptFlags field that are used by the
15795 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
15796 ** selectively disable various optimizations.
@@ -15998,10 +16032,11 @@
16032 */
16033 #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
16034 #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
16035 #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
16036 #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
16037 #define COLFLAG_SORTERREF 0x0010 /* Use sorter-refs with this column */
16038
16039 /*
16040 ** A "Collating Sequence" is defined by an instance of the following
16041 ** structure. Conceptually, a collating sequence consists of a name and
16042 ** a comparison routine that defines the order of that sequence.
@@ -16285,17 +16320,16 @@
16320 #define OE_Rollback 1 /* Fail the operation and rollback the transaction */
16321 #define OE_Abort 2 /* Back out changes but do no rollback transaction */
16322 #define OE_Fail 3 /* Stop the operation but leave all prior changes */
16323 #define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */
16324 #define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */
16325 #define OE_Update 6 /* Process as a DO UPDATE in an upsert */
16326 #define OE_Restrict 7 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
16327 #define OE_SetNull 8 /* Set the foreign key value to NULL */
16328 #define OE_SetDflt 9 /* Set the foreign key value to its default */
16329 #define OE_Cascade 10 /* Cascade the changes */
16330 #define OE_Default 11 /* Do whatever the default action is */
 
16331
16332
16333 /*
16334 ** An instance of the following structure is passed as the first
16335 ** argument to sqlite3VdbeKeyCompare and is used to control the
@@ -16738,10 +16772,11 @@
16772 char *zSpan; /* Original text of the expression */
16773 u8 sortOrder; /* 1 for DESC or 0 for ASC */
16774 unsigned done :1; /* A flag to indicate when processing is finished */
16775 unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
16776 unsigned reusable :1; /* Constant expression is reusable */
16777 unsigned bSorterRef :1; /* Defer evaluation until after sorting */
16778 union {
16779 struct {
16780 u16 iOrderByCol; /* For ORDER BY, column number in result set */
16781 u16 iAlias; /* Index into Parse.aAlias[] for zName */
16782 } x;
@@ -16921,12 +16956,15 @@
16956 ** subqueries looking for a match.
16957 */
16958 struct NameContext {
16959 Parse *pParse; /* The parser */
16960 SrcList *pSrcList; /* One or more tables used to resolve names */
16961 union {
16962 ExprList *pEList; /* Optional list of result-set columns */
16963 AggInfo *pAggInfo; /* Information about aggregates at this level */
16964 Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */
16965 } uNC;
16966 NameContext *pNext; /* Next outer name context. NULL for outermost */
16967 int nRef; /* Number of names resolved by this context */
16968 int nErr; /* Number of errors encountered while resolving names */
16969 u16 ncFlags; /* Zero or more NC_* flags defined below */
16970 };
@@ -16944,12 +16982,45 @@
16982 #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
16983 #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
16984 #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
16985 #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
16986 #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
16987 #define NC_UEList 0x0080 /* True if uNC.pEList is used */
16988 #define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */
16989 #define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */
16990 #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
16991 #define NC_Complex 0x2000 /* True if a function or subquery seen */
16992
16993 /*
16994 ** An instance of the following object describes a single ON CONFLICT
16995 ** clause in an upsert.
16996 **
16997 ** The pUpsertTarget field is only set if the ON CONFLICT clause includes
16998 ** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the
16999 ** conflict-target clause.) The pUpsertTargetWhere is the optional
17000 ** WHERE clause used to identify partial unique indexes.
17001 **
17002 ** pUpsertSet is the list of column=expr terms of the UPDATE statement.
17003 ** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
17004 ** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
17005 ** WHERE clause is omitted.
17006 */
17007 struct Upsert {
17008 ExprList *pUpsertTarget; /* Optional description of conflicting index */
17009 Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
17010 ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
17011 Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
17012 /* The fields above comprise the parse tree for the upsert clause.
17013 ** The fields below are used to transfer information from the INSERT
17014 ** processing down into the UPDATE processing while generating code.
17015 ** Upsert owns the memory allocated above, but not the memory below. */
17016 Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */
17017 SrcList *pUpsertSrc; /* Table to be updated */
17018 int regData; /* First register holding array of VALUES */
17019 int iDataCur; /* Index of the data cursor */
17020 int iIdxCur; /* Index of the first index cursor */
17021 };
17022
17023 /*
17024 ** An instance of the following structure contains all information
17025 ** needed to generate code for a single SELECT statement.
17026 **
@@ -16975,10 +17046,11 @@
17046 LogEst nSelectRow; /* Estimated number of result rows */
17047 u32 selFlags; /* Various SF_* values */
17048 int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
17049 #if SELECTTRACE_ENABLED
17050 char zSelName[12]; /* Symbolic name of this SELECT use for debugging */
17051 u32 iSelectId; /* EXPLAIN QUERY PLAN select ID */
17052 #endif
17053 int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */
17054 SrcList *pSrc; /* The FROM clause */
17055 Expr *pWhere; /* The WHERE clause */
17056 ExprList *pGroupBy; /* The GROUP BY clause */
@@ -17446,12 +17518,13 @@
17518 u8 orconf; /* OE_Rollback etc. */
17519 Trigger *pTrig; /* The trigger that this step is a part of */
17520 Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
17521 char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
17522 Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
17523 ExprList *pExprList; /* SET clause for UPDATE */
17524 IdList *pIdList; /* Column names for INSERT */
17525 Upsert *pUpsert; /* Upsert clauses on an INSERT */
17526 char *zSpan; /* Original SQL text of this command */
17527 TriggerStep *pNext; /* Next in the link-list */
17528 TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */
17529 };
17530
@@ -17559,10 +17632,11 @@
17632 #ifndef SQLITE_UNTESTABLE
17633 int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
17634 #endif
17635 int bLocaltimeFault; /* True to fail localtime() calls */
17636 int iOnceResetThreshold; /* When to reset OP_Once counters */
17637 u32 szSorterRef; /* Min size in bytes to use sorter-refs */
17638 };
17639
17640 /*
17641 ** This macro is used inside of assert() statements to indicate that
17642 ** the assert is only valid on a well-formed database. Instead of:
@@ -17979,11 +18053,11 @@
18053 SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
18054 #else
18055 # define sqlite3AutoincrementBegin(X)
18056 # define sqlite3AutoincrementEnd(X)
18057 #endif
18058 SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*);
18059 SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
18060 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
18061 SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
18062 SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
18063 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
@@ -18009,11 +18083,12 @@
18083 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
18084 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
18085 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
18086 #endif
18087 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
18088 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
18089 Upsert*);
18090 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
18091 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
18092 SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
18093 SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
18094 SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
@@ -18102,11 +18177,11 @@
18177 Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int);
18178 SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int);
18179 SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);
18180 SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int);
18181 SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int,
18182 u8,u8,int,int*,int*,Upsert*);
18183 #ifdef SQLITE_ENABLE_NULL_TRIM
18184 SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*);
18185 #else
18186 # define sqlite3SetMakeRecordP5(A,B)
18187 #endif
@@ -18155,11 +18230,12 @@
18230 void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
18231 SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
18232 SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
18233 const char*,const char*);
18234 SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
18235 Select*,u8,Upsert*,
18236 const char*,const char*);
18237 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8,
18238 const char*,const char*);
18239 SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*,
18240 const char*,const char*);
18241 SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
@@ -18341,11 +18417,11 @@
18417 SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
18418 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
18419 SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
18420 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
18421 SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
18422 SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
18423 SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
18424 SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*);
18425 SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);
18426 SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);
18427 SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);
@@ -18403,14 +18479,14 @@
18479
18480 /*
18481 ** The interface to the LEMON-generated parser
18482 */
18483 #ifndef SQLITE_AMALGAMATION
18484 SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64), Parse*);
18485 SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*));
18486 #endif
18487 SQLITE_PRIVATE void sqlite3Parser(void*, int, Token);
18488 #ifdef YYTRACKMAXSTACKDEPTH
18489 SQLITE_PRIVATE int sqlite3ParserStackPeak(void*);
18490 #endif
18491
18492 SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*);
@@ -18494,10 +18570,22 @@
18570 SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
18571 #else
18572 #define sqlite3WithPush(x,y,z)
18573 #define sqlite3WithDelete(x,y)
18574 #endif
18575 #ifndef SQLITE_OMIT_UPSERT
18576 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
18577 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
18578 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
18579 SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
18580 SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
18581 #else
18582 #define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
18583 #define sqlite3UpsertDelete(x,y)
18584 #define sqlite3UpsertDup(x,y) ((Upsert*)0)
18585 #endif
18586
18587
18588 /* Declarations for functions in fkey.c. All of these are replaced by
18589 ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
18590 ** key functionality is available. If OMIT_TRIGGER is defined but
18591 ** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
@@ -18926,11 +19014,12 @@
19014 #endif
19015 #ifndef SQLITE_UNTESTABLE
19016 0, /* xTestCallback */
19017 #endif
19018 0, /* bLocaltimeFault */
19019 0x7ffffffe, /* iOnceResetThreshold */
19020 SQLITE_DEFAULT_SORTERREF_SIZE /* szSorterRef */
19021 };
19022
19023 /*
19024 ** Hash table for global functions - functions common to all
19025 ** database connections. After initialization, this table is
@@ -27499,15 +27588,17 @@
27588 for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){
27589 sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4);
27590 }
27591 sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
27592 }
27593 if( zFormat!=0 ){
27594 va_start(ap, zFormat);
27595 sqlite3VXPrintf(&acc, zFormat, ap);
27596 va_end(ap);
27597 assert( acc.nChar>0 );
27598 sqlite3StrAccumAppend(&acc, "\n", 1);
27599 }
27600 sqlite3StrAccumFinish(&acc);
27601 fprintf(stdout,"%s", zBuf);
27602 fflush(stdout);
27603 }
27604
@@ -27576,14 +27667,14 @@
27667 sqlite3TreeViewPush(pView, 1);
27668 }
27669 do{
27670 #if SELECTTRACE_ENABLED
27671 sqlite3TreeViewLine(pView,
27672 "SELECT%s%s (%s/%d/%p) selFlags=0x%x nSelectRow=%d",
27673 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
27674 ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
27675 p->zSelName, p->iSelectId, p, p->selFlags,
27676 (int)p->nSelectRow
27677 );
27678 #else
27679 sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d",
27680 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
@@ -27973,20 +28064,25 @@
28064 int i;
28065 sqlite3TreeViewLine(pView, "%s", zLabel);
28066 for(i=0; i<pList->nExpr; i++){
28067 int j = pList->a[i].u.x.iOrderByCol;
28068 char *zName = pList->a[i].zName;
28069 int moreToFollow = i<pList->nExpr - 1;
28070 if( j || zName ){
28071 sqlite3TreeViewPush(pView, moreToFollow);
28072 moreToFollow = 0;
28073 sqlite3TreeViewLine(pView, 0);
28074 if( zName ){
28075 fprintf(stdout, "AS %s ", zName);
28076 }
28077 if( j ){
28078 fprintf(stdout, "iOrderByCol=%d", j);
28079 }
28080 fprintf(stdout, "\n");
28081 fflush(stdout);
28082 }
28083 sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
28084 if( j || zName ){
28085 sqlite3TreeViewPop(pView);
28086 }
28087 }
28088 }
@@ -30948,26 +31044,26 @@
31044 /* 79 */ "CollSeq" OpHelp(""),
31045 /* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
31046 /* 81 */ "RealAffinity" OpHelp(""),
31047 /* 82 */ "Cast" OpHelp("affinity(r[P1])"),
31048 /* 83 */ "Permutation" OpHelp(""),
31049 /* 84 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31050 /* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
31051 /* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
31052 /* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
31053 /* 88 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
31054 /* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
31055 /* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
31056 /* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
31057 /* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
31058 /* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
31059 /* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
31060 /* 95 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31061 /* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
31062 /* 97 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31063 /* 98 */ "Column" OpHelp("r[P3]=PX"),
31064 /* 99 */ "String8" OpHelp("r[P2]='P4'"),
31065 /* 100 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
31066 /* 101 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
31067 /* 102 */ "Count" OpHelp("r[P2]=count()"),
31068 /* 103 */ "ReadCookie" OpHelp(""),
31069 /* 104 */ "SetCookie" OpHelp(""),
@@ -30996,13 +31092,13 @@
31092 /* 127 */ "SeekEnd" OpHelp(""),
31093 /* 128 */ "SorterInsert" OpHelp("key=r[P2]"),
31094 /* 129 */ "IdxInsert" OpHelp("key=r[P2]"),
31095 /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31096 /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31097 /* 132 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31098 /* 133 */ "Destroy" OpHelp(""),
31099 /* 134 */ "Real" OpHelp("r[P2]=P4"),
31100 /* 135 */ "Clear" OpHelp(""),
31101 /* 136 */ "ResetSorter" OpHelp(""),
31102 /* 137 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
31103 /* 138 */ "SqlExec" OpHelp(""),
31104 /* 139 */ "ParseSchema" OpHelp(""),
@@ -61480,14 +61576,14 @@
61576 if( p && p->sharable ){
61577 sqlite3BtreeEnter(p);
61578 skipOk = 0;
61579 }
61580 }
61581 db->noSharedCache = skipOk;
61582 }
61583 SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
61584 if( db->noSharedCache==0 ) btreeEnterAll(db);
61585 }
61586 static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){
61587 int i;
61588 Btree *p;
61589 assert( sqlite3_mutex_held(db->mutex) );
@@ -61495,11 +61591,11 @@
61591 p = db->aDb[i].pBt;
61592 if( p ) sqlite3BtreeLeave(p);
61593 }
61594 }
61595 SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
61596 if( db->noSharedCache==0 ) btreeLeaveAll(db);
61597 }
61598
61599 #ifndef NDEBUG
61600 /*
61601 ** Return true if the current thread holds the database connection
@@ -73871,16 +73967,20 @@
73967 assert( zVal[nVal]=='\'' );
73968 sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
73969 0, SQLITE_DYNAMIC);
73970 }
73971 #endif
 
73972 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
73973 else if( op==TK_FUNCTION && pCtx!=0 ){
73974 rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx);
73975 }
73976 #endif
73977 else if( op==TK_TRUEFALSE ){
73978 pVal = valueNew(db, pCtx);
73979 pVal->flags = MEM_Int;
73980 pVal->u.i = pExpr->u.zToken[4]==0;
73981 }
73982
73983 *ppVal = pVal;
73984 return rc;
73985
73986 no_mem:
@@ -74624,14 +74724,33 @@
74724 int j = ADDR(x);
74725 assert( v->magic==VDBE_MAGIC_INIT );
74726 assert( j<p->nLabel );
74727 assert( j>=0 );
74728 if( p->aLabel ){
74729 #ifdef SQLITE_DEBUG
74730 if( p->db->flags & SQLITE_VdbeAddopTrace ){
74731 printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
74732 }
74733 #endif
74734 assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
74735 p->aLabel[j] = v->nOp;
74736 }
74737 }
74738
74739 #ifdef SQLITE_COVERAGE_TEST
74740 /*
74741 ** Return TRUE if and only if the label x has already been resolved.
74742 ** Return FALSE (zero) if label x is still unresolved.
74743 **
74744 ** This routine is only used inside of testcase() macros, and so it
74745 ** only exists when measuring test coverage.
74746 */
74747 SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe *v, int x){
74748 return v->pParse->aLabel && v->pParse->aLabel[ADDR(x)]>=0;
74749 }
74750 #endif /* SQLITE_COVERAGE_TEST */
74751
74752 /*
74753 ** Mark the VDBE as one that can only be run one time.
74754 */
74755 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
74756 p->runOnlyOnce = 1;
@@ -75858,10 +75977,13 @@
75977 **
75978 ** When p->explain==1, each instruction is listed. When
75979 ** p->explain==2, only OP_Explain instructions are listed and these
75980 ** are shown in a different format. p->explain==2 is used to implement
75981 ** EXPLAIN QUERY PLAN.
75982 ** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers
75983 ** are also shown, so that the boundaries between the main program and
75984 ** each trigger are clear.
75985 **
75986 ** When p->explain==1, first the main program is listed, then each of
75987 ** the trigger subprograms are listed one by one.
75988 */
75989 SQLITE_PRIVATE int sqlite3VdbeList(
@@ -75920,11 +76042,11 @@
76042 for(i=0; i<nSub; i++){
76043 nRow += apSub[i]->nOp;
76044 }
76045 }
76046
76047 while(1){ /* Loop exits via break */
76048 i = p->pc++;
76049 if( i>=nRow ){
76050 p->rc = SQLITE_OK;
76051 rc = SQLITE_DONE;
76052 break;
@@ -75966,11 +76088,14 @@
76088 pSub->flags |= MEM_Blob;
76089 pSub->n = nSub*sizeof(SubProgram*);
76090 nRow += pOp->p4.pProgram->nOp;
76091 }
76092 }
76093 if( p->explain<2 ) break;
76094 if( pOp->opcode==OP_Explain ) break;
76095 if( pOp->opcode==OP_Init && p->pc>1 ) break;
76096 }
76097
76098 if( rc==SQLITE_OK ){
76099 if( db->u1.isInterrupted ){
76100 p->rc = SQLITE_INTERRUPT;
76101 rc = SQLITE_ERROR;
@@ -92644,11 +92769,11 @@
92769 sqlite3 *db = pParse->db; /* The database connection */
92770 struct SrcList_item *pItem; /* Use for looping over pSrcList items */
92771 struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
92772 NameContext *pTopNC = pNC; /* First namecontext in the list */
92773 Schema *pSchema = 0; /* Schema of the expression */
92774 int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
92775 Table *pTab = 0; /* Table hold the row */
92776 Column *pCol; /* A column of pTab */
92777
92778 assert( pNC ); /* the name context cannot be NULL. */
92779 assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
@@ -92749,26 +92874,39 @@
92874 }
92875 pSchema = pExpr->pTab->pSchema;
92876 }
92877 } /* if( pSrcList ) */
92878
92879 #if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
92880 /* If we have not already resolved the name, then maybe
92881 ** it is a new.* or old.* trigger argument reference. Or
92882 ** maybe it is an excluded.* from an upsert.
92883 */
92884 if( zDb==0 && zTab!=0 && cntTab==0 ){
92885 pTab = 0;
92886 #ifndef SQLITE_OMIT_TRIGGER
92887 if( pParse->pTriggerTab!=0 ){
92888 int op = pParse->eTriggerOp;
92889 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
92890 if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
92891 pExpr->iTable = 1;
92892 pTab = pParse->pTriggerTab;
92893 }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
92894 pExpr->iTable = 0;
92895 pTab = pParse->pTriggerTab;
92896 }
92897 }
92898 #endif /* SQLITE_OMIT_TRIGGER */
92899 #ifndef SQLITE_OMIT_UPSERT
92900 if( (pNC->ncFlags & NC_UUpsert)!=0 ){
92901 Upsert *pUpsert = pNC->uNC.pUpsert;
92902 if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
92903 pTab = pUpsert->pUpsertSrc->a[0].pTab;
92904 pExpr->iTable = 2;
92905 }
92906 }
92907 #endif /* SQLITE_OMIT_UPSERT */
92908
92909 if( pTab ){
92910 int iCol;
92911 pSchema = pTab->pSchema;
92912 cntTab++;
@@ -92784,28 +92922,39 @@
92922 /* IMP: R-51414-32910 */
92923 iCol = -1;
92924 }
92925 if( iCol<pTab->nCol ){
92926 cnt++;
92927 #ifndef SQLITE_OMIT_UPSERT
92928 if( pExpr->iTable==2 ){
92929 testcase( iCol==(-1) );
92930 pExpr->iTable = pNC->uNC.pUpsert->regData + iCol;
92931 eNewExprOp = TK_REGISTER;
92932 }else
92933 #endif /* SQLITE_OMIT_UPSERT */
92934 {
92935 #ifndef SQLITE_OMIT_TRIGGER
92936 if( iCol<0 ){
92937 pExpr->affinity = SQLITE_AFF_INTEGER;
92938 }else if( pExpr->iTable==0 ){
92939 testcase( iCol==31 );
92940 testcase( iCol==32 );
92941 pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92942 }else{
92943 testcase( iCol==31 );
92944 testcase( iCol==32 );
92945 pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));
92946 }
92947 pExpr->pTab = pTab;
92948 pExpr->iColumn = (i16)iCol;
92949 eNewExprOp = TK_TRIGGER;
92950 #endif /* SQLITE_OMIT_TRIGGER */
92951 }
92952 }
92953 }
92954 }
92955 #endif /* !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT) */
92956
92957 /*
92958 ** Perhaps the name is a reference to the ROWID
92959 */
92960 if( cnt==0
@@ -92836,14 +92985,16 @@
92985 ** or HAVING clauses, or as part of a larger expression in the ORDER BY
92986 ** clause is not standard SQL. This is a (goofy) SQLite extension, that
92987 ** is supported for backwards compatibility only. Hence, we issue a warning
92988 ** on sqlite3_log() whenever the capability is used.
92989 */
92990 if( (pNC->ncFlags & NC_UEList)!=0
 
92991 && cnt==0
92992 && zTab==0
92993 ){
92994 pEList = pNC->uNC.pEList;
92995 assert( pEList!=0 );
92996 for(j=0; j<pEList->nExpr; j++){
92997 char *zAs = pEList->a[j].zName;
92998 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
92999 Expr *pOrig;
93000 assert( pExpr->pLeft==0 && pExpr->pRight==0 );
@@ -92936,11 +93087,11 @@
93087 */
93088 sqlite3ExprDelete(db, pExpr->pLeft);
93089 pExpr->pLeft = 0;
93090 sqlite3ExprDelete(db, pExpr->pRight);
93091 pExpr->pRight = 0;
93092 pExpr->op = eNewExprOp;
93093 ExprSetProperty(pExpr, EP_Leaf);
93094 lookupname_end:
93095 if( cnt==1 ){
93096 assert( pNC!=0 );
93097 if( !ExprHasProperty(pExpr, EP_Alias) ){
@@ -93368,12 +93519,12 @@
93519 /* Resolve all names in the ORDER BY term expression
93520 */
93521 memset(&nc, 0, sizeof(nc));
93522 nc.pParse = pParse;
93523 nc.pSrcList = pSelect->pSrc;
93524 nc.uNC.pEList = pEList;
93525 nc.ncFlags = NC_AllowAgg|NC_UEList;
93526 nc.nErr = 0;
93527 db = pParse->db;
93528 savedSuppErr = db->suppressErr;
93529 db->suppressErr = 1;
93530 rc = sqlite3ResolveExprNames(&nc, pE);
@@ -93752,11 +93903,13 @@
93903 ** aliases in the result set.
93904 **
93905 ** Minor point: If this is the case, then the expression will be
93906 ** re-evaluated for each reference to it.
93907 */
93908 assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
93909 sNC.uNC.pEList = p->pEList;
93910 sNC.ncFlags |= NC_UEList;
93911 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
93912 if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
93913
93914 /* Resolve names in table-valued-function arguments */
93915 for(i=0; i<p->pSrc->nSrc; i++){
@@ -93985,11 +94138,11 @@
94138 SQLITE_PRIVATE void sqlite3ResolveSelfReference(
94139 Parse *pParse, /* Parsing context */
94140 Table *pTab, /* The table being referenced */
94141 int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */
94142 Expr *pExpr, /* Expression to resolve. May be NULL. */
94143 ExprList *pList /* Expression list to resolve. May be NULL. */
94144 ){
94145 SrcList sSrc; /* Fake SrcList for pParse->pNewTable */
94146 NameContext sNC; /* Name context for pParse->pNewTable */
94147
94148 assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr );
@@ -95371,10 +95524,11 @@
95524 pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
95525 pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);
95526 pItem->sortOrder = pOldItem->sortOrder;
95527 pItem->done = 0;
95528 pItem->bSpanIsTab = pOldItem->bSpanIsTab;
95529 pItem->bSorterRef = pOldItem->bSorterRef;
95530 pItem->u = pOldItem->u;
95531 }
95532 return pNew;
95533 }
95534
@@ -95833,10 +95987,12 @@
95987 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
95988 return WRC_Continue;
95989 }
95990 /* Fall through */
95991 case TK_IF_NULL_ROW:
95992 case TK_REGISTER:
95993 testcase( pExpr->op==TK_REGISTER );
95994 testcase( pExpr->op==TK_IF_NULL_ROW );
95995 pWalker->eCode = 0;
95996 return WRC_Abort;
95997 case TK_VARIABLE:
95998 if( pWalker->eCode==5 ){
@@ -95850,12 +96006,12 @@
96006 pWalker->eCode = 0;
96007 return WRC_Abort;
96008 }
96009 /* Fall through */
96010 default:
96011 testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail() disallows */
96012 testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail() disallows */
96013 return WRC_Continue;
96014 }
96015 }
96016 static int exprIsConst(Expr *p, int initFlag, int iCur){
96017 Walker w;
@@ -96614,21 +96770,10 @@
96770 */
96771 if( !ExprHasProperty(pExpr, EP_VarSelect) ){
96772 jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
96773 }
96774
 
 
 
 
 
 
 
 
 
 
 
96775 switch( pExpr->op ){
96776 case TK_IN: {
96777 int addr; /* Address of OP_OpenEphemeral instruction */
96778 Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */
96779 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -96661,10 +96806,21 @@
96806 ** Generate code to write the results of the select into the temporary
96807 ** table allocated and opened above.
96808 */
96809 Select *pSelect = pExpr->x.pSelect;
96810 ExprList *pEList = pSelect->pEList;
96811
96812 #ifndef SQLITE_OMIT_EXPLAIN
96813 if( pParse->explain==2 ){
96814 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sLIST SUBQUERY %d",
96815 jmpIfDynamic>=0?"":"CORRELATED ",
96816 pParse->iNextSelectId
96817 );
96818 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg,
96819 P4_DYNAMIC);
96820 }
96821 #endif
96822
96823 assert( !isRowid );
96824 /* If the LHS and RHS of the IN operator do not match, that
96825 ** error will have been caught long before we reach this point. */
96826 if( ALWAYS(pEList->nExpr==nVal) ){
@@ -96703,11 +96859,10 @@
96859 char affinity; /* Affinity of the LHS of the IN */
96860 int i;
96861 ExprList *pList = pExpr->x.pList;
96862 struct ExprList_item *pItem;
96863 int r1, r2, r3;
 
96864 affinity = sqlite3ExprAffinity(pLeft);
96865 if( !affinity ){
96866 affinity = SQLITE_AFF_BLOB;
96867 }
96868 if( pKeyInfo ){
@@ -96782,10 +96937,21 @@
96937
96938 testcase( pExpr->op==TK_EXISTS );
96939 testcase( pExpr->op==TK_SELECT );
96940 assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );
96941 assert( ExprHasProperty(pExpr, EP_xIsSelect) );
96942
96943 #ifndef SQLITE_OMIT_EXPLAIN
96944 if( pParse->explain==2 ){
96945 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sSCALAR SUBQUERY %d",
96946 jmpIfDynamic>=0?"":"CORRELATED ",
96947 pParse->iNextSelectId
96948 );
96949 sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg,
96950 P4_DYNAMIC);
96951 }
96952 #endif
96953
96954 pSel = pExpr->x.pSelect;
96955 nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
96956 sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);
96957 pParse->nMem += nReg;
@@ -98379,10 +98545,16 @@
98545 assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */
98546 n = pList->nExpr;
98547 if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;
98548 for(pItem=pList->a, i=0; i<n; i++, pItem++){
98549 Expr *pExpr = pItem->pExpr;
98550 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
98551 if( pItem->bSorterRef ){
98552 i--;
98553 n--;
98554 }else
98555 #endif
98556 if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
98557 if( flags & SQLITE_ECEL_OMITREF ){
98558 i--;
98559 n--;
98560 }else{
@@ -98907,21 +99079,24 @@
99079 return 2;
99080 }
99081 if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
99082 if( pA->op==TK_FUNCTION ){
99083 if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
99084 }else if( pA->op==TK_COLLATE ){
99085 if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
99086 }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
99087 return 2;
99088 }
99089 }
99090 if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
99091 if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
99092 if( combinedFlags & EP_xIsSelect ) return 2;
99093 if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
99094 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
99095 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
99096 assert( (combinedFlags & EP_Reduced)==0 );
99097 if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
99098 if( pA->iColumn!=pB->iColumn ) return 2;
99099 if( pA->iTable!=pB->iTable
99100 && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
99101 }
99102 }
@@ -99263,12 +99438,13 @@
99438 static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
99439 int i;
99440 NameContext *pNC = pWalker->u.pNC;
99441 Parse *pParse = pNC->pParse;
99442 SrcList *pSrcList = pNC->pSrcList;
99443 AggInfo *pAggInfo = pNC->uNC.pAggInfo;
99444
99445 assert( pNC->ncFlags & NC_UAggInfo );
99446 switch( pExpr->op ){
99447 case TK_AGG_COLUMN:
99448 case TK_COLUMN: {
99449 testcase( pExpr->op==TK_AGG_COLUMN );
99450 testcase( pExpr->op==TK_COLUMN );
@@ -102434,11 +102610,11 @@
102610 flags |= SQLITE_OPEN_MAIN_DB;
102611 rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
102612 sqlite3_free( zPath );
102613 db->nDb++;
102614 }
102615 db->noSharedCache = 0;
102616 if( rc==SQLITE_CONSTRAINT ){
102617 rc = SQLITE_ERROR;
102618 zErrDyn = sqlite3MPrintf(db, "database is already attached");
102619 }else if( rc==SQLITE_OK ){
102620 Pager *pPager;
@@ -102506,10 +102682,11 @@
102682 ** way we found it.
102683 */
102684 if( rc==SQLITE_OK ){
102685 sqlite3BtreeEnterAll(db);
102686 db->init.iDb = 0;
102687 db->mDbFlags &= ~(DBFLAG_SchemaKnownOk);
102688 rc = sqlite3Init(db, &zErrDyn);
102689 sqlite3BtreeLeaveAll(db);
102690 assert( zErrDyn==0 || rc!=SQLITE_OK );
102691 }
102692 #ifdef SQLITE_USER_AUTHENTICATION
@@ -102778,10 +102955,13 @@
102955 }
102956 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102957 if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
102958 if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
102959 #endif
102960 if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){
102961 return 1;
102962 }
102963 }
102964 return 0;
102965 }
102966 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
102967 SQLITE_PRIVATE int sqlite3FixSelect(
@@ -102877,10 +103057,22 @@
103057 return 1;
103058 }
103059 if( sqlite3FixExprList(pFix, pStep->pExprList) ){
103060 return 1;
103061 }
103062 #ifndef SQLITE_OMIT_UPSERT
103063 if( pStep->pUpsert ){
103064 Upsert *pUp = pStep->pUpsert;
103065 if( sqlite3FixExprList(pFix, pUp->pUpsertTarget)
103066 || sqlite3FixExpr(pFix, pUp->pUpsertTargetWhere)
103067 || sqlite3FixExprList(pFix, pUp->pUpsertSet)
103068 || sqlite3FixExpr(pFix, pUp->pUpsertWhere)
103069 ){
103070 return 1;
103071 }
103072 }
103073 #endif
103074 pStep = pStep->pNext;
103075 }
103076 return 0;
103077 }
103078 #endif
@@ -103504,28 +103696,31 @@
103696 u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */
103697 const char *zName, /* Name of the table we are looking for */
103698 const char *zDbase /* Name of the database. Might be NULL */
103699 ){
103700 Table *p;
103701 sqlite3 *db = pParse->db;
103702
103703 /* Read the database schema. If an error occurs, leave an error message
103704 ** and code in pParse and return NULL. */
103705 if( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0
103706 && SQLITE_OK!=sqlite3ReadSchema(pParse)
103707 ){
103708 return 0;
103709 }
103710
103711 p = sqlite3FindTable(db, zName, zDbase);
103712 if( p==0 ){
103713 const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table";
103714 #ifndef SQLITE_OMIT_VIRTUALTABLE
103715 if( sqlite3FindDbName(db, zDbase)<1 ){
103716 /* If zName is the not the name of a table in the schema created using
103717 ** CREATE, then check to see if it is the name of an virtual table that
103718 ** can be an eponymous virtual table. */
103719 Module *pMod = (Module*)sqlite3HashFind(&db->aModule, zName);
103720 if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
103721 pMod = sqlite3PragmaVtabRegister(db, zName);
103722 }
103723 if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
103724 return pMod->pEpoTab;
103725 }
103726 }
@@ -103686,10 +103881,11 @@
103881
103882 if( iDb>=0 ){
103883 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
103884 DbSetProperty(db, iDb, DB_ResetWanted);
103885 DbSetProperty(db, 1, DB_ResetWanted);
103886 db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
103887 }
103888
103889 if( db->nSchemaLock==0 ){
103890 for(i=0; i<db->nDb; i++){
103891 if( DbHasProperty(db, i, DB_ResetWanted) ){
@@ -103711,11 +103907,11 @@
103907 Db *pDb = &db->aDb[i];
103908 if( pDb->pSchema ){
103909 sqlite3SchemaClear(pDb->pSchema);
103910 }
103911 }
103912 db->mDbFlags &= ~(DBFLAG_SchemaChange|DBFLAG_SchemaKnownOk);
103913 sqlite3VtabUnlockList(db);
103914 sqlite3BtreeLeaveAll(db);
103915 sqlite3CollapseDatabaseArray(db);
103916 }
103917
@@ -104256,19 +104452,24 @@
104452 pCol->zName = z;
104453 sqlite3ColumnPropertiesFromName(p, pCol);
104454
104455 if( pType->n==0 ){
104456 /* If there is no type specified, columns have the default affinity
104457 ** 'BLOB' with a default size of 4 bytes. */
104458 pCol->affinity = SQLITE_AFF_BLOB;
104459 pCol->szEst = 1;
104460 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
104461 if( 4>=sqlite3GlobalConfig.szSorterRef ){
104462 pCol->colFlags |= COLFLAG_SORTERREF;
104463 }
104464 #endif
104465 }else{
104466 zType = z + sqlite3Strlen30(z) + 1;
104467 memcpy(zType, pType->z, pType->n);
104468 zType[pType->n] = 0;
104469 sqlite3Dequote(zType);
104470 pCol->affinity = sqlite3AffinityType(zType, pCol);
104471 pCol->colFlags |= COLFLAG_HASTYPE;
104472 }
104473 p->nCol++;
104474 pParse->constraintName.n = 0;
104475 }
@@ -104324,11 +104525,11 @@
104525 ** 'DOUB' | SQLITE_AFF_REAL
104526 **
104527 ** If none of the substrings in the above table are found,
104528 ** SQLITE_AFF_NUMERIC is returned.
104529 */
104530 SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){
104531 u32 h = 0;
104532 char aff = SQLITE_AFF_NUMERIC;
104533 const char *zChar = 0;
104534
104535 assert( zIn!=0 );
@@ -104361,31 +104562,36 @@
104562 aff = SQLITE_AFF_INTEGER;
104563 break;
104564 }
104565 }
104566
104567 /* If pCol is not NULL, store an estimate of the field size. The
104568 ** estimate is scaled so that the size of an integer is 1. */
104569 if( pCol ){
104570 int v = 0; /* default size is approx 4 bytes */
104571 if( aff<SQLITE_AFF_NUMERIC ){
104572 if( zChar ){
104573 while( zChar[0] ){
104574 if( sqlite3Isdigit(zChar[0]) ){
104575 /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */
104576 sqlite3GetInt32(zChar, &v);
 
 
 
104577 break;
104578 }
104579 zChar++;
104580 }
104581 }else{
104582 v = 16; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/
104583 }
104584 }
104585 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
104586 if( v>=sqlite3GlobalConfig.szSorterRef ){
104587 pCol->colFlags |= COLFLAG_SORTERREF;
104588 }
104589 #endif
104590 v = v/4 + 1;
104591 if( v>255 ) v = 255;
104592 pCol->szEst = v;
104593 }
104594 return aff;
104595 }
104596
104597 /*
@@ -108366,11 +108572,11 @@
108572 int nIdx; /* Number of indices */
108573 sqlite3 *db; /* Main database structure */
108574 AuthContext sContext; /* Authorization context */
108575 NameContext sNC; /* Name context to resolve expressions in */
108576 int iDb; /* Database number */
108577 int memCnt = 0; /* Memory cell used for change counting */
108578 int rcauth; /* Value returned by authorization callback */
108579 int eOnePass; /* ONEPASS_OFF or _SINGLE or _MULTI */
108580 int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */
108581 u8 *aToOpen = 0; /* Open cursor iTabCur+j if aToOpen[j] is true */
108582 Index *pPk; /* The PRIMARY KEY index on the table */
@@ -108471,11 +108677,11 @@
108677 v = sqlite3GetVdbe(pParse);
108678 if( v==0 ){
108679 goto delete_from_cleanup;
108680 }
108681 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
108682 sqlite3BeginWriteOperation(pParse, bComplex, iDb);
108683
108684 /* If we are trying to delete from a view, realize that view into
108685 ** an ephemeral table.
108686 */
108687 #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
@@ -108499,11 +108705,14 @@
108705 }
108706
108707 /* Initialize the counter of the number of rows deleted, if
108708 ** we are counting rows.
108709 */
108710 if( (db->flags & SQLITE_CountRows)!=0
108711 && !pParse->nested
108712 && !pParse->pTriggerTab
108713 ){
108714 memCnt = ++pParse->nMem;
108715 sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
108716 }
108717
108718 #ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
@@ -108527,11 +108736,11 @@
108736 #endif
108737 ){
108738 assert( !isView );
108739 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
108740 if( HasRowid(pTab) ){
108741 sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1,
108742 pTab->zName, P4_STATIC);
108743 }
108744 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108745 assert( pIdx->pSchema==pTab->pSchema );
108746 sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
@@ -108572,13 +108781,14 @@
108781 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1);
108782 if( pWInfo==0 ) goto delete_from_cleanup;
108783 eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
108784 assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
108785 assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
108786 if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse);
108787
108788 /* Keep track of the number of rows to be deleted */
108789 if( memCnt ){
108790 sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
108791 }
108792
108793 /* Extract the rowid or primary key for the current row */
108794 if( pPk ){
@@ -108717,11 +108927,11 @@
108927
108928 /* Return the number of rows that were deleted. If this routine is
108929 ** generating code because of a call to sqlite3NestedParse(), do not
108930 ** invoke the callback function.
108931 */
108932 if( memCnt ){
108933 sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);
108934 sqlite3VdbeSetNumCols(v, 1);
108935 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
108936 }
108937
@@ -112899,11 +113109,12 @@
113109 SQLITE_PRIVATE void sqlite3Insert(
113110 Parse *pParse, /* Parser context */
113111 SrcList *pTabList, /* Name of table into which we are inserting */
113112 Select *pSelect, /* A SELECT statement to use as the data source */
113113 IdList *pColumn, /* Column names corresponding to IDLIST. */
113114 int onError, /* How to handle constraint errors */
113115 Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */
113116 ){
113117 sqlite3 *db; /* The main database structure */
113118 Table *pTab; /* The table to insert into. aka TABLE */
113119 int i, j; /* Loop counters */
113120 Vdbe *v; /* Generate code into this virtual machine */
@@ -113194,11 +113405,14 @@
113405 goto insert_cleanup;
113406 }
113407
113408 /* Initialize the count of rows to be inserted
113409 */
113410 if( (db->flags & SQLITE_CountRows)!=0
113411 && !pParse->nested
113412 && !pParse->pTriggerTab
113413 ){
113414 regRowCount = ++pParse->nMem;
113415 sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
113416 }
113417
113418 /* If this is not a view, open the table and and all indices */
@@ -113214,10 +113428,23 @@
113428 assert( pIdx );
113429 aRegIdx[i] = ++pParse->nMem;
113430 pParse->nMem += pIdx->nColumn;
113431 }
113432 }
113433 #ifndef SQLITE_OMIT_UPSERT
113434 if( pUpsert ){
113435 pTabList->a[0].iCursor = iDataCur;
113436 pUpsert->pUpsertSrc = pTabList;
113437 pUpsert->regData = regData;
113438 pUpsert->iDataCur = iDataCur;
113439 pUpsert->iIdxCur = iIdxCur;
113440 if( pUpsert->pUpsertTarget ){
113441 sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert);
113442 }
113443 }
113444 #endif
113445
113446
113447 /* This is the top of the main insertion loop */
113448 if( useTempTable ){
113449 /* This block codes the top of loop only. The complete loop is the
113450 ** following pseudocode (template 4):
@@ -113416,11 +113643,11 @@
113643 #endif
113644 {
113645 int isReplace; /* Set to true if constraints may cause a replace */
113646 int bUseSeek; /* True to use OPFLAG_SEEKRESULT */
113647 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
113648 regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0, pUpsert
113649 );
113650 sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);
113651
113652 /* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE
113653 ** constraints or (b) there are no triggers and this table is not a
@@ -113439,11 +113666,11 @@
113666 }
113667 }
113668
113669 /* Update the count of rows that are inserted
113670 */
113671 if( regRowCount ){
113672 sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
113673 }
113674
113675 if( pTrigger ){
113676 /* Code AFTER triggers */
@@ -113476,19 +113703,20 @@
113703 /*
113704 ** Return the number of rows inserted. If this routine is
113705 ** generating code because of a call to sqlite3NestedParse(), do not
113706 ** invoke the callback function.
113707 */
113708 if( regRowCount ){
113709 sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
113710 sqlite3VdbeSetNumCols(v, 1);
113711 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
113712 }
113713
113714 insert_cleanup:
113715 sqlite3SrcListDelete(db, pTabList);
113716 sqlite3ExprListDelete(db, pList);
113717 sqlite3UpsertDelete(db, pUpsert);
113718 sqlite3SelectDelete(db, pSelect);
113719 sqlite3IdListDelete(db, pColumn);
113720 sqlite3DbFree(db, aRegIdx);
113721 }
113722
@@ -113555,10 +113783,48 @@
113783 testcase( w.eCode==CKCNSTRNT_COLUMN );
113784 testcase( w.eCode==CKCNSTRNT_ROWID );
113785 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
113786 return !w.eCode;
113787 }
113788
113789 /*
113790 ** An instance of the ConstraintAddr object remembers the byte-code addresses
113791 ** for sections of the constraint checks that deal with uniqueness constraints
113792 ** on the rowid and on the upsert constraint.
113793 **
113794 ** This information is passed into checkReorderConstraintChecks() to insert
113795 ** some OP_Goto operations so that the rowid and upsert constraints occur
113796 ** in the correct order relative to other constraints.
113797 */
113798 typedef struct ConstraintAddr ConstraintAddr;
113799 struct ConstraintAddr {
113800 int ipkTop; /* Subroutine for rowid constraint check */
113801 int upsertTop; /* Label for upsert constraint check subroutine */
113802 int upsertTop2; /* Copy of upsertTop not cleared by the call */
113803 int upsertBtm; /* upsert constraint returns to this label */
113804 int ipkBtm; /* Return opcode rowid constraint check */
113805 };
113806
113807 /*
113808 ** Generate any OP_Goto operations needed to cause constraints to be
113809 ** run that haven't already been run.
113810 */
113811 static void reorderConstraintChecks(Vdbe *v, ConstraintAddr *p){
113812 if( p->upsertTop ){
113813 testcase( sqlite3VdbeLabelHasBeenResolved(v, p->upsertTop) );
113814 sqlite3VdbeGoto(v, p->upsertTop);
113815 VdbeComment((v, "call upsert subroutine"));
113816 sqlite3VdbeResolveLabel(v, p->upsertBtm);
113817 p->upsertTop = 0;
113818 }
113819 if( p->ipkTop ){
113820 sqlite3VdbeGoto(v, p->ipkTop);
113821 VdbeComment((v, "call rowid unique-check subroutine"));
113822 sqlite3VdbeJumpHere(v, p->ipkBtm);
113823 p->ipkTop = 0;
113824 }
113825 }
113826
113827 /*
113828 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
113829 ** on table pTab.
113830 **
@@ -113651,11 +113917,12 @@
113917 int regOldData, /* Previous content. 0 for INSERTs */
113918 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
113919 u8 overrideError, /* Override onError to this if not OE_Default */
113920 int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
113921 int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */
113922 int *aiChng, /* column i is unchanged if aiChng[i]<0 */
113923 Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
113924 ){
113925 Vdbe *v; /* VDBE under constrution */
113926 Index *pIdx; /* Pointer to one of the indices */
113927 Index *pPk = 0; /* The PRIMARY KEY index */
113928 sqlite3 *db; /* Database connection */
@@ -113664,21 +113931,23 @@
113931 int nCol; /* Number of columns */
113932 int onError; /* Conflict resolution strategy */
113933 int addr1; /* Address of jump instruction */
113934 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
113935 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
113936 ConstraintAddr sAddr;/* Address information for constraint reordering */
113937 Index *pUpIdx = 0; /* Index to which to apply the upsert */
113938 u8 isUpdate; /* True if this is an UPDATE operation */
113939 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
113940 int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
113941
113942 isUpdate = regOldData!=0;
113943 db = pParse->db;
113944 v = sqlite3GetVdbe(pParse);
113945 assert( v!=0 );
113946 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
113947 nCol = pTab->nCol;
113948 memset(&sAddr, 0, sizeof(sAddr));
113949
113950 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
113951 ** normal rowid tables. nPkField is the number of key fields in the
113952 ** pPk index or 1 for a rowid table. In other words, nPkField is the
113953 ** number of fields in the true primary key of the table. */
@@ -113773,10 +114042,50 @@
114042 sqlite3VdbeResolveLabel(v, allOk);
114043 }
114044 pParse->iSelfTab = 0;
114045 }
114046 #endif /* !defined(SQLITE_OMIT_CHECK) */
114047
114048 /* UNIQUE and PRIMARY KEY constraints should be handled in the following
114049 ** order:
114050 **
114051 ** (1) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
114052 ** (2) OE_Update
114053 ** (3) OE_Replace
114054 **
114055 ** OE_Fail and OE_Ignore must happen before any changes are made.
114056 ** OE_Update guarantees that only a single row will change, so it
114057 ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
114058 ** could happen in any order, but they are grouped up front for
114059 ** convenience.
114060 **
114061 ** Constraint checking code is generated in this order:
114062 ** (A) The rowid constraint
114063 ** (B) Unique index constraints that do not have OE_Replace as their
114064 ** default conflict resolution strategy
114065 ** (C) Unique index that do use OE_Replace by default.
114066 **
114067 ** The ordering of (2) and (3) is accomplished by making sure the linked
114068 ** list of indexes attached to a table puts all OE_Replace indexes last
114069 ** in the list. See sqlite3CreateIndex() for where that happens.
114070 */
114071
114072 if( pUpsert ){
114073 if( pUpsert->pUpsertTarget==0 ){
114074 /* An ON CONFLICT DO NOTHING clause, without a constraint-target.
114075 ** Make all unique constraint resolution be OE_Ignore */
114076 assert( pUpsert->pUpsertSet==0 );
114077 overrideError = OE_Ignore;
114078 pUpsert = 0;
114079 }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
114080 /* If the constraint-target is on some column other than
114081 ** then ROWID, then we might need to move the UPSERT around
114082 ** so that it occurs in the correct order. */
114083 sAddr.upsertTop = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v);
114084 sAddr.upsertBtm = sqlite3VdbeMakeLabel(v);
114085 }
114086 }
114087
114088 /* If rowid is changing, make sure the new rowid does not previously
114089 ** exist in the table.
114090 */
114091 if( pkChng && pPk==0 ){
@@ -113787,10 +114096,36 @@
114096 if( overrideError!=OE_Default ){
114097 onError = overrideError;
114098 }else if( onError==OE_Default ){
114099 onError = OE_Abort;
114100 }
114101
114102 /* figure out whether or not upsert applies in this case */
114103 if( pUpsert && pUpsert->pUpsertIdx==0 ){
114104 if( pUpsert->pUpsertSet==0 ){
114105 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
114106 }else{
114107 onError = OE_Update; /* DO UPDATE */
114108 }
114109 }
114110
114111 /* If the response to a rowid conflict is REPLACE but the response
114112 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
114113 ** to defer the running of the rowid conflict checking until after
114114 ** the UNIQUE constraints have run.
114115 */
114116 assert( OE_Update>OE_Replace );
114117 assert( OE_Ignore<OE_Replace );
114118 assert( OE_Fail<OE_Replace );
114119 assert( OE_Abort<OE_Replace );
114120 assert( OE_Rollback<OE_Replace );
114121 if( onError>=OE_Replace
114122 && (pUpsert || onError!=overrideError)
114123 && pTab->pIndex
114124 ){
114125 sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
114126 }
114127
114128 if( isUpdate ){
114129 /* pkChng!=0 does not mean that the rowid has changed, only that
114130 ** it might have changed. Skip the conflict logic below if the rowid
114131 ** is unchanged. */
@@ -113797,38 +114132,27 @@
114132 sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData);
114133 sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
114134 VdbeCoverage(v);
114135 }
114136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114137 /* Check to see if the new rowid already exists in the table. Skip
114138 ** the following conflict logic if it does not. */
114139 VdbeNoopComment((v, "uniqueness check for ROWID"));
114140 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
114141 VdbeCoverage(v);
114142
 
114143 switch( onError ){
114144 default: {
114145 onError = OE_Abort;
114146 /* Fall thru into the next case */
114147 }
114148 case OE_Rollback:
114149 case OE_Abort:
114150 case OE_Fail: {
114151 testcase( onError==OE_Rollback );
114152 testcase( onError==OE_Abort );
114153 testcase( onError==OE_Fail );
114154 sqlite3RowidConstraint(pParse, onError, pTab);
114155 break;
114156 }
114157 case OE_Replace: {
114158 /* If there are DELETE triggers on this table and the
@@ -113861,37 +114185,42 @@
114185 sqlite3MultiWrite(pParse);
114186 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
114187 regNewData, 1, 0, OE_Replace, 1, -1);
114188 }else{
114189 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
114190 assert( HasRowid(pTab) );
114191 /* This OP_Delete opcode fires the pre-update-hook only. It does
114192 ** not modify the b-tree. It is more efficient to let the coming
114193 ** OP_Insert replace the existing entry than it is to delete the
114194 ** existing entry and then insert a new one. */
114195 sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP);
114196 sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
 
114197 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
114198 if( pTab->pIndex ){
114199 sqlite3MultiWrite(pParse);
114200 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
114201 }
114202 }
114203 seenReplace = 1;
114204 break;
114205 }
114206 #ifndef SQLITE_OMIT_UPSERT
114207 case OE_Update: {
114208 sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur);
114209 /* Fall through */
114210 }
114211 #endif
114212 case OE_Ignore: {
114213 testcase( onError==OE_Ignore );
114214 sqlite3VdbeGoto(v, ignoreDest);
114215 break;
114216 }
114217 }
114218 sqlite3VdbeResolveLabel(v, addrRowidOk);
114219 if( sAddr.ipkTop ){
114220 sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto);
114221 sqlite3VdbeJumpHere(v, sAddr.ipkTop-1);
114222 }
114223 }
114224
114225 /* Test all UNIQUE constraints by creating entries for each UNIQUE
114226 ** index and making sure that duplicate entries do not already exist.
@@ -113905,16 +114234,25 @@
114234 int regR; /* Range of registers holding conflicting PK */
114235 int iThisCur; /* Cursor for this UNIQUE index */
114236 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
114237
114238 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
114239 if( pUpIdx==pIdx ){
114240 addrUniqueOk = sAddr.upsertBtm;
114241 upsertBypass = sqlite3VdbeGoto(v, 0);
114242 VdbeComment((v, "Skip upsert subroutine"));
114243 sqlite3VdbeResolveLabel(v, sAddr.upsertTop2);
114244 }else{
114245 addrUniqueOk = sqlite3VdbeMakeLabel(v);
114246 }
114247 VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
114248 if( bAffinityDone==0 ){
114249 sqlite3TableAffinity(v, pTab, regNewData+1);
114250 bAffinityDone = 1;
114251 }
114252 iThisCur = iIdxCur+ix;
114253
114254
114255 /* Skip partial indices for which the WHERE clause is not true */
114256 if( pIdx->pPartIdxWhere ){
114257 sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);
114258 pParse->iSelfTab = -(regNewData+1);
@@ -113969,10 +114307,28 @@
114307 if( overrideError!=OE_Default ){
114308 onError = overrideError;
114309 }else if( onError==OE_Default ){
114310 onError = OE_Abort;
114311 }
114312
114313 /* Figure out if the upsert clause applies to this index */
114314 if( pUpIdx==pIdx ){
114315 if( pUpsert->pUpsertSet==0 ){
114316 onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
114317 }else{
114318 onError = OE_Update; /* DO UPDATE */
114319 }
114320 }
114321
114322 /* Invoke subroutines to handle IPK replace and upsert prior to running
114323 ** the first REPLACE constraint check. */
114324 if( onError==OE_Replace ){
114325 testcase( sAddr.ipkTop );
114326 testcase( sAddr.upsertTop
114327 && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
114328 reorderConstraintChecks(v, &sAddr);
114329 }
114330
114331 /* Collision detection may be omitted if all of the following are true:
114332 ** (1) The conflict resolution algorithm is REPLACE
114333 ** (2) The table is a WITHOUT ROWID table
114334 ** (3) There are no secondary indexes on the table
@@ -114052,19 +114408,29 @@
114408 }
114409 }
114410
114411 /* Generate code that executes if the new index entry is not unique */
114412 assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
114413 || onError==OE_Ignore || onError==OE_Replace || onError==OE_Update );
114414 switch( onError ){
114415 case OE_Rollback:
114416 case OE_Abort:
114417 case OE_Fail: {
114418 testcase( onError==OE_Rollback );
114419 testcase( onError==OE_Abort );
114420 testcase( onError==OE_Fail );
114421 sqlite3UniqueConstraint(pParse, onError, pIdx);
114422 break;
114423 }
114424 #ifndef SQLITE_OMIT_UPSERT
114425 case OE_Update: {
114426 sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix);
114427 /* Fall through */
114428 }
114429 #endif
114430 case OE_Ignore: {
114431 testcase( onError==OE_Ignore );
114432 sqlite3VdbeGoto(v, ignoreDest);
114433 break;
114434 }
114435 default: {
114436 Trigger *pTrigger = 0;
@@ -114078,18 +114444,23 @@
114444 (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur);
114445 seenReplace = 1;
114446 break;
114447 }
114448 }
114449 if( pUpIdx==pIdx ){
114450 sqlite3VdbeJumpHere(v, upsertBypass);
114451 }else{
114452 sqlite3VdbeResolveLabel(v, addrUniqueOk);
114453 }
114454 sqlite3ExprCachePop(pParse);
114455 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
114456
114457 }
114458 testcase( sAddr.ipkTop!=0 );
114459 testcase( sAddr.upsertTop
114460 && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
114461 reorderConstraintChecks(v, &sAddr);
114462
114463 *pbMayReplace = seenReplace;
114464 VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
114465 }
114466
@@ -119511,10 +119882,11 @@
119882 int meta[5];
119883 InitData initData;
119884 const char *zMasterName;
119885 int openedTransaction = 0;
119886
119887 assert( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 );
119888 assert( iDb>=0 && iDb<db->nDb );
119889 assert( db->aDb[iDb].pSchema );
119890 assert( sqlite3_mutex_held(db->mutex) );
119891 assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
119892
@@ -119740,10 +120112,11 @@
120112 rc = sqlite3InitOne(db, 0, pzErrMsg);
120113 if( rc ) return rc;
120114 }
120115 /* All other schemas after the main schema. The "temp" schema must be last */
120116 for(i=db->nDb-1; i>0; i--){
120117 assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) );
120118 if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
120119 rc = sqlite3InitOne(db, i, pzErrMsg);
120120 if( rc ) return rc;
120121 }
120122 }
@@ -119761,14 +120134,16 @@
120134 int rc = SQLITE_OK;
120135 sqlite3 *db = pParse->db;
120136 assert( sqlite3_mutex_held(db->mutex) );
120137 if( !db->init.busy ){
120138 rc = sqlite3Init(db, &pParse->zErrMsg);
120139 if( rc!=SQLITE_OK ){
120140 pParse->rc = rc;
120141 pParse->nErr++;
120142 }else if( db->noSharedCache ){
120143 db->mDbFlags |= DBFLAG_SchemaKnownOk;
120144 }
120145 }
120146 return rc;
120147 }
120148
120149
@@ -120289,11 +120664,11 @@
120664 */
120665 #if SELECTTRACE_ENABLED
120666 /***/ int sqlite3SelectTrace = 0;
120667 # define SELECTTRACE(K,P,S,X) \
120668 if(sqlite3SelectTrace&(K)) \
120669 sqlite3DebugPrintf("%s/%d/%p: ",(S)->zSelName,(P)->iSelectId,(S)),\
120670 sqlite3DebugPrintf X
120671 #else
120672 # define SELECTTRACE(K,P,S,X)
120673 #endif
120674
@@ -120312,10 +120687,24 @@
120687 };
120688
120689 /*
120690 ** An instance of the following object is used to record information about
120691 ** the ORDER BY (or GROUP BY) clause of query is being coded.
120692 **
120693 ** The aDefer[] array is used by the sorter-references optimization. For
120694 ** example, assuming there is no index that can be used for the ORDER BY,
120695 ** for the query:
120696 **
120697 ** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10;
120698 **
120699 ** it may be more efficient to add just the "a" values to the sorter, and
120700 ** retrieve the associated "bigblob" values directly from table t1 as the
120701 ** 10 smallest "a" values are extracted from the sorter.
120702 **
120703 ** When the sorter-reference optimization is used, there is one entry in the
120704 ** aDefer[] array for each database table that may be read as values are
120705 ** extracted from the sorter.
120706 */
120707 typedef struct SortCtx SortCtx;
120708 struct SortCtx {
120709 ExprList *pOrderBy; /* The ORDER BY (or GROUP BY clause) */
120710 int nOBSat; /* Number of ORDER BY terms satisfied by indices */
@@ -120324,10 +120713,18 @@
120713 int labelBkOut; /* Start label for the block-output subroutine */
120714 int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */
120715 int labelDone; /* Jump here when done, ex: LIMIT reached */
120716 u8 sortFlags; /* Zero or more SORTFLAG_* bits */
120717 u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */
120718 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
120719 u8 nDefer; /* Number of valid entries in aDefer[] */
120720 struct DeferredCsr {
120721 Table *pTab; /* Table definition */
120722 int iCsr; /* Cursor number for table */
120723 int nKey; /* Number of PK columns for table pTab (>=1) */
120724 } aDefer[4];
120725 #endif
120726 };
120727 #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */
120728
120729 /*
120730 ** Delete all the content of a Select structure. Deallocate the structure
@@ -120946,10 +121343,94 @@
121343 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N);
121344 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
121345 sqlite3ReleaseTempReg(pParse, r1);
121346 }
121347
121348 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
121349 /*
121350 ** This function is called as part of inner-loop generation for a SELECT
121351 ** statement with an ORDER BY that is not optimized by an index. It
121352 ** determines the expressions, if any, that the sorter-reference
121353 ** optimization should be used for. The sorter-reference optimization
121354 ** is used for SELECT queries like:
121355 **
121356 ** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10
121357 **
121358 ** If the optimization is used for expression "bigblob", then instead of
121359 ** storing values read from that column in the sorter records, the PK of
121360 ** the row from table t1 is stored instead. Then, as records are extracted from
121361 ** the sorter to return to the user, the required value of bigblob is
121362 ** retrieved directly from table t1. If the values are very large, this
121363 ** can be more efficient than storing them directly in the sorter records.
121364 **
121365 ** The ExprList_item.bSorterRef flag is set for each expression in pEList
121366 ** for which the sorter-reference optimization should be enabled.
121367 ** Additionally, the pSort->aDefer[] array is populated with entries
121368 ** for all cursors required to evaluate all selected expressions. Finally.
121369 ** output variable (*ppExtra) is set to an expression list containing
121370 ** expressions for all extra PK values that should be stored in the
121371 ** sorter records.
121372 */
121373 static void selectExprDefer(
121374 Parse *pParse, /* Leave any error here */
121375 SortCtx *pSort, /* Sorter context */
121376 ExprList *pEList, /* Expressions destined for sorter */
121377 ExprList **ppExtra /* Expressions to append to sorter record */
121378 ){
121379 int i;
121380 int nDefer = 0;
121381 ExprList *pExtra = 0;
121382 for(i=0; i<pEList->nExpr; i++){
121383 struct ExprList_item *pItem = &pEList->a[i];
121384 if( pItem->u.x.iOrderByCol==0 ){
121385 Expr *pExpr = pItem->pExpr;
121386 Table *pTab = pExpr->pTab;
121387 if( pExpr->op==TK_COLUMN && pTab && !IsVirtual(pTab)
121388 && (pTab->aCol[pExpr->iColumn].colFlags & COLFLAG_SORTERREF)
121389 #if 0
121390 && pTab->pSchema && pTab->pSelect==0 && !IsVirtual(pTab)
121391 #endif
121392 ){
121393 int j;
121394 for(j=0; j<nDefer; j++){
121395 if( pSort->aDefer[j].iCsr==pExpr->iTable ) break;
121396 }
121397 if( j==nDefer ){
121398 if( nDefer==ArraySize(pSort->aDefer) ){
121399 continue;
121400 }else{
121401 int nKey = 1;
121402 int k;
121403 Index *pPk = 0;
121404 if( !HasRowid(pTab) ){
121405 pPk = sqlite3PrimaryKeyIndex(pTab);
121406 nKey = pPk->nKeyCol;
121407 }
121408 for(k=0; k<nKey; k++){
121409 Expr *pNew = sqlite3PExpr(pParse, TK_COLUMN, 0, 0);
121410 if( pNew ){
121411 pNew->iTable = pExpr->iTable;
121412 pNew->pTab = pExpr->pTab;
121413 pNew->iColumn = pPk ? pPk->aiColumn[k] : -1;
121414 pExtra = sqlite3ExprListAppend(pParse, pExtra, pNew);
121415 }
121416 }
121417 pSort->aDefer[nDefer].pTab = pExpr->pTab;
121418 pSort->aDefer[nDefer].iCsr = pExpr->iTable;
121419 pSort->aDefer[nDefer].nKey = nKey;
121420 nDefer++;
121421 }
121422 }
121423 pItem->bSorterRef = 1;
121424 }
121425 }
121426 }
121427 pSort->nDefer = (u8)nDefer;
121428 *ppExtra = pExtra;
121429 }
121430 #endif
121431
121432 /*
121433 ** This routine generates the code for the inside of the inner loop
121434 ** of a SELECT.
121435 **
121436 ** If srcTab is negative, then the p->pEList expressions
@@ -121018,10 +121499,13 @@
121499 for(i=0; i<nResultCol; i++){
121500 sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
121501 VdbeComment((v, "%s", p->pEList->a[i].zName));
121502 }
121503 }else if( eDest!=SRT_Exists ){
121504 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
121505 ExprList *pExtra = 0;
121506 #endif
121507 /* If the destination is an EXISTS(...) expression, the actual
121508 ** values returned by the SELECT are not required.
121509 */
121510 u8 ecelFlags;
121511 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
@@ -121041,16 +121525,38 @@
121525 int j;
121526 if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
121527 p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
121528 }
121529 }
121530 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
121531 selectExprDefer(pParse, pSort, p->pEList, &pExtra);
121532 if( pExtra && pParse->db->mallocFailed==0 ){
121533 /* If there are any extra PK columns to add to the sorter records,
121534 ** allocate extra memory cells and adjust the OpenEphemeral
121535 ** instruction to account for the larger records. This is only
121536 ** required if there are one or more WITHOUT ROWID tables with
121537 ** composite primary keys in the SortCtx.aDefer[] array. */
121538 VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);
121539 pOp->p2 += (pExtra->nExpr - pSort->nDefer);
121540 pOp->p4.pKeyInfo->nAllField += (pExtra->nExpr - pSort->nDefer);
121541 pParse->nMem += pExtra->nExpr;
121542 }
121543 #endif
121544 regOrig = 0;
121545 assert( eDest==SRT_Set || eDest==SRT_Mem
121546 || eDest==SRT_Coroutine || eDest==SRT_Output );
121547 }
121548 nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult,
121549 0,ecelFlags);
121550 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
121551 if( pExtra ){
121552 nResultCol += sqlite3ExprCodeExprList(
121553 pParse, pExtra, regResult + nResultCol, 0, 0
121554 );
121555 sqlite3ExprListDelete(pParse->db, pExtra);
121556 }
121557 #endif
121558 }
121559
121560 /* If the DISTINCT keyword was present on the SELECT statement
121561 ** and this row has been seen before, then do not make this row
121562 ** part of the result.
@@ -121504,50 +122010,60 @@
122010 SelectDest *pDest /* Write the sorted results here */
122011 ){
122012 Vdbe *v = pParse->pVdbe; /* The prepared statement */
122013 int addrBreak = pSort->labelDone; /* Jump here to exit loop */
122014 int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */
122015 int addr; /* Top of output loop. Jump for Next. */
122016 int addrOnce = 0;
122017 int iTab;
122018 ExprList *pOrderBy = pSort->pOrderBy;
122019 int eDest = pDest->eDest;
122020 int iParm = pDest->iSDParm;
122021 int regRow;
122022 int regRowid;
122023 int iCol;
122024 int nKey; /* Number of key columns in sorter record */
122025 int iSortTab; /* Sorter cursor to read from */
 
122026 int i;
122027 int bSeq; /* True if sorter record includes seq. no. */
122028 int nRefKey = 0;
122029 struct ExprList_item *aOutEx = p->pEList->a;
122030
122031 assert( addrBreak<0 );
122032 if( pSort->labelBkOut ){
122033 sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
122034 sqlite3VdbeGoto(v, addrBreak);
122035 sqlite3VdbeResolveLabel(v, pSort->labelBkOut);
122036 }
122037
122038 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
122039 /* Open any cursors needed for sorter-reference expressions */
122040 for(i=0; i<pSort->nDefer; i++){
122041 Table *pTab = pSort->aDefer[i].pTab;
122042 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
122043 sqlite3OpenTable(pParse, pSort->aDefer[i].iCsr, iDb, pTab, OP_OpenRead);
122044 nRefKey = MAX(nRefKey, pSort->aDefer[i].nKey);
122045 }
122046 #endif
122047
122048 iTab = pSort->iECursor;
122049 if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
122050 regRowid = 0;
122051 regRow = pDest->iSdst;
 
122052 }else{
122053 regRowid = sqlite3GetTempReg(pParse);
122054 regRow = sqlite3GetTempRange(pParse, nColumn);
 
122055 }
122056 nKey = pOrderBy->nExpr - pSort->nOBSat;
122057 if( pSort->sortFlags & SORTFLAG_UseSorter ){
122058 int regSortOut = ++pParse->nMem;
122059 iSortTab = pParse->nTab++;
122060 if( pSort->labelBkOut ){
122061 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
122062 }
122063 sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut,
122064 nKey+1+nColumn+nRefKey);
122065 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
122066 addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
122067 VdbeCoverage(v);
122068 codeOffset(v, p->iOffset, addrContinue);
122069 sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);
@@ -121556,22 +122072,63 @@
122072 addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v);
122073 codeOffset(v, p->iOffset, addrContinue);
122074 iSortTab = iTab;
122075 bSeq = 1;
122076 }
122077 for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){
122078 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
122079 if( aOutEx[i].bSorterRef ) continue;
122080 #endif
122081 if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++;
122082 }
122083 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
122084 if( pSort->nDefer ){
122085 int iKey = iCol+1;
122086 int regKey = sqlite3GetTempRange(pParse, nRefKey);
122087
122088 for(i=0; i<pSort->nDefer; i++){
122089 int iCsr = pSort->aDefer[i].iCsr;
122090 Table *pTab = pSort->aDefer[i].pTab;
122091 int nKey = pSort->aDefer[i].nKey;
122092
122093 sqlite3VdbeAddOp1(v, OP_NullRow, iCsr);
122094 if( HasRowid(pTab) ){
122095 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey);
122096 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCsr,
122097 sqlite3VdbeCurrentAddr(v)+1, regKey);
122098 }else{
122099 int k;
122100 int iJmp;
122101 assert( sqlite3PrimaryKeyIndex(pTab)->nKeyCol==nKey );
122102 for(k=0; k<nKey; k++){
122103 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey+k);
122104 }
122105 iJmp = sqlite3VdbeCurrentAddr(v);
122106 sqlite3VdbeAddOp4Int(v, OP_SeekGE, iCsr, iJmp+2, regKey, nKey);
122107 sqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, iJmp+3, regKey, nKey);
122108 sqlite3VdbeAddOp1(v, OP_NullRow, iCsr);
122109 }
122110 }
122111 sqlite3ReleaseTempRange(pParse, regKey, nRefKey);
122112 }
122113 #endif
122114 for(i=nColumn-1; i>=0; i--){
122115 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
122116 if( aOutEx[i].bSorterRef ){
122117 sqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i);
122118 }else
122119 #endif
122120 {
122121 int iRead;
122122 if( aOutEx[i].u.x.iOrderByCol ){
122123 iRead = aOutEx[i].u.x.iOrderByCol-1;
122124 }else{
122125 iRead = iCol--;
122126 }
122127 sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i);
122128 VdbeComment((v, "%s", aOutEx[i].zName?aOutEx[i].zName : aOutEx[i].zSpan));
122129 }
122130 }
122131 switch( eDest ){
122132 case SRT_Table:
122133 case SRT_EphemTab: {
122134 sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
@@ -123905,13 +124462,12 @@
124462 }else{
124463 pNew->pPrior = pPrior;
124464 if( pPrior ) pPrior->pNext = pNew;
124465 pNew->pNext = p;
124466 p->pPrior = pNew;
124467 SELECTTRACE(2,pParse,p,("compound-subquery flattener"
124468 " creates %s.%p as peer\n",pNew->zSelName, pNew));
 
124469 }
124470 if( db->mallocFailed ) return 1;
124471 }
124472
124473 /* Begin flattening the iFrom-th entry of the FROM clause
@@ -125439,11 +125995,14 @@
125995 return 1;
125996 }
125997 if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
125998 memset(&sAggInfo, 0, sizeof(sAggInfo));
125999 #if SELECTTRACE_ENABLED
126000 #ifndef SQLITE_OMIT_EXPLAIN
126001 p->iSelectId = pParse->iSelectId;
126002 #endif
126003 SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->iSelectId));
126004 if( sqlite3SelectTrace & 0x100 ){
126005 sqlite3TreeViewSelect(0, p, 0);
126006 }
126007 #endif
126008
@@ -125470,12 +126029,12 @@
126029 goto select_end;
126030 }
126031 assert( p->pEList!=0 );
126032 isAgg = (p->selFlags & SF_Aggregate)!=0;
126033 #if SELECTTRACE_ENABLED
126034 if( sqlite3SelectTrace & 0x104 ){
126035 SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
126036 sqlite3TreeViewSelect(0, p, 0);
126037 }
126038 #endif
126039
126040 /* Get a pointer the VDBE under construction, allocating a new VDBE if one
@@ -125572,14 +126131,17 @@
126131 /* Handle compound SELECT statements using the separate multiSelect()
126132 ** procedure.
126133 */
126134 if( p->pPrior ){
126135 rc = multiSelect(pParse, p, pDest);
 
126136 #if SELECTTRACE_ENABLED
126137 SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
126138 if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){
126139 sqlite3TreeViewSelect(0, p, 0);
126140 }
126141 #endif
126142 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
126143 return rc;
126144 }
126145 #endif
126146
126147 /* For each term in the FROM clause, do two things:
@@ -125954,11 +126516,12 @@
126516 ** SELECT statement.
126517 */
126518 memset(&sNC, 0, sizeof(sNC));
126519 sNC.pParse = pParse;
126520 sNC.pSrcList = pTabList;
126521 sNC.uNC.pAggInfo = &sAggInfo;
126522 VVA_ONLY( sNC.ncFlags = NC_UAggInfo; )
126523 sAggInfo.mnReg = pParse->nMem+1;
126524 sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
126525 sAggInfo.pGroupBy = pGroupBy;
126526 sqlite3ExprAnalyzeAggList(&sNC, pEList);
126527 sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);
@@ -126343,10 +126906,11 @@
126906 ** and send them to the callback one by one.
126907 */
126908 if( sSort.pOrderBy ){
126909 explainTempTable(pParse,
126910 sSort.nOBSat>0 ? "RIGHT PART OF ORDER BY":"ORDER BY");
126911 assert( p->pEList==pEList );
126912 generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);
126913 }
126914
126915 /* Jump here to skip this query
126916 */
@@ -126358,17 +126922,20 @@
126922
126923 /* Control jumps to here if an error is encountered above, or upon
126924 ** successful coding of the SELECT.
126925 */
126926 select_end:
 
126927 sqlite3ExprListDelete(db, pMinMaxOrderBy);
126928 sqlite3DbFree(db, sAggInfo.aCol);
126929 sqlite3DbFree(db, sAggInfo.aFunc);
126930 #if SELECTTRACE_ENABLED
126931 SELECTTRACE(0x1,pParse,p,("end processing\n"));
126932 if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){
126933 sqlite3TreeViewSelect(0, p, 0);
126934 }
126935 #endif
126936 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
126937 return rc;
126938 }
126939
126940 /************** End of select.c **********************************************/
126941 /************** Begin file table.c *******************************************/
@@ -126598,10 +127165,11 @@
127165
127166 sqlite3ExprDelete(db, pTmp->pWhere);
127167 sqlite3ExprListDelete(db, pTmp->pExprList);
127168 sqlite3SelectDelete(db, pTmp->pSelect);
127169 sqlite3IdListDelete(db, pTmp->pIdList);
127170 sqlite3UpsertDelete(db, pTmp->pUpsert);
127171 sqlite3DbFree(db, pTmp->zSpan);
127172
127173 sqlite3DbFree(db, pTmp);
127174 }
127175 }
@@ -126989,10 +127557,11 @@
127557 sqlite3 *db, /* The database connection */
127558 Token *pTableName, /* Name of the table into which we insert */
127559 IdList *pColumn, /* List of columns in pTableName to insert into */
127560 Select *pSelect, /* A SELECT statement that supplies values */
127561 u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
127562 Upsert *pUpsert, /* ON CONFLICT clauses for upsert */
127563 const char *zStart, /* Start of SQL text */
127564 const char *zEnd /* End of SQL text */
127565 ){
127566 TriggerStep *pTriggerStep;
127567
@@ -127000,13 +127569,17 @@
127569
127570 pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd);
127571 if( pTriggerStep ){
127572 pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
127573 pTriggerStep->pIdList = pColumn;
127574 pTriggerStep->pUpsert = pUpsert;
127575 pTriggerStep->orconf = orconf;
127576 }else{
127577 testcase( pColumn );
127578 sqlite3IdListDelete(db, pColumn);
127579 testcase( pUpsert );
127580 sqlite3UpsertDelete(db, pUpsert);
127581 }
127582 sqlite3SelectDelete(db, pSelect);
127583
127584 return pTriggerStep;
127585 }
@@ -127319,20 +127892,21 @@
127892 case TK_UPDATE: {
127893 sqlite3Update(pParse,
127894 targetSrcList(pParse, pStep),
127895 sqlite3ExprListDup(db, pStep->pExprList, 0),
127896 sqlite3ExprDup(db, pStep->pWhere, 0),
127897 pParse->eOrconf, 0, 0, 0
127898 );
127899 break;
127900 }
127901 case TK_INSERT: {
127902 sqlite3Insert(pParse,
127903 targetSrcList(pParse, pStep),
127904 sqlite3SelectDup(db, pStep->pSelect, 0),
127905 sqlite3IdListDup(db, pStep->pIdList),
127906 pParse->eOrconf,
127907 sqlite3UpsertDup(db, pStep->pUpsert)
127908 );
127909 break;
127910 }
127911 case TK_DELETE: {
127912 sqlite3DeleteFrom(pParse,
@@ -127806,11 +128380,12 @@
128380 SrcList *pTabList, /* The table in which we should change things */
128381 ExprList *pChanges, /* Things to be changed */
128382 Expr *pWhere, /* The WHERE clause. May be null */
128383 int onError, /* How to handle constraint errors */
128384 ExprList *pOrderBy, /* ORDER BY clause. May be null */
128385 Expr *pLimit, /* LIMIT clause. May be null */
128386 Upsert *pUpsert /* ON CONFLICT clause, or null */
128387 ){
128388 int i, j; /* Loop counters */
128389 Table *pTab; /* The table to be updated */
128390 int addrTop = 0; /* VDBE instruction address of the start of the loop */
128391 WhereInfo *pWInfo; /* Information about the WHERE clause */
@@ -127913,20 +128488,27 @@
128488 /* Allocate a cursors for the main database table and for all indices.
128489 ** The index cursors might not be used, but if they are used they
128490 ** need to occur right after the database cursor. So go ahead and
128491 ** allocate enough space, just in case.
128492 */
128493 iBaseCur = iDataCur = pParse->nTab++;
128494 iIdxCur = iDataCur+1;
128495 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
128496 testcase( pPk!=0 && pPk!=pTab->pIndex );
128497 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
128498 if( pPk==pIdx ){
128499 iDataCur = pParse->nTab;
 
128500 }
128501 pParse->nTab++;
128502 }
128503 if( pUpsert ){
128504 /* On an UPSERT, reuse the same cursors already opened by INSERT */
128505 iDataCur = pUpsert->iDataCur;
128506 iIdxCur = pUpsert->iIdxCur;
128507 pParse->nTab = iBaseCur;
128508 }
128509 pTabList->a[0].iCursor = iDataCur;
128510
128511 /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].
128512 ** Initialize aXRef[] and aToOpen[] to their default values.
128513 */
128514 aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
@@ -127939,10 +128521,12 @@
128521
128522 /* Initialize the name-context */
128523 memset(&sNC, 0, sizeof(sNC));
128524 sNC.pParse = pParse;
128525 sNC.pSrcList = pTabList;
128526 sNC.uNC.pUpsert = pUpsert;
128527 sNC.ncFlags = NC_UUpsert;
128528
128529 /* Resolve the column names in all the expressions of the
128530 ** of the UPDATE statement. Also find the column index
128531 ** for each column to be updated in the pChanges array. For each
128532 ** column to be updated, make sure we have authorization to change
@@ -128042,11 +128626,11 @@
128626
128627 /* Begin generating code. */
128628 v = sqlite3GetVdbe(pParse);
128629 if( v==0 ) goto update_cleanup;
128630 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
128631 sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
128632
128633 /* Allocate required registers. */
128634 if( !IsVirtual(pTab) ){
128635 regRowSet = ++pParse->nMem;
128636 regOldRowid = regNewRowid = ++pParse->nMem;
@@ -128093,12 +128677,20 @@
128677 pWhere, onError);
128678 goto update_cleanup;
128679 }
128680 #endif
128681
128682 /* Jump to labelBreak to abandon further processing of this UPDATE */
128683 labelContinue = labelBreak = sqlite3VdbeMakeLabel(v);
128684
128685 /* Not an UPSERT. Normal processing. Begin by
128686 ** initialize the count of updated rows */
128687 if( (db->flags&SQLITE_CountRows)!=0
128688 && !pParse->pTriggerTab
128689 && !pParse->nested
128690 && pUpsert==0
128691 ){
128692 regRowCount = ++pParse->nMem;
128693 sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
128694 }
128695
128696 if( HasRowid(pTab) ){
@@ -128107,50 +128699,65 @@
128699 assert( pPk!=0 );
128700 nPk = pPk->nKeyCol;
128701 iPk = pParse->nMem+1;
128702 pParse->nMem += nPk;
128703 regKey = ++pParse->nMem;
128704 if( pUpsert==0 ){
128705 iEph = pParse->nTab++;
128706 sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1);
128707 addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);
128708 sqlite3VdbeSetP4KeyInfo(pParse, pPk);
128709 }
128710 }
128711
128712 if( pUpsert ){
128713 /* If this is an UPSERT, then all cursors have already been opened by
128714 ** the outer INSERT and the data cursor should be pointing at the row
128715 ** that is to be updated. So bypass the code that searches for the
128716 ** row(s) to be updated.
128717 */
128718 pWInfo = 0;
128719 eOnePass = ONEPASS_SINGLE;
128720 sqlite3ExprIfFalse(pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL);
128721 }else{
128722 /* Begin the database scan.
128723 **
128724 ** Do not consider a single-pass strategy for a multi-row update if
128725 ** there are any triggers or foreign keys to process, or rows may
128726 ** be deleted as a result of REPLACE conflict handling. Any of these
128727 ** things might disturb a cursor being used to scan through the table
128728 ** or index, causing a single-pass approach to malfunction. */
128729 flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE;
128730 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
128731 flags |= WHERE_ONEPASS_MULTIROW;
128732 }
128733 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur);
128734 if( pWInfo==0 ) goto update_cleanup;
128735
128736 /* A one-pass strategy that might update more than one row may not
128737 ** be used if any column of the index used for the scan is being
128738 ** updated. Otherwise, if there is an index on "b", statements like
128739 ** the following could create an infinite loop:
128740 **
128741 ** UPDATE t1 SET b=b+1 WHERE b>?
128742 **
128743 ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI
128744 ** strategy that uses an index for which one or more columns are being
128745 ** updated. */
128746 eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
128747 if( eOnePass!=ONEPASS_SINGLE ){
128748 sqlite3MultiWrite(pParse);
128749 if( eOnePass==ONEPASS_MULTI ){
128750 int iCur = aiCurOnePass[1];
128751 if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
128752 eOnePass = ONEPASS_OFF;
128753 }
128754 assert( iCur!=iDataCur || !HasRowid(pTab) );
128755 }
128756 }
128757 }
128758
128759 if( HasRowid(pTab) ){
128760 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
128761 ** mode, write the rowid into the FIFO. In either of the one-pass modes,
128762 ** leave it in register regOldRowid. */
128763 sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
@@ -128166,73 +128773,72 @@
128773 for(i=0; i<nPk; i++){
128774 assert( pPk->aiColumn[i]>=0 );
128775 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur,pPk->aiColumn[i],iPk+i);
128776 }
128777 if( eOnePass ){
128778 if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen);
128779 nKey = nPk;
128780 regKey = iPk;
128781 }else{
128782 sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey,
128783 sqlite3IndexAffinityStr(db, pPk), nPk);
128784 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk);
128785 }
128786 }
128787
128788 if( pUpsert==0 ){
128789 if( eOnePass!=ONEPASS_MULTI ){
128790 sqlite3WhereEnd(pWInfo);
128791 }
128792
128793 if( !isView ){
128794 int addrOnce = 0;
128795
128796 /* Open every index that needs updating. */
128797 if( eOnePass!=ONEPASS_OFF ){
128798 if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;
128799 if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;
128800 }
128801
128802 if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
128803 addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
128804 }
128805 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur,
128806 aToOpen, 0, 0);
128807 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
128808 }
128809
128810 /* Top of the update loop */
128811 if( eOnePass!=ONEPASS_OFF ){
128812 if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
128813 assert( pPk );
128814 sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey,nKey);
128815 VdbeCoverageNeverTaken(v);
128816 }
128817 if( eOnePass!=ONEPASS_SINGLE ){
128818 labelContinue = sqlite3VdbeMakeLabel(v);
128819 }
128820 sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);
128821 VdbeCoverageIf(v, pPk==0);
128822 VdbeCoverageIf(v, pPk!=0);
128823 }else if( pPk ){
128824 labelContinue = sqlite3VdbeMakeLabel(v);
128825 sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v);
128826 addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey);
128827 sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0);
128828 VdbeCoverage(v);
128829 }else{
128830 labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet,labelBreak,
128831 regOldRowid);
128832 VdbeCoverage(v);
128833 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);
128834 VdbeCoverage(v);
128835 }
128836 }
128837
128838 /* If the rowid value will change, set register regNewRowid to
128839 ** contain the new value. If the rowid is not being modified,
 
128840 ** then regNewRowid is the same register as regOldRowid, which is
128841 ** already populated. */
128842 assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid );
128843 if( chngRowid ){
128844 sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);
@@ -128339,11 +128945,11 @@
128945
128946 /* Do constraint checks. */
128947 assert( regOldRowid>0 );
128948 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
128949 regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace,
128950 aXRef, 0);
128951
128952 /* Do FK constraint checks. */
128953 if( hasFK ){
128954 sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);
128955 }
@@ -128409,11 +129015,11 @@
129015 }
129016 }
129017
129018 /* Increment the row counter
129019 */
129020 if( regRowCount ){
129021 sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
129022 }
129023
129024 sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges,
129025 TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);
@@ -128436,20 +129042,19 @@
129042
129043 /* Update the sqlite_sequence table by storing the content of the
129044 ** maximum rowid counter values recorded while inserting into
129045 ** autoincrement tables.
129046 */
129047 if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){
129048 sqlite3AutoincrementEnd(pParse);
129049 }
129050
129051 /*
129052 ** Return the number of rows that were changed, if we are tracking
129053 ** that information.
 
129054 */
129055 if( regRowCount ){
129056 sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
129057 sqlite3VdbeSetNumCols(v, 1);
129058 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
129059 }
129060
@@ -128566,19 +129171,16 @@
129171
129172 bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);
129173
129174 if( bOnePass ){
129175 /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded
129176 ** above. */
 
129177 sqlite3VdbeChangeToNoop(v, addr);
 
 
 
129178 }else{
129179 /* Create a record from the argument register contents and insert it into
129180 ** the ephemeral table. */
129181 sqlite3MultiWrite(pParse);
129182 sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
129183 #ifdef SQLITE_DEBUG
129184 /* Signal an assert() within OP_MakeRecord that it is allowed to
129185 ** accept no-change records with serial_type 10 */
129186 sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC);
@@ -128617,10 +129219,262 @@
129219 }
129220 }
129221 #endif /* SQLITE_OMIT_VIRTUALTABLE */
129222
129223 /************** End of update.c **********************************************/
129224 /************** Begin file upsert.c ******************************************/
129225 /*
129226 ** 2018-04-12
129227 **
129228 ** The author disclaims copyright to this source code. In place of
129229 ** a legal notice, here is a blessing:
129230 **
129231 ** May you do good and not evil.
129232 ** May you find forgiveness for yourself and forgive others.
129233 ** May you share freely, never taking more than you give.
129234 **
129235 *************************************************************************
129236 ** This file contains code to implement various aspects of UPSERT
129237 ** processing and handling of the Upsert object.
129238 */
129239 /* #include "sqliteInt.h" */
129240
129241 #ifndef SQLITE_OMIT_UPSERT
129242 /*
129243 ** Free a list of Upsert objects
129244 */
129245 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
129246 if( p ){
129247 sqlite3ExprListDelete(db, p->pUpsertTarget);
129248 sqlite3ExprDelete(db, p->pUpsertTargetWhere);
129249 sqlite3ExprListDelete(db, p->pUpsertSet);
129250 sqlite3ExprDelete(db, p->pUpsertWhere);
129251 sqlite3DbFree(db, p);
129252 }
129253 }
129254
129255 /*
129256 ** Duplicate an Upsert object.
129257 */
129258 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
129259 if( p==0 ) return 0;
129260 return sqlite3UpsertNew(db,
129261 sqlite3ExprListDup(db, p->pUpsertTarget, 0),
129262 sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
129263 sqlite3ExprListDup(db, p->pUpsertSet, 0),
129264 sqlite3ExprDup(db, p->pUpsertWhere, 0)
129265 );
129266 }
129267
129268 /*
129269 ** Create a new Upsert object.
129270 */
129271 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
129272 sqlite3 *db, /* Determines which memory allocator to use */
129273 ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
129274 Expr *pTargetWhere, /* Optional WHERE clause on the target */
129275 ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
129276 Expr *pWhere /* WHERE clause for the ON CONFLICT UPDATE */
129277 ){
129278 Upsert *pNew;
129279 pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
129280 if( pNew==0 ){
129281 sqlite3ExprListDelete(db, pTarget);
129282 sqlite3ExprDelete(db, pTargetWhere);
129283 sqlite3ExprListDelete(db, pSet);
129284 sqlite3ExprDelete(db, pWhere);
129285 return 0;
129286 }else{
129287 pNew->pUpsertTarget = pTarget;
129288 pNew->pUpsertTargetWhere = pTargetWhere;
129289 pNew->pUpsertSet = pSet;
129290 pNew->pUpsertWhere = pWhere;
129291 pNew->pUpsertIdx = 0;
129292 }
129293 return pNew;
129294 }
129295
129296 /*
129297 ** Analyze the ON CONFLICT clause described by pUpsert. Resolve all
129298 ** symbols in the conflict-target.
129299 **
129300 ** Return SQLITE_OK if everything works, or an error code is something
129301 ** is wrong.
129302 */
129303 SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(
129304 Parse *pParse, /* The parsing context */
129305 SrcList *pTabList, /* Table into which we are inserting */
129306 Upsert *pUpsert /* The ON CONFLICT clauses */
129307 ){
129308 Table *pTab; /* That table into which we are inserting */
129309 int rc; /* Result code */
129310 int iCursor; /* Cursor used by pTab */
129311 Index *pIdx; /* One of the indexes of pTab */
129312 ExprList *pTarget; /* The conflict-target clause */
129313 Expr *pTerm; /* One term of the conflict-target clause */
129314 NameContext sNC; /* Context for resolving symbolic names */
129315 Expr sCol[2]; /* Index column converted into an Expr */
129316
129317 assert( pTabList->nSrc==1 );
129318 assert( pTabList->a[0].pTab!=0 );
129319 assert( pUpsert!=0 );
129320 assert( pUpsert->pUpsertTarget!=0 );
129321
129322 /* Resolve all symbolic names in the conflict-target clause, which
129323 ** includes both the list of columns and the optional partial-index
129324 ** WHERE clause.
129325 */
129326 memset(&sNC, 0, sizeof(sNC));
129327 sNC.pParse = pParse;
129328 sNC.pSrcList = pTabList;
129329 rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
129330 if( rc ) return rc;
129331 rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
129332 if( rc ) return rc;
129333
129334 /* Check to see if the conflict target matches the rowid. */
129335 pTab = pTabList->a[0].pTab;
129336 pTarget = pUpsert->pUpsertTarget;
129337 iCursor = pTabList->a[0].iCursor;
129338 if( HasRowid(pTab)
129339 && pTarget->nExpr==1
129340 && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
129341 && pTerm->iColumn==XN_ROWID
129342 ){
129343 /* The conflict-target is the rowid of the primary table */
129344 assert( pUpsert->pUpsertIdx==0 );
129345 return SQLITE_OK;
129346 }
129347
129348 /* Initialize sCol[0..1] to be an expression parse tree for a
129349 ** single column of an index. The sCol[0] node will be the TK_COLLATE
129350 ** operator and sCol[1] will be the TK_COLUMN operator. Code below
129351 ** will populate the specific collation and column number values
129352 ** prior to comparing against the conflict-target expression.
129353 */
129354 memset(sCol, 0, sizeof(sCol));
129355 sCol[0].op = TK_COLLATE;
129356 sCol[0].pLeft = &sCol[1];
129357 sCol[1].op = TK_COLUMN;
129358 sCol[1].iTable = pTabList->a[0].iCursor;
129359
129360 /* Check for matches against other indexes */
129361 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
129362 int ii, jj, nn;
129363 if( !IsUniqueIndex(pIdx) ) continue;
129364 if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
129365 if( pIdx->pPartIdxWhere ){
129366 if( pUpsert->pUpsertTargetWhere==0 ) continue;
129367 if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
129368 pIdx->pPartIdxWhere, iCursor)!=0 ){
129369 continue;
129370 }
129371 }
129372 nn = pIdx->nKeyCol;
129373 for(ii=0; ii<nn; ii++){
129374 Expr *pExpr;
129375 sCol[0].u.zToken = (char*)pIdx->azColl[ii];
129376 if( pIdx->aiColumn[ii]==XN_EXPR ){
129377 assert( pIdx->aColExpr!=0 );
129378 assert( pIdx->aColExpr->nExpr>ii );
129379 pExpr = pIdx->aColExpr->a[ii].pExpr;
129380 if( pExpr->op!=TK_COLLATE ){
129381 sCol[0].pLeft = pExpr;
129382 pExpr = &sCol[0];
129383 }
129384 }else{
129385 sCol[0].pLeft = &sCol[1];
129386 sCol[1].iColumn = pIdx->aiColumn[ii];
129387 pExpr = &sCol[0];
129388 }
129389 for(jj=0; jj<nn; jj++){
129390 if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
129391 break; /* Column ii of the index matches column jj of target */
129392 }
129393 }
129394 if( jj>=nn ){
129395 /* The target contains no match for column jj of the index */
129396 break;
129397 }
129398 }
129399 if( ii<nn ){
129400 /* Column ii of the index did not match any term of the conflict target.
129401 ** Continue the search with the next index. */
129402 continue;
129403 }
129404 pUpsert->pUpsertIdx = pIdx;
129405 return SQLITE_OK;
129406 }
129407 sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any "
129408 "PRIMARY KEY or UNIQUE constraint");
129409 return SQLITE_ERROR;
129410 }
129411
129412 /*
129413 ** Generate bytecode that does an UPDATE as part of an upsert.
129414 **
129415 ** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK.
129416 ** In this case parameter iCur is a cursor open on the table b-tree that
129417 ** currently points to the conflicting table row. Otherwise, if pIdx
129418 ** is not NULL, then pIdx is the constraint that failed and iCur is a
129419 ** cursor points to the conflicting row.
129420 */
129421 SQLITE_PRIVATE void sqlite3UpsertDoUpdate(
129422 Parse *pParse, /* The parsing and code-generating context */
129423 Upsert *pUpsert, /* The ON CONFLICT clause for the upsert */
129424 Table *pTab, /* The table being updated */
129425 Index *pIdx, /* The UNIQUE constraint that failed */
129426 int iCur /* Cursor for pIdx (or pTab if pIdx==NULL) */
129427 ){
129428 Vdbe *v = pParse->pVdbe;
129429 sqlite3 *db = pParse->db;
129430 SrcList *pSrc; /* FROM clause for the UPDATE */
129431 int iDataCur = pUpsert->iDataCur;
129432
129433 assert( v!=0 );
129434 VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
129435 if( pIdx && iCur!=iDataCur ){
129436 if( HasRowid(pTab) ){
129437 int regRowid = sqlite3GetTempReg(pParse);
129438 sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
129439 sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
129440 VdbeCoverage(v);
129441 sqlite3ReleaseTempReg(pParse, regRowid);
129442 }else{
129443 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
129444 int nPk = pPk->nKeyCol;
129445 int iPk = pParse->nMem+1;
129446 int i;
129447 pParse->nMem += nPk;
129448 for(i=0; i<nPk; i++){
129449 int k;
129450 assert( pPk->aiColumn[i]>=0 );
129451 k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
129452 sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i);
129453 VdbeComment((v, "%s.%s", pIdx->zName,
129454 pTab->aCol[pPk->aiColumn[i]].zName));
129455 }
129456 i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk);
129457 VdbeCoverage(v);
129458 sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
129459 "corrupt database", P4_STATIC);
129460 sqlite3VdbeJumpHere(v, i);
129461 }
129462 }
129463 /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So
129464 ** we have to make a copy before passing it down into sqlite3Update() */
129465 pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
129466 sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
129467 pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
129468 pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */
129469 pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */
129470 VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
129471 }
129472
129473 #endif /* SQLITE_OMIT_UPSERT */
129474
129475 /************** End of upsert.c **********************************************/
129476 /************** Begin file vacuum.c ******************************************/
129477 /*
129478 ** 2003 April 6
129479 **
129480 ** The author disclaims copyright to this source code. In place of
@@ -132018,10 +132872,13 @@
132872
132873 /* If this is the right table of a LEFT OUTER JOIN, allocate and
132874 ** initialize a memory cell that records if this table matches any
132875 ** row of the left table of the join.
132876 */
132877 assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
132878 || pLevel->iFrom>0 || (pTabItem[0].fg.jointype & JT_LEFT)==0
132879 );
132880 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
132881 pLevel->iLeftJoin = ++pParse->nMem;
132882 sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
132883 VdbeComment((v, "init LEFT JOIN no-match flag"));
132884 }
@@ -132551,13 +133408,20 @@
133408 }
133409
133410 /* If pIdx is an index on one or more expressions, then look through
133411 ** all the expressions in pWInfo and try to transform matching expressions
133412 ** into reference to index columns.
133413 **
133414 ** Do not do this for the RHS of a LEFT JOIN. This is because the
133415 ** expression may be evaluated after OP_NullRow has been executed on
133416 ** the cursor. In this case it is important to do the full evaluation,
133417 ** as the result of the expression may not be NULL, even if all table
133418 ** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a
133419 */
133420 if( pLevel->iLeftJoin==0 ){
133421 whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
133422 }
133423
133424 /* Record the instruction used to terminate the loop. */
133425 if( pLoop->wsFlags & WHERE_ONEROW ){
133426 pLevel->op = OP_Noop;
133427 }else if( bRev ){
@@ -132709,11 +133573,10 @@
133573 if( pWC->nTerm>1 ){
133574 int iTerm;
133575 for(iTerm=0; iTerm<pWC->nTerm; iTerm++){
133576 Expr *pExpr = pWC->a[iTerm].pExpr;
133577 if( &pWC->a[iTerm] == pTerm ) continue;
 
133578 testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
133579 testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
133580 if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
133581 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
133582 testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
@@ -132734,11 +133597,14 @@
133597 WhereTerm *pOrTerm = &pOrWc->a[ii];
133598 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
133599 WhereInfo *pSubWInfo; /* Info for single OR-term scan */
133600 Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
133601 int jmp1 = 0; /* Address of jump operation */
133602 assert( (pTabItem[0].fg.jointype & JT_LEFT)==0
133603 || ExprHasProperty(pOrExpr, EP_FromJoin)
133604 );
133605 if( pAndExpr ){
133606 pAndExpr->pLeft = pOrExpr;
133607 pOrExpr = pAndExpr;
133608 }
133609 /* Loop through table entries that match term pOrTerm. */
133610 WHERETRACE(0xffff, ("Subplan for OR-clause:\n"));
@@ -132917,11 +133783,11 @@
133783 pWInfo->untestedTerms = 1;
133784 continue;
133785 }
133786 pE = pTerm->pExpr;
133787 assert( pE!=0 );
133788 if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){
133789 continue;
133790 }
133791
133792 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
133793 iNext = 2;
@@ -133844,11 +134710,10 @@
134710 pTerm = &pWC->a[idxTerm];
134711 markTermAsChild(pWC, idxNew, idxTerm);
134712 }else{
134713 sqlite3ExprListDelete(db, pList);
134714 }
 
134715 }
134716 }
134717 }
134718 #endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */
134719
@@ -136981,19 +137846,16 @@
137846
137847 /* Do not allow the upper bound of a LIKE optimization range constraint
137848 ** to mix with a lower range bound from some other source */
137849 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
137850
137851 /* Do not allow constraints from the WHERE clause to be used by the
137852 ** right table of a LEFT JOIN. Only constraints in the ON clause are
137853 ** allowed */
137854 if( (pSrc->fg.jointype & JT_LEFT)!=0
137855 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
 
137856 ){
 
 
137857 continue;
137858 }
137859
137860 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
137861 pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE;
@@ -139983,12 +140845,14 @@
140845 ** for terminal symbols is called "yy0".
140846 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
140847 ** zero the stack is dynamically sized using realloc()
140848 ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument
140849 ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument
140850 ** sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter
140851 ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser
140852 ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser
140853 ** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context
140854 ** YYERRORSYMBOL is the code number of the error symbol. If not
140855 ** defined, then do no error processing.
140856 ** YYNSTATE the combined number of states.
140857 ** YYNRULE the number of rules in the grammar
140858 ** YYNTOKEN Number of terminal symbols
@@ -140004,48 +140868,55 @@
140868 #ifndef INTERFACE
140869 # define INTERFACE 1
140870 #endif
140871 /************* Begin control #defines *****************************************/
140872 #define YYCODETYPE unsigned char
140873 #define YYNOCODE 255
140874 #define YYACTIONTYPE unsigned short int
140875 #define YYWILDCARD 84
140876 #define sqlite3ParserTOKENTYPE Token
140877 typedef union {
140878 int yyinit;
140879 sqlite3ParserTOKENTYPE yy0;
140880 const char* yy36;
140881 TriggerStep* yy47;
140882 With* yy91;
140883 struct {int value; int mask;} yy107;
140884 Expr* yy182;
140885 Upsert* yy198;
140886 ExprList* yy232;
140887 struct TrigEvent yy300;
140888 Select* yy399;
140889 SrcList* yy427;
140890 int yy502;
140891 IdList* yy510;
140892 } YYMINORTYPE;
140893 #ifndef YYSTACKDEPTH
140894 #define YYSTACKDEPTH 100
140895 #endif
140896 #define sqlite3ParserARG_SDECL
140897 #define sqlite3ParserARG_PDECL
140898 #define sqlite3ParserARG_PARAM
140899 #define sqlite3ParserARG_FETCH
140900 #define sqlite3ParserARG_STORE
140901 #define sqlite3ParserCTX_SDECL Parse *pParse;
140902 #define sqlite3ParserCTX_PDECL ,Parse *pParse
140903 #define sqlite3ParserCTX_PARAM ,pParse
140904 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
140905 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
140906 #define YYFALLBACK 1
140907 #define YYNSTATE 490
140908 #define YYNRULE 341
140909 #define YYNTOKEN 145
140910 #define YY_MAX_SHIFT 489
140911 #define YY_MIN_SHIFTREDUCE 705
140912 #define YY_MAX_SHIFTREDUCE 1045
140913 #define YY_ERROR_ACTION 1046
140914 #define YY_ACCEPT_ACTION 1047
140915 #define YY_NO_ACTION 1048
140916 #define YY_MIN_REDUCE 1049
140917 #define YY_MAX_REDUCE 1389
140918 /************* End control #defines *******************************************/
140919
140920 /* Define the yytestcase() macro to be a no-op if is not already defined
140921 ** otherwise.
140922 **
@@ -140107,485 +140978,507 @@
140978 ** yy_reduce_ofst[] For each state, the offset into yy_action for
140979 ** shifting non-terminals after a reduce.
140980 ** yy_default[] Default action for each state.
140981 **
140982 *********** Begin parsing tables **********************************************/
140983 #define YY_ACTTAB_COUNT (1657)
140984 static const YYACTIONTYPE yy_action[] = {
140985 /* 0 */ 349, 99, 96, 185, 99, 96, 185, 233, 1047, 1,
140986 /* 10 */ 1, 489, 2, 1051, 484, 477, 477, 477, 260, 351,
140987 /* 20 */ 121, 1310, 1120, 1120, 1178, 1115, 1094, 1128, 380, 380,
140988 /* 30 */ 380, 835, 454, 410, 1115, 59, 59, 1357, 425, 836,
140989 /* 40 */ 710, 711, 712, 106, 107, 97, 1023, 1023, 900, 903,
140990 /* 50 */ 892, 892, 104, 104, 105, 105, 105, 105, 346, 238,
140991 /* 60 */ 238, 99, 96, 185, 238, 238, 889, 889, 901, 904,
140992 /* 70 */ 460, 481, 351, 99, 96, 185, 481, 347, 1177, 82,
140993 /* 80 */ 388, 214, 182, 23, 194, 103, 103, 103, 103, 102,
140994 /* 90 */ 102, 101, 101, 101, 100, 381, 106, 107, 97, 1023,
140995 /* 100 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105,
140996 /* 110 */ 105, 10, 385, 484, 24, 484, 1333, 489, 2, 1051,
140997 /* 120 */ 335, 1043, 108, 893, 260, 351, 121, 99, 96, 185,
140998 /* 130 */ 100, 381, 386, 1128, 59, 59, 59, 59, 103, 103,
140999 /* 140 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 106,
141000 /* 150 */ 107, 97, 1023, 1023, 900, 903, 892, 892, 104, 104,
141001 /* 160 */ 105, 105, 105, 105, 360, 238, 238, 170, 170, 467,
141002 /* 170 */ 455, 467, 464, 67, 381, 329, 169, 481, 351, 343,
141003 /* 180 */ 338, 400, 1044, 68, 101, 101, 101, 100, 381, 393,
141004 /* 190 */ 194, 103, 103, 103, 103, 102, 102, 101, 101, 101,
141005 /* 200 */ 100, 381, 106, 107, 97, 1023, 1023, 900, 903, 892,
141006 /* 210 */ 892, 104, 104, 105, 105, 105, 105, 483, 385, 103,
141007 /* 220 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141008 /* 230 */ 268, 351, 946, 946, 422, 296, 102, 102, 101, 101,
141009 /* 240 */ 101, 100, 381, 861, 103, 103, 103, 103, 102, 102,
141010 /* 250 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023,
141011 /* 260 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105,
141012 /* 270 */ 484, 983, 1383, 206, 1353, 1383, 438, 435, 434, 281,
141013 /* 280 */ 396, 269, 1089, 941, 351, 1002, 433, 861, 743, 401,
141014 /* 290 */ 282, 57, 57, 482, 145, 791, 791, 103, 103, 103,
141015 /* 300 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 107,
141016 /* 310 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105,
141017 /* 320 */ 105, 105, 105, 281, 1002, 1003, 1004, 206, 879, 319,
141018 /* 330 */ 438, 435, 434, 981, 259, 474, 360, 351, 1118, 1118,
141019 /* 340 */ 433, 736, 379, 378, 872, 1002, 1356, 322, 871, 766,
141020 /* 350 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100,
141021 /* 360 */ 381, 106, 107, 97, 1023, 1023, 900, 903, 892, 892,
141022 /* 370 */ 104, 104, 105, 105, 105, 105, 484, 801, 484, 871,
141023 /* 380 */ 871, 873, 401, 282, 1002, 1003, 1004, 1030, 360, 1030,
141024 /* 390 */ 351, 983, 1384, 213, 880, 1384, 145, 59, 59, 59,
141025 /* 400 */ 59, 1002, 244, 103, 103, 103, 103, 102, 102, 101,
141026 /* 410 */ 101, 101, 100, 381, 106, 107, 97, 1023, 1023, 900,
141027 /* 420 */ 903, 892, 892, 104, 104, 105, 105, 105, 105, 274,
141028 /* 430 */ 484, 110, 467, 479, 467, 444, 259, 474, 232, 232,
141029 /* 440 */ 1002, 1003, 1004, 351, 210, 335, 982, 866, 1385, 336,
141030 /* 450 */ 481, 59, 59, 981, 245, 307, 103, 103, 103, 103,
141031 /* 460 */ 102, 102, 101, 101, 101, 100, 381, 106, 107, 97,
141032 /* 470 */ 1023, 1023, 900, 903, 892, 892, 104, 104, 105, 105,
141033 /* 480 */ 105, 105, 453, 459, 484, 408, 377, 259, 474, 271,
141034 /* 490 */ 183, 273, 209, 208, 207, 356, 351, 307, 178, 177,
141035 /* 500 */ 127, 1006, 1098, 14, 14, 43, 43, 1044, 425, 103,
141036 /* 510 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141037 /* 520 */ 106, 107, 97, 1023, 1023, 900, 903, 892, 892, 104,
141038 /* 530 */ 104, 105, 105, 105, 105, 294, 1132, 408, 160, 484,
141039 /* 540 */ 408, 1006, 129, 962, 1209, 239, 239, 481, 307, 425,
141040 /* 550 */ 1309, 1097, 351, 235, 243, 272, 820, 481, 963, 425,
141041 /* 560 */ 11, 11, 103, 103, 103, 103, 102, 102, 101, 101,
141042 /* 570 */ 101, 100, 381, 964, 362, 1002, 106, 107, 97, 1023,
141043 /* 580 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105,
141044 /* 590 */ 105, 1275, 161, 126, 777, 289, 1209, 292, 1072, 357,
141045 /* 600 */ 1209, 1127, 476, 357, 778, 425, 247, 425, 351, 248,
141046 /* 610 */ 414, 364, 414, 171, 1002, 1003, 1004, 84, 103, 103,
141047 /* 620 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 1002,
141048 /* 630 */ 184, 484, 106, 107, 97, 1023, 1023, 900, 903, 892,
141049 /* 640 */ 892, 104, 104, 105, 105, 105, 105, 1123, 1209, 287,
141050 /* 650 */ 484, 1209, 11, 11, 179, 820, 259, 474, 307, 237,
141051 /* 660 */ 182, 351, 321, 365, 414, 308, 367, 366, 1002, 1003,
141052 /* 670 */ 1004, 44, 44, 87, 103, 103, 103, 103, 102, 102,
141053 /* 680 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023,
141054 /* 690 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105,
141055 /* 700 */ 246, 368, 280, 128, 10, 358, 146, 796, 835, 258,
141056 /* 710 */ 1020, 88, 795, 86, 351, 421, 836, 943, 376, 348,
141057 /* 720 */ 191, 943, 1318, 267, 308, 279, 456, 103, 103, 103,
141058 /* 730 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 95,
141059 /* 740 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105,
141060 /* 750 */ 105, 105, 105, 420, 249, 238, 238, 238, 238, 79,
141061 /* 760 */ 375, 125, 305, 29, 262, 978, 351, 481, 337, 481,
141062 /* 770 */ 756, 755, 304, 278, 415, 15, 81, 940, 1126, 940,
141063 /* 780 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100,
141064 /* 790 */ 381, 107, 97, 1023, 1023, 900, 903, 892, 892, 104,
141065 /* 800 */ 104, 105, 105, 105, 105, 457, 263, 484, 174, 484,
141066 /* 810 */ 238, 238, 863, 407, 402, 216, 216, 351, 409, 193,
141067 /* 820 */ 283, 216, 481, 81, 763, 764, 266, 5, 13, 13,
141068 /* 830 */ 34, 34, 103, 103, 103, 103, 102, 102, 101, 101,
141069 /* 840 */ 101, 100, 381, 97, 1023, 1023, 900, 903, 892, 892,
141070 /* 850 */ 104, 104, 105, 105, 105, 105, 93, 475, 1002, 4,
141071 /* 860 */ 403, 1002, 340, 431, 1002, 297, 212, 1277, 81, 746,
141072 /* 870 */ 1163, 152, 926, 478, 166, 212, 757, 829, 930, 939,
141073 /* 880 */ 216, 939, 858, 103, 103, 103, 103, 102, 102, 101,
141074 /* 890 */ 101, 101, 100, 381, 238, 238, 382, 1002, 1003, 1004,
141075 /* 900 */ 1002, 1003, 1004, 1002, 1003, 1004, 481, 439, 472, 746,
141076 /* 910 */ 105, 105, 105, 105, 98, 758, 1162, 145, 930, 412,
141077 /* 920 */ 879, 406, 793, 81, 395, 89, 90, 91, 105, 105,
141078 /* 930 */ 105, 105, 1323, 92, 484, 382, 486, 485, 240, 275,
141079 /* 940 */ 871, 103, 103, 103, 103, 102, 102, 101, 101, 101,
141080 /* 950 */ 100, 381, 1096, 371, 355, 45, 45, 259, 474, 103,
141081 /* 960 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381,
141082 /* 970 */ 1150, 871, 871, 873, 874, 21, 1332, 991, 384, 730,
141083 /* 980 */ 722, 242, 123, 1298, 124, 875, 333, 333, 332, 227,
141084 /* 990 */ 330, 991, 384, 719, 256, 242, 484, 391, 413, 1297,
141085 /* 1000 */ 333, 333, 332, 227, 330, 748, 187, 719, 265, 470,
141086 /* 1010 */ 1279, 1002, 484, 417, 391, 390, 264, 11, 11, 284,
141087 /* 1020 */ 187, 732, 265, 93, 475, 875, 4, 1279, 1281, 419,
141088 /* 1030 */ 264, 369, 416, 11, 11, 1159, 288, 484, 399, 1346,
141089 /* 1040 */ 478, 379, 378, 291, 484, 293, 189, 250, 295, 1027,
141090 /* 1050 */ 1002, 1003, 1004, 190, 1029, 1111, 140, 188, 11, 11,
141091 /* 1060 */ 189, 732, 1028, 382, 923, 46, 46, 190, 1095, 230,
141092 /* 1070 */ 140, 188, 462, 93, 475, 472, 4, 300, 309, 391,
141093 /* 1080 */ 373, 6, 1069, 217, 739, 310, 1030, 879, 1030, 1171,
141094 /* 1090 */ 478, 352, 1279, 90, 91, 800, 259, 474, 1208, 484,
141095 /* 1100 */ 92, 1268, 382, 486, 485, 352, 1002, 871, 879, 426,
141096 /* 1110 */ 259, 474, 172, 382, 238, 238, 1146, 170, 1021, 389,
141097 /* 1120 */ 47, 47, 1157, 739, 872, 472, 481, 469, 871, 350,
141098 /* 1130 */ 1214, 83, 475, 389, 4, 1078, 1071, 879, 871, 871,
141099 /* 1140 */ 873, 874, 21, 90, 91, 1002, 1003, 1004, 478, 251,
141100 /* 1150 */ 92, 251, 382, 486, 485, 443, 370, 871, 1021, 871,
141101 /* 1160 */ 871, 873, 224, 241, 306, 441, 301, 440, 211, 1060,
141102 /* 1170 */ 820, 382, 822, 447, 299, 1059, 484, 1061, 1143, 962,
141103 /* 1180 */ 430, 796, 484, 472, 1340, 312, 795, 465, 871, 871,
141104 /* 1190 */ 873, 874, 21, 314, 963, 879, 316, 59, 59, 1002,
141105 /* 1200 */ 9, 90, 91, 48, 48, 238, 238, 210, 92, 964,
141106 /* 1210 */ 382, 486, 485, 176, 334, 871, 242, 481, 1193, 238,
141107 /* 1220 */ 238, 333, 333, 332, 227, 330, 394, 270, 719, 277,
141108 /* 1230 */ 471, 481, 467, 466, 484, 145, 217, 1201, 1002, 1003,
141109 /* 1240 */ 1004, 187, 3, 265, 184, 445, 871, 871, 873, 874,
141110 /* 1250 */ 21, 264, 1337, 450, 1051, 39, 39, 392, 356, 260,
141111 /* 1260 */ 342, 121, 468, 411, 436, 821, 180, 1094, 1128, 820,
141112 /* 1270 */ 303, 1021, 1272, 1271, 299, 259, 474, 238, 238, 1002,
141113 /* 1280 */ 473, 189, 484, 318, 327, 238, 238, 484, 190, 481,
141114 /* 1290 */ 446, 140, 188, 1343, 238, 238, 1038, 481, 148, 175,
141115 /* 1300 */ 238, 238, 484, 49, 49, 219, 481, 484, 35, 35,
141116 /* 1310 */ 1317, 1021, 481, 484, 1035, 484, 1315, 484, 1002, 1003,
141117 /* 1320 */ 1004, 484, 66, 36, 36, 194, 352, 484, 38, 38,
141118 /* 1330 */ 484, 259, 474, 69, 50, 50, 51, 51, 52, 52,
141119 /* 1340 */ 359, 484, 12, 12, 484, 1198, 484, 158, 53, 53,
141120 /* 1350 */ 405, 112, 112, 385, 389, 484, 26, 484, 143, 484,
141121 /* 1360 */ 150, 484, 54, 54, 397, 40, 40, 55, 55, 484,
141122 /* 1370 */ 79, 484, 153, 1190, 484, 154, 56, 56, 41, 41,
141123 /* 1380 */ 58, 58, 133, 133, 484, 398, 484, 429, 484, 155,
141124 /* 1390 */ 134, 134, 135, 135, 484, 63, 63, 484, 341, 484,
141125 /* 1400 */ 339, 484, 196, 484, 156, 42, 42, 113, 113, 60,
141126 /* 1410 */ 60, 484, 404, 484, 27, 114, 114, 1204, 115, 115,
141127 /* 1420 */ 111, 111, 132, 132, 131, 131, 1266, 418, 484, 162,
141128 /* 1430 */ 484, 200, 119, 119, 118, 118, 484, 74, 424, 484,
141129 /* 1440 */ 1286, 484, 231, 484, 202, 484, 167, 286, 427, 116,
141130 /* 1450 */ 116, 117, 117, 290, 203, 442, 1062, 62, 62, 204,
141131 /* 1460 */ 64, 64, 61, 61, 33, 33, 37, 37, 344, 372,
141132 /* 1470 */ 1114, 1105, 748, 1113, 374, 1112, 254, 458, 1086, 255,
141133 /* 1480 */ 345, 1085, 302, 1084, 1355, 78, 1154, 311, 1104, 449,
141134 /* 1490 */ 452, 1155, 1153, 218, 7, 313, 315, 320, 1152, 85,
141135 /* 1500 */ 1252, 317, 109, 80, 463, 225, 461, 1068, 25, 487,
141136 /* 1510 */ 997, 323, 257, 226, 229, 228, 1136, 324, 325, 326,
141137 /* 1520 */ 488, 136, 1057, 1052, 1302, 1303, 1301, 706, 1300, 137,
141138 /* 1530 */ 122, 138, 383, 173, 1082, 261, 186, 252, 1081, 65,
141139 /* 1540 */ 387, 120, 938, 936, 855, 353, 149, 1079, 139, 151,
141140 /* 1550 */ 192, 780, 195, 276, 952, 157, 141, 361, 70, 363,
141141 /* 1560 */ 859, 159, 71, 72, 142, 73, 955, 354, 147, 197,
141142 /* 1570 */ 198, 951, 130, 16, 199, 285, 216, 1032, 201, 423,
141143 /* 1580 */ 164, 944, 163, 28, 721, 428, 304, 165, 205, 759,
141144 /* 1590 */ 75, 432, 298, 17, 18, 437, 76, 253, 878, 144,
141145 /* 1600 */ 877, 906, 77, 986, 30, 448, 987, 31, 451, 181,
141146 /* 1610 */ 234, 236, 168, 828, 823, 89, 910, 921, 81, 907,
141147 /* 1620 */ 215, 905, 909, 961, 960, 19, 221, 20, 220, 22,
141148 /* 1630 */ 32, 331, 876, 731, 94, 790, 794, 8, 992, 222,
141149 /* 1640 */ 480, 328, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048,
141150 /* 1650 */ 223, 1048, 1048, 1048, 1048, 1348, 1347,
141151 };
141152 static const YYCODETYPE yy_lookahead[] = {
141153 /* 0 */ 174, 226, 227, 228, 226, 227, 228, 172, 145, 146,
141154 /* 10 */ 147, 148, 149, 150, 153, 169, 170, 171, 155, 19,
141155 /* 20 */ 157, 246, 192, 193, 177, 181, 182, 164, 169, 170,
141156 /* 30 */ 171, 31, 164, 153, 190, 174, 175, 187, 153, 39,
141157 /* 40 */ 7, 8, 9, 43, 44, 45, 46, 47, 48, 49,
141158 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 196,
141159 /* 60 */ 197, 226, 227, 228, 196, 197, 46, 47, 48, 49,
141160 /* 70 */ 209, 208, 19, 226, 227, 228, 208, 174, 177, 26,
141161 /* 80 */ 195, 213, 214, 22, 221, 85, 86, 87, 88, 89,
141162 /* 90 */ 90, 91, 92, 93, 94, 95, 43, 44, 45, 46,
141163 /* 100 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
141164 /* 110 */ 57, 172, 249, 153, 53, 153, 147, 148, 149, 150,
141165 /* 120 */ 22, 23, 69, 103, 155, 19, 157, 226, 227, 228,
141166 /* 130 */ 94, 95, 247, 164, 174, 175, 174, 175, 85, 86,
141167 /* 140 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 43,
141168 /* 150 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
141169 /* 160 */ 54, 55, 56, 57, 153, 196, 197, 153, 153, 209,
141170 /* 170 */ 210, 209, 210, 67, 95, 161, 237, 208, 19, 165,
141171 /* 180 */ 165, 242, 84, 24, 91, 92, 93, 94, 95, 223,
141172 /* 190 */ 221, 85, 86, 87, 88, 89, 90, 91, 92, 93,
141173 /* 200 */ 94, 95, 43, 44, 45, 46, 47, 48, 49, 50,
141174 /* 210 */ 51, 52, 53, 54, 55, 56, 57, 153, 249, 85,
141175 /* 220 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141176 /* 230 */ 219, 19, 109, 110, 111, 23, 89, 90, 91, 92,
141177 /* 240 */ 93, 94, 95, 73, 85, 86, 87, 88, 89, 90,
141178 /* 250 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47,
141179 /* 260 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
141180 /* 270 */ 153, 22, 23, 101, 173, 26, 104, 105, 106, 109,
141181 /* 280 */ 110, 111, 181, 11, 19, 59, 114, 73, 23, 110,
141182 /* 290 */ 111, 174, 175, 116, 80, 118, 119, 85, 86, 87,
141183 /* 300 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44,
141184 /* 310 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
141185 /* 320 */ 55, 56, 57, 109, 98, 99, 100, 101, 83, 153,
141186 /* 330 */ 104, 105, 106, 84, 120, 121, 153, 19, 192, 193,
141187 /* 340 */ 114, 23, 89, 90, 99, 59, 23, 230, 103, 26,
141188 /* 350 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
141189 /* 360 */ 95, 43, 44, 45, 46, 47, 48, 49, 50, 51,
141190 /* 370 */ 52, 53, 54, 55, 56, 57, 153, 91, 153, 134,
141191 /* 380 */ 135, 136, 110, 111, 98, 99, 100, 134, 153, 136,
141192 /* 390 */ 19, 22, 23, 26, 23, 26, 80, 174, 175, 174,
141193 /* 400 */ 175, 59, 219, 85, 86, 87, 88, 89, 90, 91,
141194 /* 410 */ 92, 93, 94, 95, 43, 44, 45, 46, 47, 48,
141195 /* 420 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 16,
141196 /* 430 */ 153, 22, 209, 210, 209, 210, 120, 121, 196, 197,
141197 /* 440 */ 98, 99, 100, 19, 46, 22, 23, 23, 252, 253,
141198 /* 450 */ 208, 174, 175, 84, 219, 153, 85, 86, 87, 88,
141199 /* 460 */ 89, 90, 91, 92, 93, 94, 95, 43, 44, 45,
141200 /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
141201 /* 480 */ 56, 57, 153, 153, 153, 153, 209, 120, 121, 76,
141202 /* 490 */ 153, 78, 109, 110, 111, 97, 19, 153, 89, 90,
141203 /* 500 */ 198, 59, 183, 174, 175, 174, 175, 84, 153, 85,
141204 /* 510 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141205 /* 520 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
141206 /* 530 */ 53, 54, 55, 56, 57, 16, 197, 153, 22, 153,
141207 /* 540 */ 153, 99, 198, 12, 153, 196, 197, 208, 153, 153,
141208 /* 550 */ 195, 183, 19, 23, 222, 142, 26, 208, 27, 153,
141209 /* 560 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92,
141210 /* 570 */ 93, 94, 95, 42, 188, 59, 43, 44, 45, 46,
141211 /* 580 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
141212 /* 590 */ 57, 195, 22, 198, 63, 76, 153, 78, 167, 168,
141213 /* 600 */ 153, 195, 167, 168, 73, 153, 222, 153, 19, 222,
141214 /* 610 */ 153, 220, 153, 24, 98, 99, 100, 140, 85, 86,
141215 /* 620 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 59,
141216 /* 630 */ 100, 153, 43, 44, 45, 46, 47, 48, 49, 50,
141217 /* 640 */ 51, 52, 53, 54, 55, 56, 57, 195, 153, 195,
141218 /* 650 */ 153, 153, 174, 175, 26, 125, 120, 121, 153, 213,
141219 /* 660 */ 214, 19, 153, 220, 153, 153, 188, 220, 98, 99,
141220 /* 670 */ 100, 174, 175, 140, 85, 86, 87, 88, 89, 90,
141221 /* 680 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47,
141222 /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
141223 /* 700 */ 243, 189, 243, 198, 172, 250, 251, 117, 31, 201,
141224 /* 710 */ 26, 139, 122, 141, 19, 220, 39, 29, 220, 211,
141225 /* 720 */ 24, 33, 153, 164, 153, 164, 19, 85, 86, 87,
141226 /* 730 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44,
141227 /* 740 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
141228 /* 750 */ 55, 56, 57, 65, 243, 196, 197, 196, 197, 131,
141229 /* 760 */ 189, 22, 103, 24, 153, 23, 19, 208, 26, 208,
141230 /* 770 */ 102, 103, 113, 23, 242, 22, 26, 134, 164, 136,
141231 /* 780 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
141232 /* 790 */ 95, 44, 45, 46, 47, 48, 49, 50, 51, 52,
141233 /* 800 */ 53, 54, 55, 56, 57, 98, 153, 153, 124, 153,
141234 /* 810 */ 196, 197, 23, 23, 61, 26, 26, 19, 23, 123,
141235 /* 820 */ 23, 26, 208, 26, 7, 8, 153, 22, 174, 175,
141236 /* 830 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92,
141237 /* 840 */ 93, 94, 95, 45, 46, 47, 48, 49, 50, 51,
141238 /* 850 */ 52, 53, 54, 55, 56, 57, 19, 20, 59, 22,
141239 /* 860 */ 111, 59, 164, 23, 59, 23, 26, 153, 26, 59,
141240 /* 870 */ 153, 72, 23, 36, 72, 26, 35, 23, 59, 134,
141241 /* 880 */ 26, 136, 133, 85, 86, 87, 88, 89, 90, 91,
141242 /* 890 */ 92, 93, 94, 95, 196, 197, 59, 98, 99, 100,
141243 /* 900 */ 98, 99, 100, 98, 99, 100, 208, 66, 71, 99,
141244 /* 910 */ 54, 55, 56, 57, 58, 74, 153, 80, 99, 19,
141245 /* 920 */ 83, 223, 23, 26, 153, 26, 89, 90, 54, 55,
141246 /* 930 */ 56, 57, 153, 96, 153, 98, 99, 100, 22, 153,
141247 /* 940 */ 103, 85, 86, 87, 88, 89, 90, 91, 92, 93,
141248 /* 950 */ 94, 95, 183, 112, 158, 174, 175, 120, 121, 85,
141249 /* 960 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
141250 /* 970 */ 215, 134, 135, 136, 137, 138, 0, 1, 2, 23,
141251 /* 980 */ 21, 5, 26, 153, 22, 59, 10, 11, 12, 13,
141252 /* 990 */ 14, 1, 2, 17, 212, 5, 153, 153, 98, 153,
141253 /* 1000 */ 10, 11, 12, 13, 14, 108, 30, 17, 32, 193,
141254 /* 1010 */ 153, 59, 153, 153, 170, 171, 40, 174, 175, 153,
141255 /* 1020 */ 30, 59, 32, 19, 20, 99, 22, 170, 171, 233,
141256 /* 1030 */ 40, 188, 236, 174, 175, 153, 153, 153, 79, 123,
141257 /* 1040 */ 36, 89, 90, 153, 153, 153, 70, 188, 153, 97,
141258 /* 1050 */ 98, 99, 100, 77, 102, 153, 80, 81, 174, 175,
141259 /* 1060 */ 70, 99, 110, 59, 105, 174, 175, 77, 153, 238,
141260 /* 1070 */ 80, 81, 188, 19, 20, 71, 22, 153, 153, 235,
141261 /* 1080 */ 19, 22, 164, 24, 59, 153, 134, 83, 136, 153,
141262 /* 1090 */ 36, 115, 235, 89, 90, 91, 120, 121, 153, 153,
141263 /* 1100 */ 96, 142, 98, 99, 100, 115, 59, 103, 83, 239,
141264 /* 1110 */ 120, 121, 199, 59, 196, 197, 153, 153, 59, 143,
141265 /* 1120 */ 174, 175, 153, 98, 99, 71, 208, 153, 103, 165,
141266 /* 1130 */ 153, 19, 20, 143, 22, 153, 153, 83, 134, 135,
141267 /* 1140 */ 136, 137, 138, 89, 90, 98, 99, 100, 36, 185,
141268 /* 1150 */ 96, 187, 98, 99, 100, 91, 95, 103, 99, 134,
141269 /* 1160 */ 135, 136, 101, 102, 103, 104, 105, 106, 107, 153,
141270 /* 1170 */ 26, 59, 125, 164, 113, 153, 153, 153, 212, 12,
141271 /* 1180 */ 19, 117, 153, 71, 153, 212, 122, 164, 134, 135,
141272 /* 1190 */ 136, 137, 138, 212, 27, 83, 212, 174, 175, 59,
141273 /* 1200 */ 200, 89, 90, 174, 175, 196, 197, 46, 96, 42,
141274 /* 1210 */ 98, 99, 100, 172, 151, 103, 5, 208, 203, 196,
141275 /* 1220 */ 197, 10, 11, 12, 13, 14, 216, 216, 17, 244,
141276 /* 1230 */ 63, 208, 209, 210, 153, 80, 24, 203, 98, 99,
141277 /* 1240 */ 100, 30, 22, 32, 100, 164, 134, 135, 136, 137,
141278 /* 1250 */ 138, 40, 148, 164, 150, 174, 175, 102, 97, 155,
141279 /* 1260 */ 203, 157, 164, 244, 178, 125, 186, 182, 164, 125,
141280 /* 1270 */ 177, 59, 177, 177, 113, 120, 121, 196, 197, 59,
141281 /* 1280 */ 232, 70, 153, 216, 202, 196, 197, 153, 77, 208,
141282 /* 1290 */ 209, 80, 81, 156, 196, 197, 60, 208, 248, 200,
141283 /* 1300 */ 196, 197, 153, 174, 175, 123, 208, 153, 174, 175,
141284 /* 1310 */ 160, 99, 208, 153, 38, 153, 160, 153, 98, 99,
141285 /* 1320 */ 100, 153, 245, 174, 175, 221, 115, 153, 174, 175,
141286 /* 1330 */ 153, 120, 121, 245, 174, 175, 174, 175, 174, 175,
141287 /* 1340 */ 160, 153, 174, 175, 153, 225, 153, 22, 174, 175,
141288 /* 1350 */ 97, 174, 175, 249, 143, 153, 224, 153, 43, 153,
141289 /* 1360 */ 191, 153, 174, 175, 18, 174, 175, 174, 175, 153,
141290 /* 1370 */ 131, 153, 194, 203, 153, 194, 174, 175, 174, 175,
141291 /* 1380 */ 174, 175, 174, 175, 153, 160, 153, 18, 153, 194,
141292 /* 1390 */ 174, 175, 174, 175, 153, 174, 175, 153, 225, 153,
141293 /* 1400 */ 203, 153, 159, 153, 194, 174, 175, 174, 175, 174,
141294 /* 1410 */ 175, 153, 203, 153, 224, 174, 175, 191, 174, 175,
141295 /* 1420 */ 174, 175, 174, 175, 174, 175, 203, 160, 153, 191,
141296 /* 1430 */ 153, 159, 174, 175, 174, 175, 153, 139, 62, 153,
141297 /* 1440 */ 241, 153, 160, 153, 159, 153, 22, 240, 179, 174,
141298 /* 1450 */ 175, 174, 175, 160, 159, 97, 160, 174, 175, 159,
141299 /* 1460 */ 174, 175, 174, 175, 174, 175, 174, 175, 179, 64,
141300 /* 1470 */ 176, 184, 108, 176, 95, 176, 234, 126, 176, 234,
141301 /* 1480 */ 179, 178, 176, 176, 176, 97, 218, 217, 184, 179,
141302 /* 1490 */ 179, 218, 218, 160, 22, 217, 217, 160, 218, 139,
141303 /* 1500 */ 229, 217, 130, 129, 127, 25, 128, 163, 26, 162,
141304 /* 1510 */ 13, 206, 231, 154, 6, 154, 207, 205, 204, 203,
141305 /* 1520 */ 152, 166, 152, 152, 172, 172, 172, 4, 172, 166,
141306 /* 1530 */ 180, 166, 3, 22, 172, 144, 15, 180, 172, 172,
141307 /* 1540 */ 82, 16, 23, 23, 121, 254, 132, 172, 112, 124,
141308 /* 1550 */ 24, 20, 126, 16, 1, 124, 112, 61, 53, 37,
141309 /* 1560 */ 133, 132, 53, 53, 112, 53, 98, 254, 251, 34,
141310 /* 1570 */ 123, 1, 5, 22, 97, 142, 26, 75, 123, 41,
141311 /* 1580 */ 97, 68, 68, 24, 20, 19, 113, 22, 107, 28,
141312 /* 1590 */ 22, 67, 23, 22, 22, 67, 22, 67, 23, 37,
141313 /* 1600 */ 23, 23, 26, 23, 22, 24, 23, 22, 24, 123,
141314 /* 1610 */ 23, 23, 22, 98, 125, 26, 11, 23, 26, 23,
141315 /* 1620 */ 34, 23, 23, 23, 23, 34, 22, 34, 26, 22,
141316 /* 1630 */ 22, 15, 23, 23, 22, 117, 23, 22, 1, 123,
141317 /* 1640 */ 26, 23, 255, 255, 255, 255, 255, 255, 255, 255,
141318 /* 1650 */ 123, 255, 255, 255, 255, 123, 123, 255, 255, 255,
141319 /* 1660 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141320 /* 1670 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141321 /* 1680 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141322 /* 1690 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141323 /* 1700 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141324 /* 1710 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141325 /* 1720 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141326 /* 1730 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141327 /* 1740 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141328 /* 1750 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141329 /* 1760 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141330 /* 1770 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141331 /* 1780 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141332 /* 1790 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
141333 /* 1800 */ 255, 255,
141334 };
141335 #define YY_SHIFT_COUNT (489)
141336 #define YY_SHIFT_MIN (0)
141337 #define YY_SHIFT_MAX (1637)
141338 static const unsigned short int yy_shift_ofst[] = {
141339 /* 0 */ 990, 976, 1211, 837, 837, 316, 1054, 1054, 1054, 1054,
141340 /* 10 */ 214, 0, 0, 106, 642, 1054, 1054, 1054, 1054, 1054,
141341 /* 20 */ 1054, 1054, 1054, 952, 952, 226, 1155, 316, 316, 316,
141342 /* 30 */ 316, 316, 316, 53, 159, 212, 265, 318, 371, 424,
141343 /* 40 */ 477, 533, 589, 642, 642, 642, 642, 642, 642, 642,
141344 /* 50 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
141345 /* 60 */ 695, 642, 747, 798, 798, 1004, 1054, 1054, 1054, 1054,
141346 /* 70 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141347 /* 80 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141348 /* 90 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1112, 1054, 1054,
141349 /* 100 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
141350 /* 110 */ 1054, 856, 874, 874, 874, 874, 874, 134, 147, 93,
141351 /* 120 */ 342, 959, 1161, 253, 253, 342, 367, 367, 367, 367,
141352 /* 130 */ 179, 36, 79, 1657, 1657, 1657, 1061, 1061, 1061, 516,
141353 /* 140 */ 799, 516, 516, 531, 531, 802, 249, 369, 342, 342,
141354 /* 150 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
141355 /* 160 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 272,
141356 /* 170 */ 442, 442, 536, 1657, 1657, 1657, 1025, 245, 245, 570,
141357 /* 180 */ 172, 286, 805, 1047, 1140, 1220, 342, 342, 342, 342,
141358 /* 190 */ 342, 342, 342, 342, 170, 342, 342, 342, 342, 342,
141359 /* 200 */ 342, 342, 342, 342, 342, 342, 342, 841, 841, 841,
141360 /* 210 */ 342, 342, 342, 342, 530, 342, 342, 342, 1059, 342,
141361 /* 220 */ 342, 1167, 342, 342, 342, 342, 342, 342, 342, 342,
141362 /* 230 */ 123, 688, 177, 1212, 1212, 1212, 1212, 1144, 177, 177,
141363 /* 240 */ 1064, 409, 33, 628, 707, 707, 900, 628, 628, 900,
141364 /* 250 */ 897, 323, 398, 677, 677, 677, 707, 572, 684, 590,
141365 /* 260 */ 739, 1236, 1182, 1182, 1276, 1276, 1182, 1253, 1325, 1315,
141366 /* 270 */ 1239, 1346, 1346, 1346, 1346, 1182, 1369, 1239, 1239, 1253,
141367 /* 280 */ 1325, 1315, 1315, 1239, 1182, 1369, 1298, 1376, 1182, 1369,
141368 /* 290 */ 1424, 1182, 1369, 1182, 1369, 1424, 1358, 1358, 1358, 1405,
141369 /* 300 */ 1424, 1358, 1364, 1358, 1405, 1358, 1358, 1424, 1379, 1379,
141370 /* 310 */ 1424, 1351, 1388, 1351, 1388, 1351, 1388, 1351, 1388, 1182,
141371 /* 320 */ 1472, 1182, 1360, 1372, 1377, 1374, 1378, 1239, 1480, 1482,
141372 /* 330 */ 1497, 1497, 1508, 1508, 1508, 1657, 1657, 1657, 1657, 1657,
141373 /* 340 */ 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657,
141374 /* 350 */ 1657, 20, 413, 98, 423, 519, 383, 962, 742, 61,
141375 /* 360 */ 696, 749, 750, 753, 789, 790, 795, 797, 840, 842,
141376 /* 370 */ 810, 668, 817, 659, 819, 849, 854, 899, 643, 745,
141377 /* 380 */ 956, 926, 916, 1523, 1529, 1511, 1391, 1521, 1458, 1525,
141378 /* 390 */ 1519, 1520, 1423, 1414, 1436, 1526, 1425, 1531, 1426, 1537,
141379 /* 400 */ 1553, 1431, 1427, 1444, 1496, 1522, 1429, 1505, 1509, 1510,
141380 /* 410 */ 1512, 1452, 1468, 1535, 1447, 1570, 1567, 1551, 1477, 1433,
141381 /* 420 */ 1513, 1550, 1514, 1502, 1538, 1455, 1483, 1559, 1564, 1566,
141382 /* 430 */ 1473, 1481, 1565, 1524, 1568, 1571, 1569, 1572, 1528, 1561,
141383 /* 440 */ 1574, 1530, 1562, 1575, 1577, 1578, 1576, 1580, 1582, 1581,
141384 /* 450 */ 1583, 1585, 1584, 1486, 1587, 1588, 1515, 1586, 1590, 1489,
141385 /* 460 */ 1589, 1591, 1592, 1593, 1594, 1596, 1598, 1589, 1599, 1600,
141386 /* 470 */ 1602, 1601, 1604, 1605, 1607, 1608, 1609, 1610, 1612, 1613,
141387 /* 480 */ 1615, 1614, 1518, 1516, 1527, 1532, 1533, 1618, 1616, 1637,
141388 };
141389 #define YY_REDUCE_COUNT (350)
141390 #define YY_REDUCE_MIN (-225)
141391 #define YY_REDUCE_MAX (1375)
141392 static const short yy_reduce_ofst[] = {
141393 /* 0 */ -137, -31, 1104, 1023, 1081, -132, -40, -38, 223, 225,
141394 /* 10 */ 698, -153, -99, -225, -165, 386, 478, 843, 859, -139,
141395 /* 20 */ 884, 117, 277, 844, 857, 964, 559, 561, 614, 918,
141396 /* 30 */ 1009, 1089, 1098, -222, -222, -222, -222, -222, -222, -222,
141397 /* 40 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141398 /* 50 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141399 /* 60 */ -222, -222, -222, -222, -222, 329, 331, 497, 654, 656,
141400 /* 70 */ 781, 891, 946, 1029, 1129, 1134, 1149, 1154, 1160, 1162,
141401 /* 80 */ 1164, 1168, 1174, 1177, 1188, 1191, 1193, 1202, 1204, 1206,
141402 /* 90 */ 1208, 1216, 1218, 1221, 1231, 1233, 1235, 1241, 1244, 1246,
141403 /* 100 */ 1248, 1250, 1258, 1260, 1275, 1277, 1283, 1286, 1288, 1290,
141404 /* 110 */ 1292, -222, -222, -222, -222, -222, -222, -222, -222, -222,
141405 /* 120 */ -115, 796, -156, -154, -141, 14, 242, 349, 242, 349,
141406 /* 130 */ -61, -222, -222, -222, -222, -222, 101, 101, 101, 332,
141407 /* 140 */ 302, 384, 387, -170, 146, 344, 196, 196, 15, 11,
141408 /* 150 */ 183, 235, 395, 355, 396, 406, 452, 457, 391, 459,
141409 /* 160 */ 443, 447, 511, 495, 454, 512, 505, 571, 498, 532,
141410 /* 170 */ 431, 435, 339, 455, 446, 508, -174, -116, -97, -120,
141411 /* 180 */ -150, 64, 176, 330, 337, 509, 569, 611, 653, 673,
141412 /* 190 */ 714, 717, 763, 771, -34, 779, 786, 830, 846, 860,
141413 /* 200 */ 866, 882, 883, 890, 892, 895, 902, 319, 368, 769,
141414 /* 210 */ 915, 924, 925, 932, 755, 936, 945, 963, 782, 969,
141415 /* 220 */ 974, 816, 977, 64, 982, 983, 1016, 1022, 1024, 1031,
141416 /* 230 */ 870, 831, 913, 966, 973, 981, 984, 755, 913, 913,
141417 /* 240 */ 1000, 1041, 1063, 1015, 1010, 1011, 985, 1034, 1057, 1019,
141418 /* 250 */ 1086, 1080, 1085, 1093, 1095, 1096, 1067, 1048, 1082, 1099,
141419 /* 260 */ 1137, 1050, 1150, 1156, 1077, 1088, 1180, 1120, 1132, 1169,
141420 /* 270 */ 1170, 1178, 1181, 1195, 1210, 1225, 1243, 1197, 1209, 1173,
141421 /* 280 */ 1190, 1226, 1238, 1223, 1267, 1272, 1199, 1207, 1282, 1285,
141422 /* 290 */ 1269, 1293, 1295, 1296, 1300, 1289, 1294, 1297, 1299, 1287,
141423 /* 300 */ 1301, 1302, 1303, 1306, 1304, 1307, 1308, 1310, 1242, 1245,
141424 /* 310 */ 1311, 1268, 1270, 1273, 1278, 1274, 1279, 1280, 1284, 1333,
141425 /* 320 */ 1271, 1337, 1281, 1309, 1305, 1312, 1314, 1316, 1344, 1347,
141426 /* 330 */ 1359, 1361, 1368, 1370, 1371, 1291, 1313, 1317, 1355, 1352,
141427 /* 340 */ 1353, 1354, 1356, 1363, 1350, 1357, 1362, 1366, 1367, 1375,
141428 /* 350 */ 1365,
141429 };
141430 static const YYACTIONTYPE yy_default[] = {
141431 /* 0 */ 1389, 1389, 1389, 1261, 1046, 1151, 1261, 1261, 1261, 1261,
141432 /* 10 */ 1046, 1181, 1181, 1312, 1077, 1046, 1046, 1046, 1046, 1046,
141433 /* 20 */ 1046, 1260, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141434 /* 30 */ 1046, 1046, 1046, 1187, 1046, 1046, 1046, 1046, 1262, 1263,
141435 /* 40 */ 1046, 1046, 1046, 1311, 1313, 1197, 1196, 1195, 1194, 1294,
141436 /* 50 */ 1168, 1192, 1185, 1189, 1256, 1257, 1255, 1259, 1262, 1263,
141437 /* 60 */ 1046, 1188, 1226, 1240, 1225, 1046, 1046, 1046, 1046, 1046,
141438 /* 70 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141439 /* 80 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141440 /* 90 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141441 /* 100 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141442 /* 110 */ 1046, 1234, 1239, 1246, 1238, 1235, 1228, 1227, 1229, 1230,
141443 /* 120 */ 1046, 1067, 1116, 1046, 1046, 1046, 1329, 1328, 1046, 1046,
141444 /* 130 */ 1077, 1231, 1232, 1243, 1242, 1241, 1319, 1345, 1344, 1046,
141445 /* 140 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141446 /* 150 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141447 /* 160 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1077,
141448 /* 170 */ 1073, 1073, 1046, 1324, 1151, 1142, 1046, 1046, 1046, 1046,
141449 /* 180 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1316, 1314, 1046,
141450 /* 190 */ 1276, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141451 /* 200 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141452 /* 210 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1147, 1046,
141453 /* 220 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1339,
141454 /* 230 */ 1046, 1289, 1130, 1147, 1147, 1147, 1147, 1149, 1131, 1129,
141455 /* 240 */ 1141, 1077, 1053, 1191, 1170, 1170, 1378, 1191, 1191, 1378,
141456 /* 250 */ 1091, 1359, 1088, 1181, 1181, 1181, 1170, 1258, 1148, 1141,
141457 /* 260 */ 1046, 1381, 1156, 1156, 1380, 1380, 1156, 1200, 1206, 1119,
141458 /* 270 */ 1191, 1125, 1125, 1125, 1125, 1156, 1064, 1191, 1191, 1200,
141459 /* 280 */ 1206, 1119, 1119, 1191, 1156, 1064, 1293, 1375, 1156, 1064,
141460 /* 290 */ 1269, 1156, 1064, 1156, 1064, 1269, 1117, 1117, 1117, 1106,
141461 /* 300 */ 1269, 1117, 1091, 1117, 1106, 1117, 1117, 1269, 1273, 1273,
141462 /* 310 */ 1269, 1174, 1169, 1174, 1169, 1174, 1169, 1174, 1169, 1156,
141463 /* 320 */ 1264, 1156, 1046, 1186, 1175, 1184, 1182, 1191, 1070, 1109,
141464 /* 330 */ 1342, 1342, 1338, 1338, 1338, 1386, 1386, 1324, 1354, 1077,
141465 /* 340 */ 1077, 1077, 1077, 1354, 1093, 1093, 1077, 1077, 1077, 1077,
141466 /* 350 */ 1354, 1046, 1046, 1046, 1046, 1046, 1046, 1349, 1046, 1278,
141467 /* 360 */ 1160, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141468 /* 370 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141469 /* 380 */ 1046, 1046, 1211, 1046, 1049, 1321, 1046, 1046, 1320, 1046,
141470 /* 390 */ 1046, 1046, 1046, 1046, 1046, 1161, 1046, 1046, 1046, 1046,
141471 /* 400 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141472 /* 410 */ 1046, 1046, 1046, 1046, 1377, 1046, 1046, 1046, 1046, 1046,
141473 /* 420 */ 1046, 1292, 1291, 1046, 1046, 1158, 1046, 1046, 1046, 1046,
141474 /* 430 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141475 /* 440 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141476 /* 450 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141477 /* 460 */ 1183, 1046, 1176, 1046, 1046, 1046, 1046, 1368, 1046, 1046,
141478 /* 470 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046,
141479 /* 480 */ 1046, 1363, 1133, 1213, 1046, 1212, 1216, 1046, 1058, 1046,
141480 };
141481 /********** End of lemon-generated parsing tables *****************************/
141482
141483 /* The next table maps tokens (terminal symbols) into fallback tokens.
141484 ** If a construct like the following:
@@ -140662,10 +141555,11 @@
141555 0, /* LT => nothing */
141556 0, /* GE => nothing */
141557 0, /* ESCAPE => nothing */
141558 0, /* ID => nothing */
141559 59, /* COLUMNKW => ID */
141560 59, /* DO => ID */
141561 59, /* FOR => ID */
141562 59, /* IGNORE => ID */
141563 59, /* INITIALLY => ID */
141564 59, /* INSTEAD => ID */
141565 59, /* NO => ID */
@@ -140723,10 +141617,11 @@
141617 #endif
141618 #ifndef YYNOERRORRECOVERY
141619 int yyerrcnt; /* Shifts left before out of the error */
141620 #endif
141621 sqlite3ParserARG_SDECL /* A place to hold %extra_argument */
141622 sqlite3ParserCTX_SDECL /* A place to hold %extra_context */
141623 #if YYSTACKDEPTH<=0
141624 int yystksz; /* Current side of the stack */
141625 yyStackEntry *yystack; /* The parser's stack */
141626 yyStackEntry yystk0; /* First stack entry */
141627 #else
@@ -140831,201 +141726,204 @@
141726 /* 56 */ "LT",
141727 /* 57 */ "GE",
141728 /* 58 */ "ESCAPE",
141729 /* 59 */ "ID",
141730 /* 60 */ "COLUMNKW",
141731 /* 61 */ "DO",
141732 /* 62 */ "FOR",
141733 /* 63 */ "IGNORE",
141734 /* 64 */ "INITIALLY",
141735 /* 65 */ "INSTEAD",
141736 /* 66 */ "NO",
141737 /* 67 */ "KEY",
141738 /* 68 */ "OF",
141739 /* 69 */ "OFFSET",
141740 /* 70 */ "PRAGMA",
141741 /* 71 */ "RAISE",
141742 /* 72 */ "RECURSIVE",
141743 /* 73 */ "REPLACE",
141744 /* 74 */ "RESTRICT",
141745 /* 75 */ "ROW",
141746 /* 76 */ "TRIGGER",
141747 /* 77 */ "VACUUM",
141748 /* 78 */ "VIEW",
141749 /* 79 */ "VIRTUAL",
141750 /* 80 */ "WITH",
141751 /* 81 */ "REINDEX",
141752 /* 82 */ "RENAME",
141753 /* 83 */ "CTIME_KW",
141754 /* 84 */ "ANY",
141755 /* 85 */ "BITAND",
141756 /* 86 */ "BITOR",
141757 /* 87 */ "LSHIFT",
141758 /* 88 */ "RSHIFT",
141759 /* 89 */ "PLUS",
141760 /* 90 */ "MINUS",
141761 /* 91 */ "STAR",
141762 /* 92 */ "SLASH",
141763 /* 93 */ "REM",
141764 /* 94 */ "CONCAT",
141765 /* 95 */ "COLLATE",
141766 /* 96 */ "BITNOT",
141767 /* 97 */ "ON",
141768 /* 98 */ "INDEXED",
141769 /* 99 */ "STRING",
141770 /* 100 */ "JOIN_KW",
141771 /* 101 */ "CONSTRAINT",
141772 /* 102 */ "DEFAULT",
141773 /* 103 */ "NULL",
141774 /* 104 */ "PRIMARY",
141775 /* 105 */ "UNIQUE",
141776 /* 106 */ "CHECK",
141777 /* 107 */ "REFERENCES",
141778 /* 108 */ "AUTOINCR",
141779 /* 109 */ "INSERT",
141780 /* 110 */ "DELETE",
141781 /* 111 */ "UPDATE",
141782 /* 112 */ "SET",
141783 /* 113 */ "DEFERRABLE",
141784 /* 114 */ "FOREIGN",
141785 /* 115 */ "DROP",
141786 /* 116 */ "UNION",
141787 /* 117 */ "ALL",
141788 /* 118 */ "EXCEPT",
141789 /* 119 */ "INTERSECT",
141790 /* 120 */ "SELECT",
141791 /* 121 */ "VALUES",
141792 /* 122 */ "DISTINCT",
141793 /* 123 */ "DOT",
141794 /* 124 */ "FROM",
141795 /* 125 */ "JOIN",
141796 /* 126 */ "USING",
141797 /* 127 */ "ORDER",
141798 /* 128 */ "GROUP",
141799 /* 129 */ "HAVING",
141800 /* 130 */ "LIMIT",
141801 /* 131 */ "WHERE",
141802 /* 132 */ "INTO",
141803 /* 133 */ "NOTHING",
141804 /* 134 */ "FLOAT",
141805 /* 135 */ "BLOB",
141806 /* 136 */ "INTEGER",
141807 /* 137 */ "VARIABLE",
141808 /* 138 */ "CASE",
141809 /* 139 */ "WHEN",
141810 /* 140 */ "THEN",
141811 /* 141 */ "ELSE",
141812 /* 142 */ "INDEX",
141813 /* 143 */ "ALTER",
141814 /* 144 */ "ADD",
141815 /* 145 */ "input",
141816 /* 146 */ "cmdlist",
141817 /* 147 */ "ecmd",
141818 /* 148 */ "cmdx",
141819 /* 149 */ "explain",
141820 /* 150 */ "cmd",
141821 /* 151 */ "transtype",
141822 /* 152 */ "trans_opt",
141823 /* 153 */ "nm",
141824 /* 154 */ "savepoint_opt",
141825 /* 155 */ "create_table",
141826 /* 156 */ "create_table_args",
141827 /* 157 */ "createkw",
141828 /* 158 */ "temp",
141829 /* 159 */ "ifnotexists",
141830 /* 160 */ "dbnm",
141831 /* 161 */ "columnlist",
141832 /* 162 */ "conslist_opt",
141833 /* 163 */ "table_options",
141834 /* 164 */ "select",
141835 /* 165 */ "columnname",
141836 /* 166 */ "carglist",
141837 /* 167 */ "typetoken",
141838 /* 168 */ "typename",
141839 /* 169 */ "signed",
141840 /* 170 */ "plus_num",
141841 /* 171 */ "minus_num",
141842 /* 172 */ "scanpt",
141843 /* 173 */ "ccons",
141844 /* 174 */ "term",
141845 /* 175 */ "expr",
141846 /* 176 */ "onconf",
141847 /* 177 */ "sortorder",
141848 /* 178 */ "autoinc",
141849 /* 179 */ "eidlist_opt",
141850 /* 180 */ "refargs",
141851 /* 181 */ "defer_subclause",
141852 /* 182 */ "refarg",
141853 /* 183 */ "refact",
141854 /* 184 */ "init_deferred_pred_opt",
141855 /* 185 */ "conslist",
141856 /* 186 */ "tconscomma",
141857 /* 187 */ "tcons",
141858 /* 188 */ "sortlist",
141859 /* 189 */ "eidlist",
141860 /* 190 */ "defer_subclause_opt",
141861 /* 191 */ "orconf",
141862 /* 192 */ "resolvetype",
141863 /* 193 */ "raisetype",
141864 /* 194 */ "ifexists",
141865 /* 195 */ "fullname",
141866 /* 196 */ "selectnowith",
141867 /* 197 */ "oneselect",
141868 /* 198 */ "wqlist",
141869 /* 199 */ "multiselect_op",
141870 /* 200 */ "distinct",
141871 /* 201 */ "selcollist",
141872 /* 202 */ "from",
141873 /* 203 */ "where_opt",
141874 /* 204 */ "groupby_opt",
141875 /* 205 */ "having_opt",
141876 /* 206 */ "orderby_opt",
141877 /* 207 */ "limit_opt",
141878 /* 208 */ "values",
141879 /* 209 */ "nexprlist",
141880 /* 210 */ "exprlist",
141881 /* 211 */ "sclp",
141882 /* 212 */ "as",
141883 /* 213 */ "seltablist",
141884 /* 214 */ "stl_prefix",
141885 /* 215 */ "joinop",
141886 /* 216 */ "indexed_opt",
141887 /* 217 */ "on_opt",
141888 /* 218 */ "using_opt",
141889 /* 219 */ "xfullname",
141890 /* 220 */ "idlist",
141891 /* 221 */ "with",
141892 /* 222 */ "setlist",
141893 /* 223 */ "insert_cmd",
141894 /* 224 */ "idlist_opt",
141895 /* 225 */ "upsert",
141896 /* 226 */ "likeop",
141897 /* 227 */ "between_op",
141898 /* 228 */ "in_op",
141899 /* 229 */ "paren_exprlist",
141900 /* 230 */ "case_operand",
141901 /* 231 */ "case_exprlist",
141902 /* 232 */ "case_else",
141903 /* 233 */ "uniqueflag",
141904 /* 234 */ "collate",
141905 /* 235 */ "nmnum",
141906 /* 236 */ "trigger_decl",
141907 /* 237 */ "trigger_cmd_list",
141908 /* 238 */ "trigger_time",
141909 /* 239 */ "trigger_event",
141910 /* 240 */ "foreach_clause",
141911 /* 241 */ "when_clause",
141912 /* 242 */ "trigger_cmd",
141913 /* 243 */ "trnm",
141914 /* 244 */ "tridxby",
141915 /* 245 */ "database_kw_opt",
141916 /* 246 */ "key_opt",
141917 /* 247 */ "add_column_fullname",
141918 /* 248 */ "kwcolumn_opt",
141919 /* 249 */ "create_vtab",
141920 /* 250 */ "vtabarglist",
141921 /* 251 */ "vtabarg",
141922 /* 252 */ "vtabargtoken",
141923 /* 253 */ "lp",
141924 /* 254 */ "anylist",
141925 };
141926 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
141927
141928 #ifndef NDEBUG
141929 /* For tracing reduce actions, the names of all rules are required.
@@ -141140,232 +142038,240 @@
142038 /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
142039 /* 107 */ "dbnm ::=",
142040 /* 108 */ "dbnm ::= DOT nm",
142041 /* 109 */ "fullname ::= nm",
142042 /* 110 */ "fullname ::= nm DOT nm",
142043 /* 111 */ "xfullname ::= nm",
142044 /* 112 */ "xfullname ::= nm DOT nm",
142045 /* 113 */ "xfullname ::= nm DOT nm AS nm",
142046 /* 114 */ "xfullname ::= nm AS nm",
142047 /* 115 */ "joinop ::= COMMA|JOIN",
142048 /* 116 */ "joinop ::= JOIN_KW JOIN",
142049 /* 117 */ "joinop ::= JOIN_KW nm JOIN",
142050 /* 118 */ "joinop ::= JOIN_KW nm nm JOIN",
142051 /* 119 */ "on_opt ::= ON expr",
142052 /* 120 */ "on_opt ::=",
142053 /* 121 */ "indexed_opt ::=",
142054 /* 122 */ "indexed_opt ::= INDEXED BY nm",
142055 /* 123 */ "indexed_opt ::= NOT INDEXED",
142056 /* 124 */ "using_opt ::= USING LP idlist RP",
142057 /* 125 */ "using_opt ::=",
142058 /* 126 */ "orderby_opt ::=",
142059 /* 127 */ "orderby_opt ::= ORDER BY sortlist",
142060 /* 128 */ "sortlist ::= sortlist COMMA expr sortorder",
142061 /* 129 */ "sortlist ::= expr sortorder",
142062 /* 130 */ "sortorder ::= ASC",
142063 /* 131 */ "sortorder ::= DESC",
142064 /* 132 */ "sortorder ::=",
142065 /* 133 */ "groupby_opt ::=",
142066 /* 134 */ "groupby_opt ::= GROUP BY nexprlist",
142067 /* 135 */ "having_opt ::=",
142068 /* 136 */ "having_opt ::= HAVING expr",
142069 /* 137 */ "limit_opt ::=",
142070 /* 138 */ "limit_opt ::= LIMIT expr",
142071 /* 139 */ "limit_opt ::= LIMIT expr OFFSET expr",
142072 /* 140 */ "limit_opt ::= LIMIT expr COMMA expr",
142073 /* 141 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
142074 /* 142 */ "where_opt ::=",
142075 /* 143 */ "where_opt ::= WHERE expr",
142076 /* 144 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
142077 /* 145 */ "setlist ::= setlist COMMA nm EQ expr",
142078 /* 146 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
142079 /* 147 */ "setlist ::= nm EQ expr",
142080 /* 148 */ "setlist ::= LP idlist RP EQ expr",
142081 /* 149 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
142082 /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
142083 /* 151 */ "upsert ::=",
142084 /* 152 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
142085 /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
142086 /* 154 */ "upsert ::= ON CONFLICT DO NOTHING",
142087 /* 155 */ "insert_cmd ::= INSERT orconf",
142088 /* 156 */ "insert_cmd ::= REPLACE",
142089 /* 157 */ "idlist_opt ::=",
142090 /* 158 */ "idlist_opt ::= LP idlist RP",
142091 /* 159 */ "idlist ::= idlist COMMA nm",
142092 /* 160 */ "idlist ::= nm",
142093 /* 161 */ "expr ::= LP expr RP",
142094 /* 162 */ "expr ::= ID|INDEXED",
142095 /* 163 */ "expr ::= JOIN_KW",
142096 /* 164 */ "expr ::= nm DOT nm",
142097 /* 165 */ "expr ::= nm DOT nm DOT nm",
142098 /* 166 */ "term ::= NULL|FLOAT|BLOB",
142099 /* 167 */ "term ::= STRING",
142100 /* 168 */ "term ::= INTEGER",
142101 /* 169 */ "expr ::= VARIABLE",
142102 /* 170 */ "expr ::= expr COLLATE ID|STRING",
142103 /* 171 */ "expr ::= CAST LP expr AS typetoken RP",
142104 /* 172 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
142105 /* 173 */ "expr ::= ID|INDEXED LP STAR RP",
142106 /* 174 */ "term ::= CTIME_KW",
142107 /* 175 */ "expr ::= LP nexprlist COMMA expr RP",
142108 /* 176 */ "expr ::= expr AND expr",
142109 /* 177 */ "expr ::= expr OR expr",
142110 /* 178 */ "expr ::= expr LT|GT|GE|LE expr",
142111 /* 179 */ "expr ::= expr EQ|NE expr",
142112 /* 180 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
142113 /* 181 */ "expr ::= expr PLUS|MINUS expr",
142114 /* 182 */ "expr ::= expr STAR|SLASH|REM expr",
142115 /* 183 */ "expr ::= expr CONCAT expr",
142116 /* 184 */ "likeop ::= NOT LIKE_KW|MATCH",
142117 /* 185 */ "expr ::= expr likeop expr",
142118 /* 186 */ "expr ::= expr likeop expr ESCAPE expr",
142119 /* 187 */ "expr ::= expr ISNULL|NOTNULL",
142120 /* 188 */ "expr ::= expr NOT NULL",
142121 /* 189 */ "expr ::= expr IS expr",
142122 /* 190 */ "expr ::= expr IS NOT expr",
142123 /* 191 */ "expr ::= NOT expr",
142124 /* 192 */ "expr ::= BITNOT expr",
142125 /* 193 */ "expr ::= MINUS expr",
142126 /* 194 */ "expr ::= PLUS expr",
142127 /* 195 */ "between_op ::= BETWEEN",
142128 /* 196 */ "between_op ::= NOT BETWEEN",
142129 /* 197 */ "expr ::= expr between_op expr AND expr",
142130 /* 198 */ "in_op ::= IN",
142131 /* 199 */ "in_op ::= NOT IN",
142132 /* 200 */ "expr ::= expr in_op LP exprlist RP",
142133 /* 201 */ "expr ::= LP select RP",
142134 /* 202 */ "expr ::= expr in_op LP select RP",
142135 /* 203 */ "expr ::= expr in_op nm dbnm paren_exprlist",
142136 /* 204 */ "expr ::= EXISTS LP select RP",
142137 /* 205 */ "expr ::= CASE case_operand case_exprlist case_else END",
142138 /* 206 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
142139 /* 207 */ "case_exprlist ::= WHEN expr THEN expr",
142140 /* 208 */ "case_else ::= ELSE expr",
142141 /* 209 */ "case_else ::=",
142142 /* 210 */ "case_operand ::= expr",
142143 /* 211 */ "case_operand ::=",
142144 /* 212 */ "exprlist ::=",
142145 /* 213 */ "nexprlist ::= nexprlist COMMA expr",
142146 /* 214 */ "nexprlist ::= expr",
142147 /* 215 */ "paren_exprlist ::=",
142148 /* 216 */ "paren_exprlist ::= LP exprlist RP",
142149 /* 217 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
142150 /* 218 */ "uniqueflag ::= UNIQUE",
142151 /* 219 */ "uniqueflag ::=",
142152 /* 220 */ "eidlist_opt ::=",
142153 /* 221 */ "eidlist_opt ::= LP eidlist RP",
142154 /* 222 */ "eidlist ::= eidlist COMMA nm collate sortorder",
142155 /* 223 */ "eidlist ::= nm collate sortorder",
142156 /* 224 */ "collate ::=",
142157 /* 225 */ "collate ::= COLLATE ID|STRING",
142158 /* 226 */ "cmd ::= DROP INDEX ifexists fullname",
142159 /* 227 */ "cmd ::= VACUUM",
142160 /* 228 */ "cmd ::= VACUUM nm",
142161 /* 229 */ "cmd ::= PRAGMA nm dbnm",
142162 /* 230 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
142163 /* 231 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
142164 /* 232 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
142165 /* 233 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
142166 /* 234 */ "plus_num ::= PLUS INTEGER|FLOAT",
142167 /* 235 */ "minus_num ::= MINUS INTEGER|FLOAT",
142168 /* 236 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
142169 /* 237 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
142170 /* 238 */ "trigger_time ::= BEFORE|AFTER",
142171 /* 239 */ "trigger_time ::= INSTEAD OF",
142172 /* 240 */ "trigger_time ::=",
142173 /* 241 */ "trigger_event ::= DELETE|INSERT",
142174 /* 242 */ "trigger_event ::= UPDATE",
142175 /* 243 */ "trigger_event ::= UPDATE OF idlist",
142176 /* 244 */ "when_clause ::=",
142177 /* 245 */ "when_clause ::= WHEN expr",
142178 /* 246 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
142179 /* 247 */ "trigger_cmd_list ::= trigger_cmd SEMI",
142180 /* 248 */ "trnm ::= nm DOT nm",
142181 /* 249 */ "tridxby ::= INDEXED BY nm",
142182 /* 250 */ "tridxby ::= NOT INDEXED",
142183 /* 251 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
142184 /* 252 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
142185 /* 253 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
142186 /* 254 */ "trigger_cmd ::= scanpt select scanpt",
142187 /* 255 */ "expr ::= RAISE LP IGNORE RP",
142188 /* 256 */ "expr ::= RAISE LP raisetype COMMA nm RP",
142189 /* 257 */ "raisetype ::= ROLLBACK",
142190 /* 258 */ "raisetype ::= ABORT",
142191 /* 259 */ "raisetype ::= FAIL",
142192 /* 260 */ "cmd ::= DROP TRIGGER ifexists fullname",
142193 /* 261 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
142194 /* 262 */ "cmd ::= DETACH database_kw_opt expr",
142195 /* 263 */ "key_opt ::=",
142196 /* 264 */ "key_opt ::= KEY expr",
142197 /* 265 */ "cmd ::= REINDEX",
142198 /* 266 */ "cmd ::= REINDEX nm dbnm",
142199 /* 267 */ "cmd ::= ANALYZE",
142200 /* 268 */ "cmd ::= ANALYZE nm dbnm",
142201 /* 269 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
142202 /* 270 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
142203 /* 271 */ "add_column_fullname ::= fullname",
142204 /* 272 */ "cmd ::= create_vtab",
142205 /* 273 */ "cmd ::= create_vtab LP vtabarglist RP",
142206 /* 274 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
142207 /* 275 */ "vtabarg ::=",
142208 /* 276 */ "vtabargtoken ::= ANY",
142209 /* 277 */ "vtabargtoken ::= lp anylist RP",
142210 /* 278 */ "lp ::= LP",
142211 /* 279 */ "with ::= WITH wqlist",
142212 /* 280 */ "with ::= WITH RECURSIVE wqlist",
142213 /* 281 */ "wqlist ::= nm eidlist_opt AS LP select RP",
142214 /* 282 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
142215 /* 283 */ "input ::= cmdlist",
142216 /* 284 */ "cmdlist ::= cmdlist ecmd",
142217 /* 285 */ "cmdlist ::= ecmd",
142218 /* 286 */ "ecmd ::= SEMI",
142219 /* 287 */ "ecmd ::= cmdx SEMI",
142220 /* 288 */ "ecmd ::= explain cmdx",
142221 /* 289 */ "trans_opt ::=",
142222 /* 290 */ "trans_opt ::= TRANSACTION",
142223 /* 291 */ "trans_opt ::= TRANSACTION nm",
142224 /* 292 */ "savepoint_opt ::= SAVEPOINT",
142225 /* 293 */ "savepoint_opt ::=",
142226 /* 294 */ "cmd ::= create_table create_table_args",
142227 /* 295 */ "columnlist ::= columnlist COMMA columnname carglist",
142228 /* 296 */ "columnlist ::= columnname carglist",
142229 /* 297 */ "nm ::= ID|INDEXED",
142230 /* 298 */ "nm ::= STRING",
142231 /* 299 */ "nm ::= JOIN_KW",
142232 /* 300 */ "typetoken ::= typename",
142233 /* 301 */ "typename ::= ID|STRING",
142234 /* 302 */ "signed ::= plus_num",
142235 /* 303 */ "signed ::= minus_num",
142236 /* 304 */ "carglist ::= carglist ccons",
142237 /* 305 */ "carglist ::=",
142238 /* 306 */ "ccons ::= NULL onconf",
142239 /* 307 */ "conslist_opt ::= COMMA conslist",
142240 /* 308 */ "conslist ::= conslist tconscomma tcons",
142241 /* 309 */ "conslist ::= tcons",
142242 /* 310 */ "tconscomma ::=",
142243 /* 311 */ "defer_subclause_opt ::= defer_subclause",
142244 /* 312 */ "resolvetype ::= raisetype",
142245 /* 313 */ "selectnowith ::= oneselect",
142246 /* 314 */ "oneselect ::= values",
142247 /* 315 */ "sclp ::= selcollist COMMA",
142248 /* 316 */ "as ::= ID|STRING",
142249 /* 317 */ "expr ::= term",
142250 /* 318 */ "likeop ::= LIKE_KW|MATCH",
142251 /* 319 */ "exprlist ::= nexprlist",
142252 /* 320 */ "nmnum ::= plus_num",
142253 /* 321 */ "nmnum ::= nm",
142254 /* 322 */ "nmnum ::= ON",
142255 /* 323 */ "nmnum ::= DELETE",
142256 /* 324 */ "nmnum ::= DEFAULT",
142257 /* 325 */ "plus_num ::= INTEGER|FLOAT",
142258 /* 326 */ "foreach_clause ::=",
142259 /* 327 */ "foreach_clause ::= FOR EACH ROW",
142260 /* 328 */ "trnm ::= nm",
142261 /* 329 */ "tridxby ::=",
142262 /* 330 */ "database_kw_opt ::= DATABASE",
142263 /* 331 */ "database_kw_opt ::=",
142264 /* 332 */ "kwcolumn_opt ::=",
142265 /* 333 */ "kwcolumn_opt ::= COLUMNKW",
142266 /* 334 */ "vtabarglist ::= vtabarg",
142267 /* 335 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
142268 /* 336 */ "vtabarg ::= vtabarg vtabargtoken",
142269 /* 337 */ "anylist ::=",
142270 /* 338 */ "anylist ::= anylist LP anylist RP",
142271 /* 339 */ "anylist ::= anylist ANY",
142272 /* 340 */ "with ::=",
142273 };
142274 #endif /* NDEBUG */
142275
142276
142277 #if YYSTACKDEPTH<=0
@@ -141410,32 +142316,33 @@
142316 # define YYMALLOCARGTYPE size_t
142317 #endif
142318
142319 /* Initialize a new parser that has already been allocated.
142320 */
142321 SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL){
142322 yyParser *yypParser = (yyParser*)yypRawParser;
142323 sqlite3ParserCTX_STORE
142324 #ifdef YYTRACKMAXSTACKDEPTH
142325 yypParser->yyhwm = 0;
142326 #endif
142327 #if YYSTACKDEPTH<=0
142328 yypParser->yytos = NULL;
142329 yypParser->yystack = NULL;
142330 yypParser->yystksz = 0;
142331 if( yyGrowStack(yypParser) ){
142332 yypParser->yystack = &yypParser->yystk0;
142333 yypParser->yystksz = 1;
142334 }
142335 #endif
142336 #ifndef YYNOERRORRECOVERY
142337 yypParser->yyerrcnt = -1;
142338 #endif
142339 yypParser->yytos = yypParser->yystack;
142340 yypParser->yystack[0].stateno = 0;
142341 yypParser->yystack[0].major = 0;
142342 #if YYSTACKDEPTH>0
142343 yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
142344 #endif
142345 }
142346
142347 #ifndef sqlite3Parser_ENGINEALWAYSONSTACK
142348 /*
@@ -141448,15 +142355,18 @@
142355 **
142356 ** Outputs:
142357 ** A pointer to a parser. This pointer is used in subsequent calls
142358 ** to sqlite3Parser and sqlite3ParserFree.
142359 */
142360 SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) sqlite3ParserCTX_PDECL){
142361 yyParser *yypParser;
142362 yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
142363 if( yypParser ){
142364 sqlite3ParserCTX_STORE
142365 sqlite3ParserInit(yypParser sqlite3ParserCTX_PARAM);
142366 }
142367 return (void*)yypParser;
142368 }
142369 #endif /* sqlite3Parser_ENGINEALWAYSONSTACK */
142370
142371
142372 /* The following function deletes the "minor type" or semantic value
@@ -141469,11 +142379,12 @@
142379 static void yy_destructor(
142380 yyParser *yypParser, /* The parser */
142381 YYCODETYPE yymajor, /* Type code for object to destroy */
142382 YYMINORTYPE *yypminor /* The object to be destroyed */
142383 ){
142384 sqlite3ParserARG_FETCH
142385 sqlite3ParserCTX_FETCH
142386 switch( yymajor ){
142387 /* Here is inserted the actions which take place when a
142388 ** terminal or non-terminal is destroyed. This can happen
142389 ** when the symbol is popped from the stack during a
142390 ** reduce or during error processing or when a parser is
@@ -141482,76 +142393,77 @@
142393 ** Note: during a reduce, the only symbols destroyed are those
142394 ** which appear on the RHS of the rule, but which are *not* used
142395 ** inside the C code.
142396 */
142397 /********* Begin destructor definitions ***************************************/
142398 case 164: /* select */
142399 case 196: /* selectnowith */
142400 case 197: /* oneselect */
142401 case 208: /* values */
142402 {
142403 sqlite3SelectDelete(pParse->db, (yypminor->yy399));
142404 }
142405 break;
142406 case 174: /* term */
142407 case 175: /* expr */
142408 case 203: /* where_opt */
142409 case 205: /* having_opt */
142410 case 217: /* on_opt */
142411 case 230: /* case_operand */
142412 case 232: /* case_else */
142413 case 241: /* when_clause */
142414 case 246: /* key_opt */
142415 {
142416 sqlite3ExprDelete(pParse->db, (yypminor->yy182));
142417 }
142418 break;
142419 case 179: /* eidlist_opt */
142420 case 188: /* sortlist */
142421 case 189: /* eidlist */
142422 case 201: /* selcollist */
142423 case 204: /* groupby_opt */
142424 case 206: /* orderby_opt */
142425 case 209: /* nexprlist */
142426 case 210: /* exprlist */
142427 case 211: /* sclp */
142428 case 222: /* setlist */
142429 case 229: /* paren_exprlist */
142430 case 231: /* case_exprlist */
142431 {
142432 sqlite3ExprListDelete(pParse->db, (yypminor->yy232));
142433 }
142434 break;
142435 case 195: /* fullname */
142436 case 202: /* from */
142437 case 213: /* seltablist */
142438 case 214: /* stl_prefix */
142439 case 219: /* xfullname */
142440 {
142441 sqlite3SrcListDelete(pParse->db, (yypminor->yy427));
142442 }
142443 break;
142444 case 198: /* wqlist */
142445 {
142446 sqlite3WithDelete(pParse->db, (yypminor->yy91));
142447 }
142448 break;
142449 case 218: /* using_opt */
142450 case 220: /* idlist */
142451 case 224: /* idlist_opt */
142452 {
142453 sqlite3IdListDelete(pParse->db, (yypminor->yy510));
142454 }
142455 break;
142456 case 237: /* trigger_cmd_list */
142457 case 242: /* trigger_cmd */
142458 {
142459 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy47));
142460 }
142461 break;
142462 case 239: /* trigger_event */
142463 {
142464 sqlite3IdListDelete(pParse->db, (yypminor->yy300).b);
142465 }
142466 break;
142467 /********* End destructor definitions *****************************************/
142468 default: break; /* If no destructor action specified: do nothing */
142469 }
@@ -141659,17 +142571,16 @@
142571
142572 /*
142573 ** Find the appropriate action for a parser given the terminal
142574 ** look-ahead token iLookAhead.
142575 */
142576 static YYACTIONTYPE yy_find_shift_action(
142577 YYCODETYPE iLookAhead, /* The look-ahead token */
142578 YYACTIONTYPE stateno /* Current state number */
142579 ){
142580 int i;
142581
 
142582 if( stateno>YY_MAX_SHIFT ) return stateno;
142583 assert( stateno <= YY_SHIFT_COUNT );
142584 #if defined(YYCOVERAGE)
142585 yycoverage[stateno][iLookAhead] = 1;
142586 #endif
@@ -141729,11 +142640,11 @@
142640 /*
142641 ** Find the appropriate action for a parser given the non-terminal
142642 ** look-ahead token iLookAhead.
142643 */
142644 static int yy_find_reduce_action(
142645 YYACTIONTYPE stateno, /* Current state number */
142646 YYCODETYPE iLookAhead /* The look-ahead token */
142647 ){
142648 int i;
142649 #ifdef YYERRORSYMBOL
142650 if( stateno>YY_REDUCE_COUNT ){
@@ -141758,11 +142669,12 @@
142669
142670 /*
142671 ** The following routine is called if the stack overflows.
142672 */
142673 static void yyStackOverflow(yyParser *yypParser){
142674 sqlite3ParserARG_FETCH
142675 sqlite3ParserCTX_FETCH
142676 #ifndef NDEBUG
142677 if( yyTraceFILE ){
142678 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
142679 }
142680 #endif
@@ -141771,11 +142683,12 @@
142683 ** stack every overflows */
142684 /******** Begin %stack_overflow code ******************************************/
142685
142686 sqlite3ErrorMsg(pParse, "parser stack overflow");
142687 /******** End %stack_overflow code ********************************************/
142688 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */
142689 sqlite3ParserCTX_STORE
142690 }
142691
142692 /*
142693 ** Print tracing information for a SHIFT action
142694 */
@@ -141800,12 +142713,12 @@
142713 /*
142714 ** Perform a shift action.
142715 */
142716 static void yy_shift(
142717 yyParser *yypParser, /* The parser to be shifted */
142718 YYACTIONTYPE yyNewState, /* The new state to shift in */
142719 YYCODETYPE yyMajor, /* The major token to shift in */
142720 sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */
142721 ){
142722 yyStackEntry *yytos;
142723 yypParser->yytos++;
142724 #ifdef YYTRACKMAXSTACKDEPTH
@@ -141831,12 +142744,12 @@
142744 #endif
142745 if( yyNewState > YY_MAX_SHIFT ){
142746 yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
142747 }
142748 yytos = yypParser->yytos;
142749 yytos->stateno = yyNewState;
142750 yytos->major = yyMajor;
142751 yytos->minor.yy0 = yyMinor;
142752 yyTraceShift(yypParser, yyNewState, "Shift");
142753 }
142754
142755 /* The following table contains information about every rule that
@@ -141844,343 +142757,351 @@
142757 */
142758 static const struct {
142759 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
142760 signed char nrhs; /* Negative of the number of RHS symbols in the rule */
142761 } yyRuleInfo[] = {
142762 { 149, -1 }, /* (0) explain ::= EXPLAIN */
142763 { 149, -3 }, /* (1) explain ::= EXPLAIN QUERY PLAN */
142764 { 148, -1 }, /* (2) cmdx ::= cmd */
142765 { 150, -3 }, /* (3) cmd ::= BEGIN transtype trans_opt */
142766 { 151, 0 }, /* (4) transtype ::= */
142767 { 151, -1 }, /* (5) transtype ::= DEFERRED */
142768 { 151, -1 }, /* (6) transtype ::= IMMEDIATE */
142769 { 151, -1 }, /* (7) transtype ::= EXCLUSIVE */
142770 { 150, -2 }, /* (8) cmd ::= COMMIT|END trans_opt */
142771 { 150, -2 }, /* (9) cmd ::= ROLLBACK trans_opt */
142772 { 150, -2 }, /* (10) cmd ::= SAVEPOINT nm */
142773 { 150, -3 }, /* (11) cmd ::= RELEASE savepoint_opt nm */
142774 { 150, -5 }, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
142775 { 155, -6 }, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
142776 { 157, -1 }, /* (14) createkw ::= CREATE */
142777 { 159, 0 }, /* (15) ifnotexists ::= */
142778 { 159, -3 }, /* (16) ifnotexists ::= IF NOT EXISTS */
142779 { 158, -1 }, /* (17) temp ::= TEMP */
142780 { 158, 0 }, /* (18) temp ::= */
142781 { 156, -5 }, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
142782 { 156, -2 }, /* (20) create_table_args ::= AS select */
142783 { 163, 0 }, /* (21) table_options ::= */
142784 { 163, -2 }, /* (22) table_options ::= WITHOUT nm */
142785 { 165, -2 }, /* (23) columnname ::= nm typetoken */
142786 { 167, 0 }, /* (24) typetoken ::= */
142787 { 167, -4 }, /* (25) typetoken ::= typename LP signed RP */
142788 { 167, -6 }, /* (26) typetoken ::= typename LP signed COMMA signed RP */
142789 { 168, -2 }, /* (27) typename ::= typename ID|STRING */
142790 { 172, 0 }, /* (28) scanpt ::= */
142791 { 173, -2 }, /* (29) ccons ::= CONSTRAINT nm */
142792 { 173, -4 }, /* (30) ccons ::= DEFAULT scanpt term scanpt */
142793 { 173, -4 }, /* (31) ccons ::= DEFAULT LP expr RP */
142794 { 173, -4 }, /* (32) ccons ::= DEFAULT PLUS term scanpt */
142795 { 173, -4 }, /* (33) ccons ::= DEFAULT MINUS term scanpt */
142796 { 173, -3 }, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
142797 { 173, -3 }, /* (35) ccons ::= NOT NULL onconf */
142798 { 173, -5 }, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
142799 { 173, -2 }, /* (37) ccons ::= UNIQUE onconf */
142800 { 173, -4 }, /* (38) ccons ::= CHECK LP expr RP */
142801 { 173, -4 }, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
142802 { 173, -1 }, /* (40) ccons ::= defer_subclause */
142803 { 173, -2 }, /* (41) ccons ::= COLLATE ID|STRING */
142804 { 178, 0 }, /* (42) autoinc ::= */
142805 { 178, -1 }, /* (43) autoinc ::= AUTOINCR */
142806 { 180, 0 }, /* (44) refargs ::= */
142807 { 180, -2 }, /* (45) refargs ::= refargs refarg */
142808 { 182, -2 }, /* (46) refarg ::= MATCH nm */
142809 { 182, -3 }, /* (47) refarg ::= ON INSERT refact */
142810 { 182, -3 }, /* (48) refarg ::= ON DELETE refact */
142811 { 182, -3 }, /* (49) refarg ::= ON UPDATE refact */
142812 { 183, -2 }, /* (50) refact ::= SET NULL */
142813 { 183, -2 }, /* (51) refact ::= SET DEFAULT */
142814 { 183, -1 }, /* (52) refact ::= CASCADE */
142815 { 183, -1 }, /* (53) refact ::= RESTRICT */
142816 { 183, -2 }, /* (54) refact ::= NO ACTION */
142817 { 181, -3 }, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
142818 { 181, -2 }, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
142819 { 184, 0 }, /* (57) init_deferred_pred_opt ::= */
142820 { 184, -2 }, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
142821 { 184, -2 }, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
142822 { 162, 0 }, /* (60) conslist_opt ::= */
142823 { 186, -1 }, /* (61) tconscomma ::= COMMA */
142824 { 187, -2 }, /* (62) tcons ::= CONSTRAINT nm */
142825 { 187, -7 }, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
142826 { 187, -5 }, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
142827 { 187, -5 }, /* (65) tcons ::= CHECK LP expr RP onconf */
142828 { 187, -10 }, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
142829 { 190, 0 }, /* (67) defer_subclause_opt ::= */
142830 { 176, 0 }, /* (68) onconf ::= */
142831 { 176, -3 }, /* (69) onconf ::= ON CONFLICT resolvetype */
142832 { 191, 0 }, /* (70) orconf ::= */
142833 { 191, -2 }, /* (71) orconf ::= OR resolvetype */
142834 { 192, -1 }, /* (72) resolvetype ::= IGNORE */
142835 { 192, -1 }, /* (73) resolvetype ::= REPLACE */
142836 { 150, -4 }, /* (74) cmd ::= DROP TABLE ifexists fullname */
142837 { 194, -2 }, /* (75) ifexists ::= IF EXISTS */
142838 { 194, 0 }, /* (76) ifexists ::= */
142839 { 150, -9 }, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
142840 { 150, -4 }, /* (78) cmd ::= DROP VIEW ifexists fullname */
142841 { 150, -1 }, /* (79) cmd ::= select */
142842 { 164, -3 }, /* (80) select ::= WITH wqlist selectnowith */
142843 { 164, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
142844 { 164, -1 }, /* (82) select ::= selectnowith */
142845 { 196, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
142846 { 199, -1 }, /* (84) multiselect_op ::= UNION */
142847 { 199, -2 }, /* (85) multiselect_op ::= UNION ALL */
142848 { 199, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
142849 { 197, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
142850 { 208, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
142851 { 208, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
142852 { 200, -1 }, /* (90) distinct ::= DISTINCT */
142853 { 200, -1 }, /* (91) distinct ::= ALL */
142854 { 200, 0 }, /* (92) distinct ::= */
142855 { 211, 0 }, /* (93) sclp ::= */
142856 { 201, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
142857 { 201, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
142858 { 201, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
142859 { 212, -2 }, /* (97) as ::= AS nm */
142860 { 212, 0 }, /* (98) as ::= */
142861 { 202, 0 }, /* (99) from ::= */
142862 { 202, -2 }, /* (100) from ::= FROM seltablist */
142863 { 214, -2 }, /* (101) stl_prefix ::= seltablist joinop */
142864 { 214, 0 }, /* (102) stl_prefix ::= */
142865 { 213, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
142866 { 213, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
142867 { 213, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
142868 { 213, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
142869 { 160, 0 }, /* (107) dbnm ::= */
142870 { 160, -2 }, /* (108) dbnm ::= DOT nm */
142871 { 195, -1 }, /* (109) fullname ::= nm */
142872 { 195, -3 }, /* (110) fullname ::= nm DOT nm */
142873 { 219, -1 }, /* (111) xfullname ::= nm */
142874 { 219, -3 }, /* (112) xfullname ::= nm DOT nm */
142875 { 219, -5 }, /* (113) xfullname ::= nm DOT nm AS nm */
142876 { 219, -3 }, /* (114) xfullname ::= nm AS nm */
142877 { 215, -1 }, /* (115) joinop ::= COMMA|JOIN */
142878 { 215, -2 }, /* (116) joinop ::= JOIN_KW JOIN */
142879 { 215, -3 }, /* (117) joinop ::= JOIN_KW nm JOIN */
142880 { 215, -4 }, /* (118) joinop ::= JOIN_KW nm nm JOIN */
142881 { 217, -2 }, /* (119) on_opt ::= ON expr */
142882 { 217, 0 }, /* (120) on_opt ::= */
142883 { 216, 0 }, /* (121) indexed_opt ::= */
142884 { 216, -3 }, /* (122) indexed_opt ::= INDEXED BY nm */
142885 { 216, -2 }, /* (123) indexed_opt ::= NOT INDEXED */
142886 { 218, -4 }, /* (124) using_opt ::= USING LP idlist RP */
142887 { 218, 0 }, /* (125) using_opt ::= */
142888 { 206, 0 }, /* (126) orderby_opt ::= */
142889 { 206, -3 }, /* (127) orderby_opt ::= ORDER BY sortlist */
142890 { 188, -4 }, /* (128) sortlist ::= sortlist COMMA expr sortorder */
142891 { 188, -2 }, /* (129) sortlist ::= expr sortorder */
142892 { 177, -1 }, /* (130) sortorder ::= ASC */
142893 { 177, -1 }, /* (131) sortorder ::= DESC */
142894 { 177, 0 }, /* (132) sortorder ::= */
142895 { 204, 0 }, /* (133) groupby_opt ::= */
142896 { 204, -3 }, /* (134) groupby_opt ::= GROUP BY nexprlist */
142897 { 205, 0 }, /* (135) having_opt ::= */
142898 { 205, -2 }, /* (136) having_opt ::= HAVING expr */
142899 { 207, 0 }, /* (137) limit_opt ::= */
142900 { 207, -2 }, /* (138) limit_opt ::= LIMIT expr */
142901 { 207, -4 }, /* (139) limit_opt ::= LIMIT expr OFFSET expr */
142902 { 207, -4 }, /* (140) limit_opt ::= LIMIT expr COMMA expr */
142903 { 150, -6 }, /* (141) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
142904 { 203, 0 }, /* (142) where_opt ::= */
142905 { 203, -2 }, /* (143) where_opt ::= WHERE expr */
142906 { 150, -8 }, /* (144) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
142907 { 222, -5 }, /* (145) setlist ::= setlist COMMA nm EQ expr */
142908 { 222, -7 }, /* (146) setlist ::= setlist COMMA LP idlist RP EQ expr */
142909 { 222, -3 }, /* (147) setlist ::= nm EQ expr */
142910 { 222, -5 }, /* (148) setlist ::= LP idlist RP EQ expr */
142911 { 150, -7 }, /* (149) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
142912 { 150, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
142913 { 225, 0 }, /* (151) upsert ::= */
142914 { 225, -11 }, /* (152) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
142915 { 225, -8 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
142916 { 225, -4 }, /* (154) upsert ::= ON CONFLICT DO NOTHING */
142917 { 223, -2 }, /* (155) insert_cmd ::= INSERT orconf */
142918 { 223, -1 }, /* (156) insert_cmd ::= REPLACE */
142919 { 224, 0 }, /* (157) idlist_opt ::= */
142920 { 224, -3 }, /* (158) idlist_opt ::= LP idlist RP */
142921 { 220, -3 }, /* (159) idlist ::= idlist COMMA nm */
142922 { 220, -1 }, /* (160) idlist ::= nm */
142923 { 175, -3 }, /* (161) expr ::= LP expr RP */
142924 { 175, -1 }, /* (162) expr ::= ID|INDEXED */
142925 { 175, -1 }, /* (163) expr ::= JOIN_KW */
142926 { 175, -3 }, /* (164) expr ::= nm DOT nm */
142927 { 175, -5 }, /* (165) expr ::= nm DOT nm DOT nm */
142928 { 174, -1 }, /* (166) term ::= NULL|FLOAT|BLOB */
142929 { 174, -1 }, /* (167) term ::= STRING */
142930 { 174, -1 }, /* (168) term ::= INTEGER */
142931 { 175, -1 }, /* (169) expr ::= VARIABLE */
142932 { 175, -3 }, /* (170) expr ::= expr COLLATE ID|STRING */
142933 { 175, -6 }, /* (171) expr ::= CAST LP expr AS typetoken RP */
142934 { 175, -5 }, /* (172) expr ::= ID|INDEXED LP distinct exprlist RP */
142935 { 175, -4 }, /* (173) expr ::= ID|INDEXED LP STAR RP */
142936 { 174, -1 }, /* (174) term ::= CTIME_KW */
142937 { 175, -5 }, /* (175) expr ::= LP nexprlist COMMA expr RP */
142938 { 175, -3 }, /* (176) expr ::= expr AND expr */
142939 { 175, -3 }, /* (177) expr ::= expr OR expr */
142940 { 175, -3 }, /* (178) expr ::= expr LT|GT|GE|LE expr */
142941 { 175, -3 }, /* (179) expr ::= expr EQ|NE expr */
142942 { 175, -3 }, /* (180) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
142943 { 175, -3 }, /* (181) expr ::= expr PLUS|MINUS expr */
142944 { 175, -3 }, /* (182) expr ::= expr STAR|SLASH|REM expr */
142945 { 175, -3 }, /* (183) expr ::= expr CONCAT expr */
142946 { 226, -2 }, /* (184) likeop ::= NOT LIKE_KW|MATCH */
142947 { 175, -3 }, /* (185) expr ::= expr likeop expr */
142948 { 175, -5 }, /* (186) expr ::= expr likeop expr ESCAPE expr */
142949 { 175, -2 }, /* (187) expr ::= expr ISNULL|NOTNULL */
142950 { 175, -3 }, /* (188) expr ::= expr NOT NULL */
142951 { 175, -3 }, /* (189) expr ::= expr IS expr */
142952 { 175, -4 }, /* (190) expr ::= expr IS NOT expr */
142953 { 175, -2 }, /* (191) expr ::= NOT expr */
142954 { 175, -2 }, /* (192) expr ::= BITNOT expr */
142955 { 175, -2 }, /* (193) expr ::= MINUS expr */
142956 { 175, -2 }, /* (194) expr ::= PLUS expr */
142957 { 227, -1 }, /* (195) between_op ::= BETWEEN */
142958 { 227, -2 }, /* (196) between_op ::= NOT BETWEEN */
142959 { 175, -5 }, /* (197) expr ::= expr between_op expr AND expr */
142960 { 228, -1 }, /* (198) in_op ::= IN */
142961 { 228, -2 }, /* (199) in_op ::= NOT IN */
142962 { 175, -5 }, /* (200) expr ::= expr in_op LP exprlist RP */
142963 { 175, -3 }, /* (201) expr ::= LP select RP */
142964 { 175, -5 }, /* (202) expr ::= expr in_op LP select RP */
142965 { 175, -5 }, /* (203) expr ::= expr in_op nm dbnm paren_exprlist */
142966 { 175, -4 }, /* (204) expr ::= EXISTS LP select RP */
142967 { 175, -5 }, /* (205) expr ::= CASE case_operand case_exprlist case_else END */
142968 { 231, -5 }, /* (206) case_exprlist ::= case_exprlist WHEN expr THEN expr */
142969 { 231, -4 }, /* (207) case_exprlist ::= WHEN expr THEN expr */
142970 { 232, -2 }, /* (208) case_else ::= ELSE expr */
142971 { 232, 0 }, /* (209) case_else ::= */
142972 { 230, -1 }, /* (210) case_operand ::= expr */
142973 { 230, 0 }, /* (211) case_operand ::= */
142974 { 210, 0 }, /* (212) exprlist ::= */
142975 { 209, -3 }, /* (213) nexprlist ::= nexprlist COMMA expr */
142976 { 209, -1 }, /* (214) nexprlist ::= expr */
142977 { 229, 0 }, /* (215) paren_exprlist ::= */
142978 { 229, -3 }, /* (216) paren_exprlist ::= LP exprlist RP */
142979 { 150, -12 }, /* (217) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
142980 { 233, -1 }, /* (218) uniqueflag ::= UNIQUE */
142981 { 233, 0 }, /* (219) uniqueflag ::= */
142982 { 179, 0 }, /* (220) eidlist_opt ::= */
142983 { 179, -3 }, /* (221) eidlist_opt ::= LP eidlist RP */
142984 { 189, -5 }, /* (222) eidlist ::= eidlist COMMA nm collate sortorder */
142985 { 189, -3 }, /* (223) eidlist ::= nm collate sortorder */
142986 { 234, 0 }, /* (224) collate ::= */
142987 { 234, -2 }, /* (225) collate ::= COLLATE ID|STRING */
142988 { 150, -4 }, /* (226) cmd ::= DROP INDEX ifexists fullname */
142989 { 150, -1 }, /* (227) cmd ::= VACUUM */
142990 { 150, -2 }, /* (228) cmd ::= VACUUM nm */
142991 { 150, -3 }, /* (229) cmd ::= PRAGMA nm dbnm */
142992 { 150, -5 }, /* (230) cmd ::= PRAGMA nm dbnm EQ nmnum */
142993 { 150, -6 }, /* (231) cmd ::= PRAGMA nm dbnm LP nmnum RP */
142994 { 150, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ minus_num */
142995 { 150, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP minus_num RP */
142996 { 170, -2 }, /* (234) plus_num ::= PLUS INTEGER|FLOAT */
142997 { 171, -2 }, /* (235) minus_num ::= MINUS INTEGER|FLOAT */
142998 { 150, -5 }, /* (236) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
142999 { 236, -11 }, /* (237) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
143000 { 238, -1 }, /* (238) trigger_time ::= BEFORE|AFTER */
143001 { 238, -2 }, /* (239) trigger_time ::= INSTEAD OF */
143002 { 238, 0 }, /* (240) trigger_time ::= */
143003 { 239, -1 }, /* (241) trigger_event ::= DELETE|INSERT */
143004 { 239, -1 }, /* (242) trigger_event ::= UPDATE */
143005 { 239, -3 }, /* (243) trigger_event ::= UPDATE OF idlist */
143006 { 241, 0 }, /* (244) when_clause ::= */
143007 { 241, -2 }, /* (245) when_clause ::= WHEN expr */
143008 { 237, -3 }, /* (246) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
143009 { 237, -2 }, /* (247) trigger_cmd_list ::= trigger_cmd SEMI */
143010 { 243, -3 }, /* (248) trnm ::= nm DOT nm */
143011 { 244, -3 }, /* (249) tridxby ::= INDEXED BY nm */
143012 { 244, -2 }, /* (250) tridxby ::= NOT INDEXED */
143013 { 242, -8 }, /* (251) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
143014 { 242, -8 }, /* (252) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
143015 { 242, -6 }, /* (253) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
143016 { 242, -3 }, /* (254) trigger_cmd ::= scanpt select scanpt */
143017 { 175, -4 }, /* (255) expr ::= RAISE LP IGNORE RP */
143018 { 175, -6 }, /* (256) expr ::= RAISE LP raisetype COMMA nm RP */
143019 { 193, -1 }, /* (257) raisetype ::= ROLLBACK */
143020 { 193, -1 }, /* (258) raisetype ::= ABORT */
143021 { 193, -1 }, /* (259) raisetype ::= FAIL */
143022 { 150, -4 }, /* (260) cmd ::= DROP TRIGGER ifexists fullname */
143023 { 150, -6 }, /* (261) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
143024 { 150, -3 }, /* (262) cmd ::= DETACH database_kw_opt expr */
143025 { 246, 0 }, /* (263) key_opt ::= */
143026 { 246, -2 }, /* (264) key_opt ::= KEY expr */
143027 { 150, -1 }, /* (265) cmd ::= REINDEX */
143028 { 150, -3 }, /* (266) cmd ::= REINDEX nm dbnm */
143029 { 150, -1 }, /* (267) cmd ::= ANALYZE */
143030 { 150, -3 }, /* (268) cmd ::= ANALYZE nm dbnm */
143031 { 150, -6 }, /* (269) cmd ::= ALTER TABLE fullname RENAME TO nm */
143032 { 150, -7 }, /* (270) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
143033 { 247, -1 }, /* (271) add_column_fullname ::= fullname */
143034 { 150, -1 }, /* (272) cmd ::= create_vtab */
143035 { 150, -4 }, /* (273) cmd ::= create_vtab LP vtabarglist RP */
143036 { 249, -8 }, /* (274) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
143037 { 251, 0 }, /* (275) vtabarg ::= */
143038 { 252, -1 }, /* (276) vtabargtoken ::= ANY */
143039 { 252, -3 }, /* (277) vtabargtoken ::= lp anylist RP */
143040 { 253, -1 }, /* (278) lp ::= LP */
143041 { 221, -2 }, /* (279) with ::= WITH wqlist */
143042 { 221, -3 }, /* (280) with ::= WITH RECURSIVE wqlist */
143043 { 198, -6 }, /* (281) wqlist ::= nm eidlist_opt AS LP select RP */
143044 { 198, -8 }, /* (282) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
143045 { 145, -1 }, /* (283) input ::= cmdlist */
143046 { 146, -2 }, /* (284) cmdlist ::= cmdlist ecmd */
143047 { 146, -1 }, /* (285) cmdlist ::= ecmd */
143048 { 147, -1 }, /* (286) ecmd ::= SEMI */
143049 { 147, -2 }, /* (287) ecmd ::= cmdx SEMI */
143050 { 147, -2 }, /* (288) ecmd ::= explain cmdx */
143051 { 152, 0 }, /* (289) trans_opt ::= */
143052 { 152, -1 }, /* (290) trans_opt ::= TRANSACTION */
143053 { 152, -2 }, /* (291) trans_opt ::= TRANSACTION nm */
143054 { 154, -1 }, /* (292) savepoint_opt ::= SAVEPOINT */
143055 { 154, 0 }, /* (293) savepoint_opt ::= */
143056 { 150, -2 }, /* (294) cmd ::= create_table create_table_args */
143057 { 161, -4 }, /* (295) columnlist ::= columnlist COMMA columnname carglist */
143058 { 161, -2 }, /* (296) columnlist ::= columnname carglist */
143059 { 153, -1 }, /* (297) nm ::= ID|INDEXED */
143060 { 153, -1 }, /* (298) nm ::= STRING */
143061 { 153, -1 }, /* (299) nm ::= JOIN_KW */
143062 { 167, -1 }, /* (300) typetoken ::= typename */
143063 { 168, -1 }, /* (301) typename ::= ID|STRING */
143064 { 169, -1 }, /* (302) signed ::= plus_num */
143065 { 169, -1 }, /* (303) signed ::= minus_num */
143066 { 166, -2 }, /* (304) carglist ::= carglist ccons */
143067 { 166, 0 }, /* (305) carglist ::= */
143068 { 173, -2 }, /* (306) ccons ::= NULL onconf */
143069 { 162, -2 }, /* (307) conslist_opt ::= COMMA conslist */
143070 { 185, -3 }, /* (308) conslist ::= conslist tconscomma tcons */
143071 { 185, -1 }, /* (309) conslist ::= tcons */
143072 { 186, 0 }, /* (310) tconscomma ::= */
143073 { 190, -1 }, /* (311) defer_subclause_opt ::= defer_subclause */
143074 { 192, -1 }, /* (312) resolvetype ::= raisetype */
143075 { 196, -1 }, /* (313) selectnowith ::= oneselect */
143076 { 197, -1 }, /* (314) oneselect ::= values */
143077 { 211, -2 }, /* (315) sclp ::= selcollist COMMA */
143078 { 212, -1 }, /* (316) as ::= ID|STRING */
143079 { 175, -1 }, /* (317) expr ::= term */
143080 { 226, -1 }, /* (318) likeop ::= LIKE_KW|MATCH */
143081 { 210, -1 }, /* (319) exprlist ::= nexprlist */
143082 { 235, -1 }, /* (320) nmnum ::= plus_num */
143083 { 235, -1 }, /* (321) nmnum ::= nm */
143084 { 235, -1 }, /* (322) nmnum ::= ON */
143085 { 235, -1 }, /* (323) nmnum ::= DELETE */
143086 { 235, -1 }, /* (324) nmnum ::= DEFAULT */
143087 { 170, -1 }, /* (325) plus_num ::= INTEGER|FLOAT */
143088 { 240, 0 }, /* (326) foreach_clause ::= */
143089 { 240, -3 }, /* (327) foreach_clause ::= FOR EACH ROW */
143090 { 243, -1 }, /* (328) trnm ::= nm */
143091 { 244, 0 }, /* (329) tridxby ::= */
143092 { 245, -1 }, /* (330) database_kw_opt ::= DATABASE */
143093 { 245, 0 }, /* (331) database_kw_opt ::= */
143094 { 248, 0 }, /* (332) kwcolumn_opt ::= */
143095 { 248, -1 }, /* (333) kwcolumn_opt ::= COLUMNKW */
143096 { 250, -1 }, /* (334) vtabarglist ::= vtabarg */
143097 { 250, -3 }, /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */
143098 { 251, -2 }, /* (336) vtabarg ::= vtabarg vtabargtoken */
143099 { 254, 0 }, /* (337) anylist ::= */
143100 { 254, -4 }, /* (338) anylist ::= anylist LP anylist RP */
143101 { 254, -2 }, /* (339) anylist ::= anylist ANY */
143102 { 221, 0 }, /* (340) with ::= */
143103 };
143104
143105 static void yy_accept(yyParser*); /* Forward Declaration */
143106
143107 /*
@@ -142191,21 +143112,22 @@
143112 ** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
143113 ** if the lookahead token has already been consumed. As this procedure is
143114 ** only called from one place, optimizing compilers will in-line it, which
143115 ** means that the extra parameters have no performance impact.
143116 */
143117 static YYACTIONTYPE yy_reduce(
143118 yyParser *yypParser, /* The parser */
143119 unsigned int yyruleno, /* Number of the rule by which to reduce */
143120 int yyLookahead, /* Lookahead token, or YYNOCODE if none */
143121 sqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
143122 sqlite3ParserCTX_PDECL /* %extra_context */
143123 ){
143124 int yygoto; /* The next state */
143125 int yyact; /* The next action */
143126 yyStackEntry *yymsp; /* The top of the parser's stack */
143127 int yysize; /* Amount to pop the stack */
143128 sqlite3ParserARG_FETCH
143129 (void)yyLookahead;
143130 (void)yyLookaheadToken;
143131 yymsp = yypParser->yytos;
143132 #ifndef NDEBUG
143133 if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
@@ -142232,17 +143154,23 @@
143154 }
143155 #endif
143156 #if YYSTACKDEPTH>0
143157 if( yypParser->yytos>=yypParser->yystackEnd ){
143158 yyStackOverflow(yypParser);
143159 /* The call to yyStackOverflow() above pops the stack until it is
143160 ** empty, causing the main parser loop to exit. So the return value
143161 ** is never used and does not matter. */
143162 return 0;
143163 }
143164 #else
143165 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
143166 if( yyGrowStack(yypParser) ){
143167 yyStackOverflow(yypParser);
143168 /* The call to yyStackOverflow() above pops the stack until it is
143169 ** empty, causing the main parser loop to exit. So the return value
143170 ** is never used and does not matter. */
143171 return 0;
143172 }
143173 yymsp = yypParser->yytos;
143174 }
143175 #endif
143176 }
@@ -142266,19 +143194,19 @@
143194 break;
143195 case 2: /* cmdx ::= cmd */
143196 { sqlite3FinishCoding(pParse); }
143197 break;
143198 case 3: /* cmd ::= BEGIN transtype trans_opt */
143199 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);}
143200 break;
143201 case 4: /* transtype ::= */
143202 {yymsp[1].minor.yy502 = TK_DEFERRED;}
143203 break;
143204 case 5: /* transtype ::= DEFERRED */
143205 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
143206 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
143207 {yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/}
143208 break;
143209 case 8: /* cmd ::= COMMIT|END trans_opt */
143210 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
143211 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
143212 break;
@@ -142297,11 +143225,11 @@
143225 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
143226 }
143227 break;
143228 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
143229 {
143230 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502);
143231 }
143232 break;
143233 case 14: /* createkw ::= CREATE */
143234 {disableLookaside(pParse);}
143235 break;
@@ -142311,37 +143239,37 @@
143239 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
143240 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
143241 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
143242 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
143243 case 92: /* distinct ::= */ yytestcase(yyruleno==92);
143244 case 224: /* collate ::= */ yytestcase(yyruleno==224);
143245 {yymsp[1].minor.yy502 = 0;}
143246 break;
143247 case 16: /* ifnotexists ::= IF NOT EXISTS */
143248 {yymsp[-2].minor.yy502 = 1;}
143249 break;
143250 case 17: /* temp ::= TEMP */
143251 case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
143252 {yymsp[0].minor.yy502 = 1;}
143253 break;
143254 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
143255 {
143256 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy502,0);
143257 }
143258 break;
143259 case 20: /* create_table_args ::= AS select */
143260 {
143261 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy399);
143262 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399);
143263 }
143264 break;
143265 case 22: /* table_options ::= WITHOUT nm */
143266 {
143267 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
143268 yymsp[-1].minor.yy502 = TF_WithoutRowid | TF_NoVisibleRowid;
143269 }else{
143270 yymsp[-1].minor.yy502 = 0;
143271 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
143272 }
143273 }
143274 break;
143275 case 23: /* columnname ::= nm typetoken */
@@ -142366,30 +143294,30 @@
143294 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
143295 break;
143296 case 28: /* scanpt ::= */
143297 {
143298 assert( yyLookahead!=YYNOCODE );
143299 yymsp[1].minor.yy36 = yyLookaheadToken.z;
143300 }
143301 break;
143302 case 29: /* ccons ::= CONSTRAINT nm */
143303 case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
143304 {pParse->constraintName = yymsp[0].minor.yy0;}
143305 break;
143306 case 30: /* ccons ::= DEFAULT scanpt term scanpt */
143307 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy36,yymsp[0].minor.yy36);}
143308 break;
143309 case 31: /* ccons ::= DEFAULT LP expr RP */
143310 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
143311 break;
143312 case 32: /* ccons ::= DEFAULT PLUS term scanpt */
143313 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36);}
143314 break;
143315 case 33: /* ccons ::= DEFAULT MINUS term scanpt */
143316 {
143317 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy182, 0);
143318 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36);
143319 }
143320 break;
143321 case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
143322 {
143323 Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
@@ -142399,207 +143327,207 @@
143327 }
143328 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
143329 }
143330 break;
143331 case 35: /* ccons ::= NOT NULL onconf */
143332 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);}
143333 break;
143334 case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
143335 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);}
143336 break;
143337 case 37: /* ccons ::= UNIQUE onconf */
143338 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0,
143339 SQLITE_IDXTYPE_UNIQUE);}
143340 break;
143341 case 38: /* ccons ::= CHECK LP expr RP */
143342 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy182);}
143343 break;
143344 case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
143345 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy232,yymsp[0].minor.yy502);}
143346 break;
143347 case 40: /* ccons ::= defer_subclause */
143348 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);}
143349 break;
143350 case 41: /* ccons ::= COLLATE ID|STRING */
143351 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
143352 break;
143353 case 44: /* refargs ::= */
143354 { yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */}
143355 break;
143356 case 45: /* refargs ::= refargs refarg */
143357 { yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy107.mask) | yymsp[0].minor.yy107.value; }
143358 break;
143359 case 46: /* refarg ::= MATCH nm */
143360 { yymsp[-1].minor.yy107.value = 0; yymsp[-1].minor.yy107.mask = 0x000000; }
143361 break;
143362 case 47: /* refarg ::= ON INSERT refact */
143363 { yymsp[-2].minor.yy107.value = 0; yymsp[-2].minor.yy107.mask = 0x000000; }
143364 break;
143365 case 48: /* refarg ::= ON DELETE refact */
143366 { yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy107.mask = 0x0000ff; }
143367 break;
143368 case 49: /* refarg ::= ON UPDATE refact */
143369 { yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy107.mask = 0x00ff00; }
143370 break;
143371 case 50: /* refact ::= SET NULL */
143372 { yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */}
143373 break;
143374 case 51: /* refact ::= SET DEFAULT */
143375 { yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */}
143376 break;
143377 case 52: /* refact ::= CASCADE */
143378 { yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */}
143379 break;
143380 case 53: /* refact ::= RESTRICT */
143381 { yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */}
143382 break;
143383 case 54: /* refact ::= NO ACTION */
143384 { yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */}
143385 break;
143386 case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
143387 {yymsp[-2].minor.yy502 = 0;}
143388 break;
143389 case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
143390 case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
143391 case 155: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==155);
143392 {yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;}
143393 break;
143394 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
143395 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
143396 case 196: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==196);
143397 case 199: /* in_op ::= NOT IN */ yytestcase(yyruleno==199);
143398 case 225: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==225);
143399 {yymsp[-1].minor.yy502 = 1;}
143400 break;
143401 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
143402 {yymsp[-1].minor.yy502 = 0;}
143403 break;
143404 case 61: /* tconscomma ::= COMMA */
143405 {pParse->constraintName.n = 0;}
143406 break;
143407 case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
143408 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy232,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);}
143409 break;
143410 case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
143411 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy232,yymsp[0].minor.yy502,0,0,0,0,
143412 SQLITE_IDXTYPE_UNIQUE);}
143413 break;
143414 case 65: /* tcons ::= CHECK LP expr RP onconf */
143415 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy182);}
143416 break;
143417 case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
143418 {
143419 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy232, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy502);
143420 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502);
143421 }
143422 break;
143423 case 68: /* onconf ::= */
143424 case 70: /* orconf ::= */ yytestcase(yyruleno==70);
143425 {yymsp[1].minor.yy502 = OE_Default;}
143426 break;
143427 case 69: /* onconf ::= ON CONFLICT resolvetype */
143428 {yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;}
143429 break;
143430 case 72: /* resolvetype ::= IGNORE */
143431 {yymsp[0].minor.yy502 = OE_Ignore;}
143432 break;
143433 case 73: /* resolvetype ::= REPLACE */
143434 case 156: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==156);
143435 {yymsp[0].minor.yy502 = OE_Replace;}
143436 break;
143437 case 74: /* cmd ::= DROP TABLE ifexists fullname */
143438 {
143439 sqlite3DropTable(pParse, yymsp[0].minor.yy427, 0, yymsp[-1].minor.yy502);
143440 }
143441 break;
143442 case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
143443 {
143444 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[0].minor.yy399, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502);
143445 }
143446 break;
143447 case 78: /* cmd ::= DROP VIEW ifexists fullname */
143448 {
143449 sqlite3DropTable(pParse, yymsp[0].minor.yy427, 1, yymsp[-1].minor.yy502);
143450 }
143451 break;
143452 case 79: /* cmd ::= select */
143453 {
143454 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
143455 sqlite3Select(pParse, yymsp[0].minor.yy399, &dest);
143456 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399);
143457 }
143458 break;
143459 case 80: /* select ::= WITH wqlist selectnowith */
143460 {
143461 Select *p = yymsp[0].minor.yy399;
143462 if( p ){
143463 p->pWith = yymsp[-1].minor.yy91;
143464 parserDoubleLinkSelect(pParse, p);
143465 }else{
143466 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91);
143467 }
143468 yymsp[-2].minor.yy399 = p;
143469 }
143470 break;
143471 case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
143472 {
143473 Select *p = yymsp[0].minor.yy399;
143474 if( p ){
143475 p->pWith = yymsp[-1].minor.yy91;
143476 parserDoubleLinkSelect(pParse, p);
143477 }else{
143478 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91);
143479 }
143480 yymsp[-3].minor.yy399 = p;
143481 }
143482 break;
143483 case 82: /* select ::= selectnowith */
143484 {
143485 Select *p = yymsp[0].minor.yy399;
143486 if( p ){
143487 parserDoubleLinkSelect(pParse, p);
143488 }
143489 yymsp[0].minor.yy399 = p; /*A-overwrites-X*/
143490 }
143491 break;
143492 case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
143493 {
143494 Select *pRhs = yymsp[0].minor.yy399;
143495 Select *pLhs = yymsp[-2].minor.yy399;
143496 if( pRhs && pRhs->pPrior ){
143497 SrcList *pFrom;
143498 Token x;
143499 x.n = 0;
143500 parserDoubleLinkSelect(pParse, pRhs);
143501 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
143502 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
143503 }
143504 if( pRhs ){
143505 pRhs->op = (u8)yymsp[-1].minor.yy502;
143506 pRhs->pPrior = pLhs;
143507 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
143508 pRhs->selFlags &= ~SF_MultiValue;
143509 if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1;
143510 }else{
143511 sqlite3SelectDelete(pParse->db, pLhs);
143512 }
143513 yymsp[-2].minor.yy399 = pRhs;
143514 }
143515 break;
143516 case 84: /* multiselect_op ::= UNION */
143517 case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
143518 {yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/}
143519 break;
143520 case 85: /* multiselect_op ::= UNION ALL */
143521 {yymsp[-1].minor.yy502 = TK_ALL;}
143522 break;
143523 case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
143524 {
143525 #if SELECTTRACE_ENABLED
143526 Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
143527 #endif
143528 yymsp[-8].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy232,yymsp[-5].minor.yy427,yymsp[-4].minor.yy182,yymsp[-3].minor.yy232,yymsp[-2].minor.yy182,yymsp[-1].minor.yy232,yymsp[-7].minor.yy502,yymsp[0].minor.yy182);
143529 #if SELECTTRACE_ENABLED
143530 /* Populate the Select.zSelName[] string that is used to help with
143531 ** query planner debugging, to differentiate between multiple Select
143532 ** objects in a complex query.
143533 **
@@ -142606,481 +143534,507 @@
143534 ** If the SELECT keyword is immediately followed by a C-style comment
143535 ** then extract the first few alphanumeric characters from within that
143536 ** comment to be the zSelName value. Otherwise, the label is #N where
143537 ** is an integer that is incremented with each SELECT statement seen.
143538 */
143539 if( yymsp[-8].minor.yy399!=0 ){
143540 const char *z = s.z+6;
143541 int i;
143542 sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName,"#%d",++pParse->nSelect);
143543 while( z[0]==' ' ) z++;
143544 if( z[0]=='/' && z[1]=='*' ){
143545 z += 2;
143546 while( z[0]==' ' ) z++;
143547 for(i=0; sqlite3Isalnum(z[i]); i++){}
143548 sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName, "%.*s", i, z);
143549 }
143550 }
143551 #endif /* SELECTRACE_ENABLED */
143552 }
143553 break;
143554 case 88: /* values ::= VALUES LP nexprlist RP */
143555 {
143556 yymsp[-3].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values,0);
143557 }
143558 break;
143559 case 89: /* values ::= values COMMA LP exprlist RP */
143560 {
143561 Select *pRight, *pLeft = yymsp[-4].minor.yy399;
143562 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values|SF_MultiValue,0);
143563 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
143564 if( pRight ){
143565 pRight->op = TK_ALL;
143566 pRight->pPrior = pLeft;
143567 yymsp[-4].minor.yy399 = pRight;
143568 }else{
143569 yymsp[-4].minor.yy399 = pLeft;
143570 }
143571 }
143572 break;
143573 case 90: /* distinct ::= DISTINCT */
143574 {yymsp[0].minor.yy502 = SF_Distinct;}
143575 break;
143576 case 91: /* distinct ::= ALL */
143577 {yymsp[0].minor.yy502 = SF_All;}
143578 break;
143579 case 93: /* sclp ::= */
143580 case 126: /* orderby_opt ::= */ yytestcase(yyruleno==126);
143581 case 133: /* groupby_opt ::= */ yytestcase(yyruleno==133);
143582 case 212: /* exprlist ::= */ yytestcase(yyruleno==212);
143583 case 215: /* paren_exprlist ::= */ yytestcase(yyruleno==215);
143584 case 220: /* eidlist_opt ::= */ yytestcase(yyruleno==220);
143585 {yymsp[1].minor.yy232 = 0;}
143586 break;
143587 case 94: /* selcollist ::= sclp scanpt expr scanpt as */
143588 {
143589 yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[-2].minor.yy182);
143590 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[0].minor.yy0, 1);
143591 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy232,yymsp[-3].minor.yy36,yymsp[-1].minor.yy36);
143592 }
143593 break;
143594 case 95: /* selcollist ::= sclp scanpt STAR */
143595 {
143596 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
143597 yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy232, p);
143598 }
143599 break;
143600 case 96: /* selcollist ::= sclp scanpt nm DOT STAR */
143601 {
143602 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
143603 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
143604 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
143605 yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, pDot);
143606 }
143607 break;
143608 case 97: /* as ::= AS nm */
143609 case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108);
143610 case 234: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==234);
143611 case 235: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==235);
143612 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
143613 break;
143614 case 99: /* from ::= */
143615 {yymsp[1].minor.yy427 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy427));}
143616 break;
143617 case 100: /* from ::= FROM seltablist */
143618 {
143619 yymsp[-1].minor.yy427 = yymsp[0].minor.yy427;
143620 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy427);
143621 }
143622 break;
143623 case 101: /* stl_prefix ::= seltablist joinop */
143624 {
143625 if( ALWAYS(yymsp[-1].minor.yy427 && yymsp[-1].minor.yy427->nSrc>0) ) yymsp[-1].minor.yy427->a[yymsp[-1].minor.yy427->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502;
143626 }
143627 break;
143628 case 102: /* stl_prefix ::= */
143629 {yymsp[1].minor.yy427 = 0;}
143630 break;
143631 case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
143632 {
143633 yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143634 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy427, &yymsp[-2].minor.yy0);
143635 }
143636 break;
143637 case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
143638 {
143639 yymsp[-8].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy427,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143640 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy427, yymsp[-4].minor.yy232);
143641 }
143642 break;
143643 case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
143644 {
143645 yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy399,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143646 }
143647 break;
143648 case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
143649 {
143650 if( yymsp[-6].minor.yy427==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy182==0 && yymsp[0].minor.yy510==0 ){
143651 yymsp[-6].minor.yy427 = yymsp[-4].minor.yy427;
143652 }else if( yymsp[-4].minor.yy427->nSrc==1 ){
143653 yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143654 if( yymsp[-6].minor.yy427 ){
143655 struct SrcList_item *pNew = &yymsp[-6].minor.yy427->a[yymsp[-6].minor.yy427->nSrc-1];
143656 struct SrcList_item *pOld = yymsp[-4].minor.yy427->a;
143657 pNew->zName = pOld->zName;
143658 pNew->zDatabase = pOld->zDatabase;
143659 pNew->pSelect = pOld->pSelect;
143660 pOld->zName = pOld->zDatabase = 0;
143661 pOld->pSelect = 0;
143662 }
143663 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy427);
143664 }else{
143665 Select *pSubquery;
143666 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy427);
143667 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy427,0,0,0,0,SF_NestedFrom,0);
143668 yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy182,yymsp[0].minor.yy510);
143669 }
143670 }
143671 break;
143672 case 107: /* dbnm ::= */
143673 case 121: /* indexed_opt ::= */ yytestcase(yyruleno==121);
143674 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
143675 break;
143676 case 109: /* fullname ::= nm */
143677 case 111: /* xfullname ::= nm */ yytestcase(yyruleno==111);
143678 {yymsp[0].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
143679 break;
143680 case 110: /* fullname ::= nm DOT nm */
143681 case 112: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==112);
143682 {yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
143683 break;
143684 case 113: /* xfullname ::= nm DOT nm AS nm */
143685 {
143686 yymsp[-4].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
143687 if( yymsp[-4].minor.yy427 ) yymsp[-4].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
143688 }
143689 break;
143690 case 114: /* xfullname ::= nm AS nm */
143691 {
143692 yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
143693 if( yymsp[-2].minor.yy427 ) yymsp[-2].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
143694 }
143695 break;
143696 case 115: /* joinop ::= COMMA|JOIN */
143697 { yymsp[0].minor.yy502 = JT_INNER; }
143698 break;
143699 case 116: /* joinop ::= JOIN_KW JOIN */
143700 {yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
143701 break;
143702 case 117: /* joinop ::= JOIN_KW nm JOIN */
143703 {yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
143704 break;
143705 case 118: /* joinop ::= JOIN_KW nm nm JOIN */
143706 {yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
143707 break;
143708 case 119: /* on_opt ::= ON expr */
143709 case 136: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==136);
143710 case 143: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==143);
143711 case 208: /* case_else ::= ELSE expr */ yytestcase(yyruleno==208);
143712 {yymsp[-1].minor.yy182 = yymsp[0].minor.yy182;}
143713 break;
143714 case 120: /* on_opt ::= */
143715 case 135: /* having_opt ::= */ yytestcase(yyruleno==135);
143716 case 137: /* limit_opt ::= */ yytestcase(yyruleno==137);
143717 case 142: /* where_opt ::= */ yytestcase(yyruleno==142);
143718 case 209: /* case_else ::= */ yytestcase(yyruleno==209);
143719 case 211: /* case_operand ::= */ yytestcase(yyruleno==211);
143720 {yymsp[1].minor.yy182 = 0;}
143721 break;
143722 case 122: /* indexed_opt ::= INDEXED BY nm */
143723 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
143724 break;
143725 case 123: /* indexed_opt ::= NOT INDEXED */
143726 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
143727 break;
143728 case 124: /* using_opt ::= USING LP idlist RP */
143729 {yymsp[-3].minor.yy510 = yymsp[-1].minor.yy510;}
143730 break;
143731 case 125: /* using_opt ::= */
143732 case 157: /* idlist_opt ::= */ yytestcase(yyruleno==157);
143733 {yymsp[1].minor.yy510 = 0;}
143734 break;
143735 case 127: /* orderby_opt ::= ORDER BY sortlist */
143736 case 134: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==134);
143737 {yymsp[-2].minor.yy232 = yymsp[0].minor.yy232;}
143738 break;
143739 case 128: /* sortlist ::= sortlist COMMA expr sortorder */
143740 {
143741 yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232,yymsp[-1].minor.yy182);
143742 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy232,yymsp[0].minor.yy502);
143743 }
143744 break;
143745 case 129: /* sortlist ::= expr sortorder */
143746 {
143747 yymsp[-1].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy182); /*A-overwrites-Y*/
143748 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy232,yymsp[0].minor.yy502);
143749 }
143750 break;
143751 case 130: /* sortorder ::= ASC */
143752 {yymsp[0].minor.yy502 = SQLITE_SO_ASC;}
143753 break;
143754 case 131: /* sortorder ::= DESC */
143755 {yymsp[0].minor.yy502 = SQLITE_SO_DESC;}
143756 break;
143757 case 132: /* sortorder ::= */
143758 {yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;}
143759 break;
143760 case 138: /* limit_opt ::= LIMIT expr */
143761 {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,0);}
143762 break;
143763 case 139: /* limit_opt ::= LIMIT expr OFFSET expr */
143764 {yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);}
143765 break;
143766 case 140: /* limit_opt ::= LIMIT expr COMMA expr */
143767 {yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,yymsp[-2].minor.yy182);}
143768 break;
143769 case 141: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
143770 {
143771 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy427, &yymsp[-1].minor.yy0);
143772 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy427,yymsp[0].minor.yy182,0,0);
143773 }
143774 break;
143775 case 144: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
143776 {
143777 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy427, &yymsp[-3].minor.yy0);
143778 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy232,"set list");
143779 sqlite3Update(pParse,yymsp[-4].minor.yy427,yymsp[-1].minor.yy232,yymsp[0].minor.yy182,yymsp[-5].minor.yy502,0,0,0);
143780 }
143781 break;
143782 case 145: /* setlist ::= setlist COMMA nm EQ expr */
143783 {
143784 yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[0].minor.yy182);
143785 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, 1);
143786 }
143787 break;
143788 case 146: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
143789 {
143790 yymsp[-6].minor.yy232 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy232, yymsp[-3].minor.yy510, yymsp[0].minor.yy182);
143791 }
143792 break;
143793 case 147: /* setlist ::= nm EQ expr */
143794 {
143795 yylhsminor.yy232 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy182);
143796 sqlite3ExprListSetName(pParse, yylhsminor.yy232, &yymsp[-2].minor.yy0, 1);
143797 }
143798 yymsp[-2].minor.yy232 = yylhsminor.yy232;
143799 break;
143800 case 148: /* setlist ::= LP idlist RP EQ expr */
143801 {
143802 yymsp[-4].minor.yy232 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy510, yymsp[0].minor.yy182);
143803 }
143804 break;
143805 case 149: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
143806 {
143807 sqlite3Insert(pParse, yymsp[-3].minor.yy427, yymsp[-1].minor.yy399, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, yymsp[0].minor.yy198);
143808 }
143809 break;
143810 case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
143811 {
143812 sqlite3Insert(pParse, yymsp[-3].minor.yy427, 0, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, 0);
143813 }
143814 break;
143815 case 151: /* upsert ::= */
143816 { yymsp[1].minor.yy198 = 0; }
143817 break;
143818 case 152: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
143819 { yymsp[-10].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy232,yymsp[-5].minor.yy182,yymsp[-1].minor.yy232,yymsp[0].minor.yy182);}
143820 break;
143821 case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
143822 { yymsp[-7].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy232,yymsp[-2].minor.yy182,0,0); }
143823 break;
143824 case 154: /* upsert ::= ON CONFLICT DO NOTHING */
143825 { yymsp[-3].minor.yy198 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
143826 break;
143827 case 158: /* idlist_opt ::= LP idlist RP */
143828 {yymsp[-2].minor.yy510 = yymsp[-1].minor.yy510;}
143829 break;
143830 case 159: /* idlist ::= idlist COMMA nm */
143831 {yymsp[-2].minor.yy510 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy510,&yymsp[0].minor.yy0);}
143832 break;
143833 case 160: /* idlist ::= nm */
143834 {yymsp[0].minor.yy510 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
143835 break;
143836 case 161: /* expr ::= LP expr RP */
143837 {yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182;}
143838 break;
143839 case 162: /* expr ::= ID|INDEXED */
143840 case 163: /* expr ::= JOIN_KW */ yytestcase(yyruleno==163);
143841 {yymsp[0].minor.yy182=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
143842 break;
143843 case 164: /* expr ::= nm DOT nm */
143844 {
143845 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
143846 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
143847 yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
143848 }
143849 yymsp[-2].minor.yy182 = yylhsminor.yy182;
143850 break;
143851 case 165: /* expr ::= nm DOT nm DOT nm */
143852 {
143853 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
143854 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
143855 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
143856 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
143857 yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
143858 }
143859 yymsp[-4].minor.yy182 = yylhsminor.yy182;
143860 break;
143861 case 166: /* term ::= NULL|FLOAT|BLOB */
143862 case 167: /* term ::= STRING */ yytestcase(yyruleno==167);
143863 {yymsp[0].minor.yy182=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
143864 break;
143865 case 168: /* term ::= INTEGER */
143866 {
143867 yylhsminor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
143868 }
143869 yymsp[0].minor.yy182 = yylhsminor.yy182;
143870 break;
143871 case 169: /* expr ::= VARIABLE */
143872 {
143873 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
143874 u32 n = yymsp[0].minor.yy0.n;
143875 yymsp[0].minor.yy182 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
143876 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy182, n);
143877 }else{
143878 /* When doing a nested parse, one can include terms in an expression
143879 ** that look like this: #1 #2 ... These terms refer to registers
143880 ** in the virtual machine. #N is the N-th register. */
143881 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
143882 assert( t.n>=2 );
143883 if( pParse->nested==0 ){
143884 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
143885 yymsp[0].minor.yy182 = 0;
143886 }else{
143887 yymsp[0].minor.yy182 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
143888 if( yymsp[0].minor.yy182 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy182->iTable);
143889 }
143890 }
143891 }
143892 break;
143893 case 170: /* expr ::= expr COLLATE ID|STRING */
143894 {
143895 yymsp[-2].minor.yy182 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy182, &yymsp[0].minor.yy0, 1);
143896 }
143897 break;
143898 case 171: /* expr ::= CAST LP expr AS typetoken RP */
143899 {
143900 yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
143901 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy182, yymsp[-3].minor.yy182, 0);
143902 }
143903 break;
143904 case 172: /* expr ::= ID|INDEXED LP distinct exprlist RP */
143905 {
143906 if( yymsp[-1].minor.yy232 && yymsp[-1].minor.yy232->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
143907 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
143908 }
143909 yylhsminor.yy182 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy232, &yymsp[-4].minor.yy0);
143910 if( yymsp[-2].minor.yy502==SF_Distinct && yylhsminor.yy182 ){
143911 yylhsminor.yy182->flags |= EP_Distinct;
143912 }
143913 }
143914 yymsp[-4].minor.yy182 = yylhsminor.yy182;
143915 break;
143916 case 173: /* expr ::= ID|INDEXED LP STAR RP */
143917 {
143918 yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
143919 }
143920 yymsp[-3].minor.yy182 = yylhsminor.yy182;
143921 break;
143922 case 174: /* term ::= CTIME_KW */
143923 {
143924 yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
143925 }
143926 yymsp[0].minor.yy182 = yylhsminor.yy182;
143927 break;
143928 case 175: /* expr ::= LP nexprlist COMMA expr RP */
143929 {
143930 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy232, yymsp[-1].minor.yy182);
143931 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
143932 if( yymsp[-4].minor.yy182 ){
143933 yymsp[-4].minor.yy182->x.pList = pList;
143934 }else{
143935 sqlite3ExprListDelete(pParse->db, pList);
143936 }
143937 }
143938 break;
143939 case 176: /* expr ::= expr AND expr */
143940 case 177: /* expr ::= expr OR expr */ yytestcase(yyruleno==177);
143941 case 178: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==178);
143942 case 179: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==179);
143943 case 180: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==180);
143944 case 181: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==181);
143945 case 182: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==182);
143946 case 183: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==183);
143947 {yymsp[-2].minor.yy182=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);}
143948 break;
143949 case 184: /* likeop ::= NOT LIKE_KW|MATCH */
143950 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
143951 break;
143952 case 185: /* expr ::= expr likeop expr */
143953 {
143954 ExprList *pList;
143955 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
143956 yymsp[-1].minor.yy0.n &= 0x7fffffff;
143957 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy182);
143958 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy182);
143959 yymsp[-2].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
143960 if( bNot ) yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy182, 0);
143961 if( yymsp[-2].minor.yy182 ) yymsp[-2].minor.yy182->flags |= EP_InfixFunc;
143962 }
143963 break;
143964 case 186: /* expr ::= expr likeop expr ESCAPE expr */
143965 {
143966 ExprList *pList;
143967 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
143968 yymsp[-3].minor.yy0.n &= 0x7fffffff;
143969 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
143970 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy182);
143971 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182);
143972 yymsp[-4].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
143973 if( bNot ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
143974 if( yymsp[-4].minor.yy182 ) yymsp[-4].minor.yy182->flags |= EP_InfixFunc;
143975 }
143976 break;
143977 case 187: /* expr ::= expr ISNULL|NOTNULL */
143978 {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy182,0);}
143979 break;
143980 case 188: /* expr ::= expr NOT NULL */
143981 {yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy182,0);}
143982 break;
143983 case 189: /* expr ::= expr IS expr */
143984 {
143985 yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);
143986 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-2].minor.yy182, TK_ISNULL);
143987 }
143988 break;
143989 case 190: /* expr ::= expr IS NOT expr */
143990 {
143991 yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy182,yymsp[0].minor.yy182);
143992 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-3].minor.yy182, TK_NOTNULL);
143993 }
143994 break;
143995 case 191: /* expr ::= NOT expr */
143996 case 192: /* expr ::= BITNOT expr */ yytestcase(yyruleno==192);
143997 {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy182, 0);/*A-overwrites-B*/}
143998 break;
143999 case 193: /* expr ::= MINUS expr */
144000 {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy182, 0);}
144001 break;
144002 case 194: /* expr ::= PLUS expr */
144003 {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy182, 0);}
144004 break;
144005 case 195: /* between_op ::= BETWEEN */
144006 case 198: /* in_op ::= IN */ yytestcase(yyruleno==198);
144007 {yymsp[0].minor.yy502 = 0;}
144008 break;
144009 case 197: /* expr ::= expr between_op expr AND expr */
144010 {
144011 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
144012 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182);
144013 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy182, 0);
144014 if( yymsp[-4].minor.yy182 ){
144015 yymsp[-4].minor.yy182->x.pList = pList;
144016 }else{
144017 sqlite3ExprListDelete(pParse->db, pList);
144018 }
144019 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144020 }
144021 break;
144022 case 200: /* expr ::= expr in_op LP exprlist RP */
144023 {
144024 if( yymsp[-1].minor.yy232==0 ){
144025 /* Expressions of the form
144026 **
144027 ** expr1 IN ()
144028 ** expr1 NOT IN ()
144029 **
144030 ** simplify to constants 0 (false) and 1 (true), respectively,
144031 ** regardless of the value of expr1.
144032 */
144033 sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy182);
144034 yymsp[-4].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy502],1);
144035 }else if( yymsp[-1].minor.yy232->nExpr==1 ){
144036 /* Expressions of the form:
144037 **
144038 ** expr1 IN (?1)
144039 ** expr1 NOT IN (?2)
144040 **
@@ -143093,394 +144047,396 @@
144047 ** But, the RHS of the == or <> is marked with the EP_Generic flag
144048 ** so that it may not contribute to the computation of comparison
144049 ** affinity or the collating sequence to use for comparison. Otherwise,
144050 ** the semantics would be subtly different from IN or NOT IN.
144051 */
144052 Expr *pRHS = yymsp[-1].minor.yy232->a[0].pExpr;
144053 yymsp[-1].minor.yy232->a[0].pExpr = 0;
144054 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232);
144055 /* pRHS cannot be NULL because a malloc error would have been detected
144056 ** before now and control would have never reached this point */
144057 if( ALWAYS(pRHS) ){
144058 pRHS->flags &= ~EP_Collate;
144059 pRHS->flags |= EP_Generic;
144060 }
144061 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_NE : TK_EQ, yymsp[-4].minor.yy182, pRHS);
144062 }else{
144063 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144064 if( yymsp[-4].minor.yy182 ){
144065 yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy232;
144066 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182);
144067 }else{
144068 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232);
144069 }
144070 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144071 }
144072 }
144073 break;
144074 case 201: /* expr ::= LP select RP */
144075 {
144076 yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
144077 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy182, yymsp[-1].minor.yy399);
144078 }
144079 break;
144080 case 202: /* expr ::= expr in_op LP select RP */
144081 {
144082 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144083 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, yymsp[-1].minor.yy399);
144084 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144085 }
144086 break;
144087 case 203: /* expr ::= expr in_op nm dbnm paren_exprlist */
144088 {
144089 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
144090 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
144091 if( yymsp[0].minor.yy232 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy232);
144092 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0);
144093 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, pSelect);
144094 if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0);
144095 }
144096 break;
144097 case 204: /* expr ::= EXISTS LP select RP */
144098 {
144099 Expr *p;
144100 p = yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
144101 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy399);
144102 }
144103 break;
144104 case 205: /* expr ::= CASE case_operand case_exprlist case_else END */
144105 {
144106 yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy182, 0);
144107 if( yymsp[-4].minor.yy182 ){
144108 yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy182 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[-1].minor.yy182) : yymsp[-2].minor.yy232;
144109 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182);
144110 }else{
144111 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy232);
144112 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy182);
144113 }
144114 }
144115 break;
144116 case 206: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
144117 {
144118 yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[-2].minor.yy182);
144119 yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[0].minor.yy182);
144120 }
144121 break;
144122 case 207: /* case_exprlist ::= WHEN expr THEN expr */
144123 {
144124 yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182);
144125 yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232, yymsp[0].minor.yy182);
144126 }
144127 break;
144128 case 210: /* case_operand ::= expr */
144129 {yymsp[0].minor.yy182 = yymsp[0].minor.yy182; /*A-overwrites-X*/}
144130 break;
144131 case 213: /* nexprlist ::= nexprlist COMMA expr */
144132 {yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[0].minor.yy182);}
144133 break;
144134 case 214: /* nexprlist ::= expr */
144135 {yymsp[0].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy182); /*A-overwrites-Y*/}
144136 break;
144137 case 216: /* paren_exprlist ::= LP exprlist RP */
144138 case 221: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==221);
144139 {yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232;}
144140 break;
144141 case 217: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
144142 {
144143 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
144144 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy232, yymsp[-10].minor.yy502,
144145 &yymsp[-11].minor.yy0, yymsp[0].minor.yy182, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF);
144146 }
144147 break;
144148 case 218: /* uniqueflag ::= UNIQUE */
144149 case 258: /* raisetype ::= ABORT */ yytestcase(yyruleno==258);
144150 {yymsp[0].minor.yy502 = OE_Abort;}
144151 break;
144152 case 219: /* uniqueflag ::= */
144153 {yymsp[1].minor.yy502 = OE_None;}
144154 break;
144155 case 222: /* eidlist ::= eidlist COMMA nm collate sortorder */
144156 {
144157 yymsp[-4].minor.yy232 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502);
144158 }
144159 break;
144160 case 223: /* eidlist ::= nm collate sortorder */
144161 {
144162 yymsp[-2].minor.yy232 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/
144163 }
144164 break;
144165 case 226: /* cmd ::= DROP INDEX ifexists fullname */
144166 {sqlite3DropIndex(pParse, yymsp[0].minor.yy427, yymsp[-1].minor.yy502);}
144167 break;
144168 case 227: /* cmd ::= VACUUM */
144169 {sqlite3Vacuum(pParse,0);}
144170 break;
144171 case 228: /* cmd ::= VACUUM nm */
144172 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
144173 break;
144174 case 229: /* cmd ::= PRAGMA nm dbnm */
144175 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
144176 break;
144177 case 230: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
144178 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
144179 break;
144180 case 231: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
144181 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
144182 break;
144183 case 232: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
144184 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
144185 break;
144186 case 233: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
144187 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
144188 break;
144189 case 236: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
144190 {
144191 Token all;
144192 all.z = yymsp[-3].minor.yy0.z;
144193 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
144194 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy47, &all);
144195 }
144196 break;
144197 case 237: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
144198 {
144199 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy502, yymsp[-4].minor.yy300.a, yymsp[-4].minor.yy300.b, yymsp[-2].minor.yy427, yymsp[0].minor.yy182, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502);
144200 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
144201 }
144202 break;
144203 case 238: /* trigger_time ::= BEFORE|AFTER */
144204 { yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ }
144205 break;
144206 case 239: /* trigger_time ::= INSTEAD OF */
144207 { yymsp[-1].minor.yy502 = TK_INSTEAD;}
144208 break;
144209 case 240: /* trigger_time ::= */
144210 { yymsp[1].minor.yy502 = TK_BEFORE; }
144211 break;
144212 case 241: /* trigger_event ::= DELETE|INSERT */
144213 case 242: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==242);
144214 {yymsp[0].minor.yy300.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy300.b = 0;}
144215 break;
144216 case 243: /* trigger_event ::= UPDATE OF idlist */
144217 {yymsp[-2].minor.yy300.a = TK_UPDATE; yymsp[-2].minor.yy300.b = yymsp[0].minor.yy510;}
144218 break;
144219 case 244: /* when_clause ::= */
144220 case 263: /* key_opt ::= */ yytestcase(yyruleno==263);
144221 { yymsp[1].minor.yy182 = 0; }
144222 break;
144223 case 245: /* when_clause ::= WHEN expr */
144224 case 264: /* key_opt ::= KEY expr */ yytestcase(yyruleno==264);
144225 { yymsp[-1].minor.yy182 = yymsp[0].minor.yy182; }
144226 break;
144227 case 246: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
144228 {
144229 assert( yymsp[-2].minor.yy47!=0 );
144230 yymsp[-2].minor.yy47->pLast->pNext = yymsp[-1].minor.yy47;
144231 yymsp[-2].minor.yy47->pLast = yymsp[-1].minor.yy47;
144232 }
144233 break;
144234 case 247: /* trigger_cmd_list ::= trigger_cmd SEMI */
144235 {
144236 assert( yymsp[-1].minor.yy47!=0 );
144237 yymsp[-1].minor.yy47->pLast = yymsp[-1].minor.yy47;
144238 }
144239 break;
144240 case 248: /* trnm ::= nm DOT nm */
144241 {
144242 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
144243 sqlite3ErrorMsg(pParse,
144244 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
144245 "statements within triggers");
144246 }
144247 break;
144248 case 249: /* tridxby ::= INDEXED BY nm */
144249 {
144250 sqlite3ErrorMsg(pParse,
144251 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
144252 "within triggers");
144253 }
144254 break;
144255 case 250: /* tridxby ::= NOT INDEXED */
144256 {
144257 sqlite3ErrorMsg(pParse,
144258 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
144259 "within triggers");
144260 }
144261 break;
144262 case 251: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
144263 {yylhsminor.yy47 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy182, yymsp[-6].minor.yy502, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy36);}
144264 yymsp[-7].minor.yy47 = yylhsminor.yy47;
144265 break;
144266 case 252: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
144267 {
144268 yylhsminor.yy47 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy510,yymsp[-2].minor.yy399,yymsp[-6].minor.yy502,yymsp[-1].minor.yy198,yymsp[-7].minor.yy36,yymsp[0].minor.yy36);/*yylhsminor.yy47-overwrites-yymsp[-6].minor.yy502*/
144269 }
144270 yymsp[-7].minor.yy47 = yylhsminor.yy47;
144271 break;
144272 case 253: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
144273 {yylhsminor.yy47 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy182, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy36);}
144274 yymsp[-5].minor.yy47 = yylhsminor.yy47;
144275 break;
144276 case 254: /* trigger_cmd ::= scanpt select scanpt */
144277 {yylhsminor.yy47 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy399, yymsp[-2].minor.yy36, yymsp[0].minor.yy36); /*yylhsminor.yy47-overwrites-yymsp[-1].minor.yy399*/}
144278 yymsp[-2].minor.yy47 = yylhsminor.yy47;
144279 break;
144280 case 255: /* expr ::= RAISE LP IGNORE RP */
144281 {
144282 yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
144283 if( yymsp[-3].minor.yy182 ){
144284 yymsp[-3].minor.yy182->affinity = OE_Ignore;
144285 }
144286 }
144287 break;
144288 case 256: /* expr ::= RAISE LP raisetype COMMA nm RP */
144289 {
144290 yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
144291 if( yymsp[-5].minor.yy182 ) {
144292 yymsp[-5].minor.yy182->affinity = (char)yymsp[-3].minor.yy502;
144293 }
144294 }
144295 break;
144296 case 257: /* raisetype ::= ROLLBACK */
144297 {yymsp[0].minor.yy502 = OE_Rollback;}
144298 break;
144299 case 259: /* raisetype ::= FAIL */
144300 {yymsp[0].minor.yy502 = OE_Fail;}
144301 break;
144302 case 260: /* cmd ::= DROP TRIGGER ifexists fullname */
144303 {
144304 sqlite3DropTrigger(pParse,yymsp[0].minor.yy427,yymsp[-1].minor.yy502);
144305 }
144306 break;
144307 case 261: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
144308 {
144309 sqlite3Attach(pParse, yymsp[-3].minor.yy182, yymsp[-1].minor.yy182, yymsp[0].minor.yy182);
144310 }
144311 break;
144312 case 262: /* cmd ::= DETACH database_kw_opt expr */
144313 {
144314 sqlite3Detach(pParse, yymsp[0].minor.yy182);
144315 }
144316 break;
144317 case 265: /* cmd ::= REINDEX */
144318 {sqlite3Reindex(pParse, 0, 0);}
144319 break;
144320 case 266: /* cmd ::= REINDEX nm dbnm */
144321 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
144322 break;
144323 case 267: /* cmd ::= ANALYZE */
144324 {sqlite3Analyze(pParse, 0, 0);}
144325 break;
144326 case 268: /* cmd ::= ANALYZE nm dbnm */
144327 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
144328 break;
144329 case 269: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
144330 {
144331 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy427,&yymsp[0].minor.yy0);
144332 }
144333 break;
144334 case 270: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
144335 {
144336 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
144337 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
144338 }
144339 break;
144340 case 271: /* add_column_fullname ::= fullname */
144341 {
144342 disableLookaside(pParse);
144343 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy427);
144344 }
144345 break;
144346 case 272: /* cmd ::= create_vtab */
144347 {sqlite3VtabFinishParse(pParse,0);}
144348 break;
144349 case 273: /* cmd ::= create_vtab LP vtabarglist RP */
144350 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
144351 break;
144352 case 274: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
144353 {
144354 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy502);
144355 }
144356 break;
144357 case 275: /* vtabarg ::= */
144358 {sqlite3VtabArgInit(pParse);}
144359 break;
144360 case 276: /* vtabargtoken ::= ANY */
144361 case 277: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==277);
144362 case 278: /* lp ::= LP */ yytestcase(yyruleno==278);
144363 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
144364 break;
144365 case 279: /* with ::= WITH wqlist */
144366 case 280: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==280);
144367 { sqlite3WithPush(pParse, yymsp[0].minor.yy91, 1); }
144368 break;
144369 case 281: /* wqlist ::= nm eidlist_opt AS LP select RP */
144370 {
144371 yymsp[-5].minor.yy91 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399); /*A-overwrites-X*/
144372 }
144373 break;
144374 case 282: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
144375 {
144376 yymsp[-7].minor.yy91 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy91, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399);
144377 }
144378 break;
144379 default:
144380 /* (283) input ::= cmdlist */ yytestcase(yyruleno==283);
144381 /* (284) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==284);
144382 /* (285) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=285);
144383 /* (286) ecmd ::= SEMI */ yytestcase(yyruleno==286);
144384 /* (287) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==287);
144385 /* (288) ecmd ::= explain cmdx */ yytestcase(yyruleno==288);
144386 /* (289) trans_opt ::= */ yytestcase(yyruleno==289);
144387 /* (290) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==290);
144388 /* (291) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==291);
144389 /* (292) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==292);
144390 /* (293) savepoint_opt ::= */ yytestcase(yyruleno==293);
144391 /* (294) cmd ::= create_table create_table_args */ yytestcase(yyruleno==294);
144392 /* (295) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==295);
144393 /* (296) columnlist ::= columnname carglist */ yytestcase(yyruleno==296);
144394 /* (297) nm ::= ID|INDEXED */ yytestcase(yyruleno==297);
144395 /* (298) nm ::= STRING */ yytestcase(yyruleno==298);
144396 /* (299) nm ::= JOIN_KW */ yytestcase(yyruleno==299);
144397 /* (300) typetoken ::= typename */ yytestcase(yyruleno==300);
144398 /* (301) typename ::= ID|STRING */ yytestcase(yyruleno==301);
144399 /* (302) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=302);
144400 /* (303) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=303);
144401 /* (304) carglist ::= carglist ccons */ yytestcase(yyruleno==304);
144402 /* (305) carglist ::= */ yytestcase(yyruleno==305);
144403 /* (306) ccons ::= NULL onconf */ yytestcase(yyruleno==306);
144404 /* (307) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==307);
144405 /* (308) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==308);
144406 /* (309) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=309);
144407 /* (310) tconscomma ::= */ yytestcase(yyruleno==310);
144408 /* (311) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=311);
144409 /* (312) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=312);
144410 /* (313) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=313);
144411 /* (314) oneselect ::= values */ yytestcase(yyruleno==314);
144412 /* (315) sclp ::= selcollist COMMA */ yytestcase(yyruleno==315);
144413 /* (316) as ::= ID|STRING */ yytestcase(yyruleno==316);
144414 /* (317) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=317);
144415 /* (318) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==318);
144416 /* (319) exprlist ::= nexprlist */ yytestcase(yyruleno==319);
144417 /* (320) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=320);
144418 /* (321) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=321);
144419 /* (322) nmnum ::= ON */ yytestcase(yyruleno==322);
144420 /* (323) nmnum ::= DELETE */ yytestcase(yyruleno==323);
144421 /* (324) nmnum ::= DEFAULT */ yytestcase(yyruleno==324);
144422 /* (325) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==325);
144423 /* (326) foreach_clause ::= */ yytestcase(yyruleno==326);
144424 /* (327) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==327);
144425 /* (328) trnm ::= nm */ yytestcase(yyruleno==328);
144426 /* (329) tridxby ::= */ yytestcase(yyruleno==329);
144427 /* (330) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==330);
144428 /* (331) database_kw_opt ::= */ yytestcase(yyruleno==331);
144429 /* (332) kwcolumn_opt ::= */ yytestcase(yyruleno==332);
144430 /* (333) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==333);
144431 /* (334) vtabarglist ::= vtabarg */ yytestcase(yyruleno==334);
144432 /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==335);
144433 /* (336) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==336);
144434 /* (337) anylist ::= */ yytestcase(yyruleno==337);
144435 /* (338) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==338);
144436 /* (339) anylist ::= anylist ANY */ yytestcase(yyruleno==339);
144437 /* (340) with ::= */ yytestcase(yyruleno==340);
144438 break;
144439 /********** End reduce actions ************************************************/
144440 };
144441 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
144442 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -143497,20 +144453,22 @@
144453 yymsp += yysize+1;
144454 yypParser->yytos = yymsp;
144455 yymsp->stateno = (YYACTIONTYPE)yyact;
144456 yymsp->major = (YYCODETYPE)yygoto;
144457 yyTraceShift(yypParser, yyact, "... then shift");
144458 return yyact;
144459 }
144460
144461 /*
144462 ** The following code executes when the parse fails
144463 */
144464 #ifndef YYNOERRORRECOVERY
144465 static void yy_parse_failed(
144466 yyParser *yypParser /* The parser */
144467 ){
144468 sqlite3ParserARG_FETCH
144469 sqlite3ParserCTX_FETCH
144470 #ifndef NDEBUG
144471 if( yyTraceFILE ){
144472 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
144473 }
144474 #endif
@@ -143517,11 +144475,12 @@
144475 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
144476 /* Here code is inserted which will be executed whenever the
144477 ** parser fails */
144478 /************ Begin %parse_failure code ***************************************/
144479 /************ End %parse_failure code *****************************************/
144480 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144481 sqlite3ParserCTX_STORE
144482 }
144483 #endif /* YYNOERRORRECOVERY */
144484
144485 /*
144486 ** The following code executes when a syntax error first occurs.
@@ -143529,11 +144488,12 @@
144488 static void yy_syntax_error(
144489 yyParser *yypParser, /* The parser */
144490 int yymajor, /* The major type of the error token */
144491 sqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */
144492 ){
144493 sqlite3ParserARG_FETCH
144494 sqlite3ParserCTX_FETCH
144495 #define TOKEN yyminor
144496 /************ Begin %syntax_error code ****************************************/
144497
144498 UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */
144499 if( TOKEN.z[0] ){
@@ -143540,20 +144500,22 @@
144500 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
144501 }else{
144502 sqlite3ErrorMsg(pParse, "incomplete input");
144503 }
144504 /************ End %syntax_error code ******************************************/
144505 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144506 sqlite3ParserCTX_STORE
144507 }
144508
144509 /*
144510 ** The following is executed when the parser accepts
144511 */
144512 static void yy_accept(
144513 yyParser *yypParser /* The parser */
144514 ){
144515 sqlite3ParserARG_FETCH
144516 sqlite3ParserCTX_FETCH
144517 #ifndef NDEBUG
144518 if( yyTraceFILE ){
144519 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
144520 }
144521 #endif
@@ -143563,11 +144525,12 @@
144525 assert( yypParser->yytos==yypParser->yystack );
144526 /* Here code is inserted which will be executed whenever the
144527 ** parser accepts */
144528 /*********** Begin %parse_accept code *****************************************/
144529 /*********** End %parse_accept code *******************************************/
144530 sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
144531 sqlite3ParserCTX_STORE
144532 }
144533
144534 /* The main parser program.
144535 ** The first argument is a pointer to a structure obtained from
144536 ** "sqlite3ParserAlloc" which describes the current state of the parser.
@@ -143592,49 +144555,51 @@
144555 int yymajor, /* The major token code number */
144556 sqlite3ParserTOKENTYPE yyminor /* The value for the token */
144557 sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */
144558 ){
144559 YYMINORTYPE yyminorunion;
144560 YYACTIONTYPE yyact; /* The parser action. */
144561 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
144562 int yyendofinput; /* True if we are at the end of input */
144563 #endif
144564 #ifdef YYERRORSYMBOL
144565 int yyerrorhit = 0; /* True if yymajor has invoked an error */
144566 #endif
144567 yyParser *yypParser = (yyParser*)yyp; /* The parser */
144568 sqlite3ParserCTX_FETCH
144569 sqlite3ParserARG_STORE
144570
 
144571 assert( yypParser->yytos!=0 );
144572 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
144573 yyendofinput = (yymajor==0);
144574 #endif
 
144575
144576 yyact = yypParser->yytos->stateno;
144577 #ifndef NDEBUG
144578 if( yyTraceFILE ){
144579 if( yyact < YY_MIN_REDUCE ){
 
144580 fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
144581 yyTracePrompt,yyTokenName[yymajor],yyact);
144582 }else{
144583 fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
144584 yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
144585 }
144586 }
144587 #endif
144588
144589 do{
144590 assert( yyact==yypParser->yytos->stateno );
144591 yyact = yy_find_shift_action(yymajor,yyact);
144592 if( yyact >= YY_MIN_REDUCE ){
144593 yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
144594 yyminor sqlite3ParserCTX_PARAM);
144595 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
144596 yy_shift(yypParser,yyact,yymajor,yyminor);
144597 #ifndef YYNOERRORRECOVERY
144598 yypParser->yyerrcnt--;
144599 #endif
144600 break;
144601 }else if( yyact==YY_ACCEPT_ACTION ){
144602 yypParser->yytos--;
144603 yy_accept(yypParser);
144604 return;
144605 }else{
@@ -143701,10 +144666,12 @@
144666 yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
144667 }
144668 }
144669 yypParser->yyerrcnt = 3;
144670 yyerrorhit = 1;
144671 if( yymajor==YYNOCODE ) break;
144672 yyact = yypParser->yytos->stateno;
144673 #elif defined(YYNOERRORRECOVERY)
144674 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
144675 ** do any kind of error recovery. Instead, simply invoke the syntax
144676 ** error routine and continue going as if nothing had happened.
144677 **
@@ -143711,12 +144678,11 @@
144678 ** Applications can set this macro (for example inside %include) if
144679 ** they intend to abandon the parse upon the first syntax error seen.
144680 */
144681 yy_syntax_error(yypParser,yymajor, yyminor);
144682 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
144683 break;
 
144684 #else /* YYERRORSYMBOL is not defined */
144685 /* This is what we do if the grammar does not define ERROR:
144686 **
144687 ** * Report an error message, and throw away the input token.
144688 **
@@ -143734,14 +144700,14 @@
144700 yy_parse_failed(yypParser);
144701 #ifndef YYNOERRORRECOVERY
144702 yypParser->yyerrcnt = -1;
144703 #endif
144704 }
144705 break;
144706 #endif
144707 }
144708 }while( yypParser->yytos>yypParser->yystack );
144709 #ifndef NDEBUG
144710 if( yyTraceFILE ){
144711 yyStackEntry *i;
144712 char cDiv = '[';
144713 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
@@ -143914,23 +144880,23 @@
144880 ** might be implemented more directly using a hand-written hash table.
144881 ** But by using this automatically generated code, the size of the code
144882 ** is substantially reduced. This is important for embedded applications
144883 ** on platforms with limited memory.
144884 */
144885 /* Hash score: 185 */
144886 /* zKWText[] encodes 845 bytes of keyword text in 561 bytes */
144887 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
144888 /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
144889 /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
144890 /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
144891 /* BETWEENOTHINGLOBYCASCADELETECASECOLLATECREATECURRENT_DATE */
144892 /* DETACHIMMEDIATEJOINSERTLIKEMATCHPLANALYZEPRAGMABORTVALUES */
144893 /* VIRTUALIMITWHENOTNULLWHERENAMEAFTEREPLACEANDEFAULT */
144894 /* AUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP */
144895 /* RIMARYDEFERREDISTINCTDORDERESTRICTDROPFAILFROMFULLIFISNULL */
144896 /* RIGHTROLLBACKROWUNIONUSINGVACUUMVIEWINITIALLY */
144897 static const char zKWText[560] = {
144898 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
144899 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
144900 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
144901 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
144902 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
@@ -143940,86 +144906,87 @@
144906 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
144907 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
144908 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
144909 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
144910 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
144911 'B','E','T','W','E','E','N','O','T','H','I','N','G','L','O','B','Y','C',
144912 'A','S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L',
144913 'A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D',
144914 'A','T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E',
144915 'J','O','I','N','S','E','R','T','L','I','K','E','M','A','T','C','H','P',
144916 'L','A','N','A','L','Y','Z','E','P','R','A','G','M','A','B','O','R','T',
144917 'V','A','L','U','E','S','V','I','R','T','U','A','L','I','M','I','T','W',
144918 'H','E','N','O','T','N','U','L','L','W','H','E','R','E','N','A','M','E',
144919 'A','F','T','E','R','E','P','L','A','C','E','A','N','D','E','F','A','U',
144920 'L','T','A','U','T','O','I','N','C','R','E','M','E','N','T','C','A','S',
144921 'T','C','O','L','U','M','N','C','O','M','M','I','T','C','O','N','F','L',
144922 'I','C','T','C','R','O','S','S','C','U','R','R','E','N','T','_','T','I',
144923 'M','E','S','T','A','M','P','R','I','M','A','R','Y','D','E','F','E','R',
144924 'R','E','D','I','S','T','I','N','C','T','D','O','R','D','E','R','E','S',
144925 'T','R','I','C','T','D','R','O','P','F','A','I','L','F','R','O','M','F',
144926 'U','L','L','I','F','I','S','N','U','L','L','R','I','G','H','T','R','O',
144927 'L','L','B','A','C','K','R','O','W','U','N','I','O','N','U','S','I','N',
144928 'G','V','A','C','U','U','M','V','I','E','W','I','N','I','T','I','A','L',
144929 'L','Y',
144930 };
144931 /* aKWHash[i] is the hash value for the i-th keyword */
144932 static const unsigned char aKWHash[127] = {
144933 74, 108, 119, 72, 0, 45, 0, 0, 81, 0, 76, 61, 0,
144934 42, 12, 77, 15, 0, 118, 84, 54, 116, 0, 19, 0, 0,
144935 123, 0, 121, 111, 0, 22, 96, 0, 9, 0, 0, 68, 69,
144936 0, 67, 6, 0, 48, 93, 105, 0, 120, 104, 0, 0, 44,
144937 0, 106, 24, 0, 17, 0, 124, 53, 23, 0, 5, 62, 25,
144938 99, 0, 0, 126, 112, 60, 125, 57, 28, 55, 0, 94, 0,
144939 103, 26, 0, 102, 0, 0, 0, 98, 95, 100, 91, 115, 14,
144940 39, 114, 0, 80, 0, 109, 92, 90, 32, 0, 122, 79, 117,
144941 86, 46, 83, 0, 0, 97, 40, 59, 110, 0, 36, 0, 0,
144942 29, 0, 89, 87, 88, 0, 20, 85, 0, 56,
144943 };
144944 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
144945 ** then the i-th keyword has no more hash collisions. Otherwise,
144946 ** the next keyword with the same hash is aKWHash[i]-1. */
144947 static const unsigned char aKWNext[126] = {
144948 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
144949 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
144950 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144951 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
144952 0, 43, 3, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144953 0, 1, 64, 0, 0, 65, 0, 41, 0, 38, 0, 0, 0,
144954 0, 0, 49, 75, 0, 0, 30, 0, 58, 0, 0, 63, 31,
144955 52, 16, 34, 10, 0, 0, 0, 0, 0, 0, 0, 11, 70,
144956 78, 0, 8, 0, 18, 51, 0, 107, 101, 0, 113, 0, 73,
144957 27, 37, 71, 82, 0, 35, 66, 0, 0,
144958 };
144959 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
144960 static const unsigned char aKWLen[126] = {
144961 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
144962 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
144963 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
144964 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
144965 6, 6, 5, 6, 5, 5, 9, 7, 7, 4, 2, 7, 3,
144966 6, 4, 7, 6, 12, 6, 9, 4, 6, 4, 5, 4, 7,
144967 6, 5, 6, 7, 5, 4, 7, 3, 2, 4, 5, 6, 5,
144968 7, 3, 7, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12,
144969 7, 8, 8, 2, 2, 5, 8, 4, 4, 4, 4, 2, 6,
144970 5, 8, 3, 5, 5, 6, 4, 9, 3,
144971 };
144972 /* aKWOffset[i] is the index into zKWText[] of the start of
144973 ** the text for the i-th keyword. */
144974 static const unsigned short int aKWOffset[126] = {
144975 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
144976 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
144977 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
144978 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
144979 199, 204, 209, 212, 218, 221, 225, 234, 240, 246, 249, 251, 252,
144980 256, 262, 266, 273, 279, 291, 297, 306, 308, 314, 318, 323, 325,
144981 332, 337, 342, 348, 354, 359, 362, 362, 362, 365, 369, 372, 378,
144982 382, 389, 391, 398, 400, 402, 411, 415, 421, 427, 435, 440, 440,
144983 456, 463, 470, 471, 478, 479, 483, 491, 495, 499, 503, 507, 509,
144984 515, 520, 528, 531, 536, 541, 547, 551, 556,
144985 };
144986 /* aKWCode[i] is the parser symbol code for the i-th keyword */
144987 static const unsigned char aKWCode[126] = {
144988 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
144989 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
144990 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
144991 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
144992 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -144028,23 +144995,24 @@
144995 TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
144996 TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
144997 TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
144998 TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
144999 TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
145000 TK_NOTHING, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC,
145001 TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE, TK_CTIME_KW,
145002 TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_LIKE_KW,
145003 TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT,
145004 TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, TK_NOTNULL,
145005 TK_NOT, TK_NO, TK_NULL, TK_WHERE, TK_RENAME,
145006 TK_AFTER, TK_REPLACE, TK_AND, TK_DEFAULT, TK_AUTOINCR,
145007 TK_TO, TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT,
145008 TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_PRIMARY,
145009 TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DO, TK_ORDER,
145010 TK_RESTRICT, TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW,
145011 TK_IF, TK_ISNULL, TK_JOIN_KW, TK_ROLLBACK, TK_ROW,
145012 TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_INITIALLY,
145013 TK_ALL,
145014 };
145015 /* Check to see if z[0..n-1] is a keyword. If it is, write the
145016 ** parser symbol code for that keyword into *pType. Always
145017 ** return the integer n (the length of the token). */
145018 static int keywordCode(const char *z, int n, int *pType){
@@ -144121,74 +145089,76 @@
145089 testcase( i==55 ); /* UPDATE */
145090 testcase( i==56 ); /* BEGIN */
145091 testcase( i==57 ); /* INNER */
145092 testcase( i==58 ); /* RECURSIVE */
145093 testcase( i==59 ); /* BETWEEN */
145094 testcase( i==60 ); /* NOTHING */
145095 testcase( i==61 ); /* GLOB */
145096 testcase( i==62 ); /* BY */
145097 testcase( i==63 ); /* CASCADE */
145098 testcase( i==64 ); /* ASC */
145099 testcase( i==65 ); /* DELETE */
145100 testcase( i==66 ); /* CASE */
145101 testcase( i==67 ); /* COLLATE */
145102 testcase( i==68 ); /* CREATE */
145103 testcase( i==69 ); /* CURRENT_DATE */
145104 testcase( i==70 ); /* DETACH */
145105 testcase( i==71 ); /* IMMEDIATE */
145106 testcase( i==72 ); /* JOIN */
145107 testcase( i==73 ); /* INSERT */
145108 testcase( i==74 ); /* LIKE */
145109 testcase( i==75 ); /* MATCH */
145110 testcase( i==76 ); /* PLAN */
145111 testcase( i==77 ); /* ANALYZE */
145112 testcase( i==78 ); /* PRAGMA */
145113 testcase( i==79 ); /* ABORT */
145114 testcase( i==80 ); /* VALUES */
145115 testcase( i==81 ); /* VIRTUAL */
145116 testcase( i==82 ); /* LIMIT */
145117 testcase( i==83 ); /* WHEN */
145118 testcase( i==84 ); /* NOTNULL */
145119 testcase( i==85 ); /* NOT */
145120 testcase( i==86 ); /* NO */
145121 testcase( i==87 ); /* NULL */
145122 testcase( i==88 ); /* WHERE */
145123 testcase( i==89 ); /* RENAME */
145124 testcase( i==90 ); /* AFTER */
145125 testcase( i==91 ); /* REPLACE */
145126 testcase( i==92 ); /* AND */
145127 testcase( i==93 ); /* DEFAULT */
145128 testcase( i==94 ); /* AUTOINCREMENT */
145129 testcase( i==95 ); /* TO */
145130 testcase( i==96 ); /* IN */
145131 testcase( i==97 ); /* CAST */
145132 testcase( i==98 ); /* COLUMN */
145133 testcase( i==99 ); /* COMMIT */
145134 testcase( i==100 ); /* CONFLICT */
145135 testcase( i==101 ); /* CROSS */
145136 testcase( i==102 ); /* CURRENT_TIMESTAMP */
145137 testcase( i==103 ); /* CURRENT_TIME */
145138 testcase( i==104 ); /* PRIMARY */
145139 testcase( i==105 ); /* DEFERRED */
145140 testcase( i==106 ); /* DISTINCT */
145141 testcase( i==107 ); /* IS */
145142 testcase( i==108 ); /* DO */
145143 testcase( i==109 ); /* ORDER */
145144 testcase( i==110 ); /* RESTRICT */
145145 testcase( i==111 ); /* DROP */
145146 testcase( i==112 ); /* FAIL */
145147 testcase( i==113 ); /* FROM */
145148 testcase( i==114 ); /* FULL */
145149 testcase( i==115 ); /* IF */
145150 testcase( i==116 ); /* ISNULL */
145151 testcase( i==117 ); /* RIGHT */
145152 testcase( i==118 ); /* ROLLBACK */
145153 testcase( i==119 ); /* ROW */
145154 testcase( i==120 ); /* UNION */
145155 testcase( i==121 ); /* USING */
145156 testcase( i==122 ); /* VACUUM */
145157 testcase( i==123 ); /* VIEW */
145158 testcase( i==124 ); /* INITIALLY */
145159 testcase( i==125 ); /* ALL */
145160 *pType = aKWCode[i];
145161 break;
145162 }
145163 }
145164 return n;
@@ -144196,11 +145166,11 @@
145166 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
145167 int id = TK_ID;
145168 keywordCode((char*)z, n, &id);
145169 return id;
145170 }
145171 #define SQLITE_N_KEYWORD 126
145172
145173 /************** End of keywordhash.h *****************************************/
145174 /************** Continuing where we left off in tokenize.c *******************/
145175
145176
@@ -144553,13 +145523,13 @@
145523 pParse->zTail = zSql;
145524 assert( pzErrMsg!=0 );
145525 /* sqlite3ParserTrace(stdout, "parser: "); */
145526 #ifdef sqlite3Parser_ENGINEALWAYSONSTACK
145527 pEngine = &sEngine;
145528 sqlite3ParserInit(pEngine, pParse);
145529 #else
145530 pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse);
145531 if( pEngine==0 ){
145532 sqlite3OomFault(db);
145533 return SQLITE_NOMEM_BKPT;
145534 }
145535 #endif
@@ -144599,11 +145569,11 @@
145569 }
145570 zSql += n;
145571 }else{
145572 pParse->sLastToken.z = zSql;
145573 pParse->sLastToken.n = n;
145574 sqlite3Parser(pEngine, tokenType, pParse->sLastToken);
145575 lastTokenParsed = tokenType;
145576 zSql += n;
145577 if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
145578 }
145579 }
@@ -145706,10 +146676,21 @@
146676 case SQLITE_CONFIG_STMTJRNL_SPILL: {
146677 sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int);
146678 break;
146679 }
146680
146681 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
146682 case SQLITE_CONFIG_SORTERREF_SIZE: {
146683 int iVal = va_arg(ap, int);
146684 if( iVal<0 ){
146685 iVal = SQLITE_DEFAULT_SORTERREF_SIZE;
146686 }
146687 sqlite3GlobalConfig.szSorterRef = (u32)iVal;
146688 break;
146689 }
146690 #endif /* SQLITE_ENABLE_SORTER_REFERENCES */
146691
146692 default: {
146693 rc = SQLITE_ERROR;
146694 break;
146695 }
146696 }
@@ -189765,12 +190746,14 @@
190746 ** for terminal symbols is called "fts5yy0".
190747 ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If
190748 ** zero the stack is dynamically sized using realloc()
190749 ** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument
190750 ** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument
190751 ** sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter
190752 ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser
190753 ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser
190754 ** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context
190755 ** fts5YYERRORSYMBOL is the code number of the error symbol. If not
190756 ** defined, then do no error processing.
190757 ** fts5YYNSTATE the combined number of states.
190758 ** fts5YYNRULE the number of rules in the grammar
190759 ** fts5YYNFTS5TOKEN Number of terminal symbols
@@ -189786,29 +190769,35 @@
190769 #ifndef INTERFACE
190770 # define INTERFACE 1
190771 #endif
190772 /************* Begin control #defines *****************************************/
190773 #define fts5YYCODETYPE unsigned char
190774 #define fts5YYNOCODE 27
190775 #define fts5YYACTIONTYPE unsigned char
190776 #define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token
190777 typedef union {
190778 int fts5yyinit;
190779 sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0;
190780 int fts5yy4;
190781 Fts5Colset* fts5yy11;
190782 Fts5ExprNode* fts5yy24;
190783 Fts5ExprNearset* fts5yy46;
190784 Fts5ExprPhrase* fts5yy53;
190785 } fts5YYMINORTYPE;
190786 #ifndef fts5YYSTACKDEPTH
190787 #define fts5YYSTACKDEPTH 100
190788 #endif
190789 #define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse;
190790 #define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse
190791 #define sqlite3Fts5ParserARG_PARAM ,pParse
190792 #define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse;
190793 #define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse;
190794 #define sqlite3Fts5ParserCTX_SDECL
190795 #define sqlite3Fts5ParserCTX_PDECL
190796 #define sqlite3Fts5ParserCTX_PARAM
190797 #define sqlite3Fts5ParserCTX_FETCH
190798 #define sqlite3Fts5ParserCTX_STORE
190799 #define fts5YYNSTATE 35
190800 #define fts5YYNRULE 28
190801 #define fts5YYNFTS5TOKEN 16
190802 #define fts5YY_MAX_SHIFT 34
190803 #define fts5YY_MIN_SHIFTREDUCE 52
@@ -189885,50 +190874,50 @@
190874 *********** Begin parsing tables **********************************************/
190875 #define fts5YY_ACTTAB_COUNT (105)
190876 static const fts5YYACTIONTYPE fts5yy_action[] = {
190877 /* 0 */ 81, 20, 96, 6, 28, 99, 98, 26, 26, 18,
190878 /* 10 */ 96, 6, 28, 17, 98, 56, 26, 19, 96, 6,
190879 /* 20 */ 28, 14, 98, 14, 26, 31, 92, 96, 6, 28,
190880 /* 30 */ 108, 98, 25, 26, 21, 96, 6, 28, 78, 98,
190881 /* 40 */ 58, 26, 29, 96, 6, 28, 107, 98, 22, 26,
190882 /* 50 */ 24, 16, 12, 11, 1, 13, 13, 24, 16, 23,
190883 /* 60 */ 11, 33, 34, 13, 97, 8, 27, 32, 98, 7,
190884 /* 70 */ 26, 3, 4, 5, 3, 4, 5, 3, 83, 4,
190885 /* 80 */ 5, 3, 63, 5, 3, 62, 12, 2, 86, 13,
190886 /* 90 */ 9, 30, 10, 10, 54, 57, 75, 78, 78, 53,
190887 /* 100 */ 57, 15, 82, 82, 71,
190888 };
190889 static const fts5YYCODETYPE fts5yy_lookahead[] = {
190890 /* 0 */ 16, 17, 18, 19, 20, 22, 22, 24, 24, 17,
190891 /* 10 */ 18, 19, 20, 7, 22, 9, 24, 17, 18, 19,
190892 /* 20 */ 20, 9, 22, 9, 24, 13, 17, 18, 19, 20,
190893 /* 30 */ 26, 22, 24, 24, 17, 18, 19, 20, 15, 22,
190894 /* 40 */ 9, 24, 17, 18, 19, 20, 26, 22, 21, 24,
190895 /* 50 */ 6, 7, 9, 9, 10, 12, 12, 6, 7, 21,
190896 /* 60 */ 9, 24, 25, 12, 18, 5, 20, 14, 22, 5,
190897 /* 70 */ 24, 3, 1, 2, 3, 1, 2, 3, 0, 1,
190898 /* 80 */ 2, 3, 11, 2, 3, 11, 9, 10, 5, 12,
190899 /* 90 */ 23, 24, 10, 10, 8, 9, 9, 15, 15, 8,
190900 /* 100 */ 9, 9, 27, 27, 11, 27, 27, 27, 27, 27,
190901 /* 110 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
190902 /* 120 */ 27,
190903 };
190904 #define fts5YY_SHIFT_COUNT (34)
190905 #define fts5YY_SHIFT_MIN (0)
190906 #define fts5YY_SHIFT_MAX (93)
190907 static const unsigned char fts5yy_shift_ofst[] = {
190908 /* 0 */ 44, 44, 44, 44, 44, 44, 51, 77, 43, 12,
190909 /* 10 */ 14, 83, 82, 14, 23, 23, 31, 31, 71, 74,
190910 /* 20 */ 78, 81, 86, 91, 6, 53, 53, 60, 64, 68,
190911 /* 30 */ 53, 87, 92, 53, 93,
190912 };
190913 #define fts5YY_REDUCE_COUNT (17)
190914 #define fts5YY_REDUCE_MIN (-17)
190915 #define fts5YY_REDUCE_MAX (67)
190916 static const signed char fts5yy_reduce_ofst[] = {
190917 /* 0 */ -16, -8, 0, 9, 17, 25, 46, -17, -17, 37,
190918 /* 10 */ 67, 4, 4, 8, 4, 20, 27, 38,
190919 };
190920 static const fts5YYACTIONTYPE fts5yy_default[] = {
190921 /* 0 */ 80, 80, 80, 80, 80, 80, 95, 80, 80, 105,
190922 /* 10 */ 80, 110, 110, 80, 110, 110, 80, 80, 80, 80,
190923 /* 20 */ 80, 91, 80, 80, 80, 101, 100, 80, 80, 90,
@@ -189989,10 +190978,11 @@
190978 #endif
190979 #ifndef fts5YYNOERRORRECOVERY
190980 int fts5yyerrcnt; /* Shifts left before out of the error */
190981 #endif
190982 sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */
190983 sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */
190984 #if fts5YYSTACKDEPTH<=0
190985 int fts5yystksz; /* Current side of the stack */
190986 fts5yyStackEntry *fts5yystack; /* The parser's stack */
190987 fts5yyStackEntry fts5yystk0; /* First stack entry */
190988 #else
@@ -190052,22 +191042,21 @@
191042 /* 11 */ "RP",
191043 /* 12 */ "CARET",
191044 /* 13 */ "COMMA",
191045 /* 14 */ "PLUS",
191046 /* 15 */ "STAR",
191047 /* 16 */ "input",
191048 /* 17 */ "expr",
191049 /* 18 */ "cnearset",
191050 /* 19 */ "exprlist",
191051 /* 20 */ "colset",
191052 /* 21 */ "colsetlist",
191053 /* 22 */ "nearset",
191054 /* 23 */ "nearphrases",
191055 /* 24 */ "phrase",
191056 /* 25 */ "neardist_opt",
191057 /* 26 */ "star_opt",
 
191058 };
191059 #endif /* defined(fts5YYCOVERAGE) || !defined(NDEBUG) */
191060
191061 #ifndef NDEBUG
191062 /* For tracing reduce actions, the names of all rules are required.
@@ -190147,32 +191136,33 @@
191136 # define fts5YYMALLOCARGTYPE size_t
191137 #endif
191138
191139 /* Initialize a new parser that has already been allocated.
191140 */
191141 static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PDECL){
191142 fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yypRawParser;
191143 sqlite3Fts5ParserCTX_STORE
191144 #ifdef fts5YYTRACKMAXSTACKDEPTH
191145 fts5yypParser->fts5yyhwm = 0;
191146 #endif
191147 #if fts5YYSTACKDEPTH<=0
191148 fts5yypParser->fts5yytos = NULL;
191149 fts5yypParser->fts5yystack = NULL;
191150 fts5yypParser->fts5yystksz = 0;
191151 if( fts5yyGrowStack(fts5yypParser) ){
191152 fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0;
191153 fts5yypParser->fts5yystksz = 1;
191154 }
191155 #endif
191156 #ifndef fts5YYNOERRORRECOVERY
191157 fts5yypParser->fts5yyerrcnt = -1;
191158 #endif
191159 fts5yypParser->fts5yytos = fts5yypParser->fts5yystack;
191160 fts5yypParser->fts5yystack[0].stateno = 0;
191161 fts5yypParser->fts5yystack[0].major = 0;
191162 #if fts5YYSTACKDEPTH>0
191163 fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1];
191164 #endif
191165 }
191166
191167 #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
191168 /*
@@ -190185,15 +191175,18 @@
191175 **
191176 ** Outputs:
191177 ** A pointer to a parser. This pointer is used in subsequent calls
191178 ** to sqlite3Fts5Parser and sqlite3Fts5ParserFree.
191179 */
191180 static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE) sqlite3Fts5ParserCTX_PDECL){
191181 fts5yyParser *fts5yypParser;
191182 fts5yypParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) );
191183 if( fts5yypParser ){
191184 sqlite3Fts5ParserCTX_STORE
191185 sqlite3Fts5ParserInit(fts5yypParser sqlite3Fts5ParserCTX_PARAM);
191186 }
191187 return (void*)fts5yypParser;
191188 }
191189 #endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */
191190
191191
191192 /* The following function deletes the "minor type" or semantic value
@@ -190206,11 +191199,12 @@
191199 static void fts5yy_destructor(
191200 fts5yyParser *fts5yypParser, /* The parser */
191201 fts5YYCODETYPE fts5yymajor, /* Type code for object to destroy */
191202 fts5YYMINORTYPE *fts5yypminor /* The object to be destroyed */
191203 ){
191204 sqlite3Fts5ParserARG_FETCH
191205 sqlite3Fts5ParserCTX_FETCH
191206 switch( fts5yymajor ){
191207 /* Here is inserted the actions which take place when a
191208 ** terminal or non-terminal is destroyed. This can happen
191209 ** when the symbol is popped from the stack during a
191210 ** reduce or during error processing or when a parser is
@@ -190219,37 +191213,37 @@
191213 ** Note: during a reduce, the only symbols destroyed are those
191214 ** which appear on the RHS of the rule, but which are *not* used
191215 ** inside the C code.
191216 */
191217 /********* Begin destructor definitions ***************************************/
191218 case 16: /* input */
191219 {
191220 (void)pParse;
191221 }
191222 break;
191223 case 17: /* expr */
191224 case 18: /* cnearset */
191225 case 19: /* exprlist */
191226 {
191227 sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24));
191228 }
191229 break;
191230 case 20: /* colset */
191231 case 21: /* colsetlist */
191232 {
191233 sqlite3_free((fts5yypminor->fts5yy11));
191234 }
191235 break;
191236 case 22: /* nearset */
191237 case 23: /* nearphrases */
191238 {
191239 sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46));
191240 }
191241 break;
191242 case 24: /* phrase */
191243 {
191244 sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53));
191245 }
191246 break;
191247 /********* End destructor definitions *****************************************/
191248 default: break; /* If no destructor action specified: do nothing */
191249 }
@@ -190357,17 +191351,16 @@
191351
191352 /*
191353 ** Find the appropriate action for a parser given the terminal
191354 ** look-ahead token iLookAhead.
191355 */
191356 static fts5YYACTIONTYPE fts5yy_find_shift_action(
191357 fts5YYCODETYPE iLookAhead, /* The look-ahead token */
191358 fts5YYACTIONTYPE stateno /* Current state number */
191359 ){
191360 int i;
191361
 
191362 if( stateno>fts5YY_MAX_SHIFT ) return stateno;
191363 assert( stateno <= fts5YY_SHIFT_COUNT );
191364 #if defined(fts5YYCOVERAGE)
191365 fts5yycoverage[stateno][iLookAhead] = 1;
191366 #endif
@@ -190427,11 +191420,11 @@
191420 /*
191421 ** Find the appropriate action for a parser given the non-terminal
191422 ** look-ahead token iLookAhead.
191423 */
191424 static int fts5yy_find_reduce_action(
191425 fts5YYACTIONTYPE stateno, /* Current state number */
191426 fts5YYCODETYPE iLookAhead /* The look-ahead token */
191427 ){
191428 int i;
191429 #ifdef fts5YYERRORSYMBOL
191430 if( stateno>fts5YY_REDUCE_COUNT ){
@@ -190456,11 +191449,12 @@
191449
191450 /*
191451 ** The following routine is called if the stack overflows.
191452 */
191453 static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){
191454 sqlite3Fts5ParserARG_FETCH
191455 sqlite3Fts5ParserCTX_FETCH
191456 #ifndef NDEBUG
191457 if( fts5yyTraceFILE ){
191458 fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt);
191459 }
191460 #endif
@@ -190469,11 +191463,12 @@
191463 ** stack every overflows */
191464 /******** Begin %stack_overflow code ******************************************/
191465
191466 sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow");
191467 /******** End %stack_overflow code ********************************************/
191468 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */
191469 sqlite3Fts5ParserCTX_STORE
191470 }
191471
191472 /*
191473 ** Print tracing information for a SHIFT action
191474 */
@@ -190498,12 +191493,12 @@
191493 /*
191494 ** Perform a shift action.
191495 */
191496 static void fts5yy_shift(
191497 fts5yyParser *fts5yypParser, /* The parser to be shifted */
191498 fts5YYACTIONTYPE fts5yyNewState, /* The new state to shift in */
191499 fts5YYCODETYPE fts5yyMajor, /* The major token to shift in */
191500 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */
191501 ){
191502 fts5yyStackEntry *fts5yytos;
191503 fts5yypParser->fts5yytos++;
191504 #ifdef fts5YYTRACKMAXSTACKDEPTH
@@ -190529,12 +191524,12 @@
191524 #endif
191525 if( fts5yyNewState > fts5YY_MAX_SHIFT ){
191526 fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;
191527 }
191528 fts5yytos = fts5yypParser->fts5yytos;
191529 fts5yytos->stateno = fts5yyNewState;
191530 fts5yytos->major = fts5yyMajor;
191531 fts5yytos->minor.fts5yy0 = fts5yyMinor;
191532 fts5yyTraceShift(fts5yypParser, fts5yyNewState, "Shift");
191533 }
191534
191535 /* The following table contains information about every rule that
@@ -190542,38 +191537,38 @@
191537 */
191538 static const struct {
191539 fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
191540 signed char nrhs; /* Negative of the number of RHS symbols in the rule */
191541 } fts5yyRuleInfo[] = {
191542 { 16, -1 }, /* (0) input ::= expr */
191543 { 20, -4 }, /* (1) colset ::= MINUS LCP colsetlist RCP */
191544 { 20, -3 }, /* (2) colset ::= LCP colsetlist RCP */
191545 { 20, -1 }, /* (3) colset ::= STRING */
191546 { 20, -2 }, /* (4) colset ::= MINUS STRING */
191547 { 21, -2 }, /* (5) colsetlist ::= colsetlist STRING */
191548 { 21, -1 }, /* (6) colsetlist ::= STRING */
191549 { 17, -3 }, /* (7) expr ::= expr AND expr */
191550 { 17, -3 }, /* (8) expr ::= expr OR expr */
191551 { 17, -3 }, /* (9) expr ::= expr NOT expr */
191552 { 17, -5 }, /* (10) expr ::= colset COLON LP expr RP */
191553 { 17, -3 }, /* (11) expr ::= LP expr RP */
191554 { 17, -1 }, /* (12) expr ::= exprlist */
191555 { 19, -1 }, /* (13) exprlist ::= cnearset */
191556 { 19, -2 }, /* (14) exprlist ::= exprlist cnearset */
191557 { 18, -1 }, /* (15) cnearset ::= nearset */
191558 { 18, -3 }, /* (16) cnearset ::= colset COLON nearset */
191559 { 22, -1 }, /* (17) nearset ::= phrase */
191560 { 22, -2 }, /* (18) nearset ::= CARET phrase */
191561 { 22, -5 }, /* (19) nearset ::= STRING LP nearphrases neardist_opt RP */
191562 { 23, -1 }, /* (20) nearphrases ::= phrase */
191563 { 23, -2 }, /* (21) nearphrases ::= nearphrases phrase */
191564 { 25, 0 }, /* (22) neardist_opt ::= */
191565 { 25, -2 }, /* (23) neardist_opt ::= COMMA STRING */
191566 { 24, -4 }, /* (24) phrase ::= phrase PLUS STRING star_opt */
191567 { 24, -2 }, /* (25) phrase ::= STRING star_opt */
191568 { 26, -1 }, /* (26) star_opt ::= STAR */
191569 { 26, 0 }, /* (27) star_opt ::= */
191570 };
191571
191572 static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */
191573
191574 /*
@@ -190584,21 +191579,22 @@
191579 ** access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE
191580 ** if the lookahead token has already been consumed. As this procedure is
191581 ** only called from one place, optimizing compilers will in-line it, which
191582 ** means that the extra parameters have no performance impact.
191583 */
191584 static fts5YYACTIONTYPE fts5yy_reduce(
191585 fts5yyParser *fts5yypParser, /* The parser */
191586 unsigned int fts5yyruleno, /* Number of the rule by which to reduce */
191587 int fts5yyLookahead, /* Lookahead token, or fts5YYNOCODE if none */
191588 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */
191589 sqlite3Fts5ParserCTX_PDECL /* %extra_context */
191590 ){
191591 int fts5yygoto; /* The next state */
191592 int fts5yyact; /* The next action */
191593 fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */
191594 int fts5yysize; /* Amount to pop the stack */
191595 sqlite3Fts5ParserARG_FETCH
191596 (void)fts5yyLookahead;
191597 (void)fts5yyLookaheadToken;
191598 fts5yymsp = fts5yypParser->fts5yytos;
191599 #ifndef NDEBUG
191600 if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
@@ -190625,17 +191621,23 @@
191621 }
191622 #endif
191623 #if fts5YYSTACKDEPTH>0
191624 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
191625 fts5yyStackOverflow(fts5yypParser);
191626 /* The call to fts5yyStackOverflow() above pops the stack until it is
191627 ** empty, causing the main parser loop to exit. So the return value
191628 ** is never used and does not matter. */
191629 return 0;
191630 }
191631 #else
191632 if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){
191633 if( fts5yyGrowStack(fts5yypParser) ){
191634 fts5yyStackOverflow(fts5yypParser);
191635 /* The call to fts5yyStackOverflow() above pops the stack until it is
191636 ** empty, causing the main parser loop to exit. So the return value
191637 ** is never used and does not matter. */
191638 return 0;
191639 }
191640 fts5yymsp = fts5yypParser->fts5yytos;
191641 }
191642 #endif
191643 }
@@ -190650,142 +191652,142 @@
191652 ** break;
191653 */
191654 /********** Begin reduce actions **********************************************/
191655 fts5YYMINORTYPE fts5yylhsminor;
191656 case 0: /* input ::= expr */
191657 { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }
191658 break;
191659 case 1: /* colset ::= MINUS LCP colsetlist RCP */
191660 {
191661 fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
191662 }
191663 break;
191664 case 2: /* colset ::= LCP colsetlist RCP */
191665 { fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }
191666 break;
191667 case 3: /* colset ::= STRING */
191668 {
191669 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191670 }
191671 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
191672 break;
191673 case 4: /* colset ::= MINUS STRING */
191674 {
191675 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191676 fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);
191677 }
191678 break;
191679 case 5: /* colsetlist ::= colsetlist STRING */
191680 {
191681 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }
191682 fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
191683 break;
191684 case 6: /* colsetlist ::= STRING */
191685 {
191686 fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);
191687 }
191688 fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;
191689 break;
191690 case 7: /* expr ::= expr AND expr */
191691 {
191692 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
191693 }
191694 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191695 break;
191696 case 8: /* expr ::= expr OR expr */
191697 {
191698 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
191699 }
191700 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191701 break;
191702 case 9: /* expr ::= expr NOT expr */
191703 {
191704 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);
191705 }
191706 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191707 break;
191708 case 10: /* expr ::= colset COLON LP expr RP */
191709 {
191710 sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11);
191711 fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;
191712 }
191713 fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191714 break;
191715 case 11: /* expr ::= LP expr RP */
191716 {fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}
191717 break;
191718 case 12: /* expr ::= exprlist */
191719 case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13);
191720 {fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}
191721 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191722 break;
191723 case 14: /* exprlist ::= exprlist cnearset */
191724 {
191725 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);
191726 }
191727 fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191728 break;
191729 case 15: /* cnearset ::= nearset */
191730 {
191731 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
191732 }
191733 fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191734 break;
191735 case 16: /* cnearset ::= colset COLON nearset */
191736 {
191737 fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46);
191738 sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11);
191739 }
191740 fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;
191741 break;
191742 case 17: /* nearset ::= phrase */
191743 { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }
191744 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
191745 break;
191746 case 18: /* nearset ::= CARET phrase */
191747 {
191748 sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53);
191749 fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
191750 }
191751 break;
191752 case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */
191753 {
191754 sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);
191755 sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);
191756 fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;
191757 }
191758 fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
191759 break;
191760 case 20: /* nearphrases ::= phrase */
191761 {
191762 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53);
191763 }
191764 fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
191765 break;
191766 case 21: /* nearphrases ::= nearphrases phrase */
191767 {
191768 fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);
191769 }
191770 fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;
191771 break;
191772 case 22: /* neardist_opt ::= */
191773 { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }
191774 break;
191775 case 23: /* neardist_opt ::= COMMA STRING */
191776 { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }
191777 break;
191778 case 24: /* phrase ::= phrase PLUS STRING star_opt */
191779 {
191780 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
191781 }
191782 fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
191783 break;
191784 case 25: /* phrase ::= STRING star_opt */
191785 {
191786 fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);
191787 }
191788 fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;
191789 break;
191790 case 26: /* star_opt ::= STAR */
191791 { fts5yymsp[0].minor.fts5yy4 = 1; }
191792 break;
191793 case 27: /* star_opt ::= */
@@ -190810,20 +191812,22 @@
191812 fts5yymsp += fts5yysize+1;
191813 fts5yypParser->fts5yytos = fts5yymsp;
191814 fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact;
191815 fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto;
191816 fts5yyTraceShift(fts5yypParser, fts5yyact, "... then shift");
191817 return fts5yyact;
191818 }
191819
191820 /*
191821 ** The following code executes when the parse fails
191822 */
191823 #ifndef fts5YYNOERRORRECOVERY
191824 static void fts5yy_parse_failed(
191825 fts5yyParser *fts5yypParser /* The parser */
191826 ){
191827 sqlite3Fts5ParserARG_FETCH
191828 sqlite3Fts5ParserCTX_FETCH
191829 #ifndef NDEBUG
191830 if( fts5yyTraceFILE ){
191831 fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt);
191832 }
191833 #endif
@@ -190830,11 +191834,12 @@
191834 while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
191835 /* Here code is inserted which will be executed whenever the
191836 ** parser fails */
191837 /************ Begin %parse_failure code ***************************************/
191838 /************ End %parse_failure code *****************************************/
191839 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191840 sqlite3Fts5ParserCTX_STORE
191841 }
191842 #endif /* fts5YYNOERRORRECOVERY */
191843
191844 /*
191845 ** The following code executes when a syntax error first occurs.
@@ -190842,29 +191847,32 @@
191847 static void fts5yy_syntax_error(
191848 fts5yyParser *fts5yypParser, /* The parser */
191849 int fts5yymajor, /* The major type of the error token */
191850 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */
191851 ){
191852 sqlite3Fts5ParserARG_FETCH
191853 sqlite3Fts5ParserCTX_FETCH
191854 #define FTS5TOKEN fts5yyminor
191855 /************ Begin %syntax_error code ****************************************/
191856
191857 UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */
191858 sqlite3Fts5ParseError(
191859 pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p
191860 );
191861 /************ End %syntax_error code ******************************************/
191862 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191863 sqlite3Fts5ParserCTX_STORE
191864 }
191865
191866 /*
191867 ** The following is executed when the parser accepts
191868 */
191869 static void fts5yy_accept(
191870 fts5yyParser *fts5yypParser /* The parser */
191871 ){
191872 sqlite3Fts5ParserARG_FETCH
191873 sqlite3Fts5ParserCTX_FETCH
191874 #ifndef NDEBUG
191875 if( fts5yyTraceFILE ){
191876 fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt);
191877 }
191878 #endif
@@ -190874,11 +191882,12 @@
191882 assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack );
191883 /* Here code is inserted which will be executed whenever the
191884 ** parser accepts */
191885 /*********** Begin %parse_accept code *****************************************/
191886 /*********** End %parse_accept code *******************************************/
191887 sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */
191888 sqlite3Fts5ParserCTX_STORE
191889 }
191890
191891 /* The main parser program.
191892 ** The first argument is a pointer to a structure obtained from
191893 ** "sqlite3Fts5ParserAlloc" which describes the current state of the parser.
@@ -190903,49 +191912,51 @@
191912 int fts5yymajor, /* The major token code number */
191913 sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */
191914 sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */
191915 ){
191916 fts5YYMINORTYPE fts5yyminorunion;
191917 fts5YYACTIONTYPE fts5yyact; /* The parser action. */
191918 #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
191919 int fts5yyendofinput; /* True if we are at the end of input */
191920 #endif
191921 #ifdef fts5YYERRORSYMBOL
191922 int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */
191923 #endif
191924 fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yyp; /* The parser */
191925 sqlite3Fts5ParserCTX_FETCH
191926 sqlite3Fts5ParserARG_STORE
191927
 
191928 assert( fts5yypParser->fts5yytos!=0 );
191929 #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)
191930 fts5yyendofinput = (fts5yymajor==0);
191931 #endif
 
191932
191933 fts5yyact = fts5yypParser->fts5yytos->stateno;
191934 #ifndef NDEBUG
191935 if( fts5yyTraceFILE ){
191936 if( fts5yyact < fts5YY_MIN_REDUCE ){
 
191937 fprintf(fts5yyTraceFILE,"%sInput '%s' in state %d\n",
191938 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact);
191939 }else{
191940 fprintf(fts5yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
191941 fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE);
191942 }
191943 }
191944 #endif
191945
191946 do{
191947 assert( fts5yyact==fts5yypParser->fts5yytos->stateno );
191948 fts5yyact = fts5yy_find_shift_action(fts5yymajor,fts5yyact);
191949 if( fts5yyact >= fts5YY_MIN_REDUCE ){
191950 fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor,
191951 fts5yyminor sqlite3Fts5ParserCTX_PARAM);
191952 }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
191953 fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor);
191954 #ifndef fts5YYNOERRORRECOVERY
191955 fts5yypParser->fts5yyerrcnt--;
191956 #endif
191957 break;
191958 }else if( fts5yyact==fts5YY_ACCEPT_ACTION ){
191959 fts5yypParser->fts5yytos--;
191960 fts5yy_accept(fts5yypParser);
191961 return;
191962 }else{
@@ -191012,10 +192023,12 @@
192023 fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor);
192024 }
192025 }
192026 fts5yypParser->fts5yyerrcnt = 3;
192027 fts5yyerrorhit = 1;
192028 if( fts5yymajor==fts5YYNOCODE ) break;
192029 fts5yyact = fts5yypParser->fts5yytos->stateno;
192030 #elif defined(fts5YYNOERRORRECOVERY)
192031 /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to
192032 ** do any kind of error recovery. Instead, simply invoke the syntax
192033 ** error routine and continue going as if nothing had happened.
192034 **
@@ -191022,12 +192035,11 @@
192035 ** Applications can set this macro (for example inside %include) if
192036 ** they intend to abandon the parse upon the first syntax error seen.
192037 */
192038 fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor);
192039 fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);
192040 break;
 
192041 #else /* fts5YYERRORSYMBOL is not defined */
192042 /* This is what we do if the grammar does not define ERROR:
192043 **
192044 ** * Report an error message, and throw away the input token.
192045 **
@@ -191045,14 +192057,14 @@
192057 fts5yy_parse_failed(fts5yypParser);
192058 #ifndef fts5YYNOERRORRECOVERY
192059 fts5yypParser->fts5yyerrcnt = -1;
192060 #endif
192061 }
192062 break;
192063 #endif
192064 }
192065 }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
192066 #ifndef NDEBUG
192067 if( fts5yyTraceFILE ){
192068 fts5yyStackEntry *i;
192069 char cDiv = '[';
192070 fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt);
@@ -205660,11 +206672,11 @@
206672 int nArg, /* Number of args */
206673 sqlite3_value **apUnused /* Function arguments */
206674 ){
206675 assert( nArg==0 );
206676 UNUSED_PARAM2(nArg, apUnused);
206677 sqlite3_result_text(pCtx, "fts5: 2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3", -1, SQLITE_TRANSIENT);
206678 }
206679
206680 static int fts5Init(sqlite3 *db){
206681 static const sqlite3_module fts5Mod = {
206682 /* iVersion */ 2,
@@ -209930,12 +210942,12 @@
210942 }
210943 #endif /* SQLITE_CORE */
210944 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
210945
210946 /************** End of stmt.c ************************************************/
210947 #if __LINE__!=210947
210948 #undef SQLITE_SOURCE_ID
210949 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8alt2"
210950 #endif
210951 /* Return the source-id for this library */
210952 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
210953 /************************** End of sqlite3.c ******************************/
210954
+20 -3
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121121
**
122122
** See also: [sqlite3_libversion()],
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126
-#define SQLITE_VERSION "3.23.1"
127
-#define SQLITE_VERSION_NUMBER 3023001
128
-#define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b"
126
+#define SQLITE_VERSION "3.24.0"
127
+#define SQLITE_VERSION_NUMBER 3024000
128
+#define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -1928,10 +1928,26 @@
19281928
** Since many statement journals never become large, setting the spill
19291929
** threshold to a value such as 64KiB can greatly reduce the amount of
19301930
** I/O required to support statement rollback.
19311931
** The default value for this setting is controlled by the
19321932
** [SQLITE_STMTJRNL_SPILL] compile-time option.
1933
+**
1934
+** [[SQLITE_CONFIG_SORTERREF_SIZE]]
1935
+** <dt>SQLITE_CONFIG_SORTERREF_SIZE
1936
+** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
1937
+** of type (int) - the new value of the sorter-reference size threshold.
1938
+** Usually, when SQLite uses an external sort to order records according
1939
+** to an ORDER BY clause, all fields required by the caller are present in the
1940
+** sorted records. However, if SQLite determines based on the declared type
1941
+** of a table column that its values are likely to be very large - larger
1942
+** than the configured sorter-reference size threshold - then a reference
1943
+** is stored in each sorted record and the required column values loaded
1944
+** from the database as records are returned in sorted order. The default
1945
+** value for this option is to never use this optimization. Specifying a
1946
+** negative value for this option restores the default behaviour.
1947
+** This option is only available if SQLite is compiled with the
1948
+** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
19331949
** </dl>
19341950
*/
19351951
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
19361952
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
19371953
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -1957,10 +1973,11 @@
19571973
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
19581974
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
19591975
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
19601976
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
19611977
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
1978
+#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
19621979
19631980
/*
19641981
** CAPI3REF: Database Connection Configuration Options
19651982
**
19661983
** These constants are the available integer configuration options that
19671984
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.23.1"
127 #define SQLITE_VERSION_NUMBER 3023001
128 #define SQLITE_SOURCE_ID "2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -1928,10 +1928,26 @@
1928 ** Since many statement journals never become large, setting the spill
1929 ** threshold to a value such as 64KiB can greatly reduce the amount of
1930 ** I/O required to support statement rollback.
1931 ** The default value for this setting is controlled by the
1932 ** [SQLITE_STMTJRNL_SPILL] compile-time option.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1933 ** </dl>
1934 */
1935 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1936 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1937 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -1957,10 +1973,11 @@
1957 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1958 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1959 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
1960 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
1961 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
 
1962
1963 /*
1964 ** CAPI3REF: Database Connection Configuration Options
1965 **
1966 ** These constants are the available integer configuration options that
1967
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.24.0"
127 #define SQLITE_VERSION_NUMBER 3024000
128 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -1928,10 +1928,26 @@
1928 ** Since many statement journals never become large, setting the spill
1929 ** threshold to a value such as 64KiB can greatly reduce the amount of
1930 ** I/O required to support statement rollback.
1931 ** The default value for this setting is controlled by the
1932 ** [SQLITE_STMTJRNL_SPILL] compile-time option.
1933 **
1934 ** [[SQLITE_CONFIG_SORTERREF_SIZE]]
1935 ** <dt>SQLITE_CONFIG_SORTERREF_SIZE
1936 ** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
1937 ** of type (int) - the new value of the sorter-reference size threshold.
1938 ** Usually, when SQLite uses an external sort to order records according
1939 ** to an ORDER BY clause, all fields required by the caller are present in the
1940 ** sorted records. However, if SQLite determines based on the declared type
1941 ** of a table column that its values are likely to be very large - larger
1942 ** than the configured sorter-reference size threshold - then a reference
1943 ** is stored in each sorted record and the required column values loaded
1944 ** from the database as records are returned in sorted order. The default
1945 ** value for this option is to never use this optimization. Specifying a
1946 ** negative value for this option restores the default behaviour.
1947 ** This option is only available if SQLite is compiled with the
1948 ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
1949 ** </dl>
1950 */
1951 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1952 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1953 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
@@ -1957,10 +1973,11 @@
1973 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1974 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1975 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
1976 #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
1977 #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
1978 #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
1979
1980 /*
1981 ** CAPI3REF: Database Connection Configuration Options
1982 **
1983 ** These constants are the available integer configuration options that
1984
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -89,11 +89,11 @@
8989
9090
# define the SQLite shell files, which need special flags on compile
9191
SQLITESHELLSRC=shell.c
9292
ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
9393
SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94
-SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
94
+SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
9595
9696
# define the th scripting files, which need special flags on compile
9797
THSRC=th.c th_lang.c
9898
ORIGTHSRC=$(foreach sf,$(THSRC),$(SRCDIR)$(sf))
9999
THOBJ=$(foreach sf,$(THSRC),$(sf:.c=.obj))
100100
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -89,11 +89,11 @@
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94 SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
95
96 # define the th scripting files, which need special flags on compile
97 THSRC=th.c th_lang.c
98 ORIGTHSRC=$(foreach sf,$(THSRC),$(SRCDIR)$(sf))
99 THOBJ=$(foreach sf,$(THSRC),$(sf:.c=.obj))
100
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -89,11 +89,11 @@
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94 SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
95
96 # define the th scripting files, which need special flags on compile
97 THSRC=th.c th_lang.c
98 ORIGTHSRC=$(foreach sf,$(THSRC),$(SRCDIR)$(sf))
99 THOBJ=$(foreach sf,$(THSRC),$(sf:.c=.obj))
100
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,11 +26,11 @@
2626
TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
2727
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
2828
2929
SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
3030
31
-SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
31
+SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3232
3333
SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
3434
3535
OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
3636
3737
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,11 +26,11 @@
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
30
31 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -26,11 +26,11 @@
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB
30
31 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35 OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
36
37
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2334,11 +2334,12 @@
23342334
-DSQLITE_ENABLE_DBPAGE_VTAB \
23352335
-Dmain=sqlite3_shell \
23362336
-DSQLITE_SHELL_IS_UTF8=1 \
23372337
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
23382338
-DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2339
- -DSQLITE_SHELL_DBNAME_PROC=fossil_open \
2339
+ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2340
+ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
23402341
-Daccess=file_access \
23412342
-Dsystem=fossil_system \
23422343
-Dgetenv=fossil_getenv \
23432344
-Dfopen=fossil_fopen
23442345
23452346
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2334,11 +2334,12 @@
2334 -DSQLITE_ENABLE_DBPAGE_VTAB \
2335 -Dmain=sqlite3_shell \
2336 -DSQLITE_SHELL_IS_UTF8=1 \
2337 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2338 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2339 -DSQLITE_SHELL_DBNAME_PROC=fossil_open \
 
2340 -Daccess=file_access \
2341 -Dsystem=fossil_system \
2342 -Dgetenv=fossil_getenv \
2343 -Dfopen=fossil_fopen
2344
2345
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2334,11 +2334,12 @@
2334 -DSQLITE_ENABLE_DBPAGE_VTAB \
2335 -Dmain=sqlite3_shell \
2336 -DSQLITE_SHELL_IS_UTF8=1 \
2337 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2338 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2339 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2340 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
2341 -Daccess=file_access \
2342 -Dsystem=fossil_system \
2343 -Dgetenv=fossil_getenv \
2344 -Dfopen=fossil_fopen
2345
2346
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -367,11 +367,12 @@
367367
/DSQLITE_ENABLE_DBPAGE_VTAB \
368368
/Dmain=sqlite3_shell \
369369
/DSQLITE_SHELL_IS_UTF8=1 \
370370
/DSQLITE_OMIT_LOAD_EXTENSION=1 \
371371
/DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
372
- /DSQLITE_SHELL_DBNAME_PROC=fossil_open \
372
+ /DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
373
+ /DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
373374
/Daccess=file_access \
374375
/Dsystem=fossil_system \
375376
/Dgetenv=fossil_getenv \
376377
/Dfopen=fossil_fopen
377378
378379
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -367,11 +367,12 @@
367 /DSQLITE_ENABLE_DBPAGE_VTAB \
368 /Dmain=sqlite3_shell \
369 /DSQLITE_SHELL_IS_UTF8=1 \
370 /DSQLITE_OMIT_LOAD_EXTENSION=1 \
371 /DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
372 /DSQLITE_SHELL_DBNAME_PROC=fossil_open \
 
373 /Daccess=file_access \
374 /Dsystem=fossil_system \
375 /Dgetenv=fossil_getenv \
376 /Dfopen=fossil_fopen
377
378
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -367,11 +367,12 @@
367 /DSQLITE_ENABLE_DBPAGE_VTAB \
368 /Dmain=sqlite3_shell \
369 /DSQLITE_SHELL_IS_UTF8=1 \
370 /DSQLITE_OMIT_LOAD_EXTENSION=1 \
371 /DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
372 /DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
373 /DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
374 /Daccess=file_access \
375 /Dsystem=fossil_system \
376 /Dgetenv=fossil_getenv \
377 /Dfopen=fossil_fopen
378
379

Keyboard Shortcuts

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