Fossil SCM

Update the built-in SQLite and SQL command-line shell to the latest code from the SQLite trunk.

drh 2012-02-07 16:20 trunk
Commit 030035345c802bb57ba855e8a7ae395b3eeb57bf
3 files changed +100 -38 +1753 -1635 +19 -11
+100 -38
--- src/shell.c
+++ src/shell.c
@@ -55,11 +55,11 @@
5555
#if defined(HAVE_READLINE) && HAVE_READLINE==1
5656
# include <readline/readline.h>
5757
# include <readline/history.h>
5858
#endif
5959
#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
60
-# define readline(p) local_getline(p,stdin)
60
+# define readline(p) local_getline(p,stdin,0)
6161
# define add_history(X)
6262
# define read_history(X)
6363
# define write_history(X)
6464
# define stifle_history(X)
6565
#endif
@@ -332,14 +332,15 @@
332332
** fails.
333333
**
334334
** The interface is like "readline" but no command-line editing
335335
** is done.
336336
*/
337
-static char *local_getline(char *zPrompt, FILE *in){
337
+static char *local_getline(char *zPrompt, FILE *in, int csvFlag){
338338
char *zLine;
339339
int nLine;
340340
int n;
341
+ int inQuote = 0;
341342
342343
if( zPrompt && *zPrompt ){
343344
printf("%s",zPrompt);
344345
fflush(stdout);
345346
}
@@ -359,12 +360,15 @@
359360
return 0;
360361
}
361362
zLine[n] = 0;
362363
break;
363364
}
364
- while( zLine[n] ){ n++; }
365
- if( n>0 && zLine[n-1]=='\n' ){
365
+ while( zLine[n] ){
366
+ if( zLine[n]=='"' ) inQuote = !inQuote;
367
+ n++;
368
+ }
369
+ if( n>0 && zLine[n-1]=='\n' && (!inQuote || !csvFlag) ){
366370
n--;
367371
if( n>0 && zLine[n-1]=='\r' ) n--;
368372
zLine[n] = 0;
369373
break;
370374
}
@@ -381,11 +385,11 @@
381385
*/
382386
static char *one_input_line(const char *zPrior, FILE *in){
383387
char *zPrompt;
384388
char *zResult;
385389
if( in!=0 ){
386
- return local_getline(0, in);
390
+ return local_getline(0, in, 0);
387391
}
388392
if( zPrior && zPrior[0] ){
389393
zPrompt = continuePrompt;
390394
}else{
391395
zPrompt = mainPrompt;
@@ -612,12 +616,11 @@
612616
};
613617
614618
/*
615619
** Output a single term of CSV. Actually, p->separator is used for
616620
** the separator, which may or may not be a comma. p->nullvalue is
617
-** the null value. Strings are quoted using ANSI-C rules. Numbers
618
-** appear outside of quotes.
621
+** the null value. Strings are quoted if necessary.
619622
*/
620623
static void output_csv(struct callback_data *p, const char *z, int bSep){
621624
FILE *out = p->out;
622625
if( z==0 ){
623626
fprintf(out,"%s",p->nullvalue);
@@ -932,36 +935,54 @@
932935
return zIn;
933936
}
934937
935938
936939
/*
937
-** Execute a query statement that has a single result column. Print
938
-** that result column on a line by itself with a semicolon terminator.
940
+** Execute a query statement that will generate SQL output. Print
941
+** the result columns, comma-separated, on a line and then add a
942
+** semicolon terminator to the end of that line.
939943
**
940
-** This is used, for example, to show the schema of the database by
941
-** querying the SQLITE_MASTER table.
944
+** If the number of columns is 1 and that column contains text "--"
945
+** then write the semicolon on a separate line. That way, if a
946
+** "--" comment occurs at the end of the statement, the comment
947
+** won't consume the semicolon terminator.
942948
*/
943949
static int run_table_dump_query(
944950
struct callback_data *p, /* Query context */
945951
const char *zSelect, /* SELECT statement to extract content */
946952
const char *zFirstRow /* Print before first row, if not NULL */
947953
){
948954
sqlite3_stmt *pSelect;
949955
int rc;
956
+ int nResult;
957
+ int i;
958
+ const char *z;
950959
rc = sqlite3_prepare(p->db, zSelect, -1, &pSelect, 0);
951960
if( rc!=SQLITE_OK || !pSelect ){
952961
fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
953962
p->nErr++;
954963
return rc;
955964
}
956965
rc = sqlite3_step(pSelect);
966
+ nResult = sqlite3_column_count(pSelect);
957967
while( rc==SQLITE_ROW ){
958968
if( zFirstRow ){
959969
fprintf(p->out, "%s", zFirstRow);
960970
zFirstRow = 0;
961971
}
962
- fprintf(p->out, "%s;\n", sqlite3_column_text(pSelect, 0));
972
+ z = (const char*)sqlite3_column_text(pSelect, 0);
973
+ fprintf(p->out, "%s", z);
974
+ for(i=1; i<nResult; i++){
975
+ fprintf(p->out, ",%s", sqlite3_column_text(pSelect, i));
976
+ }
977
+ if( z==0 ) z = "";
978
+ while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
979
+ if( z[0] ){
980
+ fprintf(p->out, "\n;\n");
981
+ }else{
982
+ fprintf(p->out, ";\n");
983
+ }
963984
rc = sqlite3_step(pSelect);
964985
}
965986
rc = sqlite3_finalize(pSelect);
966987
if( rc!=SQLITE_OK ){
967988
fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
@@ -1264,10 +1285,11 @@
12641285
sqlite3_stmt *pTableInfo = 0;
12651286
char *zSelect = 0;
12661287
char *zTableInfo = 0;
12671288
char *zTmp = 0;
12681289
int nRow = 0;
1290
+ int kk;
12691291
12701292
zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
12711293
zTableInfo = appendText(zTableInfo, zTable, '"');
12721294
zTableInfo = appendText(zTableInfo, ");", 0);
12731295
@@ -1276,11 +1298,16 @@
12761298
if( rc!=SQLITE_OK || !pTableInfo ){
12771299
return 1;
12781300
}
12791301
12801302
zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
1281
- zTmp = appendText(zTmp, zTable, '"');
1303
+ if( !isalpha(zTable[0]) ){
1304
+ kk = 0;
1305
+ }else{
1306
+ for(kk=1; isalnum(zTable[kk]); kk++){}
1307
+ }
1308
+ zTmp = appendText(zTmp, zTable, zTable[kk] ? '"' : 0);
12821309
if( zTmp ){
12831310
zSelect = appendText(zSelect, zTmp, '\'');
12841311
}
12851312
zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
12861313
rc = sqlite3_step(pTableInfo);
@@ -1288,11 +1315,11 @@
12881315
const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
12891316
zSelect = appendText(zSelect, "quote(", 0);
12901317
zSelect = appendText(zSelect, zText, '"');
12911318
rc = sqlite3_step(pTableInfo);
12921319
if( rc==SQLITE_ROW ){
1293
- zSelect = appendText(zSelect, ") || ',' || ", 0);
1320
+ zSelect = appendText(zSelect, "), ", 0);
12941321
}else{
12951322
zSelect = appendText(zSelect, ") ", 0);
12961323
}
12971324
nRow++;
12981325
}
@@ -1767,16 +1794,19 @@
17671794
sqlite3_finalize(pStmt);
17681795
return 1;
17691796
}
17701797
sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
17711798
zCommit = "COMMIT";
1772
- while( (zLine = local_getline(0, in))!=0 ){
1773
- char *z;
1799
+ while( (zLine = local_getline(0, in, 1))!=0 ){
1800
+ char *z, c;
1801
+ int inQuote = 0;
17741802
lineno++;
17751803
azCol[0] = zLine;
1776
- for(i=0, z=zLine; *z && *z!='\n' && *z!='\r'; z++){
1777
- if( *z==p->separator[0] && strncmp(z, p->separator, nSep)==0 ){
1804
+ for(i=0, z=zLine; (c = *z)!=0; z++){
1805
+ if( c=='"' ) inQuote = !inQuote;
1806
+ if( c=='\n' ) lineno++;
1807
+ if( !inQuote && c==p->separator[0] && strncmp(z,p->separator,nSep)==0 ){
17781808
*z = 0;
17791809
i++;
17801810
if( i<nCol ){
17811811
azCol[i] = &z[nSep];
17821812
z += nSep-1;
@@ -1792,10 +1822,18 @@
17921822
free(zLine);
17931823
rc = 1;
17941824
break; /* from while */
17951825
}
17961826
for(i=0; i<nCol; i++){
1827
+ if( azCol[i][0]=='"' ){
1828
+ int k;
1829
+ for(z=azCol[i], j=1, k=0; z[j]; j++){
1830
+ if( z[j]=='"' ){ j++; if( z[j]==0 ) break; }
1831
+ z[k++] = z[j];
1832
+ }
1833
+ z[k] = 0;
1834
+ }
17971835
sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
17981836
}
17991837
sqlite3_step(pStmt);
18001838
rc = sqlite3_reset(pStmt);
18011839
free(zLine);
@@ -2664,33 +2702,34 @@
26642702
26652703
/*
26662704
** Show available command line options
26672705
*/
26682706
static const char zOptions[] =
2669
- " -help show this message\n"
2670
- " -init filename read/process named file\n"
2671
- " -echo print commands before execution\n"
2672
- " -[no]header turn headers on or off\n"
26732707
" -bail stop after hitting an error\n"
2674
- " -interactive force interactive I/O\n"
26752708
" -batch force batch I/O\n"
26762709
" -column set output mode to 'column'\n"
2710
+ " -cmd command run \"command\" before reading stdin\n"
26772711
" -csv set output mode to 'csv'\n"
2712
+ " -echo print commands before execution\n"
2713
+ " -init filename read/process named file\n"
2714
+ " -[no]header turn headers on or off\n"
2715
+ " -help show this message\n"
26782716
" -html set output mode to HTML\n"
2717
+ " -interactive force interactive I/O\n"
26792718
" -line set output mode to 'line'\n"
26802719
" -list set output mode to 'list'\n"
2720
+#ifdef SQLITE_ENABLE_MULTIPLEX
2721
+ " -multiplex enable the multiplexor VFS\n"
2722
+#endif
2723
+ " -nullvalue 'text' set text string for NULL values\n"
26812724
" -separator 'x' set output field separator (|)\n"
26822725
" -stats print memory stats before each finalize\n"
2683
- " -nullvalue 'text' set text string for NULL values\n"
26842726
" -version show SQLite version\n"
26852727
" -vfs NAME use NAME as the default VFS\n"
26862728
#ifdef SQLITE_ENABLE_VFSTRACE
26872729
" -vfstrace enable tracing of all VFS calls\n"
26882730
#endif
2689
-#ifdef SQLITE_ENABLE_MULTIPLEX
2690
- " -multiplex enable the multiplexor VFS\n"
2691
-#endif
26922731
;
26932732
static void usage(int showDetail){
26942733
fprintf(stderr,
26952734
"Usage: %s [OPTIONS] FILENAME [SQL]\n"
26962735
"FILENAME is the name of an SQLite database. A new database is created\n"
@@ -2749,23 +2788,26 @@
27492788
*/
27502789
for(i=1; i<argc-1; i++){
27512790
char *z;
27522791
if( argv[i][0]!='-' ) break;
27532792
z = argv[i];
2754
- if( z[0]=='-' && z[1]=='-' ) z++;
2755
- if( strcmp(argv[i],"-separator")==0 || strcmp(argv[i],"-nullvalue")==0 ){
2793
+ if( z[1]=='-' ) z++;
2794
+ if( strcmp(z,"-separator")==0
2795
+ || strcmp(z,"-nullvalue")==0
2796
+ || strcmp(z,"-cmd")==0
2797
+ ){
27562798
i++;
2757
- }else if( strcmp(argv[i],"-init")==0 ){
2799
+ }else if( strcmp(z,"-init")==0 ){
27582800
i++;
27592801
zInitFile = argv[i];
27602802
/* Need to check for batch mode here to so we can avoid printing
27612803
** informational messages (like from process_sqliterc) before
27622804
** we do the actual processing of arguments later in a second pass.
27632805
*/
2764
- }else if( strcmp(argv[i],"-batch")==0 ){
2806
+ }else if( strcmp(z,"-batch")==0 ){
27652807
stdin_is_interactive = 0;
2766
- }else if( strcmp(argv[i],"-heap")==0 ){
2808
+ }else if( strcmp(z,"-heap")==0 ){
27672809
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
27682810
int j, c;
27692811
const char *zSize;
27702812
sqlite3_int64 szHeap;
27712813
@@ -2778,11 +2820,11 @@
27782820
}
27792821
if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
27802822
sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
27812823
#endif
27822824
#ifdef SQLITE_ENABLE_VFSTRACE
2783
- }else if( strcmp(argv[i],"-vfstrace")==0 ){
2825
+ }else if( strcmp(z,"-vfstrace")==0 ){
27842826
extern int vfstrace_register(
27852827
const char *zTraceName,
27862828
const char *zOldVfsName,
27872829
int (*xOut)(const char*,void*),
27882830
void *pOutArg,
@@ -2789,15 +2831,15 @@
27892831
int makeDefault
27902832
);
27912833
vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
27922834
#endif
27932835
#ifdef SQLITE_ENABLE_MULTIPLEX
2794
- }else if( strcmp(argv[i],"-multiplex")==0 ){
2836
+ }else if( strcmp(z,"-multiplex")==0 ){
27952837
extern int sqlite3_multiple_initialize(const char*,int);
27962838
sqlite3_multiplex_initialize(0, 1);
27972839
#endif
2798
- }else if( strcmp(argv[i],"-vfs")==0 ){
2840
+ }else if( strcmp(z,"-vfs")==0 ){
27992841
sqlite3_vfs *pVfs = sqlite3_vfs_find(argv[++i]);
28002842
if( pVfs ){
28012843
sqlite3_vfs_register(pVfs, 1);
28022844
}else{
28032845
fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
@@ -2881,20 +2923,22 @@
28812923
data.mode = MODE_Csv;
28822924
memcpy(data.separator,",",2);
28832925
}else if( strcmp(z,"-separator")==0 ){
28842926
i++;
28852927
if(i>=argc){
2886
- fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
2928
+ fprintf(stderr,"%s: Error: missing argument for option: %s\n",
2929
+ Argv0, z);
28872930
fprintf(stderr,"Use -help for a list of options.\n");
28882931
return 1;
28892932
}
28902933
sqlite3_snprintf(sizeof(data.separator), data.separator,
28912934
"%.*s",(int)sizeof(data.separator)-1,argv[i]);
28922935
}else if( strcmp(z,"-nullvalue")==0 ){
28932936
i++;
28942937
if(i>=argc){
2895
- fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
2938
+ fprintf(stderr,"%s: Error: missing argument for option: %s\n",
2939
+ Argv0, z);
28962940
fprintf(stderr,"Use -help for a list of options.\n");
28972941
return 1;
28982942
}
28992943
sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
29002944
"%.*s",(int)sizeof(data.nullvalue)-1,argv[i]);
@@ -2925,12 +2969,30 @@
29252969
#endif
29262970
#ifdef SQLITE_ENABLE_MULTIPLEX
29272971
}else if( strcmp(z,"-multiplex")==0 ){
29282972
i++;
29292973
#endif
2930
- }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
2974
+ }else if( strcmp(z,"-help")==0 ){
29312975
usage(1);
2976
+ }else if( strcmp(z,"-cmd")==0 ){
2977
+ if( i==argc-1 ) break;
2978
+ i++;
2979
+ z = argv[i];
2980
+ if( z[0]=='.' ){
2981
+ rc = do_meta_command(z, &data);
2982
+ if( rc && bail_on_error ) return rc;
2983
+ }else{
2984
+ open_db(&data);
2985
+ rc = shell_exec(data.db, z, shell_callback, &data, &zErrMsg);
2986
+ if( zErrMsg!=0 ){
2987
+ fprintf(stderr,"Error: %s\n", zErrMsg);
2988
+ if( bail_on_error ) return rc!=0 ? rc : 1;
2989
+ }else if( rc!=0 ){
2990
+ fprintf(stderr,"Error: unable to process SQL \"%s\"\n", z);
2991
+ if( bail_on_error ) return rc;
2992
+ }
2993
+ }
29322994
}else{
29332995
fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
29342996
fprintf(stderr,"Use -help for a list of options.\n");
29352997
return 1;
29362998
}
29372999
--- src/shell.c
+++ src/shell.c
@@ -55,11 +55,11 @@
55 #if defined(HAVE_READLINE) && HAVE_READLINE==1
56 # include <readline/readline.h>
57 # include <readline/history.h>
58 #endif
59 #if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
60 # define readline(p) local_getline(p,stdin)
61 # define add_history(X)
62 # define read_history(X)
63 # define write_history(X)
64 # define stifle_history(X)
65 #endif
@@ -332,14 +332,15 @@
332 ** fails.
333 **
334 ** The interface is like "readline" but no command-line editing
335 ** is done.
336 */
337 static char *local_getline(char *zPrompt, FILE *in){
338 char *zLine;
339 int nLine;
340 int n;
 
341
342 if( zPrompt && *zPrompt ){
343 printf("%s",zPrompt);
344 fflush(stdout);
345 }
@@ -359,12 +360,15 @@
359 return 0;
360 }
361 zLine[n] = 0;
362 break;
363 }
364 while( zLine[n] ){ n++; }
365 if( n>0 && zLine[n-1]=='\n' ){
 
 
 
366 n--;
367 if( n>0 && zLine[n-1]=='\r' ) n--;
368 zLine[n] = 0;
369 break;
370 }
@@ -381,11 +385,11 @@
381 */
382 static char *one_input_line(const char *zPrior, FILE *in){
383 char *zPrompt;
384 char *zResult;
385 if( in!=0 ){
386 return local_getline(0, in);
387 }
388 if( zPrior && zPrior[0] ){
389 zPrompt = continuePrompt;
390 }else{
391 zPrompt = mainPrompt;
@@ -612,12 +616,11 @@
612 };
613
614 /*
615 ** Output a single term of CSV. Actually, p->separator is used for
616 ** the separator, which may or may not be a comma. p->nullvalue is
617 ** the null value. Strings are quoted using ANSI-C rules. Numbers
618 ** appear outside of quotes.
619 */
620 static void output_csv(struct callback_data *p, const char *z, int bSep){
621 FILE *out = p->out;
622 if( z==0 ){
623 fprintf(out,"%s",p->nullvalue);
@@ -932,36 +935,54 @@
932 return zIn;
933 }
934
935
936 /*
937 ** Execute a query statement that has a single result column. Print
938 ** that result column on a line by itself with a semicolon terminator.
 
939 **
940 ** This is used, for example, to show the schema of the database by
941 ** querying the SQLITE_MASTER table.
 
 
942 */
943 static int run_table_dump_query(
944 struct callback_data *p, /* Query context */
945 const char *zSelect, /* SELECT statement to extract content */
946 const char *zFirstRow /* Print before first row, if not NULL */
947 ){
948 sqlite3_stmt *pSelect;
949 int rc;
 
 
 
950 rc = sqlite3_prepare(p->db, zSelect, -1, &pSelect, 0);
951 if( rc!=SQLITE_OK || !pSelect ){
952 fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
953 p->nErr++;
954 return rc;
955 }
956 rc = sqlite3_step(pSelect);
 
957 while( rc==SQLITE_ROW ){
958 if( zFirstRow ){
959 fprintf(p->out, "%s", zFirstRow);
960 zFirstRow = 0;
961 }
962 fprintf(p->out, "%s;\n", sqlite3_column_text(pSelect, 0));
 
 
 
 
 
 
 
 
 
 
 
963 rc = sqlite3_step(pSelect);
964 }
965 rc = sqlite3_finalize(pSelect);
966 if( rc!=SQLITE_OK ){
967 fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
@@ -1264,10 +1285,11 @@
1264 sqlite3_stmt *pTableInfo = 0;
1265 char *zSelect = 0;
1266 char *zTableInfo = 0;
1267 char *zTmp = 0;
1268 int nRow = 0;
 
1269
1270 zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
1271 zTableInfo = appendText(zTableInfo, zTable, '"');
1272 zTableInfo = appendText(zTableInfo, ");", 0);
1273
@@ -1276,11 +1298,16 @@
1276 if( rc!=SQLITE_OK || !pTableInfo ){
1277 return 1;
1278 }
1279
1280 zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
1281 zTmp = appendText(zTmp, zTable, '"');
 
 
 
 
 
1282 if( zTmp ){
1283 zSelect = appendText(zSelect, zTmp, '\'');
1284 }
1285 zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
1286 rc = sqlite3_step(pTableInfo);
@@ -1288,11 +1315,11 @@
1288 const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
1289 zSelect = appendText(zSelect, "quote(", 0);
1290 zSelect = appendText(zSelect, zText, '"');
1291 rc = sqlite3_step(pTableInfo);
1292 if( rc==SQLITE_ROW ){
1293 zSelect = appendText(zSelect, ") || ',' || ", 0);
1294 }else{
1295 zSelect = appendText(zSelect, ") ", 0);
1296 }
1297 nRow++;
1298 }
@@ -1767,16 +1794,19 @@
1767 sqlite3_finalize(pStmt);
1768 return 1;
1769 }
1770 sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
1771 zCommit = "COMMIT";
1772 while( (zLine = local_getline(0, in))!=0 ){
1773 char *z;
 
1774 lineno++;
1775 azCol[0] = zLine;
1776 for(i=0, z=zLine; *z && *z!='\n' && *z!='\r'; z++){
1777 if( *z==p->separator[0] && strncmp(z, p->separator, nSep)==0 ){
 
 
1778 *z = 0;
1779 i++;
1780 if( i<nCol ){
1781 azCol[i] = &z[nSep];
1782 z += nSep-1;
@@ -1792,10 +1822,18 @@
1792 free(zLine);
1793 rc = 1;
1794 break; /* from while */
1795 }
1796 for(i=0; i<nCol; i++){
 
 
 
 
 
 
 
 
1797 sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
1798 }
1799 sqlite3_step(pStmt);
1800 rc = sqlite3_reset(pStmt);
1801 free(zLine);
@@ -2664,33 +2702,34 @@
2664
2665 /*
2666 ** Show available command line options
2667 */
2668 static const char zOptions[] =
2669 " -help show this message\n"
2670 " -init filename read/process named file\n"
2671 " -echo print commands before execution\n"
2672 " -[no]header turn headers on or off\n"
2673 " -bail stop after hitting an error\n"
2674 " -interactive force interactive I/O\n"
2675 " -batch force batch I/O\n"
2676 " -column set output mode to 'column'\n"
 
2677 " -csv set output mode to 'csv'\n"
 
 
 
 
2678 " -html set output mode to HTML\n"
 
2679 " -line set output mode to 'line'\n"
2680 " -list set output mode to 'list'\n"
 
 
 
 
2681 " -separator 'x' set output field separator (|)\n"
2682 " -stats print memory stats before each finalize\n"
2683 " -nullvalue 'text' set text string for NULL values\n"
2684 " -version show SQLite version\n"
2685 " -vfs NAME use NAME as the default VFS\n"
2686 #ifdef SQLITE_ENABLE_VFSTRACE
2687 " -vfstrace enable tracing of all VFS calls\n"
2688 #endif
2689 #ifdef SQLITE_ENABLE_MULTIPLEX
2690 " -multiplex enable the multiplexor VFS\n"
2691 #endif
2692 ;
2693 static void usage(int showDetail){
2694 fprintf(stderr,
2695 "Usage: %s [OPTIONS] FILENAME [SQL]\n"
2696 "FILENAME is the name of an SQLite database. A new database is created\n"
@@ -2749,23 +2788,26 @@
2749 */
2750 for(i=1; i<argc-1; i++){
2751 char *z;
2752 if( argv[i][0]!='-' ) break;
2753 z = argv[i];
2754 if( z[0]=='-' && z[1]=='-' ) z++;
2755 if( strcmp(argv[i],"-separator")==0 || strcmp(argv[i],"-nullvalue")==0 ){
 
 
 
2756 i++;
2757 }else if( strcmp(argv[i],"-init")==0 ){
2758 i++;
2759 zInitFile = argv[i];
2760 /* Need to check for batch mode here to so we can avoid printing
2761 ** informational messages (like from process_sqliterc) before
2762 ** we do the actual processing of arguments later in a second pass.
2763 */
2764 }else if( strcmp(argv[i],"-batch")==0 ){
2765 stdin_is_interactive = 0;
2766 }else if( strcmp(argv[i],"-heap")==0 ){
2767 #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
2768 int j, c;
2769 const char *zSize;
2770 sqlite3_int64 szHeap;
2771
@@ -2778,11 +2820,11 @@
2778 }
2779 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
2780 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
2781 #endif
2782 #ifdef SQLITE_ENABLE_VFSTRACE
2783 }else if( strcmp(argv[i],"-vfstrace")==0 ){
2784 extern int vfstrace_register(
2785 const char *zTraceName,
2786 const char *zOldVfsName,
2787 int (*xOut)(const char*,void*),
2788 void *pOutArg,
@@ -2789,15 +2831,15 @@
2789 int makeDefault
2790 );
2791 vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
2792 #endif
2793 #ifdef SQLITE_ENABLE_MULTIPLEX
2794 }else if( strcmp(argv[i],"-multiplex")==0 ){
2795 extern int sqlite3_multiple_initialize(const char*,int);
2796 sqlite3_multiplex_initialize(0, 1);
2797 #endif
2798 }else if( strcmp(argv[i],"-vfs")==0 ){
2799 sqlite3_vfs *pVfs = sqlite3_vfs_find(argv[++i]);
2800 if( pVfs ){
2801 sqlite3_vfs_register(pVfs, 1);
2802 }else{
2803 fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
@@ -2881,20 +2923,22 @@
2881 data.mode = MODE_Csv;
2882 memcpy(data.separator,",",2);
2883 }else if( strcmp(z,"-separator")==0 ){
2884 i++;
2885 if(i>=argc){
2886 fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
 
2887 fprintf(stderr,"Use -help for a list of options.\n");
2888 return 1;
2889 }
2890 sqlite3_snprintf(sizeof(data.separator), data.separator,
2891 "%.*s",(int)sizeof(data.separator)-1,argv[i]);
2892 }else if( strcmp(z,"-nullvalue")==0 ){
2893 i++;
2894 if(i>=argc){
2895 fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
 
2896 fprintf(stderr,"Use -help for a list of options.\n");
2897 return 1;
2898 }
2899 sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
2900 "%.*s",(int)sizeof(data.nullvalue)-1,argv[i]);
@@ -2925,12 +2969,30 @@
2925 #endif
2926 #ifdef SQLITE_ENABLE_MULTIPLEX
2927 }else if( strcmp(z,"-multiplex")==0 ){
2928 i++;
2929 #endif
2930 }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
2931 usage(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2932 }else{
2933 fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
2934 fprintf(stderr,"Use -help for a list of options.\n");
2935 return 1;
2936 }
2937
--- src/shell.c
+++ src/shell.c
@@ -55,11 +55,11 @@
55 #if defined(HAVE_READLINE) && HAVE_READLINE==1
56 # include <readline/readline.h>
57 # include <readline/history.h>
58 #endif
59 #if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
60 # define readline(p) local_getline(p,stdin,0)
61 # define add_history(X)
62 # define read_history(X)
63 # define write_history(X)
64 # define stifle_history(X)
65 #endif
@@ -332,14 +332,15 @@
332 ** fails.
333 **
334 ** The interface is like "readline" but no command-line editing
335 ** is done.
336 */
337 static char *local_getline(char *zPrompt, FILE *in, int csvFlag){
338 char *zLine;
339 int nLine;
340 int n;
341 int inQuote = 0;
342
343 if( zPrompt && *zPrompt ){
344 printf("%s",zPrompt);
345 fflush(stdout);
346 }
@@ -359,12 +360,15 @@
360 return 0;
361 }
362 zLine[n] = 0;
363 break;
364 }
365 while( zLine[n] ){
366 if( zLine[n]=='"' ) inQuote = !inQuote;
367 n++;
368 }
369 if( n>0 && zLine[n-1]=='\n' && (!inQuote || !csvFlag) ){
370 n--;
371 if( n>0 && zLine[n-1]=='\r' ) n--;
372 zLine[n] = 0;
373 break;
374 }
@@ -381,11 +385,11 @@
385 */
386 static char *one_input_line(const char *zPrior, FILE *in){
387 char *zPrompt;
388 char *zResult;
389 if( in!=0 ){
390 return local_getline(0, in, 0);
391 }
392 if( zPrior && zPrior[0] ){
393 zPrompt = continuePrompt;
394 }else{
395 zPrompt = mainPrompt;
@@ -612,12 +616,11 @@
616 };
617
618 /*
619 ** Output a single term of CSV. Actually, p->separator is used for
620 ** the separator, which may or may not be a comma. p->nullvalue is
621 ** the null value. Strings are quoted if necessary.
 
622 */
623 static void output_csv(struct callback_data *p, const char *z, int bSep){
624 FILE *out = p->out;
625 if( z==0 ){
626 fprintf(out,"%s",p->nullvalue);
@@ -932,36 +935,54 @@
935 return zIn;
936 }
937
938
939 /*
940 ** Execute a query statement that will generate SQL output. Print
941 ** the result columns, comma-separated, on a line and then add a
942 ** semicolon terminator to the end of that line.
943 **
944 ** If the number of columns is 1 and that column contains text "--"
945 ** then write the semicolon on a separate line. That way, if a
946 ** "--" comment occurs at the end of the statement, the comment
947 ** won't consume the semicolon terminator.
948 */
949 static int run_table_dump_query(
950 struct callback_data *p, /* Query context */
951 const char *zSelect, /* SELECT statement to extract content */
952 const char *zFirstRow /* Print before first row, if not NULL */
953 ){
954 sqlite3_stmt *pSelect;
955 int rc;
956 int nResult;
957 int i;
958 const char *z;
959 rc = sqlite3_prepare(p->db, zSelect, -1, &pSelect, 0);
960 if( rc!=SQLITE_OK || !pSelect ){
961 fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
962 p->nErr++;
963 return rc;
964 }
965 rc = sqlite3_step(pSelect);
966 nResult = sqlite3_column_count(pSelect);
967 while( rc==SQLITE_ROW ){
968 if( zFirstRow ){
969 fprintf(p->out, "%s", zFirstRow);
970 zFirstRow = 0;
971 }
972 z = (const char*)sqlite3_column_text(pSelect, 0);
973 fprintf(p->out, "%s", z);
974 for(i=1; i<nResult; i++){
975 fprintf(p->out, ",%s", sqlite3_column_text(pSelect, i));
976 }
977 if( z==0 ) z = "";
978 while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
979 if( z[0] ){
980 fprintf(p->out, "\n;\n");
981 }else{
982 fprintf(p->out, ";\n");
983 }
984 rc = sqlite3_step(pSelect);
985 }
986 rc = sqlite3_finalize(pSelect);
987 if( rc!=SQLITE_OK ){
988 fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
@@ -1264,10 +1285,11 @@
1285 sqlite3_stmt *pTableInfo = 0;
1286 char *zSelect = 0;
1287 char *zTableInfo = 0;
1288 char *zTmp = 0;
1289 int nRow = 0;
1290 int kk;
1291
1292 zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
1293 zTableInfo = appendText(zTableInfo, zTable, '"');
1294 zTableInfo = appendText(zTableInfo, ");", 0);
1295
@@ -1276,11 +1298,16 @@
1298 if( rc!=SQLITE_OK || !pTableInfo ){
1299 return 1;
1300 }
1301
1302 zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
1303 if( !isalpha(zTable[0]) ){
1304 kk = 0;
1305 }else{
1306 for(kk=1; isalnum(zTable[kk]); kk++){}
1307 }
1308 zTmp = appendText(zTmp, zTable, zTable[kk] ? '"' : 0);
1309 if( zTmp ){
1310 zSelect = appendText(zSelect, zTmp, '\'');
1311 }
1312 zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
1313 rc = sqlite3_step(pTableInfo);
@@ -1288,11 +1315,11 @@
1315 const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
1316 zSelect = appendText(zSelect, "quote(", 0);
1317 zSelect = appendText(zSelect, zText, '"');
1318 rc = sqlite3_step(pTableInfo);
1319 if( rc==SQLITE_ROW ){
1320 zSelect = appendText(zSelect, "), ", 0);
1321 }else{
1322 zSelect = appendText(zSelect, ") ", 0);
1323 }
1324 nRow++;
1325 }
@@ -1767,16 +1794,19 @@
1794 sqlite3_finalize(pStmt);
1795 return 1;
1796 }
1797 sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
1798 zCommit = "COMMIT";
1799 while( (zLine = local_getline(0, in, 1))!=0 ){
1800 char *z, c;
1801 int inQuote = 0;
1802 lineno++;
1803 azCol[0] = zLine;
1804 for(i=0, z=zLine; (c = *z)!=0; z++){
1805 if( c=='"' ) inQuote = !inQuote;
1806 if( c=='\n' ) lineno++;
1807 if( !inQuote && c==p->separator[0] && strncmp(z,p->separator,nSep)==0 ){
1808 *z = 0;
1809 i++;
1810 if( i<nCol ){
1811 azCol[i] = &z[nSep];
1812 z += nSep-1;
@@ -1792,10 +1822,18 @@
1822 free(zLine);
1823 rc = 1;
1824 break; /* from while */
1825 }
1826 for(i=0; i<nCol; i++){
1827 if( azCol[i][0]=='"' ){
1828 int k;
1829 for(z=azCol[i], j=1, k=0; z[j]; j++){
1830 if( z[j]=='"' ){ j++; if( z[j]==0 ) break; }
1831 z[k++] = z[j];
1832 }
1833 z[k] = 0;
1834 }
1835 sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
1836 }
1837 sqlite3_step(pStmt);
1838 rc = sqlite3_reset(pStmt);
1839 free(zLine);
@@ -2664,33 +2702,34 @@
2702
2703 /*
2704 ** Show available command line options
2705 */
2706 static const char zOptions[] =
 
 
 
 
2707 " -bail stop after hitting an error\n"
 
2708 " -batch force batch I/O\n"
2709 " -column set output mode to 'column'\n"
2710 " -cmd command run \"command\" before reading stdin\n"
2711 " -csv set output mode to 'csv'\n"
2712 " -echo print commands before execution\n"
2713 " -init filename read/process named file\n"
2714 " -[no]header turn headers on or off\n"
2715 " -help show this message\n"
2716 " -html set output mode to HTML\n"
2717 " -interactive force interactive I/O\n"
2718 " -line set output mode to 'line'\n"
2719 " -list set output mode to 'list'\n"
2720 #ifdef SQLITE_ENABLE_MULTIPLEX
2721 " -multiplex enable the multiplexor VFS\n"
2722 #endif
2723 " -nullvalue 'text' set text string for NULL values\n"
2724 " -separator 'x' set output field separator (|)\n"
2725 " -stats print memory stats before each finalize\n"
 
2726 " -version show SQLite version\n"
2727 " -vfs NAME use NAME as the default VFS\n"
2728 #ifdef SQLITE_ENABLE_VFSTRACE
2729 " -vfstrace enable tracing of all VFS calls\n"
2730 #endif
 
 
 
2731 ;
2732 static void usage(int showDetail){
2733 fprintf(stderr,
2734 "Usage: %s [OPTIONS] FILENAME [SQL]\n"
2735 "FILENAME is the name of an SQLite database. A new database is created\n"
@@ -2749,23 +2788,26 @@
2788 */
2789 for(i=1; i<argc-1; i++){
2790 char *z;
2791 if( argv[i][0]!='-' ) break;
2792 z = argv[i];
2793 if( z[1]=='-' ) z++;
2794 if( strcmp(z,"-separator")==0
2795 || strcmp(z,"-nullvalue")==0
2796 || strcmp(z,"-cmd")==0
2797 ){
2798 i++;
2799 }else if( strcmp(z,"-init")==0 ){
2800 i++;
2801 zInitFile = argv[i];
2802 /* Need to check for batch mode here to so we can avoid printing
2803 ** informational messages (like from process_sqliterc) before
2804 ** we do the actual processing of arguments later in a second pass.
2805 */
2806 }else if( strcmp(z,"-batch")==0 ){
2807 stdin_is_interactive = 0;
2808 }else if( strcmp(z,"-heap")==0 ){
2809 #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
2810 int j, c;
2811 const char *zSize;
2812 sqlite3_int64 szHeap;
2813
@@ -2778,11 +2820,11 @@
2820 }
2821 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
2822 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
2823 #endif
2824 #ifdef SQLITE_ENABLE_VFSTRACE
2825 }else if( strcmp(z,"-vfstrace")==0 ){
2826 extern int vfstrace_register(
2827 const char *zTraceName,
2828 const char *zOldVfsName,
2829 int (*xOut)(const char*,void*),
2830 void *pOutArg,
@@ -2789,15 +2831,15 @@
2831 int makeDefault
2832 );
2833 vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
2834 #endif
2835 #ifdef SQLITE_ENABLE_MULTIPLEX
2836 }else if( strcmp(z,"-multiplex")==0 ){
2837 extern int sqlite3_multiple_initialize(const char*,int);
2838 sqlite3_multiplex_initialize(0, 1);
2839 #endif
2840 }else if( strcmp(z,"-vfs")==0 ){
2841 sqlite3_vfs *pVfs = sqlite3_vfs_find(argv[++i]);
2842 if( pVfs ){
2843 sqlite3_vfs_register(pVfs, 1);
2844 }else{
2845 fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
@@ -2881,20 +2923,22 @@
2923 data.mode = MODE_Csv;
2924 memcpy(data.separator,",",2);
2925 }else if( strcmp(z,"-separator")==0 ){
2926 i++;
2927 if(i>=argc){
2928 fprintf(stderr,"%s: Error: missing argument for option: %s\n",
2929 Argv0, z);
2930 fprintf(stderr,"Use -help for a list of options.\n");
2931 return 1;
2932 }
2933 sqlite3_snprintf(sizeof(data.separator), data.separator,
2934 "%.*s",(int)sizeof(data.separator)-1,argv[i]);
2935 }else if( strcmp(z,"-nullvalue")==0 ){
2936 i++;
2937 if(i>=argc){
2938 fprintf(stderr,"%s: Error: missing argument for option: %s\n",
2939 Argv0, z);
2940 fprintf(stderr,"Use -help for a list of options.\n");
2941 return 1;
2942 }
2943 sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
2944 "%.*s",(int)sizeof(data.nullvalue)-1,argv[i]);
@@ -2925,12 +2969,30 @@
2969 #endif
2970 #ifdef SQLITE_ENABLE_MULTIPLEX
2971 }else if( strcmp(z,"-multiplex")==0 ){
2972 i++;
2973 #endif
2974 }else if( strcmp(z,"-help")==0 ){
2975 usage(1);
2976 }else if( strcmp(z,"-cmd")==0 ){
2977 if( i==argc-1 ) break;
2978 i++;
2979 z = argv[i];
2980 if( z[0]=='.' ){
2981 rc = do_meta_command(z, &data);
2982 if( rc && bail_on_error ) return rc;
2983 }else{
2984 open_db(&data);
2985 rc = shell_exec(data.db, z, shell_callback, &data, &zErrMsg);
2986 if( zErrMsg!=0 ){
2987 fprintf(stderr,"Error: %s\n", zErrMsg);
2988 if( bail_on_error ) return rc!=0 ? rc : 1;
2989 }else if( rc!=0 ){
2990 fprintf(stderr,"Error: unable to process SQL \"%s\"\n", z);
2991 if( bail_on_error ) return rc;
2992 }
2993 }
2994 }else{
2995 fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
2996 fprintf(stderr,"Use -help for a list of options.\n");
2997 return 1;
2998 }
2999
+1753 -1635
--- 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.7.10. By combining all the individual C code files into this
3
+** version 3.7.11. 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.
@@ -655,13 +655,13 @@
655655
**
656656
** See also: [sqlite3_libversion()],
657657
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658658
** [sqlite_version()] and [sqlite_source_id()].
659659
*/
660
-#define SQLITE_VERSION "3.7.10"
661
-#define SQLITE_VERSION_NUMBER 3007010
662
-#define SQLITE_SOURCE_ID "2012-01-11 16:16:08 9e31a275ef494ea8713a1d60a15b84157e57c3ff"
660
+#define SQLITE_VERSION "3.7.11"
661
+#define SQLITE_VERSION_NUMBER 3007011
662
+#define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
663663
664664
/*
665665
** CAPI3REF: Run-Time Library Version Numbers
666666
** KEYWORDS: sqlite3_version, sqlite3_sourceid
667667
**
@@ -3180,33 +3180,41 @@
31803180
**
31813181
** These are utility routines, useful to VFS implementations, that check
31823182
** to see if a database file was a URI that contained a specific query
31833183
** parameter, and if so obtains the value of that query parameter.
31843184
**
3185
-** If F is the filename pointer passed into the xOpen() method of a VFS
3186
-** implementation and P is the name of the query parameter, then
3185
+** If F is the database filename pointer passed into the xOpen() method of
3186
+** a VFS implementation when the flags parameter to xOpen() has one or
3187
+** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
3188
+** P is the name of the query parameter, then
31873189
** sqlite3_uri_parameter(F,P) returns the value of the P
31883190
** parameter if it exists or a NULL pointer if P does not appear as a
31893191
** query parameter on F. If P is a query parameter of F
31903192
** has no explicit value, then sqlite3_uri_parameter(F,P) returns
31913193
** a pointer to an empty string.
31923194
**
31933195
** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
31943196
** parameter and returns true (1) or false (0) according to the value
3195
-** of P. The value of P is true if it is "yes" or "true" or "on" or
3196
-** a non-zero number and is false otherwise. If P is not a query parameter
3197
-** on F then sqlite3_uri_boolean(F,P,B) returns (B!=0).
3197
+** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
3198
+** value of query parameter P is one of "yes", "true", or "on" in any
3199
+** case or if the value begins with a non-zero number. The
3200
+** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
3201
+** query parameter P is one of "no", "false", or "off" in any case or
3202
+** if the value begins with a numeric zero. If P is not a query
3203
+** parameter on F or if the value of P is does not match any of the
3204
+** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
31983205
**
31993206
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
32003207
** 64-bit signed integer and returns that integer, or D if P does not
32013208
** exist. If the value of P is something other than an integer, then
32023209
** zero is returned.
32033210
**
32043211
** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
32053212
** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3206
-** is not a pathname pointer that SQLite passed into the xOpen VFS method,
3207
-** then the behavior of this routine is undefined and probably undesirable.
3213
+** is not a database file pathname pointer that SQLite passed into the xOpen
3214
+** VFS method, then the behavior of this routine is undefined and probably
3215
+** undesirable.
32083216
*/
32093217
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
32103218
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
32113219
SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
32123220
@@ -6758,11 +6766,11 @@
67586766
** functions.
67596767
**
67606768
** [[the xShrink() page cache method]]
67616769
** ^SQLite invokes the xShrink() method when it wants the page cache to
67626770
** free up as much of heap memory as possible. The page cache implementation
6763
-** is not obligated to free any memory, but well-behaved implementions should
6771
+** is not obligated to free any memory, but well-behaved implementations should
67646772
** do their best.
67656773
*/
67666774
typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
67676775
struct sqlite3_pcache_methods2 {
67686776
int iVersion;
@@ -8010,13 +8018,17 @@
80108018
*/
80118019
#define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0])))
80128020
80138021
/*
80148022
** The following value as a destructor means to use sqlite3DbFree().
8015
-** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.
8023
+** The sqlite3DbFree() routine requires two parameters instead of the
8024
+** one parameter that destructors normally want. So we have to introduce
8025
+** this magic value that the code knows to handle differently. Any
8026
+** pointer will work here as long as it is distinct from SQLITE_STATIC
8027
+** and SQLITE_TRANSIENT.
80168028
*/
8017
-#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3DbFree)
8029
+#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
80188030
80198031
/*
80208032
** When SQLITE_OMIT_WSD is defined, it means that the target platform does
80218033
** not support Writable Static Data (WSD) such as global and static variables.
80228034
** All variables must either be on the stack or dynamically allocated from
@@ -8172,14 +8184,13 @@
81728184
**
81738185
** NOTE: These values must match the corresponding PAGER_ values in
81748186
** pager.h.
81758187
*/
81768188
#define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
8177
-#define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */
8178
-#define BTREE_MEMORY 4 /* This is an in-memory DB */
8179
-#define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */
8180
-#define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */
8189
+#define BTREE_MEMORY 2 /* This is an in-memory DB */
8190
+#define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */
8191
+#define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */
81818192
81828193
SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
81838194
SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
81848195
SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);
81858196
SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);
@@ -8848,12 +8859,11 @@
88488859
** Allowed values for the flags parameter to sqlite3PagerOpen().
88498860
**
88508861
** NOTE: These values must match the corresponding BTREE_ values in btree.h.
88518862
*/
88528863
#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
8853
-#define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
8854
-#define PAGER_MEMORY 0x0004 /* In-memory database */
8864
+#define PAGER_MEMORY 0x0002 /* In-memory database */
88558865
88568866
/*
88578867
** Valid values for the second argument to sqlite3PagerLockingMode().
88588868
*/
88598869
#define PAGER_LOCKINGMODE_QUERY -1
@@ -9006,12 +9016,12 @@
90069016
struct PgHdr {
90079017
sqlite3_pcache_page *pPage; /* Pcache object page handle */
90089018
void *pData; /* Page data */
90099019
void *pExtra; /* Extra content */
90109020
PgHdr *pDirty; /* Transient list of dirty pages */
9011
- Pgno pgno; /* Page number for this page */
90129021
Pager *pPager; /* The pager this page is part of */
9022
+ Pgno pgno; /* Page number for this page */
90139023
#ifdef SQLITE_CHECK_PAGES
90149024
u32 pageHash; /* Hash of page content */
90159025
#endif
90169026
u16 flags; /* PGHDR flags defined below */
90179027
@@ -9235,15 +9245,27 @@
92359245
# define SQLITE_TEMPNAME_SIZE 200
92369246
#endif
92379247
92389248
/*
92399249
** Determine if we are dealing with Windows NT.
9250
+**
9251
+** We ought to be able to determine if we are compiling for win98 or winNT
9252
+** using the _WIN32_WINNT macro as follows:
9253
+**
9254
+** #if defined(_WIN32_WINNT)
9255
+** # define SQLITE_OS_WINNT 1
9256
+** #else
9257
+** # define SQLITE_OS_WINNT 0
9258
+** #endif
9259
+**
9260
+** However, vs2005 does not set _WIN32_WINNT by default, as it ought to,
9261
+** so the above test does not work. We'll just assume that everything is
9262
+** winNT unless the programmer explicitly says otherwise by setting
9263
+** SQLITE_OS_WINNT to 0.
92409264
*/
9241
-#if defined(_WIN32_WINNT)
9265
+#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)
92429266
# define SQLITE_OS_WINNT 1
9243
-#else
9244
-# define SQLITE_OS_WINNT 0
92459267
#endif
92469268
92479269
/*
92489270
** Determine if we are dealing with WindowsCE - which has a much
92499271
** reduced API.
@@ -9637,39 +9659,20 @@
96379659
FuncDef *a[23]; /* Hash table for functions */
96389660
};
96399661
96409662
/*
96419663
** Each database connection is an instance of the following structure.
9642
-**
9643
-** The sqlite.lastRowid records the last insert rowid generated by an
9644
-** insert statement. Inserts on views do not affect its value. Each
9645
-** trigger has its own context, so that lastRowid can be updated inside
9646
-** triggers as usual. The previous value will be restored once the trigger
9647
-** exits. Upon entering a before or instead of trigger, lastRowid is no
9648
-** longer (since after version 2.8.12) reset to -1.
9649
-**
9650
-** The sqlite.nChange does not count changes within triggers and keeps no
9651
-** context. It is reset at start of sqlite3_exec.
9652
-** The sqlite.lsChange represents the number of changes made by the last
9653
-** insert, update, or delete statement. It remains constant throughout the
9654
-** length of a statement and is then updated by OP_SetCounts. It keeps a
9655
-** context stack just like lastRowid so that the count of changes
9656
-** within a trigger is not seen outside the trigger. Changes to views do not
9657
-** affect the value of lsChange.
9658
-** The sqlite.csChange keeps track of the number of current changes (since
9659
-** the last statement) and is used to update sqlite_lsChange.
9660
-**
9661
-** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16
9662
-** store the most recent error code and, if applicable, string. The
9663
-** internal function sqlite3Error() is used to set these variables
9664
-** consistently.
96659664
*/
96669665
struct sqlite3 {
96679666
sqlite3_vfs *pVfs; /* OS Interface */
9668
- int nDb; /* Number of backends currently in use */
9667
+ struct Vdbe *pVdbe; /* List of active virtual machines */
9668
+ CollSeq *pDfltColl; /* The default collating sequence (BINARY) */
9669
+ sqlite3_mutex *mutex; /* Connection mutex */
96699670
Db *aDb; /* All backends */
9671
+ int nDb; /* Number of backends currently in use */
96709672
int flags; /* Miscellaneous flags. See below */
9673
+ i64 lastRowid; /* ROWID of most recent insert (see above) */
96719674
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
96729675
int errCode; /* Most recent error code (SQLITE_*) */
96739676
int errMask; /* & result codes with this before returning */
96749677
u8 autoCommit; /* The auto-commit flag. */
96759678
u8 temp_store; /* 1: file 2: memory 0: default */
@@ -9676,31 +9679,27 @@
96769679
u8 mallocFailed; /* True if we have seen a malloc failure */
96779680
u8 dfltLockMode; /* Default locking-mode for attached dbs */
96789681
signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
96799682
u8 suppressErr; /* Do not issue error messages if true */
96809683
u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
9684
+ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
96819685
int nextPagesize; /* Pagesize after VACUUM if >0 */
9682
- int nTable; /* Number of tables in the database */
9683
- CollSeq *pDfltColl; /* The default collating sequence (BINARY) */
9684
- i64 lastRowid; /* ROWID of most recent insert (see above) */
96859686
u32 magic; /* Magic number for detect library misuse */
96869687
int nChange; /* Value returned by sqlite3_changes() */
96879688
int nTotalChange; /* Value returned by sqlite3_total_changes() */
9688
- sqlite3_mutex *mutex; /* Connection mutex */
96899689
int aLimit[SQLITE_N_LIMIT]; /* Limits */
96909690
struct sqlite3InitInfo { /* Information used during initialization */
9691
- int iDb; /* When back is being initialized */
96929691
int newTnum; /* Rootpage of table being initialized */
9692
+ u8 iDb; /* Which db file is being initialized */
96939693
u8 busy; /* TRUE if currently initializing */
96949694
u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */
96959695
} init;
9696
- int nExtension; /* Number of loaded extensions */
9697
- void **aExtension; /* Array of shared library handles */
9698
- struct Vdbe *pVdbe; /* List of active virtual machines */
96999696
int activeVdbeCnt; /* Number of VDBEs currently executing */
97009697
int writeVdbeCnt; /* Number of active VDBEs that are writing */
97019698
int vdbeExecCnt; /* Number of nested calls to VdbeExec() */
9699
+ int nExtension; /* Number of loaded extensions */
9700
+ void **aExtension; /* Array of shared library handles */
97029701
void (*xTrace)(void*,const char*); /* Trace function */
97039702
void *pTraceArg; /* Argument to the trace function */
97049703
void (*xProfile)(void*,const char*,u64); /* Profiling function */
97059704
void *pProfileArg; /* Argument to profile function */
97069705
void *pCommitArg; /* Argument to xCommitCallback() */
@@ -9733,25 +9732,24 @@
97339732
int (*xProgress)(void *); /* The progress callback */
97349733
void *pProgressArg; /* Argument to the progress callback */
97359734
int nProgressOps; /* Number of opcodes for progress callback */
97369735
#endif
97379736
#ifndef SQLITE_OMIT_VIRTUALTABLE
9737
+ int nVTrans; /* Allocated size of aVTrans */
97389738
Hash aModule; /* populated by sqlite3_create_module() */
97399739
VtabCtx *pVtabCtx; /* Context for active vtab connect/create */
97409740
VTable **aVTrans; /* Virtual tables with open transactions */
9741
- int nVTrans; /* Allocated size of aVTrans */
97429741
VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */
97439742
#endif
97449743
FuncDefHash aFunc; /* Hash table of connection functions */
97459744
Hash aCollSeq; /* All collating sequences */
97469745
BusyHandler busyHandler; /* Busy callback */
9747
- int busyTimeout; /* Busy handler timeout, in msec */
97489746
Db aDbStatic[2]; /* Static space for the 2 default backends */
97499747
Savepoint *pSavepoint; /* List of active savepoints */
9748
+ int busyTimeout; /* Busy handler timeout, in msec */
97509749
int nSavepoint; /* Number of non-transaction savepoints */
97519750
int nStatement; /* Number of nested statement-transactions */
9752
- u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
97539751
i64 nDeferredCons; /* Net deferred constraints this transaction. */
97549752
int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
97559753
97569754
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
97579755
/* The following variables are all protected by the STATIC_MASTER
@@ -9790,12 +9788,11 @@
97909788
#define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */
97919789
/* result set is empty */
97929790
#define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */
97939791
#define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */
97949792
#define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */
9795
-#define SQLITE_NoReadlock 0x00020000 /* Readlocks are omitted when
9796
- ** accessing read-only databases */
9793
+ /* 0x00020000 Unused */
97979794
#define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */
97989795
#define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */
97999796
#define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */
98009797
#define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */
98019798
#define SQLITE_CkptFullFSync 0x00400000 /* Use full fsync for checkpoint */
@@ -9880,11 +9877,10 @@
98809877
*/
98819878
#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
98829879
#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
98839880
#define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
98849881
#define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
9885
-#define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */
98869882
#define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */
98879883
#define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */
98889884
98899885
/*
98909886
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
@@ -10163,12 +10159,10 @@
1016310159
#define TF_Readonly 0x01 /* Read-only system table */
1016410160
#define TF_Ephemeral 0x02 /* An ephemeral table */
1016510161
#define TF_HasPrimaryKey 0x04 /* Table has a primary key */
1016610162
#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
1016710163
#define TF_Virtual 0x10 /* Is a virtual table */
10168
-#define TF_NeedMetadata 0x20 /* aCol[].zType and aCol[].pColl missing */
10169
-
1017010164
1017110165
1017210166
/*
1017310167
** Test to see whether or not a table is a virtual table. This is
1017410168
** done as a macro so that it will be optimized out when virtual
@@ -10326,23 +10320,23 @@
1032610320
** algorithm to employ whenever an attempt is made to insert a non-unique
1032710321
** element.
1032810322
*/
1032910323
struct Index {
1033010324
char *zName; /* Name of this index */
10331
- int nColumn; /* Number of columns in the table used by this index */
1033210325
int *aiColumn; /* Which columns are used by this index. 1st is 0 */
1033310326
tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
1033410327
Table *pTable; /* The SQL table being indexed */
10335
- int tnum; /* Page containing root of this index in database file */
10336
- u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
10337
- u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
10338
- u8 bUnordered; /* Use this index for == or IN queries only */
1033910328
char *zColAff; /* String defining the affinity of each column */
1034010329
Index *pNext; /* The next index associated with the same table */
1034110330
Schema *pSchema; /* Schema containing this index */
1034210331
u8 *aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */
1034310332
char **azColl; /* Array of collation sequence names for index */
10333
+ int nColumn; /* Number of columns in the table used by this index */
10334
+ int tnum; /* Page containing root of this index in database file */
10335
+ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
10336
+ u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
10337
+ u8 bUnordered; /* Use this index for == or IN queries only */
1034410338
#ifdef SQLITE_ENABLE_STAT3
1034510339
int nSample; /* Number of elements in aSample[] */
1034610340
tRowcnt avgEq; /* Average nEq value for key values not in aSample */
1034710341
IndexSample *aSample; /* Samples of the left-most key */
1034810342
#endif
@@ -10397,22 +10391,21 @@
1039710391
** from source tables rather than from accumulators */
1039810392
u8 useSortingIdx; /* In direct mode, reference the sorting index rather
1039910393
** than the source table */
1040010394
int sortingIdx; /* Cursor number of the sorting index */
1040110395
int sortingIdxPTab; /* Cursor number of pseudo-table */
10402
- ExprList *pGroupBy; /* The group by clause */
1040310396
int nSortingColumn; /* Number of columns in the sorting index */
10397
+ ExprList *pGroupBy; /* The group by clause */
1040410398
struct AggInfo_col { /* For each column used in source tables */
1040510399
Table *pTab; /* Source table */
1040610400
int iTable; /* Cursor number of the source table */
1040710401
int iColumn; /* Column number within the source table */
1040810402
int iSorterColumn; /* Column number in the sorting index */
1040910403
int iMem; /* Memory location that acts as accumulator */
1041010404
Expr *pExpr; /* The original expression */
1041110405
} *aCol;
1041210406
int nColumn; /* Number of used entries in aCol[] */
10413
- int nColumnAlloc; /* Number of slots allocated for aCol[] */
1041410407
int nAccumulator; /* Number of columns that show through to the output.
1041510408
** Additional columns are used only as parameters to
1041610409
** aggregate functions */
1041710410
struct AggInfo_func { /* For each aggregate function */
1041810411
Expr *pExpr; /* Expression encoding the function */
@@ -10419,11 +10412,10 @@
1041910412
FuncDef *pFunc; /* The aggregate function implementation */
1042010413
int iMem; /* Memory location that acts as accumulator */
1042110414
int iDistinct; /* Ephemeral table used to enforce DISTINCT */
1042210415
} *aFunc;
1042310416
int nFunc; /* Number of entries in aFunc[] */
10424
- int nFuncAlloc; /* Number of slots allocated for aFunc[] */
1042510417
};
1042610418
1042710419
/*
1042810420
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
1042910421
** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -10616,21 +10608,20 @@
1061610608
** also be used as the argument to a function, in which case the a.zName
1061710609
** field is not used.
1061810610
*/
1061910611
struct ExprList {
1062010612
int nExpr; /* Number of expressions on the list */
10621
- int nAlloc; /* Number of entries allocated below */
1062210613
int iECursor; /* VDBE Cursor associated with this ExprList */
10623
- struct ExprList_item {
10614
+ struct ExprList_item { /* For each expression in the list */
1062410615
Expr *pExpr; /* The list of expressions */
1062510616
char *zName; /* Token associated with this expression */
1062610617
char *zSpan; /* Original text of the expression */
1062710618
u8 sortOrder; /* 1 for DESC or 0 for ASC */
1062810619
u8 done; /* A flag to indicate when processing is finished */
1062910620
u16 iOrderByCol; /* For ORDER BY, column number in result set */
1063010621
u16 iAlias; /* Index into Parse.aAlias[] for zName */
10631
- } *a; /* One entry for each expression */
10622
+ } *a; /* Alloc a power of two greater or equal to nExpr */
1063210623
};
1063310624
1063410625
/*
1063510626
** An instance of this structure is used by the parser to record both
1063610627
** the parse tree for an expression and the span of input text for an
@@ -10661,11 +10652,10 @@
1066110652
struct IdList_item {
1066210653
char *zName; /* Name of the identifier */
1066310654
int idx; /* Index in some Table.aCol[] of a column named zName */
1066410655
} *a;
1066510656
int nId; /* Number of identifiers on the list */
10666
- int nAlloc; /* Number of entries allocated for a[] below */
1066710657
};
1066810658
1066910659
/*
1067010660
** The bitmask datatype defined below is used for various optimizations.
1067110661
**
@@ -10905,10 +10895,13 @@
1090510895
struct Select {
1090610896
ExprList *pEList; /* The fields of the result */
1090710897
u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
1090810898
char affinity; /* MakeRecord with this affinity for SRT_Set */
1090910899
u16 selFlags; /* Various SF_* values */
10900
+ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
10901
+ int addrOpenEphm[3]; /* OP_OpenEphem opcodes related to this select */
10902
+ double nSelectRow; /* Estimated number of result rows */
1091010903
SrcList *pSrc; /* The FROM clause */
1091110904
Expr *pWhere; /* The WHERE clause */
1091210905
ExprList *pGroupBy; /* The GROUP BY clause */
1091310906
Expr *pHaving; /* The HAVING clause */
1091410907
ExprList *pOrderBy; /* The ORDER BY clause */
@@ -10915,13 +10908,10 @@
1091510908
Select *pPrior; /* Prior select in a compound select statement */
1091610909
Select *pNext; /* Next select to the left in a compound */
1091710910
Select *pRightmost; /* Right-most select in a compound select statement */
1091810911
Expr *pLimit; /* LIMIT expression. NULL means not used. */
1091910912
Expr *pOffset; /* OFFSET expression. NULL means not used. */
10920
- int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
10921
- int addrOpenEphm[3]; /* OP_OpenEphem opcodes related to this select */
10922
- double nSelectRow; /* Estimated number of result rows */
1092310913
};
1092410914
1092510915
/*
1092610916
** Allowed values for Select.selFlags. The "SF" prefix stands for
1092710917
** "Select Flag".
@@ -10931,10 +10921,11 @@
1093110921
#define SF_Aggregate 0x04 /* Contains aggregate functions */
1093210922
#define SF_UsesEphemeral 0x08 /* Uses the OpenEphemeral opcode */
1093310923
#define SF_Expanded 0x10 /* sqlite3SelectExpand() called on this */
1093410924
#define SF_HasTypeInfo 0x20 /* FROM subqueries have Table metadata */
1093510925
#define SF_UseSorter 0x40 /* Sort using a sorter */
10926
+#define SF_Values 0x80 /* Synthesized from VALUES clause */
1093610927
1093710928
1093810929
/*
1093910930
** The results of a select can be distributed in several ways. The
1094010931
** "SRT" prefix means "SELECT Result Type".
@@ -11008,14 +10999,14 @@
1100810999
** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
1100911000
** a mask of new.* columns used by the program.
1101011001
*/
1101111002
struct TriggerPrg {
1101211003
Trigger *pTrigger; /* Trigger this program was coded from */
11013
- int orconf; /* Default ON CONFLICT policy */
11004
+ TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */
1101411005
SubProgram *pProgram; /* Program implementing pTrigger/orconf */
11006
+ int orconf; /* Default ON CONFLICT policy */
1101511007
u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */
11016
- TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */
1101711008
};
1101811009
1101911010
/*
1102011011
** The yDbMask datatype for the bitmask of all attached databases.
1102111012
*/
@@ -11041,18 +11032,22 @@
1104111032
** compiled. Function sqlite3TableLock() is used to add entries to the
1104211033
** list.
1104311034
*/
1104411035
struct Parse {
1104511036
sqlite3 *db; /* The main database structure */
11046
- int rc; /* Return code from execution */
1104711037
char *zErrMsg; /* An error message */
1104811038
Vdbe *pVdbe; /* An engine for executing database bytecode */
11039
+ int rc; /* Return code from execution */
1104911040
u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
1105011041
u8 checkSchema; /* Causes schema cookie check after an error */
1105111042
u8 nested; /* Number of nested calls to the parser/code generator */
1105211043
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
1105311044
u8 nTempInUse; /* Number of aTempReg[] currently checked out */
11045
+ u8 nColCache; /* Number of entries in aColCache[] */
11046
+ u8 iColCache; /* Next entry in aColCache[] to replace */
11047
+ u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
11048
+ u8 mayAbort; /* True if statement may throw an ABORT exception */
1105411049
int aTempReg[8]; /* Holding area for temporary registers */
1105511050
int nRangeReg; /* Size of the temporary register block */
1105611051
int iRangeReg; /* First register in temporary register block */
1105711052
int nErr; /* Number of errors seen */
1105811053
int nTab; /* Number of previously allocated VDBE cursors */
@@ -11060,12 +11055,10 @@
1106011055
int nSet; /* Number of sets used so far */
1106111056
int nOnce; /* Number of OP_Once instructions so far */
1106211057
int ckBase; /* Base register of data during check constraints */
1106311058
int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
1106411059
int iCacheCnt; /* Counter used to generate aColCache[].lru values */
11065
- u8 nColCache; /* Number of entries in aColCache[] */
11066
- u8 iColCache; /* Next entry in aColCache[] to replace */
1106711060
struct yColCache {
1106811061
int iTable; /* Table cursor number */
1106911062
int iColumn; /* Table column number */
1107011063
u8 tempReg; /* iReg is a temp register that needs to be freed */
1107111064
int iLevel; /* Nesting level */
@@ -11072,65 +11065,67 @@
1107211065
int iReg; /* Reg with value of this column. 0 means none. */
1107311066
int lru; /* Least recently used entry has the smallest value */
1107411067
} aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
1107511068
yDbMask writeMask; /* Start a write transaction on these databases */
1107611069
yDbMask cookieMask; /* Bitmask of schema verified databases */
11077
- u8 isMultiWrite; /* True if statement may affect/insert multiple rows */
11078
- u8 mayAbort; /* True if statement may throw an ABORT exception */
1107911070
int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */
1108011071
int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
11072
+ int regRowid; /* Register holding rowid of CREATE TABLE entry */
11073
+ int regRoot; /* Register holding root page number for new objects */
11074
+ int nMaxArg; /* Max args passed to user function by sub-program */
1108111075
#ifndef SQLITE_OMIT_SHARED_CACHE
1108211076
int nTableLock; /* Number of locks in aTableLock */
1108311077
TableLock *aTableLock; /* Required table locks for shared-cache mode */
1108411078
#endif
11085
- int regRowid; /* Register holding rowid of CREATE TABLE entry */
11086
- int regRoot; /* Register holding root page number for new objects */
1108711079
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
11088
- int nMaxArg; /* Max args passed to user function by sub-program */
1108911080
1109011081
/* Information used while coding trigger programs. */
1109111082
Parse *pToplevel; /* Parse structure for main program (or NULL) */
1109211083
Table *pTriggerTab; /* Table triggers are being coded for */
11084
+ double nQueryLoop; /* Estimated number of iterations of a query */
1109311085
u32 oldmask; /* Mask of old.* columns referenced */
1109411086
u32 newmask; /* Mask of new.* columns referenced */
1109511087
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
1109611088
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
1109711089
u8 disableTriggers; /* True to disable triggers */
11098
- double nQueryLoop; /* Estimated number of iterations of a query */
1109911090
1110011091
/* Above is constant between recursions. Below is reset before and after
1110111092
** each recursion */
1110211093
11103
- int nVar; /* Number of '?' variables seen in the SQL so far */
11104
- int nzVar; /* Number of available slots in azVar[] */
11105
- char **azVar; /* Pointers to names of parameters */
11106
- Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
11107
- int nAlias; /* Number of aliased result set columns */
11108
- int *aAlias; /* Register used to hold aliased result */
11109
- u8 explain; /* True if the EXPLAIN flag is found on the query */
11110
- Token sNameToken; /* Token with unqualified schema object name */
11111
- Token sLastToken; /* The last token parsed */
11112
- const char *zTail; /* All SQL text past the last semicolon parsed */
11113
- Table *pNewTable; /* A table being constructed by CREATE TABLE */
11094
+ int nVar; /* Number of '?' variables seen in the SQL so far */
11095
+ int nzVar; /* Number of available slots in azVar[] */
11096
+ u8 explain; /* True if the EXPLAIN flag is found on the query */
11097
+#ifndef SQLITE_OMIT_VIRTUALTABLE
11098
+ u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
11099
+ int nVtabLock; /* Number of virtual tables to lock */
11100
+#endif
11101
+ int nAlias; /* Number of aliased result set columns */
11102
+ int nHeight; /* Expression tree height of current sub-select */
11103
+#ifndef SQLITE_OMIT_EXPLAIN
11104
+ int iSelectId; /* ID of current select for EXPLAIN output */
11105
+ int iNextSelectId; /* Next available select ID for EXPLAIN output */
11106
+#endif
11107
+ char **azVar; /* Pointers to names of parameters */
11108
+ Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
11109
+ int *aAlias; /* Register used to hold aliased result */
11110
+ const char *zTail; /* All SQL text past the last semicolon parsed */
11111
+ Table *pNewTable; /* A table being constructed by CREATE TABLE */
1111411112
Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
1111511113
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
11114
+ Token sNameToken; /* Token with unqualified schema object name */
11115
+ Token sLastToken; /* The last token parsed */
1111611116
#ifndef SQLITE_OMIT_VIRTUALTABLE
11117
- Token sArg; /* Complete text of a module argument */
11118
- u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
11119
- int nVtabLock; /* Number of virtual tables to lock */
11120
- Table **apVtabLock; /* Pointer to virtual tables needing locking */
11121
-#endif
11122
- int nHeight; /* Expression tree height of current sub-select */
11123
- Table *pZombieTab; /* List of Table objects to delete after code gen */
11124
- TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
11125
-
11126
-#ifndef SQLITE_OMIT_EXPLAIN
11127
- int iSelectId;
11128
- int iNextSelectId;
11129
-#endif
11117
+ Token sArg; /* Complete text of a module argument */
11118
+ Table **apVtabLock; /* Pointer to virtual tables needing locking */
11119
+#endif
11120
+ Table *pZombieTab; /* List of Table objects to delete after code gen */
11121
+ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
1113011122
};
1113111123
11124
+/*
11125
+** Return true if currently inside an sqlite3_declare_vtab() call.
11126
+*/
1113211127
#ifdef SQLITE_OMIT_VIRTUALTABLE
1113311128
#define IN_DECLARE_VTAB 0
1113411129
#else
1113511130
#define IN_DECLARE_VTAB (pParse->declareVtab)
1113611131
#endif
@@ -11277,12 +11272,12 @@
1127711272
** A pointer to this structure is used to communicate information
1127811273
** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
1127911274
*/
1128011275
typedef struct {
1128111276
sqlite3 *db; /* The database being initialized */
11282
- int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
1128311277
char **pzErrMsg; /* Error message stored here */
11278
+ int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
1128411279
int rc; /* Result code stored here */
1128511280
} InitData;
1128611281
1128711282
/*
1128811283
** Structure containing global configuration data for the SQLite library.
@@ -11603,11 +11598,11 @@
1160311598
#else
1160411599
# define sqlite3AutoincrementBegin(X)
1160511600
# define sqlite3AutoincrementEnd(X)
1160611601
#endif
1160711602
SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
11608
-SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*);
11603
+SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
1160911604
SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
1161011605
SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
1161111606
SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
1161211607
SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
1161311608
SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
@@ -11841,11 +11836,11 @@
1184111836
#ifdef SQLITE_ENABLE_8_3_NAMES
1184211837
SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*);
1184311838
#else
1184411839
# define sqlite3FileSuffix3(X,Y)
1184511840
#endif
11846
-SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z);
11841
+SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,int);
1184711842
1184811843
SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
1184911844
SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
1185011845
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
1185111846
void(*)(void*));
@@ -11967,11 +11962,11 @@
1196711962
SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int);
1196811963
SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*);
1196911964
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
1197011965
#endif
1197111966
SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
11972
-SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
11967
+SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int);
1197311968
SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*);
1197411969
SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*);
1197511970
SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*);
1197611971
SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
1197711972
SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
@@ -12896,25 +12891,25 @@
1289612891
** set to NULL if the currently executing frame is the main program.
1289712892
*/
1289812893
typedef struct VdbeFrame VdbeFrame;
1289912894
struct VdbeFrame {
1290012895
Vdbe *v; /* VM this frame belongs to */
12901
- int pc; /* Program Counter in parent (calling) frame */
12896
+ VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
1290212897
Op *aOp; /* Program instructions for parent frame */
12903
- int nOp; /* Size of aOp array */
1290412898
Mem *aMem; /* Array of memory cells for parent frame */
12905
- int nMem; /* Number of entries in aMem */
1290612899
u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
12907
- int nOnceFlag; /* Number of entries in aOnceFlag */
1290812900
VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
12909
- u16 nCursor; /* Number of entries in apCsr */
1291012901
void *token; /* Copy of SubProgram.token */
12902
+ i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
12903
+ u16 nCursor; /* Number of entries in apCsr */
12904
+ int pc; /* Program Counter in parent (calling) frame */
12905
+ int nOp; /* Size of aOp array */
12906
+ int nMem; /* Number of entries in aMem */
12907
+ int nOnceFlag; /* Number of entries in aOnceFlag */
1291112908
int nChildMem; /* Number of memory cells for child frame */
1291212909
int nChildCsr; /* Number of cursors for child frame */
12913
- i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
1291412910
int nChange; /* Statement changes (Vdbe.nChanges) */
12915
- VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
1291612911
};
1291712912
1291812913
#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
1291912914
1292012915
/*
@@ -13037,12 +13032,13 @@
1303713032
struct sqlite3_context {
1303813033
FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
1303913034
VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
1304013035
Mem s; /* The return value is stored here */
1304113036
Mem *pMem; /* Memory cell used to store aggregate context */
13042
- int isError; /* Error code returned by the function. */
1304313037
CollSeq *pColl; /* Collating sequence */
13038
+ int isError; /* Error code returned by the function. */
13039
+ int skipFlag; /* Skip skip accumulator loading if true */
1304413040
};
1304513041
1304613042
/*
1304713043
** An Explain object accumulates indented output which is helpful
1304813044
** in describing recursive data structures.
@@ -13079,11 +13075,10 @@
1307913075
Mem *pResultSet; /* Pointer to an array of results */
1308013076
int nMem; /* Number of memory locations currently allocated */
1308113077
int nOp; /* Number of instructions in the program */
1308213078
int nOpAlloc; /* Number of slots allocated for aOp[] */
1308313079
int nLabel; /* Number of labels used */
13084
- int nLabelAlloc; /* Number of slots allocated in aLabel[] */
1308513080
int *aLabel; /* Space to hold the labels */
1308613081
u16 nResColumn; /* Number of columns in one row of the result set */
1308713082
u16 nCursor; /* Number of slots in apCsr[] */
1308813083
u32 magic; /* Magic number for sanity checking */
1308913084
char *zErrMsg; /* Error message written here */
@@ -15146,11 +15141,39 @@
1514615141
** This file contains low-level memory allocation drivers for when
1514715142
** SQLite will use the standard C-library malloc/realloc/free interface
1514815143
** to obtain the memory it needs.
1514915144
**
1515015145
** This file contains implementations of the low-level memory allocation
15151
-** routines specified in the sqlite3_mem_methods object.
15146
+** routines specified in the sqlite3_mem_methods object. The content of
15147
+** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The
15148
+** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the
15149
+** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The
15150
+** default configuration is to use memory allocation routines in this
15151
+** file.
15152
+**
15153
+** C-preprocessor macro summary:
15154
+**
15155
+** HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if
15156
+** the malloc_usable_size() interface exists
15157
+** on the target platform. Or, this symbol
15158
+** can be set manually, if desired.
15159
+** If an equivalent interface exists by
15160
+** a different name, using a separate -D
15161
+** option to rename it. This symbol will
15162
+** be enabled automatically on windows
15163
+** systems, and malloc_usable_size() will
15164
+** be redefined to _msize(), unless the
15165
+** SQLITE_WITHOUT_MSIZE macro is defined.
15166
+**
15167
+** SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone
15168
+** memory allocator. Set this symbol to enable
15169
+** building on older macs.
15170
+**
15171
+** SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of
15172
+** _msize() on windows systems. This might
15173
+** be necessary when compiling for Delphi,
15174
+** for example.
1515215175
*/
1515315176
1515415177
/*
1515515178
** This version of the memory allocator is the default. It is
1515615179
** used when no other memory allocator is specified using compile-time
@@ -15157,21 +15180,25 @@
1515715180
** macros.
1515815181
*/
1515915182
#ifdef SQLITE_SYSTEM_MALLOC
1516015183
1516115184
/*
15162
-** Windows systems have malloc_usable_size() but it is called _msize()
15185
+** Windows systems have malloc_usable_size() but it is called _msize().
15186
+** The use of _msize() is automatic, but can be disabled by compiling
15187
+** with -DSQLITE_WITHOUT_MSIZE
1516315188
*/
15164
-#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
15189
+#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN \
15190
+ && !defined(SQLITE_WITHOUT_MSIZE)
1516515191
# define HAVE_MALLOC_USABLE_SIZE 1
15166
-# define malloc_usable_size _msize
15192
+# define SQLITE_MALLOCSIZE _msize
1516715193
#endif
1516815194
15169
-#if defined(__APPLE__)
15195
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
1517015196
1517115197
/*
15172
-** Use the zone allocator available on apple products
15198
+** Use the zone allocator available on apple products unless the
15199
+** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.
1517315200
*/
1517415201
#include <sys/sysctl.h>
1517515202
#include <malloc/malloc.h>
1517615203
#include <libkern/OSAtomic.h>
1517715204
static malloc_zone_t* _sqliteZone_;
@@ -15182,21 +15209,24 @@
1518215209
(_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))
1518315210
1518415211
#else /* if not __APPLE__ */
1518515212
1518615213
/*
15187
-** Use standard C library malloc and free on non-Apple systems.
15214
+** Use standard C library malloc and free on non-Apple systems.
15215
+** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
1518815216
*/
1518915217
#define SQLITE_MALLOC(x) malloc(x)
1519015218
#define SQLITE_FREE(x) free(x)
1519115219
#define SQLITE_REALLOC(x,y) realloc((x),(y))
1519215220
1519315221
#ifdef HAVE_MALLOC_USABLE_SIZE
15194
-#include <malloc.h>
15195
-#define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
15222
+# ifndef SQLITE_MALLOCSIZE
15223
+# include <malloc.h>
15224
+# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
15225
+# endif
1519615226
#else
15197
-#undef SQLITE_MALLOCSIZE
15227
+# undef SQLITE_MALLOCSIZE
1519815228
#endif
1519915229
1520015230
#endif /* __APPLE__ or not __APPLE__ */
1520115231
1520215232
/*
@@ -15314,11 +15344,11 @@
1531415344
1531515345
/*
1531615346
** Initialize this module.
1531715347
*/
1531815348
static int sqlite3MemInit(void *NotUsed){
15319
-#if defined(__APPLE__)
15349
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
1532015350
int cpuCount;
1532115351
size_t len;
1532215352
if( _sqliteZone_ ){
1532315353
return SQLITE_OK;
1532415354
}
@@ -36786,20 +36816,19 @@
3678636816
int szExtra; /* Size of extra space in bytes */
3678736817
int bPurgeable; /* True if cache is purgeable */
3678836818
unsigned int nMin; /* Minimum number of pages reserved */
3678936819
unsigned int nMax; /* Configured "cache_size" value */
3679036820
unsigned int n90pct; /* nMax*9/10 */
36821
+ unsigned int iMaxKey; /* Largest key seen since xTruncate() */
3679136822
3679236823
/* Hash table of all pages. The following variables may only be accessed
3679336824
** when the accessor is holding the PGroup mutex.
3679436825
*/
3679536826
unsigned int nRecyclable; /* Number of pages in the LRU list */
3679636827
unsigned int nPage; /* Total number of pages in apHash */
3679736828
unsigned int nHash; /* Number of slots in apHash[] */
3679836829
PgHdr1 **apHash; /* Hash table for fast lookup by key */
36799
-
36800
- unsigned int iMaxKey; /* Largest key seen since xTruncate() */
3680136830
};
3680236831
3680336832
/*
3680436833
** Each cache entry is represented by an instance of the following
3680536834
** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of
@@ -36839,12 +36868,12 @@
3683936868
int nSlot; /* The number of pcache slots */
3684036869
int nReserve; /* Try to keep nFreeSlot above this */
3684136870
void *pStart, *pEnd; /* Bounds of pagecache malloc range */
3684236871
/* Above requires no mutex. Use mutex below for variable that follow. */
3684336872
sqlite3_mutex *mutex; /* Mutex for accessing the following: */
36844
- int nFreeSlot; /* Number of unused pcache slots */
3684536873
PgFreeslot *pFree; /* Free page blocks */
36874
+ int nFreeSlot; /* Number of unused pcache slots */
3684636875
/* The following value requires a mutex to change. We skip the mutex on
3684736876
** reading because (1) most platforms read a 32-bit integer atomically and
3684836877
** (2) even if an incorrect value is read, no great harm is done since this
3684936878
** is really just an optimization. */
3685036879
int bUnderPressure; /* True if low on PAGECACHE memory */
@@ -38898,11 +38927,10 @@
3889838927
struct Pager {
3889938928
sqlite3_vfs *pVfs; /* OS functions to use for IO */
3890038929
u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
3890138930
u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */
3890238931
u8 useJournal; /* Use a rollback journal on this file */
38903
- u8 noReadlock; /* Do not bother to obtain readlocks */
3890438932
u8 noSync; /* Do not sync the journal if true */
3890538933
u8 fullSync; /* Do extra syncs of the journal for robustness */
3890638934
u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */
3890738935
u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */
3890838936
u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
@@ -39146,11 +39174,11 @@
3914639174
break;
3914739175
3914839176
case PAGER_READER:
3914939177
assert( pPager->errCode==SQLITE_OK );
3915039178
assert( p->eLock!=UNKNOWN_LOCK );
39151
- assert( p->eLock>=SHARED_LOCK || p->noReadlock );
39179
+ assert( p->eLock>=SHARED_LOCK );
3915239180
break;
3915339181
3915439182
case PAGER_WRITER_LOCKED:
3915539183
assert( p->eLock!=UNKNOWN_LOCK );
3915639184
assert( pPager->errCode==SQLITE_OK );
@@ -41355,11 +41383,11 @@
4135541383
** if the database size is not available. The database size is not
4135641384
** available from the WAL sub-system if the log file is empty or
4135741385
** contains no valid committed transactions.
4135841386
*/
4135941387
assert( pPager->eState==PAGER_OPEN );
41360
- assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock );
41388
+ assert( pPager->eLock>=SHARED_LOCK );
4136141389
nPage = sqlite3WalDbsize(pPager->pWal);
4136241390
4136341391
/* If the database size was not available from the WAL sub-system,
4136441392
** determine it based on the size of the database file. If the size
4136541393
** of the database file is not an integer multiple of the page-size,
@@ -41410,11 +41438,11 @@
4141041438
** other connection.
4141141439
*/
4141241440
static int pagerOpenWalIfPresent(Pager *pPager){
4141341441
int rc = SQLITE_OK;
4141441442
assert( pPager->eState==PAGER_OPEN );
41415
- assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock );
41443
+ assert( pPager->eLock>=SHARED_LOCK );
4141641444
4141741445
if( !pPager->tempFile ){
4141841446
int isWal; /* True if WAL file exists */
4141941447
Pgno nPage; /* Size of the database file */
4142041448
@@ -42573,11 +42601,11 @@
4257342601
** along with each page reference. This space is available to the user
4257442602
** via the sqlite3PagerGetExtra() API.
4257542603
**
4257642604
** The flags argument is used to specify properties that affect the
4257742605
** operation of the pager. It should be passed some bitwise combination
42578
-** of the PAGER_OMIT_JOURNAL and PAGER_NO_READLOCK flags.
42606
+** of the PAGER_* flags.
4257942607
**
4258042608
** The vfsFlags parameter is a bitmask to pass to the flags parameter
4258142609
** of the xOpen() method of the supplied VFS when opening files.
4258242610
**
4258342611
** If the pager object is allocated and the specified file opened
@@ -42604,11 +42632,10 @@
4260442632
int readOnly = 0; /* True if this is a read-only file */
4260542633
int journalFileSize; /* Bytes to allocate for each journal fd */
4260642634
char *zPathname = 0; /* Full path to database file */
4260742635
int nPathname = 0; /* Number of bytes in zPathname */
4260842636
int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
42609
- int noReadlock = (flags & PAGER_NO_READLOCK)!=0; /* True to omit read-lock */
4261042637
int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
4261142638
u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
4261242639
const char *zUri = 0; /* URI args to copy */
4261342640
int nUri = 0; /* Number of bytes of URI args at *zUri */
4261442641
@@ -42811,11 +42838,10 @@
4281142838
4281242839
PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename));
4281342840
IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename))
4281442841
4281542842
pPager->useJournal = (u8)useJournal;
42816
- pPager->noReadlock = (noReadlock && readOnly) ?1:0;
4281742843
/* pPager->stmtOpen = 0; */
4281842844
/* pPager->stmtInUse = 0; */
4281942845
/* pPager->nRef = 0; */
4282042846
/* pPager->stmtSize = 0; */
4282142847
/* pPager->stmtJSize = 0; */
@@ -43033,18 +43059,15 @@
4303343059
4303443060
if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
4303543061
int bHotJournal = 1; /* True if there exists a hot journal-file */
4303643062
4303743063
assert( !MEMDB );
43038
- assert( pPager->noReadlock==0 || pPager->readOnly );
43039
-
43040
- if( pPager->noReadlock==0 ){
43041
- rc = pager_wait_on_lock(pPager, SHARED_LOCK);
43042
- if( rc!=SQLITE_OK ){
43043
- assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );
43044
- goto failed;
43045
- }
43064
+
43065
+ rc = pager_wait_on_lock(pPager, SHARED_LOCK);
43066
+ if( rc!=SQLITE_OK ){
43067
+ assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );
43068
+ goto failed;
4304643069
}
4304743070
4304843071
/* If a journal file exists, and there is no RESERVED lock on the
4304943072
** database file, then it either needs to be played back or deleted.
4305043073
*/
@@ -45048,11 +45071,11 @@
4504845071
*/
4504945072
static int pagerOpenWal(Pager *pPager){
4505045073
int rc = SQLITE_OK;
4505145074
4505245075
assert( pPager->pWal==0 && pPager->tempFile==0 );
45053
- assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK || pPager->noReadlock);
45076
+ assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );
4505445077
4505545078
/* If the pager is already in exclusive-mode, the WAL module will use
4505645079
** heap-memory for the wal-index instead of the VFS shared-memory
4505745080
** implementation. Take the exclusive lock now, before opening the WAL
4505845081
** file, to make sure this is safe.
@@ -48561,14 +48584,13 @@
4856148584
u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
4856248585
u16 cellOffset; /* Index in aData of first cell pointer */
4856348586
u16 nFree; /* Number of free bytes on the page */
4856448587
u16 nCell; /* Number of cells on this page, local and ovfl */
4856548588
u16 maskPage; /* Mask for page offset */
48566
- struct _OvflCell { /* Cells that will not fit on aData[] */
48567
- u8 *pCell; /* Pointers to the body of the overflow cell */
48568
- u16 idx; /* Insert this cell before idx-th non-overflow cell */
48569
- } aOvfl[5];
48589
+ u16 aiOvfl[5]; /* Insert the i-th overflow cell before the aiOvfl-th
48590
+ ** non-overflow cell */
48591
+ u8 *apOvfl[5]; /* Pointers to the body of overflow cells */
4857048592
BtShared *pBt; /* Pointer to BtShared that this page is part of */
4857148593
u8 *aData; /* Pointer to disk image of the page data */
4857248594
u8 *aDataEnd; /* One byte past the end of usable data */
4857348595
u8 *aCellIdx; /* The cell index area */
4857448596
DbPage *pDbPage; /* Pager page handle */
@@ -48772,10 +48794,13 @@
4877248794
struct BtCursor {
4877348795
Btree *pBtree; /* The Btree to which this cursor belongs */
4877448796
BtShared *pBt; /* The BtShared this cursor points to */
4877548797
BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
4877648798
struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
48799
+#ifndef SQLITE_OMIT_INCRBLOB
48800
+ Pgno *aOverflow; /* Cache of overflow page locations */
48801
+#endif
4877748802
Pgno pgnoRoot; /* The root page of this tree */
4877848803
sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */
4877948804
CellInfo info; /* A parse of the cell we are pointing at */
4878048805
i64 nKey; /* Size of pKey, or last integer key */
4878148806
void *pKey; /* Saved key that was cursor's last known position */
@@ -48783,11 +48808,10 @@
4878348808
u8 wrFlag; /* True if writable */
4878448809
u8 atLast; /* Cursor pointing to the last entry */
4878548810
u8 validNKey; /* True if info.nKey is valid */
4878648811
u8 eState; /* One of the CURSOR_XXX constants (see below) */
4878748812
#ifndef SQLITE_OMIT_INCRBLOB
48788
- Pgno *aOverflow; /* Cache of overflow page locations */
4878948813
u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */
4879048814
#endif
4879148815
i16 iPage; /* Index of current page in apPage */
4879248816
u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
4879348817
MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
@@ -48912,12 +48936,12 @@
4891248936
*/
4891348937
typedef struct IntegrityCk IntegrityCk;
4891448938
struct IntegrityCk {
4891548939
BtShared *pBt; /* The tree being checked out */
4891648940
Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
48917
- Pgno nPage; /* Number of pages in the database */
4891848941
int *anRef; /* Number of times each page is referenced */
48942
+ Pgno nPage; /* Number of pages in the database */
4891948943
int mxErr; /* Stop accumulating errors when this reaches zero */
4892048944
int nErr; /* Number of messages written to zErrMsg so far */
4892148945
int mallocFailed; /* A memory allocation error has occurred */
4892248946
StrAccum errMsg; /* Accumulate the error message text here */
4892348947
};
@@ -50073,16 +50097,14 @@
5007350097
static u8 *findOverflowCell(MemPage *pPage, int iCell){
5007450098
int i;
5007550099
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5007650100
for(i=pPage->nOverflow-1; i>=0; i--){
5007750101
int k;
50078
- struct _OvflCell *pOvfl;
50079
- pOvfl = &pPage->aOvfl[i];
50080
- k = pOvfl->idx;
50102
+ k = pPage->aiOvfl[i];
5008150103
if( k<=iCell ){
5008250104
if( k==iCell ){
50083
- return pOvfl->pCell;
50105
+ return pPage->apOvfl[i];
5008450106
}
5008550107
iCell--;
5008650108
}
5008750109
}
5008850110
return findCell(pPage, iCell);
@@ -50892,15 +50914,12 @@
5089250914
** when sqlite3BtreeClose() is called.
5089350915
**
5089450916
** If zFilename is ":memory:" then an in-memory database is created
5089550917
** that is automatically destroyed when it is closed.
5089650918
**
50897
-** The "flags" parameter is a bitmask that might contain bits
50898
-** BTREE_OMIT_JOURNAL and/or BTREE_NO_READLOCK. The BTREE_NO_READLOCK
50899
-** bit is also set if the SQLITE_NoReadlock flags is set in db->flags.
50900
-** These flags are passed through into sqlite3PagerOpen() and must
50901
-** be the same values as PAGER_OMIT_JOURNAL and PAGER_NO_READLOCK.
50919
+** The "flags" parameter is a bitmask that might contain bits like
50920
+** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY.
5090250921
**
5090350922
** If the database is already opened in the same database connection
5090450923
** and we are in shared cache mode, then the open will fail with an
5090550924
** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared
5090650925
** objects in the same database connection since doing so will lead
@@ -50943,13 +50962,10 @@
5094350962
assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );
5094450963
5094550964
/* A BTREE_SINGLE database is always a temporary and/or ephemeral */
5094650965
assert( (flags & BTREE_SINGLE)==0 || isTempDb );
5094750966
50948
- if( db->flags & SQLITE_NoReadlock ){
50949
- flags |= BTREE_NO_READLOCK;
50950
- }
5095150967
if( isMemdb ){
5095250968
flags |= BTREE_MEMORY;
5095350969
}
5095450970
if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
5095550971
vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
@@ -53397,11 +53413,11 @@
5339753413
return SQLITE_CORRUPT_BKPT;
5339853414
}
5339953415
return SQLITE_OK;
5340053416
}
5340153417
53402
-#ifndef NDEBUG
53418
+#if 0
5340353419
/*
5340453420
** Page pParent is an internal (non-leaf) tree page. This function
5340553421
** asserts that page number iChild is the left-child if the iIdx'th
5340653422
** cell in page pParent. Or, if iIdx is equal to the total number of
5340753423
** cells in pParent, that page number iChild is the right-child of
@@ -53430,15 +53446,25 @@
5343053446
static void moveToParent(BtCursor *pCur){
5343153447
assert( cursorHoldsMutex(pCur) );
5343253448
assert( pCur->eState==CURSOR_VALID );
5343353449
assert( pCur->iPage>0 );
5343453450
assert( pCur->apPage[pCur->iPage] );
53451
+
53452
+ /* UPDATE: It is actually possible for the condition tested by the assert
53453
+ ** below to be untrue if the database file is corrupt. This can occur if
53454
+ ** one cursor has modified page pParent while a reference to it is held
53455
+ ** by a second cursor. Which can only happen if a single page is linked
53456
+ ** into more than one b-tree structure in a corrupt database. */
53457
+#if 0
5343553458
assertParentIndex(
5343653459
pCur->apPage[pCur->iPage-1],
5343753460
pCur->aiIdx[pCur->iPage-1],
5343853461
pCur->apPage[pCur->iPage]->pgno
5343953462
);
53463
+#endif
53464
+ testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );
53465
+
5344053466
releasePage(pCur->apPage[pCur->iPage]);
5344153467
pCur->iPage--;
5344253468
pCur->info.nSize = 0;
5344353469
pCur->validNKey = 0;
5344453470
}
@@ -53904,11 +53930,17 @@
5390453930
pCur->skipNext = 0;
5390553931
5390653932
pPage = pCur->apPage[pCur->iPage];
5390753933
idx = ++pCur->aiIdx[pCur->iPage];
5390853934
assert( pPage->isInit );
53909
- assert( idx<=pPage->nCell );
53935
+
53936
+ /* If the database file is corrupt, it is possible for the value of idx
53937
+ ** to be invalid here. This can only occur if a second cursor modifies
53938
+ ** the page while cursor pCur is holding a reference to it. Which can
53939
+ ** only happen if the database is corrupt in such a way as to link the
53940
+ ** page into more than one b-tree structure. */
53941
+ testcase( idx>pPage->nCell );
5391053942
5391153943
pCur->info.nSize = 0;
5391253944
pCur->validNKey = 0;
5391353945
if( idx>=pPage->nCell ){
5391453946
if( !pPage->leaf ){
@@ -54714,11 +54746,11 @@
5471454746
** content of the cell.
5471554747
**
5471654748
** If the cell content will fit on the page, then put it there. If it
5471754749
** will not fit, then make a copy of the cell content into pTemp if
5471854750
** pTemp is not null. Regardless of pTemp, allocate a new entry
54719
-** in pPage->aOvfl[] and make it point to the cell content (either
54751
+** in pPage->apOvfl[] and make it point to the cell content (either
5472054752
** in pTemp or the original pCell) and also record its index.
5472154753
** Allocating a new entry in pPage->aCell[] implies that
5472254754
** pPage->nOverflow is incremented.
5472354755
**
5472454756
** If nSkip is non-zero, then do not copy the first nSkip bytes of the
@@ -54748,11 +54780,12 @@
5474854780
5474954781
if( *pRC ) return;
5475054782
5475154783
assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
5475254784
assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 );
54753
- assert( pPage->nOverflow<=ArraySize(pPage->aOvfl) );
54785
+ assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
54786
+ assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
5475454787
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
5475554788
/* The cell should normally be sized correctly. However, when moving a
5475654789
** malformed cell from a leaf page to an interior page, if the cell size
5475754790
** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
5475854791
** might be less than 8 (leaf-size + pointer) on the interior node. Hence
@@ -54765,13 +54798,13 @@
5476554798
}
5476654799
if( iChild ){
5476754800
put4byte(pCell, iChild);
5476854801
}
5476954802
j = pPage->nOverflow++;
54770
- assert( j<(int)(sizeof(pPage->aOvfl)/sizeof(pPage->aOvfl[0])) );
54771
- pPage->aOvfl[j].pCell = pCell;
54772
- pPage->aOvfl[j].idx = (u16)i;
54803
+ assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) );
54804
+ pPage->apOvfl[j] = pCell;
54805
+ pPage->aiOvfl[j] = (u16)i;
5477354806
}else{
5477454807
int rc = sqlite3PagerWrite(pPage->pDbPage);
5477554808
if( rc!=SQLITE_OK ){
5477654809
*pRC = rc;
5477754810
return;
@@ -54915,11 +54948,11 @@
5491554948
rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
5491654949
5491754950
if( rc==SQLITE_OK ){
5491854951
5491954952
u8 *pOut = &pSpace[4];
54920
- u8 *pCell = pPage->aOvfl[0].pCell;
54953
+ u8 *pCell = pPage->apOvfl[0];
5492154954
u16 szCell = cellSizePtr(pPage, pCell);
5492254955
u8 *pStop;
5492354956
5492454957
assert( sqlite3PagerIswriteable(pNew->pDbPage) );
5492554958
assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
@@ -55025,11 +55058,11 @@
5502555058
** parent page stored in the pointer map is page pTo. If pFrom contained
5502655059
** any cells with overflow page pointers, then the corresponding pointer
5502755060
** map entries are also updated so that the parent page is page pTo.
5502855061
**
5502955062
** If pFrom is currently carrying any overflow cells (entries in the
55030
-** MemPage.aOvfl[] array), they are not copied to pTo.
55063
+** MemPage.apOvfl[] array), they are not copied to pTo.
5503155064
**
5503255065
** Before returning, page pTo is reinitialized using btreeInitPage().
5503355066
**
5503455067
** The performance of this function is not critical. It is only used by
5503555068
** the balance_shallower() and balance_deeper() procedures, neither of
@@ -55162,11 +55195,11 @@
5516255195
** this overflow cell is present, it must be the cell with
5516355196
** index iParentIdx. This scenario comes about when this function
5516455197
** is called (indirectly) from sqlite3BtreeDelete().
5516555198
*/
5516655199
assert( pParent->nOverflow==0 || pParent->nOverflow==1 );
55167
- assert( pParent->nOverflow==0 || pParent->aOvfl[0].idx==iParentIdx );
55200
+ assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
5516855201
5516955202
if( !aOvflSpace ){
5517055203
return SQLITE_NOMEM;
5517155204
}
5517255205
@@ -55209,12 +55242,12 @@
5520955242
goto balance_cleanup;
5521055243
}
5521155244
nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
5521255245
if( (i--)==0 ) break;
5521355246
55214
- if( i+nxDiv==pParent->aOvfl[0].idx && pParent->nOverflow ){
55215
- apDiv[i] = pParent->aOvfl[0].pCell;
55247
+ if( i+nxDiv==pParent->aiOvfl[0] && pParent->nOverflow ){
55248
+ apDiv[i] = pParent->apOvfl[0];
5521655249
pgno = get4byte(apDiv[i]);
5521755250
szNew[i] = cellSizePtr(pParent, apDiv[i]);
5521855251
pParent->nOverflow = 0;
5521955252
}else{
5522055253
apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);
@@ -55651,11 +55684,11 @@
5565155684
** actually moved between pages. */
5565255685
MemPage *pNew = apNew[0];
5565355686
MemPage *pOld = apCopy[0];
5565455687
int nOverflow = pOld->nOverflow;
5565555688
int iNextOld = pOld->nCell + nOverflow;
55656
- int iOverflow = (nOverflow ? pOld->aOvfl[0].idx : -1);
55689
+ int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1);
5565755690
j = 0; /* Current 'old' sibling page */
5565855691
k = 0; /* Current 'new' sibling page */
5565955692
for(i=0; i<nCell; i++){
5566055693
int isDivider = 0;
5566155694
while( i==iNextOld ){
@@ -55665,18 +55698,18 @@
5566555698
assert( j+1 < ArraySize(apCopy) );
5566655699
pOld = apCopy[++j];
5566755700
iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
5566855701
if( pOld->nOverflow ){
5566955702
nOverflow = pOld->nOverflow;
55670
- iOverflow = i + !leafData + pOld->aOvfl[0].idx;
55703
+ iOverflow = i + !leafData + pOld->aiOvfl[0];
5567155704
}
5567255705
isDivider = !leafData;
5567355706
}
5567455707
5567555708
assert(nOverflow>0 || iOverflow<i );
55676
- assert(nOverflow<2 || pOld->aOvfl[0].idx==pOld->aOvfl[1].idx-1);
55677
- assert(nOverflow<3 || pOld->aOvfl[1].idx==pOld->aOvfl[2].idx-1);
55709
+ assert(nOverflow<2 || pOld->aiOvfl[0]==pOld->aiOvfl[1]-1);
55710
+ assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1);
5567855711
if( i==iOverflow ){
5567955712
isDivider = 1;
5568055713
if( (--nOverflow)>0 ){
5568155714
iOverflow++;
5568255715
}
@@ -55793,11 +55826,14 @@
5579355826
assert( pChild->nCell==pRoot->nCell );
5579455827
5579555828
TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
5579655829
5579755830
/* Copy the overflow cells from pRoot to pChild */
55798
- memcpy(pChild->aOvfl, pRoot->aOvfl, pRoot->nOverflow*sizeof(pRoot->aOvfl[0]));
55831
+ memcpy(pChild->aiOvfl, pRoot->aiOvfl,
55832
+ pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
55833
+ memcpy(pChild->apOvfl, pRoot->apOvfl,
55834
+ pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));
5579955835
pChild->nOverflow = pRoot->nOverflow;
5580055836
5580155837
/* Zero the contents of pRoot. Then install pChild as the right-child. */
5580255838
zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);
5580355839
put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);
@@ -55856,11 +55892,11 @@
5585655892
rc = sqlite3PagerWrite(pParent->pDbPage);
5585755893
if( rc==SQLITE_OK ){
5585855894
#ifndef SQLITE_OMIT_QUICKBALANCE
5585955895
if( pPage->hasData
5586055896
&& pPage->nOverflow==1
55861
- && pPage->aOvfl[0].idx==pPage->nCell
55897
+ && pPage->aiOvfl[0]==pPage->nCell
5586255898
&& pParent->pgno!=1
5586355899
&& pParent->nCell==iIdx
5586455900
){
5586555901
/* Call balance_quick() to create a new sibling of pPage on which
5586655902
** to store the overflow cell. balance_quick() inserts a new cell
@@ -58277,10 +58313,11 @@
5827758313
5827858314
if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
5827958315
memcpy(pMem->zMalloc, pMem->z, pMem->n);
5828058316
}
5828158317
if( pMem->flags&MEM_Dyn && pMem->xDel ){
58318
+ assert( pMem->xDel!=SQLITE_DYNAMIC );
5828258319
pMem->xDel((void *)(pMem->z));
5828358320
}
5828458321
5828558322
pMem->z = pMem->zMalloc;
5828658323
if( pMem->z==0 ){
@@ -58456,10 +58493,11 @@
5845658493
sqlite3VdbeMemFinalize(p, p->u.pDef);
5845758494
assert( (p->flags & MEM_Agg)==0 );
5845858495
sqlite3VdbeMemRelease(p);
5845958496
}else if( p->flags&MEM_Dyn && p->xDel ){
5846058497
assert( (p->flags&MEM_RowSet)==0 );
58498
+ assert( p->xDel!=SQLITE_DYNAMIC );
5846158499
p->xDel((void *)p->z);
5846258500
p->xDel = 0;
5846358501
}else if( p->flags&MEM_RowSet ){
5846458502
sqlite3RowSetClear(p->u.pRowSet);
5846558503
}else if( p->flags&MEM_Frame ){
@@ -59573,18 +59611,15 @@
5957359611
** Hence, a negative P2 value is a label that has yet to be resolved.
5957459612
**
5957559613
** Zero is returned if a malloc() fails.
5957659614
*/
5957759615
SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *p){
59578
- int i;
59579
- i = p->nLabel++;
59616
+ int i = p->nLabel++;
5958059617
assert( p->magic==VDBE_MAGIC_INIT );
59581
- if( i>=p->nLabelAlloc ){
59582
- int n = p->nLabelAlloc*2 + 5;
59583
- p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
59584
- n*sizeof(p->aLabel[0]));
59585
- p->nLabelAlloc = sqlite3DbMallocSize(p->db, p->aLabel)/sizeof(p->aLabel[0]);
59618
+ if( (i & (i-1))==0 ){
59619
+ p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
59620
+ (i*2+1)*sizeof(p->aLabel[0]));
5958659621
}
5958759622
if( p->aLabel ){
5958859623
p->aLabel[i] = -1;
5958959624
}
5959059625
return -1-i;
@@ -61625,16 +61660,10 @@
6162561660
}else{
6162661661
sqlite3VdbeSetChanges(db, 0);
6162761662
}
6162861663
p->nChange = 0;
6162961664
}
61630
-
61631
- /* Rollback or commit any schema changes that occurred. */
61632
- if( p->rc!=SQLITE_OK && db->flags&SQLITE_InternChanges ){
61633
- sqlite3ResetInternalSchema(db, -1);
61634
- db->flags = (db->flags | SQLITE_InternChanges);
61635
- }
6163661665
6163761666
/* Release the locks */
6163861667
sqlite3VdbeLeave(p);
6163961668
}
6164061669
@@ -66051,23 +66080,30 @@
6605166080
arithmetic_result_is_null:
6605266081
sqlite3VdbeMemSetNull(pOut);
6605366082
break;
6605466083
}
6605566084
66056
-/* Opcode: CollSeq * * P4
66085
+/* Opcode: CollSeq P1 * * P4
6605766086
**
6605866087
** P4 is a pointer to a CollSeq struct. If the next call to a user function
6605966088
** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will
6606066089
** be returned. This is used by the built-in min(), max() and nullif()
6606166090
** functions.
66091
+**
66092
+** If P1 is not zero, then it is a register that a subsequent min() or
66093
+** max() aggregate will set to 1 if the current row is not the minimum or
66094
+** maximum. The P1 register is initialized to 0 by this instruction.
6606266095
**
6606366096
** The interface used by the implementation of the aforementioned functions
6606466097
** to retrieve the collation sequence set by this opcode is not available
6606566098
** publicly, only to user functions defined in func.c.
6606666099
*/
6606766100
case OP_CollSeq: {
6606866101
assert( pOp->p4type==P4_COLLSEQ );
66102
+ if( pOp->p1 ){
66103
+ sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0);
66104
+ }
6606966105
break;
6607066106
}
6607166107
6607266108
/* Opcode: Function P1 P2 P3 P4 P5
6607366109
**
@@ -67597,11 +67633,11 @@
6759767633
** If a write-transaction is started and the Vdbe.usesStmtJournal flag is
6759867634
** true (this flag is set if the Vdbe may modify more than one row and may
6759967635
** throw an ABORT exception), a statement transaction may also be opened.
6760067636
** More specifically, a statement transaction is opened iff the database
6760167637
** connection is currently not in autocommit mode, or if there are other
67602
-** active statements. A statement transaction allows the affects of this
67638
+** active statements. A statement transaction allows the changes made by this
6760367639
** VDBE to be rolled back after an error without having to roll back the
6760467640
** entire transaction. If no error is encountered, the statement transaction
6760567641
** will automatically commit when the VDBE halts.
6760667642
**
6760767643
** If P2 is zero, then a read-lock is obtained on the database file.
@@ -69641,10 +69677,11 @@
6964169677
if( rc==SQLITE_OK ) rc = u.by.initData.rc;
6964269678
sqlite3DbFree(db, u.by.zSql);
6964369679
db->init.busy = 0;
6964469680
}
6964569681
}
69682
+ if( rc ) sqlite3ResetInternalSchema(db, -1);
6964669683
if( rc==SQLITE_NOMEM ){
6964769684
goto no_mem;
6964869685
}
6964969686
break;
6965069687
}
@@ -69983,11 +70020,10 @@
6998370020
p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
6998470021
p->aOp = aOp = u.cc.pProgram->aOp;
6998570022
p->nOp = u.cc.pProgram->nOp;
6998670023
p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
6998770024
p->nOnceFlag = u.cc.pProgram->nOnce;
69988
- p->nOp = u.cc.pProgram->nOp;
6998970025
pc = -1;
6999070026
memset(p->aOnceFlag, 0, p->nOnceFlag);
6999170027
6999270028
break;
6999370029
}
@@ -70178,10 +70214,11 @@
7017870214
u.cf.ctx.s.zMalloc = 0;
7017970215
u.cf.ctx.s.xDel = 0;
7018070216
u.cf.ctx.s.db = db;
7018170217
u.cf.ctx.isError = 0;
7018270218
u.cf.ctx.pColl = 0;
70219
+ u.cf.ctx.skipFlag = 0;
7018370220
if( u.cf.ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){
7018470221
assert( pOp>p->aOp );
7018570222
assert( pOp[-1].p4type==P4_COLLSEQ );
7018670223
assert( pOp[-1].opcode==OP_CollSeq );
7018770224
u.cf.ctx.pColl = pOp[-1].p4.pColl;
@@ -70189,10 +70226,15 @@
7018970226
(u.cf.ctx.pFunc->xStep)(&u.cf.ctx, u.cf.n, u.cf.apVal); /* IMP: R-24505-23230 */
7019070227
if( u.cf.ctx.isError ){
7019170228
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&u.cf.ctx.s));
7019270229
rc = u.cf.ctx.isError;
7019370230
}
70231
+ if( u.cf.ctx.skipFlag ){
70232
+ assert( pOp[-1].opcode==OP_CollSeq );
70233
+ u.cf.i = pOp[-1].p1;
70234
+ if( u.cf.i ) sqlite3VdbeMemSetInt64(&aMem[u.cf.i], 1);
70235
+ }
7019470236
7019570237
sqlite3VdbeMemRelease(&u.cf.ctx.s);
7019670238
7019770239
break;
7019870240
}
@@ -71582,21 +71624,21 @@
7158271624
** In other words, each time we advance to the next sorter element, log2(N)
7158371625
** key comparison operations are required, where N is the number of segments
7158471626
** being merged (rounded up to the next power of 2).
7158571627
*/
7158671628
struct VdbeSorter {
71587
- int nInMemory; /* Current size of pRecord list as PMA */
71588
- int nTree; /* Used size of aTree/aIter (power of 2) */
71589
- VdbeSorterIter *aIter; /* Array of iterators to merge */
71590
- int *aTree; /* Current state of incremental merge */
7159171629
i64 iWriteOff; /* Current write offset within file pTemp1 */
7159271630
i64 iReadOff; /* Current read offset within file pTemp1 */
71593
- sqlite3_file *pTemp1; /* PMA file 1 */
71631
+ int nInMemory; /* Current size of pRecord list as PMA */
71632
+ int nTree; /* Used size of aTree/aIter (power of 2) */
7159471633
int nPMA; /* Number of PMAs stored in pTemp1 */
71595
- SorterRecord *pRecord; /* Head of in-memory record list */
7159671634
int mnPmaSize; /* Minimum PMA size, in bytes */
7159771635
int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
71636
+ VdbeSorterIter *aIter; /* Array of iterators to merge */
71637
+ int *aTree; /* Current state of incremental merge */
71638
+ sqlite3_file *pTemp1; /* PMA file 1 */
71639
+ SorterRecord *pRecord; /* Head of in-memory record list */
7159871640
UnpackedRecord *pUnpacked; /* Used to unpack keys */
7159971641
};
7160071642
7160171643
/*
7160271644
** The following type is an iterator for a PMA. It caches the current key in
@@ -71603,14 +71645,14 @@
7160371645
** variables nKey/aKey. If the iterator is at EOF, pFile==0.
7160471646
*/
7160571647
struct VdbeSorterIter {
7160671648
i64 iReadOff; /* Current read offset */
7160771649
i64 iEof; /* 1 byte past EOF for this iterator */
71608
- sqlite3_file *pFile; /* File iterator is reading from */
7160971650
int nAlloc; /* Bytes of space at aAlloc */
71610
- u8 *aAlloc; /* Allocated space */
7161171651
int nKey; /* Number of bytes in key */
71652
+ sqlite3_file *pFile; /* File iterator is reading from */
71653
+ u8 *aAlloc; /* Allocated space */
7161271654
u8 *aKey; /* Pointer to current key */
7161371655
};
7161471656
7161571657
/*
7161671658
** A structure to store a single record. All in-memory records are connected
@@ -75093,12 +75135,13 @@
7509375135
int i;
7509475136
if( p==0 ) return 0;
7509575137
pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
7509675138
if( pNew==0 ) return 0;
7509775139
pNew->iECursor = 0;
75098
- pNew->nExpr = pNew->nAlloc = p->nExpr;
75099
- pNew->a = pItem = sqlite3DbMallocRaw(db, p->nExpr*sizeof(p->a[0]) );
75140
+ pNew->nExpr = i = p->nExpr;
75141
+ if( (flags & EXPRDUP_REDUCE)==0 ) for(i=1; i<p->nExpr; i+=i){}
75142
+ pNew->a = pItem = sqlite3DbMallocRaw(db, i*sizeof(p->a[0]) );
7510075143
if( pItem==0 ){
7510175144
sqlite3DbFree(db, pNew);
7510275145
return 0;
7510375146
}
7510475147
pOldItem = p->a;
@@ -75162,16 +75205,19 @@
7516275205
IdList *pNew;
7516375206
int i;
7516475207
if( p==0 ) return 0;
7516575208
pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
7516675209
if( pNew==0 ) return 0;
75167
- pNew->nId = pNew->nAlloc = p->nId;
75210
+ pNew->nId = p->nId;
7516875211
pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );
7516975212
if( pNew->a==0 ){
7517075213
sqlite3DbFree(db, pNew);
7517175214
return 0;
7517275215
}
75216
+ /* Note that because the size of the allocation for p->a[] is not
75217
+ ** necessarily a power of two, sqlite3IdListAppend() may not be called
75218
+ ** on the duplicate created by this function. */
7517375219
for(i=0; i<p->nId; i++){
7517475220
struct IdList_item *pNewItem = &pNew->a[i];
7517575221
struct IdList_item *pOldItem = &p->a[i];
7517675222
pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
7517775223
pNewItem->idx = pOldItem->idx;
@@ -75229,21 +75275,20 @@
7522975275
if( pList==0 ){
7523075276
pList = sqlite3DbMallocZero(db, sizeof(ExprList) );
7523175277
if( pList==0 ){
7523275278
goto no_mem;
7523375279
}
75234
- assert( pList->nAlloc==0 );
75235
- }
75236
- if( pList->nAlloc<=pList->nExpr ){
75280
+ pList->a = sqlite3DbMallocRaw(db, sizeof(pList->a[0]));
75281
+ if( pList->a==0 ) goto no_mem;
75282
+ }else if( (pList->nExpr & (pList->nExpr-1))==0 ){
7523775283
struct ExprList_item *a;
75238
- int n = pList->nAlloc*2 + 4;
75239
- a = sqlite3DbRealloc(db, pList->a, n*sizeof(pList->a[0]));
75284
+ assert( pList->nExpr>0 );
75285
+ a = sqlite3DbRealloc(db, pList->a, pList->nExpr*2*sizeof(pList->a[0]));
7524075286
if( a==0 ){
7524175287
goto no_mem;
7524275288
}
7524375289
pList->a = a;
75244
- pList->nAlloc = sqlite3DbMallocSize(db, a)/sizeof(a[0]);
7524575290
}
7524675291
assert( pList->a!=0 );
7524775292
if( 1 ){
7524875293
struct ExprList_item *pItem = &pList->a[pList->nExpr++];
7524975294
memset(pItem, 0, sizeof(*pItem));
@@ -75330,12 +75375,11 @@
7533075375
*/
7533175376
SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
7533275377
int i;
7533375378
struct ExprList_item *pItem;
7533475379
if( pList==0 ) return;
75335
- assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
75336
- assert( pList->nExpr<=pList->nAlloc );
75380
+ assert( pList->a!=0 || pList->nExpr==0 );
7533775381
for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
7533875382
sqlite3ExprDelete(db, pItem->pExpr);
7533975383
sqlite3DbFree(db, pItem->zName);
7534075384
sqlite3DbFree(db, pItem->zSpan);
7534175385
}
@@ -78012,13 +78056,11 @@
7801278056
int i;
7801378057
pInfo->aCol = sqlite3ArrayAllocate(
7801478058
db,
7801578059
pInfo->aCol,
7801678060
sizeof(pInfo->aCol[0]),
78017
- 3,
7801878061
&pInfo->nColumn,
78019
- &pInfo->nColumnAlloc,
7802078062
&i
7802178063
);
7802278064
return i;
7802378065
}
7802478066
@@ -78030,13 +78072,11 @@
7803078072
int i;
7803178073
pInfo->aFunc = sqlite3ArrayAllocate(
7803278074
db,
7803378075
pInfo->aFunc,
7803478076
sizeof(pInfo->aFunc[0]),
78035
- 3,
7803678077
&pInfo->nFunc,
78037
- &pInfo->nFuncAlloc,
7803878078
&i
7803978079
);
7804078080
return i;
7804178081
}
7804278082
@@ -78809,11 +78849,11 @@
7880978849
"name = CASE "
7881078850
"WHEN type='table' THEN %Q "
7881178851
"WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
7881278852
"'sqlite_autoindex_' || %Q || substr(name,%d+18) "
7881378853
"ELSE name END "
78814
- "WHERE tbl_name=%Q AND "
78854
+ "WHERE tbl_name=%Q COLLATE nocase AND "
7881578855
"(type='table' OR type='index' OR type='trigger');",
7881678856
zDb, SCHEMA_TABLE(iDb), zName, zName, zName,
7881778857
#ifndef SQLITE_OMIT_TRIGGER
7881878858
zName,
7881978859
#endif
@@ -82678,11 +82718,10 @@
8267882718
assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
8267982719
db->mallocFailed = 1;
8268082720
return;
8268182721
}
8268282722
pParse->pNewTable = 0;
82683
- db->nTable++;
8268482723
db->flags |= SQLITE_InternChanges;
8268582724
8268682725
#ifndef SQLITE_OMIT_ALTERTABLE
8268782726
if( !p->pSelect ){
8268882727
const char *zName = (const char *)pParse->sNameToken.z;
@@ -84099,31 +84138,27 @@
8409984138
*/
8410084139
SQLITE_PRIVATE void *sqlite3ArrayAllocate(
8410184140
sqlite3 *db, /* Connection to notify of malloc failures */
8410284141
void *pArray, /* Array of objects. Might be reallocated */
8410384142
int szEntry, /* Size of each object in the array */
84104
- int initSize, /* Suggested initial allocation, in elements */
8410584143
int *pnEntry, /* Number of objects currently in use */
84106
- int *pnAlloc, /* Current size of the allocation, in elements */
8410784144
int *pIdx /* Write the index of a new slot here */
8410884145
){
8410984146
char *z;
84110
- if( *pnEntry >= *pnAlloc ){
84111
- void *pNew;
84112
- int newSize;
84113
- newSize = (*pnAlloc)*2 + initSize;
84114
- pNew = sqlite3DbRealloc(db, pArray, newSize*szEntry);
84147
+ int n = *pnEntry;
84148
+ if( (n & (n-1))==0 ){
84149
+ int sz = (n==0) ? 1 : 2*n;
84150
+ void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);
8411584151
if( pNew==0 ){
8411684152
*pIdx = -1;
8411784153
return pArray;
8411884154
}
84119
- *pnAlloc = sqlite3DbMallocSize(db, pNew)/szEntry;
8412084155
pArray = pNew;
8412184156
}
8412284157
z = (char*)pArray;
84123
- memset(&z[*pnEntry * szEntry], 0, szEntry);
84124
- *pIdx = *pnEntry;
84158
+ memset(&z[n * szEntry], 0, szEntry);
84159
+ *pIdx = n;
8412584160
++*pnEntry;
8412684161
return pArray;
8412784162
}
8412884163
8412984164
/*
@@ -84135,19 +84170,16 @@
8413584170
SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){
8413684171
int i;
8413784172
if( pList==0 ){
8413884173
pList = sqlite3DbMallocZero(db, sizeof(IdList) );
8413984174
if( pList==0 ) return 0;
84140
- pList->nAlloc = 0;
8414184175
}
8414284176
pList->a = sqlite3ArrayAllocate(
8414384177
db,
8414484178
pList->a,
8414584179
sizeof(pList->a[0]),
84146
- 5,
8414784180
&pList->nId,
84148
- &pList->nAlloc,
8414984181
&i
8415084182
);
8415184183
if( i<0 ){
8415284184
sqlite3IdListDelete(db, pList);
8415384185
return 0;
@@ -86002,10 +86034,18 @@
8600286034
** Return the collating function associated with a function.
8600386035
*/
8600486036
static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
8600586037
return context->pColl;
8600686038
}
86039
+
86040
+/*
86041
+** Indicate that the accumulator load should be skipped on this
86042
+** iteration of the aggregate loop.
86043
+*/
86044
+static void sqlite3SkipAccumulatorLoad(sqlite3_context *context){
86045
+ context->skipFlag = 1;
86046
+}
8600786047
8600886048
/*
8600986049
** Implementation of the non-aggregate min() and max() functions
8601086050
*/
8601186051
static void minmaxFunc(
@@ -87309,15 +87349,16 @@
8730987349
){
8731087350
Mem *pArg = (Mem *)argv[0];
8731187351
Mem *pBest;
8731287352
UNUSED_PARAMETER(NotUsed);
8731387353
87314
- if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
8731587354
pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
8731687355
if( !pBest ) return;
8731787356
87318
- if( pBest->flags ){
87357
+ if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
87358
+ if( pBest->flags ) sqlite3SkipAccumulatorLoad(context);
87359
+ }else if( pBest->flags ){
8731987360
int max;
8732087361
int cmp;
8732187362
CollSeq *pColl = sqlite3GetFuncCollSeq(context);
8732287363
/* This step function is used for both the min() and max() aggregates,
8732387364
** the only difference between the two being that the sense of the
@@ -87329,20 +87370,22 @@
8732987370
*/
8733087371
max = sqlite3_user_data(context)!=0;
8733187372
cmp = sqlite3MemCompare(pBest, pArg, pColl);
8733287373
if( (max && cmp<0) || (!max && cmp>0) ){
8733387374
sqlite3VdbeMemCopy(pBest, pArg);
87375
+ }else{
87376
+ sqlite3SkipAccumulatorLoad(context);
8733487377
}
8733587378
}else{
8733687379
sqlite3VdbeMemCopy(pBest, pArg);
8733787380
}
8733887381
}
8733987382
static void minMaxFinalize(sqlite3_context *context){
8734087383
sqlite3_value *pRes;
8734187384
pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);
8734287385
if( pRes ){
87343
- if( ALWAYS(pRes->flags) ){
87386
+ if( pRes->flags ){
8734487387
sqlite3_result_value(context, pRes);
8734587388
}
8734687389
sqlite3VdbeMemRelease(pRes);
8734787390
}
8734887391
}
@@ -91920,18 +91963,19 @@
9192091963
*/
9192191964
9192291965
/*
9192391966
** Interpret the given string as a safety level. Return 0 for OFF,
9192491967
** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
91925
-** unrecognized string argument.
91968
+** unrecognized string argument. The FULL option is disallowed
91969
+** if the omitFull parameter it 1.
9192691970
**
9192791971
** Note that the values returned are one less that the values that
9192891972
** should be passed into sqlite3BtreeSetSafetyLevel(). The is done
9192991973
** to support legacy SQL code. The safety level used to be boolean
9193091974
** and older scripts may have used numbers 0 for OFF and 1 for ON.
9193191975
*/
91932
-static u8 getSafetyLevel(const char *z){
91976
+static u8 getSafetyLevel(const char *z, int omitFull, int dflt){
9193391977
/* 123456789 123456789 */
9193491978
static const char zText[] = "onoffalseyestruefull";
9193591979
static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
9193691980
static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
9193791981
static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2};
@@ -91938,23 +91982,23 @@
9193891982
int i, n;
9193991983
if( sqlite3Isdigit(*z) ){
9194091984
return (u8)sqlite3Atoi(z);
9194191985
}
9194291986
n = sqlite3Strlen30(z);
91943
- for(i=0; i<ArraySize(iLength); i++){
91987
+ for(i=0; i<ArraySize(iLength)-omitFull; i++){
9194491988
if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
9194591989
return iValue[i];
9194691990
}
9194791991
}
91948
- return 1;
91992
+ return dflt;
9194991993
}
9195091994
9195191995
/*
9195291996
** Interpret the given string as a boolean value.
9195391997
*/
91954
-SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z){
91955
- return getSafetyLevel(z)&1;
91998
+SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z, int dflt){
91999
+ return getSafetyLevel(z,1,dflt)!=0;
9195692000
}
9195792001
9195892002
/* The sqlite3GetBoolean() function is used by other modules but the
9195992003
** remainder of this file is specific to PRAGMA processing. So omit
9196092004
** the rest of the file if PRAGMAs are omitted from the build.
@@ -92093,11 +92137,10 @@
9209392137
#ifndef SQLITE_OMIT_CHECK
9209492138
{ "ignore_check_constraints", SQLITE_IgnoreChecks },
9209592139
#endif
9209692140
/* The following is VERY experimental */
9209792141
{ "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode },
92098
- { "omit_readlock", SQLITE_NoReadlock },
9209992142
9210092143
/* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
9210192144
** flag if there are any active statements. */
9210292145
{ "read_uncommitted", SQLITE_ReadUncommitted },
9210392146
{ "recursive_triggers", SQLITE_RecTriggers },
@@ -92125,11 +92168,11 @@
9212592168
/* Foreign key support may not be enabled or disabled while not
9212692169
** in auto-commit mode. */
9212792170
mask &= ~(SQLITE_ForeignKeys);
9212892171
}
9212992172
92130
- if( sqlite3GetBoolean(zRight) ){
92173
+ if( sqlite3GetBoolean(zRight, 0) ){
9213192174
db->flags |= mask;
9213292175
}else{
9213392176
db->flags &= ~mask;
9213492177
}
9213592178
@@ -92341,11 +92384,11 @@
9234192384
if( sqlite3StrICmp(zLeft,"secure_delete")==0 ){
9234292385
Btree *pBt = pDb->pBt;
9234392386
int b = -1;
9234492387
assert( pBt!=0 );
9234592388
if( zRight ){
92346
- b = sqlite3GetBoolean(zRight);
92389
+ b = sqlite3GetBoolean(zRight, 0);
9234792390
}
9234892391
if( pId2->n==0 && b>=0 ){
9234992392
int ii;
9235092393
for(ii=0; ii<db->nDb; ii++){
9235192394
sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -92746,11 +92789,11 @@
9274692789
}else{
9274792790
if( !db->autoCommit ){
9274892791
sqlite3ErrorMsg(pParse,
9274992792
"Safety level may not be changed inside a transaction");
9275092793
}else{
92751
- pDb->safety_level = getSafetyLevel(zRight)+1;
92794
+ pDb->safety_level = getSafetyLevel(zRight,0,1)+1;
9275292795
}
9275392796
}
9275492797
}else
9275592798
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */
9275692799
@@ -92945,11 +92988,11 @@
9294592988
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
9294692989
9294792990
#ifndef NDEBUG
9294892991
if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
9294992992
if( zRight ){
92950
- if( sqlite3GetBoolean(zRight) ){
92993
+ if( sqlite3GetBoolean(zRight, 0) ){
9295192994
sqlite3ParserTrace(stderr, "parser: ");
9295292995
}else{
9295392996
sqlite3ParserTrace(0, 0);
9295492997
}
9295592998
}
@@ -92959,11 +93002,11 @@
9295993002
/* Reinstall the LIKE and GLOB functions. The variant of LIKE
9296093003
** used will be case sensitive or not depending on the RHS.
9296193004
*/
9296293005
if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
9296393006
if( zRight ){
92964
- sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight));
93007
+ sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
9296593008
}
9296693009
}else
9296793010
9296893011
#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
9296993012
# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
@@ -94385,10 +94428,11 @@
9438594428
}
9438694429
if( pEList==0 ){
9438794430
pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0));
9438894431
}
9438994432
pNew->pEList = pEList;
94433
+ if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));
9439094434
pNew->pSrc = pSrc;
9439194435
pNew->pWhere = pWhere;
9439294436
pNew->pGroupBy = pGroupBy;
9439394437
pNew->pHaving = pHaving;
9439494438
pNew->pOrderBy = pOrderBy;
@@ -95923,12 +95967,16 @@
9592395967
/* Make sure all SELECTs in the statement have the same number of elements
9592495968
** in their result sets.
9592595969
*/
9592695970
assert( p->pEList && pPrior->pEList );
9592795971
if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
95928
- sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
95929
- " do not have the same number of result columns", selectOpName(p->op));
95972
+ if( p->selFlags & SF_Values ){
95973
+ sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms");
95974
+ }else{
95975
+ sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
95976
+ " do not have the same number of result columns", selectOpName(p->op));
95977
+ }
9593095978
rc = 1;
9593195979
goto multi_select_end;
9593295980
}
9593395981
9593495982
/* Compound SELECTs that have an ORDER BY clause are handled separately.
@@ -96540,11 +96588,11 @@
9654096588
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
9654196589
if( pNew==0 ) return SQLITE_NOMEM;
9654296590
pNew->flags |= EP_IntValue;
9654396591
pNew->u.iValue = i;
9654496592
pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
96545
- pOrderBy->a[nOrderBy++].iOrderByCol = (u16)i;
96593
+ if( pOrderBy ) pOrderBy->a[nOrderBy++].iOrderByCol = (u16)i;
9654696594
}
9654796595
}
9654896596
}
9654996597
9655096598
/* Compute the comparison permutation and keyinfo that is used with
@@ -97903,10 +97951,12 @@
9790397951
** the current cursor position.
9790497952
*/
9790597953
static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
9790697954
Vdbe *v = pParse->pVdbe;
9790797955
int i;
97956
+ int regHit = 0;
97957
+ int addrHitTest = 0;
9790897958
struct AggInfo_func *pF;
9790997959
struct AggInfo_col *pC;
9791097960
9791197961
pAggInfo->directMode = 1;
9791297962
sqlite3ExprCacheClear(pParse);
@@ -97938,11 +97988,12 @@
9793897988
pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
9793997989
}
9794097990
if( !pColl ){
9794197991
pColl = pParse->db->pDfltColl;
9794297992
}
97943
- sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
97993
+ if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;
97994
+ sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
9794497995
}
9794597996
sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,
9794697997
(void*)pF->pFunc, P4_FUNCDEF);
9794797998
sqlite3VdbeChangeP5(v, (u8)nArg);
9794897999
sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
@@ -97961,16 +98012,22 @@
9796198012
** text or blob value. See ticket [883034dcb5].
9796298013
**
9796398014
** Another solution would be to change the OP_SCopy used to copy cached
9796498015
** values to an OP_Copy.
9796598016
*/
98017
+ if( regHit ){
98018
+ addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit);
98019
+ }
9796698020
sqlite3ExprCacheClear(pParse);
9796798021
for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
9796898022
sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
9796998023
}
9797098024
pAggInfo->directMode = 0;
9797198025
sqlite3ExprCacheClear(pParse);
98026
+ if( addrHitTest ){
98027
+ sqlite3VdbeJumpHere(v, addrHitTest);
98028
+ }
9797298029
}
9797398030
9797498031
/*
9797598032
** Add a single OP_Explain instruction to the VDBE to explain a simple
9797698033
** count(*) query ("SELECT count(*) FROM pTab").
@@ -98907,11 +98964,11 @@
9890798964
sqlite3ExplainPop(pVdbe);
9890898965
}
9890998966
9891098967
/* End of the structure debug printing code
9891198968
*****************************************************************************/
98912
-#endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
98969
+#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */
9891398970
9891498971
/************** End of select.c **********************************************/
9891598972
/************** Begin file table.c *******************************************/
9891698973
/*
9891798974
** 2001 September 15
@@ -101534,17 +101591,18 @@
101534101591
*/
101535101592
SQLITE_PRIVATE void sqlite3VtabBeginParse(
101536101593
Parse *pParse, /* Parsing context */
101537101594
Token *pName1, /* Name of new table, or database name */
101538101595
Token *pName2, /* Name of new table or NULL */
101539
- Token *pModuleName /* Name of the module for the virtual table */
101596
+ Token *pModuleName, /* Name of the module for the virtual table */
101597
+ int ifNotExists /* No error if the table already exists */
101540101598
){
101541101599
int iDb; /* The database the table is being created in */
101542101600
Table *pTable; /* The new virtual table */
101543101601
sqlite3 *db; /* Database connection */
101544101602
101545
- sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
101603
+ sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists);
101546101604
pTable = pParse->pNewTable;
101547101605
if( pTable==0 ) return;
101548101606
assert( 0==pTable->pIndex );
101549101607
101550101608
db = pParse->db;
@@ -101575,11 +101633,11 @@
101575101633
** This routine takes the module argument that has been accumulating
101576101634
** in pParse->zArg[] and appends it to the list of arguments on the
101577101635
** virtual table currently under construction in pParse->pTable.
101578101636
*/
101579101637
static void addArgumentToVtab(Parse *pParse){
101580
- if( pParse->sArg.z && ALWAYS(pParse->pNewTable) ){
101638
+ if( pParse->sArg.z && pParse->pNewTable ){
101581101639
const char *z = (const char*)pParse->sArg.z;
101582101640
int n = pParse->sArg.n;
101583101641
sqlite3 *db = pParse->db;
101584101642
addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));
101585101643
}
@@ -107620,10 +107678,18 @@
107620107678
/*
107621107679
** An instance of this structure holds the ATTACH key and the key type.
107622107680
*/
107623107681
struct AttachKey { int type; Token key; };
107624107682
107683
+/*
107684
+** One or more VALUES claues
107685
+*/
107686
+struct ValueList {
107687
+ ExprList *pList;
107688
+ Select *pSelect;
107689
+};
107690
+
107625107691
107626107692
/* This is a utility routine used to set the ExprSpan.zStart and
107627107693
** ExprSpan.zEnd values of pOut so that the span covers the complete
107628107694
** range of text beginning with pStart and going to the end of pEnd.
107629107695
*/
@@ -107743,40 +107809,41 @@
107743107809
** YYNRULE the number of rules in the grammar
107744107810
** YYERRORSYMBOL is the code number of the error symbol. If not
107745107811
** defined, then do no error processing.
107746107812
*/
107747107813
#define YYCODETYPE unsigned char
107748
-#define YYNOCODE 253
107814
+#define YYNOCODE 251
107749107815
#define YYACTIONTYPE unsigned short int
107750107816
#define YYWILDCARD 67
107751107817
#define sqlite3ParserTOKENTYPE Token
107752107818
typedef union {
107753107819
int yyinit;
107754107820
sqlite3ParserTOKENTYPE yy0;
107755
- int yy4;
107756
- struct TrigEvent yy90;
107757
- ExprSpan yy118;
107758
- TriggerStep* yy203;
107759
- u8 yy210;
107760
- struct {int value; int mask;} yy215;
107761
- SrcList* yy259;
107762
- struct LimitVal yy292;
107763
- Expr* yy314;
107764
- ExprList* yy322;
107765
- struct LikeOp yy342;
107766
- IdList* yy384;
107767
- Select* yy387;
107821
+ struct LimitVal yy64;
107822
+ Expr* yy122;
107823
+ Select* yy159;
107824
+ IdList* yy180;
107825
+ struct {int value; int mask;} yy207;
107826
+ u8 yy258;
107827
+ struct LikeOp yy318;
107828
+ TriggerStep* yy327;
107829
+ ExprSpan yy342;
107830
+ SrcList* yy347;
107831
+ int yy392;
107832
+ struct TrigEvent yy410;
107833
+ ExprList* yy442;
107834
+ struct ValueList yy487;
107768107835
} YYMINORTYPE;
107769107836
#ifndef YYSTACKDEPTH
107770107837
#define YYSTACKDEPTH 100
107771107838
#endif
107772107839
#define sqlite3ParserARG_SDECL Parse *pParse;
107773107840
#define sqlite3ParserARG_PDECL ,Parse *pParse
107774107841
#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
107775107842
#define sqlite3ParserARG_STORE yypParser->pParse = pParse
107776
-#define YYNSTATE 630
107777
-#define YYNRULE 329
107843
+#define YYNSTATE 629
107844
+#define YYNRULE 327
107778107845
#define YYFALLBACK 1
107779107846
#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
107780107847
#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
107781107848
#define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
107782107849
@@ -107842,477 +107909,480 @@
107842107909
** shifting terminals.
107843107910
** yy_reduce_ofst[] For each state, the offset into yy_action for
107844107911
** shifting non-terminals after a reduce.
107845107912
** yy_default[] Default action for each state.
107846107913
*/
107847
-#define YY_ACTTAB_COUNT (1557)
107914
+#define YY_ACTTAB_COUNT (1580)
107848107915
static const YYACTIONTYPE yy_action[] = {
107849
- /* 0 */ 313, 960, 186, 419, 2, 172, 627, 597, 55, 55,
107850
- /* 10 */ 55, 55, 48, 53, 53, 53, 53, 52, 52, 51,
107851
- /* 20 */ 51, 51, 50, 238, 302, 283, 623, 622, 516, 515,
107852
- /* 30 */ 590, 584, 55, 55, 55, 55, 282, 53, 53, 53,
107853
- /* 40 */ 53, 52, 52, 51, 51, 51, 50, 238, 6, 56,
107854
- /* 50 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107855
- /* 60 */ 55, 55, 608, 53, 53, 53, 53, 52, 52, 51,
107856
- /* 70 */ 51, 51, 50, 238, 313, 597, 409, 330, 579, 579,
107857
- /* 80 */ 32, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107858
- /* 90 */ 50, 238, 330, 217, 620, 619, 166, 411, 624, 382,
107859
- /* 100 */ 379, 378, 7, 491, 590, 584, 200, 199, 198, 58,
107860
- /* 110 */ 377, 300, 414, 621, 481, 66, 623, 622, 621, 580,
107861
- /* 120 */ 254, 601, 94, 56, 57, 47, 582, 581, 583, 583,
107862
- /* 130 */ 54, 54, 55, 55, 55, 55, 671, 53, 53, 53,
107863
- /* 140 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 532,
107864
- /* 150 */ 226, 506, 507, 133, 177, 139, 284, 385, 279, 384,
107865
- /* 160 */ 169, 197, 342, 398, 251, 226, 253, 275, 388, 167,
107866
- /* 170 */ 139, 284, 385, 279, 384, 169, 570, 236, 590, 584,
107867
- /* 180 */ 672, 240, 275, 157, 620, 619, 554, 437, 51, 51,
107868
- /* 190 */ 51, 50, 238, 343, 439, 553, 438, 56, 57, 47,
107869
- /* 200 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107870
- /* 210 */ 465, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107871
- /* 220 */ 50, 238, 313, 390, 52, 52, 51, 51, 51, 50,
107872
- /* 230 */ 238, 391, 166, 491, 566, 382, 379, 378, 409, 440,
107873
- /* 240 */ 579, 579, 252, 440, 607, 66, 377, 513, 621, 49,
107874
- /* 250 */ 46, 147, 590, 584, 621, 16, 466, 189, 621, 441,
107875
- /* 260 */ 442, 673, 526, 441, 340, 577, 595, 64, 194, 482,
107876
- /* 270 */ 434, 56, 57, 47, 582, 581, 583, 583, 54, 54,
107877
- /* 280 */ 55, 55, 55, 55, 30, 53, 53, 53, 53, 52,
107878
- /* 290 */ 52, 51, 51, 51, 50, 238, 313, 593, 593, 593,
107879
- /* 300 */ 387, 578, 606, 493, 259, 351, 258, 411, 1, 623,
107880
- /* 310 */ 622, 496, 623, 622, 65, 240, 623, 622, 597, 443,
107881
- /* 320 */ 237, 239, 414, 341, 237, 602, 590, 584, 18, 603,
107882
- /* 330 */ 166, 601, 87, 382, 379, 378, 67, 623, 622, 38,
107883
- /* 340 */ 623, 622, 176, 270, 377, 56, 57, 47, 582, 581,
107884
- /* 350 */ 583, 583, 54, 54, 55, 55, 55, 55, 175, 53,
107885
- /* 360 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107886
- /* 370 */ 313, 396, 233, 411, 531, 565, 317, 620, 619, 44,
107887
- /* 380 */ 620, 619, 240, 206, 620, 619, 597, 266, 414, 268,
107888
- /* 390 */ 409, 597, 579, 579, 352, 184, 505, 601, 73, 533,
107889
- /* 400 */ 590, 584, 466, 548, 190, 620, 619, 576, 620, 619,
107890
- /* 410 */ 547, 383, 551, 35, 332, 575, 574, 600, 504, 56,
107891
- /* 420 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107892
- /* 430 */ 55, 55, 567, 53, 53, 53, 53, 52, 52, 51,
107893
- /* 440 */ 51, 51, 50, 238, 313, 411, 561, 561, 528, 364,
107894
- /* 450 */ 259, 351, 258, 183, 361, 549, 524, 374, 411, 597,
107895
- /* 460 */ 414, 240, 560, 560, 409, 604, 579, 579, 328, 601,
107896
- /* 470 */ 93, 623, 622, 414, 590, 584, 237, 564, 559, 559,
107897
- /* 480 */ 520, 402, 601, 87, 409, 210, 579, 579, 168, 421,
107898
- /* 490 */ 950, 519, 950, 56, 57, 47, 582, 581, 583, 583,
107899
- /* 500 */ 54, 54, 55, 55, 55, 55, 192, 53, 53, 53,
107900
- /* 510 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 600,
107901
- /* 520 */ 293, 563, 511, 234, 357, 146, 475, 475, 367, 411,
107902
- /* 530 */ 562, 411, 358, 542, 425, 171, 411, 215, 144, 620,
107903
- /* 540 */ 619, 544, 318, 353, 414, 203, 414, 275, 590, 584,
107904
- /* 550 */ 549, 414, 174, 601, 94, 601, 79, 558, 471, 61,
107905
- /* 560 */ 601, 79, 421, 949, 350, 949, 34, 56, 57, 47,
107906
- /* 570 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107907
- /* 580 */ 535, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107908
- /* 590 */ 50, 238, 313, 307, 424, 394, 272, 49, 46, 147,
107909
- /* 600 */ 349, 322, 4, 411, 491, 312, 321, 425, 568, 492,
107910
- /* 610 */ 216, 264, 407, 575, 574, 429, 66, 549, 414, 621,
107911
- /* 620 */ 540, 602, 590, 584, 13, 603, 621, 601, 72, 12,
107912
- /* 630 */ 618, 617, 616, 202, 210, 621, 546, 469, 422, 319,
107913
- /* 640 */ 148, 56, 57, 47, 582, 581, 583, 583, 54, 54,
107914
- /* 650 */ 55, 55, 55, 55, 338, 53, 53, 53, 53, 52,
107915
- /* 660 */ 52, 51, 51, 51, 50, 238, 313, 600, 600, 411,
107916
- /* 670 */ 39, 21, 37, 170, 237, 875, 411, 572, 572, 201,
107917
- /* 680 */ 144, 473, 538, 331, 414, 474, 143, 146, 630, 628,
107918
- /* 690 */ 334, 414, 353, 601, 68, 168, 590, 584, 132, 365,
107919
- /* 700 */ 601, 96, 307, 423, 530, 336, 49, 46, 147, 568,
107920
- /* 710 */ 406, 216, 549, 360, 529, 56, 57, 47, 582, 581,
107921
- /* 720 */ 583, 583, 54, 54, 55, 55, 55, 55, 411, 53,
107922
- /* 730 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107923
- /* 740 */ 313, 411, 605, 414, 484, 510, 172, 422, 597, 318,
107924
- /* 750 */ 496, 485, 601, 99, 411, 142, 414, 411, 231, 411,
107925
- /* 760 */ 540, 411, 359, 629, 2, 601, 97, 426, 308, 414,
107926
- /* 770 */ 590, 584, 414, 20, 414, 621, 414, 621, 601, 106,
107927
- /* 780 */ 503, 601, 105, 601, 108, 601, 109, 204, 28, 56,
107928
- /* 790 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107929
- /* 800 */ 55, 55, 411, 53, 53, 53, 53, 52, 52, 51,
107930
- /* 810 */ 51, 51, 50, 238, 313, 411, 597, 414, 411, 276,
107931
- /* 820 */ 214, 600, 411, 366, 213, 381, 601, 134, 274, 500,
107932
- /* 830 */ 414, 167, 130, 414, 621, 411, 354, 414, 376, 601,
107933
- /* 840 */ 135, 129, 601, 100, 590, 584, 601, 104, 522, 521,
107934
- /* 850 */ 414, 621, 224, 273, 600, 167, 327, 282, 600, 601,
107935
- /* 860 */ 103, 468, 521, 56, 57, 47, 582, 581, 583, 583,
107936
- /* 870 */ 54, 54, 55, 55, 55, 55, 411, 53, 53, 53,
107937
- /* 880 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 411,
107938
- /* 890 */ 27, 414, 411, 375, 276, 167, 359, 544, 50, 238,
107939
- /* 900 */ 601, 95, 128, 223, 414, 411, 165, 414, 411, 621,
107940
- /* 910 */ 411, 621, 612, 601, 102, 372, 601, 76, 590, 584,
107941
- /* 920 */ 414, 570, 236, 414, 470, 414, 167, 621, 188, 601,
107942
- /* 930 */ 98, 225, 601, 138, 601, 137, 232, 56, 45, 47,
107943
- /* 940 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107944
- /* 950 */ 411, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107945
- /* 960 */ 50, 238, 313, 276, 276, 414, 411, 276, 544, 459,
107946
- /* 970 */ 359, 171, 209, 479, 601, 136, 628, 334, 621, 621,
107947
- /* 980 */ 125, 414, 621, 368, 411, 621, 257, 540, 589, 588,
107948
- /* 990 */ 601, 75, 590, 584, 458, 446, 23, 23, 124, 414,
107949
- /* 1000 */ 326, 325, 621, 427, 324, 309, 600, 288, 601, 92,
107950
- /* 1010 */ 586, 585, 57, 47, 582, 581, 583, 583, 54, 54,
107951
- /* 1020 */ 55, 55, 55, 55, 411, 53, 53, 53, 53, 52,
107952
- /* 1030 */ 52, 51, 51, 51, 50, 238, 313, 587, 411, 414,
107953
- /* 1040 */ 411, 207, 611, 476, 171, 472, 160, 123, 601, 91,
107954
- /* 1050 */ 323, 261, 15, 414, 464, 414, 411, 621, 411, 354,
107955
- /* 1060 */ 222, 411, 601, 74, 601, 90, 590, 584, 159, 264,
107956
- /* 1070 */ 158, 414, 461, 414, 621, 600, 414, 121, 120, 25,
107957
- /* 1080 */ 601, 89, 601, 101, 621, 601, 88, 47, 582, 581,
107958
- /* 1090 */ 583, 583, 54, 54, 55, 55, 55, 55, 544, 53,
107959
- /* 1100 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107960
- /* 1110 */ 43, 405, 263, 3, 610, 264, 140, 415, 622, 24,
107961
- /* 1120 */ 410, 11, 456, 594, 118, 155, 219, 452, 408, 621,
107962
- /* 1130 */ 621, 621, 156, 43, 405, 621, 3, 286, 621, 113,
107963
- /* 1140 */ 415, 622, 111, 445, 411, 400, 557, 403, 545, 10,
107964
- /* 1150 */ 411, 408, 264, 110, 205, 436, 541, 566, 453, 414,
107965
- /* 1160 */ 621, 621, 63, 621, 435, 414, 411, 621, 601, 94,
107966
- /* 1170 */ 403, 621, 411, 337, 601, 86, 150, 40, 41, 534,
107967
- /* 1180 */ 566, 414, 242, 264, 42, 413, 412, 414, 600, 595,
107968
- /* 1190 */ 601, 85, 191, 333, 107, 451, 601, 84, 621, 539,
107969
- /* 1200 */ 40, 41, 420, 230, 411, 149, 316, 42, 413, 412,
107970
- /* 1210 */ 398, 127, 595, 315, 621, 399, 278, 625, 181, 414,
107971
- /* 1220 */ 593, 593, 593, 592, 591, 14, 450, 411, 601, 71,
107972
- /* 1230 */ 240, 621, 43, 405, 264, 3, 615, 180, 264, 415,
107973
- /* 1240 */ 622, 614, 414, 593, 593, 593, 592, 591, 14, 621,
107974
- /* 1250 */ 408, 601, 70, 621, 417, 33, 405, 613, 3, 411,
107975
- /* 1260 */ 264, 411, 415, 622, 418, 626, 178, 509, 8, 403,
107976
- /* 1270 */ 241, 416, 126, 408, 414, 621, 414, 449, 208, 566,
107977
- /* 1280 */ 240, 221, 621, 601, 83, 601, 82, 599, 297, 277,
107978
- /* 1290 */ 296, 30, 403, 31, 395, 264, 295, 397, 489, 40,
107979
- /* 1300 */ 41, 411, 566, 220, 621, 294, 42, 413, 412, 271,
107980
- /* 1310 */ 621, 595, 600, 621, 59, 60, 414, 269, 267, 623,
107981
- /* 1320 */ 622, 36, 40, 41, 621, 601, 81, 598, 235, 42,
107982
- /* 1330 */ 413, 412, 621, 621, 595, 265, 344, 411, 248, 556,
107983
- /* 1340 */ 173, 185, 593, 593, 593, 592, 591, 14, 218, 29,
107984
- /* 1350 */ 621, 543, 414, 305, 304, 303, 179, 301, 411, 566,
107985
- /* 1360 */ 454, 601, 80, 289, 335, 593, 593, 593, 592, 591,
107986
- /* 1370 */ 14, 411, 287, 414, 151, 392, 246, 260, 411, 196,
107987
- /* 1380 */ 195, 523, 601, 69, 411, 245, 414, 526, 537, 285,
107988
- /* 1390 */ 389, 595, 621, 414, 536, 601, 17, 362, 153, 414,
107989
- /* 1400 */ 466, 463, 601, 78, 154, 414, 462, 152, 601, 77,
107990
- /* 1410 */ 355, 255, 621, 455, 601, 9, 621, 386, 444, 517,
107991
- /* 1420 */ 247, 621, 593, 593, 593, 621, 621, 244, 621, 243,
107992
- /* 1430 */ 430, 518, 292, 621, 329, 621, 145, 393, 280, 513,
107993
- /* 1440 */ 291, 131, 621, 514, 621, 621, 311, 621, 259, 346,
107994
- /* 1450 */ 249, 621, 621, 229, 314, 621, 228, 512, 227, 240,
107995
- /* 1460 */ 494, 488, 310, 164, 487, 486, 373, 480, 163, 262,
107996
- /* 1470 */ 369, 371, 162, 26, 212, 478, 477, 161, 141, 363,
107997
- /* 1480 */ 467, 122, 339, 187, 119, 348, 347, 117, 116, 115,
107998
- /* 1490 */ 114, 112, 182, 457, 320, 22, 433, 432, 448, 19,
107999
- /* 1500 */ 609, 431, 428, 62, 193, 596, 573, 298, 555, 552,
108000
- /* 1510 */ 571, 404, 290, 380, 498, 510, 495, 306, 281, 499,
108001
- /* 1520 */ 250, 5, 497, 460, 345, 447, 569, 550, 238, 299,
108002
- /* 1530 */ 527, 525, 508, 961, 502, 501, 961, 401, 961, 211,
108003
- /* 1540 */ 490, 356, 256, 961, 483, 961, 961, 961, 961, 961,
108004
- /* 1550 */ 961, 961, 961, 961, 961, 961, 370,
107916
+ /* 0 */ 310, 328, 574, 573, 15, 172, 187, 596, 56, 56,
107917
+ /* 10 */ 56, 56, 49, 54, 54, 54, 54, 53, 53, 52,
107918
+ /* 20 */ 52, 52, 51, 234, 622, 621, 626, 622, 621, 299,
107919
+ /* 30 */ 589, 583, 56, 56, 56, 56, 236, 54, 54, 54,
107920
+ /* 40 */ 54, 53, 53, 52, 52, 52, 51, 234, 351, 57,
107921
+ /* 50 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107922
+ /* 60 */ 56, 56, 570, 54, 54, 54, 54, 53, 53, 52,
107923
+ /* 70 */ 52, 52, 51, 234, 310, 596, 326, 607, 233, 232,
107924
+ /* 80 */ 33, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107925
+ /* 90 */ 51, 234, 619, 618, 326, 619, 618, 166, 605, 492,
107926
+ /* 100 */ 381, 378, 377, 235, 589, 583, 554, 495, 1, 59,
107927
+ /* 110 */ 19, 376, 622, 621, 53, 53, 52, 52, 52, 51,
107928
+ /* 120 */ 234, 571, 571, 57, 58, 48, 581, 580, 582, 582,
107929
+ /* 130 */ 55, 55, 56, 56, 56, 56, 215, 54, 54, 54,
107930
+ /* 140 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 224,
107931
+ /* 150 */ 50, 47, 147, 177, 139, 281, 384, 276, 383, 169,
107932
+ /* 160 */ 408, 553, 578, 578, 622, 621, 272, 224, 439, 550,
107933
+ /* 170 */ 552, 410, 139, 281, 384, 276, 383, 169, 589, 583,
107934
+ /* 180 */ 619, 618, 280, 620, 272, 195, 413, 309, 440, 441,
107935
+ /* 190 */ 567, 491, 214, 279, 560, 600, 92, 57, 58, 48,
107936
+ /* 200 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
107937
+ /* 210 */ 559, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107938
+ /* 220 */ 51, 234, 310, 464, 233, 232, 558, 133, 519, 50,
107939
+ /* 230 */ 47, 147, 619, 618, 565, 436, 397, 515, 514, 518,
107940
+ /* 240 */ 410, 387, 438, 389, 437, 622, 621, 442, 570, 433,
107941
+ /* 250 */ 203, 390, 589, 583, 6, 413, 166, 670, 250, 381,
107942
+ /* 260 */ 378, 377, 525, 190, 600, 92, 594, 571, 571, 465,
107943
+ /* 270 */ 376, 57, 58, 48, 581, 580, 582, 582, 55, 55,
107944
+ /* 280 */ 56, 56, 56, 56, 599, 54, 54, 54, 54, 53,
107945
+ /* 290 */ 53, 52, 52, 52, 51, 234, 310, 592, 592, 592,
107946
+ /* 300 */ 490, 182, 247, 548, 249, 397, 273, 410, 7, 439,
107947
+ /* 310 */ 398, 606, 67, 619, 618, 620, 472, 256, 347, 255,
107948
+ /* 320 */ 473, 620, 413, 576, 620, 65, 589, 583, 236, 440,
107949
+ /* 330 */ 336, 600, 92, 68, 364, 192, 481, 622, 621, 547,
107950
+ /* 340 */ 622, 621, 560, 323, 207, 57, 58, 48, 581, 580,
107951
+ /* 350 */ 582, 582, 55, 55, 56, 56, 56, 56, 559, 54,
107952
+ /* 360 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
107953
+ /* 370 */ 310, 410, 397, 146, 558, 531, 401, 348, 599, 166,
107954
+ /* 380 */ 248, 204, 381, 378, 377, 541, 413, 171, 337, 570,
107955
+ /* 390 */ 622, 621, 40, 376, 38, 600, 74, 465, 548, 490,
107956
+ /* 400 */ 589, 583, 532, 350, 579, 619, 618, 297, 619, 618,
107957
+ /* 410 */ 480, 67, 470, 39, 620, 599, 406, 574, 573, 57,
107958
+ /* 420 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107959
+ /* 430 */ 56, 56, 577, 54, 54, 54, 54, 53, 53, 52,
107960
+ /* 440 */ 52, 52, 51, 234, 310, 256, 347, 255, 530, 52,
107961
+ /* 450 */ 52, 52, 51, 234, 345, 564, 236, 386, 619, 618,
107962
+ /* 460 */ 957, 185, 418, 2, 408, 410, 578, 578, 198, 197,
107963
+ /* 470 */ 196, 499, 183, 167, 589, 583, 671, 570, 505, 506,
107964
+ /* 480 */ 413, 267, 601, 672, 546, 208, 602, 36, 601, 600,
107965
+ /* 490 */ 91, 468, 602, 57, 58, 48, 581, 580, 582, 582,
107966
+ /* 500 */ 55, 55, 56, 56, 56, 56, 202, 54, 54, 54,
107967
+ /* 510 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 599,
107968
+ /* 520 */ 157, 408, 527, 578, 578, 263, 490, 265, 410, 873,
107969
+ /* 530 */ 410, 474, 474, 366, 373, 410, 504, 428, 67, 290,
107970
+ /* 540 */ 599, 620, 352, 413, 408, 413, 578, 578, 589, 583,
107971
+ /* 550 */ 413, 382, 600, 92, 600, 16, 543, 62, 503, 600,
107972
+ /* 560 */ 92, 408, 346, 578, 578, 168, 45, 57, 58, 48,
107973
+ /* 570 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
107974
+ /* 580 */ 200, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107975
+ /* 590 */ 51, 234, 310, 393, 395, 534, 510, 617, 616, 615,
107976
+ /* 600 */ 318, 314, 172, 66, 596, 410, 338, 596, 324, 571,
107977
+ /* 610 */ 571, 50, 47, 147, 599, 629, 627, 330, 539, 315,
107978
+ /* 620 */ 413, 30, 589, 583, 272, 236, 199, 144, 176, 600,
107979
+ /* 630 */ 73, 420, 947, 620, 947, 420, 946, 351, 946, 175,
107980
+ /* 640 */ 596, 57, 58, 48, 581, 580, 582, 582, 55, 55,
107981
+ /* 650 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53,
107982
+ /* 660 */ 53, 52, 52, 52, 51, 234, 310, 261, 410, 413,
107983
+ /* 670 */ 269, 208, 596, 363, 410, 596, 424, 360, 600, 69,
107984
+ /* 680 */ 424, 327, 620, 413, 50, 47, 147, 410, 358, 413,
107985
+ /* 690 */ 575, 553, 600, 94, 483, 509, 589, 583, 600, 97,
107986
+ /* 700 */ 552, 484, 413, 620, 188, 599, 551, 563, 596, 566,
107987
+ /* 710 */ 334, 600, 95, 205, 201, 57, 58, 48, 581, 580,
107988
+ /* 720 */ 582, 582, 55, 55, 56, 56, 56, 56, 352, 54,
107989
+ /* 730 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
107990
+ /* 740 */ 310, 410, 261, 410, 167, 22, 356, 599, 359, 623,
107991
+ /* 750 */ 50, 47, 147, 548, 357, 562, 413, 620, 413, 332,
107992
+ /* 760 */ 523, 270, 410, 167, 620, 600, 104, 600, 103, 603,
107993
+ /* 770 */ 589, 583, 339, 539, 304, 423, 222, 413, 174, 304,
107994
+ /* 780 */ 422, 561, 567, 405, 214, 260, 600, 106, 620, 57,
107995
+ /* 790 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107996
+ /* 800 */ 56, 56, 410, 54, 54, 54, 54, 53, 53, 52,
107997
+ /* 810 */ 52, 52, 51, 234, 310, 410, 557, 413, 410, 421,
107998
+ /* 820 */ 273, 35, 512, 146, 421, 12, 600, 107, 213, 144,
107999
+ /* 830 */ 413, 410, 32, 413, 410, 620, 365, 353, 358, 600,
108000
+ /* 840 */ 134, 11, 600, 135, 589, 583, 413, 21, 548, 413,
108001
+ /* 850 */ 316, 148, 620, 620, 170, 600, 98, 223, 600, 102,
108002
+ /* 860 */ 374, 168, 167, 57, 58, 48, 581, 580, 582, 582,
108003
+ /* 870 */ 55, 55, 56, 56, 56, 56, 410, 54, 54, 54,
108004
+ /* 880 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 410,
108005
+ /* 890 */ 273, 413, 410, 273, 212, 469, 410, 167, 628, 2,
108006
+ /* 900 */ 600, 101, 545, 221, 413, 620, 130, 413, 620, 410,
108007
+ /* 910 */ 539, 413, 537, 600, 93, 315, 600, 100, 589, 583,
108008
+ /* 920 */ 600, 77, 425, 305, 413, 620, 254, 322, 599, 458,
108009
+ /* 930 */ 320, 171, 543, 600, 96, 521, 520, 57, 58, 48,
108010
+ /* 940 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
108011
+ /* 950 */ 410, 54, 54, 54, 54, 53, 53, 52, 52, 52,
108012
+ /* 960 */ 51, 234, 310, 410, 273, 413, 410, 457, 358, 35,
108013
+ /* 970 */ 426, 230, 306, 319, 600, 138, 467, 520, 413, 620,
108014
+ /* 980 */ 143, 413, 410, 620, 410, 353, 529, 600, 137, 142,
108015
+ /* 990 */ 600, 136, 589, 583, 604, 261, 528, 413, 229, 413,
108016
+ /* 1000 */ 620, 321, 495, 28, 543, 543, 600, 76, 600, 90,
108017
+ /* 1010 */ 620, 57, 46, 48, 581, 580, 582, 582, 55, 55,
108018
+ /* 1020 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53,
108019
+ /* 1030 */ 53, 52, 52, 52, 51, 234, 310, 261, 451, 413,
108020
+ /* 1040 */ 410, 211, 611, 285, 283, 610, 609, 502, 600, 89,
108021
+ /* 1050 */ 380, 217, 620, 128, 140, 413, 220, 620, 410, 409,
108022
+ /* 1060 */ 620, 620, 588, 587, 600, 75, 589, 583, 271, 620,
108023
+ /* 1070 */ 51, 234, 127, 413, 620, 599, 627, 330, 27, 375,
108024
+ /* 1080 */ 449, 279, 600, 88, 585, 584, 58, 48, 581, 580,
108025
+ /* 1090 */ 582, 582, 55, 55, 56, 56, 56, 56, 410, 54,
108026
+ /* 1100 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
108027
+ /* 1110 */ 310, 586, 410, 413, 410, 261, 593, 165, 399, 556,
108028
+ /* 1120 */ 126, 371, 600, 87, 478, 186, 123, 413, 367, 413,
108029
+ /* 1130 */ 620, 620, 410, 620, 620, 410, 600, 99, 600, 86,
108030
+ /* 1140 */ 589, 583, 475, 122, 258, 171, 471, 413, 160, 121,
108031
+ /* 1150 */ 413, 14, 159, 463, 25, 24, 600, 17, 448, 600,
108032
+ /* 1160 */ 85, 48, 581, 580, 582, 582, 55, 55, 56, 56,
108033
+ /* 1170 */ 56, 56, 158, 54, 54, 54, 54, 53, 53, 52,
108034
+ /* 1180 */ 52, 52, 51, 234, 44, 404, 261, 3, 544, 261,
108035
+ /* 1190 */ 540, 414, 621, 460, 119, 118, 538, 275, 10, 349,
108036
+ /* 1200 */ 4, 620, 407, 620, 620, 620, 116, 44, 404, 410,
108037
+ /* 1210 */ 3, 620, 620, 410, 414, 621, 456, 454, 252, 450,
108038
+ /* 1220 */ 508, 402, 111, 109, 413, 407, 155, 444, 413, 447,
108039
+ /* 1230 */ 435, 565, 219, 600, 84, 620, 108, 600, 83, 64,
108040
+ /* 1240 */ 434, 417, 625, 150, 402, 333, 410, 237, 238, 124,
108041
+ /* 1250 */ 274, 41, 42, 533, 565, 206, 189, 261, 43, 412,
108042
+ /* 1260 */ 411, 413, 261, 594, 488, 620, 329, 149, 419, 268,
108043
+ /* 1270 */ 600, 72, 620, 266, 41, 42, 181, 620, 410, 620,
108044
+ /* 1280 */ 105, 43, 412, 411, 620, 624, 594, 614, 620, 599,
108045
+ /* 1290 */ 228, 125, 313, 413, 592, 592, 592, 591, 590, 13,
108046
+ /* 1300 */ 218, 410, 600, 71, 236, 244, 44, 404, 264, 3,
108047
+ /* 1310 */ 312, 613, 340, 414, 621, 180, 413, 592, 592, 592,
108048
+ /* 1320 */ 591, 590, 13, 620, 407, 600, 82, 410, 416, 34,
108049
+ /* 1330 */ 404, 410, 3, 410, 262, 410, 414, 621, 612, 331,
108050
+ /* 1340 */ 178, 415, 413, 402, 8, 236, 413, 407, 413, 620,
108051
+ /* 1350 */ 413, 600, 81, 565, 257, 600, 80, 600, 70, 600,
108052
+ /* 1360 */ 18, 598, 361, 462, 461, 30, 402, 294, 31, 620,
108053
+ /* 1370 */ 293, 354, 251, 41, 42, 410, 565, 620, 620, 620,
108054
+ /* 1380 */ 43, 412, 411, 453, 396, 594, 620, 620, 394, 61,
108055
+ /* 1390 */ 413, 292, 443, 622, 621, 243, 41, 42, 620, 600,
108056
+ /* 1400 */ 79, 597, 291, 43, 412, 411, 60, 620, 594, 240,
108057
+ /* 1410 */ 620, 410, 231, 37, 555, 173, 592, 592, 592, 591,
108058
+ /* 1420 */ 590, 13, 216, 239, 620, 184, 413, 302, 301, 300,
108059
+ /* 1430 */ 179, 298, 388, 565, 452, 600, 78, 286, 620, 592,
108060
+ /* 1440 */ 592, 592, 591, 590, 13, 429, 29, 413, 151, 289,
108061
+ /* 1450 */ 242, 145, 392, 194, 193, 288, 600, 9, 542, 241,
108062
+ /* 1460 */ 620, 525, 391, 284, 620, 594, 620, 620, 522, 536,
108063
+ /* 1470 */ 620, 535, 153, 385, 465, 516, 282, 325, 154, 517,
108064
+ /* 1480 */ 277, 152, 512, 511, 513, 129, 226, 308, 487, 486,
108065
+ /* 1490 */ 485, 164, 372, 493, 307, 227, 592, 592, 592, 225,
108066
+ /* 1500 */ 479, 163, 368, 370, 162, 476, 210, 477, 26, 259,
108067
+ /* 1510 */ 161, 466, 362, 141, 132, 120, 117, 455, 156, 115,
108068
+ /* 1520 */ 344, 343, 256, 342, 245, 114, 113, 446, 311, 112,
108069
+ /* 1530 */ 23, 317, 432, 236, 131, 431, 110, 430, 20, 427,
108070
+ /* 1540 */ 608, 595, 295, 63, 379, 287, 509, 191, 278, 403,
108071
+ /* 1550 */ 572, 569, 497, 498, 496, 494, 335, 459, 445, 303,
108072
+ /* 1560 */ 296, 246, 341, 355, 5, 568, 369, 507, 253, 549,
108073
+ /* 1570 */ 526, 209, 400, 501, 500, 524, 234, 958, 489, 482,
108005108074
};
108006108075
static const YYCODETYPE yy_lookahead[] = {
108007
- /* 0 */ 19, 142, 143, 144, 145, 24, 1, 26, 77, 78,
108076
+ /* 0 */ 19, 169, 170, 171, 22, 24, 24, 26, 77, 78,
108008108077
/* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
108009
- /* 20 */ 89, 90, 91, 92, 15, 98, 26, 27, 7, 8,
108010
- /* 30 */ 49, 50, 77, 78, 79, 80, 109, 82, 83, 84,
108011
- /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 22, 68,
108078
+ /* 20 */ 89, 90, 91, 92, 26, 27, 1, 26, 27, 15,
108079
+ /* 30 */ 49, 50, 77, 78, 79, 80, 116, 82, 83, 84,
108080
+ /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 128, 68,
108012108081
/* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108013
- /* 60 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88,
108014
- /* 70 */ 89, 90, 91, 92, 19, 94, 112, 19, 114, 115,
108082
+ /* 60 */ 79, 80, 230, 82, 83, 84, 85, 86, 87, 88,
108083
+ /* 70 */ 89, 90, 91, 92, 19, 94, 19, 23, 86, 87,
108015108084
/* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108016
- /* 90 */ 91, 92, 19, 22, 94, 95, 96, 150, 150, 99,
108017
- /* 100 */ 100, 101, 76, 150, 49, 50, 105, 106, 107, 54,
108018
- /* 110 */ 110, 158, 165, 165, 161, 162, 26, 27, 165, 113,
108019
- /* 120 */ 16, 174, 175, 68, 69, 70, 71, 72, 73, 74,
108020
- /* 130 */ 75, 76, 77, 78, 79, 80, 118, 82, 83, 84,
108021
- /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 23,
108022
- /* 150 */ 92, 97, 98, 24, 96, 97, 98, 99, 100, 101,
108023
- /* 160 */ 102, 25, 97, 216, 60, 92, 62, 109, 221, 25,
108024
- /* 170 */ 97, 98, 99, 100, 101, 102, 86, 87, 49, 50,
108025
- /* 180 */ 118, 116, 109, 25, 94, 95, 32, 97, 88, 89,
108026
- /* 190 */ 90, 91, 92, 128, 104, 41, 106, 68, 69, 70,
108085
+ /* 90 */ 91, 92, 94, 95, 19, 94, 95, 96, 172, 173,
108086
+ /* 100 */ 99, 100, 101, 197, 49, 50, 177, 181, 22, 54,
108087
+ /* 110 */ 204, 110, 26, 27, 86, 87, 88, 89, 90, 91,
108088
+ /* 120 */ 92, 129, 130, 68, 69, 70, 71, 72, 73, 74,
108089
+ /* 130 */ 75, 76, 77, 78, 79, 80, 22, 82, 83, 84,
108090
+ /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 92,
108091
+ /* 150 */ 221, 222, 223, 96, 97, 98, 99, 100, 101, 102,
108092
+ /* 160 */ 112, 32, 114, 115, 26, 27, 109, 92, 150, 25,
108093
+ /* 170 */ 41, 150, 97, 98, 99, 100, 101, 102, 49, 50,
108094
+ /* 180 */ 94, 95, 98, 165, 109, 25, 165, 163, 170, 171,
108095
+ /* 190 */ 166, 167, 168, 109, 12, 174, 175, 68, 69, 70,
108027108096
/* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108028
- /* 210 */ 11, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108029
- /* 220 */ 91, 92, 19, 19, 86, 87, 88, 89, 90, 91,
108030
- /* 230 */ 92, 27, 96, 150, 66, 99, 100, 101, 112, 150,
108031
- /* 240 */ 114, 115, 138, 150, 161, 162, 110, 103, 165, 222,
108032
- /* 250 */ 223, 224, 49, 50, 165, 22, 57, 24, 165, 170,
108033
- /* 260 */ 171, 118, 94, 170, 171, 23, 98, 25, 185, 186,
108034
- /* 270 */ 243, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108035
- /* 280 */ 77, 78, 79, 80, 126, 82, 83, 84, 85, 86,
108097
+ /* 210 */ 28, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108098
+ /* 220 */ 91, 92, 19, 11, 86, 87, 44, 24, 46, 221,
108099
+ /* 230 */ 222, 223, 94, 95, 66, 97, 215, 7, 8, 57,
108100
+ /* 240 */ 150, 220, 104, 19, 106, 26, 27, 229, 230, 241,
108101
+ /* 250 */ 160, 27, 49, 50, 22, 165, 96, 118, 16, 99,
108102
+ /* 260 */ 100, 101, 94, 119, 174, 175, 98, 129, 130, 57,
108103
+ /* 270 */ 110, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108104
+ /* 280 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86,
108036108105
/* 290 */ 87, 88, 89, 90, 91, 92, 19, 129, 130, 131,
108037
- /* 300 */ 88, 23, 172, 173, 105, 106, 107, 150, 22, 26,
108038
- /* 310 */ 27, 181, 26, 27, 22, 116, 26, 27, 26, 230,
108039
- /* 320 */ 231, 197, 165, 230, 231, 113, 49, 50, 204, 117,
108040
- /* 330 */ 96, 174, 175, 99, 100, 101, 22, 26, 27, 136,
108041
- /* 340 */ 26, 27, 118, 16, 110, 68, 69, 70, 71, 72,
108042
- /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 118, 82,
108106
+ /* 300 */ 150, 23, 60, 25, 62, 215, 150, 150, 76, 150,
108107
+ /* 310 */ 220, 161, 162, 94, 95, 165, 30, 105, 106, 107,
108108
+ /* 320 */ 34, 165, 165, 23, 165, 25, 49, 50, 116, 170,
108109
+ /* 330 */ 171, 174, 175, 22, 48, 185, 186, 26, 27, 120,
108110
+ /* 340 */ 26, 27, 12, 187, 160, 68, 69, 70, 71, 72,
108111
+ /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 28, 82,
108043108112
/* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108044
- /* 370 */ 19, 214, 215, 150, 23, 23, 155, 94, 95, 22,
108045
- /* 380 */ 94, 95, 116, 160, 94, 95, 94, 60, 165, 62,
108046
- /* 390 */ 112, 26, 114, 115, 128, 23, 36, 174, 175, 88,
108047
- /* 400 */ 49, 50, 57, 120, 22, 94, 95, 23, 94, 95,
108048
- /* 410 */ 120, 51, 25, 136, 169, 170, 171, 194, 58, 68,
108113
+ /* 370 */ 19, 150, 215, 95, 44, 23, 46, 220, 194, 96,
108114
+ /* 380 */ 138, 160, 99, 100, 101, 23, 165, 25, 229, 230,
108115
+ /* 390 */ 26, 27, 135, 110, 137, 174, 175, 57, 120, 150,
108116
+ /* 400 */ 49, 50, 88, 219, 113, 94, 95, 158, 94, 95,
108117
+ /* 410 */ 161, 162, 21, 136, 165, 194, 169, 170, 171, 68,
108049108118
/* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108050108119
/* 430 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88,
108051
- /* 440 */ 89, 90, 91, 92, 19, 150, 12, 12, 23, 228,
108052
- /* 450 */ 105, 106, 107, 23, 233, 25, 165, 19, 150, 94,
108053
- /* 460 */ 165, 116, 28, 28, 112, 174, 114, 115, 108, 174,
108054
- /* 470 */ 175, 26, 27, 165, 49, 50, 231, 11, 44, 44,
108055
- /* 480 */ 46, 46, 174, 175, 112, 160, 114, 115, 50, 22,
108056
- /* 490 */ 23, 57, 25, 68, 69, 70, 71, 72, 73, 74,
108057
- /* 500 */ 75, 76, 77, 78, 79, 80, 119, 82, 83, 84,
108120
+ /* 440 */ 89, 90, 91, 92, 19, 105, 106, 107, 23, 88,
108121
+ /* 450 */ 89, 90, 91, 92, 63, 23, 116, 88, 94, 95,
108122
+ /* 460 */ 142, 143, 144, 145, 112, 150, 114, 115, 105, 106,
108123
+ /* 470 */ 107, 23, 23, 25, 49, 50, 118, 230, 97, 98,
108124
+ /* 480 */ 165, 16, 113, 118, 120, 160, 117, 136, 113, 174,
108125
+ /* 490 */ 175, 100, 117, 68, 69, 70, 71, 72, 73, 74,
108126
+ /* 500 */ 75, 76, 77, 78, 79, 80, 160, 82, 83, 84,
108058108127
/* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 194,
108059
- /* 520 */ 225, 23, 23, 215, 19, 95, 105, 106, 107, 150,
108060
- /* 530 */ 23, 150, 27, 23, 67, 25, 150, 206, 207, 94,
108061
- /* 540 */ 95, 166, 104, 218, 165, 22, 165, 109, 49, 50,
108062
- /* 550 */ 120, 165, 25, 174, 175, 174, 175, 23, 21, 234,
108063
- /* 560 */ 174, 175, 22, 23, 239, 25, 25, 68, 69, 70,
108128
+ /* 520 */ 25, 112, 23, 114, 115, 60, 150, 62, 150, 138,
108129
+ /* 530 */ 150, 105, 106, 107, 19, 150, 36, 161, 162, 224,
108130
+ /* 540 */ 194, 165, 217, 165, 112, 165, 114, 115, 49, 50,
108131
+ /* 550 */ 165, 51, 174, 175, 174, 175, 166, 232, 58, 174,
108132
+ /* 560 */ 175, 112, 237, 114, 115, 50, 22, 68, 69, 70,
108064108133
/* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108065
- /* 580 */ 205, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108066
- /* 590 */ 91, 92, 19, 22, 23, 216, 23, 222, 223, 224,
108067
- /* 600 */ 63, 220, 35, 150, 150, 163, 220, 67, 166, 167,
108068
- /* 610 */ 168, 150, 169, 170, 171, 161, 162, 25, 165, 165,
108069
- /* 620 */ 150, 113, 49, 50, 25, 117, 165, 174, 175, 35,
108070
- /* 630 */ 7, 8, 9, 160, 160, 165, 120, 100, 67, 247,
108071
- /* 640 */ 248, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108072
- /* 650 */ 77, 78, 79, 80, 193, 82, 83, 84, 85, 86,
108073
- /* 660 */ 87, 88, 89, 90, 91, 92, 19, 194, 194, 150,
108074
- /* 670 */ 135, 24, 137, 35, 231, 138, 150, 129, 130, 206,
108075
- /* 680 */ 207, 30, 27, 213, 165, 34, 118, 95, 0, 1,
108076
- /* 690 */ 2, 165, 218, 174, 175, 50, 49, 50, 22, 48,
108077
- /* 700 */ 174, 175, 22, 23, 23, 244, 222, 223, 224, 166,
108078
- /* 710 */ 167, 168, 120, 239, 23, 68, 69, 70, 71, 72,
108079
- /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
108134
+ /* 580 */ 160, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108135
+ /* 590 */ 91, 92, 19, 215, 214, 205, 23, 7, 8, 9,
108136
+ /* 600 */ 215, 155, 24, 22, 26, 150, 97, 26, 108, 129,
108137
+ /* 610 */ 130, 221, 222, 223, 194, 0, 1, 2, 150, 104,
108138
+ /* 620 */ 165, 126, 49, 50, 109, 116, 206, 207, 118, 174,
108139
+ /* 630 */ 175, 22, 23, 165, 25, 22, 23, 128, 25, 118,
108140
+ /* 640 */ 26, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108141
+ /* 650 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
108142
+ /* 660 */ 87, 88, 89, 90, 91, 92, 19, 150, 150, 165,
108143
+ /* 670 */ 23, 160, 94, 227, 150, 94, 67, 231, 174, 175,
108144
+ /* 680 */ 67, 213, 165, 165, 221, 222, 223, 150, 150, 165,
108145
+ /* 690 */ 23, 32, 174, 175, 181, 182, 49, 50, 174, 175,
108146
+ /* 700 */ 41, 188, 165, 165, 22, 194, 177, 11, 94, 23,
108147
+ /* 710 */ 193, 174, 175, 160, 22, 68, 69, 70, 71, 72,
108148
+ /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 217, 82,
108080108149
/* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108081
- /* 740 */ 19, 150, 173, 165, 181, 182, 24, 67, 26, 104,
108082
- /* 750 */ 181, 188, 174, 175, 150, 39, 165, 150, 52, 150,
108083
- /* 760 */ 150, 150, 150, 144, 145, 174, 175, 249, 250, 165,
108084
- /* 770 */ 49, 50, 165, 52, 165, 165, 165, 165, 174, 175,
108085
- /* 780 */ 29, 174, 175, 174, 175, 174, 175, 160, 22, 68,
108150
+ /* 740 */ 19, 150, 150, 150, 25, 24, 19, 194, 237, 150,
108151
+ /* 750 */ 221, 222, 223, 25, 27, 23, 165, 165, 165, 242,
108152
+ /* 760 */ 165, 23, 150, 25, 165, 174, 175, 174, 175, 174,
108153
+ /* 770 */ 49, 50, 219, 150, 22, 23, 238, 165, 25, 22,
108154
+ /* 780 */ 23, 23, 166, 167, 168, 193, 174, 175, 165, 68,
108086108155
/* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108087108156
/* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88,
108088
- /* 810 */ 89, 90, 91, 92, 19, 150, 94, 165, 150, 150,
108089
- /* 820 */ 160, 194, 150, 213, 160, 52, 174, 175, 23, 23,
108090
- /* 830 */ 165, 25, 22, 165, 165, 150, 150, 165, 52, 174,
108091
- /* 840 */ 175, 22, 174, 175, 49, 50, 174, 175, 190, 191,
108092
- /* 850 */ 165, 165, 240, 23, 194, 25, 187, 109, 194, 174,
108093
- /* 860 */ 175, 190, 191, 68, 69, 70, 71, 72, 73, 74,
108157
+ /* 810 */ 89, 90, 91, 92, 19, 150, 23, 165, 150, 67,
108158
+ /* 820 */ 150, 25, 103, 95, 67, 35, 174, 175, 206, 207,
108159
+ /* 830 */ 165, 150, 25, 165, 150, 165, 213, 150, 150, 174,
108160
+ /* 840 */ 175, 35, 174, 175, 49, 50, 165, 52, 120, 165,
108161
+ /* 850 */ 245, 246, 165, 165, 35, 174, 175, 187, 174, 175,
108162
+ /* 860 */ 23, 50, 25, 68, 69, 70, 71, 72, 73, 74,
108094108163
/* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84,
108095108164
/* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150,
108096
- /* 890 */ 22, 165, 150, 23, 150, 25, 150, 166, 91, 92,
108097
- /* 900 */ 174, 175, 22, 217, 165, 150, 102, 165, 150, 165,
108098
- /* 910 */ 150, 165, 150, 174, 175, 19, 174, 175, 49, 50,
108099
- /* 920 */ 165, 86, 87, 165, 23, 165, 25, 165, 24, 174,
108100
- /* 930 */ 175, 187, 174, 175, 174, 175, 205, 68, 69, 70,
108165
+ /* 890 */ 150, 165, 150, 150, 160, 23, 150, 25, 144, 145,
108166
+ /* 900 */ 174, 175, 120, 216, 165, 165, 22, 165, 165, 150,
108167
+ /* 910 */ 150, 165, 27, 174, 175, 104, 174, 175, 49, 50,
108168
+ /* 920 */ 174, 175, 247, 248, 165, 165, 238, 187, 194, 23,
108169
+ /* 930 */ 187, 25, 166, 174, 175, 190, 191, 68, 69, 70,
108101108170
/* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108102108171
/* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108103
- /* 960 */ 91, 92, 19, 150, 150, 165, 150, 150, 166, 23,
108104
- /* 970 */ 150, 25, 160, 20, 174, 175, 1, 2, 165, 165,
108105
- /* 980 */ 104, 165, 165, 43, 150, 165, 240, 150, 49, 50,
108106
- /* 990 */ 174, 175, 49, 50, 23, 23, 25, 25, 53, 165,
108107
- /* 1000 */ 187, 187, 165, 23, 187, 25, 194, 205, 174, 175,
108108
- /* 1010 */ 71, 72, 69, 70, 71, 72, 73, 74, 75, 76,
108172
+ /* 960 */ 91, 92, 19, 150, 150, 165, 150, 23, 150, 25,
108173
+ /* 970 */ 23, 205, 25, 213, 174, 175, 190, 191, 165, 165,
108174
+ /* 980 */ 118, 165, 150, 165, 150, 150, 23, 174, 175, 39,
108175
+ /* 990 */ 174, 175, 49, 50, 173, 150, 23, 165, 52, 165,
108176
+ /* 1000 */ 165, 187, 181, 22, 166, 166, 174, 175, 174, 175,
108177
+ /* 1010 */ 165, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108109108178
/* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
108110
- /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 98, 150, 165,
108111
- /* 1040 */ 150, 160, 150, 59, 25, 53, 104, 22, 174, 175,
108112
- /* 1050 */ 213, 138, 5, 165, 1, 165, 150, 165, 150, 150,
108113
- /* 1060 */ 240, 150, 174, 175, 174, 175, 49, 50, 118, 150,
108114
- /* 1070 */ 35, 165, 27, 165, 165, 194, 165, 108, 127, 76,
108115
- /* 1080 */ 174, 175, 174, 175, 165, 174, 175, 70, 71, 72,
108116
- /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 166, 82,
108179
+ /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 150, 193, 165,
108180
+ /* 1040 */ 150, 160, 150, 205, 205, 150, 150, 29, 174, 175,
108181
+ /* 1050 */ 52, 216, 165, 22, 150, 165, 238, 165, 150, 150,
108182
+ /* 1060 */ 165, 165, 49, 50, 174, 175, 49, 50, 23, 165,
108183
+ /* 1070 */ 91, 92, 22, 165, 165, 194, 1, 2, 22, 52,
108184
+ /* 1080 */ 193, 109, 174, 175, 71, 72, 69, 70, 71, 72,
108185
+ /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
108117108186
/* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108118
- /* 1110 */ 19, 20, 193, 22, 150, 150, 150, 26, 27, 76,
108119
- /* 1120 */ 150, 22, 1, 150, 119, 121, 217, 20, 37, 165,
108120
- /* 1130 */ 165, 165, 16, 19, 20, 165, 22, 205, 165, 119,
108121
- /* 1140 */ 26, 27, 108, 128, 150, 150, 150, 56, 150, 22,
108122
- /* 1150 */ 150, 37, 150, 127, 160, 23, 150, 66, 193, 165,
108123
- /* 1160 */ 165, 165, 16, 165, 23, 165, 150, 165, 174, 175,
108124
- /* 1170 */ 56, 165, 150, 65, 174, 175, 15, 86, 87, 88,
108125
- /* 1180 */ 66, 165, 140, 150, 93, 94, 95, 165, 194, 98,
108126
- /* 1190 */ 174, 175, 22, 3, 164, 193, 174, 175, 165, 150,
108127
- /* 1200 */ 86, 87, 4, 180, 150, 248, 251, 93, 94, 95,
108128
- /* 1210 */ 216, 180, 98, 251, 165, 221, 150, 149, 6, 165,
108129
- /* 1220 */ 129, 130, 131, 132, 133, 134, 193, 150, 174, 175,
108130
- /* 1230 */ 116, 165, 19, 20, 150, 22, 149, 151, 150, 26,
108131
- /* 1240 */ 27, 149, 165, 129, 130, 131, 132, 133, 134, 165,
108132
- /* 1250 */ 37, 174, 175, 165, 149, 19, 20, 13, 22, 150,
108133
- /* 1260 */ 150, 150, 26, 27, 146, 147, 151, 150, 25, 56,
108134
- /* 1270 */ 152, 159, 154, 37, 165, 165, 165, 193, 160, 66,
108135
- /* 1280 */ 116, 193, 165, 174, 175, 174, 175, 194, 199, 150,
108136
- /* 1290 */ 200, 126, 56, 124, 123, 150, 201, 122, 150, 86,
108137
- /* 1300 */ 87, 150, 66, 193, 165, 202, 93, 94, 95, 150,
108138
- /* 1310 */ 165, 98, 194, 165, 125, 22, 165, 150, 150, 26,
108139
- /* 1320 */ 27, 135, 86, 87, 165, 174, 175, 203, 226, 93,
108140
- /* 1330 */ 94, 95, 165, 165, 98, 150, 218, 150, 193, 157,
108141
- /* 1340 */ 118, 157, 129, 130, 131, 132, 133, 134, 5, 104,
108142
- /* 1350 */ 165, 211, 165, 10, 11, 12, 13, 14, 150, 66,
108143
- /* 1360 */ 17, 174, 175, 210, 246, 129, 130, 131, 132, 133,
108144
- /* 1370 */ 134, 150, 210, 165, 31, 121, 33, 150, 150, 86,
108145
- /* 1380 */ 87, 176, 174, 175, 150, 42, 165, 94, 211, 210,
108146
- /* 1390 */ 150, 98, 165, 165, 211, 174, 175, 150, 55, 165,
108147
- /* 1400 */ 57, 150, 174, 175, 61, 165, 150, 64, 174, 175,
108148
- /* 1410 */ 150, 150, 165, 150, 174, 175, 165, 104, 150, 184,
108149
- /* 1420 */ 150, 165, 129, 130, 131, 165, 165, 150, 165, 150,
108150
- /* 1430 */ 150, 176, 150, 165, 47, 165, 150, 150, 176, 103,
108151
- /* 1440 */ 150, 22, 165, 178, 165, 165, 179, 165, 105, 106,
108152
- /* 1450 */ 107, 165, 165, 229, 111, 165, 92, 176, 229, 116,
108153
- /* 1460 */ 184, 176, 179, 156, 176, 176, 18, 157, 156, 237,
108154
- /* 1470 */ 45, 157, 156, 135, 157, 157, 238, 156, 68, 157,
108155
- /* 1480 */ 189, 189, 139, 219, 22, 157, 18, 192, 192, 192,
108156
- /* 1490 */ 192, 189, 219, 199, 157, 242, 40, 157, 199, 242,
108157
- /* 1500 */ 153, 157, 38, 245, 196, 166, 232, 198, 177, 177,
108158
- /* 1510 */ 232, 227, 209, 178, 166, 182, 166, 148, 177, 177,
108159
- /* 1520 */ 209, 196, 177, 199, 209, 199, 166, 208, 92, 195,
108160
- /* 1530 */ 174, 174, 183, 252, 183, 183, 252, 191, 252, 235,
108161
- /* 1540 */ 186, 241, 241, 252, 186, 252, 252, 252, 252, 252,
108162
- /* 1550 */ 252, 252, 252, 252, 252, 252, 236,
108187
+ /* 1110 */ 19, 98, 150, 165, 150, 150, 150, 102, 150, 150,
108188
+ /* 1120 */ 22, 19, 174, 175, 20, 24, 104, 165, 43, 165,
108189
+ /* 1130 */ 165, 165, 150, 165, 165, 150, 174, 175, 174, 175,
108190
+ /* 1140 */ 49, 50, 59, 53, 138, 25, 53, 165, 104, 22,
108191
+ /* 1150 */ 165, 5, 118, 1, 76, 76, 174, 175, 193, 174,
108192
+ /* 1160 */ 175, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108193
+ /* 1170 */ 79, 80, 35, 82, 83, 84, 85, 86, 87, 88,
108194
+ /* 1180 */ 89, 90, 91, 92, 19, 20, 150, 22, 150, 150,
108195
+ /* 1190 */ 150, 26, 27, 27, 108, 127, 150, 150, 22, 25,
108196
+ /* 1200 */ 22, 165, 37, 165, 165, 165, 119, 19, 20, 150,
108197
+ /* 1210 */ 22, 165, 165, 150, 26, 27, 23, 1, 16, 20,
108198
+ /* 1220 */ 150, 56, 119, 108, 165, 37, 121, 128, 165, 193,
108199
+ /* 1230 */ 23, 66, 193, 174, 175, 165, 127, 174, 175, 16,
108200
+ /* 1240 */ 23, 146, 147, 15, 56, 65, 150, 152, 140, 154,
108201
+ /* 1250 */ 150, 86, 87, 88, 66, 160, 22, 150, 93, 94,
108202
+ /* 1260 */ 95, 165, 150, 98, 150, 165, 3, 246, 4, 150,
108203
+ /* 1270 */ 174, 175, 165, 150, 86, 87, 6, 165, 150, 165,
108204
+ /* 1280 */ 164, 93, 94, 95, 165, 149, 98, 149, 165, 194,
108205
+ /* 1290 */ 180, 180, 249, 165, 129, 130, 131, 132, 133, 134,
108206
+ /* 1300 */ 193, 150, 174, 175, 116, 193, 19, 20, 150, 22,
108207
+ /* 1310 */ 249, 149, 217, 26, 27, 151, 165, 129, 130, 131,
108208
+ /* 1320 */ 132, 133, 134, 165, 37, 174, 175, 150, 149, 19,
108209
+ /* 1330 */ 20, 150, 22, 150, 150, 150, 26, 27, 13, 244,
108210
+ /* 1340 */ 151, 159, 165, 56, 25, 116, 165, 37, 165, 165,
108211
+ /* 1350 */ 165, 174, 175, 66, 150, 174, 175, 174, 175, 174,
108212
+ /* 1360 */ 175, 194, 150, 150, 150, 126, 56, 199, 124, 165,
108213
+ /* 1370 */ 200, 150, 150, 86, 87, 150, 66, 165, 165, 165,
108214
+ /* 1380 */ 93, 94, 95, 150, 122, 98, 165, 165, 123, 22,
108215
+ /* 1390 */ 165, 201, 150, 26, 27, 150, 86, 87, 165, 174,
108216
+ /* 1400 */ 175, 203, 202, 93, 94, 95, 125, 165, 98, 150,
108217
+ /* 1410 */ 165, 150, 225, 135, 157, 118, 129, 130, 131, 132,
108218
+ /* 1420 */ 133, 134, 5, 150, 165, 157, 165, 10, 11, 12,
108219
+ /* 1430 */ 13, 14, 150, 66, 17, 174, 175, 210, 165, 129,
108220
+ /* 1440 */ 130, 131, 132, 133, 134, 150, 104, 165, 31, 150,
108221
+ /* 1450 */ 33, 150, 150, 86, 87, 150, 174, 175, 211, 42,
108222
+ /* 1460 */ 165, 94, 121, 210, 165, 98, 165, 165, 176, 211,
108223
+ /* 1470 */ 165, 211, 55, 104, 57, 184, 210, 47, 61, 176,
108224
+ /* 1480 */ 176, 64, 103, 176, 178, 22, 92, 179, 176, 176,
108225
+ /* 1490 */ 176, 156, 18, 184, 179, 228, 129, 130, 131, 228,
108226
+ /* 1500 */ 157, 156, 45, 157, 156, 236, 157, 157, 135, 235,
108227
+ /* 1510 */ 156, 189, 157, 68, 218, 189, 22, 199, 156, 192,
108228
+ /* 1520 */ 157, 18, 105, 106, 107, 192, 192, 199, 111, 192,
108229
+ /* 1530 */ 240, 157, 40, 116, 218, 157, 189, 157, 240, 38,
108230
+ /* 1540 */ 153, 166, 198, 243, 178, 209, 182, 196, 177, 226,
108231
+ /* 1550 */ 230, 230, 166, 177, 177, 166, 139, 199, 199, 148,
108232
+ /* 1560 */ 195, 209, 209, 239, 196, 166, 234, 183, 239, 208,
108233
+ /* 1570 */ 174, 233, 191, 183, 183, 174, 92, 250, 186, 186,
108163108234
};
108164
-#define YY_SHIFT_USE_DFLT (-74)
108165
-#define YY_SHIFT_COUNT (418)
108166
-#define YY_SHIFT_MIN (-73)
108167
-#define YY_SHIFT_MAX (1468)
108235
+#define YY_SHIFT_USE_DFLT (-81)
108236
+#define YY_SHIFT_COUNT (417)
108237
+#define YY_SHIFT_MIN (-80)
108238
+#define YY_SHIFT_MAX (1503)
108168108239
static const short yy_shift_ofst[] = {
108169
- /* 0 */ 975, 1114, 1343, 1114, 1213, 1213, 90, 90, 0, -19,
108170
- /* 10 */ 1213, 1213, 1213, 1213, 1213, 345, 445, 721, 1091, 1213,
108171
- /* 20 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108172
- /* 30 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108173
- /* 40 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1236, 1213, 1213,
108174
- /* 50 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108175
- /* 60 */ 1213, 199, 445, 445, 835, 835, 365, 1164, 55, 647,
108176
- /* 70 */ 573, 499, 425, 351, 277, 203, 129, 795, 795, 795,
108177
- /* 80 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795,
108178
- /* 90 */ 795, 795, 795, 795, 795, 869, 795, 943, 1017, 1017,
108179
- /* 100 */ -69, -45, -45, -45, -45, -45, -1, 58, 138, 100,
108180
- /* 110 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108181
- /* 120 */ 445, 445, 445, 445, 445, 445, 537, 438, 445, 445,
108182
- /* 130 */ 445, 445, 445, 365, 807, 1436, -74, -74, -74, 1293,
108183
- /* 140 */ 73, 434, 434, 311, 314, 290, 283, 286, 540, 467,
108184
- /* 150 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108185
- /* 160 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108186
- /* 170 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108187
- /* 180 */ 445, 445, 65, 722, 722, 722, 688, 266, 1164, 1164,
108188
- /* 190 */ 1164, -74, -74, -74, 136, 168, 168, 234, 360, 360,
108189
- /* 200 */ 360, 430, 372, 435, 352, 278, 126, -36, -36, -36,
108190
- /* 210 */ -36, 421, 651, -36, -36, 592, 292, 212, 623, 158,
108191
- /* 220 */ 204, 204, 505, 158, 505, 144, 365, 154, 365, 154,
108192
- /* 230 */ 645, 154, 204, 154, 154, 535, 548, 548, 365, 387,
108193
- /* 240 */ 508, 233, 1464, 1222, 1222, 1456, 1456, 1222, 1462, 1410,
108194
- /* 250 */ 1165, 1468, 1468, 1468, 1468, 1222, 1165, 1462, 1410, 1410,
108195
- /* 260 */ 1222, 1448, 1338, 1425, 1222, 1222, 1448, 1222, 1448, 1222,
108196
- /* 270 */ 1448, 1419, 1313, 1313, 1313, 1387, 1364, 1364, 1419, 1313,
108197
- /* 280 */ 1336, 1313, 1387, 1313, 1313, 1254, 1245, 1254, 1245, 1254,
108198
- /* 290 */ 1245, 1222, 1222, 1186, 1189, 1175, 1169, 1171, 1165, 1164,
108199
- /* 300 */ 1243, 1244, 1244, 1212, 1212, 1212, 1212, -74, -74, -74,
108200
- /* 310 */ -74, -74, -74, 939, 104, 680, 571, 327, 1, 980,
108201
- /* 320 */ 26, 972, 971, 946, 901, 870, 830, 806, 54, 21,
108202
- /* 330 */ -73, 510, 242, 1198, 1190, 1170, 1042, 1161, 1108, 1146,
108203
- /* 340 */ 1141, 1132, 1015, 1127, 1026, 1034, 1020, 1107, 1004, 1116,
108204
- /* 350 */ 1121, 1005, 1099, 951, 1043, 1003, 969, 1045, 1035, 950,
108205
- /* 360 */ 1053, 1047, 1025, 942, 913, 992, 1019, 945, 984, 940,
108206
- /* 370 */ 876, 904, 953, 896, 748, 804, 880, 786, 868, 819,
108207
- /* 380 */ 805, 810, 773, 751, 766, 706, 716, 691, 681, 568,
108208
- /* 390 */ 655, 638, 676, 516, 541, 594, 599, 567, 541, 534,
108209
- /* 400 */ 507, 527, 498, 523, 466, 382, 409, 384, 357, 6,
108210
- /* 410 */ 240, 224, 143, 62, 18, 71, 39, 9, 5,
108240
+ /* 0 */ 1075, 1188, 1417, 1188, 1287, 1287, 138, 138, 1, -19,
108241
+ /* 10 */ 1287, 1287, 1287, 1287, 340, -2, 129, 129, 795, 1165,
108242
+ /* 20 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108243
+ /* 30 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108244
+ /* 40 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1310, 1287,
108245
+ /* 50 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108246
+ /* 60 */ 1287, 1287, 212, -2, -2, -8, -8, 614, 1229, 55,
108247
+ /* 70 */ 721, 647, 573, 499, 425, 351, 277, 203, 869, 869,
108248
+ /* 80 */ 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
108249
+ /* 90 */ 869, 869, 869, 943, 869, 1017, 1091, 1091, -69, -45,
108250
+ /* 100 */ -45, -45, -45, -45, -1, 57, 28, 361, -2, -2,
108251
+ /* 110 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108252
+ /* 120 */ -2, -2, -2, -2, 391, 515, -2, -2, -2, -2,
108253
+ /* 130 */ -2, 509, -80, 614, 979, 1484, -81, -81, -81, 1367,
108254
+ /* 140 */ 75, 182, 182, 314, 311, 364, 219, 86, 613, 609,
108255
+ /* 150 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108256
+ /* 160 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108257
+ /* 170 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108258
+ /* 180 */ -2, -2, 578, 578, 578, 615, 1229, 1229, 1229, -81,
108259
+ /* 190 */ -81, -81, 160, 168, 168, 283, 500, 500, 500, 278,
108260
+ /* 200 */ 449, 330, 432, 409, 352, 48, 48, 48, 48, 426,
108261
+ /* 210 */ 286, 48, 48, 728, 581, 369, 590, 495, 224, 224,
108262
+ /* 220 */ 727, 495, 727, 719, 614, 659, 614, 659, 811, 659,
108263
+ /* 230 */ 224, 257, 480, 480, 614, 144, 375, -18, 1501, 1297,
108264
+ /* 240 */ 1297, 1492, 1492, 1297, 1494, 1445, 1239, 1503, 1503, 1503,
108265
+ /* 250 */ 1503, 1297, 1474, 1239, 1494, 1445, 1445, 1297, 1474, 1373,
108266
+ /* 260 */ 1457, 1297, 1297, 1474, 1297, 1474, 1297, 1474, 1463, 1369,
108267
+ /* 270 */ 1369, 1369, 1430, 1394, 1394, 1463, 1369, 1379, 1369, 1430,
108268
+ /* 280 */ 1369, 1369, 1341, 1342, 1341, 1342, 1341, 1342, 1297, 1297,
108269
+ /* 290 */ 1278, 1281, 1262, 1244, 1265, 1239, 1229, 1319, 1325, 1325,
108270
+ /* 300 */ 1270, 1270, 1270, 1270, -81, -81, -81, -81, -81, -81,
108271
+ /* 310 */ 1013, 242, 757, 752, 465, 363, 947, 232, 944, 906,
108272
+ /* 320 */ 872, 837, 738, 448, 381, 230, 84, 362, 300, 1264,
108273
+ /* 330 */ 1263, 1234, 1108, 1228, 1180, 1223, 1217, 1207, 1099, 1174,
108274
+ /* 340 */ 1109, 1115, 1103, 1199, 1105, 1202, 1216, 1087, 1193, 1178,
108275
+ /* 350 */ 1174, 1176, 1068, 1079, 1078, 1086, 1166, 1137, 1034, 1152,
108276
+ /* 360 */ 1146, 1127, 1044, 1006, 1093, 1120, 1090, 1083, 1085, 1022,
108277
+ /* 370 */ 1101, 1104, 1102, 972, 1015, 1098, 1027, 1056, 1050, 1045,
108278
+ /* 380 */ 1031, 998, 1018, 981, 946, 950, 973, 963, 862, 885,
108279
+ /* 390 */ 819, 884, 782, 796, 806, 807, 790, 796, 793, 758,
108280
+ /* 400 */ 753, 732, 692, 696, 682, 686, 667, 544, 291, 521,
108281
+ /* 410 */ 510, 365, 358, 139, 114, 54, 14, 25,
108211108282
};
108212
-#define YY_REDUCE_USE_DFLT (-142)
108213
-#define YY_REDUCE_COUNT (312)
108214
-#define YY_REDUCE_MIN (-141)
108215
-#define YY_REDUCE_MAX (1369)
108283
+#define YY_REDUCE_USE_DFLT (-169)
108284
+#define YY_REDUCE_COUNT (309)
108285
+#define YY_REDUCE_MIN (-168)
108286
+#define YY_REDUCE_MAX (1411)
108216108287
static const short yy_reduce_ofst[] = {
108217
- /* 0 */ -141, 994, 1118, 223, 157, -53, 93, 89, 83, 375,
108218
- /* 10 */ 386, 381, 379, 308, 295, 325, -47, 27, 1240, 1234,
108219
- /* 20 */ 1228, 1221, 1208, 1187, 1151, 1111, 1109, 1077, 1054, 1022,
108220
- /* 30 */ 1016, 1000, 911, 908, 906, 890, 888, 874, 834, 816,
108221
- /* 40 */ 800, 760, 758, 755, 742, 739, 726, 685, 672, 668,
108222
- /* 50 */ 665, 652, 611, 609, 607, 604, 591, 578, 526, 519,
108223
- /* 60 */ 453, 474, 454, 461, 443, 245, 442, 473, 484, 484,
108224
- /* 70 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108225
- /* 80 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108226
- /* 90 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108227
- /* 100 */ 484, 484, 484, 484, 484, 484, 484, 130, 484, 484,
108228
- /* 110 */ 1145, 909, 1110, 1088, 1084, 1033, 1002, 965, 820, 837,
108229
- /* 120 */ 746, 686, 612, 817, 610, 919, 221, 563, 814, 813,
108230
- /* 130 */ 744, 669, 470, 543, 484, 484, 484, 484, 484, 291,
108231
- /* 140 */ 569, 671, 658, 970, 1290, 1287, 1286, 1282, 518, 518,
108232
- /* 150 */ 1280, 1279, 1277, 1270, 1268, 1263, 1261, 1260, 1256, 1251,
108233
- /* 160 */ 1247, 1227, 1185, 1168, 1167, 1159, 1148, 1139, 1117, 1066,
108234
- /* 170 */ 1049, 1006, 998, 996, 995, 973, 970, 966, 964, 892,
108235
- /* 180 */ 762, -52, 881, 932, 802, 731, 619, 812, 664, 660,
108236
- /* 190 */ 627, 392, 331, 124, 1358, 1357, 1356, 1354, 1352, 1351,
108237
- /* 200 */ 1349, 1319, 1334, 1346, 1334, 1334, 1334, 1334, 1334, 1334,
108238
- /* 210 */ 1334, 1320, 1304, 1334, 1334, 1319, 1360, 1325, 1369, 1326,
108239
- /* 220 */ 1315, 1311, 1301, 1324, 1300, 1335, 1350, 1345, 1348, 1342,
108240
- /* 230 */ 1333, 1341, 1303, 1332, 1331, 1284, 1278, 1274, 1339, 1309,
108241
- /* 240 */ 1308, 1347, 1258, 1344, 1340, 1257, 1253, 1337, 1273, 1302,
108242
- /* 250 */ 1299, 1298, 1297, 1296, 1295, 1328, 1294, 1264, 1292, 1291,
108243
- /* 260 */ 1322, 1321, 1238, 1232, 1318, 1317, 1316, 1314, 1312, 1310,
108244
- /* 270 */ 1307, 1283, 1289, 1288, 1285, 1276, 1229, 1224, 1267, 1281,
108245
- /* 280 */ 1265, 1262, 1235, 1255, 1205, 1183, 1179, 1177, 1162, 1140,
108246
- /* 290 */ 1153, 1184, 1182, 1102, 1124, 1103, 1095, 1090, 1089, 1093,
108247
- /* 300 */ 1112, 1115, 1086, 1105, 1092, 1087, 1068, 962, 955, 957,
108248
- /* 310 */ 1031, 1023, 1030,
108288
+ /* 0 */ 318, 90, 1095, 221, 157, 21, 159, 18, 150, 390,
108289
+ /* 10 */ 385, 378, 380, 315, 325, 249, 529, -71, 8, 1282,
108290
+ /* 20 */ 1261, 1225, 1185, 1183, 1181, 1177, 1151, 1128, 1096, 1063,
108291
+ /* 30 */ 1059, 985, 982, 964, 962, 948, 908, 890, 874, 834,
108292
+ /* 40 */ 832, 816, 813, 800, 759, 746, 742, 739, 726, 684,
108293
+ /* 50 */ 681, 668, 665, 652, 612, 593, 591, 537, 524, 518,
108294
+ /* 60 */ 504, 455, 511, 376, 517, 247, -168, 24, 420, 463,
108295
+ /* 70 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108296
+ /* 80 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108297
+ /* 90 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108298
+ /* 100 */ 463, 463, 463, 463, 463, -74, 463, 463, 1112, 835,
108299
+ /* 110 */ 1107, 1039, 1036, 965, 887, 845, 818, 760, 688, 687,
108300
+ /* 120 */ 538, 743, 623, 592, 446, 513, 814, 740, 670, 156,
108301
+ /* 130 */ 468, 553, 184, 616, 463, 463, 463, 463, 463, 595,
108302
+ /* 140 */ 821, 786, 745, 909, 1305, 1302, 1301, 1299, 675, 675,
108303
+ /* 150 */ 1295, 1273, 1259, 1245, 1242, 1233, 1222, 1221, 1214, 1213,
108304
+ /* 160 */ 1212, 1204, 1184, 1158, 1123, 1119, 1114, 1100, 1070, 1047,
108305
+ /* 170 */ 1046, 1040, 1038, 969, 968, 966, 909, 904, 896, 895,
108306
+ /* 180 */ 892, 599, 839, 838, 766, 754, 881, 734, 346, 605,
108307
+ /* 190 */ 622, -94, 1393, 1401, 1396, 1392, 1391, 1390, 1384, 1361,
108308
+ /* 200 */ 1365, 1381, 1365, 1365, 1365, 1365, 1365, 1365, 1365, 1332,
108309
+ /* 210 */ 1338, 1365, 1365, 1361, 1399, 1368, 1411, 1359, 1353, 1352,
108310
+ /* 220 */ 1329, 1358, 1324, 1366, 1389, 1377, 1386, 1376, 1364, 1371,
108311
+ /* 230 */ 1336, 1323, 1321, 1320, 1375, 1344, 1351, 1387, 1300, 1380,
108312
+ /* 240 */ 1378, 1298, 1290, 1374, 1316, 1347, 1328, 1337, 1334, 1333,
108313
+ /* 250 */ 1327, 1363, 1362, 1318, 1296, 1326, 1322, 1355, 1354, 1269,
108314
+ /* 260 */ 1274, 1350, 1349, 1348, 1346, 1345, 1343, 1335, 1315, 1314,
108315
+ /* 270 */ 1313, 1312, 1309, 1271, 1267, 1308, 1307, 1306, 1304, 1291,
108316
+ /* 280 */ 1303, 1292, 1260, 1266, 1258, 1253, 1247, 1227, 1268, 1257,
108317
+ /* 290 */ 1187, 1198, 1200, 1190, 1170, 1168, 1167, 1182, 1189, 1164,
108318
+ /* 300 */ 1179, 1162, 1138, 1136, 1061, 1043, 1021, 1111, 1110, 1116,
108249108319
};
108250108320
static const YYACTIONTYPE yy_default[] = {
108251
- /* 0 */ 635, 870, 959, 959, 959, 870, 899, 899, 959, 759,
108252
- /* 10 */ 959, 959, 959, 959, 868, 959, 959, 933, 959, 959,
108253
- /* 20 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108254
- /* 30 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108255
- /* 40 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108256
- /* 50 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108257
- /* 60 */ 959, 959, 959, 959, 899, 899, 674, 763, 794, 959,
108258
- /* 70 */ 959, 959, 959, 959, 959, 959, 959, 932, 934, 809,
108259
- /* 80 */ 808, 802, 801, 912, 774, 799, 792, 785, 796, 871,
108260
- /* 90 */ 864, 865, 863, 867, 872, 959, 795, 831, 848, 830,
108261
- /* 100 */ 842, 847, 854, 846, 843, 833, 832, 666, 834, 835,
108262
- /* 110 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108263
- /* 120 */ 959, 959, 959, 959, 959, 959, 661, 728, 959, 959,
108264
- /* 130 */ 959, 959, 959, 959, 836, 837, 851, 850, 849, 959,
108265
- /* 140 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108266
- /* 150 */ 959, 939, 937, 959, 883, 959, 959, 959, 959, 959,
108267
- /* 160 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108268
- /* 170 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108269
- /* 180 */ 959, 641, 959, 759, 759, 759, 635, 959, 959, 959,
108270
- /* 190 */ 959, 951, 763, 753, 719, 959, 959, 959, 959, 959,
108271
- /* 200 */ 959, 959, 959, 959, 959, 959, 959, 804, 742, 922,
108272
- /* 210 */ 924, 959, 905, 740, 663, 761, 676, 751, 643, 798,
108273
- /* 220 */ 776, 776, 917, 798, 917, 700, 959, 788, 959, 788,
108274
- /* 230 */ 697, 788, 776, 788, 788, 866, 959, 959, 959, 760,
108275
- /* 240 */ 751, 959, 944, 767, 767, 936, 936, 767, 810, 732,
108276
- /* 250 */ 798, 739, 739, 739, 739, 767, 798, 810, 732, 732,
108277
- /* 260 */ 767, 658, 911, 909, 767, 767, 658, 767, 658, 767,
108278
- /* 270 */ 658, 876, 730, 730, 730, 715, 880, 880, 876, 730,
108279
- /* 280 */ 700, 730, 715, 730, 730, 780, 775, 780, 775, 780,
108280
- /* 290 */ 775, 767, 767, 959, 793, 781, 791, 789, 798, 959,
108281
- /* 300 */ 718, 651, 651, 640, 640, 640, 640, 956, 956, 951,
108282
- /* 310 */ 702, 702, 684, 959, 959, 959, 959, 959, 959, 959,
108283
- /* 320 */ 885, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108284
- /* 330 */ 959, 959, 959, 959, 636, 946, 959, 959, 943, 959,
108285
- /* 340 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108286
- /* 350 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 915,
108287
- /* 360 */ 959, 959, 959, 959, 959, 959, 908, 907, 959, 959,
108288
- /* 370 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108289
- /* 380 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108290
- /* 390 */ 959, 959, 959, 959, 790, 959, 782, 959, 869, 959,
108291
- /* 400 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 745,
108292
- /* 410 */ 819, 959, 818, 822, 817, 668, 959, 649, 959, 632,
108293
- /* 420 */ 637, 955, 958, 957, 954, 953, 952, 947, 945, 942,
108294
- /* 430 */ 941, 940, 938, 935, 931, 889, 887, 894, 893, 892,
108295
- /* 440 */ 891, 890, 888, 886, 884, 805, 803, 800, 797, 930,
108296
- /* 450 */ 882, 741, 738, 737, 657, 948, 914, 923, 921, 811,
108297
- /* 460 */ 920, 919, 918, 916, 913, 900, 807, 806, 733, 874,
108298
- /* 470 */ 873, 660, 904, 903, 902, 906, 910, 901, 769, 659,
108299
- /* 480 */ 656, 665, 722, 721, 729, 727, 726, 725, 724, 723,
108300
- /* 490 */ 720, 667, 675, 686, 714, 699, 698, 879, 881, 878,
108301
- /* 500 */ 877, 707, 706, 712, 711, 710, 709, 708, 705, 704,
108302
- /* 510 */ 703, 696, 695, 701, 694, 717, 716, 713, 693, 736,
108303
- /* 520 */ 735, 734, 731, 692, 691, 690, 822, 689, 688, 828,
108304
- /* 530 */ 827, 815, 858, 756, 755, 754, 766, 765, 778, 777,
108305
- /* 540 */ 813, 812, 779, 764, 758, 757, 773, 772, 771, 770,
108306
- /* 550 */ 762, 752, 784, 787, 786, 783, 860, 768, 857, 929,
108307
- /* 560 */ 928, 927, 926, 925, 862, 861, 829, 826, 679, 680,
108308
- /* 570 */ 898, 896, 897, 895, 682, 681, 678, 677, 859, 747,
108309
- /* 580 */ 746, 855, 852, 844, 840, 856, 853, 845, 841, 839,
108310
- /* 590 */ 838, 824, 823, 821, 820, 816, 825, 670, 748, 744,
108311
- /* 600 */ 743, 814, 750, 749, 687, 685, 683, 664, 662, 655,
108312
- /* 610 */ 653, 652, 654, 650, 648, 647, 646, 645, 644, 673,
108313
- /* 620 */ 672, 671, 669, 668, 642, 639, 638, 634, 633, 631,
108321
+ /* 0 */ 634, 868, 956, 956, 868, 868, 956, 956, 956, 758,
108322
+ /* 10 */ 956, 956, 956, 866, 956, 956, 786, 786, 930, 956,
108323
+ /* 20 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108324
+ /* 30 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108325
+ /* 40 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108326
+ /* 50 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108327
+ /* 60 */ 956, 956, 956, 956, 956, 956, 956, 673, 762, 792,
108328
+ /* 70 */ 956, 956, 956, 956, 956, 956, 956, 956, 929, 931,
108329
+ /* 80 */ 800, 799, 909, 773, 797, 790, 794, 869, 862, 863,
108330
+ /* 90 */ 861, 865, 870, 956, 793, 829, 846, 828, 840, 845,
108331
+ /* 100 */ 852, 844, 841, 831, 830, 665, 832, 833, 956, 956,
108332
+ /* 110 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108333
+ /* 120 */ 956, 956, 956, 956, 660, 727, 956, 956, 956, 956,
108334
+ /* 130 */ 956, 956, 956, 956, 834, 835, 849, 848, 847, 956,
108335
+ /* 140 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108336
+ /* 150 */ 956, 936, 934, 956, 881, 956, 956, 956, 956, 956,
108337
+ /* 160 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108338
+ /* 170 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108339
+ /* 180 */ 956, 640, 758, 758, 758, 634, 956, 956, 956, 948,
108340
+ /* 190 */ 762, 752, 718, 956, 956, 956, 956, 956, 956, 956,
108341
+ /* 200 */ 956, 956, 956, 956, 956, 802, 741, 919, 921, 956,
108342
+ /* 210 */ 902, 739, 662, 760, 675, 750, 642, 796, 775, 775,
108343
+ /* 220 */ 914, 796, 914, 699, 956, 786, 956, 786, 696, 786,
108344
+ /* 230 */ 775, 864, 956, 956, 956, 759, 750, 956, 941, 766,
108345
+ /* 240 */ 766, 933, 933, 766, 808, 731, 796, 738, 738, 738,
108346
+ /* 250 */ 738, 766, 657, 796, 808, 731, 731, 766, 657, 908,
108347
+ /* 260 */ 906, 766, 766, 657, 766, 657, 766, 657, 874, 729,
108348
+ /* 270 */ 729, 729, 714, 878, 878, 874, 729, 699, 729, 714,
108349
+ /* 280 */ 729, 729, 779, 774, 779, 774, 779, 774, 766, 766,
108350
+ /* 290 */ 956, 791, 780, 789, 787, 796, 956, 717, 650, 650,
108351
+ /* 300 */ 639, 639, 639, 639, 953, 953, 948, 701, 701, 683,
108352
+ /* 310 */ 956, 956, 956, 956, 956, 956, 956, 883, 956, 956,
108353
+ /* 320 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108354
+ /* 330 */ 635, 943, 956, 956, 940, 956, 956, 956, 956, 801,
108355
+ /* 340 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108356
+ /* 350 */ 918, 956, 956, 956, 956, 956, 956, 956, 912, 956,
108357
+ /* 360 */ 956, 956, 956, 956, 956, 905, 904, 956, 956, 956,
108358
+ /* 370 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108359
+ /* 380 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108360
+ /* 390 */ 956, 956, 956, 788, 956, 781, 956, 867, 956, 956,
108361
+ /* 400 */ 956, 956, 956, 956, 956, 956, 956, 956, 744, 817,
108362
+ /* 410 */ 956, 816, 820, 815, 667, 956, 648, 956, 631, 636,
108363
+ /* 420 */ 952, 955, 954, 951, 950, 949, 944, 942, 939, 938,
108364
+ /* 430 */ 937, 935, 932, 928, 887, 885, 892, 891, 890, 889,
108365
+ /* 440 */ 888, 886, 884, 882, 803, 798, 795, 927, 880, 740,
108366
+ /* 450 */ 737, 736, 656, 945, 911, 920, 807, 806, 809, 917,
108367
+ /* 460 */ 916, 915, 913, 910, 897, 805, 804, 732, 872, 871,
108368
+ /* 470 */ 659, 901, 900, 899, 903, 907, 898, 768, 658, 655,
108369
+ /* 480 */ 664, 721, 720, 728, 726, 725, 724, 723, 722, 719,
108370
+ /* 490 */ 666, 674, 685, 713, 698, 697, 877, 879, 876, 875,
108371
+ /* 500 */ 706, 705, 711, 710, 709, 708, 707, 704, 703, 702,
108372
+ /* 510 */ 695, 694, 700, 693, 716, 715, 712, 692, 735, 734,
108373
+ /* 520 */ 733, 730, 691, 690, 689, 820, 688, 687, 826, 825,
108374
+ /* 530 */ 813, 856, 755, 754, 753, 765, 764, 777, 776, 811,
108375
+ /* 540 */ 810, 778, 763, 757, 756, 772, 771, 770, 769, 761,
108376
+ /* 550 */ 751, 783, 785, 784, 782, 858, 767, 855, 926, 925,
108377
+ /* 560 */ 924, 923, 922, 860, 859, 827, 824, 678, 679, 895,
108378
+ /* 570 */ 894, 896, 893, 681, 680, 677, 676, 857, 746, 745,
108379
+ /* 580 */ 853, 850, 842, 838, 854, 851, 843, 839, 837, 836,
108380
+ /* 590 */ 822, 821, 819, 818, 814, 823, 669, 747, 743, 742,
108381
+ /* 600 */ 812, 749, 748, 686, 684, 682, 663, 661, 654, 652,
108382
+ /* 610 */ 651, 653, 649, 647, 646, 645, 644, 643, 672, 671,
108383
+ /* 620 */ 670, 668, 667, 641, 638, 637, 633, 632, 630,
108314108384
};
108315108385
108316108386
/* The next table maps tokens into fallback tokens. If a construct
108317108387
** like the following:
108318108388
**
@@ -108521,20 +108591,20 @@
108521108591
"ifexists", "fullname", "oneselect", "multiselect_op",
108522108592
"distinct", "selcollist", "from", "where_opt",
108523108593
"groupby_opt", "having_opt", "orderby_opt", "limit_opt",
108524108594
"sclp", "as", "seltablist", "stl_prefix",
108525108595
"joinop", "indexed_opt", "on_opt", "using_opt",
108526
- "joinop2", "inscollist", "sortlist", "sortitem",
108527
- "nexprlist", "setlist", "insert_cmd", "inscollist_opt",
108528
- "itemlist", "exprlist", "likeop", "between_op",
108529
- "in_op", "case_operand", "case_exprlist", "case_else",
108530
- "uniqueflag", "collate", "nmnum", "plus_opt",
108531
- "number", "trigger_decl", "trigger_cmd_list", "trigger_time",
108532
- "trigger_event", "foreach_clause", "when_clause", "trigger_cmd",
108533
- "trnm", "tridxby", "database_kw_opt", "key_opt",
108534
- "add_column_fullname", "kwcolumn_opt", "create_vtab", "vtabarglist",
108535
- "vtabarg", "vtabargtoken", "lp", "anylist",
108596
+ "joinop2", "inscollist", "sortlist", "nexprlist",
108597
+ "setlist", "insert_cmd", "inscollist_opt", "valuelist",
108598
+ "exprlist", "likeop", "between_op", "in_op",
108599
+ "case_operand", "case_exprlist", "case_else", "uniqueflag",
108600
+ "collate", "nmnum", "number", "trigger_decl",
108601
+ "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause",
108602
+ "when_clause", "trigger_cmd", "trnm", "tridxby",
108603
+ "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt",
108604
+ "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken",
108605
+ "lp", "anylist",
108536108606
};
108537108607
#endif /* NDEBUG */
108538108608
108539108609
#ifndef NDEBUG
108540108610
/* For tracing reduce actions, the names of all rules are required.
@@ -108691,186 +108761,184 @@
108691108761
/* 148 */ "indexed_opt ::= NOT INDEXED",
108692108762
/* 149 */ "using_opt ::= USING LP inscollist RP",
108693108763
/* 150 */ "using_opt ::=",
108694108764
/* 151 */ "orderby_opt ::=",
108695108765
/* 152 */ "orderby_opt ::= ORDER BY sortlist",
108696
- /* 153 */ "sortlist ::= sortlist COMMA sortitem sortorder",
108697
- /* 154 */ "sortlist ::= sortitem sortorder",
108698
- /* 155 */ "sortitem ::= expr",
108699
- /* 156 */ "sortorder ::= ASC",
108700
- /* 157 */ "sortorder ::= DESC",
108701
- /* 158 */ "sortorder ::=",
108702
- /* 159 */ "groupby_opt ::=",
108703
- /* 160 */ "groupby_opt ::= GROUP BY nexprlist",
108704
- /* 161 */ "having_opt ::=",
108705
- /* 162 */ "having_opt ::= HAVING expr",
108706
- /* 163 */ "limit_opt ::=",
108707
- /* 164 */ "limit_opt ::= LIMIT expr",
108708
- /* 165 */ "limit_opt ::= LIMIT expr OFFSET expr",
108709
- /* 166 */ "limit_opt ::= LIMIT expr COMMA expr",
108710
- /* 167 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt",
108711
- /* 168 */ "where_opt ::=",
108712
- /* 169 */ "where_opt ::= WHERE expr",
108713
- /* 170 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt",
108714
- /* 171 */ "setlist ::= setlist COMMA nm EQ expr",
108715
- /* 172 */ "setlist ::= nm EQ expr",
108716
- /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
108717
- /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
108718
- /* 175 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
108719
- /* 176 */ "insert_cmd ::= INSERT orconf",
108720
- /* 177 */ "insert_cmd ::= REPLACE",
108721
- /* 178 */ "itemlist ::= itemlist COMMA expr",
108722
- /* 179 */ "itemlist ::= expr",
108723
- /* 180 */ "inscollist_opt ::=",
108724
- /* 181 */ "inscollist_opt ::= LP inscollist RP",
108725
- /* 182 */ "inscollist ::= inscollist COMMA nm",
108726
- /* 183 */ "inscollist ::= nm",
108727
- /* 184 */ "expr ::= term",
108728
- /* 185 */ "expr ::= LP expr RP",
108729
- /* 186 */ "term ::= NULL",
108730
- /* 187 */ "expr ::= id",
108731
- /* 188 */ "expr ::= JOIN_KW",
108732
- /* 189 */ "expr ::= nm DOT nm",
108733
- /* 190 */ "expr ::= nm DOT nm DOT nm",
108734
- /* 191 */ "term ::= INTEGER|FLOAT|BLOB",
108735
- /* 192 */ "term ::= STRING",
108736
- /* 193 */ "expr ::= REGISTER",
108737
- /* 194 */ "expr ::= VARIABLE",
108738
- /* 195 */ "expr ::= expr COLLATE ids",
108739
- /* 196 */ "expr ::= CAST LP expr AS typetoken RP",
108740
- /* 197 */ "expr ::= ID LP distinct exprlist RP",
108741
- /* 198 */ "expr ::= ID LP STAR RP",
108742
- /* 199 */ "term ::= CTIME_KW",
108743
- /* 200 */ "expr ::= expr AND expr",
108744
- /* 201 */ "expr ::= expr OR expr",
108745
- /* 202 */ "expr ::= expr LT|GT|GE|LE expr",
108746
- /* 203 */ "expr ::= expr EQ|NE expr",
108747
- /* 204 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
108748
- /* 205 */ "expr ::= expr PLUS|MINUS expr",
108749
- /* 206 */ "expr ::= expr STAR|SLASH|REM expr",
108750
- /* 207 */ "expr ::= expr CONCAT expr",
108751
- /* 208 */ "likeop ::= LIKE_KW",
108752
- /* 209 */ "likeop ::= NOT LIKE_KW",
108753
- /* 210 */ "likeop ::= MATCH",
108754
- /* 211 */ "likeop ::= NOT MATCH",
108755
- /* 212 */ "expr ::= expr likeop expr",
108756
- /* 213 */ "expr ::= expr likeop expr ESCAPE expr",
108757
- /* 214 */ "expr ::= expr ISNULL|NOTNULL",
108758
- /* 215 */ "expr ::= expr NOT NULL",
108759
- /* 216 */ "expr ::= expr IS expr",
108760
- /* 217 */ "expr ::= expr IS NOT expr",
108761
- /* 218 */ "expr ::= NOT expr",
108762
- /* 219 */ "expr ::= BITNOT expr",
108763
- /* 220 */ "expr ::= MINUS expr",
108764
- /* 221 */ "expr ::= PLUS expr",
108765
- /* 222 */ "between_op ::= BETWEEN",
108766
- /* 223 */ "between_op ::= NOT BETWEEN",
108767
- /* 224 */ "expr ::= expr between_op expr AND expr",
108768
- /* 225 */ "in_op ::= IN",
108769
- /* 226 */ "in_op ::= NOT IN",
108770
- /* 227 */ "expr ::= expr in_op LP exprlist RP",
108771
- /* 228 */ "expr ::= LP select RP",
108772
- /* 229 */ "expr ::= expr in_op LP select RP",
108773
- /* 230 */ "expr ::= expr in_op nm dbnm",
108774
- /* 231 */ "expr ::= EXISTS LP select RP",
108775
- /* 232 */ "expr ::= CASE case_operand case_exprlist case_else END",
108776
- /* 233 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
108777
- /* 234 */ "case_exprlist ::= WHEN expr THEN expr",
108778
- /* 235 */ "case_else ::= ELSE expr",
108779
- /* 236 */ "case_else ::=",
108780
- /* 237 */ "case_operand ::= expr",
108781
- /* 238 */ "case_operand ::=",
108782
- /* 239 */ "exprlist ::= nexprlist",
108783
- /* 240 */ "exprlist ::=",
108784
- /* 241 */ "nexprlist ::= nexprlist COMMA expr",
108785
- /* 242 */ "nexprlist ::= expr",
108786
- /* 243 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
108787
- /* 244 */ "uniqueflag ::= UNIQUE",
108788
- /* 245 */ "uniqueflag ::=",
108789
- /* 246 */ "idxlist_opt ::=",
108790
- /* 247 */ "idxlist_opt ::= LP idxlist RP",
108791
- /* 248 */ "idxlist ::= idxlist COMMA nm collate sortorder",
108792
- /* 249 */ "idxlist ::= nm collate sortorder",
108793
- /* 250 */ "collate ::=",
108794
- /* 251 */ "collate ::= COLLATE ids",
108795
- /* 252 */ "cmd ::= DROP INDEX ifexists fullname",
108796
- /* 253 */ "cmd ::= VACUUM",
108797
- /* 254 */ "cmd ::= VACUUM nm",
108798
- /* 255 */ "cmd ::= PRAGMA nm dbnm",
108799
- /* 256 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
108800
- /* 257 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
108801
- /* 258 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
108802
- /* 259 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
108803
- /* 260 */ "nmnum ::= plus_num",
108804
- /* 261 */ "nmnum ::= nm",
108805
- /* 262 */ "nmnum ::= ON",
108806
- /* 263 */ "nmnum ::= DELETE",
108807
- /* 264 */ "nmnum ::= DEFAULT",
108808
- /* 265 */ "plus_num ::= plus_opt number",
108766
+ /* 153 */ "sortlist ::= sortlist COMMA expr sortorder",
108767
+ /* 154 */ "sortlist ::= expr sortorder",
108768
+ /* 155 */ "sortorder ::= ASC",
108769
+ /* 156 */ "sortorder ::= DESC",
108770
+ /* 157 */ "sortorder ::=",
108771
+ /* 158 */ "groupby_opt ::=",
108772
+ /* 159 */ "groupby_opt ::= GROUP BY nexprlist",
108773
+ /* 160 */ "having_opt ::=",
108774
+ /* 161 */ "having_opt ::= HAVING expr",
108775
+ /* 162 */ "limit_opt ::=",
108776
+ /* 163 */ "limit_opt ::= LIMIT expr",
108777
+ /* 164 */ "limit_opt ::= LIMIT expr OFFSET expr",
108778
+ /* 165 */ "limit_opt ::= LIMIT expr COMMA expr",
108779
+ /* 166 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt",
108780
+ /* 167 */ "where_opt ::=",
108781
+ /* 168 */ "where_opt ::= WHERE expr",
108782
+ /* 169 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt",
108783
+ /* 170 */ "setlist ::= setlist COMMA nm EQ expr",
108784
+ /* 171 */ "setlist ::= nm EQ expr",
108785
+ /* 172 */ "cmd ::= insert_cmd INTO fullname inscollist_opt valuelist",
108786
+ /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
108787
+ /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
108788
+ /* 175 */ "insert_cmd ::= INSERT orconf",
108789
+ /* 176 */ "insert_cmd ::= REPLACE",
108790
+ /* 177 */ "valuelist ::= VALUES LP nexprlist RP",
108791
+ /* 178 */ "valuelist ::= valuelist COMMA LP exprlist RP",
108792
+ /* 179 */ "inscollist_opt ::=",
108793
+ /* 180 */ "inscollist_opt ::= LP inscollist RP",
108794
+ /* 181 */ "inscollist ::= inscollist COMMA nm",
108795
+ /* 182 */ "inscollist ::= nm",
108796
+ /* 183 */ "expr ::= term",
108797
+ /* 184 */ "expr ::= LP expr RP",
108798
+ /* 185 */ "term ::= NULL",
108799
+ /* 186 */ "expr ::= id",
108800
+ /* 187 */ "expr ::= JOIN_KW",
108801
+ /* 188 */ "expr ::= nm DOT nm",
108802
+ /* 189 */ "expr ::= nm DOT nm DOT nm",
108803
+ /* 190 */ "term ::= INTEGER|FLOAT|BLOB",
108804
+ /* 191 */ "term ::= STRING",
108805
+ /* 192 */ "expr ::= REGISTER",
108806
+ /* 193 */ "expr ::= VARIABLE",
108807
+ /* 194 */ "expr ::= expr COLLATE ids",
108808
+ /* 195 */ "expr ::= CAST LP expr AS typetoken RP",
108809
+ /* 196 */ "expr ::= ID LP distinct exprlist RP",
108810
+ /* 197 */ "expr ::= ID LP STAR RP",
108811
+ /* 198 */ "term ::= CTIME_KW",
108812
+ /* 199 */ "expr ::= expr AND expr",
108813
+ /* 200 */ "expr ::= expr OR expr",
108814
+ /* 201 */ "expr ::= expr LT|GT|GE|LE expr",
108815
+ /* 202 */ "expr ::= expr EQ|NE expr",
108816
+ /* 203 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
108817
+ /* 204 */ "expr ::= expr PLUS|MINUS expr",
108818
+ /* 205 */ "expr ::= expr STAR|SLASH|REM expr",
108819
+ /* 206 */ "expr ::= expr CONCAT expr",
108820
+ /* 207 */ "likeop ::= LIKE_KW",
108821
+ /* 208 */ "likeop ::= NOT LIKE_KW",
108822
+ /* 209 */ "likeop ::= MATCH",
108823
+ /* 210 */ "likeop ::= NOT MATCH",
108824
+ /* 211 */ "expr ::= expr likeop expr",
108825
+ /* 212 */ "expr ::= expr likeop expr ESCAPE expr",
108826
+ /* 213 */ "expr ::= expr ISNULL|NOTNULL",
108827
+ /* 214 */ "expr ::= expr NOT NULL",
108828
+ /* 215 */ "expr ::= expr IS expr",
108829
+ /* 216 */ "expr ::= expr IS NOT expr",
108830
+ /* 217 */ "expr ::= NOT expr",
108831
+ /* 218 */ "expr ::= BITNOT expr",
108832
+ /* 219 */ "expr ::= MINUS expr",
108833
+ /* 220 */ "expr ::= PLUS expr",
108834
+ /* 221 */ "between_op ::= BETWEEN",
108835
+ /* 222 */ "between_op ::= NOT BETWEEN",
108836
+ /* 223 */ "expr ::= expr between_op expr AND expr",
108837
+ /* 224 */ "in_op ::= IN",
108838
+ /* 225 */ "in_op ::= NOT IN",
108839
+ /* 226 */ "expr ::= expr in_op LP exprlist RP",
108840
+ /* 227 */ "expr ::= LP select RP",
108841
+ /* 228 */ "expr ::= expr in_op LP select RP",
108842
+ /* 229 */ "expr ::= expr in_op nm dbnm",
108843
+ /* 230 */ "expr ::= EXISTS LP select RP",
108844
+ /* 231 */ "expr ::= CASE case_operand case_exprlist case_else END",
108845
+ /* 232 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
108846
+ /* 233 */ "case_exprlist ::= WHEN expr THEN expr",
108847
+ /* 234 */ "case_else ::= ELSE expr",
108848
+ /* 235 */ "case_else ::=",
108849
+ /* 236 */ "case_operand ::= expr",
108850
+ /* 237 */ "case_operand ::=",
108851
+ /* 238 */ "exprlist ::= nexprlist",
108852
+ /* 239 */ "exprlist ::=",
108853
+ /* 240 */ "nexprlist ::= nexprlist COMMA expr",
108854
+ /* 241 */ "nexprlist ::= expr",
108855
+ /* 242 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
108856
+ /* 243 */ "uniqueflag ::= UNIQUE",
108857
+ /* 244 */ "uniqueflag ::=",
108858
+ /* 245 */ "idxlist_opt ::=",
108859
+ /* 246 */ "idxlist_opt ::= LP idxlist RP",
108860
+ /* 247 */ "idxlist ::= idxlist COMMA nm collate sortorder",
108861
+ /* 248 */ "idxlist ::= nm collate sortorder",
108862
+ /* 249 */ "collate ::=",
108863
+ /* 250 */ "collate ::= COLLATE ids",
108864
+ /* 251 */ "cmd ::= DROP INDEX ifexists fullname",
108865
+ /* 252 */ "cmd ::= VACUUM",
108866
+ /* 253 */ "cmd ::= VACUUM nm",
108867
+ /* 254 */ "cmd ::= PRAGMA nm dbnm",
108868
+ /* 255 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
108869
+ /* 256 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
108870
+ /* 257 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
108871
+ /* 258 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
108872
+ /* 259 */ "nmnum ::= plus_num",
108873
+ /* 260 */ "nmnum ::= nm",
108874
+ /* 261 */ "nmnum ::= ON",
108875
+ /* 262 */ "nmnum ::= DELETE",
108876
+ /* 263 */ "nmnum ::= DEFAULT",
108877
+ /* 264 */ "plus_num ::= PLUS number",
108878
+ /* 265 */ "plus_num ::= number",
108809108879
/* 266 */ "minus_num ::= MINUS number",
108810108880
/* 267 */ "number ::= INTEGER|FLOAT",
108811
- /* 268 */ "plus_opt ::= PLUS",
108812
- /* 269 */ "plus_opt ::=",
108813
- /* 270 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
108814
- /* 271 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
108815
- /* 272 */ "trigger_time ::= BEFORE",
108816
- /* 273 */ "trigger_time ::= AFTER",
108817
- /* 274 */ "trigger_time ::= INSTEAD OF",
108818
- /* 275 */ "trigger_time ::=",
108819
- /* 276 */ "trigger_event ::= DELETE|INSERT",
108820
- /* 277 */ "trigger_event ::= UPDATE",
108821
- /* 278 */ "trigger_event ::= UPDATE OF inscollist",
108822
- /* 279 */ "foreach_clause ::=",
108823
- /* 280 */ "foreach_clause ::= FOR EACH ROW",
108824
- /* 281 */ "when_clause ::=",
108825
- /* 282 */ "when_clause ::= WHEN expr",
108826
- /* 283 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
108827
- /* 284 */ "trigger_cmd_list ::= trigger_cmd SEMI",
108828
- /* 285 */ "trnm ::= nm",
108829
- /* 286 */ "trnm ::= nm DOT nm",
108830
- /* 287 */ "tridxby ::=",
108831
- /* 288 */ "tridxby ::= INDEXED BY nm",
108832
- /* 289 */ "tridxby ::= NOT INDEXED",
108833
- /* 290 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
108834
- /* 291 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP",
108835
- /* 292 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select",
108836
- /* 293 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
108837
- /* 294 */ "trigger_cmd ::= select",
108838
- /* 295 */ "expr ::= RAISE LP IGNORE RP",
108839
- /* 296 */ "expr ::= RAISE LP raisetype COMMA nm RP",
108840
- /* 297 */ "raisetype ::= ROLLBACK",
108841
- /* 298 */ "raisetype ::= ABORT",
108842
- /* 299 */ "raisetype ::= FAIL",
108843
- /* 300 */ "cmd ::= DROP TRIGGER ifexists fullname",
108844
- /* 301 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
108845
- /* 302 */ "cmd ::= DETACH database_kw_opt expr",
108846
- /* 303 */ "key_opt ::=",
108847
- /* 304 */ "key_opt ::= KEY expr",
108848
- /* 305 */ "database_kw_opt ::= DATABASE",
108849
- /* 306 */ "database_kw_opt ::=",
108850
- /* 307 */ "cmd ::= REINDEX",
108851
- /* 308 */ "cmd ::= REINDEX nm dbnm",
108852
- /* 309 */ "cmd ::= ANALYZE",
108853
- /* 310 */ "cmd ::= ANALYZE nm dbnm",
108854
- /* 311 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
108855
- /* 312 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
108856
- /* 313 */ "add_column_fullname ::= fullname",
108857
- /* 314 */ "kwcolumn_opt ::=",
108858
- /* 315 */ "kwcolumn_opt ::= COLUMNKW",
108859
- /* 316 */ "cmd ::= create_vtab",
108860
- /* 317 */ "cmd ::= create_vtab LP vtabarglist RP",
108861
- /* 318 */ "create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm",
108862
- /* 319 */ "vtabarglist ::= vtabarg",
108863
- /* 320 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
108864
- /* 321 */ "vtabarg ::=",
108865
- /* 322 */ "vtabarg ::= vtabarg vtabargtoken",
108866
- /* 323 */ "vtabargtoken ::= ANY",
108867
- /* 324 */ "vtabargtoken ::= lp anylist RP",
108868
- /* 325 */ "lp ::= LP",
108869
- /* 326 */ "anylist ::=",
108870
- /* 327 */ "anylist ::= anylist LP anylist RP",
108871
- /* 328 */ "anylist ::= anylist ANY",
108881
+ /* 268 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
108882
+ /* 269 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
108883
+ /* 270 */ "trigger_time ::= BEFORE",
108884
+ /* 271 */ "trigger_time ::= AFTER",
108885
+ /* 272 */ "trigger_time ::= INSTEAD OF",
108886
+ /* 273 */ "trigger_time ::=",
108887
+ /* 274 */ "trigger_event ::= DELETE|INSERT",
108888
+ /* 275 */ "trigger_event ::= UPDATE",
108889
+ /* 276 */ "trigger_event ::= UPDATE OF inscollist",
108890
+ /* 277 */ "foreach_clause ::=",
108891
+ /* 278 */ "foreach_clause ::= FOR EACH ROW",
108892
+ /* 279 */ "when_clause ::=",
108893
+ /* 280 */ "when_clause ::= WHEN expr",
108894
+ /* 281 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
108895
+ /* 282 */ "trigger_cmd_list ::= trigger_cmd SEMI",
108896
+ /* 283 */ "trnm ::= nm",
108897
+ /* 284 */ "trnm ::= nm DOT nm",
108898
+ /* 285 */ "tridxby ::=",
108899
+ /* 286 */ "tridxby ::= INDEXED BY nm",
108900
+ /* 287 */ "tridxby ::= NOT INDEXED",
108901
+ /* 288 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
108902
+ /* 289 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist",
108903
+ /* 290 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select",
108904
+ /* 291 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
108905
+ /* 292 */ "trigger_cmd ::= select",
108906
+ /* 293 */ "expr ::= RAISE LP IGNORE RP",
108907
+ /* 294 */ "expr ::= RAISE LP raisetype COMMA nm RP",
108908
+ /* 295 */ "raisetype ::= ROLLBACK",
108909
+ /* 296 */ "raisetype ::= ABORT",
108910
+ /* 297 */ "raisetype ::= FAIL",
108911
+ /* 298 */ "cmd ::= DROP TRIGGER ifexists fullname",
108912
+ /* 299 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
108913
+ /* 300 */ "cmd ::= DETACH database_kw_opt expr",
108914
+ /* 301 */ "key_opt ::=",
108915
+ /* 302 */ "key_opt ::= KEY expr",
108916
+ /* 303 */ "database_kw_opt ::= DATABASE",
108917
+ /* 304 */ "database_kw_opt ::=",
108918
+ /* 305 */ "cmd ::= REINDEX",
108919
+ /* 306 */ "cmd ::= REINDEX nm dbnm",
108920
+ /* 307 */ "cmd ::= ANALYZE",
108921
+ /* 308 */ "cmd ::= ANALYZE nm dbnm",
108922
+ /* 309 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
108923
+ /* 310 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
108924
+ /* 311 */ "add_column_fullname ::= fullname",
108925
+ /* 312 */ "kwcolumn_opt ::=",
108926
+ /* 313 */ "kwcolumn_opt ::= COLUMNKW",
108927
+ /* 314 */ "cmd ::= create_vtab",
108928
+ /* 315 */ "cmd ::= create_vtab LP vtabarglist RP",
108929
+ /* 316 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
108930
+ /* 317 */ "vtabarglist ::= vtabarg",
108931
+ /* 318 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
108932
+ /* 319 */ "vtabarg ::=",
108933
+ /* 320 */ "vtabarg ::= vtabarg vtabargtoken",
108934
+ /* 321 */ "vtabargtoken ::= ANY",
108935
+ /* 322 */ "vtabargtoken ::= lp anylist RP",
108936
+ /* 323 */ "lp ::= LP",
108937
+ /* 324 */ "anylist ::=",
108938
+ /* 325 */ "anylist ::= anylist LP anylist RP",
108939
+ /* 326 */ "anylist ::= anylist ANY",
108872108940
};
108873108941
#endif /* NDEBUG */
108874108942
108875108943
108876108944
#if YYSTACKDEPTH<=0
@@ -108948,71 +109016,77 @@
108948109016
** inside the C code.
108949109017
*/
108950109018
case 160: /* select */
108951109019
case 194: /* oneselect */
108952109020
{
108953
-sqlite3SelectDelete(pParse->db, (yypminor->yy387));
109021
+sqlite3SelectDelete(pParse->db, (yypminor->yy159));
108954109022
}
108955109023
break;
108956109024
case 174: /* term */
108957109025
case 175: /* expr */
108958109026
{
108959
-sqlite3ExprDelete(pParse->db, (yypminor->yy118).pExpr);
109027
+sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr);
108960109028
}
108961109029
break;
108962109030
case 179: /* idxlist_opt */
108963109031
case 187: /* idxlist */
108964109032
case 197: /* selcollist */
108965109033
case 200: /* groupby_opt */
108966109034
case 202: /* orderby_opt */
108967109035
case 204: /* sclp */
108968109036
case 214: /* sortlist */
108969
- case 216: /* nexprlist */
108970
- case 217: /* setlist */
108971
- case 220: /* itemlist */
108972
- case 221: /* exprlist */
108973
- case 226: /* case_exprlist */
109037
+ case 215: /* nexprlist */
109038
+ case 216: /* setlist */
109039
+ case 220: /* exprlist */
109040
+ case 225: /* case_exprlist */
108974109041
{
108975
-sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
109042
+sqlite3ExprListDelete(pParse->db, (yypminor->yy442));
108976109043
}
108977109044
break;
108978109045
case 193: /* fullname */
108979109046
case 198: /* from */
108980109047
case 206: /* seltablist */
108981109048
case 207: /* stl_prefix */
108982109049
{
108983
-sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
109050
+sqlite3SrcListDelete(pParse->db, (yypminor->yy347));
108984109051
}
108985109052
break;
108986109053
case 199: /* where_opt */
108987109054
case 201: /* having_opt */
108988109055
case 210: /* on_opt */
108989
- case 215: /* sortitem */
108990
- case 225: /* case_operand */
108991
- case 227: /* case_else */
108992
- case 238: /* when_clause */
108993
- case 243: /* key_opt */
109056
+ case 224: /* case_operand */
109057
+ case 226: /* case_else */
109058
+ case 236: /* when_clause */
109059
+ case 241: /* key_opt */
108994109060
{
108995
-sqlite3ExprDelete(pParse->db, (yypminor->yy314));
109061
+sqlite3ExprDelete(pParse->db, (yypminor->yy122));
108996109062
}
108997109063
break;
108998109064
case 211: /* using_opt */
108999109065
case 213: /* inscollist */
109000
- case 219: /* inscollist_opt */
109066
+ case 218: /* inscollist_opt */
109001109067
{
109002
-sqlite3IdListDelete(pParse->db, (yypminor->yy384));
109068
+sqlite3IdListDelete(pParse->db, (yypminor->yy180));
109069
+}
109070
+ break;
109071
+ case 219: /* valuelist */
109072
+{
109073
+
109074
+ sqlite3ExprListDelete(pParse->db, (yypminor->yy487).pList);
109075
+ sqlite3SelectDelete(pParse->db, (yypminor->yy487).pSelect);
109076
+
109003109077
}
109004109078
break;
109005
- case 234: /* trigger_cmd_list */
109006
- case 239: /* trigger_cmd */
109079
+ case 232: /* trigger_cmd_list */
109080
+ case 237: /* trigger_cmd */
109007109081
{
109008
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
109082
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327));
109009109083
}
109010109084
break;
109011
- case 236: /* trigger_event */
109085
+ case 234: /* trigger_event */
109012109086
{
109013
-sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
109087
+sqlite3IdListDelete(pParse->db, (yypminor->yy410).b);
109014109088
}
109015109089
break;
109016109090
default: break; /* If no destructor action specified: do nothing */
109017109091
}
109018109092
}
@@ -109408,11 +109482,10 @@
109408109482
{ 211, 0 },
109409109483
{ 202, 0 },
109410109484
{ 202, 3 },
109411109485
{ 214, 4 },
109412109486
{ 214, 2 },
109413
- { 215, 1 },
109414109487
{ 177, 1 },
109415109488
{ 177, 1 },
109416109489
{ 177, 0 },
109417109490
{ 200, 0 },
109418109491
{ 200, 3 },
@@ -109424,21 +109497,21 @@
109424109497
{ 203, 4 },
109425109498
{ 147, 5 },
109426109499
{ 199, 0 },
109427109500
{ 199, 2 },
109428109501
{ 147, 7 },
109429
- { 217, 5 },
109430
- { 217, 3 },
109431
- { 147, 8 },
109502
+ { 216, 5 },
109503
+ { 216, 3 },
109504
+ { 147, 5 },
109432109505
{ 147, 5 },
109433109506
{ 147, 6 },
109434
- { 218, 2 },
109435
- { 218, 1 },
109436
- { 220, 3 },
109437
- { 220, 1 },
109438
- { 219, 0 },
109439
- { 219, 3 },
109507
+ { 217, 2 },
109508
+ { 217, 1 },
109509
+ { 219, 4 },
109510
+ { 219, 5 },
109511
+ { 218, 0 },
109512
+ { 218, 3 },
109440109513
{ 213, 3 },
109441109514
{ 213, 1 },
109442109515
{ 175, 1 },
109443109516
{ 175, 3 },
109444109517
{ 174, 1 },
@@ -109461,14 +109534,14 @@
109461109534
{ 175, 3 },
109462109535
{ 175, 3 },
109463109536
{ 175, 3 },
109464109537
{ 175, 3 },
109465109538
{ 175, 3 },
109466
- { 222, 1 },
109467
- { 222, 2 },
109468
- { 222, 1 },
109469
- { 222, 2 },
109539
+ { 221, 1 },
109540
+ { 221, 2 },
109541
+ { 221, 1 },
109542
+ { 221, 2 },
109470109543
{ 175, 3 },
109471109544
{ 175, 5 },
109472109545
{ 175, 2 },
109473109546
{ 175, 3 },
109474109547
{ 175, 3 },
@@ -109475,117 +109548,116 @@
109475109548
{ 175, 4 },
109476109549
{ 175, 2 },
109477109550
{ 175, 2 },
109478109551
{ 175, 2 },
109479109552
{ 175, 2 },
109553
+ { 222, 1 },
109554
+ { 222, 2 },
109555
+ { 175, 5 },
109480109556
{ 223, 1 },
109481109557
{ 223, 2 },
109482
- { 175, 5 },
109483
- { 224, 1 },
109484
- { 224, 2 },
109485109558
{ 175, 5 },
109486109559
{ 175, 3 },
109487109560
{ 175, 5 },
109488109561
{ 175, 4 },
109489109562
{ 175, 4 },
109490109563
{ 175, 5 },
109491
- { 226, 5 },
109492
- { 226, 4 },
109493
- { 227, 2 },
109494
- { 227, 0 },
109495
- { 225, 1 },
109496
- { 225, 0 },
109497
- { 221, 1 },
109498
- { 221, 0 },
109499
- { 216, 3 },
109500
- { 216, 1 },
109564
+ { 225, 5 },
109565
+ { 225, 4 },
109566
+ { 226, 2 },
109567
+ { 226, 0 },
109568
+ { 224, 1 },
109569
+ { 224, 0 },
109570
+ { 220, 1 },
109571
+ { 220, 0 },
109572
+ { 215, 3 },
109573
+ { 215, 1 },
109501109574
{ 147, 11 },
109502
- { 228, 1 },
109503
- { 228, 0 },
109575
+ { 227, 1 },
109576
+ { 227, 0 },
109504109577
{ 179, 0 },
109505109578
{ 179, 3 },
109506109579
{ 187, 5 },
109507109580
{ 187, 3 },
109508
- { 229, 0 },
109509
- { 229, 2 },
109581
+ { 228, 0 },
109582
+ { 228, 2 },
109510109583
{ 147, 4 },
109511109584
{ 147, 1 },
109512109585
{ 147, 2 },
109513109586
{ 147, 3 },
109514109587
{ 147, 5 },
109515109588
{ 147, 6 },
109516109589
{ 147, 5 },
109517109590
{ 147, 6 },
109518
- { 230, 1 },
109519
- { 230, 1 },
109520
- { 230, 1 },
109521
- { 230, 1 },
109522
- { 230, 1 },
109591
+ { 229, 1 },
109592
+ { 229, 1 },
109593
+ { 229, 1 },
109594
+ { 229, 1 },
109595
+ { 229, 1 },
109523109596
{ 170, 2 },
109597
+ { 170, 1 },
109524109598
{ 171, 2 },
109525
- { 232, 1 },
109526
- { 231, 1 },
109527
- { 231, 0 },
109599
+ { 230, 1 },
109528109600
{ 147, 5 },
109529
- { 233, 11 },
109530
- { 235, 1 },
109531
- { 235, 1 },
109532
- { 235, 2 },
109601
+ { 231, 11 },
109602
+ { 233, 1 },
109603
+ { 233, 1 },
109604
+ { 233, 2 },
109605
+ { 233, 0 },
109606
+ { 234, 1 },
109607
+ { 234, 1 },
109608
+ { 234, 3 },
109533109609
{ 235, 0 },
109534
- { 236, 1 },
109535
- { 236, 1 },
109536
- { 236, 3 },
109537
- { 237, 0 },
109538
- { 237, 3 },
109539
- { 238, 0 },
109540
- { 238, 2 },
109541
- { 234, 3 },
109542
- { 234, 2 },
109543
- { 240, 1 },
109544
- { 240, 3 },
109545
- { 241, 0 },
109546
- { 241, 3 },
109547
- { 241, 2 },
109548
- { 239, 7 },
109549
- { 239, 8 },
109550
- { 239, 5 },
109551
- { 239, 5 },
109552
- { 239, 1 },
109610
+ { 235, 3 },
109611
+ { 236, 0 },
109612
+ { 236, 2 },
109613
+ { 232, 3 },
109614
+ { 232, 2 },
109615
+ { 238, 1 },
109616
+ { 238, 3 },
109617
+ { 239, 0 },
109618
+ { 239, 3 },
109619
+ { 239, 2 },
109620
+ { 237, 7 },
109621
+ { 237, 5 },
109622
+ { 237, 5 },
109623
+ { 237, 5 },
109624
+ { 237, 1 },
109553109625
{ 175, 4 },
109554109626
{ 175, 6 },
109555109627
{ 191, 1 },
109556109628
{ 191, 1 },
109557109629
{ 191, 1 },
109558109630
{ 147, 4 },
109559109631
{ 147, 6 },
109560109632
{ 147, 3 },
109561
- { 243, 0 },
109562
- { 243, 2 },
109563
- { 242, 1 },
109564
- { 242, 0 },
109633
+ { 241, 0 },
109634
+ { 241, 2 },
109635
+ { 240, 1 },
109636
+ { 240, 0 },
109565109637
{ 147, 1 },
109566109638
{ 147, 3 },
109567109639
{ 147, 1 },
109568109640
{ 147, 3 },
109569109641
{ 147, 6 },
109570109642
{ 147, 6 },
109571
- { 244, 1 },
109572
- { 245, 0 },
109573
- { 245, 1 },
109643
+ { 242, 1 },
109644
+ { 243, 0 },
109645
+ { 243, 1 },
109574109646
{ 147, 1 },
109575109647
{ 147, 4 },
109576
- { 246, 7 },
109648
+ { 244, 8 },
109649
+ { 245, 1 },
109650
+ { 245, 3 },
109651
+ { 246, 0 },
109652
+ { 246, 2 },
109577109653
{ 247, 1 },
109578109654
{ 247, 3 },
109579
- { 248, 0 },
109580
- { 248, 2 },
109581
- { 249, 1 },
109582
- { 249, 3 },
109583
- { 250, 1 },
109584
- { 251, 0 },
109585
- { 251, 4 },
109586
- { 251, 2 },
109655
+ { 248, 1 },
109656
+ { 249, 0 },
109657
+ { 249, 4 },
109658
+ { 249, 2 },
109587109659
};
109588109660
109589109661
static void yy_accept(yyParser*); /* Forward Declaration */
109590109662
109591109663
/*
@@ -109649,21 +109721,21 @@
109649109721
break;
109650109722
case 8: /* cmdx ::= cmd */
109651109723
{ sqlite3FinishCoding(pParse); }
109652109724
break;
109653109725
case 9: /* cmd ::= BEGIN transtype trans_opt */
109654
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
109726
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);}
109655109727
break;
109656109728
case 13: /* transtype ::= */
109657
-{yygotominor.yy4 = TK_DEFERRED;}
109729
+{yygotominor.yy392 = TK_DEFERRED;}
109658109730
break;
109659109731
case 14: /* transtype ::= DEFERRED */
109660109732
case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
109661109733
case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
109662109734
case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
109663109735
case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
109664
-{yygotominor.yy4 = yymsp[0].major;}
109736
+{yygotominor.yy392 = yymsp[0].major;}
109665109737
break;
109666109738
case 17: /* cmd ::= COMMIT trans_opt */
109667109739
case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
109668109740
{sqlite3CommitTransaction(pParse);}
109669109741
break;
@@ -109685,11 +109757,11 @@
109685109757
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
109686109758
}
109687109759
break;
109688109760
case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
109689109761
{
109690
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
109762
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392);
109691109763
}
109692109764
break;
109693109765
case 27: /* createkw ::= CREATE */
109694109766
{
109695109767
pParse->db->lookaside.bEnabled = 0;
@@ -109704,33 +109776,33 @@
109704109776
case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==87);
109705109777
case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98);
109706109778
case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
109707109779
case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
109708109780
case 121: /* distinct ::= */ yytestcase(yyruleno==121);
109709
- case 222: /* between_op ::= BETWEEN */ yytestcase(yyruleno==222);
109710
- case 225: /* in_op ::= IN */ yytestcase(yyruleno==225);
109711
-{yygotominor.yy4 = 0;}
109781
+ case 221: /* between_op ::= BETWEEN */ yytestcase(yyruleno==221);
109782
+ case 224: /* in_op ::= IN */ yytestcase(yyruleno==224);
109783
+{yygotominor.yy392 = 0;}
109712109784
break;
109713109785
case 29: /* ifnotexists ::= IF NOT EXISTS */
109714109786
case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
109715109787
case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
109716109788
case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
109717109789
case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
109718109790
case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
109719
- case 223: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==223);
109720
- case 226: /* in_op ::= NOT IN */ yytestcase(yyruleno==226);
109721
-{yygotominor.yy4 = 1;}
109791
+ case 222: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==222);
109792
+ case 225: /* in_op ::= NOT IN */ yytestcase(yyruleno==225);
109793
+{yygotominor.yy392 = 1;}
109722109794
break;
109723109795
case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
109724109796
{
109725109797
sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
109726109798
}
109727109799
break;
109728109800
case 33: /* create_table_args ::= AS select */
109729109801
{
109730
- sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy387);
109731
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
109802
+ sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy159);
109803
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);
109732109804
}
109733109805
break;
109734109806
case 36: /* column ::= columnid type carglist */
109735109807
{
109736109808
yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
@@ -109753,20 +109825,21 @@
109753109825
case 49: /* typename ::= ids */ yytestcase(yyruleno==49);
109754109826
case 127: /* as ::= AS nm */ yytestcase(yyruleno==127);
109755109827
case 128: /* as ::= ids */ yytestcase(yyruleno==128);
109756109828
case 138: /* dbnm ::= DOT nm */ yytestcase(yyruleno==138);
109757109829
case 147: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==147);
109758
- case 251: /* collate ::= COLLATE ids */ yytestcase(yyruleno==251);
109759
- case 260: /* nmnum ::= plus_num */ yytestcase(yyruleno==260);
109760
- case 261: /* nmnum ::= nm */ yytestcase(yyruleno==261);
109761
- case 262: /* nmnum ::= ON */ yytestcase(yyruleno==262);
109762
- case 263: /* nmnum ::= DELETE */ yytestcase(yyruleno==263);
109763
- case 264: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==264);
109764
- case 265: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==265);
109830
+ case 250: /* collate ::= COLLATE ids */ yytestcase(yyruleno==250);
109831
+ case 259: /* nmnum ::= plus_num */ yytestcase(yyruleno==259);
109832
+ case 260: /* nmnum ::= nm */ yytestcase(yyruleno==260);
109833
+ case 261: /* nmnum ::= ON */ yytestcase(yyruleno==261);
109834
+ case 262: /* nmnum ::= DELETE */ yytestcase(yyruleno==262);
109835
+ case 263: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==263);
109836
+ case 264: /* plus_num ::= PLUS number */ yytestcase(yyruleno==264);
109837
+ case 265: /* plus_num ::= number */ yytestcase(yyruleno==265);
109765109838
case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
109766109839
case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
109767
- case 285: /* trnm ::= nm */ yytestcase(yyruleno==285);
109840
+ case 283: /* trnm ::= nm */ yytestcase(yyruleno==283);
109768109841
{yygotominor.yy0 = yymsp[0].minor.yy0;}
109769109842
break;
109770109843
case 45: /* type ::= typetoken */
109771109844
{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
109772109845
break;
@@ -109785,21 +109858,21 @@
109785109858
case 50: /* typename ::= typename ids */
109786109859
{yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
109787109860
break;
109788109861
case 57: /* ccons ::= DEFAULT term */
109789109862
case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
109790
-{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy118);}
109863
+{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);}
109791109864
break;
109792109865
case 58: /* ccons ::= DEFAULT LP expr RP */
109793
-{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy118);}
109866
+{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);}
109794109867
break;
109795109868
case 60: /* ccons ::= DEFAULT MINUS term */
109796109869
{
109797109870
ExprSpan v;
109798
- v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy118.pExpr, 0, 0);
109871
+ v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0);
109799109872
v.zStart = yymsp[-1].minor.yy0.z;
109800
- v.zEnd = yymsp[0].minor.yy118.zEnd;
109873
+ v.zEnd = yymsp[0].minor.yy342.zEnd;
109801109874
sqlite3AddDefaultValue(pParse,&v);
109802109875
}
109803109876
break;
109804109877
case 61: /* ccons ::= DEFAULT id */
109805109878
{
@@ -109807,897 +109880,921 @@
109807109880
spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
109808109881
sqlite3AddDefaultValue(pParse,&v);
109809109882
}
109810109883
break;
109811109884
case 63: /* ccons ::= NOT NULL onconf */
109812
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
109885
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);}
109813109886
break;
109814109887
case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
109815
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
109888
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);}
109816109889
break;
109817109890
case 65: /* ccons ::= UNIQUE onconf */
109818
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0);}
109891
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);}
109819109892
break;
109820109893
case 66: /* ccons ::= CHECK LP expr RP */
109821
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy118.pExpr);}
109894
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);}
109822109895
break;
109823109896
case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
109824
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
109897
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);}
109825109898
break;
109826109899
case 68: /* ccons ::= defer_subclause */
109827
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
109900
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);}
109828109901
break;
109829109902
case 69: /* ccons ::= COLLATE ids */
109830109903
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
109831109904
break;
109832109905
case 72: /* refargs ::= */
109833
-{ yygotominor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
109906
+{ yygotominor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */}
109834109907
break;
109835109908
case 73: /* refargs ::= refargs refarg */
109836
-{ yygotominor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
109909
+{ yygotominor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; }
109837109910
break;
109838109911
case 74: /* refarg ::= MATCH nm */
109839109912
case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
109840
-{ yygotominor.yy215.value = 0; yygotominor.yy215.mask = 0x000000; }
109913
+{ yygotominor.yy207.value = 0; yygotominor.yy207.mask = 0x000000; }
109841109914
break;
109842109915
case 76: /* refarg ::= ON DELETE refact */
109843
-{ yygotominor.yy215.value = yymsp[0].minor.yy4; yygotominor.yy215.mask = 0x0000ff; }
109916
+{ yygotominor.yy207.value = yymsp[0].minor.yy392; yygotominor.yy207.mask = 0x0000ff; }
109844109917
break;
109845109918
case 77: /* refarg ::= ON UPDATE refact */
109846
-{ yygotominor.yy215.value = yymsp[0].minor.yy4<<8; yygotominor.yy215.mask = 0x00ff00; }
109919
+{ yygotominor.yy207.value = yymsp[0].minor.yy392<<8; yygotominor.yy207.mask = 0x00ff00; }
109847109920
break;
109848109921
case 78: /* refact ::= SET NULL */
109849
-{ yygotominor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
109922
+{ yygotominor.yy392 = OE_SetNull; /* EV: R-33326-45252 */}
109850109923
break;
109851109924
case 79: /* refact ::= SET DEFAULT */
109852
-{ yygotominor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
109925
+{ yygotominor.yy392 = OE_SetDflt; /* EV: R-33326-45252 */}
109853109926
break;
109854109927
case 80: /* refact ::= CASCADE */
109855
-{ yygotominor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
109928
+{ yygotominor.yy392 = OE_Cascade; /* EV: R-33326-45252 */}
109856109929
break;
109857109930
case 81: /* refact ::= RESTRICT */
109858
-{ yygotominor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
109931
+{ yygotominor.yy392 = OE_Restrict; /* EV: R-33326-45252 */}
109859109932
break;
109860109933
case 82: /* refact ::= NO ACTION */
109861
-{ yygotominor.yy4 = OE_None; /* EV: R-33326-45252 */}
109934
+{ yygotominor.yy392 = OE_None; /* EV: R-33326-45252 */}
109862109935
break;
109863109936
case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
109864109937
case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
109865109938
case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
109866109939
case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
109867
-{yygotominor.yy4 = yymsp[0].minor.yy4;}
109940
+{yygotominor.yy392 = yymsp[0].minor.yy392;}
109868109941
break;
109869109942
case 88: /* conslist_opt ::= */
109870109943
{yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
109871109944
break;
109872109945
case 89: /* conslist_opt ::= COMMA conslist */
109873109946
{yygotominor.yy0 = yymsp[-1].minor.yy0;}
109874109947
break;
109875109948
case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
109876
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
109949
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);}
109877109950
break;
109878109951
case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
109879
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0);}
109952
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);}
109880109953
break;
109881109954
case 96: /* tcons ::= CHECK LP expr RP onconf */
109882
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy118.pExpr);}
109955
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);}
109883109956
break;
109884109957
case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
109885109958
{
109886
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
109887
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
109959
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392);
109960
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392);
109888109961
}
109889109962
break;
109890109963
case 100: /* onconf ::= */
109891
-{yygotominor.yy4 = OE_Default;}
109964
+{yygotominor.yy392 = OE_Default;}
109892109965
break;
109893109966
case 102: /* orconf ::= */
109894
-{yygotominor.yy210 = OE_Default;}
109967
+{yygotominor.yy258 = OE_Default;}
109895109968
break;
109896109969
case 103: /* orconf ::= OR resolvetype */
109897
-{yygotominor.yy210 = (u8)yymsp[0].minor.yy4;}
109970
+{yygotominor.yy258 = (u8)yymsp[0].minor.yy392;}
109898109971
break;
109899109972
case 105: /* resolvetype ::= IGNORE */
109900
-{yygotominor.yy4 = OE_Ignore;}
109973
+{yygotominor.yy392 = OE_Ignore;}
109901109974
break;
109902109975
case 106: /* resolvetype ::= REPLACE */
109903
-{yygotominor.yy4 = OE_Replace;}
109976
+{yygotominor.yy392 = OE_Replace;}
109904109977
break;
109905109978
case 107: /* cmd ::= DROP TABLE ifexists fullname */
109906109979
{
109907
- sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
109980
+ sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392);
109908109981
}
109909109982
break;
109910109983
case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
109911109984
{
109912
- sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy387, yymsp[-6].minor.yy4, yymsp[-4].minor.yy4);
109985
+ sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy159, yymsp[-6].minor.yy392, yymsp[-4].minor.yy392);
109913109986
}
109914109987
break;
109915109988
case 111: /* cmd ::= DROP VIEW ifexists fullname */
109916109989
{
109917
- sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
109990
+ sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392);
109918109991
}
109919109992
break;
109920109993
case 112: /* cmd ::= select */
109921109994
{
109922109995
SelectDest dest = {SRT_Output, 0, 0, 0, 0};
109923
- sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
109996
+ sqlite3Select(pParse, yymsp[0].minor.yy159, &dest);
109924109997
sqlite3ExplainBegin(pParse->pVdbe);
109925
- sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy387);
109998
+ sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy159);
109926109999
sqlite3ExplainFinish(pParse->pVdbe);
109927
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
110000
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);
109928110001
}
109929110002
break;
109930110003
case 113: /* select ::= oneselect */
109931
-{yygotominor.yy387 = yymsp[0].minor.yy387;}
110004
+{yygotominor.yy159 = yymsp[0].minor.yy159;}
109932110005
break;
109933110006
case 114: /* select ::= select multiselect_op oneselect */
109934110007
{
109935
- if( yymsp[0].minor.yy387 ){
109936
- yymsp[0].minor.yy387->op = (u8)yymsp[-1].minor.yy4;
109937
- yymsp[0].minor.yy387->pPrior = yymsp[-2].minor.yy387;
110008
+ if( yymsp[0].minor.yy159 ){
110009
+ yymsp[0].minor.yy159->op = (u8)yymsp[-1].minor.yy392;
110010
+ yymsp[0].minor.yy159->pPrior = yymsp[-2].minor.yy159;
109938110011
}else{
109939
- sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy387);
110012
+ sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy159);
109940110013
}
109941
- yygotominor.yy387 = yymsp[0].minor.yy387;
110014
+ yygotominor.yy159 = yymsp[0].minor.yy159;
109942110015
}
109943110016
break;
109944110017
case 116: /* multiselect_op ::= UNION ALL */
109945
-{yygotominor.yy4 = TK_ALL;}
110018
+{yygotominor.yy392 = TK_ALL;}
109946110019
break;
109947110020
case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
109948110021
{
109949
- yygotominor.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.yy292.pLimit,yymsp[0].minor.yy292.pOffset);
110022
+ yygotominor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset);
109950110023
}
109951110024
break;
109952110025
case 122: /* sclp ::= selcollist COMMA */
109953
- case 247: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==247);
109954
-{yygotominor.yy322 = yymsp[-1].minor.yy322;}
110026
+ case 246: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==246);
110027
+{yygotominor.yy442 = yymsp[-1].minor.yy442;}
109955110028
break;
109956110029
case 123: /* sclp ::= */
109957110030
case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
109958
- case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159);
109959
- case 240: /* exprlist ::= */ yytestcase(yyruleno==240);
109960
- case 246: /* idxlist_opt ::= */ yytestcase(yyruleno==246);
109961
-{yygotominor.yy322 = 0;}
110031
+ case 158: /* groupby_opt ::= */ yytestcase(yyruleno==158);
110032
+ case 239: /* exprlist ::= */ yytestcase(yyruleno==239);
110033
+ case 245: /* idxlist_opt ::= */ yytestcase(yyruleno==245);
110034
+{yygotominor.yy442 = 0;}
109962110035
break;
109963110036
case 124: /* selcollist ::= sclp expr as */
109964110037
{
109965
- yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, yymsp[-1].minor.yy118.pExpr);
109966
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[0].minor.yy0, 1);
109967
- sqlite3ExprListSetSpan(pParse,yygotominor.yy322,&yymsp[-1].minor.yy118);
110038
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr);
110039
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[0].minor.yy0, 1);
110040
+ sqlite3ExprListSetSpan(pParse,yygotominor.yy442,&yymsp[-1].minor.yy342);
109968110041
}
109969110042
break;
109970110043
case 125: /* selcollist ::= sclp STAR */
109971110044
{
109972110045
Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
109973
- yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy322, p);
110046
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p);
109974110047
}
109975110048
break;
109976110049
case 126: /* selcollist ::= sclp nm DOT STAR */
109977110050
{
109978110051
Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
109979110052
Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
109980110053
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
109981
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, pDot);
110054
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot);
109982110055
}
109983110056
break;
109984110057
case 129: /* as ::= */
109985110058
{yygotominor.yy0.n = 0;}
109986110059
break;
109987110060
case 130: /* from ::= */
109988
-{yygotominor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy259));}
110061
+{yygotominor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy347));}
109989110062
break;
109990110063
case 131: /* from ::= FROM seltablist */
109991110064
{
109992
- yygotominor.yy259 = yymsp[0].minor.yy259;
109993
- sqlite3SrcListShiftJoinType(yygotominor.yy259);
110065
+ yygotominor.yy347 = yymsp[0].minor.yy347;
110066
+ sqlite3SrcListShiftJoinType(yygotominor.yy347);
109994110067
}
109995110068
break;
109996110069
case 132: /* stl_prefix ::= seltablist joinop */
109997110070
{
109998
- yygotominor.yy259 = yymsp[-1].minor.yy259;
109999
- if( ALWAYS(yygotominor.yy259 && yygotominor.yy259->nSrc>0) ) yygotominor.yy259->a[yygotominor.yy259->nSrc-1].jointype = (u8)yymsp[0].minor.yy4;
110071
+ yygotominor.yy347 = yymsp[-1].minor.yy347;
110072
+ if( ALWAYS(yygotominor.yy347 && yygotominor.yy347->nSrc>0) ) yygotominor.yy347->a[yygotominor.yy347->nSrc-1].jointype = (u8)yymsp[0].minor.yy392;
110000110073
}
110001110074
break;
110002110075
case 133: /* stl_prefix ::= */
110003
-{yygotominor.yy259 = 0;}
110076
+{yygotominor.yy347 = 0;}
110004110077
break;
110005110078
case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
110006110079
{
110007
- yygotominor.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);
110008
- sqlite3SrcListIndexedBy(pParse, yygotominor.yy259, &yymsp[-2].minor.yy0);
110080
+ yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110081
+ sqlite3SrcListIndexedBy(pParse, yygotominor.yy347, &yymsp[-2].minor.yy0);
110009110082
}
110010110083
break;
110011110084
case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
110012110085
{
110013
- yygotominor.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);
110086
+ yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110014110087
}
110015110088
break;
110016110089
case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
110017110090
{
110018
- if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
110019
- yygotominor.yy259 = yymsp[-4].minor.yy259;
110091
+ if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){
110092
+ yygotominor.yy347 = yymsp[-4].minor.yy347;
110020110093
}else{
110021110094
Select *pSubquery;
110022
- sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
110023
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,0,0,0);
110024
- yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
110095
+ sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347);
110096
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0);
110097
+ yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110025110098
}
110026110099
}
110027110100
break;
110028110101
case 137: /* dbnm ::= */
110029110102
case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
110030110103
{yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
110031110104
break;
110032110105
case 139: /* fullname ::= nm dbnm */
110033
-{yygotominor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
110106
+{yygotominor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
110034110107
break;
110035110108
case 140: /* joinop ::= COMMA|JOIN */
110036
-{ yygotominor.yy4 = JT_INNER; }
110109
+{ yygotominor.yy392 = JT_INNER; }
110037110110
break;
110038110111
case 141: /* joinop ::= JOIN_KW JOIN */
110039
-{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
110112
+{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
110040110113
break;
110041110114
case 142: /* joinop ::= JOIN_KW nm JOIN */
110042
-{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
110115
+{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
110043110116
break;
110044110117
case 143: /* joinop ::= JOIN_KW nm nm JOIN */
110045
-{ yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
110118
+{ yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
110046110119
break;
110047110120
case 144: /* on_opt ::= ON expr */
110048
- case 155: /* sortitem ::= expr */ yytestcase(yyruleno==155);
110049
- case 162: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==162);
110050
- case 169: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==169);
110051
- case 235: /* case_else ::= ELSE expr */ yytestcase(yyruleno==235);
110052
- case 237: /* case_operand ::= expr */ yytestcase(yyruleno==237);
110053
-{yygotominor.yy314 = yymsp[0].minor.yy118.pExpr;}
110121
+ case 161: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==161);
110122
+ case 168: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==168);
110123
+ case 234: /* case_else ::= ELSE expr */ yytestcase(yyruleno==234);
110124
+ case 236: /* case_operand ::= expr */ yytestcase(yyruleno==236);
110125
+{yygotominor.yy122 = yymsp[0].minor.yy342.pExpr;}
110054110126
break;
110055110127
case 145: /* on_opt ::= */
110056
- case 161: /* having_opt ::= */ yytestcase(yyruleno==161);
110057
- case 168: /* where_opt ::= */ yytestcase(yyruleno==168);
110058
- case 236: /* case_else ::= */ yytestcase(yyruleno==236);
110059
- case 238: /* case_operand ::= */ yytestcase(yyruleno==238);
110060
-{yygotominor.yy314 = 0;}
110128
+ case 160: /* having_opt ::= */ yytestcase(yyruleno==160);
110129
+ case 167: /* where_opt ::= */ yytestcase(yyruleno==167);
110130
+ case 235: /* case_else ::= */ yytestcase(yyruleno==235);
110131
+ case 237: /* case_operand ::= */ yytestcase(yyruleno==237);
110132
+{yygotominor.yy122 = 0;}
110061110133
break;
110062110134
case 148: /* indexed_opt ::= NOT INDEXED */
110063110135
{yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
110064110136
break;
110065110137
case 149: /* using_opt ::= USING LP inscollist RP */
110066
- case 181: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==181);
110067
-{yygotominor.yy384 = yymsp[-1].minor.yy384;}
110138
+ case 180: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==180);
110139
+{yygotominor.yy180 = yymsp[-1].minor.yy180;}
110068110140
break;
110069110141
case 150: /* using_opt ::= */
110070
- case 180: /* inscollist_opt ::= */ yytestcase(yyruleno==180);
110071
-{yygotominor.yy384 = 0;}
110142
+ case 179: /* inscollist_opt ::= */ yytestcase(yyruleno==179);
110143
+{yygotominor.yy180 = 0;}
110072110144
break;
110073110145
case 152: /* orderby_opt ::= ORDER BY sortlist */
110074
- case 160: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==160);
110075
- case 239: /* exprlist ::= nexprlist */ yytestcase(yyruleno==239);
110076
-{yygotominor.yy322 = yymsp[0].minor.yy322;}
110077
- break;
110078
- case 153: /* sortlist ::= sortlist COMMA sortitem sortorder */
110079
-{
110080
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
110081
- if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110082
-}
110083
- break;
110084
- case 154: /* sortlist ::= sortitem sortorder */
110085
-{
110086
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314);
110087
- if( yygotominor.yy322 && ALWAYS(yygotominor.yy322->a) ) yygotominor.yy322->a[0].sortOrder = (u8)yymsp[0].minor.yy4;
110088
-}
110089
- break;
110090
- case 156: /* sortorder ::= ASC */
110091
- case 158: /* sortorder ::= */ yytestcase(yyruleno==158);
110092
-{yygotominor.yy4 = SQLITE_SO_ASC;}
110093
- break;
110094
- case 157: /* sortorder ::= DESC */
110095
-{yygotominor.yy4 = SQLITE_SO_DESC;}
110096
- break;
110097
- case 163: /* limit_opt ::= */
110098
-{yygotominor.yy292.pLimit = 0; yygotominor.yy292.pOffset = 0;}
110099
- break;
110100
- case 164: /* limit_opt ::= LIMIT expr */
110101
-{yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr; yygotominor.yy292.pOffset = 0;}
110102
- break;
110103
- case 165: /* limit_opt ::= LIMIT expr OFFSET expr */
110104
-{yygotominor.yy292.pLimit = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pOffset = yymsp[0].minor.yy118.pExpr;}
110105
- break;
110106
- case 166: /* limit_opt ::= LIMIT expr COMMA expr */
110107
-{yygotominor.yy292.pOffset = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr;}
110108
- break;
110109
- case 167: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
110110
-{
110111
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
110112
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314);
110113
-}
110114
- break;
110115
- case 170: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
110116
-{
110117
- sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
110118
- sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
110119
- sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy210);
110120
-}
110121
- break;
110122
- case 171: /* setlist ::= setlist COMMA nm EQ expr */
110123
-{
110124
- yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy118.pExpr);
110125
- sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110126
-}
110127
- break;
110128
- case 172: /* setlist ::= nm EQ expr */
110129
-{
110130
- yygotominor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy118.pExpr);
110131
- sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110132
-}
110133
- break;
110134
- case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
110135
-{sqlite3Insert(pParse, yymsp[-5].minor.yy259, yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy384, yymsp[-7].minor.yy210);}
110136
- break;
110137
- case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
110138
-{sqlite3Insert(pParse, yymsp[-2].minor.yy259, 0, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy210);}
110139
- break;
110140
- case 175: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
110141
-{sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy210);}
110142
- break;
110143
- case 176: /* insert_cmd ::= INSERT orconf */
110144
-{yygotominor.yy210 = yymsp[0].minor.yy210;}
110145
- break;
110146
- case 177: /* insert_cmd ::= REPLACE */
110147
-{yygotominor.yy210 = OE_Replace;}
110148
- break;
110149
- case 178: /* itemlist ::= itemlist COMMA expr */
110150
- case 241: /* nexprlist ::= nexprlist COMMA expr */ yytestcase(yyruleno==241);
110151
-{yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy118.pExpr);}
110152
- break;
110153
- case 179: /* itemlist ::= expr */
110154
- case 242: /* nexprlist ::= expr */ yytestcase(yyruleno==242);
110155
-{yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy118.pExpr);}
110156
- break;
110157
- case 182: /* inscollist ::= inscollist COMMA nm */
110158
-{yygotominor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
110159
- break;
110160
- case 183: /* inscollist ::= nm */
110161
-{yygotominor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
110162
- break;
110163
- case 184: /* expr ::= term */
110164
-{yygotominor.yy118 = yymsp[0].minor.yy118;}
110165
- break;
110166
- case 185: /* expr ::= LP expr RP */
110167
-{yygotominor.yy118.pExpr = yymsp[-1].minor.yy118.pExpr; spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
110168
- break;
110169
- case 186: /* term ::= NULL */
110170
- case 191: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==191);
110171
- case 192: /* term ::= STRING */ yytestcase(yyruleno==192);
110172
-{spanExpr(&yygotominor.yy118, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
110173
- break;
110174
- case 187: /* expr ::= id */
110175
- case 188: /* expr ::= JOIN_KW */ yytestcase(yyruleno==188);
110176
-{spanExpr(&yygotominor.yy118, pParse, TK_ID, &yymsp[0].minor.yy0);}
110177
- break;
110178
- case 189: /* expr ::= nm DOT nm */
110146
+ case 159: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==159);
110147
+ case 238: /* exprlist ::= nexprlist */ yytestcase(yyruleno==238);
110148
+{yygotominor.yy442 = yymsp[0].minor.yy442;}
110149
+ break;
110150
+ case 153: /* sortlist ::= sortlist COMMA expr sortorder */
110151
+{
110152
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr);
110153
+ if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110154
+}
110155
+ break;
110156
+ case 154: /* sortlist ::= expr sortorder */
110157
+{
110158
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr);
110159
+ if( yygotominor.yy442 && ALWAYS(yygotominor.yy442->a) ) yygotominor.yy442->a[0].sortOrder = (u8)yymsp[0].minor.yy392;
110160
+}
110161
+ break;
110162
+ case 155: /* sortorder ::= ASC */
110163
+ case 157: /* sortorder ::= */ yytestcase(yyruleno==157);
110164
+{yygotominor.yy392 = SQLITE_SO_ASC;}
110165
+ break;
110166
+ case 156: /* sortorder ::= DESC */
110167
+{yygotominor.yy392 = SQLITE_SO_DESC;}
110168
+ break;
110169
+ case 162: /* limit_opt ::= */
110170
+{yygotominor.yy64.pLimit = 0; yygotominor.yy64.pOffset = 0;}
110171
+ break;
110172
+ case 163: /* limit_opt ::= LIMIT expr */
110173
+{yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yygotominor.yy64.pOffset = 0;}
110174
+ break;
110175
+ case 164: /* limit_opt ::= LIMIT expr OFFSET expr */
110176
+{yygotominor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;}
110177
+ break;
110178
+ case 165: /* limit_opt ::= LIMIT expr COMMA expr */
110179
+{yygotominor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;}
110180
+ break;
110181
+ case 166: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
110182
+{
110183
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0);
110184
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122);
110185
+}
110186
+ break;
110187
+ case 169: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
110188
+{
110189
+ sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0);
110190
+ sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list");
110191
+ sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy258);
110192
+}
110193
+ break;
110194
+ case 170: /* setlist ::= setlist COMMA nm EQ expr */
110195
+{
110196
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr);
110197
+ sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110198
+}
110199
+ break;
110200
+ case 171: /* setlist ::= nm EQ expr */
110201
+{
110202
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr);
110203
+ sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110204
+}
110205
+ break;
110206
+ case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt valuelist */
110207
+{sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}
110208
+ break;
110209
+ case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
110210
+{sqlite3Insert(pParse, yymsp[-2].minor.yy347, 0, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}
110211
+ break;
110212
+ case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
110213
+{sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy258);}
110214
+ break;
110215
+ case 175: /* insert_cmd ::= INSERT orconf */
110216
+{yygotominor.yy258 = yymsp[0].minor.yy258;}
110217
+ break;
110218
+ case 176: /* insert_cmd ::= REPLACE */
110219
+{yygotominor.yy258 = OE_Replace;}
110220
+ break;
110221
+ case 177: /* valuelist ::= VALUES LP nexprlist RP */
110222
+{
110223
+ yygotominor.yy487.pList = yymsp[-1].minor.yy442;
110224
+ yygotominor.yy487.pSelect = 0;
110225
+}
110226
+ break;
110227
+ case 178: /* valuelist ::= valuelist COMMA LP exprlist RP */
110228
+{
110229
+ Select *pRight = sqlite3SelectNew(pParse, yymsp[-1].minor.yy442, 0, 0, 0, 0, 0, 0, 0, 0);
110230
+ if( yymsp[-4].minor.yy487.pList ){
110231
+ yymsp[-4].minor.yy487.pSelect = sqlite3SelectNew(pParse, yymsp[-4].minor.yy487.pList, 0, 0, 0, 0, 0, 0, 0, 0);
110232
+ yymsp[-4].minor.yy487.pList = 0;
110233
+ }
110234
+ yygotominor.yy487.pList = 0;
110235
+ if( yymsp[-4].minor.yy487.pSelect==0 || pRight==0 ){
110236
+ sqlite3SelectDelete(pParse->db, pRight);
110237
+ sqlite3SelectDelete(pParse->db, yymsp[-4].minor.yy487.pSelect);
110238
+ yygotominor.yy487.pSelect = 0;
110239
+ }else{
110240
+ pRight->op = TK_ALL;
110241
+ pRight->pPrior = yymsp[-4].minor.yy487.pSelect;
110242
+ pRight->selFlags |= SF_Values;
110243
+ pRight->pPrior->selFlags |= SF_Values;
110244
+ yygotominor.yy487.pSelect = pRight;
110245
+ }
110246
+}
110247
+ break;
110248
+ case 181: /* inscollist ::= inscollist COMMA nm */
110249
+{yygotominor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);}
110250
+ break;
110251
+ case 182: /* inscollist ::= nm */
110252
+{yygotominor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
110253
+ break;
110254
+ case 183: /* expr ::= term */
110255
+{yygotominor.yy342 = yymsp[0].minor.yy342;}
110256
+ break;
110257
+ case 184: /* expr ::= LP expr RP */
110258
+{yygotominor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr; spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
110259
+ break;
110260
+ case 185: /* term ::= NULL */
110261
+ case 190: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==190);
110262
+ case 191: /* term ::= STRING */ yytestcase(yyruleno==191);
110263
+{spanExpr(&yygotominor.yy342, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
110264
+ break;
110265
+ case 186: /* expr ::= id */
110266
+ case 187: /* expr ::= JOIN_KW */ yytestcase(yyruleno==187);
110267
+{spanExpr(&yygotominor.yy342, pParse, TK_ID, &yymsp[0].minor.yy0);}
110268
+ break;
110269
+ case 188: /* expr ::= nm DOT nm */
110179110270
{
110180110271
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110181110272
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110182
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
110183
- spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
110273
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
110274
+ spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
110184110275
}
110185110276
break;
110186
- case 190: /* expr ::= nm DOT nm DOT nm */
110277
+ case 189: /* expr ::= nm DOT nm DOT nm */
110187110278
{
110188110279
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
110189110280
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110190110281
Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110191110282
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
110192
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
110193
- spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110283
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
110284
+ spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110194110285
}
110195110286
break;
110196
- case 193: /* expr ::= REGISTER */
110287
+ case 192: /* expr ::= REGISTER */
110197110288
{
110198110289
/* When doing a nested parse, one can include terms in an expression
110199110290
** that look like this: #1 #2 ... These terms refer to registers
110200110291
** in the virtual machine. #N is the N-th register. */
110201110292
if( pParse->nested==0 ){
110202110293
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0);
110203
- yygotominor.yy118.pExpr = 0;
110204
- }else{
110205
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
110206
- if( yygotominor.yy118.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy118.pExpr->iTable);
110207
- }
110208
- spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110209
-}
110210
- break;
110211
- case 194: /* expr ::= VARIABLE */
110212
-{
110213
- spanExpr(&yygotominor.yy118, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
110214
- sqlite3ExprAssignVarNumber(pParse, yygotominor.yy118.pExpr);
110215
- spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110216
-}
110217
- break;
110218
- case 195: /* expr ::= expr COLLATE ids */
110219
-{
110220
- yygotominor.yy118.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy118.pExpr, &yymsp[0].minor.yy0);
110221
- yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
110222
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110223
-}
110224
- break;
110225
- case 196: /* expr ::= CAST LP expr AS typetoken RP */
110226
-{
110227
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy118.pExpr, 0, &yymsp[-1].minor.yy0);
110228
- spanSet(&yygotominor.yy118,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
110229
-}
110230
- break;
110231
- case 197: /* expr ::= ID LP distinct exprlist RP */
110232
-{
110233
- if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
110294
+ yygotominor.yy342.pExpr = 0;
110295
+ }else{
110296
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
110297
+ if( yygotominor.yy342.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy342.pExpr->iTable);
110298
+ }
110299
+ spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110300
+}
110301
+ break;
110302
+ case 193: /* expr ::= VARIABLE */
110303
+{
110304
+ spanExpr(&yygotominor.yy342, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
110305
+ sqlite3ExprAssignVarNumber(pParse, yygotominor.yy342.pExpr);
110306
+ spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110307
+}
110308
+ break;
110309
+ case 194: /* expr ::= expr COLLATE ids */
110310
+{
110311
+ yygotominor.yy342.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0);
110312
+ yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;
110313
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110314
+}
110315
+ break;
110316
+ case 195: /* expr ::= CAST LP expr AS typetoken RP */
110317
+{
110318
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0);
110319
+ spanSet(&yygotominor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
110320
+}
110321
+ break;
110322
+ case 196: /* expr ::= ID LP distinct exprlist RP */
110323
+{
110324
+ if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
110234110325
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
110235110326
}
110236
- yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
110237
- spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110238
- if( yymsp[-2].minor.yy4 && yygotominor.yy118.pExpr ){
110239
- yygotominor.yy118.pExpr->flags |= EP_Distinct;
110240
- }
110241
-}
110242
- break;
110243
- case 198: /* expr ::= ID LP STAR RP */
110244
-{
110245
- yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
110246
- spanSet(&yygotominor.yy118,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
110247
-}
110248
- break;
110249
- case 199: /* term ::= CTIME_KW */
110327
+ yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0);
110328
+ spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110329
+ if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){
110330
+ yygotominor.yy342.pExpr->flags |= EP_Distinct;
110331
+ }
110332
+}
110333
+ break;
110334
+ case 197: /* expr ::= ID LP STAR RP */
110335
+{
110336
+ yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
110337
+ spanSet(&yygotominor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
110338
+}
110339
+ break;
110340
+ case 198: /* term ::= CTIME_KW */
110250110341
{
110251110342
/* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
110252110343
** treated as functions that return constants */
110253
- yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
110254
- if( yygotominor.yy118.pExpr ){
110255
- yygotominor.yy118.pExpr->op = TK_CONST_FUNC;
110256
- }
110257
- spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110258
-}
110259
- break;
110260
- case 200: /* expr ::= expr AND expr */
110261
- case 201: /* expr ::= expr OR expr */ yytestcase(yyruleno==201);
110262
- case 202: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==202);
110263
- case 203: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==203);
110264
- case 204: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==204);
110265
- case 205: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==205);
110266
- case 206: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==206);
110267
- case 207: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==207);
110268
-{spanBinaryExpr(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);}
110269
- break;
110270
- case 208: /* likeop ::= LIKE_KW */
110271
- case 210: /* likeop ::= MATCH */ yytestcase(yyruleno==210);
110272
-{yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 0;}
110273
- break;
110274
- case 209: /* likeop ::= NOT LIKE_KW */
110275
- case 211: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==211);
110276
-{yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 1;}
110277
- break;
110278
- case 212: /* expr ::= expr likeop expr */
110279
-{
110280
- ExprList *pList;
110281
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy118.pExpr);
110282
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy118.pExpr);
110283
- yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy342.eOperator);
110284
- if( yymsp[-1].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110285
- yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
110286
- yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110287
- if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
110288
-}
110289
- break;
110290
- case 213: /* expr ::= expr likeop expr ESCAPE expr */
110291
-{
110292
- ExprList *pList;
110293
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110294
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy118.pExpr);
110295
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
110296
- yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy342.eOperator);
110297
- if( yymsp[-3].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110298
- yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110299
- yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110300
- if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
110301
-}
110302
- break;
110303
- case 214: /* expr ::= expr ISNULL|NOTNULL */
110304
-{spanUnaryPostfix(&yygotominor.yy118,pParse,yymsp[0].major,&yymsp[-1].minor.yy118,&yymsp[0].minor.yy0);}
110305
- break;
110306
- case 215: /* expr ::= expr NOT NULL */
110307
-{spanUnaryPostfix(&yygotominor.yy118,pParse,TK_NOTNULL,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy0);}
110308
- break;
110309
- case 216: /* expr ::= expr IS expr */
110310
-{
110311
- spanBinaryExpr(&yygotominor.yy118,pParse,TK_IS,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);
110312
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_ISNULL);
110313
-}
110314
- break;
110315
- case 217: /* expr ::= expr IS NOT expr */
110316
-{
110317
- spanBinaryExpr(&yygotominor.yy118,pParse,TK_ISNOT,&yymsp[-3].minor.yy118,&yymsp[0].minor.yy118);
110318
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_NOTNULL);
110319
-}
110320
- break;
110321
- case 218: /* expr ::= NOT expr */
110322
- case 219: /* expr ::= BITNOT expr */ yytestcase(yyruleno==219);
110323
-{spanUnaryPrefix(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110324
- break;
110325
- case 220: /* expr ::= MINUS expr */
110326
-{spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UMINUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110327
- break;
110328
- case 221: /* expr ::= PLUS expr */
110329
-{spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UPLUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110330
- break;
110331
- case 224: /* expr ::= expr between_op expr AND expr */
110332
-{
110333
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110334
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
110335
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110336
- if( yygotominor.yy118.pExpr ){
110337
- yygotominor.yy118.pExpr->x.pList = pList;
110344
+ yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
110345
+ if( yygotominor.yy342.pExpr ){
110346
+ yygotominor.yy342.pExpr->op = TK_CONST_FUNC;
110347
+ }
110348
+ spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110349
+}
110350
+ break;
110351
+ case 199: /* expr ::= expr AND expr */
110352
+ case 200: /* expr ::= expr OR expr */ yytestcase(yyruleno==200);
110353
+ case 201: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==201);
110354
+ case 202: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==202);
110355
+ case 203: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==203);
110356
+ case 204: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==204);
110357
+ case 205: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==205);
110358
+ case 206: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==206);
110359
+{spanBinaryExpr(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);}
110360
+ break;
110361
+ case 207: /* likeop ::= LIKE_KW */
110362
+ case 209: /* likeop ::= MATCH */ yytestcase(yyruleno==209);
110363
+{yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 0;}
110364
+ break;
110365
+ case 208: /* likeop ::= NOT LIKE_KW */
110366
+ case 210: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==210);
110367
+{yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 1;}
110368
+ break;
110369
+ case 211: /* expr ::= expr likeop expr */
110370
+{
110371
+ ExprList *pList;
110372
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr);
110373
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr);
110374
+ yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator);
110375
+ if( yymsp[-1].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110376
+ yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;
110377
+ yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110378
+ if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;
110379
+}
110380
+ break;
110381
+ case 212: /* expr ::= expr likeop expr ESCAPE expr */
110382
+{
110383
+ ExprList *pList;
110384
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110385
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr);
110386
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);
110387
+ yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator);
110388
+ if( yymsp[-3].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110389
+ yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110390
+ yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110391
+ if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;
110392
+}
110393
+ break;
110394
+ case 213: /* expr ::= expr ISNULL|NOTNULL */
110395
+{spanUnaryPostfix(&yygotominor.yy342,pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);}
110396
+ break;
110397
+ case 214: /* expr ::= expr NOT NULL */
110398
+{spanUnaryPostfix(&yygotominor.yy342,pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);}
110399
+ break;
110400
+ case 215: /* expr ::= expr IS expr */
110401
+{
110402
+ spanBinaryExpr(&yygotominor.yy342,pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);
110403
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_ISNULL);
110404
+}
110405
+ break;
110406
+ case 216: /* expr ::= expr IS NOT expr */
110407
+{
110408
+ spanBinaryExpr(&yygotominor.yy342,pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342);
110409
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_NOTNULL);
110410
+}
110411
+ break;
110412
+ case 217: /* expr ::= NOT expr */
110413
+ case 218: /* expr ::= BITNOT expr */ yytestcase(yyruleno==218);
110414
+{spanUnaryPrefix(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110415
+ break;
110416
+ case 219: /* expr ::= MINUS expr */
110417
+{spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110418
+ break;
110419
+ case 220: /* expr ::= PLUS expr */
110420
+{spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110421
+ break;
110422
+ case 223: /* expr ::= expr between_op expr AND expr */
110423
+{
110424
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110425
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);
110426
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110427
+ if( yygotominor.yy342.pExpr ){
110428
+ yygotominor.yy342.pExpr->x.pList = pList;
110338110429
}else{
110339110430
sqlite3ExprListDelete(pParse->db, pList);
110340110431
}
110341
- if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110342
- yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110343
- yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110344
-}
110345
- break;
110346
- case 227: /* expr ::= expr in_op LP exprlist RP */
110347
-{
110348
- if( yymsp[-1].minor.yy322==0 ){
110432
+ if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110433
+ yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110434
+ yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110435
+}
110436
+ break;
110437
+ case 226: /* expr ::= expr in_op LP exprlist RP */
110438
+{
110439
+ if( yymsp[-1].minor.yy442==0 ){
110349110440
/* Expressions of the form
110350110441
**
110351110442
** expr1 IN ()
110352110443
** expr1 NOT IN ()
110353110444
**
110354110445
** simplify to constants 0 (false) and 1 (true), respectively,
110355110446
** regardless of the value of expr1.
110356110447
*/
110357
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy4]);
110358
- sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy118.pExpr);
110359
- }else{
110360
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110361
- if( yygotominor.yy118.pExpr ){
110362
- yygotominor.yy118.pExpr->x.pList = yymsp[-1].minor.yy322;
110363
- sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110364
- }else{
110365
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
110366
- }
110367
- if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110368
- }
110369
- yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110370
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110371
- }
110372
- break;
110373
- case 228: /* expr ::= LP select RP */
110374
-{
110375
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
110376
- if( yygotominor.yy118.pExpr ){
110377
- yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
110378
- ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110379
- sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110380
- }else{
110381
- sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110382
- }
110383
- yygotominor.yy118.zStart = yymsp[-2].minor.yy0.z;
110384
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110385
- }
110386
- break;
110387
- case 229: /* expr ::= expr in_op LP select RP */
110388
-{
110389
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110390
- if( yygotominor.yy118.pExpr ){
110391
- yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
110392
- ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110393
- sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110394
- }else{
110395
- sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110396
- }
110397
- if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110398
- yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110399
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110400
- }
110401
- break;
110402
- case 230: /* expr ::= expr in_op nm dbnm */
110448
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]);
110449
+ sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr);
110450
+ }else{
110451
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110452
+ if( yygotominor.yy342.pExpr ){
110453
+ yygotominor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442;
110454
+ sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110455
+ }else{
110456
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442);
110457
+ }
110458
+ if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110459
+ }
110460
+ yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110461
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110462
+ }
110463
+ break;
110464
+ case 227: /* expr ::= LP select RP */
110465
+{
110466
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
110467
+ if( yygotominor.yy342.pExpr ){
110468
+ yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;
110469
+ ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110470
+ sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110471
+ }else{
110472
+ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110473
+ }
110474
+ yygotominor.yy342.zStart = yymsp[-2].minor.yy0.z;
110475
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110476
+ }
110477
+ break;
110478
+ case 228: /* expr ::= expr in_op LP select RP */
110479
+{
110480
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110481
+ if( yygotominor.yy342.pExpr ){
110482
+ yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;
110483
+ ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110484
+ sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110485
+ }else{
110486
+ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110487
+ }
110488
+ if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110489
+ yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110490
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110491
+ }
110492
+ break;
110493
+ case 229: /* expr ::= expr in_op nm dbnm */
110403110494
{
110404110495
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
110405
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy118.pExpr, 0, 0);
110406
- if( yygotominor.yy118.pExpr ){
110407
- yygotominor.yy118.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
110408
- ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110409
- sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110496
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0);
110497
+ if( yygotominor.yy342.pExpr ){
110498
+ yygotominor.yy342.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
110499
+ ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110500
+ sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110410110501
}else{
110411110502
sqlite3SrcListDelete(pParse->db, pSrc);
110412110503
}
110413
- if( yymsp[-2].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110414
- yygotominor.yy118.zStart = yymsp[-3].minor.yy118.zStart;
110415
- yygotominor.yy118.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
110416
- }
110417
- break;
110418
- case 231: /* expr ::= EXISTS LP select RP */
110419
-{
110420
- Expr *p = yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
110504
+ if( yymsp[-2].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110505
+ yygotominor.yy342.zStart = yymsp[-3].minor.yy342.zStart;
110506
+ yygotominor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
110507
+ }
110508
+ break;
110509
+ case 230: /* expr ::= EXISTS LP select RP */
110510
+{
110511
+ Expr *p = yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
110421110512
if( p ){
110422
- p->x.pSelect = yymsp[-1].minor.yy387;
110513
+ p->x.pSelect = yymsp[-1].minor.yy159;
110423110514
ExprSetProperty(p, EP_xIsSelect);
110424110515
sqlite3ExprSetHeight(pParse, p);
110425110516
}else{
110426
- sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110427
- }
110428
- yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
110429
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110430
- }
110431
- break;
110432
- case 232: /* expr ::= CASE case_operand case_exprlist case_else END */
110433
-{
110434
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, 0);
110435
- if( yygotominor.yy118.pExpr ){
110436
- yygotominor.yy118.pExpr->x.pList = yymsp[-2].minor.yy322;
110437
- sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110438
- }else{
110439
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
110440
- }
110441
- yygotominor.yy118.zStart = yymsp[-4].minor.yy0.z;
110442
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110443
-}
110444
- break;
110445
- case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
110446
-{
110447
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy118.pExpr);
110448
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
110449
-}
110450
- break;
110451
- case 234: /* case_exprlist ::= WHEN expr THEN expr */
110452
-{
110453
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110454
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
110455
-}
110456
- break;
110457
- case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
110517
+ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110518
+ }
110519
+ yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;
110520
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110521
+ }
110522
+ break;
110523
+ case 231: /* expr ::= CASE case_operand case_exprlist case_else END */
110524
+{
110525
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, yymsp[-1].minor.yy122, 0);
110526
+ if( yygotominor.yy342.pExpr ){
110527
+ yygotominor.yy342.pExpr->x.pList = yymsp[-2].minor.yy442;
110528
+ sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110529
+ }else{
110530
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442);
110531
+ }
110532
+ yygotominor.yy342.zStart = yymsp[-4].minor.yy0.z;
110533
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110534
+}
110535
+ break;
110536
+ case 232: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
110537
+{
110538
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr);
110539
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);
110540
+}
110541
+ break;
110542
+ case 233: /* case_exprlist ::= WHEN expr THEN expr */
110543
+{
110544
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110545
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);
110546
+}
110547
+ break;
110548
+ case 240: /* nexprlist ::= nexprlist COMMA expr */
110549
+{yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);}
110550
+ break;
110551
+ case 241: /* nexprlist ::= expr */
110552
+{yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr);}
110553
+ break;
110554
+ case 242: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
110458110555
{
110459110556
sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
110460
- sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy322, yymsp[-9].minor.yy4,
110461
- &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy4);
110557
+ sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy442, yymsp[-9].minor.yy392,
110558
+ &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy392);
110462110559
}
110463110560
break;
110464
- case 244: /* uniqueflag ::= UNIQUE */
110465
- case 298: /* raisetype ::= ABORT */ yytestcase(yyruleno==298);
110466
-{yygotominor.yy4 = OE_Abort;}
110467
- break;
110468
- case 245: /* uniqueflag ::= */
110469
-{yygotominor.yy4 = OE_None;}
110470
- break;
110471
- case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */
110561
+ case 243: /* uniqueflag ::= UNIQUE */
110562
+ case 296: /* raisetype ::= ABORT */ yytestcase(yyruleno==296);
110563
+{yygotominor.yy392 = OE_Abort;}
110564
+ break;
110565
+ case 244: /* uniqueflag ::= */
110566
+{yygotominor.yy392 = OE_None;}
110567
+ break;
110568
+ case 247: /* idxlist ::= idxlist COMMA nm collate sortorder */
110472110569
{
110473110570
Expr *p = 0;
110474110571
if( yymsp[-1].minor.yy0.n>0 ){
110475110572
p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
110476110573
sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110477110574
}
110478
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, p);
110479
- sqlite3ExprListSetName(pParse,yygotominor.yy322,&yymsp[-2].minor.yy0,1);
110480
- sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
110481
- if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110575
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, p);
110576
+ sqlite3ExprListSetName(pParse,yygotominor.yy442,&yymsp[-2].minor.yy0,1);
110577
+ sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index");
110578
+ if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110482110579
}
110483110580
break;
110484
- case 249: /* idxlist ::= nm collate sortorder */
110581
+ case 248: /* idxlist ::= nm collate sortorder */
110485110582
{
110486110583
Expr *p = 0;
110487110584
if( yymsp[-1].minor.yy0.n>0 ){
110488110585
p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
110489110586
sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110490110587
}
110491
- yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, p);
110492
- sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110493
- sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
110494
- if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110588
+ yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, p);
110589
+ sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110590
+ sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index");
110591
+ if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110495110592
}
110496110593
break;
110497
- case 250: /* collate ::= */
110594
+ case 249: /* collate ::= */
110498110595
{yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
110499110596
break;
110500
- case 252: /* cmd ::= DROP INDEX ifexists fullname */
110501
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
110597
+ case 251: /* cmd ::= DROP INDEX ifexists fullname */
110598
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);}
110502110599
break;
110503
- case 253: /* cmd ::= VACUUM */
110504
- case 254: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==254);
110600
+ case 252: /* cmd ::= VACUUM */
110601
+ case 253: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==253);
110505110602
{sqlite3Vacuum(pParse);}
110506110603
break;
110507
- case 255: /* cmd ::= PRAGMA nm dbnm */
110604
+ case 254: /* cmd ::= PRAGMA nm dbnm */
110508110605
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
110509110606
break;
110510
- case 256: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
110607
+ case 255: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
110511110608
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
110512110609
break;
110513
- case 257: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
110610
+ case 256: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
110514110611
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
110515110612
break;
110516
- case 258: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
110613
+ case 257: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
110517110614
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
110518110615
break;
110519
- case 259: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
110616
+ case 258: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
110520110617
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
110521110618
break;
110522
- case 270: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
110619
+ case 268: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
110523110620
{
110524110621
Token all;
110525110622
all.z = yymsp[-3].minor.yy0.z;
110526110623
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
110527
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
110624
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all);
110528110625
}
110529110626
break;
110530
- case 271: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
110627
+ case 269: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
110531110628
{
110532
- 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);
110629
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392);
110533110630
yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
110534110631
}
110535110632
break;
110536
- case 272: /* trigger_time ::= BEFORE */
110537
- case 275: /* trigger_time ::= */ yytestcase(yyruleno==275);
110538
-{ yygotominor.yy4 = TK_BEFORE; }
110539
- break;
110540
- case 273: /* trigger_time ::= AFTER */
110541
-{ yygotominor.yy4 = TK_AFTER; }
110542
- break;
110543
- case 274: /* trigger_time ::= INSTEAD OF */
110544
-{ yygotominor.yy4 = TK_INSTEAD;}
110545
- break;
110546
- case 276: /* trigger_event ::= DELETE|INSERT */
110547
- case 277: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==277);
110548
-{yygotominor.yy90.a = yymsp[0].major; yygotominor.yy90.b = 0;}
110549
- break;
110550
- case 278: /* trigger_event ::= UPDATE OF inscollist */
110551
-{yygotominor.yy90.a = TK_UPDATE; yygotominor.yy90.b = yymsp[0].minor.yy384;}
110552
- break;
110553
- case 281: /* when_clause ::= */
110554
- case 303: /* key_opt ::= */ yytestcase(yyruleno==303);
110555
-{ yygotominor.yy314 = 0; }
110556
- break;
110557
- case 282: /* when_clause ::= WHEN expr */
110558
- case 304: /* key_opt ::= KEY expr */ yytestcase(yyruleno==304);
110559
-{ yygotominor.yy314 = yymsp[0].minor.yy118.pExpr; }
110560
- break;
110561
- case 283: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
110562
-{
110563
- assert( yymsp[-2].minor.yy203!=0 );
110564
- yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
110565
- yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
110566
- yygotominor.yy203 = yymsp[-2].minor.yy203;
110567
-}
110568
- break;
110569
- case 284: /* trigger_cmd_list ::= trigger_cmd SEMI */
110570
-{
110571
- assert( yymsp[-1].minor.yy203!=0 );
110572
- yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
110573
- yygotominor.yy203 = yymsp[-1].minor.yy203;
110574
-}
110575
- break;
110576
- case 286: /* trnm ::= nm DOT nm */
110633
+ case 270: /* trigger_time ::= BEFORE */
110634
+ case 273: /* trigger_time ::= */ yytestcase(yyruleno==273);
110635
+{ yygotominor.yy392 = TK_BEFORE; }
110636
+ break;
110637
+ case 271: /* trigger_time ::= AFTER */
110638
+{ yygotominor.yy392 = TK_AFTER; }
110639
+ break;
110640
+ case 272: /* trigger_time ::= INSTEAD OF */
110641
+{ yygotominor.yy392 = TK_INSTEAD;}
110642
+ break;
110643
+ case 274: /* trigger_event ::= DELETE|INSERT */
110644
+ case 275: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==275);
110645
+{yygotominor.yy410.a = yymsp[0].major; yygotominor.yy410.b = 0;}
110646
+ break;
110647
+ case 276: /* trigger_event ::= UPDATE OF inscollist */
110648
+{yygotominor.yy410.a = TK_UPDATE; yygotominor.yy410.b = yymsp[0].minor.yy180;}
110649
+ break;
110650
+ case 279: /* when_clause ::= */
110651
+ case 301: /* key_opt ::= */ yytestcase(yyruleno==301);
110652
+{ yygotominor.yy122 = 0; }
110653
+ break;
110654
+ case 280: /* when_clause ::= WHEN expr */
110655
+ case 302: /* key_opt ::= KEY expr */ yytestcase(yyruleno==302);
110656
+{ yygotominor.yy122 = yymsp[0].minor.yy342.pExpr; }
110657
+ break;
110658
+ case 281: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
110659
+{
110660
+ assert( yymsp[-2].minor.yy327!=0 );
110661
+ yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327;
110662
+ yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327;
110663
+ yygotominor.yy327 = yymsp[-2].minor.yy327;
110664
+}
110665
+ break;
110666
+ case 282: /* trigger_cmd_list ::= trigger_cmd SEMI */
110667
+{
110668
+ assert( yymsp[-1].minor.yy327!=0 );
110669
+ yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327;
110670
+ yygotominor.yy327 = yymsp[-1].minor.yy327;
110671
+}
110672
+ break;
110673
+ case 284: /* trnm ::= nm DOT nm */
110577110674
{
110578110675
yygotominor.yy0 = yymsp[0].minor.yy0;
110579110676
sqlite3ErrorMsg(pParse,
110580110677
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
110581110678
"statements within triggers");
110582110679
}
110583110680
break;
110584
- case 288: /* tridxby ::= INDEXED BY nm */
110681
+ case 286: /* tridxby ::= INDEXED BY nm */
110585110682
{
110586110683
sqlite3ErrorMsg(pParse,
110587110684
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
110588110685
"within triggers");
110589110686
}
110590110687
break;
110591
- case 289: /* tridxby ::= NOT INDEXED */
110688
+ case 287: /* tridxby ::= NOT INDEXED */
110592110689
{
110593110690
sqlite3ErrorMsg(pParse,
110594110691
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
110595110692
"within triggers");
110596110693
}
110597110694
break;
110598
- case 290: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
110599
-{ yygotominor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy314, yymsp[-5].minor.yy210); }
110600
- break;
110601
- case 291: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP */
110602
-{yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy384, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy210);}
110603
- break;
110604
- case 292: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
110605
-{yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy384, 0, yymsp[0].minor.yy387, yymsp[-4].minor.yy210);}
110606
- break;
110607
- case 293: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
110608
-{yygotominor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy314);}
110609
- break;
110610
- case 294: /* trigger_cmd ::= select */
110611
-{yygotominor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy387); }
110612
- break;
110613
- case 295: /* expr ::= RAISE LP IGNORE RP */
110614
-{
110615
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
110616
- if( yygotominor.yy118.pExpr ){
110617
- yygotominor.yy118.pExpr->affinity = OE_Ignore;
110618
- }
110619
- yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
110620
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110621
-}
110622
- break;
110623
- case 296: /* expr ::= RAISE LP raisetype COMMA nm RP */
110624
-{
110625
- yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
110626
- if( yygotominor.yy118.pExpr ) {
110627
- yygotominor.yy118.pExpr->affinity = (char)yymsp[-3].minor.yy4;
110628
- }
110629
- yygotominor.yy118.zStart = yymsp[-5].minor.yy0.z;
110630
- yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110631
-}
110632
- break;
110633
- case 297: /* raisetype ::= ROLLBACK */
110634
-{yygotominor.yy4 = OE_Rollback;}
110635
- break;
110636
- case 299: /* raisetype ::= FAIL */
110637
-{yygotominor.yy4 = OE_Fail;}
110638
- break;
110639
- case 300: /* cmd ::= DROP TRIGGER ifexists fullname */
110640
-{
110641
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
110642
-}
110643
- break;
110644
- case 301: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
110645
-{
110646
- sqlite3Attach(pParse, yymsp[-3].minor.yy118.pExpr, yymsp[-1].minor.yy118.pExpr, yymsp[0].minor.yy314);
110647
-}
110648
- break;
110649
- case 302: /* cmd ::= DETACH database_kw_opt expr */
110650
-{
110651
- sqlite3Detach(pParse, yymsp[0].minor.yy118.pExpr);
110652
-}
110653
- break;
110654
- case 307: /* cmd ::= REINDEX */
110695
+ case 288: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
110696
+{ yygotominor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy258); }
110697
+ break;
110698
+ case 289: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist */
110699
+{yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-4].minor.yy258);}
110700
+ break;
110701
+ case 290: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
110702
+{yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, 0, yymsp[0].minor.yy159, yymsp[-4].minor.yy258);}
110703
+ break;
110704
+ case 291: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
110705
+{yygotominor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);}
110706
+ break;
110707
+ case 292: /* trigger_cmd ::= select */
110708
+{yygotominor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); }
110709
+ break;
110710
+ case 293: /* expr ::= RAISE LP IGNORE RP */
110711
+{
110712
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
110713
+ if( yygotominor.yy342.pExpr ){
110714
+ yygotominor.yy342.pExpr->affinity = OE_Ignore;
110715
+ }
110716
+ yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;
110717
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110718
+}
110719
+ break;
110720
+ case 294: /* expr ::= RAISE LP raisetype COMMA nm RP */
110721
+{
110722
+ yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
110723
+ if( yygotominor.yy342.pExpr ) {
110724
+ yygotominor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392;
110725
+ }
110726
+ yygotominor.yy342.zStart = yymsp[-5].minor.yy0.z;
110727
+ yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110728
+}
110729
+ break;
110730
+ case 295: /* raisetype ::= ROLLBACK */
110731
+{yygotominor.yy392 = OE_Rollback;}
110732
+ break;
110733
+ case 297: /* raisetype ::= FAIL */
110734
+{yygotominor.yy392 = OE_Fail;}
110735
+ break;
110736
+ case 298: /* cmd ::= DROP TRIGGER ifexists fullname */
110737
+{
110738
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392);
110739
+}
110740
+ break;
110741
+ case 299: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
110742
+{
110743
+ sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122);
110744
+}
110745
+ break;
110746
+ case 300: /* cmd ::= DETACH database_kw_opt expr */
110747
+{
110748
+ sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr);
110749
+}
110750
+ break;
110751
+ case 305: /* cmd ::= REINDEX */
110655110752
{sqlite3Reindex(pParse, 0, 0);}
110656110753
break;
110657
- case 308: /* cmd ::= REINDEX nm dbnm */
110754
+ case 306: /* cmd ::= REINDEX nm dbnm */
110658110755
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110659110756
break;
110660
- case 309: /* cmd ::= ANALYZE */
110757
+ case 307: /* cmd ::= ANALYZE */
110661110758
{sqlite3Analyze(pParse, 0, 0);}
110662110759
break;
110663
- case 310: /* cmd ::= ANALYZE nm dbnm */
110760
+ case 308: /* cmd ::= ANALYZE nm dbnm */
110664110761
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110665110762
break;
110666
- case 311: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
110763
+ case 309: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
110667110764
{
110668
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
110765
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0);
110669110766
}
110670110767
break;
110671
- case 312: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
110768
+ case 310: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
110672110769
{
110673110770
sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
110674110771
}
110675110772
break;
110676
- case 313: /* add_column_fullname ::= fullname */
110773
+ case 311: /* add_column_fullname ::= fullname */
110677110774
{
110678110775
pParse->db->lookaside.bEnabled = 0;
110679
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
110776
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347);
110680110777
}
110681110778
break;
110682
- case 316: /* cmd ::= create_vtab */
110779
+ case 314: /* cmd ::= create_vtab */
110683110780
{sqlite3VtabFinishParse(pParse,0);}
110684110781
break;
110685
- case 317: /* cmd ::= create_vtab LP vtabarglist RP */
110782
+ case 315: /* cmd ::= create_vtab LP vtabarglist RP */
110686110783
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
110687110784
break;
110688
- case 318: /* create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm */
110785
+ case 316: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
110689110786
{
110690
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
110787
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392);
110691110788
}
110692110789
break;
110693
- case 321: /* vtabarg ::= */
110790
+ case 319: /* vtabarg ::= */
110694110791
{sqlite3VtabArgInit(pParse);}
110695110792
break;
110696
- case 323: /* vtabargtoken ::= ANY */
110697
- case 324: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==324);
110698
- case 325: /* lp ::= LP */ yytestcase(yyruleno==325);
110793
+ case 321: /* vtabargtoken ::= ANY */
110794
+ case 322: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==322);
110795
+ case 323: /* lp ::= LP */ yytestcase(yyruleno==323);
110699110796
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
110700110797
break;
110701110798
default:
110702110799
/* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
110703110800
/* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
@@ -110722,25 +110819,23 @@
110722110819
/* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62);
110723110820
/* (90) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==90);
110724110821
/* (91) conslist ::= conslist tcons */ yytestcase(yyruleno==91);
110725110822
/* (92) conslist ::= tcons */ yytestcase(yyruleno==92);
110726110823
/* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);
110727
- /* (268) plus_opt ::= PLUS */ yytestcase(yyruleno==268);
110728
- /* (269) plus_opt ::= */ yytestcase(yyruleno==269);
110729
- /* (279) foreach_clause ::= */ yytestcase(yyruleno==279);
110730
- /* (280) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==280);
110731
- /* (287) tridxby ::= */ yytestcase(yyruleno==287);
110732
- /* (305) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==305);
110733
- /* (306) database_kw_opt ::= */ yytestcase(yyruleno==306);
110734
- /* (314) kwcolumn_opt ::= */ yytestcase(yyruleno==314);
110735
- /* (315) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==315);
110736
- /* (319) vtabarglist ::= vtabarg */ yytestcase(yyruleno==319);
110737
- /* (320) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==320);
110738
- /* (322) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==322);
110739
- /* (326) anylist ::= */ yytestcase(yyruleno==326);
110740
- /* (327) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==327);
110741
- /* (328) anylist ::= anylist ANY */ yytestcase(yyruleno==328);
110824
+ /* (277) foreach_clause ::= */ yytestcase(yyruleno==277);
110825
+ /* (278) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==278);
110826
+ /* (285) tridxby ::= */ yytestcase(yyruleno==285);
110827
+ /* (303) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==303);
110828
+ /* (304) database_kw_opt ::= */ yytestcase(yyruleno==304);
110829
+ /* (312) kwcolumn_opt ::= */ yytestcase(yyruleno==312);
110830
+ /* (313) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==313);
110831
+ /* (317) vtabarglist ::= vtabarg */ yytestcase(yyruleno==317);
110832
+ /* (318) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==318);
110833
+ /* (320) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==320);
110834
+ /* (324) anylist ::= */ yytestcase(yyruleno==324);
110835
+ /* (325) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==325);
110836
+ /* (326) anylist ::= anylist ANY */ yytestcase(yyruleno==326);
110742110837
break;
110743110838
};
110744110839
yygoto = yyRuleInfo[yyruleno].lhs;
110745110840
yysize = yyRuleInfo[yyruleno].nrhs;
110746110841
yypParser->yyidx -= yysize;
@@ -115167,11 +115262,12 @@
115167115262
/*
115168115263
** Return a boolean value for a query parameter.
115169115264
*/
115170115265
SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
115171115266
const char *z = sqlite3_uri_parameter(zFilename, zParam);
115172
- return z ? sqlite3GetBoolean(z) : (bDflt!=0);
115267
+ bDflt = bDflt!=0;
115268
+ return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
115173115269
}
115174115270
115175115271
/*
115176115272
** Return a 64-bit integer value for a query parameter.
115177115273
*/
@@ -116503,11 +116599,11 @@
116503116599
/* fts3_write.c */
116504116600
SQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*);
116505116601
SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *);
116506116602
SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *);
116507116603
SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *);
116508
-SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, sqlite3_int64,
116604
+SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, int, sqlite3_int64,
116509116605
sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**);
116510116606
SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
116511116607
Fts3Table*,int,const char*,int,int,Fts3SegReader**);
116512116608
SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *);
116513116609
SQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, sqlite3_stmt **);
@@ -118931,11 +119027,13 @@
118931119027
if( rc!=SQLITE_OK ) goto finished;
118932119028
if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;
118933119029
}
118934119030
118935119031
rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1,
118936
- iStartBlock, iLeavesEndBlock, iEndBlock, zRoot, nRoot, &pSeg
119032
+ (isPrefix==0 && isScan==0),
119033
+ iStartBlock, iLeavesEndBlock,
119034
+ iEndBlock, zRoot, nRoot, &pSeg
118937119035
);
118938119036
if( rc!=SQLITE_OK ) goto finished;
118939119037
rc = fts3SegReaderCursorAppend(pCsr, pSeg);
118940119038
}
118941119039
}
@@ -124753,10 +124851,11 @@
124753124851
** fts3SegReaderFirstDocid()
124754124852
** fts3SegReaderNextDocid()
124755124853
*/
124756124854
struct Fts3SegReader {
124757124855
int iIdx; /* Index within level, or 0x7FFFFFFF for PT */
124856
+ int bLookup; /* True for a lookup only */
124758124857
124759124858
sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
124760124859
sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
124761124860
sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
124762124861
sqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */
@@ -125730,10 +125829,22 @@
125730125829
){
125731125830
rc = fts3SegReaderIncrRead(pReader);
125732125831
}
125733125832
return rc;
125734125833
}
125834
+
125835
+/*
125836
+** Set an Fts3SegReader cursor to point at EOF.
125837
+*/
125838
+static void fts3SegReaderSetEof(Fts3SegReader *pSeg){
125839
+ if( !fts3SegReaderIsRootOnly(pSeg) ){
125840
+ sqlite3_free(pSeg->aNode);
125841
+ sqlite3_blob_close(pSeg->pBlob);
125842
+ pSeg->pBlob = 0;
125843
+ }
125844
+ pSeg->aNode = 0;
125845
+}
125735125846
125736125847
/*
125737125848
** Move the iterator passed as the first argument to the next term in the
125738125849
** segment. If successful, SQLITE_OK is returned. If there is no next term,
125739125850
** SQLITE_DONE. Otherwise, an SQLite error code.
@@ -125770,16 +125881,11 @@
125770125881
assert( pReader->aNode );
125771125882
}
125772125883
return SQLITE_OK;
125773125884
}
125774125885
125775
- if( !fts3SegReaderIsRootOnly(pReader) ){
125776
- sqlite3_free(pReader->aNode);
125777
- sqlite3_blob_close(pReader->pBlob);
125778
- pReader->pBlob = 0;
125779
- }
125780
- pReader->aNode = 0;
125886
+ fts3SegReaderSetEof(pReader);
125781125887
125782125888
/* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
125783125889
** blocks have already been traversed. */
125784125890
assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );
125785125891
if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
@@ -126022,10 +126128,11 @@
126022126128
/*
126023126129
** Allocate a new SegReader object.
126024126130
*/
126025126131
SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
126026126132
int iAge, /* Segment "age". */
126133
+ int bLookup, /* True for a lookup only */
126027126134
sqlite3_int64 iStartLeaf, /* First leaf to traverse */
126028126135
sqlite3_int64 iEndLeaf, /* Final leaf to traverse */
126029126136
sqlite3_int64 iEndBlock, /* Final block of segment */
126030126137
const char *zRoot, /* Buffer containing root node */
126031126138
int nRoot, /* Size of buffer containing root node */
@@ -126043,10 +126150,11 @@
126043126150
if( !pReader ){
126044126151
return SQLITE_NOMEM;
126045126152
}
126046126153
memset(pReader, 0, sizeof(Fts3SegReader));
126047126154
pReader->iIdx = iAge;
126155
+ pReader->bLookup = bLookup;
126048126156
pReader->iStartBlock = iStartLeaf;
126049126157
pReader->iLeafEndBlock = iEndLeaf;
126050126158
pReader->iEndBlock = iEndBlock;
126051126159
126052126160
if( nExtra ){
@@ -127045,15 +127153,20 @@
127045127153
** equal or greater value than the specified term. This prevents many
127046127154
** unnecessary merge/sort operations for the case where single segment
127047127155
** b-tree leaf nodes contain more than one term.
127048127156
*/
127049127157
for(i=0; pCsr->bRestart==0 && i<pCsr->nSegment; i++){
127158
+ int res = 0;
127050127159
Fts3SegReader *pSeg = pCsr->apSegment[i];
127051127160
do {
127052127161
int rc = fts3SegReaderNext(p, pSeg, 0);
127053127162
if( rc!=SQLITE_OK ) return rc;
127054
- }while( zTerm && fts3SegReaderTermCmp(pSeg, zTerm, nTerm)<0 );
127163
+ }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );
127164
+
127165
+ if( pSeg->bLookup && res!=0 ){
127166
+ fts3SegReaderSetEof(pSeg);
127167
+ }
127055127168
}
127056127169
fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp);
127057127170
127058127171
return SQLITE_OK;
127059127172
}
@@ -127170,11 +127283,16 @@
127170127283
127171127284
/* Advance the first pCsr->nAdvance entries in the apSegment[] array
127172127285
** forward. Then sort the list in order of current term again.
127173127286
*/
127174127287
for(i=0; i<pCsr->nAdvance; i++){
127175
- rc = fts3SegReaderNext(p, apSegment[i], 0);
127288
+ Fts3SegReader *pSeg = apSegment[i];
127289
+ if( pSeg->bLookup ){
127290
+ fts3SegReaderSetEof(pSeg);
127291
+ }else{
127292
+ rc = fts3SegReaderNext(p, pSeg, 0);
127293
+ }
127176127294
if( rc!=SQLITE_OK ) return rc;
127177127295
}
127178127296
fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp);
127179127297
pCsr->nAdvance = 0;
127180127298
127181127299
--- 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.7.10. 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.
@@ -655,13 +655,13 @@
655 **
656 ** See also: [sqlite3_libversion()],
657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658 ** [sqlite_version()] and [sqlite_source_id()].
659 */
660 #define SQLITE_VERSION "3.7.10"
661 #define SQLITE_VERSION_NUMBER 3007010
662 #define SQLITE_SOURCE_ID "2012-01-11 16:16:08 9e31a275ef494ea8713a1d60a15b84157e57c3ff"
663
664 /*
665 ** CAPI3REF: Run-Time Library Version Numbers
666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
667 **
@@ -3180,33 +3180,41 @@
3180 **
3181 ** These are utility routines, useful to VFS implementations, that check
3182 ** to see if a database file was a URI that contained a specific query
3183 ** parameter, and if so obtains the value of that query parameter.
3184 **
3185 ** If F is the filename pointer passed into the xOpen() method of a VFS
3186 ** implementation and P is the name of the query parameter, then
 
 
3187 ** sqlite3_uri_parameter(F,P) returns the value of the P
3188 ** parameter if it exists or a NULL pointer if P does not appear as a
3189 ** query parameter on F. If P is a query parameter of F
3190 ** has no explicit value, then sqlite3_uri_parameter(F,P) returns
3191 ** a pointer to an empty string.
3192 **
3193 ** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
3194 ** parameter and returns true (1) or false (0) according to the value
3195 ** of P. The value of P is true if it is "yes" or "true" or "on" or
3196 ** a non-zero number and is false otherwise. If P is not a query parameter
3197 ** on F then sqlite3_uri_boolean(F,P,B) returns (B!=0).
 
 
 
 
 
3198 **
3199 ** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
3200 ** 64-bit signed integer and returns that integer, or D if P does not
3201 ** exist. If the value of P is something other than an integer, then
3202 ** zero is returned.
3203 **
3204 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
3205 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3206 ** is not a pathname pointer that SQLite passed into the xOpen VFS method,
3207 ** then the behavior of this routine is undefined and probably undesirable.
 
3208 */
3209 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3210 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3211 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3212
@@ -6758,11 +6766,11 @@
6758 ** functions.
6759 **
6760 ** [[the xShrink() page cache method]]
6761 ** ^SQLite invokes the xShrink() method when it wants the page cache to
6762 ** free up as much of heap memory as possible. The page cache implementation
6763 ** is not obligated to free any memory, but well-behaved implementions should
6764 ** do their best.
6765 */
6766 typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
6767 struct sqlite3_pcache_methods2 {
6768 int iVersion;
@@ -8010,13 +8018,17 @@
8010 */
8011 #define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0])))
8012
8013 /*
8014 ** The following value as a destructor means to use sqlite3DbFree().
8015 ** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.
 
 
 
 
8016 */
8017 #define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3DbFree)
8018
8019 /*
8020 ** When SQLITE_OMIT_WSD is defined, it means that the target platform does
8021 ** not support Writable Static Data (WSD) such as global and static variables.
8022 ** All variables must either be on the stack or dynamically allocated from
@@ -8172,14 +8184,13 @@
8172 **
8173 ** NOTE: These values must match the corresponding PAGER_ values in
8174 ** pager.h.
8175 */
8176 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
8177 #define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */
8178 #define BTREE_MEMORY 4 /* This is an in-memory DB */
8179 #define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */
8180 #define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */
8181
8182 SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
8183 SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
8184 SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);
8185 SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);
@@ -8848,12 +8859,11 @@
8848 ** Allowed values for the flags parameter to sqlite3PagerOpen().
8849 **
8850 ** NOTE: These values must match the corresponding BTREE_ values in btree.h.
8851 */
8852 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
8853 #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
8854 #define PAGER_MEMORY 0x0004 /* In-memory database */
8855
8856 /*
8857 ** Valid values for the second argument to sqlite3PagerLockingMode().
8858 */
8859 #define PAGER_LOCKINGMODE_QUERY -1
@@ -9006,12 +9016,12 @@
9006 struct PgHdr {
9007 sqlite3_pcache_page *pPage; /* Pcache object page handle */
9008 void *pData; /* Page data */
9009 void *pExtra; /* Extra content */
9010 PgHdr *pDirty; /* Transient list of dirty pages */
9011 Pgno pgno; /* Page number for this page */
9012 Pager *pPager; /* The pager this page is part of */
 
9013 #ifdef SQLITE_CHECK_PAGES
9014 u32 pageHash; /* Hash of page content */
9015 #endif
9016 u16 flags; /* PGHDR flags defined below */
9017
@@ -9235,15 +9245,27 @@
9235 # define SQLITE_TEMPNAME_SIZE 200
9236 #endif
9237
9238 /*
9239 ** Determine if we are dealing with Windows NT.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9240 */
9241 #if defined(_WIN32_WINNT)
9242 # define SQLITE_OS_WINNT 1
9243 #else
9244 # define SQLITE_OS_WINNT 0
9245 #endif
9246
9247 /*
9248 ** Determine if we are dealing with WindowsCE - which has a much
9249 ** reduced API.
@@ -9637,39 +9659,20 @@
9637 FuncDef *a[23]; /* Hash table for functions */
9638 };
9639
9640 /*
9641 ** Each database connection is an instance of the following structure.
9642 **
9643 ** The sqlite.lastRowid records the last insert rowid generated by an
9644 ** insert statement. Inserts on views do not affect its value. Each
9645 ** trigger has its own context, so that lastRowid can be updated inside
9646 ** triggers as usual. The previous value will be restored once the trigger
9647 ** exits. Upon entering a before or instead of trigger, lastRowid is no
9648 ** longer (since after version 2.8.12) reset to -1.
9649 **
9650 ** The sqlite.nChange does not count changes within triggers and keeps no
9651 ** context. It is reset at start of sqlite3_exec.
9652 ** The sqlite.lsChange represents the number of changes made by the last
9653 ** insert, update, or delete statement. It remains constant throughout the
9654 ** length of a statement and is then updated by OP_SetCounts. It keeps a
9655 ** context stack just like lastRowid so that the count of changes
9656 ** within a trigger is not seen outside the trigger. Changes to views do not
9657 ** affect the value of lsChange.
9658 ** The sqlite.csChange keeps track of the number of current changes (since
9659 ** the last statement) and is used to update sqlite_lsChange.
9660 **
9661 ** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16
9662 ** store the most recent error code and, if applicable, string. The
9663 ** internal function sqlite3Error() is used to set these variables
9664 ** consistently.
9665 */
9666 struct sqlite3 {
9667 sqlite3_vfs *pVfs; /* OS Interface */
9668 int nDb; /* Number of backends currently in use */
 
 
9669 Db *aDb; /* All backends */
 
9670 int flags; /* Miscellaneous flags. See below */
 
9671 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
9672 int errCode; /* Most recent error code (SQLITE_*) */
9673 int errMask; /* & result codes with this before returning */
9674 u8 autoCommit; /* The auto-commit flag. */
9675 u8 temp_store; /* 1: file 2: memory 0: default */
@@ -9676,31 +9679,27 @@
9676 u8 mallocFailed; /* True if we have seen a malloc failure */
9677 u8 dfltLockMode; /* Default locking-mode for attached dbs */
9678 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
9679 u8 suppressErr; /* Do not issue error messages if true */
9680 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
 
9681 int nextPagesize; /* Pagesize after VACUUM if >0 */
9682 int nTable; /* Number of tables in the database */
9683 CollSeq *pDfltColl; /* The default collating sequence (BINARY) */
9684 i64 lastRowid; /* ROWID of most recent insert (see above) */
9685 u32 magic; /* Magic number for detect library misuse */
9686 int nChange; /* Value returned by sqlite3_changes() */
9687 int nTotalChange; /* Value returned by sqlite3_total_changes() */
9688 sqlite3_mutex *mutex; /* Connection mutex */
9689 int aLimit[SQLITE_N_LIMIT]; /* Limits */
9690 struct sqlite3InitInfo { /* Information used during initialization */
9691 int iDb; /* When back is being initialized */
9692 int newTnum; /* Rootpage of table being initialized */
 
9693 u8 busy; /* TRUE if currently initializing */
9694 u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */
9695 } init;
9696 int nExtension; /* Number of loaded extensions */
9697 void **aExtension; /* Array of shared library handles */
9698 struct Vdbe *pVdbe; /* List of active virtual machines */
9699 int activeVdbeCnt; /* Number of VDBEs currently executing */
9700 int writeVdbeCnt; /* Number of active VDBEs that are writing */
9701 int vdbeExecCnt; /* Number of nested calls to VdbeExec() */
 
 
9702 void (*xTrace)(void*,const char*); /* Trace function */
9703 void *pTraceArg; /* Argument to the trace function */
9704 void (*xProfile)(void*,const char*,u64); /* Profiling function */
9705 void *pProfileArg; /* Argument to profile function */
9706 void *pCommitArg; /* Argument to xCommitCallback() */
@@ -9733,25 +9732,24 @@
9733 int (*xProgress)(void *); /* The progress callback */
9734 void *pProgressArg; /* Argument to the progress callback */
9735 int nProgressOps; /* Number of opcodes for progress callback */
9736 #endif
9737 #ifndef SQLITE_OMIT_VIRTUALTABLE
 
9738 Hash aModule; /* populated by sqlite3_create_module() */
9739 VtabCtx *pVtabCtx; /* Context for active vtab connect/create */
9740 VTable **aVTrans; /* Virtual tables with open transactions */
9741 int nVTrans; /* Allocated size of aVTrans */
9742 VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */
9743 #endif
9744 FuncDefHash aFunc; /* Hash table of connection functions */
9745 Hash aCollSeq; /* All collating sequences */
9746 BusyHandler busyHandler; /* Busy callback */
9747 int busyTimeout; /* Busy handler timeout, in msec */
9748 Db aDbStatic[2]; /* Static space for the 2 default backends */
9749 Savepoint *pSavepoint; /* List of active savepoints */
 
9750 int nSavepoint; /* Number of non-transaction savepoints */
9751 int nStatement; /* Number of nested statement-transactions */
9752 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
9753 i64 nDeferredCons; /* Net deferred constraints this transaction. */
9754 int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
9755
9756 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
9757 /* The following variables are all protected by the STATIC_MASTER
@@ -9790,12 +9788,11 @@
9790 #define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */
9791 /* result set is empty */
9792 #define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */
9793 #define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */
9794 #define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */
9795 #define SQLITE_NoReadlock 0x00020000 /* Readlocks are omitted when
9796 ** accessing read-only databases */
9797 #define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */
9798 #define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */
9799 #define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */
9800 #define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */
9801 #define SQLITE_CkptFullFSync 0x00400000 /* Use full fsync for checkpoint */
@@ -9880,11 +9877,10 @@
9880 */
9881 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
9882 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
9883 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
9884 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
9885 #define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */
9886 #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */
9887 #define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */
9888
9889 /*
9890 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
@@ -10163,12 +10159,10 @@
10163 #define TF_Readonly 0x01 /* Read-only system table */
10164 #define TF_Ephemeral 0x02 /* An ephemeral table */
10165 #define TF_HasPrimaryKey 0x04 /* Table has a primary key */
10166 #define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
10167 #define TF_Virtual 0x10 /* Is a virtual table */
10168 #define TF_NeedMetadata 0x20 /* aCol[].zType and aCol[].pColl missing */
10169
10170
10171
10172 /*
10173 ** Test to see whether or not a table is a virtual table. This is
10174 ** done as a macro so that it will be optimized out when virtual
@@ -10326,23 +10320,23 @@
10326 ** algorithm to employ whenever an attempt is made to insert a non-unique
10327 ** element.
10328 */
10329 struct Index {
10330 char *zName; /* Name of this index */
10331 int nColumn; /* Number of columns in the table used by this index */
10332 int *aiColumn; /* Which columns are used by this index. 1st is 0 */
10333 tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
10334 Table *pTable; /* The SQL table being indexed */
10335 int tnum; /* Page containing root of this index in database file */
10336 u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
10337 u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
10338 u8 bUnordered; /* Use this index for == or IN queries only */
10339 char *zColAff; /* String defining the affinity of each column */
10340 Index *pNext; /* The next index associated with the same table */
10341 Schema *pSchema; /* Schema containing this index */
10342 u8 *aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */
10343 char **azColl; /* Array of collation sequence names for index */
 
 
 
 
 
10344 #ifdef SQLITE_ENABLE_STAT3
10345 int nSample; /* Number of elements in aSample[] */
10346 tRowcnt avgEq; /* Average nEq value for key values not in aSample */
10347 IndexSample *aSample; /* Samples of the left-most key */
10348 #endif
@@ -10397,22 +10391,21 @@
10397 ** from source tables rather than from accumulators */
10398 u8 useSortingIdx; /* In direct mode, reference the sorting index rather
10399 ** than the source table */
10400 int sortingIdx; /* Cursor number of the sorting index */
10401 int sortingIdxPTab; /* Cursor number of pseudo-table */
10402 ExprList *pGroupBy; /* The group by clause */
10403 int nSortingColumn; /* Number of columns in the sorting index */
 
10404 struct AggInfo_col { /* For each column used in source tables */
10405 Table *pTab; /* Source table */
10406 int iTable; /* Cursor number of the source table */
10407 int iColumn; /* Column number within the source table */
10408 int iSorterColumn; /* Column number in the sorting index */
10409 int iMem; /* Memory location that acts as accumulator */
10410 Expr *pExpr; /* The original expression */
10411 } *aCol;
10412 int nColumn; /* Number of used entries in aCol[] */
10413 int nColumnAlloc; /* Number of slots allocated for aCol[] */
10414 int nAccumulator; /* Number of columns that show through to the output.
10415 ** Additional columns are used only as parameters to
10416 ** aggregate functions */
10417 struct AggInfo_func { /* For each aggregate function */
10418 Expr *pExpr; /* Expression encoding the function */
@@ -10419,11 +10412,10 @@
10419 FuncDef *pFunc; /* The aggregate function implementation */
10420 int iMem; /* Memory location that acts as accumulator */
10421 int iDistinct; /* Ephemeral table used to enforce DISTINCT */
10422 } *aFunc;
10423 int nFunc; /* Number of entries in aFunc[] */
10424 int nFuncAlloc; /* Number of slots allocated for aFunc[] */
10425 };
10426
10427 /*
10428 ** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
10429 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -10616,21 +10608,20 @@
10616 ** also be used as the argument to a function, in which case the a.zName
10617 ** field is not used.
10618 */
10619 struct ExprList {
10620 int nExpr; /* Number of expressions on the list */
10621 int nAlloc; /* Number of entries allocated below */
10622 int iECursor; /* VDBE Cursor associated with this ExprList */
10623 struct ExprList_item {
10624 Expr *pExpr; /* The list of expressions */
10625 char *zName; /* Token associated with this expression */
10626 char *zSpan; /* Original text of the expression */
10627 u8 sortOrder; /* 1 for DESC or 0 for ASC */
10628 u8 done; /* A flag to indicate when processing is finished */
10629 u16 iOrderByCol; /* For ORDER BY, column number in result set */
10630 u16 iAlias; /* Index into Parse.aAlias[] for zName */
10631 } *a; /* One entry for each expression */
10632 };
10633
10634 /*
10635 ** An instance of this structure is used by the parser to record both
10636 ** the parse tree for an expression and the span of input text for an
@@ -10661,11 +10652,10 @@
10661 struct IdList_item {
10662 char *zName; /* Name of the identifier */
10663 int idx; /* Index in some Table.aCol[] of a column named zName */
10664 } *a;
10665 int nId; /* Number of identifiers on the list */
10666 int nAlloc; /* Number of entries allocated for a[] below */
10667 };
10668
10669 /*
10670 ** The bitmask datatype defined below is used for various optimizations.
10671 **
@@ -10905,10 +10895,13 @@
10905 struct Select {
10906 ExprList *pEList; /* The fields of the result */
10907 u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
10908 char affinity; /* MakeRecord with this affinity for SRT_Set */
10909 u16 selFlags; /* Various SF_* values */
 
 
 
10910 SrcList *pSrc; /* The FROM clause */
10911 Expr *pWhere; /* The WHERE clause */
10912 ExprList *pGroupBy; /* The GROUP BY clause */
10913 Expr *pHaving; /* The HAVING clause */
10914 ExprList *pOrderBy; /* The ORDER BY clause */
@@ -10915,13 +10908,10 @@
10915 Select *pPrior; /* Prior select in a compound select statement */
10916 Select *pNext; /* Next select to the left in a compound */
10917 Select *pRightmost; /* Right-most select in a compound select statement */
10918 Expr *pLimit; /* LIMIT expression. NULL means not used. */
10919 Expr *pOffset; /* OFFSET expression. NULL means not used. */
10920 int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
10921 int addrOpenEphm[3]; /* OP_OpenEphem opcodes related to this select */
10922 double nSelectRow; /* Estimated number of result rows */
10923 };
10924
10925 /*
10926 ** Allowed values for Select.selFlags. The "SF" prefix stands for
10927 ** "Select Flag".
@@ -10931,10 +10921,11 @@
10931 #define SF_Aggregate 0x04 /* Contains aggregate functions */
10932 #define SF_UsesEphemeral 0x08 /* Uses the OpenEphemeral opcode */
10933 #define SF_Expanded 0x10 /* sqlite3SelectExpand() called on this */
10934 #define SF_HasTypeInfo 0x20 /* FROM subqueries have Table metadata */
10935 #define SF_UseSorter 0x40 /* Sort using a sorter */
 
10936
10937
10938 /*
10939 ** The results of a select can be distributed in several ways. The
10940 ** "SRT" prefix means "SELECT Result Type".
@@ -11008,14 +10999,14 @@
11008 ** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
11009 ** a mask of new.* columns used by the program.
11010 */
11011 struct TriggerPrg {
11012 Trigger *pTrigger; /* Trigger this program was coded from */
11013 int orconf; /* Default ON CONFLICT policy */
11014 SubProgram *pProgram; /* Program implementing pTrigger/orconf */
 
11015 u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */
11016 TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */
11017 };
11018
11019 /*
11020 ** The yDbMask datatype for the bitmask of all attached databases.
11021 */
@@ -11041,18 +11032,22 @@
11041 ** compiled. Function sqlite3TableLock() is used to add entries to the
11042 ** list.
11043 */
11044 struct Parse {
11045 sqlite3 *db; /* The main database structure */
11046 int rc; /* Return code from execution */
11047 char *zErrMsg; /* An error message */
11048 Vdbe *pVdbe; /* An engine for executing database bytecode */
 
11049 u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
11050 u8 checkSchema; /* Causes schema cookie check after an error */
11051 u8 nested; /* Number of nested calls to the parser/code generator */
11052 u8 nTempReg; /* Number of temporary registers in aTempReg[] */
11053 u8 nTempInUse; /* Number of aTempReg[] currently checked out */
 
 
 
 
11054 int aTempReg[8]; /* Holding area for temporary registers */
11055 int nRangeReg; /* Size of the temporary register block */
11056 int iRangeReg; /* First register in temporary register block */
11057 int nErr; /* Number of errors seen */
11058 int nTab; /* Number of previously allocated VDBE cursors */
@@ -11060,12 +11055,10 @@
11060 int nSet; /* Number of sets used so far */
11061 int nOnce; /* Number of OP_Once instructions so far */
11062 int ckBase; /* Base register of data during check constraints */
11063 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
11064 int iCacheCnt; /* Counter used to generate aColCache[].lru values */
11065 u8 nColCache; /* Number of entries in aColCache[] */
11066 u8 iColCache; /* Next entry in aColCache[] to replace */
11067 struct yColCache {
11068 int iTable; /* Table cursor number */
11069 int iColumn; /* Table column number */
11070 u8 tempReg; /* iReg is a temp register that needs to be freed */
11071 int iLevel; /* Nesting level */
@@ -11072,65 +11065,67 @@
11072 int iReg; /* Reg with value of this column. 0 means none. */
11073 int lru; /* Least recently used entry has the smallest value */
11074 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
11075 yDbMask writeMask; /* Start a write transaction on these databases */
11076 yDbMask cookieMask; /* Bitmask of schema verified databases */
11077 u8 isMultiWrite; /* True if statement may affect/insert multiple rows */
11078 u8 mayAbort; /* True if statement may throw an ABORT exception */
11079 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */
11080 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
 
 
 
11081 #ifndef SQLITE_OMIT_SHARED_CACHE
11082 int nTableLock; /* Number of locks in aTableLock */
11083 TableLock *aTableLock; /* Required table locks for shared-cache mode */
11084 #endif
11085 int regRowid; /* Register holding rowid of CREATE TABLE entry */
11086 int regRoot; /* Register holding root page number for new objects */
11087 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
11088 int nMaxArg; /* Max args passed to user function by sub-program */
11089
11090 /* Information used while coding trigger programs. */
11091 Parse *pToplevel; /* Parse structure for main program (or NULL) */
11092 Table *pTriggerTab; /* Table triggers are being coded for */
 
11093 u32 oldmask; /* Mask of old.* columns referenced */
11094 u32 newmask; /* Mask of new.* columns referenced */
11095 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
11096 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
11097 u8 disableTriggers; /* True to disable triggers */
11098 double nQueryLoop; /* Estimated number of iterations of a query */
11099
11100 /* Above is constant between recursions. Below is reset before and after
11101 ** each recursion */
11102
11103 int nVar; /* Number of '?' variables seen in the SQL so far */
11104 int nzVar; /* Number of available slots in azVar[] */
11105 char **azVar; /* Pointers to names of parameters */
11106 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
11107 int nAlias; /* Number of aliased result set columns */
11108 int *aAlias; /* Register used to hold aliased result */
11109 u8 explain; /* True if the EXPLAIN flag is found on the query */
11110 Token sNameToken; /* Token with unqualified schema object name */
11111 Token sLastToken; /* The last token parsed */
11112 const char *zTail; /* All SQL text past the last semicolon parsed */
11113 Table *pNewTable; /* A table being constructed by CREATE TABLE */
 
 
 
 
 
 
 
11114 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
11115 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
 
 
11116 #ifndef SQLITE_OMIT_VIRTUALTABLE
11117 Token sArg; /* Complete text of a module argument */
11118 u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
11119 int nVtabLock; /* Number of virtual tables to lock */
11120 Table **apVtabLock; /* Pointer to virtual tables needing locking */
11121 #endif
11122 int nHeight; /* Expression tree height of current sub-select */
11123 Table *pZombieTab; /* List of Table objects to delete after code gen */
11124 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
11125
11126 #ifndef SQLITE_OMIT_EXPLAIN
11127 int iSelectId;
11128 int iNextSelectId;
11129 #endif
11130 };
11131
 
 
 
11132 #ifdef SQLITE_OMIT_VIRTUALTABLE
11133 #define IN_DECLARE_VTAB 0
11134 #else
11135 #define IN_DECLARE_VTAB (pParse->declareVtab)
11136 #endif
@@ -11277,12 +11272,12 @@
11277 ** A pointer to this structure is used to communicate information
11278 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
11279 */
11280 typedef struct {
11281 sqlite3 *db; /* The database being initialized */
11282 int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
11283 char **pzErrMsg; /* Error message stored here */
 
11284 int rc; /* Result code stored here */
11285 } InitData;
11286
11287 /*
11288 ** Structure containing global configuration data for the SQLite library.
@@ -11603,11 +11598,11 @@
11603 #else
11604 # define sqlite3AutoincrementBegin(X)
11605 # define sqlite3AutoincrementEnd(X)
11606 #endif
11607 SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
11608 SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*);
11609 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
11610 SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
11611 SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
11612 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
11613 SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
@@ -11841,11 +11836,11 @@
11841 #ifdef SQLITE_ENABLE_8_3_NAMES
11842 SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*);
11843 #else
11844 # define sqlite3FileSuffix3(X,Y)
11845 #endif
11846 SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z);
11847
11848 SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
11849 SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
11850 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
11851 void(*)(void*));
@@ -11967,11 +11962,11 @@
11967 SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int);
11968 SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*);
11969 # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
11970 #endif
11971 SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
11972 SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
11973 SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*);
11974 SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*);
11975 SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*);
11976 SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
11977 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
@@ -12896,25 +12891,25 @@
12896 ** set to NULL if the currently executing frame is the main program.
12897 */
12898 typedef struct VdbeFrame VdbeFrame;
12899 struct VdbeFrame {
12900 Vdbe *v; /* VM this frame belongs to */
12901 int pc; /* Program Counter in parent (calling) frame */
12902 Op *aOp; /* Program instructions for parent frame */
12903 int nOp; /* Size of aOp array */
12904 Mem *aMem; /* Array of memory cells for parent frame */
12905 int nMem; /* Number of entries in aMem */
12906 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
12907 int nOnceFlag; /* Number of entries in aOnceFlag */
12908 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
12909 u16 nCursor; /* Number of entries in apCsr */
12910 void *token; /* Copy of SubProgram.token */
 
 
 
 
 
 
12911 int nChildMem; /* Number of memory cells for child frame */
12912 int nChildCsr; /* Number of cursors for child frame */
12913 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
12914 int nChange; /* Statement changes (Vdbe.nChanges) */
12915 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
12916 };
12917
12918 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
12919
12920 /*
@@ -13037,12 +13032,13 @@
13037 struct sqlite3_context {
13038 FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
13039 VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
13040 Mem s; /* The return value is stored here */
13041 Mem *pMem; /* Memory cell used to store aggregate context */
13042 int isError; /* Error code returned by the function. */
13043 CollSeq *pColl; /* Collating sequence */
 
 
13044 };
13045
13046 /*
13047 ** An Explain object accumulates indented output which is helpful
13048 ** in describing recursive data structures.
@@ -13079,11 +13075,10 @@
13079 Mem *pResultSet; /* Pointer to an array of results */
13080 int nMem; /* Number of memory locations currently allocated */
13081 int nOp; /* Number of instructions in the program */
13082 int nOpAlloc; /* Number of slots allocated for aOp[] */
13083 int nLabel; /* Number of labels used */
13084 int nLabelAlloc; /* Number of slots allocated in aLabel[] */
13085 int *aLabel; /* Space to hold the labels */
13086 u16 nResColumn; /* Number of columns in one row of the result set */
13087 u16 nCursor; /* Number of slots in apCsr[] */
13088 u32 magic; /* Magic number for sanity checking */
13089 char *zErrMsg; /* Error message written here */
@@ -15146,11 +15141,39 @@
15146 ** This file contains low-level memory allocation drivers for when
15147 ** SQLite will use the standard C-library malloc/realloc/free interface
15148 ** to obtain the memory it needs.
15149 **
15150 ** This file contains implementations of the low-level memory allocation
15151 ** routines specified in the sqlite3_mem_methods object.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15152 */
15153
15154 /*
15155 ** This version of the memory allocator is the default. It is
15156 ** used when no other memory allocator is specified using compile-time
@@ -15157,21 +15180,25 @@
15157 ** macros.
15158 */
15159 #ifdef SQLITE_SYSTEM_MALLOC
15160
15161 /*
15162 ** Windows systems have malloc_usable_size() but it is called _msize()
 
 
15163 */
15164 #if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
 
15165 # define HAVE_MALLOC_USABLE_SIZE 1
15166 # define malloc_usable_size _msize
15167 #endif
15168
15169 #if defined(__APPLE__)
15170
15171 /*
15172 ** Use the zone allocator available on apple products
 
15173 */
15174 #include <sys/sysctl.h>
15175 #include <malloc/malloc.h>
15176 #include <libkern/OSAtomic.h>
15177 static malloc_zone_t* _sqliteZone_;
@@ -15182,21 +15209,24 @@
15182 (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))
15183
15184 #else /* if not __APPLE__ */
15185
15186 /*
15187 ** Use standard C library malloc and free on non-Apple systems.
 
15188 */
15189 #define SQLITE_MALLOC(x) malloc(x)
15190 #define SQLITE_FREE(x) free(x)
15191 #define SQLITE_REALLOC(x,y) realloc((x),(y))
15192
15193 #ifdef HAVE_MALLOC_USABLE_SIZE
15194 #include <malloc.h>
15195 #define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
 
 
15196 #else
15197 #undef SQLITE_MALLOCSIZE
15198 #endif
15199
15200 #endif /* __APPLE__ or not __APPLE__ */
15201
15202 /*
@@ -15314,11 +15344,11 @@
15314
15315 /*
15316 ** Initialize this module.
15317 */
15318 static int sqlite3MemInit(void *NotUsed){
15319 #if defined(__APPLE__)
15320 int cpuCount;
15321 size_t len;
15322 if( _sqliteZone_ ){
15323 return SQLITE_OK;
15324 }
@@ -36786,20 +36816,19 @@
36786 int szExtra; /* Size of extra space in bytes */
36787 int bPurgeable; /* True if cache is purgeable */
36788 unsigned int nMin; /* Minimum number of pages reserved */
36789 unsigned int nMax; /* Configured "cache_size" value */
36790 unsigned int n90pct; /* nMax*9/10 */
 
36791
36792 /* Hash table of all pages. The following variables may only be accessed
36793 ** when the accessor is holding the PGroup mutex.
36794 */
36795 unsigned int nRecyclable; /* Number of pages in the LRU list */
36796 unsigned int nPage; /* Total number of pages in apHash */
36797 unsigned int nHash; /* Number of slots in apHash[] */
36798 PgHdr1 **apHash; /* Hash table for fast lookup by key */
36799
36800 unsigned int iMaxKey; /* Largest key seen since xTruncate() */
36801 };
36802
36803 /*
36804 ** Each cache entry is represented by an instance of the following
36805 ** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of
@@ -36839,12 +36868,12 @@
36839 int nSlot; /* The number of pcache slots */
36840 int nReserve; /* Try to keep nFreeSlot above this */
36841 void *pStart, *pEnd; /* Bounds of pagecache malloc range */
36842 /* Above requires no mutex. Use mutex below for variable that follow. */
36843 sqlite3_mutex *mutex; /* Mutex for accessing the following: */
36844 int nFreeSlot; /* Number of unused pcache slots */
36845 PgFreeslot *pFree; /* Free page blocks */
 
36846 /* The following value requires a mutex to change. We skip the mutex on
36847 ** reading because (1) most platforms read a 32-bit integer atomically and
36848 ** (2) even if an incorrect value is read, no great harm is done since this
36849 ** is really just an optimization. */
36850 int bUnderPressure; /* True if low on PAGECACHE memory */
@@ -38898,11 +38927,10 @@
38898 struct Pager {
38899 sqlite3_vfs *pVfs; /* OS functions to use for IO */
38900 u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
38901 u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */
38902 u8 useJournal; /* Use a rollback journal on this file */
38903 u8 noReadlock; /* Do not bother to obtain readlocks */
38904 u8 noSync; /* Do not sync the journal if true */
38905 u8 fullSync; /* Do extra syncs of the journal for robustness */
38906 u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */
38907 u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */
38908 u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
@@ -39146,11 +39174,11 @@
39146 break;
39147
39148 case PAGER_READER:
39149 assert( pPager->errCode==SQLITE_OK );
39150 assert( p->eLock!=UNKNOWN_LOCK );
39151 assert( p->eLock>=SHARED_LOCK || p->noReadlock );
39152 break;
39153
39154 case PAGER_WRITER_LOCKED:
39155 assert( p->eLock!=UNKNOWN_LOCK );
39156 assert( pPager->errCode==SQLITE_OK );
@@ -41355,11 +41383,11 @@
41355 ** if the database size is not available. The database size is not
41356 ** available from the WAL sub-system if the log file is empty or
41357 ** contains no valid committed transactions.
41358 */
41359 assert( pPager->eState==PAGER_OPEN );
41360 assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock );
41361 nPage = sqlite3WalDbsize(pPager->pWal);
41362
41363 /* If the database size was not available from the WAL sub-system,
41364 ** determine it based on the size of the database file. If the size
41365 ** of the database file is not an integer multiple of the page-size,
@@ -41410,11 +41438,11 @@
41410 ** other connection.
41411 */
41412 static int pagerOpenWalIfPresent(Pager *pPager){
41413 int rc = SQLITE_OK;
41414 assert( pPager->eState==PAGER_OPEN );
41415 assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock );
41416
41417 if( !pPager->tempFile ){
41418 int isWal; /* True if WAL file exists */
41419 Pgno nPage; /* Size of the database file */
41420
@@ -42573,11 +42601,11 @@
42573 ** along with each page reference. This space is available to the user
42574 ** via the sqlite3PagerGetExtra() API.
42575 **
42576 ** The flags argument is used to specify properties that affect the
42577 ** operation of the pager. It should be passed some bitwise combination
42578 ** of the PAGER_OMIT_JOURNAL and PAGER_NO_READLOCK flags.
42579 **
42580 ** The vfsFlags parameter is a bitmask to pass to the flags parameter
42581 ** of the xOpen() method of the supplied VFS when opening files.
42582 **
42583 ** If the pager object is allocated and the specified file opened
@@ -42604,11 +42632,10 @@
42604 int readOnly = 0; /* True if this is a read-only file */
42605 int journalFileSize; /* Bytes to allocate for each journal fd */
42606 char *zPathname = 0; /* Full path to database file */
42607 int nPathname = 0; /* Number of bytes in zPathname */
42608 int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
42609 int noReadlock = (flags & PAGER_NO_READLOCK)!=0; /* True to omit read-lock */
42610 int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
42611 u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
42612 const char *zUri = 0; /* URI args to copy */
42613 int nUri = 0; /* Number of bytes of URI args at *zUri */
42614
@@ -42811,11 +42838,10 @@
42811
42812 PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename));
42813 IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename))
42814
42815 pPager->useJournal = (u8)useJournal;
42816 pPager->noReadlock = (noReadlock && readOnly) ?1:0;
42817 /* pPager->stmtOpen = 0; */
42818 /* pPager->stmtInUse = 0; */
42819 /* pPager->nRef = 0; */
42820 /* pPager->stmtSize = 0; */
42821 /* pPager->stmtJSize = 0; */
@@ -43033,18 +43059,15 @@
43033
43034 if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
43035 int bHotJournal = 1; /* True if there exists a hot journal-file */
43036
43037 assert( !MEMDB );
43038 assert( pPager->noReadlock==0 || pPager->readOnly );
43039
43040 if( pPager->noReadlock==0 ){
43041 rc = pager_wait_on_lock(pPager, SHARED_LOCK);
43042 if( rc!=SQLITE_OK ){
43043 assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );
43044 goto failed;
43045 }
43046 }
43047
43048 /* If a journal file exists, and there is no RESERVED lock on the
43049 ** database file, then it either needs to be played back or deleted.
43050 */
@@ -45048,11 +45071,11 @@
45048 */
45049 static int pagerOpenWal(Pager *pPager){
45050 int rc = SQLITE_OK;
45051
45052 assert( pPager->pWal==0 && pPager->tempFile==0 );
45053 assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK || pPager->noReadlock);
45054
45055 /* If the pager is already in exclusive-mode, the WAL module will use
45056 ** heap-memory for the wal-index instead of the VFS shared-memory
45057 ** implementation. Take the exclusive lock now, before opening the WAL
45058 ** file, to make sure this is safe.
@@ -48561,14 +48584,13 @@
48561 u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
48562 u16 cellOffset; /* Index in aData of first cell pointer */
48563 u16 nFree; /* Number of free bytes on the page */
48564 u16 nCell; /* Number of cells on this page, local and ovfl */
48565 u16 maskPage; /* Mask for page offset */
48566 struct _OvflCell { /* Cells that will not fit on aData[] */
48567 u8 *pCell; /* Pointers to the body of the overflow cell */
48568 u16 idx; /* Insert this cell before idx-th non-overflow cell */
48569 } aOvfl[5];
48570 BtShared *pBt; /* Pointer to BtShared that this page is part of */
48571 u8 *aData; /* Pointer to disk image of the page data */
48572 u8 *aDataEnd; /* One byte past the end of usable data */
48573 u8 *aCellIdx; /* The cell index area */
48574 DbPage *pDbPage; /* Pager page handle */
@@ -48772,10 +48794,13 @@
48772 struct BtCursor {
48773 Btree *pBtree; /* The Btree to which this cursor belongs */
48774 BtShared *pBt; /* The BtShared this cursor points to */
48775 BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
48776 struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
 
 
 
48777 Pgno pgnoRoot; /* The root page of this tree */
48778 sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */
48779 CellInfo info; /* A parse of the cell we are pointing at */
48780 i64 nKey; /* Size of pKey, or last integer key */
48781 void *pKey; /* Saved key that was cursor's last known position */
@@ -48783,11 +48808,10 @@
48783 u8 wrFlag; /* True if writable */
48784 u8 atLast; /* Cursor pointing to the last entry */
48785 u8 validNKey; /* True if info.nKey is valid */
48786 u8 eState; /* One of the CURSOR_XXX constants (see below) */
48787 #ifndef SQLITE_OMIT_INCRBLOB
48788 Pgno *aOverflow; /* Cache of overflow page locations */
48789 u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */
48790 #endif
48791 i16 iPage; /* Index of current page in apPage */
48792 u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
48793 MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
@@ -48912,12 +48936,12 @@
48912 */
48913 typedef struct IntegrityCk IntegrityCk;
48914 struct IntegrityCk {
48915 BtShared *pBt; /* The tree being checked out */
48916 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
48917 Pgno nPage; /* Number of pages in the database */
48918 int *anRef; /* Number of times each page is referenced */
 
48919 int mxErr; /* Stop accumulating errors when this reaches zero */
48920 int nErr; /* Number of messages written to zErrMsg so far */
48921 int mallocFailed; /* A memory allocation error has occurred */
48922 StrAccum errMsg; /* Accumulate the error message text here */
48923 };
@@ -50073,16 +50097,14 @@
50073 static u8 *findOverflowCell(MemPage *pPage, int iCell){
50074 int i;
50075 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
50076 for(i=pPage->nOverflow-1; i>=0; i--){
50077 int k;
50078 struct _OvflCell *pOvfl;
50079 pOvfl = &pPage->aOvfl[i];
50080 k = pOvfl->idx;
50081 if( k<=iCell ){
50082 if( k==iCell ){
50083 return pOvfl->pCell;
50084 }
50085 iCell--;
50086 }
50087 }
50088 return findCell(pPage, iCell);
@@ -50892,15 +50914,12 @@
50892 ** when sqlite3BtreeClose() is called.
50893 **
50894 ** If zFilename is ":memory:" then an in-memory database is created
50895 ** that is automatically destroyed when it is closed.
50896 **
50897 ** The "flags" parameter is a bitmask that might contain bits
50898 ** BTREE_OMIT_JOURNAL and/or BTREE_NO_READLOCK. The BTREE_NO_READLOCK
50899 ** bit is also set if the SQLITE_NoReadlock flags is set in db->flags.
50900 ** These flags are passed through into sqlite3PagerOpen() and must
50901 ** be the same values as PAGER_OMIT_JOURNAL and PAGER_NO_READLOCK.
50902 **
50903 ** If the database is already opened in the same database connection
50904 ** and we are in shared cache mode, then the open will fail with an
50905 ** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared
50906 ** objects in the same database connection since doing so will lead
@@ -50943,13 +50962,10 @@
50943 assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );
50944
50945 /* A BTREE_SINGLE database is always a temporary and/or ephemeral */
50946 assert( (flags & BTREE_SINGLE)==0 || isTempDb );
50947
50948 if( db->flags & SQLITE_NoReadlock ){
50949 flags |= BTREE_NO_READLOCK;
50950 }
50951 if( isMemdb ){
50952 flags |= BTREE_MEMORY;
50953 }
50954 if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
50955 vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
@@ -53397,11 +53413,11 @@
53397 return SQLITE_CORRUPT_BKPT;
53398 }
53399 return SQLITE_OK;
53400 }
53401
53402 #ifndef NDEBUG
53403 /*
53404 ** Page pParent is an internal (non-leaf) tree page. This function
53405 ** asserts that page number iChild is the left-child if the iIdx'th
53406 ** cell in page pParent. Or, if iIdx is equal to the total number of
53407 ** cells in pParent, that page number iChild is the right-child of
@@ -53430,15 +53446,25 @@
53430 static void moveToParent(BtCursor *pCur){
53431 assert( cursorHoldsMutex(pCur) );
53432 assert( pCur->eState==CURSOR_VALID );
53433 assert( pCur->iPage>0 );
53434 assert( pCur->apPage[pCur->iPage] );
 
 
 
 
 
 
 
53435 assertParentIndex(
53436 pCur->apPage[pCur->iPage-1],
53437 pCur->aiIdx[pCur->iPage-1],
53438 pCur->apPage[pCur->iPage]->pgno
53439 );
 
 
 
53440 releasePage(pCur->apPage[pCur->iPage]);
53441 pCur->iPage--;
53442 pCur->info.nSize = 0;
53443 pCur->validNKey = 0;
53444 }
@@ -53904,11 +53930,17 @@
53904 pCur->skipNext = 0;
53905
53906 pPage = pCur->apPage[pCur->iPage];
53907 idx = ++pCur->aiIdx[pCur->iPage];
53908 assert( pPage->isInit );
53909 assert( idx<=pPage->nCell );
 
 
 
 
 
 
53910
53911 pCur->info.nSize = 0;
53912 pCur->validNKey = 0;
53913 if( idx>=pPage->nCell ){
53914 if( !pPage->leaf ){
@@ -54714,11 +54746,11 @@
54714 ** content of the cell.
54715 **
54716 ** If the cell content will fit on the page, then put it there. If it
54717 ** will not fit, then make a copy of the cell content into pTemp if
54718 ** pTemp is not null. Regardless of pTemp, allocate a new entry
54719 ** in pPage->aOvfl[] and make it point to the cell content (either
54720 ** in pTemp or the original pCell) and also record its index.
54721 ** Allocating a new entry in pPage->aCell[] implies that
54722 ** pPage->nOverflow is incremented.
54723 **
54724 ** If nSkip is non-zero, then do not copy the first nSkip bytes of the
@@ -54748,11 +54780,12 @@
54748
54749 if( *pRC ) return;
54750
54751 assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
54752 assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 );
54753 assert( pPage->nOverflow<=ArraySize(pPage->aOvfl) );
 
54754 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
54755 /* The cell should normally be sized correctly. However, when moving a
54756 ** malformed cell from a leaf page to an interior page, if the cell size
54757 ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
54758 ** might be less than 8 (leaf-size + pointer) on the interior node. Hence
@@ -54765,13 +54798,13 @@
54765 }
54766 if( iChild ){
54767 put4byte(pCell, iChild);
54768 }
54769 j = pPage->nOverflow++;
54770 assert( j<(int)(sizeof(pPage->aOvfl)/sizeof(pPage->aOvfl[0])) );
54771 pPage->aOvfl[j].pCell = pCell;
54772 pPage->aOvfl[j].idx = (u16)i;
54773 }else{
54774 int rc = sqlite3PagerWrite(pPage->pDbPage);
54775 if( rc!=SQLITE_OK ){
54776 *pRC = rc;
54777 return;
@@ -54915,11 +54948,11 @@
54915 rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
54916
54917 if( rc==SQLITE_OK ){
54918
54919 u8 *pOut = &pSpace[4];
54920 u8 *pCell = pPage->aOvfl[0].pCell;
54921 u16 szCell = cellSizePtr(pPage, pCell);
54922 u8 *pStop;
54923
54924 assert( sqlite3PagerIswriteable(pNew->pDbPage) );
54925 assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
@@ -55025,11 +55058,11 @@
55025 ** parent page stored in the pointer map is page pTo. If pFrom contained
55026 ** any cells with overflow page pointers, then the corresponding pointer
55027 ** map entries are also updated so that the parent page is page pTo.
55028 **
55029 ** If pFrom is currently carrying any overflow cells (entries in the
55030 ** MemPage.aOvfl[] array), they are not copied to pTo.
55031 **
55032 ** Before returning, page pTo is reinitialized using btreeInitPage().
55033 **
55034 ** The performance of this function is not critical. It is only used by
55035 ** the balance_shallower() and balance_deeper() procedures, neither of
@@ -55162,11 +55195,11 @@
55162 ** this overflow cell is present, it must be the cell with
55163 ** index iParentIdx. This scenario comes about when this function
55164 ** is called (indirectly) from sqlite3BtreeDelete().
55165 */
55166 assert( pParent->nOverflow==0 || pParent->nOverflow==1 );
55167 assert( pParent->nOverflow==0 || pParent->aOvfl[0].idx==iParentIdx );
55168
55169 if( !aOvflSpace ){
55170 return SQLITE_NOMEM;
55171 }
55172
@@ -55209,12 +55242,12 @@
55209 goto balance_cleanup;
55210 }
55211 nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
55212 if( (i--)==0 ) break;
55213
55214 if( i+nxDiv==pParent->aOvfl[0].idx && pParent->nOverflow ){
55215 apDiv[i] = pParent->aOvfl[0].pCell;
55216 pgno = get4byte(apDiv[i]);
55217 szNew[i] = cellSizePtr(pParent, apDiv[i]);
55218 pParent->nOverflow = 0;
55219 }else{
55220 apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);
@@ -55651,11 +55684,11 @@
55651 ** actually moved between pages. */
55652 MemPage *pNew = apNew[0];
55653 MemPage *pOld = apCopy[0];
55654 int nOverflow = pOld->nOverflow;
55655 int iNextOld = pOld->nCell + nOverflow;
55656 int iOverflow = (nOverflow ? pOld->aOvfl[0].idx : -1);
55657 j = 0; /* Current 'old' sibling page */
55658 k = 0; /* Current 'new' sibling page */
55659 for(i=0; i<nCell; i++){
55660 int isDivider = 0;
55661 while( i==iNextOld ){
@@ -55665,18 +55698,18 @@
55665 assert( j+1 < ArraySize(apCopy) );
55666 pOld = apCopy[++j];
55667 iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
55668 if( pOld->nOverflow ){
55669 nOverflow = pOld->nOverflow;
55670 iOverflow = i + !leafData + pOld->aOvfl[0].idx;
55671 }
55672 isDivider = !leafData;
55673 }
55674
55675 assert(nOverflow>0 || iOverflow<i );
55676 assert(nOverflow<2 || pOld->aOvfl[0].idx==pOld->aOvfl[1].idx-1);
55677 assert(nOverflow<3 || pOld->aOvfl[1].idx==pOld->aOvfl[2].idx-1);
55678 if( i==iOverflow ){
55679 isDivider = 1;
55680 if( (--nOverflow)>0 ){
55681 iOverflow++;
55682 }
@@ -55793,11 +55826,14 @@
55793 assert( pChild->nCell==pRoot->nCell );
55794
55795 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
55796
55797 /* Copy the overflow cells from pRoot to pChild */
55798 memcpy(pChild->aOvfl, pRoot->aOvfl, pRoot->nOverflow*sizeof(pRoot->aOvfl[0]));
 
 
 
55799 pChild->nOverflow = pRoot->nOverflow;
55800
55801 /* Zero the contents of pRoot. Then install pChild as the right-child. */
55802 zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);
55803 put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);
@@ -55856,11 +55892,11 @@
55856 rc = sqlite3PagerWrite(pParent->pDbPage);
55857 if( rc==SQLITE_OK ){
55858 #ifndef SQLITE_OMIT_QUICKBALANCE
55859 if( pPage->hasData
55860 && pPage->nOverflow==1
55861 && pPage->aOvfl[0].idx==pPage->nCell
55862 && pParent->pgno!=1
55863 && pParent->nCell==iIdx
55864 ){
55865 /* Call balance_quick() to create a new sibling of pPage on which
55866 ** to store the overflow cell. balance_quick() inserts a new cell
@@ -58277,10 +58313,11 @@
58277
58278 if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
58279 memcpy(pMem->zMalloc, pMem->z, pMem->n);
58280 }
58281 if( pMem->flags&MEM_Dyn && pMem->xDel ){
 
58282 pMem->xDel((void *)(pMem->z));
58283 }
58284
58285 pMem->z = pMem->zMalloc;
58286 if( pMem->z==0 ){
@@ -58456,10 +58493,11 @@
58456 sqlite3VdbeMemFinalize(p, p->u.pDef);
58457 assert( (p->flags & MEM_Agg)==0 );
58458 sqlite3VdbeMemRelease(p);
58459 }else if( p->flags&MEM_Dyn && p->xDel ){
58460 assert( (p->flags&MEM_RowSet)==0 );
 
58461 p->xDel((void *)p->z);
58462 p->xDel = 0;
58463 }else if( p->flags&MEM_RowSet ){
58464 sqlite3RowSetClear(p->u.pRowSet);
58465 }else if( p->flags&MEM_Frame ){
@@ -59573,18 +59611,15 @@
59573 ** Hence, a negative P2 value is a label that has yet to be resolved.
59574 **
59575 ** Zero is returned if a malloc() fails.
59576 */
59577 SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *p){
59578 int i;
59579 i = p->nLabel++;
59580 assert( p->magic==VDBE_MAGIC_INIT );
59581 if( i>=p->nLabelAlloc ){
59582 int n = p->nLabelAlloc*2 + 5;
59583 p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
59584 n*sizeof(p->aLabel[0]));
59585 p->nLabelAlloc = sqlite3DbMallocSize(p->db, p->aLabel)/sizeof(p->aLabel[0]);
59586 }
59587 if( p->aLabel ){
59588 p->aLabel[i] = -1;
59589 }
59590 return -1-i;
@@ -61625,16 +61660,10 @@
61625 }else{
61626 sqlite3VdbeSetChanges(db, 0);
61627 }
61628 p->nChange = 0;
61629 }
61630
61631 /* Rollback or commit any schema changes that occurred. */
61632 if( p->rc!=SQLITE_OK && db->flags&SQLITE_InternChanges ){
61633 sqlite3ResetInternalSchema(db, -1);
61634 db->flags = (db->flags | SQLITE_InternChanges);
61635 }
61636
61637 /* Release the locks */
61638 sqlite3VdbeLeave(p);
61639 }
61640
@@ -66051,23 +66080,30 @@
66051 arithmetic_result_is_null:
66052 sqlite3VdbeMemSetNull(pOut);
66053 break;
66054 }
66055
66056 /* Opcode: CollSeq * * P4
66057 **
66058 ** P4 is a pointer to a CollSeq struct. If the next call to a user function
66059 ** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will
66060 ** be returned. This is used by the built-in min(), max() and nullif()
66061 ** functions.
 
 
 
 
66062 **
66063 ** The interface used by the implementation of the aforementioned functions
66064 ** to retrieve the collation sequence set by this opcode is not available
66065 ** publicly, only to user functions defined in func.c.
66066 */
66067 case OP_CollSeq: {
66068 assert( pOp->p4type==P4_COLLSEQ );
 
 
 
66069 break;
66070 }
66071
66072 /* Opcode: Function P1 P2 P3 P4 P5
66073 **
@@ -67597,11 +67633,11 @@
67597 ** If a write-transaction is started and the Vdbe.usesStmtJournal flag is
67598 ** true (this flag is set if the Vdbe may modify more than one row and may
67599 ** throw an ABORT exception), a statement transaction may also be opened.
67600 ** More specifically, a statement transaction is opened iff the database
67601 ** connection is currently not in autocommit mode, or if there are other
67602 ** active statements. A statement transaction allows the affects of this
67603 ** VDBE to be rolled back after an error without having to roll back the
67604 ** entire transaction. If no error is encountered, the statement transaction
67605 ** will automatically commit when the VDBE halts.
67606 **
67607 ** If P2 is zero, then a read-lock is obtained on the database file.
@@ -69641,10 +69677,11 @@
69641 if( rc==SQLITE_OK ) rc = u.by.initData.rc;
69642 sqlite3DbFree(db, u.by.zSql);
69643 db->init.busy = 0;
69644 }
69645 }
 
69646 if( rc==SQLITE_NOMEM ){
69647 goto no_mem;
69648 }
69649 break;
69650 }
@@ -69983,11 +70020,10 @@
69983 p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
69984 p->aOp = aOp = u.cc.pProgram->aOp;
69985 p->nOp = u.cc.pProgram->nOp;
69986 p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
69987 p->nOnceFlag = u.cc.pProgram->nOnce;
69988 p->nOp = u.cc.pProgram->nOp;
69989 pc = -1;
69990 memset(p->aOnceFlag, 0, p->nOnceFlag);
69991
69992 break;
69993 }
@@ -70178,10 +70214,11 @@
70178 u.cf.ctx.s.zMalloc = 0;
70179 u.cf.ctx.s.xDel = 0;
70180 u.cf.ctx.s.db = db;
70181 u.cf.ctx.isError = 0;
70182 u.cf.ctx.pColl = 0;
 
70183 if( u.cf.ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){
70184 assert( pOp>p->aOp );
70185 assert( pOp[-1].p4type==P4_COLLSEQ );
70186 assert( pOp[-1].opcode==OP_CollSeq );
70187 u.cf.ctx.pColl = pOp[-1].p4.pColl;
@@ -70189,10 +70226,15 @@
70189 (u.cf.ctx.pFunc->xStep)(&u.cf.ctx, u.cf.n, u.cf.apVal); /* IMP: R-24505-23230 */
70190 if( u.cf.ctx.isError ){
70191 sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&u.cf.ctx.s));
70192 rc = u.cf.ctx.isError;
70193 }
 
 
 
 
 
70194
70195 sqlite3VdbeMemRelease(&u.cf.ctx.s);
70196
70197 break;
70198 }
@@ -71582,21 +71624,21 @@
71582 ** In other words, each time we advance to the next sorter element, log2(N)
71583 ** key comparison operations are required, where N is the number of segments
71584 ** being merged (rounded up to the next power of 2).
71585 */
71586 struct VdbeSorter {
71587 int nInMemory; /* Current size of pRecord list as PMA */
71588 int nTree; /* Used size of aTree/aIter (power of 2) */
71589 VdbeSorterIter *aIter; /* Array of iterators to merge */
71590 int *aTree; /* Current state of incremental merge */
71591 i64 iWriteOff; /* Current write offset within file pTemp1 */
71592 i64 iReadOff; /* Current read offset within file pTemp1 */
71593 sqlite3_file *pTemp1; /* PMA file 1 */
 
71594 int nPMA; /* Number of PMAs stored in pTemp1 */
71595 SorterRecord *pRecord; /* Head of in-memory record list */
71596 int mnPmaSize; /* Minimum PMA size, in bytes */
71597 int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
 
 
 
 
71598 UnpackedRecord *pUnpacked; /* Used to unpack keys */
71599 };
71600
71601 /*
71602 ** The following type is an iterator for a PMA. It caches the current key in
@@ -71603,14 +71645,14 @@
71603 ** variables nKey/aKey. If the iterator is at EOF, pFile==0.
71604 */
71605 struct VdbeSorterIter {
71606 i64 iReadOff; /* Current read offset */
71607 i64 iEof; /* 1 byte past EOF for this iterator */
71608 sqlite3_file *pFile; /* File iterator is reading from */
71609 int nAlloc; /* Bytes of space at aAlloc */
71610 u8 *aAlloc; /* Allocated space */
71611 int nKey; /* Number of bytes in key */
 
 
71612 u8 *aKey; /* Pointer to current key */
71613 };
71614
71615 /*
71616 ** A structure to store a single record. All in-memory records are connected
@@ -75093,12 +75135,13 @@
75093 int i;
75094 if( p==0 ) return 0;
75095 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
75096 if( pNew==0 ) return 0;
75097 pNew->iECursor = 0;
75098 pNew->nExpr = pNew->nAlloc = p->nExpr;
75099 pNew->a = pItem = sqlite3DbMallocRaw(db, p->nExpr*sizeof(p->a[0]) );
 
75100 if( pItem==0 ){
75101 sqlite3DbFree(db, pNew);
75102 return 0;
75103 }
75104 pOldItem = p->a;
@@ -75162,16 +75205,19 @@
75162 IdList *pNew;
75163 int i;
75164 if( p==0 ) return 0;
75165 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
75166 if( pNew==0 ) return 0;
75167 pNew->nId = pNew->nAlloc = p->nId;
75168 pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );
75169 if( pNew->a==0 ){
75170 sqlite3DbFree(db, pNew);
75171 return 0;
75172 }
 
 
 
75173 for(i=0; i<p->nId; i++){
75174 struct IdList_item *pNewItem = &pNew->a[i];
75175 struct IdList_item *pOldItem = &p->a[i];
75176 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
75177 pNewItem->idx = pOldItem->idx;
@@ -75229,21 +75275,20 @@
75229 if( pList==0 ){
75230 pList = sqlite3DbMallocZero(db, sizeof(ExprList) );
75231 if( pList==0 ){
75232 goto no_mem;
75233 }
75234 assert( pList->nAlloc==0 );
75235 }
75236 if( pList->nAlloc<=pList->nExpr ){
75237 struct ExprList_item *a;
75238 int n = pList->nAlloc*2 + 4;
75239 a = sqlite3DbRealloc(db, pList->a, n*sizeof(pList->a[0]));
75240 if( a==0 ){
75241 goto no_mem;
75242 }
75243 pList->a = a;
75244 pList->nAlloc = sqlite3DbMallocSize(db, a)/sizeof(a[0]);
75245 }
75246 assert( pList->a!=0 );
75247 if( 1 ){
75248 struct ExprList_item *pItem = &pList->a[pList->nExpr++];
75249 memset(pItem, 0, sizeof(*pItem));
@@ -75330,12 +75375,11 @@
75330 */
75331 SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
75332 int i;
75333 struct ExprList_item *pItem;
75334 if( pList==0 ) return;
75335 assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
75336 assert( pList->nExpr<=pList->nAlloc );
75337 for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
75338 sqlite3ExprDelete(db, pItem->pExpr);
75339 sqlite3DbFree(db, pItem->zName);
75340 sqlite3DbFree(db, pItem->zSpan);
75341 }
@@ -78012,13 +78056,11 @@
78012 int i;
78013 pInfo->aCol = sqlite3ArrayAllocate(
78014 db,
78015 pInfo->aCol,
78016 sizeof(pInfo->aCol[0]),
78017 3,
78018 &pInfo->nColumn,
78019 &pInfo->nColumnAlloc,
78020 &i
78021 );
78022 return i;
78023 }
78024
@@ -78030,13 +78072,11 @@
78030 int i;
78031 pInfo->aFunc = sqlite3ArrayAllocate(
78032 db,
78033 pInfo->aFunc,
78034 sizeof(pInfo->aFunc[0]),
78035 3,
78036 &pInfo->nFunc,
78037 &pInfo->nFuncAlloc,
78038 &i
78039 );
78040 return i;
78041 }
78042
@@ -78809,11 +78849,11 @@
78809 "name = CASE "
78810 "WHEN type='table' THEN %Q "
78811 "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
78812 "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
78813 "ELSE name END "
78814 "WHERE tbl_name=%Q AND "
78815 "(type='table' OR type='index' OR type='trigger');",
78816 zDb, SCHEMA_TABLE(iDb), zName, zName, zName,
78817 #ifndef SQLITE_OMIT_TRIGGER
78818 zName,
78819 #endif
@@ -82678,11 +82718,10 @@
82678 assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
82679 db->mallocFailed = 1;
82680 return;
82681 }
82682 pParse->pNewTable = 0;
82683 db->nTable++;
82684 db->flags |= SQLITE_InternChanges;
82685
82686 #ifndef SQLITE_OMIT_ALTERTABLE
82687 if( !p->pSelect ){
82688 const char *zName = (const char *)pParse->sNameToken.z;
@@ -84099,31 +84138,27 @@
84099 */
84100 SQLITE_PRIVATE void *sqlite3ArrayAllocate(
84101 sqlite3 *db, /* Connection to notify of malloc failures */
84102 void *pArray, /* Array of objects. Might be reallocated */
84103 int szEntry, /* Size of each object in the array */
84104 int initSize, /* Suggested initial allocation, in elements */
84105 int *pnEntry, /* Number of objects currently in use */
84106 int *pnAlloc, /* Current size of the allocation, in elements */
84107 int *pIdx /* Write the index of a new slot here */
84108 ){
84109 char *z;
84110 if( *pnEntry >= *pnAlloc ){
84111 void *pNew;
84112 int newSize;
84113 newSize = (*pnAlloc)*2 + initSize;
84114 pNew = sqlite3DbRealloc(db, pArray, newSize*szEntry);
84115 if( pNew==0 ){
84116 *pIdx = -1;
84117 return pArray;
84118 }
84119 *pnAlloc = sqlite3DbMallocSize(db, pNew)/szEntry;
84120 pArray = pNew;
84121 }
84122 z = (char*)pArray;
84123 memset(&z[*pnEntry * szEntry], 0, szEntry);
84124 *pIdx = *pnEntry;
84125 ++*pnEntry;
84126 return pArray;
84127 }
84128
84129 /*
@@ -84135,19 +84170,16 @@
84135 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){
84136 int i;
84137 if( pList==0 ){
84138 pList = sqlite3DbMallocZero(db, sizeof(IdList) );
84139 if( pList==0 ) return 0;
84140 pList->nAlloc = 0;
84141 }
84142 pList->a = sqlite3ArrayAllocate(
84143 db,
84144 pList->a,
84145 sizeof(pList->a[0]),
84146 5,
84147 &pList->nId,
84148 &pList->nAlloc,
84149 &i
84150 );
84151 if( i<0 ){
84152 sqlite3IdListDelete(db, pList);
84153 return 0;
@@ -86002,10 +86034,18 @@
86002 ** Return the collating function associated with a function.
86003 */
86004 static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
86005 return context->pColl;
86006 }
 
 
 
 
 
 
 
 
86007
86008 /*
86009 ** Implementation of the non-aggregate min() and max() functions
86010 */
86011 static void minmaxFunc(
@@ -87309,15 +87349,16 @@
87309 ){
87310 Mem *pArg = (Mem *)argv[0];
87311 Mem *pBest;
87312 UNUSED_PARAMETER(NotUsed);
87313
87314 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
87315 pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
87316 if( !pBest ) return;
87317
87318 if( pBest->flags ){
 
 
87319 int max;
87320 int cmp;
87321 CollSeq *pColl = sqlite3GetFuncCollSeq(context);
87322 /* This step function is used for both the min() and max() aggregates,
87323 ** the only difference between the two being that the sense of the
@@ -87329,20 +87370,22 @@
87329 */
87330 max = sqlite3_user_data(context)!=0;
87331 cmp = sqlite3MemCompare(pBest, pArg, pColl);
87332 if( (max && cmp<0) || (!max && cmp>0) ){
87333 sqlite3VdbeMemCopy(pBest, pArg);
 
 
87334 }
87335 }else{
87336 sqlite3VdbeMemCopy(pBest, pArg);
87337 }
87338 }
87339 static void minMaxFinalize(sqlite3_context *context){
87340 sqlite3_value *pRes;
87341 pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);
87342 if( pRes ){
87343 if( ALWAYS(pRes->flags) ){
87344 sqlite3_result_value(context, pRes);
87345 }
87346 sqlite3VdbeMemRelease(pRes);
87347 }
87348 }
@@ -91920,18 +91963,19 @@
91920 */
91921
91922 /*
91923 ** Interpret the given string as a safety level. Return 0 for OFF,
91924 ** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
91925 ** unrecognized string argument.
 
91926 **
91927 ** Note that the values returned are one less that the values that
91928 ** should be passed into sqlite3BtreeSetSafetyLevel(). The is done
91929 ** to support legacy SQL code. The safety level used to be boolean
91930 ** and older scripts may have used numbers 0 for OFF and 1 for ON.
91931 */
91932 static u8 getSafetyLevel(const char *z){
91933 /* 123456789 123456789 */
91934 static const char zText[] = "onoffalseyestruefull";
91935 static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
91936 static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
91937 static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2};
@@ -91938,23 +91982,23 @@
91938 int i, n;
91939 if( sqlite3Isdigit(*z) ){
91940 return (u8)sqlite3Atoi(z);
91941 }
91942 n = sqlite3Strlen30(z);
91943 for(i=0; i<ArraySize(iLength); i++){
91944 if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
91945 return iValue[i];
91946 }
91947 }
91948 return 1;
91949 }
91950
91951 /*
91952 ** Interpret the given string as a boolean value.
91953 */
91954 SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z){
91955 return getSafetyLevel(z)&1;
91956 }
91957
91958 /* The sqlite3GetBoolean() function is used by other modules but the
91959 ** remainder of this file is specific to PRAGMA processing. So omit
91960 ** the rest of the file if PRAGMAs are omitted from the build.
@@ -92093,11 +92137,10 @@
92093 #ifndef SQLITE_OMIT_CHECK
92094 { "ignore_check_constraints", SQLITE_IgnoreChecks },
92095 #endif
92096 /* The following is VERY experimental */
92097 { "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode },
92098 { "omit_readlock", SQLITE_NoReadlock },
92099
92100 /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
92101 ** flag if there are any active statements. */
92102 { "read_uncommitted", SQLITE_ReadUncommitted },
92103 { "recursive_triggers", SQLITE_RecTriggers },
@@ -92125,11 +92168,11 @@
92125 /* Foreign key support may not be enabled or disabled while not
92126 ** in auto-commit mode. */
92127 mask &= ~(SQLITE_ForeignKeys);
92128 }
92129
92130 if( sqlite3GetBoolean(zRight) ){
92131 db->flags |= mask;
92132 }else{
92133 db->flags &= ~mask;
92134 }
92135
@@ -92341,11 +92384,11 @@
92341 if( sqlite3StrICmp(zLeft,"secure_delete")==0 ){
92342 Btree *pBt = pDb->pBt;
92343 int b = -1;
92344 assert( pBt!=0 );
92345 if( zRight ){
92346 b = sqlite3GetBoolean(zRight);
92347 }
92348 if( pId2->n==0 && b>=0 ){
92349 int ii;
92350 for(ii=0; ii<db->nDb; ii++){
92351 sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -92746,11 +92789,11 @@
92746 }else{
92747 if( !db->autoCommit ){
92748 sqlite3ErrorMsg(pParse,
92749 "Safety level may not be changed inside a transaction");
92750 }else{
92751 pDb->safety_level = getSafetyLevel(zRight)+1;
92752 }
92753 }
92754 }else
92755 #endif /* SQLITE_OMIT_PAGER_PRAGMAS */
92756
@@ -92945,11 +92988,11 @@
92945 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
92946
92947 #ifndef NDEBUG
92948 if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
92949 if( zRight ){
92950 if( sqlite3GetBoolean(zRight) ){
92951 sqlite3ParserTrace(stderr, "parser: ");
92952 }else{
92953 sqlite3ParserTrace(0, 0);
92954 }
92955 }
@@ -92959,11 +93002,11 @@
92959 /* Reinstall the LIKE and GLOB functions. The variant of LIKE
92960 ** used will be case sensitive or not depending on the RHS.
92961 */
92962 if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
92963 if( zRight ){
92964 sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight));
92965 }
92966 }else
92967
92968 #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
92969 # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
@@ -94385,10 +94428,11 @@
94385 }
94386 if( pEList==0 ){
94387 pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0));
94388 }
94389 pNew->pEList = pEList;
 
94390 pNew->pSrc = pSrc;
94391 pNew->pWhere = pWhere;
94392 pNew->pGroupBy = pGroupBy;
94393 pNew->pHaving = pHaving;
94394 pNew->pOrderBy = pOrderBy;
@@ -95923,12 +95967,16 @@
95923 /* Make sure all SELECTs in the statement have the same number of elements
95924 ** in their result sets.
95925 */
95926 assert( p->pEList && pPrior->pEList );
95927 if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
95928 sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
95929 " do not have the same number of result columns", selectOpName(p->op));
 
 
 
 
95930 rc = 1;
95931 goto multi_select_end;
95932 }
95933
95934 /* Compound SELECTs that have an ORDER BY clause are handled separately.
@@ -96540,11 +96588,11 @@
96540 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
96541 if( pNew==0 ) return SQLITE_NOMEM;
96542 pNew->flags |= EP_IntValue;
96543 pNew->u.iValue = i;
96544 pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
96545 pOrderBy->a[nOrderBy++].iOrderByCol = (u16)i;
96546 }
96547 }
96548 }
96549
96550 /* Compute the comparison permutation and keyinfo that is used with
@@ -97903,10 +97951,12 @@
97903 ** the current cursor position.
97904 */
97905 static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
97906 Vdbe *v = pParse->pVdbe;
97907 int i;
 
 
97908 struct AggInfo_func *pF;
97909 struct AggInfo_col *pC;
97910
97911 pAggInfo->directMode = 1;
97912 sqlite3ExprCacheClear(pParse);
@@ -97938,11 +97988,12 @@
97938 pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
97939 }
97940 if( !pColl ){
97941 pColl = pParse->db->pDfltColl;
97942 }
97943 sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
 
97944 }
97945 sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,
97946 (void*)pF->pFunc, P4_FUNCDEF);
97947 sqlite3VdbeChangeP5(v, (u8)nArg);
97948 sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
@@ -97961,16 +98012,22 @@
97961 ** text or blob value. See ticket [883034dcb5].
97962 **
97963 ** Another solution would be to change the OP_SCopy used to copy cached
97964 ** values to an OP_Copy.
97965 */
 
 
 
97966 sqlite3ExprCacheClear(pParse);
97967 for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
97968 sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
97969 }
97970 pAggInfo->directMode = 0;
97971 sqlite3ExprCacheClear(pParse);
 
 
 
97972 }
97973
97974 /*
97975 ** Add a single OP_Explain instruction to the VDBE to explain a simple
97976 ** count(*) query ("SELECT count(*) FROM pTab").
@@ -98907,11 +98964,11 @@
98907 sqlite3ExplainPop(pVdbe);
98908 }
98909
98910 /* End of the structure debug printing code
98911 *****************************************************************************/
98912 #endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
98913
98914 /************** End of select.c **********************************************/
98915 /************** Begin file table.c *******************************************/
98916 /*
98917 ** 2001 September 15
@@ -101534,17 +101591,18 @@
101534 */
101535 SQLITE_PRIVATE void sqlite3VtabBeginParse(
101536 Parse *pParse, /* Parsing context */
101537 Token *pName1, /* Name of new table, or database name */
101538 Token *pName2, /* Name of new table or NULL */
101539 Token *pModuleName /* Name of the module for the virtual table */
 
101540 ){
101541 int iDb; /* The database the table is being created in */
101542 Table *pTable; /* The new virtual table */
101543 sqlite3 *db; /* Database connection */
101544
101545 sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
101546 pTable = pParse->pNewTable;
101547 if( pTable==0 ) return;
101548 assert( 0==pTable->pIndex );
101549
101550 db = pParse->db;
@@ -101575,11 +101633,11 @@
101575 ** This routine takes the module argument that has been accumulating
101576 ** in pParse->zArg[] and appends it to the list of arguments on the
101577 ** virtual table currently under construction in pParse->pTable.
101578 */
101579 static void addArgumentToVtab(Parse *pParse){
101580 if( pParse->sArg.z && ALWAYS(pParse->pNewTable) ){
101581 const char *z = (const char*)pParse->sArg.z;
101582 int n = pParse->sArg.n;
101583 sqlite3 *db = pParse->db;
101584 addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));
101585 }
@@ -107620,10 +107678,18 @@
107620 /*
107621 ** An instance of this structure holds the ATTACH key and the key type.
107622 */
107623 struct AttachKey { int type; Token key; };
107624
 
 
 
 
 
 
 
 
107625
107626 /* This is a utility routine used to set the ExprSpan.zStart and
107627 ** ExprSpan.zEnd values of pOut so that the span covers the complete
107628 ** range of text beginning with pStart and going to the end of pEnd.
107629 */
@@ -107743,40 +107809,41 @@
107743 ** YYNRULE the number of rules in the grammar
107744 ** YYERRORSYMBOL is the code number of the error symbol. If not
107745 ** defined, then do no error processing.
107746 */
107747 #define YYCODETYPE unsigned char
107748 #define YYNOCODE 253
107749 #define YYACTIONTYPE unsigned short int
107750 #define YYWILDCARD 67
107751 #define sqlite3ParserTOKENTYPE Token
107752 typedef union {
107753 int yyinit;
107754 sqlite3ParserTOKENTYPE yy0;
107755 int yy4;
107756 struct TrigEvent yy90;
107757 ExprSpan yy118;
107758 TriggerStep* yy203;
107759 u8 yy210;
107760 struct {int value; int mask;} yy215;
107761 SrcList* yy259;
107762 struct LimitVal yy292;
107763 Expr* yy314;
107764 ExprList* yy322;
107765 struct LikeOp yy342;
107766 IdList* yy384;
107767 Select* yy387;
 
107768 } YYMINORTYPE;
107769 #ifndef YYSTACKDEPTH
107770 #define YYSTACKDEPTH 100
107771 #endif
107772 #define sqlite3ParserARG_SDECL Parse *pParse;
107773 #define sqlite3ParserARG_PDECL ,Parse *pParse
107774 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
107775 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
107776 #define YYNSTATE 630
107777 #define YYNRULE 329
107778 #define YYFALLBACK 1
107779 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
107780 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
107781 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
107782
@@ -107842,477 +107909,480 @@
107842 ** shifting terminals.
107843 ** yy_reduce_ofst[] For each state, the offset into yy_action for
107844 ** shifting non-terminals after a reduce.
107845 ** yy_default[] Default action for each state.
107846 */
107847 #define YY_ACTTAB_COUNT (1557)
107848 static const YYACTIONTYPE yy_action[] = {
107849 /* 0 */ 313, 960, 186, 419, 2, 172, 627, 597, 55, 55,
107850 /* 10 */ 55, 55, 48, 53, 53, 53, 53, 52, 52, 51,
107851 /* 20 */ 51, 51, 50, 238, 302, 283, 623, 622, 516, 515,
107852 /* 30 */ 590, 584, 55, 55, 55, 55, 282, 53, 53, 53,
107853 /* 40 */ 53, 52, 52, 51, 51, 51, 50, 238, 6, 56,
107854 /* 50 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107855 /* 60 */ 55, 55, 608, 53, 53, 53, 53, 52, 52, 51,
107856 /* 70 */ 51, 51, 50, 238, 313, 597, 409, 330, 579, 579,
107857 /* 80 */ 32, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107858 /* 90 */ 50, 238, 330, 217, 620, 619, 166, 411, 624, 382,
107859 /* 100 */ 379, 378, 7, 491, 590, 584, 200, 199, 198, 58,
107860 /* 110 */ 377, 300, 414, 621, 481, 66, 623, 622, 621, 580,
107861 /* 120 */ 254, 601, 94, 56, 57, 47, 582, 581, 583, 583,
107862 /* 130 */ 54, 54, 55, 55, 55, 55, 671, 53, 53, 53,
107863 /* 140 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 532,
107864 /* 150 */ 226, 506, 507, 133, 177, 139, 284, 385, 279, 384,
107865 /* 160 */ 169, 197, 342, 398, 251, 226, 253, 275, 388, 167,
107866 /* 170 */ 139, 284, 385, 279, 384, 169, 570, 236, 590, 584,
107867 /* 180 */ 672, 240, 275, 157, 620, 619, 554, 437, 51, 51,
107868 /* 190 */ 51, 50, 238, 343, 439, 553, 438, 56, 57, 47,
107869 /* 200 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107870 /* 210 */ 465, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107871 /* 220 */ 50, 238, 313, 390, 52, 52, 51, 51, 51, 50,
107872 /* 230 */ 238, 391, 166, 491, 566, 382, 379, 378, 409, 440,
107873 /* 240 */ 579, 579, 252, 440, 607, 66, 377, 513, 621, 49,
107874 /* 250 */ 46, 147, 590, 584, 621, 16, 466, 189, 621, 441,
107875 /* 260 */ 442, 673, 526, 441, 340, 577, 595, 64, 194, 482,
107876 /* 270 */ 434, 56, 57, 47, 582, 581, 583, 583, 54, 54,
107877 /* 280 */ 55, 55, 55, 55, 30, 53, 53, 53, 53, 52,
107878 /* 290 */ 52, 51, 51, 51, 50, 238, 313, 593, 593, 593,
107879 /* 300 */ 387, 578, 606, 493, 259, 351, 258, 411, 1, 623,
107880 /* 310 */ 622, 496, 623, 622, 65, 240, 623, 622, 597, 443,
107881 /* 320 */ 237, 239, 414, 341, 237, 602, 590, 584, 18, 603,
107882 /* 330 */ 166, 601, 87, 382, 379, 378, 67, 623, 622, 38,
107883 /* 340 */ 623, 622, 176, 270, 377, 56, 57, 47, 582, 581,
107884 /* 350 */ 583, 583, 54, 54, 55, 55, 55, 55, 175, 53,
107885 /* 360 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107886 /* 370 */ 313, 396, 233, 411, 531, 565, 317, 620, 619, 44,
107887 /* 380 */ 620, 619, 240, 206, 620, 619, 597, 266, 414, 268,
107888 /* 390 */ 409, 597, 579, 579, 352, 184, 505, 601, 73, 533,
107889 /* 400 */ 590, 584, 466, 548, 190, 620, 619, 576, 620, 619,
107890 /* 410 */ 547, 383, 551, 35, 332, 575, 574, 600, 504, 56,
107891 /* 420 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107892 /* 430 */ 55, 55, 567, 53, 53, 53, 53, 52, 52, 51,
107893 /* 440 */ 51, 51, 50, 238, 313, 411, 561, 561, 528, 364,
107894 /* 450 */ 259, 351, 258, 183, 361, 549, 524, 374, 411, 597,
107895 /* 460 */ 414, 240, 560, 560, 409, 604, 579, 579, 328, 601,
107896 /* 470 */ 93, 623, 622, 414, 590, 584, 237, 564, 559, 559,
107897 /* 480 */ 520, 402, 601, 87, 409, 210, 579, 579, 168, 421,
107898 /* 490 */ 950, 519, 950, 56, 57, 47, 582, 581, 583, 583,
107899 /* 500 */ 54, 54, 55, 55, 55, 55, 192, 53, 53, 53,
107900 /* 510 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 600,
107901 /* 520 */ 293, 563, 511, 234, 357, 146, 475, 475, 367, 411,
107902 /* 530 */ 562, 411, 358, 542, 425, 171, 411, 215, 144, 620,
107903 /* 540 */ 619, 544, 318, 353, 414, 203, 414, 275, 590, 584,
107904 /* 550 */ 549, 414, 174, 601, 94, 601, 79, 558, 471, 61,
107905 /* 560 */ 601, 79, 421, 949, 350, 949, 34, 56, 57, 47,
107906 /* 570 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107907 /* 580 */ 535, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107908 /* 590 */ 50, 238, 313, 307, 424, 394, 272, 49, 46, 147,
107909 /* 600 */ 349, 322, 4, 411, 491, 312, 321, 425, 568, 492,
107910 /* 610 */ 216, 264, 407, 575, 574, 429, 66, 549, 414, 621,
107911 /* 620 */ 540, 602, 590, 584, 13, 603, 621, 601, 72, 12,
107912 /* 630 */ 618, 617, 616, 202, 210, 621, 546, 469, 422, 319,
107913 /* 640 */ 148, 56, 57, 47, 582, 581, 583, 583, 54, 54,
107914 /* 650 */ 55, 55, 55, 55, 338, 53, 53, 53, 53, 52,
107915 /* 660 */ 52, 51, 51, 51, 50, 238, 313, 600, 600, 411,
107916 /* 670 */ 39, 21, 37, 170, 237, 875, 411, 572, 572, 201,
107917 /* 680 */ 144, 473, 538, 331, 414, 474, 143, 146, 630, 628,
107918 /* 690 */ 334, 414, 353, 601, 68, 168, 590, 584, 132, 365,
107919 /* 700 */ 601, 96, 307, 423, 530, 336, 49, 46, 147, 568,
107920 /* 710 */ 406, 216, 549, 360, 529, 56, 57, 47, 582, 581,
107921 /* 720 */ 583, 583, 54, 54, 55, 55, 55, 55, 411, 53,
107922 /* 730 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107923 /* 740 */ 313, 411, 605, 414, 484, 510, 172, 422, 597, 318,
107924 /* 750 */ 496, 485, 601, 99, 411, 142, 414, 411, 231, 411,
107925 /* 760 */ 540, 411, 359, 629, 2, 601, 97, 426, 308, 414,
107926 /* 770 */ 590, 584, 414, 20, 414, 621, 414, 621, 601, 106,
107927 /* 780 */ 503, 601, 105, 601, 108, 601, 109, 204, 28, 56,
107928 /* 790 */ 57, 47, 582, 581, 583, 583, 54, 54, 55, 55,
107929 /* 800 */ 55, 55, 411, 53, 53, 53, 53, 52, 52, 51,
107930 /* 810 */ 51, 51, 50, 238, 313, 411, 597, 414, 411, 276,
107931 /* 820 */ 214, 600, 411, 366, 213, 381, 601, 134, 274, 500,
107932 /* 830 */ 414, 167, 130, 414, 621, 411, 354, 414, 376, 601,
107933 /* 840 */ 135, 129, 601, 100, 590, 584, 601, 104, 522, 521,
107934 /* 850 */ 414, 621, 224, 273, 600, 167, 327, 282, 600, 601,
107935 /* 860 */ 103, 468, 521, 56, 57, 47, 582, 581, 583, 583,
107936 /* 870 */ 54, 54, 55, 55, 55, 55, 411, 53, 53, 53,
107937 /* 880 */ 53, 52, 52, 51, 51, 51, 50, 238, 313, 411,
107938 /* 890 */ 27, 414, 411, 375, 276, 167, 359, 544, 50, 238,
107939 /* 900 */ 601, 95, 128, 223, 414, 411, 165, 414, 411, 621,
107940 /* 910 */ 411, 621, 612, 601, 102, 372, 601, 76, 590, 584,
107941 /* 920 */ 414, 570, 236, 414, 470, 414, 167, 621, 188, 601,
107942 /* 930 */ 98, 225, 601, 138, 601, 137, 232, 56, 45, 47,
107943 /* 940 */ 582, 581, 583, 583, 54, 54, 55, 55, 55, 55,
107944 /* 950 */ 411, 53, 53, 53, 53, 52, 52, 51, 51, 51,
107945 /* 960 */ 50, 238, 313, 276, 276, 414, 411, 276, 544, 459,
107946 /* 970 */ 359, 171, 209, 479, 601, 136, 628, 334, 621, 621,
107947 /* 980 */ 125, 414, 621, 368, 411, 621, 257, 540, 589, 588,
107948 /* 990 */ 601, 75, 590, 584, 458, 446, 23, 23, 124, 414,
107949 /* 1000 */ 326, 325, 621, 427, 324, 309, 600, 288, 601, 92,
107950 /* 1010 */ 586, 585, 57, 47, 582, 581, 583, 583, 54, 54,
107951 /* 1020 */ 55, 55, 55, 55, 411, 53, 53, 53, 53, 52,
107952 /* 1030 */ 52, 51, 51, 51, 50, 238, 313, 587, 411, 414,
107953 /* 1040 */ 411, 207, 611, 476, 171, 472, 160, 123, 601, 91,
107954 /* 1050 */ 323, 261, 15, 414, 464, 414, 411, 621, 411, 354,
107955 /* 1060 */ 222, 411, 601, 74, 601, 90, 590, 584, 159, 264,
107956 /* 1070 */ 158, 414, 461, 414, 621, 600, 414, 121, 120, 25,
107957 /* 1080 */ 601, 89, 601, 101, 621, 601, 88, 47, 582, 581,
107958 /* 1090 */ 583, 583, 54, 54, 55, 55, 55, 55, 544, 53,
107959 /* 1100 */ 53, 53, 53, 52, 52, 51, 51, 51, 50, 238,
107960 /* 1110 */ 43, 405, 263, 3, 610, 264, 140, 415, 622, 24,
107961 /* 1120 */ 410, 11, 456, 594, 118, 155, 219, 452, 408, 621,
107962 /* 1130 */ 621, 621, 156, 43, 405, 621, 3, 286, 621, 113,
107963 /* 1140 */ 415, 622, 111, 445, 411, 400, 557, 403, 545, 10,
107964 /* 1150 */ 411, 408, 264, 110, 205, 436, 541, 566, 453, 414,
107965 /* 1160 */ 621, 621, 63, 621, 435, 414, 411, 621, 601, 94,
107966 /* 1170 */ 403, 621, 411, 337, 601, 86, 150, 40, 41, 534,
107967 /* 1180 */ 566, 414, 242, 264, 42, 413, 412, 414, 600, 595,
107968 /* 1190 */ 601, 85, 191, 333, 107, 451, 601, 84, 621, 539,
107969 /* 1200 */ 40, 41, 420, 230, 411, 149, 316, 42, 413, 412,
107970 /* 1210 */ 398, 127, 595, 315, 621, 399, 278, 625, 181, 414,
107971 /* 1220 */ 593, 593, 593, 592, 591, 14, 450, 411, 601, 71,
107972 /* 1230 */ 240, 621, 43, 405, 264, 3, 615, 180, 264, 415,
107973 /* 1240 */ 622, 614, 414, 593, 593, 593, 592, 591, 14, 621,
107974 /* 1250 */ 408, 601, 70, 621, 417, 33, 405, 613, 3, 411,
107975 /* 1260 */ 264, 411, 415, 622, 418, 626, 178, 509, 8, 403,
107976 /* 1270 */ 241, 416, 126, 408, 414, 621, 414, 449, 208, 566,
107977 /* 1280 */ 240, 221, 621, 601, 83, 601, 82, 599, 297, 277,
107978 /* 1290 */ 296, 30, 403, 31, 395, 264, 295, 397, 489, 40,
107979 /* 1300 */ 41, 411, 566, 220, 621, 294, 42, 413, 412, 271,
107980 /* 1310 */ 621, 595, 600, 621, 59, 60, 414, 269, 267, 623,
107981 /* 1320 */ 622, 36, 40, 41, 621, 601, 81, 598, 235, 42,
107982 /* 1330 */ 413, 412, 621, 621, 595, 265, 344, 411, 248, 556,
107983 /* 1340 */ 173, 185, 593, 593, 593, 592, 591, 14, 218, 29,
107984 /* 1350 */ 621, 543, 414, 305, 304, 303, 179, 301, 411, 566,
107985 /* 1360 */ 454, 601, 80, 289, 335, 593, 593, 593, 592, 591,
107986 /* 1370 */ 14, 411, 287, 414, 151, 392, 246, 260, 411, 196,
107987 /* 1380 */ 195, 523, 601, 69, 411, 245, 414, 526, 537, 285,
107988 /* 1390 */ 389, 595, 621, 414, 536, 601, 17, 362, 153, 414,
107989 /* 1400 */ 466, 463, 601, 78, 154, 414, 462, 152, 601, 77,
107990 /* 1410 */ 355, 255, 621, 455, 601, 9, 621, 386, 444, 517,
107991 /* 1420 */ 247, 621, 593, 593, 593, 621, 621, 244, 621, 243,
107992 /* 1430 */ 430, 518, 292, 621, 329, 621, 145, 393, 280, 513,
107993 /* 1440 */ 291, 131, 621, 514, 621, 621, 311, 621, 259, 346,
107994 /* 1450 */ 249, 621, 621, 229, 314, 621, 228, 512, 227, 240,
107995 /* 1460 */ 494, 488, 310, 164, 487, 486, 373, 480, 163, 262,
107996 /* 1470 */ 369, 371, 162, 26, 212, 478, 477, 161, 141, 363,
107997 /* 1480 */ 467, 122, 339, 187, 119, 348, 347, 117, 116, 115,
107998 /* 1490 */ 114, 112, 182, 457, 320, 22, 433, 432, 448, 19,
107999 /* 1500 */ 609, 431, 428, 62, 193, 596, 573, 298, 555, 552,
108000 /* 1510 */ 571, 404, 290, 380, 498, 510, 495, 306, 281, 499,
108001 /* 1520 */ 250, 5, 497, 460, 345, 447, 569, 550, 238, 299,
108002 /* 1530 */ 527, 525, 508, 961, 502, 501, 961, 401, 961, 211,
108003 /* 1540 */ 490, 356, 256, 961, 483, 961, 961, 961, 961, 961,
108004 /* 1550 */ 961, 961, 961, 961, 961, 961, 370,
 
 
108005 };
108006 static const YYCODETYPE yy_lookahead[] = {
108007 /* 0 */ 19, 142, 143, 144, 145, 24, 1, 26, 77, 78,
108008 /* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
108009 /* 20 */ 89, 90, 91, 92, 15, 98, 26, 27, 7, 8,
108010 /* 30 */ 49, 50, 77, 78, 79, 80, 109, 82, 83, 84,
108011 /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 22, 68,
108012 /* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108013 /* 60 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88,
108014 /* 70 */ 89, 90, 91, 92, 19, 94, 112, 19, 114, 115,
108015 /* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108016 /* 90 */ 91, 92, 19, 22, 94, 95, 96, 150, 150, 99,
108017 /* 100 */ 100, 101, 76, 150, 49, 50, 105, 106, 107, 54,
108018 /* 110 */ 110, 158, 165, 165, 161, 162, 26, 27, 165, 113,
108019 /* 120 */ 16, 174, 175, 68, 69, 70, 71, 72, 73, 74,
108020 /* 130 */ 75, 76, 77, 78, 79, 80, 118, 82, 83, 84,
108021 /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 23,
108022 /* 150 */ 92, 97, 98, 24, 96, 97, 98, 99, 100, 101,
108023 /* 160 */ 102, 25, 97, 216, 60, 92, 62, 109, 221, 25,
108024 /* 170 */ 97, 98, 99, 100, 101, 102, 86, 87, 49, 50,
108025 /* 180 */ 118, 116, 109, 25, 94, 95, 32, 97, 88, 89,
108026 /* 190 */ 90, 91, 92, 128, 104, 41, 106, 68, 69, 70,
108027 /* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108028 /* 210 */ 11, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108029 /* 220 */ 91, 92, 19, 19, 86, 87, 88, 89, 90, 91,
108030 /* 230 */ 92, 27, 96, 150, 66, 99, 100, 101, 112, 150,
108031 /* 240 */ 114, 115, 138, 150, 161, 162, 110, 103, 165, 222,
108032 /* 250 */ 223, 224, 49, 50, 165, 22, 57, 24, 165, 170,
108033 /* 260 */ 171, 118, 94, 170, 171, 23, 98, 25, 185, 186,
108034 /* 270 */ 243, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108035 /* 280 */ 77, 78, 79, 80, 126, 82, 83, 84, 85, 86,
108036 /* 290 */ 87, 88, 89, 90, 91, 92, 19, 129, 130, 131,
108037 /* 300 */ 88, 23, 172, 173, 105, 106, 107, 150, 22, 26,
108038 /* 310 */ 27, 181, 26, 27, 22, 116, 26, 27, 26, 230,
108039 /* 320 */ 231, 197, 165, 230, 231, 113, 49, 50, 204, 117,
108040 /* 330 */ 96, 174, 175, 99, 100, 101, 22, 26, 27, 136,
108041 /* 340 */ 26, 27, 118, 16, 110, 68, 69, 70, 71, 72,
108042 /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 118, 82,
108043 /* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108044 /* 370 */ 19, 214, 215, 150, 23, 23, 155, 94, 95, 22,
108045 /* 380 */ 94, 95, 116, 160, 94, 95, 94, 60, 165, 62,
108046 /* 390 */ 112, 26, 114, 115, 128, 23, 36, 174, 175, 88,
108047 /* 400 */ 49, 50, 57, 120, 22, 94, 95, 23, 94, 95,
108048 /* 410 */ 120, 51, 25, 136, 169, 170, 171, 194, 58, 68,
108049 /* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108050 /* 430 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88,
108051 /* 440 */ 89, 90, 91, 92, 19, 150, 12, 12, 23, 228,
108052 /* 450 */ 105, 106, 107, 23, 233, 25, 165, 19, 150, 94,
108053 /* 460 */ 165, 116, 28, 28, 112, 174, 114, 115, 108, 174,
108054 /* 470 */ 175, 26, 27, 165, 49, 50, 231, 11, 44, 44,
108055 /* 480 */ 46, 46, 174, 175, 112, 160, 114, 115, 50, 22,
108056 /* 490 */ 23, 57, 25, 68, 69, 70, 71, 72, 73, 74,
108057 /* 500 */ 75, 76, 77, 78, 79, 80, 119, 82, 83, 84,
108058 /* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 194,
108059 /* 520 */ 225, 23, 23, 215, 19, 95, 105, 106, 107, 150,
108060 /* 530 */ 23, 150, 27, 23, 67, 25, 150, 206, 207, 94,
108061 /* 540 */ 95, 166, 104, 218, 165, 22, 165, 109, 49, 50,
108062 /* 550 */ 120, 165, 25, 174, 175, 174, 175, 23, 21, 234,
108063 /* 560 */ 174, 175, 22, 23, 239, 25, 25, 68, 69, 70,
108064 /* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108065 /* 580 */ 205, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108066 /* 590 */ 91, 92, 19, 22, 23, 216, 23, 222, 223, 224,
108067 /* 600 */ 63, 220, 35, 150, 150, 163, 220, 67, 166, 167,
108068 /* 610 */ 168, 150, 169, 170, 171, 161, 162, 25, 165, 165,
108069 /* 620 */ 150, 113, 49, 50, 25, 117, 165, 174, 175, 35,
108070 /* 630 */ 7, 8, 9, 160, 160, 165, 120, 100, 67, 247,
108071 /* 640 */ 248, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108072 /* 650 */ 77, 78, 79, 80, 193, 82, 83, 84, 85, 86,
108073 /* 660 */ 87, 88, 89, 90, 91, 92, 19, 194, 194, 150,
108074 /* 670 */ 135, 24, 137, 35, 231, 138, 150, 129, 130, 206,
108075 /* 680 */ 207, 30, 27, 213, 165, 34, 118, 95, 0, 1,
108076 /* 690 */ 2, 165, 218, 174, 175, 50, 49, 50, 22, 48,
108077 /* 700 */ 174, 175, 22, 23, 23, 244, 222, 223, 224, 166,
108078 /* 710 */ 167, 168, 120, 239, 23, 68, 69, 70, 71, 72,
108079 /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
108080 /* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108081 /* 740 */ 19, 150, 173, 165, 181, 182, 24, 67, 26, 104,
108082 /* 750 */ 181, 188, 174, 175, 150, 39, 165, 150, 52, 150,
108083 /* 760 */ 150, 150, 150, 144, 145, 174, 175, 249, 250, 165,
108084 /* 770 */ 49, 50, 165, 52, 165, 165, 165, 165, 174, 175,
108085 /* 780 */ 29, 174, 175, 174, 175, 174, 175, 160, 22, 68,
108086 /* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108087 /* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88,
108088 /* 810 */ 89, 90, 91, 92, 19, 150, 94, 165, 150, 150,
108089 /* 820 */ 160, 194, 150, 213, 160, 52, 174, 175, 23, 23,
108090 /* 830 */ 165, 25, 22, 165, 165, 150, 150, 165, 52, 174,
108091 /* 840 */ 175, 22, 174, 175, 49, 50, 174, 175, 190, 191,
108092 /* 850 */ 165, 165, 240, 23, 194, 25, 187, 109, 194, 174,
108093 /* 860 */ 175, 190, 191, 68, 69, 70, 71, 72, 73, 74,
108094 /* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84,
108095 /* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150,
108096 /* 890 */ 22, 165, 150, 23, 150, 25, 150, 166, 91, 92,
108097 /* 900 */ 174, 175, 22, 217, 165, 150, 102, 165, 150, 165,
108098 /* 910 */ 150, 165, 150, 174, 175, 19, 174, 175, 49, 50,
108099 /* 920 */ 165, 86, 87, 165, 23, 165, 25, 165, 24, 174,
108100 /* 930 */ 175, 187, 174, 175, 174, 175, 205, 68, 69, 70,
108101 /* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108102 /* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108103 /* 960 */ 91, 92, 19, 150, 150, 165, 150, 150, 166, 23,
108104 /* 970 */ 150, 25, 160, 20, 174, 175, 1, 2, 165, 165,
108105 /* 980 */ 104, 165, 165, 43, 150, 165, 240, 150, 49, 50,
108106 /* 990 */ 174, 175, 49, 50, 23, 23, 25, 25, 53, 165,
108107 /* 1000 */ 187, 187, 165, 23, 187, 25, 194, 205, 174, 175,
108108 /* 1010 */ 71, 72, 69, 70, 71, 72, 73, 74, 75, 76,
108109 /* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
108110 /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 98, 150, 165,
108111 /* 1040 */ 150, 160, 150, 59, 25, 53, 104, 22, 174, 175,
108112 /* 1050 */ 213, 138, 5, 165, 1, 165, 150, 165, 150, 150,
108113 /* 1060 */ 240, 150, 174, 175, 174, 175, 49, 50, 118, 150,
108114 /* 1070 */ 35, 165, 27, 165, 165, 194, 165, 108, 127, 76,
108115 /* 1080 */ 174, 175, 174, 175, 165, 174, 175, 70, 71, 72,
108116 /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 166, 82,
108117 /* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108118 /* 1110 */ 19, 20, 193, 22, 150, 150, 150, 26, 27, 76,
108119 /* 1120 */ 150, 22, 1, 150, 119, 121, 217, 20, 37, 165,
108120 /* 1130 */ 165, 165, 16, 19, 20, 165, 22, 205, 165, 119,
108121 /* 1140 */ 26, 27, 108, 128, 150, 150, 150, 56, 150, 22,
108122 /* 1150 */ 150, 37, 150, 127, 160, 23, 150, 66, 193, 165,
108123 /* 1160 */ 165, 165, 16, 165, 23, 165, 150, 165, 174, 175,
108124 /* 1170 */ 56, 165, 150, 65, 174, 175, 15, 86, 87, 88,
108125 /* 1180 */ 66, 165, 140, 150, 93, 94, 95, 165, 194, 98,
108126 /* 1190 */ 174, 175, 22, 3, 164, 193, 174, 175, 165, 150,
108127 /* 1200 */ 86, 87, 4, 180, 150, 248, 251, 93, 94, 95,
108128 /* 1210 */ 216, 180, 98, 251, 165, 221, 150, 149, 6, 165,
108129 /* 1220 */ 129, 130, 131, 132, 133, 134, 193, 150, 174, 175,
108130 /* 1230 */ 116, 165, 19, 20, 150, 22, 149, 151, 150, 26,
108131 /* 1240 */ 27, 149, 165, 129, 130, 131, 132, 133, 134, 165,
108132 /* 1250 */ 37, 174, 175, 165, 149, 19, 20, 13, 22, 150,
108133 /* 1260 */ 150, 150, 26, 27, 146, 147, 151, 150, 25, 56,
108134 /* 1270 */ 152, 159, 154, 37, 165, 165, 165, 193, 160, 66,
108135 /* 1280 */ 116, 193, 165, 174, 175, 174, 175, 194, 199, 150,
108136 /* 1290 */ 200, 126, 56, 124, 123, 150, 201, 122, 150, 86,
108137 /* 1300 */ 87, 150, 66, 193, 165, 202, 93, 94, 95, 150,
108138 /* 1310 */ 165, 98, 194, 165, 125, 22, 165, 150, 150, 26,
108139 /* 1320 */ 27, 135, 86, 87, 165, 174, 175, 203, 226, 93,
108140 /* 1330 */ 94, 95, 165, 165, 98, 150, 218, 150, 193, 157,
108141 /* 1340 */ 118, 157, 129, 130, 131, 132, 133, 134, 5, 104,
108142 /* 1350 */ 165, 211, 165, 10, 11, 12, 13, 14, 150, 66,
108143 /* 1360 */ 17, 174, 175, 210, 246, 129, 130, 131, 132, 133,
108144 /* 1370 */ 134, 150, 210, 165, 31, 121, 33, 150, 150, 86,
108145 /* 1380 */ 87, 176, 174, 175, 150, 42, 165, 94, 211, 210,
108146 /* 1390 */ 150, 98, 165, 165, 211, 174, 175, 150, 55, 165,
108147 /* 1400 */ 57, 150, 174, 175, 61, 165, 150, 64, 174, 175,
108148 /* 1410 */ 150, 150, 165, 150, 174, 175, 165, 104, 150, 184,
108149 /* 1420 */ 150, 165, 129, 130, 131, 165, 165, 150, 165, 150,
108150 /* 1430 */ 150, 176, 150, 165, 47, 165, 150, 150, 176, 103,
108151 /* 1440 */ 150, 22, 165, 178, 165, 165, 179, 165, 105, 106,
108152 /* 1450 */ 107, 165, 165, 229, 111, 165, 92, 176, 229, 116,
108153 /* 1460 */ 184, 176, 179, 156, 176, 176, 18, 157, 156, 237,
108154 /* 1470 */ 45, 157, 156, 135, 157, 157, 238, 156, 68, 157,
108155 /* 1480 */ 189, 189, 139, 219, 22, 157, 18, 192, 192, 192,
108156 /* 1490 */ 192, 189, 219, 199, 157, 242, 40, 157, 199, 242,
108157 /* 1500 */ 153, 157, 38, 245, 196, 166, 232, 198, 177, 177,
108158 /* 1510 */ 232, 227, 209, 178, 166, 182, 166, 148, 177, 177,
108159 /* 1520 */ 209, 196, 177, 199, 209, 199, 166, 208, 92, 195,
108160 /* 1530 */ 174, 174, 183, 252, 183, 183, 252, 191, 252, 235,
108161 /* 1540 */ 186, 241, 241, 252, 186, 252, 252, 252, 252, 252,
108162 /* 1550 */ 252, 252, 252, 252, 252, 252, 236,
 
 
108163 };
108164 #define YY_SHIFT_USE_DFLT (-74)
108165 #define YY_SHIFT_COUNT (418)
108166 #define YY_SHIFT_MIN (-73)
108167 #define YY_SHIFT_MAX (1468)
108168 static const short yy_shift_ofst[] = {
108169 /* 0 */ 975, 1114, 1343, 1114, 1213, 1213, 90, 90, 0, -19,
108170 /* 10 */ 1213, 1213, 1213, 1213, 1213, 345, 445, 721, 1091, 1213,
108171 /* 20 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108172 /* 30 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108173 /* 40 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1236, 1213, 1213,
108174 /* 50 */ 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213, 1213,
108175 /* 60 */ 1213, 199, 445, 445, 835, 835, 365, 1164, 55, 647,
108176 /* 70 */ 573, 499, 425, 351, 277, 203, 129, 795, 795, 795,
108177 /* 80 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795,
108178 /* 90 */ 795, 795, 795, 795, 795, 869, 795, 943, 1017, 1017,
108179 /* 100 */ -69, -45, -45, -45, -45, -45, -1, 58, 138, 100,
108180 /* 110 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108181 /* 120 */ 445, 445, 445, 445, 445, 445, 537, 438, 445, 445,
108182 /* 130 */ 445, 445, 445, 365, 807, 1436, -74, -74, -74, 1293,
108183 /* 140 */ 73, 434, 434, 311, 314, 290, 283, 286, 540, 467,
108184 /* 150 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108185 /* 160 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108186 /* 170 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
108187 /* 180 */ 445, 445, 65, 722, 722, 722, 688, 266, 1164, 1164,
108188 /* 190 */ 1164, -74, -74, -74, 136, 168, 168, 234, 360, 360,
108189 /* 200 */ 360, 430, 372, 435, 352, 278, 126, -36, -36, -36,
108190 /* 210 */ -36, 421, 651, -36, -36, 592, 292, 212, 623, 158,
108191 /* 220 */ 204, 204, 505, 158, 505, 144, 365, 154, 365, 154,
108192 /* 230 */ 645, 154, 204, 154, 154, 535, 548, 548, 365, 387,
108193 /* 240 */ 508, 233, 1464, 1222, 1222, 1456, 1456, 1222, 1462, 1410,
108194 /* 250 */ 1165, 1468, 1468, 1468, 1468, 1222, 1165, 1462, 1410, 1410,
108195 /* 260 */ 1222, 1448, 1338, 1425, 1222, 1222, 1448, 1222, 1448, 1222,
108196 /* 270 */ 1448, 1419, 1313, 1313, 1313, 1387, 1364, 1364, 1419, 1313,
108197 /* 280 */ 1336, 1313, 1387, 1313, 1313, 1254, 1245, 1254, 1245, 1254,
108198 /* 290 */ 1245, 1222, 1222, 1186, 1189, 1175, 1169, 1171, 1165, 1164,
108199 /* 300 */ 1243, 1244, 1244, 1212, 1212, 1212, 1212, -74, -74, -74,
108200 /* 310 */ -74, -74, -74, 939, 104, 680, 571, 327, 1, 980,
108201 /* 320 */ 26, 972, 971, 946, 901, 870, 830, 806, 54, 21,
108202 /* 330 */ -73, 510, 242, 1198, 1190, 1170, 1042, 1161, 1108, 1146,
108203 /* 340 */ 1141, 1132, 1015, 1127, 1026, 1034, 1020, 1107, 1004, 1116,
108204 /* 350 */ 1121, 1005, 1099, 951, 1043, 1003, 969, 1045, 1035, 950,
108205 /* 360 */ 1053, 1047, 1025, 942, 913, 992, 1019, 945, 984, 940,
108206 /* 370 */ 876, 904, 953, 896, 748, 804, 880, 786, 868, 819,
108207 /* 380 */ 805, 810, 773, 751, 766, 706, 716, 691, 681, 568,
108208 /* 390 */ 655, 638, 676, 516, 541, 594, 599, 567, 541, 534,
108209 /* 400 */ 507, 527, 498, 523, 466, 382, 409, 384, 357, 6,
108210 /* 410 */ 240, 224, 143, 62, 18, 71, 39, 9, 5,
108211 };
108212 #define YY_REDUCE_USE_DFLT (-142)
108213 #define YY_REDUCE_COUNT (312)
108214 #define YY_REDUCE_MIN (-141)
108215 #define YY_REDUCE_MAX (1369)
108216 static const short yy_reduce_ofst[] = {
108217 /* 0 */ -141, 994, 1118, 223, 157, -53, 93, 89, 83, 375,
108218 /* 10 */ 386, 381, 379, 308, 295, 325, -47, 27, 1240, 1234,
108219 /* 20 */ 1228, 1221, 1208, 1187, 1151, 1111, 1109, 1077, 1054, 1022,
108220 /* 30 */ 1016, 1000, 911, 908, 906, 890, 888, 874, 834, 816,
108221 /* 40 */ 800, 760, 758, 755, 742, 739, 726, 685, 672, 668,
108222 /* 50 */ 665, 652, 611, 609, 607, 604, 591, 578, 526, 519,
108223 /* 60 */ 453, 474, 454, 461, 443, 245, 442, 473, 484, 484,
108224 /* 70 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108225 /* 80 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108226 /* 90 */ 484, 484, 484, 484, 484, 484, 484, 484, 484, 484,
108227 /* 100 */ 484, 484, 484, 484, 484, 484, 484, 130, 484, 484,
108228 /* 110 */ 1145, 909, 1110, 1088, 1084, 1033, 1002, 965, 820, 837,
108229 /* 120 */ 746, 686, 612, 817, 610, 919, 221, 563, 814, 813,
108230 /* 130 */ 744, 669, 470, 543, 484, 484, 484, 484, 484, 291,
108231 /* 140 */ 569, 671, 658, 970, 1290, 1287, 1286, 1282, 518, 518,
108232 /* 150 */ 1280, 1279, 1277, 1270, 1268, 1263, 1261, 1260, 1256, 1251,
108233 /* 160 */ 1247, 1227, 1185, 1168, 1167, 1159, 1148, 1139, 1117, 1066,
108234 /* 170 */ 1049, 1006, 998, 996, 995, 973, 970, 966, 964, 892,
108235 /* 180 */ 762, -52, 881, 932, 802, 731, 619, 812, 664, 660,
108236 /* 190 */ 627, 392, 331, 124, 1358, 1357, 1356, 1354, 1352, 1351,
108237 /* 200 */ 1349, 1319, 1334, 1346, 1334, 1334, 1334, 1334, 1334, 1334,
108238 /* 210 */ 1334, 1320, 1304, 1334, 1334, 1319, 1360, 1325, 1369, 1326,
108239 /* 220 */ 1315, 1311, 1301, 1324, 1300, 1335, 1350, 1345, 1348, 1342,
108240 /* 230 */ 1333, 1341, 1303, 1332, 1331, 1284, 1278, 1274, 1339, 1309,
108241 /* 240 */ 1308, 1347, 1258, 1344, 1340, 1257, 1253, 1337, 1273, 1302,
108242 /* 250 */ 1299, 1298, 1297, 1296, 1295, 1328, 1294, 1264, 1292, 1291,
108243 /* 260 */ 1322, 1321, 1238, 1232, 1318, 1317, 1316, 1314, 1312, 1310,
108244 /* 270 */ 1307, 1283, 1289, 1288, 1285, 1276, 1229, 1224, 1267, 1281,
108245 /* 280 */ 1265, 1262, 1235, 1255, 1205, 1183, 1179, 1177, 1162, 1140,
108246 /* 290 */ 1153, 1184, 1182, 1102, 1124, 1103, 1095, 1090, 1089, 1093,
108247 /* 300 */ 1112, 1115, 1086, 1105, 1092, 1087, 1068, 962, 955, 957,
108248 /* 310 */ 1031, 1023, 1030,
108249 };
108250 static const YYACTIONTYPE yy_default[] = {
108251 /* 0 */ 635, 870, 959, 959, 959, 870, 899, 899, 959, 759,
108252 /* 10 */ 959, 959, 959, 959, 868, 959, 959, 933, 959, 959,
108253 /* 20 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108254 /* 30 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108255 /* 40 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108256 /* 50 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108257 /* 60 */ 959, 959, 959, 959, 899, 899, 674, 763, 794, 959,
108258 /* 70 */ 959, 959, 959, 959, 959, 959, 959, 932, 934, 809,
108259 /* 80 */ 808, 802, 801, 912, 774, 799, 792, 785, 796, 871,
108260 /* 90 */ 864, 865, 863, 867, 872, 959, 795, 831, 848, 830,
108261 /* 100 */ 842, 847, 854, 846, 843, 833, 832, 666, 834, 835,
108262 /* 110 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108263 /* 120 */ 959, 959, 959, 959, 959, 959, 661, 728, 959, 959,
108264 /* 130 */ 959, 959, 959, 959, 836, 837, 851, 850, 849, 959,
108265 /* 140 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108266 /* 150 */ 959, 939, 937, 959, 883, 959, 959, 959, 959, 959,
108267 /* 160 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108268 /* 170 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108269 /* 180 */ 959, 641, 959, 759, 759, 759, 635, 959, 959, 959,
108270 /* 190 */ 959, 951, 763, 753, 719, 959, 959, 959, 959, 959,
108271 /* 200 */ 959, 959, 959, 959, 959, 959, 959, 804, 742, 922,
108272 /* 210 */ 924, 959, 905, 740, 663, 761, 676, 751, 643, 798,
108273 /* 220 */ 776, 776, 917, 798, 917, 700, 959, 788, 959, 788,
108274 /* 230 */ 697, 788, 776, 788, 788, 866, 959, 959, 959, 760,
108275 /* 240 */ 751, 959, 944, 767, 767, 936, 936, 767, 810, 732,
108276 /* 250 */ 798, 739, 739, 739, 739, 767, 798, 810, 732, 732,
108277 /* 260 */ 767, 658, 911, 909, 767, 767, 658, 767, 658, 767,
108278 /* 270 */ 658, 876, 730, 730, 730, 715, 880, 880, 876, 730,
108279 /* 280 */ 700, 730, 715, 730, 730, 780, 775, 780, 775, 780,
108280 /* 290 */ 775, 767, 767, 959, 793, 781, 791, 789, 798, 959,
108281 /* 300 */ 718, 651, 651, 640, 640, 640, 640, 956, 956, 951,
108282 /* 310 */ 702, 702, 684, 959, 959, 959, 959, 959, 959, 959,
108283 /* 320 */ 885, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108284 /* 330 */ 959, 959, 959, 959, 636, 946, 959, 959, 943, 959,
108285 /* 340 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108286 /* 350 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 915,
108287 /* 360 */ 959, 959, 959, 959, 959, 959, 908, 907, 959, 959,
108288 /* 370 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108289 /* 380 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 959,
108290 /* 390 */ 959, 959, 959, 959, 790, 959, 782, 959, 869, 959,
108291 /* 400 */ 959, 959, 959, 959, 959, 959, 959, 959, 959, 745,
108292 /* 410 */ 819, 959, 818, 822, 817, 668, 959, 649, 959, 632,
108293 /* 420 */ 637, 955, 958, 957, 954, 953, 952, 947, 945, 942,
108294 /* 430 */ 941, 940, 938, 935, 931, 889, 887, 894, 893, 892,
108295 /* 440 */ 891, 890, 888, 886, 884, 805, 803, 800, 797, 930,
108296 /* 450 */ 882, 741, 738, 737, 657, 948, 914, 923, 921, 811,
108297 /* 460 */ 920, 919, 918, 916, 913, 900, 807, 806, 733, 874,
108298 /* 470 */ 873, 660, 904, 903, 902, 906, 910, 901, 769, 659,
108299 /* 480 */ 656, 665, 722, 721, 729, 727, 726, 725, 724, 723,
108300 /* 490 */ 720, 667, 675, 686, 714, 699, 698, 879, 881, 878,
108301 /* 500 */ 877, 707, 706, 712, 711, 710, 709, 708, 705, 704,
108302 /* 510 */ 703, 696, 695, 701, 694, 717, 716, 713, 693, 736,
108303 /* 520 */ 735, 734, 731, 692, 691, 690, 822, 689, 688, 828,
108304 /* 530 */ 827, 815, 858, 756, 755, 754, 766, 765, 778, 777,
108305 /* 540 */ 813, 812, 779, 764, 758, 757, 773, 772, 771, 770,
108306 /* 550 */ 762, 752, 784, 787, 786, 783, 860, 768, 857, 929,
108307 /* 560 */ 928, 927, 926, 925, 862, 861, 829, 826, 679, 680,
108308 /* 570 */ 898, 896, 897, 895, 682, 681, 678, 677, 859, 747,
108309 /* 580 */ 746, 855, 852, 844, 840, 856, 853, 845, 841, 839,
108310 /* 590 */ 838, 824, 823, 821, 820, 816, 825, 670, 748, 744,
108311 /* 600 */ 743, 814, 750, 749, 687, 685, 683, 664, 662, 655,
108312 /* 610 */ 653, 652, 654, 650, 648, 647, 646, 645, 644, 673,
108313 /* 620 */ 672, 671, 669, 668, 642, 639, 638, 634, 633, 631,
108314 };
108315
108316 /* The next table maps tokens into fallback tokens. If a construct
108317 ** like the following:
108318 **
@@ -108521,20 +108591,20 @@
108521 "ifexists", "fullname", "oneselect", "multiselect_op",
108522 "distinct", "selcollist", "from", "where_opt",
108523 "groupby_opt", "having_opt", "orderby_opt", "limit_opt",
108524 "sclp", "as", "seltablist", "stl_prefix",
108525 "joinop", "indexed_opt", "on_opt", "using_opt",
108526 "joinop2", "inscollist", "sortlist", "sortitem",
108527 "nexprlist", "setlist", "insert_cmd", "inscollist_opt",
108528 "itemlist", "exprlist", "likeop", "between_op",
108529 "in_op", "case_operand", "case_exprlist", "case_else",
108530 "uniqueflag", "collate", "nmnum", "plus_opt",
108531 "number", "trigger_decl", "trigger_cmd_list", "trigger_time",
108532 "trigger_event", "foreach_clause", "when_clause", "trigger_cmd",
108533 "trnm", "tridxby", "database_kw_opt", "key_opt",
108534 "add_column_fullname", "kwcolumn_opt", "create_vtab", "vtabarglist",
108535 "vtabarg", "vtabargtoken", "lp", "anylist",
108536 };
108537 #endif /* NDEBUG */
108538
108539 #ifndef NDEBUG
108540 /* For tracing reduce actions, the names of all rules are required.
@@ -108691,186 +108761,184 @@
108691 /* 148 */ "indexed_opt ::= NOT INDEXED",
108692 /* 149 */ "using_opt ::= USING LP inscollist RP",
108693 /* 150 */ "using_opt ::=",
108694 /* 151 */ "orderby_opt ::=",
108695 /* 152 */ "orderby_opt ::= ORDER BY sortlist",
108696 /* 153 */ "sortlist ::= sortlist COMMA sortitem sortorder",
108697 /* 154 */ "sortlist ::= sortitem sortorder",
108698 /* 155 */ "sortitem ::= expr",
108699 /* 156 */ "sortorder ::= ASC",
108700 /* 157 */ "sortorder ::= DESC",
108701 /* 158 */ "sortorder ::=",
108702 /* 159 */ "groupby_opt ::=",
108703 /* 160 */ "groupby_opt ::= GROUP BY nexprlist",
108704 /* 161 */ "having_opt ::=",
108705 /* 162 */ "having_opt ::= HAVING expr",
108706 /* 163 */ "limit_opt ::=",
108707 /* 164 */ "limit_opt ::= LIMIT expr",
108708 /* 165 */ "limit_opt ::= LIMIT expr OFFSET expr",
108709 /* 166 */ "limit_opt ::= LIMIT expr COMMA expr",
108710 /* 167 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt",
108711 /* 168 */ "where_opt ::=",
108712 /* 169 */ "where_opt ::= WHERE expr",
108713 /* 170 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt",
108714 /* 171 */ "setlist ::= setlist COMMA nm EQ expr",
108715 /* 172 */ "setlist ::= nm EQ expr",
108716 /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
108717 /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
108718 /* 175 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
108719 /* 176 */ "insert_cmd ::= INSERT orconf",
108720 /* 177 */ "insert_cmd ::= REPLACE",
108721 /* 178 */ "itemlist ::= itemlist COMMA expr",
108722 /* 179 */ "itemlist ::= expr",
108723 /* 180 */ "inscollist_opt ::=",
108724 /* 181 */ "inscollist_opt ::= LP inscollist RP",
108725 /* 182 */ "inscollist ::= inscollist COMMA nm",
108726 /* 183 */ "inscollist ::= nm",
108727 /* 184 */ "expr ::= term",
108728 /* 185 */ "expr ::= LP expr RP",
108729 /* 186 */ "term ::= NULL",
108730 /* 187 */ "expr ::= id",
108731 /* 188 */ "expr ::= JOIN_KW",
108732 /* 189 */ "expr ::= nm DOT nm",
108733 /* 190 */ "expr ::= nm DOT nm DOT nm",
108734 /* 191 */ "term ::= INTEGER|FLOAT|BLOB",
108735 /* 192 */ "term ::= STRING",
108736 /* 193 */ "expr ::= REGISTER",
108737 /* 194 */ "expr ::= VARIABLE",
108738 /* 195 */ "expr ::= expr COLLATE ids",
108739 /* 196 */ "expr ::= CAST LP expr AS typetoken RP",
108740 /* 197 */ "expr ::= ID LP distinct exprlist RP",
108741 /* 198 */ "expr ::= ID LP STAR RP",
108742 /* 199 */ "term ::= CTIME_KW",
108743 /* 200 */ "expr ::= expr AND expr",
108744 /* 201 */ "expr ::= expr OR expr",
108745 /* 202 */ "expr ::= expr LT|GT|GE|LE expr",
108746 /* 203 */ "expr ::= expr EQ|NE expr",
108747 /* 204 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
108748 /* 205 */ "expr ::= expr PLUS|MINUS expr",
108749 /* 206 */ "expr ::= expr STAR|SLASH|REM expr",
108750 /* 207 */ "expr ::= expr CONCAT expr",
108751 /* 208 */ "likeop ::= LIKE_KW",
108752 /* 209 */ "likeop ::= NOT LIKE_KW",
108753 /* 210 */ "likeop ::= MATCH",
108754 /* 211 */ "likeop ::= NOT MATCH",
108755 /* 212 */ "expr ::= expr likeop expr",
108756 /* 213 */ "expr ::= expr likeop expr ESCAPE expr",
108757 /* 214 */ "expr ::= expr ISNULL|NOTNULL",
108758 /* 215 */ "expr ::= expr NOT NULL",
108759 /* 216 */ "expr ::= expr IS expr",
108760 /* 217 */ "expr ::= expr IS NOT expr",
108761 /* 218 */ "expr ::= NOT expr",
108762 /* 219 */ "expr ::= BITNOT expr",
108763 /* 220 */ "expr ::= MINUS expr",
108764 /* 221 */ "expr ::= PLUS expr",
108765 /* 222 */ "between_op ::= BETWEEN",
108766 /* 223 */ "between_op ::= NOT BETWEEN",
108767 /* 224 */ "expr ::= expr between_op expr AND expr",
108768 /* 225 */ "in_op ::= IN",
108769 /* 226 */ "in_op ::= NOT IN",
108770 /* 227 */ "expr ::= expr in_op LP exprlist RP",
108771 /* 228 */ "expr ::= LP select RP",
108772 /* 229 */ "expr ::= expr in_op LP select RP",
108773 /* 230 */ "expr ::= expr in_op nm dbnm",
108774 /* 231 */ "expr ::= EXISTS LP select RP",
108775 /* 232 */ "expr ::= CASE case_operand case_exprlist case_else END",
108776 /* 233 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
108777 /* 234 */ "case_exprlist ::= WHEN expr THEN expr",
108778 /* 235 */ "case_else ::= ELSE expr",
108779 /* 236 */ "case_else ::=",
108780 /* 237 */ "case_operand ::= expr",
108781 /* 238 */ "case_operand ::=",
108782 /* 239 */ "exprlist ::= nexprlist",
108783 /* 240 */ "exprlist ::=",
108784 /* 241 */ "nexprlist ::= nexprlist COMMA expr",
108785 /* 242 */ "nexprlist ::= expr",
108786 /* 243 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
108787 /* 244 */ "uniqueflag ::= UNIQUE",
108788 /* 245 */ "uniqueflag ::=",
108789 /* 246 */ "idxlist_opt ::=",
108790 /* 247 */ "idxlist_opt ::= LP idxlist RP",
108791 /* 248 */ "idxlist ::= idxlist COMMA nm collate sortorder",
108792 /* 249 */ "idxlist ::= nm collate sortorder",
108793 /* 250 */ "collate ::=",
108794 /* 251 */ "collate ::= COLLATE ids",
108795 /* 252 */ "cmd ::= DROP INDEX ifexists fullname",
108796 /* 253 */ "cmd ::= VACUUM",
108797 /* 254 */ "cmd ::= VACUUM nm",
108798 /* 255 */ "cmd ::= PRAGMA nm dbnm",
108799 /* 256 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
108800 /* 257 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
108801 /* 258 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
108802 /* 259 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
108803 /* 260 */ "nmnum ::= plus_num",
108804 /* 261 */ "nmnum ::= nm",
108805 /* 262 */ "nmnum ::= ON",
108806 /* 263 */ "nmnum ::= DELETE",
108807 /* 264 */ "nmnum ::= DEFAULT",
108808 /* 265 */ "plus_num ::= plus_opt number",
108809 /* 266 */ "minus_num ::= MINUS number",
108810 /* 267 */ "number ::= INTEGER|FLOAT",
108811 /* 268 */ "plus_opt ::= PLUS",
108812 /* 269 */ "plus_opt ::=",
108813 /* 270 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
108814 /* 271 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
108815 /* 272 */ "trigger_time ::= BEFORE",
108816 /* 273 */ "trigger_time ::= AFTER",
108817 /* 274 */ "trigger_time ::= INSTEAD OF",
108818 /* 275 */ "trigger_time ::=",
108819 /* 276 */ "trigger_event ::= DELETE|INSERT",
108820 /* 277 */ "trigger_event ::= UPDATE",
108821 /* 278 */ "trigger_event ::= UPDATE OF inscollist",
108822 /* 279 */ "foreach_clause ::=",
108823 /* 280 */ "foreach_clause ::= FOR EACH ROW",
108824 /* 281 */ "when_clause ::=",
108825 /* 282 */ "when_clause ::= WHEN expr",
108826 /* 283 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
108827 /* 284 */ "trigger_cmd_list ::= trigger_cmd SEMI",
108828 /* 285 */ "trnm ::= nm",
108829 /* 286 */ "trnm ::= nm DOT nm",
108830 /* 287 */ "tridxby ::=",
108831 /* 288 */ "tridxby ::= INDEXED BY nm",
108832 /* 289 */ "tridxby ::= NOT INDEXED",
108833 /* 290 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
108834 /* 291 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP",
108835 /* 292 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select",
108836 /* 293 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
108837 /* 294 */ "trigger_cmd ::= select",
108838 /* 295 */ "expr ::= RAISE LP IGNORE RP",
108839 /* 296 */ "expr ::= RAISE LP raisetype COMMA nm RP",
108840 /* 297 */ "raisetype ::= ROLLBACK",
108841 /* 298 */ "raisetype ::= ABORT",
108842 /* 299 */ "raisetype ::= FAIL",
108843 /* 300 */ "cmd ::= DROP TRIGGER ifexists fullname",
108844 /* 301 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
108845 /* 302 */ "cmd ::= DETACH database_kw_opt expr",
108846 /* 303 */ "key_opt ::=",
108847 /* 304 */ "key_opt ::= KEY expr",
108848 /* 305 */ "database_kw_opt ::= DATABASE",
108849 /* 306 */ "database_kw_opt ::=",
108850 /* 307 */ "cmd ::= REINDEX",
108851 /* 308 */ "cmd ::= REINDEX nm dbnm",
108852 /* 309 */ "cmd ::= ANALYZE",
108853 /* 310 */ "cmd ::= ANALYZE nm dbnm",
108854 /* 311 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
108855 /* 312 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
108856 /* 313 */ "add_column_fullname ::= fullname",
108857 /* 314 */ "kwcolumn_opt ::=",
108858 /* 315 */ "kwcolumn_opt ::= COLUMNKW",
108859 /* 316 */ "cmd ::= create_vtab",
108860 /* 317 */ "cmd ::= create_vtab LP vtabarglist RP",
108861 /* 318 */ "create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm",
108862 /* 319 */ "vtabarglist ::= vtabarg",
108863 /* 320 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
108864 /* 321 */ "vtabarg ::=",
108865 /* 322 */ "vtabarg ::= vtabarg vtabargtoken",
108866 /* 323 */ "vtabargtoken ::= ANY",
108867 /* 324 */ "vtabargtoken ::= lp anylist RP",
108868 /* 325 */ "lp ::= LP",
108869 /* 326 */ "anylist ::=",
108870 /* 327 */ "anylist ::= anylist LP anylist RP",
108871 /* 328 */ "anylist ::= anylist ANY",
108872 };
108873 #endif /* NDEBUG */
108874
108875
108876 #if YYSTACKDEPTH<=0
@@ -108948,71 +109016,77 @@
108948 ** inside the C code.
108949 */
108950 case 160: /* select */
108951 case 194: /* oneselect */
108952 {
108953 sqlite3SelectDelete(pParse->db, (yypminor->yy387));
108954 }
108955 break;
108956 case 174: /* term */
108957 case 175: /* expr */
108958 {
108959 sqlite3ExprDelete(pParse->db, (yypminor->yy118).pExpr);
108960 }
108961 break;
108962 case 179: /* idxlist_opt */
108963 case 187: /* idxlist */
108964 case 197: /* selcollist */
108965 case 200: /* groupby_opt */
108966 case 202: /* orderby_opt */
108967 case 204: /* sclp */
108968 case 214: /* sortlist */
108969 case 216: /* nexprlist */
108970 case 217: /* setlist */
108971 case 220: /* itemlist */
108972 case 221: /* exprlist */
108973 case 226: /* case_exprlist */
108974 {
108975 sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
108976 }
108977 break;
108978 case 193: /* fullname */
108979 case 198: /* from */
108980 case 206: /* seltablist */
108981 case 207: /* stl_prefix */
108982 {
108983 sqlite3SrcListDelete(pParse->db, (yypminor->yy259));
108984 }
108985 break;
108986 case 199: /* where_opt */
108987 case 201: /* having_opt */
108988 case 210: /* on_opt */
108989 case 215: /* sortitem */
108990 case 225: /* case_operand */
108991 case 227: /* case_else */
108992 case 238: /* when_clause */
108993 case 243: /* key_opt */
108994 {
108995 sqlite3ExprDelete(pParse->db, (yypminor->yy314));
108996 }
108997 break;
108998 case 211: /* using_opt */
108999 case 213: /* inscollist */
109000 case 219: /* inscollist_opt */
109001 {
109002 sqlite3IdListDelete(pParse->db, (yypminor->yy384));
 
 
 
 
 
 
 
 
109003 }
109004 break;
109005 case 234: /* trigger_cmd_list */
109006 case 239: /* trigger_cmd */
109007 {
109008 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy203));
109009 }
109010 break;
109011 case 236: /* trigger_event */
109012 {
109013 sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
109014 }
109015 break;
109016 default: break; /* If no destructor action specified: do nothing */
109017 }
109018 }
@@ -109408,11 +109482,10 @@
109408 { 211, 0 },
109409 { 202, 0 },
109410 { 202, 3 },
109411 { 214, 4 },
109412 { 214, 2 },
109413 { 215, 1 },
109414 { 177, 1 },
109415 { 177, 1 },
109416 { 177, 0 },
109417 { 200, 0 },
109418 { 200, 3 },
@@ -109424,21 +109497,21 @@
109424 { 203, 4 },
109425 { 147, 5 },
109426 { 199, 0 },
109427 { 199, 2 },
109428 { 147, 7 },
109429 { 217, 5 },
109430 { 217, 3 },
109431 { 147, 8 },
109432 { 147, 5 },
109433 { 147, 6 },
109434 { 218, 2 },
109435 { 218, 1 },
109436 { 220, 3 },
109437 { 220, 1 },
109438 { 219, 0 },
109439 { 219, 3 },
109440 { 213, 3 },
109441 { 213, 1 },
109442 { 175, 1 },
109443 { 175, 3 },
109444 { 174, 1 },
@@ -109461,14 +109534,14 @@
109461 { 175, 3 },
109462 { 175, 3 },
109463 { 175, 3 },
109464 { 175, 3 },
109465 { 175, 3 },
109466 { 222, 1 },
109467 { 222, 2 },
109468 { 222, 1 },
109469 { 222, 2 },
109470 { 175, 3 },
109471 { 175, 5 },
109472 { 175, 2 },
109473 { 175, 3 },
109474 { 175, 3 },
@@ -109475,117 +109548,116 @@
109475 { 175, 4 },
109476 { 175, 2 },
109477 { 175, 2 },
109478 { 175, 2 },
109479 { 175, 2 },
 
 
 
109480 { 223, 1 },
109481 { 223, 2 },
109482 { 175, 5 },
109483 { 224, 1 },
109484 { 224, 2 },
109485 { 175, 5 },
109486 { 175, 3 },
109487 { 175, 5 },
109488 { 175, 4 },
109489 { 175, 4 },
109490 { 175, 5 },
109491 { 226, 5 },
109492 { 226, 4 },
109493 { 227, 2 },
109494 { 227, 0 },
109495 { 225, 1 },
109496 { 225, 0 },
109497 { 221, 1 },
109498 { 221, 0 },
109499 { 216, 3 },
109500 { 216, 1 },
109501 { 147, 11 },
109502 { 228, 1 },
109503 { 228, 0 },
109504 { 179, 0 },
109505 { 179, 3 },
109506 { 187, 5 },
109507 { 187, 3 },
109508 { 229, 0 },
109509 { 229, 2 },
109510 { 147, 4 },
109511 { 147, 1 },
109512 { 147, 2 },
109513 { 147, 3 },
109514 { 147, 5 },
109515 { 147, 6 },
109516 { 147, 5 },
109517 { 147, 6 },
109518 { 230, 1 },
109519 { 230, 1 },
109520 { 230, 1 },
109521 { 230, 1 },
109522 { 230, 1 },
109523 { 170, 2 },
 
109524 { 171, 2 },
109525 { 232, 1 },
109526 { 231, 1 },
109527 { 231, 0 },
109528 { 147, 5 },
109529 { 233, 11 },
109530 { 235, 1 },
109531 { 235, 1 },
109532 { 235, 2 },
 
 
 
 
109533 { 235, 0 },
109534 { 236, 1 },
109535 { 236, 1 },
109536 { 236, 3 },
109537 { 237, 0 },
109538 { 237, 3 },
109539 { 238, 0 },
109540 { 238, 2 },
109541 { 234, 3 },
109542 { 234, 2 },
109543 { 240, 1 },
109544 { 240, 3 },
109545 { 241, 0 },
109546 { 241, 3 },
109547 { 241, 2 },
109548 { 239, 7 },
109549 { 239, 8 },
109550 { 239, 5 },
109551 { 239, 5 },
109552 { 239, 1 },
109553 { 175, 4 },
109554 { 175, 6 },
109555 { 191, 1 },
109556 { 191, 1 },
109557 { 191, 1 },
109558 { 147, 4 },
109559 { 147, 6 },
109560 { 147, 3 },
109561 { 243, 0 },
109562 { 243, 2 },
109563 { 242, 1 },
109564 { 242, 0 },
109565 { 147, 1 },
109566 { 147, 3 },
109567 { 147, 1 },
109568 { 147, 3 },
109569 { 147, 6 },
109570 { 147, 6 },
109571 { 244, 1 },
109572 { 245, 0 },
109573 { 245, 1 },
109574 { 147, 1 },
109575 { 147, 4 },
109576 { 246, 7 },
 
 
 
 
109577 { 247, 1 },
109578 { 247, 3 },
109579 { 248, 0 },
109580 { 248, 2 },
109581 { 249, 1 },
109582 { 249, 3 },
109583 { 250, 1 },
109584 { 251, 0 },
109585 { 251, 4 },
109586 { 251, 2 },
109587 };
109588
109589 static void yy_accept(yyParser*); /* Forward Declaration */
109590
109591 /*
@@ -109649,21 +109721,21 @@
109649 break;
109650 case 8: /* cmdx ::= cmd */
109651 { sqlite3FinishCoding(pParse); }
109652 break;
109653 case 9: /* cmd ::= BEGIN transtype trans_opt */
109654 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy4);}
109655 break;
109656 case 13: /* transtype ::= */
109657 {yygotominor.yy4 = TK_DEFERRED;}
109658 break;
109659 case 14: /* transtype ::= DEFERRED */
109660 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
109661 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
109662 case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
109663 case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
109664 {yygotominor.yy4 = yymsp[0].major;}
109665 break;
109666 case 17: /* cmd ::= COMMIT trans_opt */
109667 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
109668 {sqlite3CommitTransaction(pParse);}
109669 break;
@@ -109685,11 +109757,11 @@
109685 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
109686 }
109687 break;
109688 case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
109689 {
109690 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy4,0,0,yymsp[-2].minor.yy4);
109691 }
109692 break;
109693 case 27: /* createkw ::= CREATE */
109694 {
109695 pParse->db->lookaside.bEnabled = 0;
@@ -109704,33 +109776,33 @@
109704 case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==87);
109705 case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98);
109706 case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
109707 case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
109708 case 121: /* distinct ::= */ yytestcase(yyruleno==121);
109709 case 222: /* between_op ::= BETWEEN */ yytestcase(yyruleno==222);
109710 case 225: /* in_op ::= IN */ yytestcase(yyruleno==225);
109711 {yygotominor.yy4 = 0;}
109712 break;
109713 case 29: /* ifnotexists ::= IF NOT EXISTS */
109714 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
109715 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
109716 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
109717 case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
109718 case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
109719 case 223: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==223);
109720 case 226: /* in_op ::= NOT IN */ yytestcase(yyruleno==226);
109721 {yygotominor.yy4 = 1;}
109722 break;
109723 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
109724 {
109725 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
109726 }
109727 break;
109728 case 33: /* create_table_args ::= AS select */
109729 {
109730 sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy387);
109731 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
109732 }
109733 break;
109734 case 36: /* column ::= columnid type carglist */
109735 {
109736 yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
@@ -109753,20 +109825,21 @@
109753 case 49: /* typename ::= ids */ yytestcase(yyruleno==49);
109754 case 127: /* as ::= AS nm */ yytestcase(yyruleno==127);
109755 case 128: /* as ::= ids */ yytestcase(yyruleno==128);
109756 case 138: /* dbnm ::= DOT nm */ yytestcase(yyruleno==138);
109757 case 147: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==147);
109758 case 251: /* collate ::= COLLATE ids */ yytestcase(yyruleno==251);
109759 case 260: /* nmnum ::= plus_num */ yytestcase(yyruleno==260);
109760 case 261: /* nmnum ::= nm */ yytestcase(yyruleno==261);
109761 case 262: /* nmnum ::= ON */ yytestcase(yyruleno==262);
109762 case 263: /* nmnum ::= DELETE */ yytestcase(yyruleno==263);
109763 case 264: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==264);
109764 case 265: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==265);
 
109765 case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
109766 case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
109767 case 285: /* trnm ::= nm */ yytestcase(yyruleno==285);
109768 {yygotominor.yy0 = yymsp[0].minor.yy0;}
109769 break;
109770 case 45: /* type ::= typetoken */
109771 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
109772 break;
@@ -109785,21 +109858,21 @@
109785 case 50: /* typename ::= typename ids */
109786 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
109787 break;
109788 case 57: /* ccons ::= DEFAULT term */
109789 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
109790 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy118);}
109791 break;
109792 case 58: /* ccons ::= DEFAULT LP expr RP */
109793 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy118);}
109794 break;
109795 case 60: /* ccons ::= DEFAULT MINUS term */
109796 {
109797 ExprSpan v;
109798 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy118.pExpr, 0, 0);
109799 v.zStart = yymsp[-1].minor.yy0.z;
109800 v.zEnd = yymsp[0].minor.yy118.zEnd;
109801 sqlite3AddDefaultValue(pParse,&v);
109802 }
109803 break;
109804 case 61: /* ccons ::= DEFAULT id */
109805 {
@@ -109807,897 +109880,921 @@
109807 spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
109808 sqlite3AddDefaultValue(pParse,&v);
109809 }
109810 break;
109811 case 63: /* ccons ::= NOT NULL onconf */
109812 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy4);}
109813 break;
109814 case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
109815 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy4,yymsp[0].minor.yy4,yymsp[-2].minor.yy4);}
109816 break;
109817 case 65: /* ccons ::= UNIQUE onconf */
109818 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy4,0,0,0,0);}
109819 break;
109820 case 66: /* ccons ::= CHECK LP expr RP */
109821 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy118.pExpr);}
109822 break;
109823 case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
109824 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy4);}
109825 break;
109826 case 68: /* ccons ::= defer_subclause */
109827 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy4);}
109828 break;
109829 case 69: /* ccons ::= COLLATE ids */
109830 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
109831 break;
109832 case 72: /* refargs ::= */
109833 { yygotominor.yy4 = OE_None*0x0101; /* EV: R-19803-45884 */}
109834 break;
109835 case 73: /* refargs ::= refargs refarg */
109836 { yygotominor.yy4 = (yymsp[-1].minor.yy4 & ~yymsp[0].minor.yy215.mask) | yymsp[0].minor.yy215.value; }
109837 break;
109838 case 74: /* refarg ::= MATCH nm */
109839 case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
109840 { yygotominor.yy215.value = 0; yygotominor.yy215.mask = 0x000000; }
109841 break;
109842 case 76: /* refarg ::= ON DELETE refact */
109843 { yygotominor.yy215.value = yymsp[0].minor.yy4; yygotominor.yy215.mask = 0x0000ff; }
109844 break;
109845 case 77: /* refarg ::= ON UPDATE refact */
109846 { yygotominor.yy215.value = yymsp[0].minor.yy4<<8; yygotominor.yy215.mask = 0x00ff00; }
109847 break;
109848 case 78: /* refact ::= SET NULL */
109849 { yygotominor.yy4 = OE_SetNull; /* EV: R-33326-45252 */}
109850 break;
109851 case 79: /* refact ::= SET DEFAULT */
109852 { yygotominor.yy4 = OE_SetDflt; /* EV: R-33326-45252 */}
109853 break;
109854 case 80: /* refact ::= CASCADE */
109855 { yygotominor.yy4 = OE_Cascade; /* EV: R-33326-45252 */}
109856 break;
109857 case 81: /* refact ::= RESTRICT */
109858 { yygotominor.yy4 = OE_Restrict; /* EV: R-33326-45252 */}
109859 break;
109860 case 82: /* refact ::= NO ACTION */
109861 { yygotominor.yy4 = OE_None; /* EV: R-33326-45252 */}
109862 break;
109863 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
109864 case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
109865 case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
109866 case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
109867 {yygotominor.yy4 = yymsp[0].minor.yy4;}
109868 break;
109869 case 88: /* conslist_opt ::= */
109870 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
109871 break;
109872 case 89: /* conslist_opt ::= COMMA conslist */
109873 {yygotominor.yy0 = yymsp[-1].minor.yy0;}
109874 break;
109875 case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
109876 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy4,yymsp[-2].minor.yy4,0);}
109877 break;
109878 case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
109879 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy4,0,0,0,0);}
109880 break;
109881 case 96: /* tcons ::= CHECK LP expr RP onconf */
109882 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy118.pExpr);}
109883 break;
109884 case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
109885 {
109886 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy4);
109887 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy4);
109888 }
109889 break;
109890 case 100: /* onconf ::= */
109891 {yygotominor.yy4 = OE_Default;}
109892 break;
109893 case 102: /* orconf ::= */
109894 {yygotominor.yy210 = OE_Default;}
109895 break;
109896 case 103: /* orconf ::= OR resolvetype */
109897 {yygotominor.yy210 = (u8)yymsp[0].minor.yy4;}
109898 break;
109899 case 105: /* resolvetype ::= IGNORE */
109900 {yygotominor.yy4 = OE_Ignore;}
109901 break;
109902 case 106: /* resolvetype ::= REPLACE */
109903 {yygotominor.yy4 = OE_Replace;}
109904 break;
109905 case 107: /* cmd ::= DROP TABLE ifexists fullname */
109906 {
109907 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 0, yymsp[-1].minor.yy4);
109908 }
109909 break;
109910 case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
109911 {
109912 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy387, yymsp[-6].minor.yy4, yymsp[-4].minor.yy4);
109913 }
109914 break;
109915 case 111: /* cmd ::= DROP VIEW ifexists fullname */
109916 {
109917 sqlite3DropTable(pParse, yymsp[0].minor.yy259, 1, yymsp[-1].minor.yy4);
109918 }
109919 break;
109920 case 112: /* cmd ::= select */
109921 {
109922 SelectDest dest = {SRT_Output, 0, 0, 0, 0};
109923 sqlite3Select(pParse, yymsp[0].minor.yy387, &dest);
109924 sqlite3ExplainBegin(pParse->pVdbe);
109925 sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy387);
109926 sqlite3ExplainFinish(pParse->pVdbe);
109927 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy387);
109928 }
109929 break;
109930 case 113: /* select ::= oneselect */
109931 {yygotominor.yy387 = yymsp[0].minor.yy387;}
109932 break;
109933 case 114: /* select ::= select multiselect_op oneselect */
109934 {
109935 if( yymsp[0].minor.yy387 ){
109936 yymsp[0].minor.yy387->op = (u8)yymsp[-1].minor.yy4;
109937 yymsp[0].minor.yy387->pPrior = yymsp[-2].minor.yy387;
109938 }else{
109939 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy387);
109940 }
109941 yygotominor.yy387 = yymsp[0].minor.yy387;
109942 }
109943 break;
109944 case 116: /* multiselect_op ::= UNION ALL */
109945 {yygotominor.yy4 = TK_ALL;}
109946 break;
109947 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
109948 {
109949 yygotominor.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.yy292.pLimit,yymsp[0].minor.yy292.pOffset);
109950 }
109951 break;
109952 case 122: /* sclp ::= selcollist COMMA */
109953 case 247: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==247);
109954 {yygotominor.yy322 = yymsp[-1].minor.yy322;}
109955 break;
109956 case 123: /* sclp ::= */
109957 case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
109958 case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159);
109959 case 240: /* exprlist ::= */ yytestcase(yyruleno==240);
109960 case 246: /* idxlist_opt ::= */ yytestcase(yyruleno==246);
109961 {yygotominor.yy322 = 0;}
109962 break;
109963 case 124: /* selcollist ::= sclp expr as */
109964 {
109965 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, yymsp[-1].minor.yy118.pExpr);
109966 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[0].minor.yy0, 1);
109967 sqlite3ExprListSetSpan(pParse,yygotominor.yy322,&yymsp[-1].minor.yy118);
109968 }
109969 break;
109970 case 125: /* selcollist ::= sclp STAR */
109971 {
109972 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
109973 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy322, p);
109974 }
109975 break;
109976 case 126: /* selcollist ::= sclp nm DOT STAR */
109977 {
109978 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
109979 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
109980 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
109981 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, pDot);
109982 }
109983 break;
109984 case 129: /* as ::= */
109985 {yygotominor.yy0.n = 0;}
109986 break;
109987 case 130: /* from ::= */
109988 {yygotominor.yy259 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy259));}
109989 break;
109990 case 131: /* from ::= FROM seltablist */
109991 {
109992 yygotominor.yy259 = yymsp[0].minor.yy259;
109993 sqlite3SrcListShiftJoinType(yygotominor.yy259);
109994 }
109995 break;
109996 case 132: /* stl_prefix ::= seltablist joinop */
109997 {
109998 yygotominor.yy259 = yymsp[-1].minor.yy259;
109999 if( ALWAYS(yygotominor.yy259 && yygotominor.yy259->nSrc>0) ) yygotominor.yy259->a[yygotominor.yy259->nSrc-1].jointype = (u8)yymsp[0].minor.yy4;
110000 }
110001 break;
110002 case 133: /* stl_prefix ::= */
110003 {yygotominor.yy259 = 0;}
110004 break;
110005 case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
110006 {
110007 yygotominor.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);
110008 sqlite3SrcListIndexedBy(pParse, yygotominor.yy259, &yymsp[-2].minor.yy0);
110009 }
110010 break;
110011 case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
110012 {
110013 yygotominor.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);
110014 }
110015 break;
110016 case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
110017 {
110018 if( yymsp[-6].minor.yy259==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy314==0 && yymsp[0].minor.yy384==0 ){
110019 yygotominor.yy259 = yymsp[-4].minor.yy259;
110020 }else{
110021 Select *pSubquery;
110022 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy259);
110023 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy259,0,0,0,0,0,0,0);
110024 yygotominor.yy259 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy259,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy314,yymsp[0].minor.yy384);
110025 }
110026 }
110027 break;
110028 case 137: /* dbnm ::= */
110029 case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
110030 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
110031 break;
110032 case 139: /* fullname ::= nm dbnm */
110033 {yygotominor.yy259 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
110034 break;
110035 case 140: /* joinop ::= COMMA|JOIN */
110036 { yygotominor.yy4 = JT_INNER; }
110037 break;
110038 case 141: /* joinop ::= JOIN_KW JOIN */
110039 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
110040 break;
110041 case 142: /* joinop ::= JOIN_KW nm JOIN */
110042 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
110043 break;
110044 case 143: /* joinop ::= JOIN_KW nm nm JOIN */
110045 { yygotominor.yy4 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
110046 break;
110047 case 144: /* on_opt ::= ON expr */
110048 case 155: /* sortitem ::= expr */ yytestcase(yyruleno==155);
110049 case 162: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==162);
110050 case 169: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==169);
110051 case 235: /* case_else ::= ELSE expr */ yytestcase(yyruleno==235);
110052 case 237: /* case_operand ::= expr */ yytestcase(yyruleno==237);
110053 {yygotominor.yy314 = yymsp[0].minor.yy118.pExpr;}
110054 break;
110055 case 145: /* on_opt ::= */
110056 case 161: /* having_opt ::= */ yytestcase(yyruleno==161);
110057 case 168: /* where_opt ::= */ yytestcase(yyruleno==168);
110058 case 236: /* case_else ::= */ yytestcase(yyruleno==236);
110059 case 238: /* case_operand ::= */ yytestcase(yyruleno==238);
110060 {yygotominor.yy314 = 0;}
110061 break;
110062 case 148: /* indexed_opt ::= NOT INDEXED */
110063 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
110064 break;
110065 case 149: /* using_opt ::= USING LP inscollist RP */
110066 case 181: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==181);
110067 {yygotominor.yy384 = yymsp[-1].minor.yy384;}
110068 break;
110069 case 150: /* using_opt ::= */
110070 case 180: /* inscollist_opt ::= */ yytestcase(yyruleno==180);
110071 {yygotominor.yy384 = 0;}
110072 break;
110073 case 152: /* orderby_opt ::= ORDER BY sortlist */
110074 case 160: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==160);
110075 case 239: /* exprlist ::= nexprlist */ yytestcase(yyruleno==239);
110076 {yygotominor.yy322 = yymsp[0].minor.yy322;}
110077 break;
110078 case 153: /* sortlist ::= sortlist COMMA sortitem sortorder */
110079 {
110080 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322,yymsp[-1].minor.yy314);
110081 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110082 }
110083 break;
110084 case 154: /* sortlist ::= sortitem sortorder */
110085 {
110086 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy314);
110087 if( yygotominor.yy322 && ALWAYS(yygotominor.yy322->a) ) yygotominor.yy322->a[0].sortOrder = (u8)yymsp[0].minor.yy4;
110088 }
110089 break;
110090 case 156: /* sortorder ::= ASC */
110091 case 158: /* sortorder ::= */ yytestcase(yyruleno==158);
110092 {yygotominor.yy4 = SQLITE_SO_ASC;}
110093 break;
110094 case 157: /* sortorder ::= DESC */
110095 {yygotominor.yy4 = SQLITE_SO_DESC;}
110096 break;
110097 case 163: /* limit_opt ::= */
110098 {yygotominor.yy292.pLimit = 0; yygotominor.yy292.pOffset = 0;}
110099 break;
110100 case 164: /* limit_opt ::= LIMIT expr */
110101 {yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr; yygotominor.yy292.pOffset = 0;}
110102 break;
110103 case 165: /* limit_opt ::= LIMIT expr OFFSET expr */
110104 {yygotominor.yy292.pLimit = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pOffset = yymsp[0].minor.yy118.pExpr;}
110105 break;
110106 case 166: /* limit_opt ::= LIMIT expr COMMA expr */
110107 {yygotominor.yy292.pOffset = yymsp[-2].minor.yy118.pExpr; yygotominor.yy292.pLimit = yymsp[0].minor.yy118.pExpr;}
110108 break;
110109 case 167: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
110110 {
110111 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy259, &yymsp[-1].minor.yy0);
110112 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy259,yymsp[0].minor.yy314);
110113 }
110114 break;
110115 case 170: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
110116 {
110117 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy259, &yymsp[-3].minor.yy0);
110118 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy322,"set list");
110119 sqlite3Update(pParse,yymsp[-4].minor.yy259,yymsp[-1].minor.yy322,yymsp[0].minor.yy314,yymsp[-5].minor.yy210);
110120 }
110121 break;
110122 case 171: /* setlist ::= setlist COMMA nm EQ expr */
110123 {
110124 yygotominor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy118.pExpr);
110125 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110126 }
110127 break;
110128 case 172: /* setlist ::= nm EQ expr */
110129 {
110130 yygotominor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy118.pExpr);
110131 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110132 }
110133 break;
110134 case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
110135 {sqlite3Insert(pParse, yymsp[-5].minor.yy259, yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy384, yymsp[-7].minor.yy210);}
110136 break;
110137 case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
110138 {sqlite3Insert(pParse, yymsp[-2].minor.yy259, 0, yymsp[0].minor.yy387, yymsp[-1].minor.yy384, yymsp[-4].minor.yy210);}
110139 break;
110140 case 175: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
110141 {sqlite3Insert(pParse, yymsp[-3].minor.yy259, 0, 0, yymsp[-2].minor.yy384, yymsp[-5].minor.yy210);}
110142 break;
110143 case 176: /* insert_cmd ::= INSERT orconf */
110144 {yygotominor.yy210 = yymsp[0].minor.yy210;}
110145 break;
110146 case 177: /* insert_cmd ::= REPLACE */
110147 {yygotominor.yy210 = OE_Replace;}
110148 break;
110149 case 178: /* itemlist ::= itemlist COMMA expr */
110150 case 241: /* nexprlist ::= nexprlist COMMA expr */ yytestcase(yyruleno==241);
110151 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy118.pExpr);}
110152 break;
110153 case 179: /* itemlist ::= expr */
110154 case 242: /* nexprlist ::= expr */ yytestcase(yyruleno==242);
110155 {yygotominor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy118.pExpr);}
110156 break;
110157 case 182: /* inscollist ::= inscollist COMMA nm */
110158 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy384,&yymsp[0].minor.yy0);}
110159 break;
110160 case 183: /* inscollist ::= nm */
110161 {yygotominor.yy384 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
110162 break;
110163 case 184: /* expr ::= term */
110164 {yygotominor.yy118 = yymsp[0].minor.yy118;}
110165 break;
110166 case 185: /* expr ::= LP expr RP */
110167 {yygotominor.yy118.pExpr = yymsp[-1].minor.yy118.pExpr; spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
110168 break;
110169 case 186: /* term ::= NULL */
110170 case 191: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==191);
110171 case 192: /* term ::= STRING */ yytestcase(yyruleno==192);
110172 {spanExpr(&yygotominor.yy118, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
110173 break;
110174 case 187: /* expr ::= id */
110175 case 188: /* expr ::= JOIN_KW */ yytestcase(yyruleno==188);
110176 {spanExpr(&yygotominor.yy118, pParse, TK_ID, &yymsp[0].minor.yy0);}
110177 break;
110178 case 189: /* expr ::= nm DOT nm */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110179 {
110180 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110181 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110182 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
110183 spanSet(&yygotominor.yy118,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
110184 }
110185 break;
110186 case 190: /* expr ::= nm DOT nm DOT nm */
110187 {
110188 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
110189 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110190 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110191 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
110192 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
110193 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110194 }
110195 break;
110196 case 193: /* expr ::= REGISTER */
110197 {
110198 /* When doing a nested parse, one can include terms in an expression
110199 ** that look like this: #1 #2 ... These terms refer to registers
110200 ** in the virtual machine. #N is the N-th register. */
110201 if( pParse->nested==0 ){
110202 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0);
110203 yygotominor.yy118.pExpr = 0;
110204 }else{
110205 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
110206 if( yygotominor.yy118.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy118.pExpr->iTable);
110207 }
110208 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110209 }
110210 break;
110211 case 194: /* expr ::= VARIABLE */
110212 {
110213 spanExpr(&yygotominor.yy118, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
110214 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy118.pExpr);
110215 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110216 }
110217 break;
110218 case 195: /* expr ::= expr COLLATE ids */
110219 {
110220 yygotominor.yy118.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy118.pExpr, &yymsp[0].minor.yy0);
110221 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
110222 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110223 }
110224 break;
110225 case 196: /* expr ::= CAST LP expr AS typetoken RP */
110226 {
110227 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy118.pExpr, 0, &yymsp[-1].minor.yy0);
110228 spanSet(&yygotominor.yy118,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
110229 }
110230 break;
110231 case 197: /* expr ::= ID LP distinct exprlist RP */
110232 {
110233 if( yymsp[-1].minor.yy322 && yymsp[-1].minor.yy322->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
110234 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
110235 }
110236 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
110237 spanSet(&yygotominor.yy118,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110238 if( yymsp[-2].minor.yy4 && yygotominor.yy118.pExpr ){
110239 yygotominor.yy118.pExpr->flags |= EP_Distinct;
110240 }
110241 }
110242 break;
110243 case 198: /* expr ::= ID LP STAR RP */
110244 {
110245 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
110246 spanSet(&yygotominor.yy118,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
110247 }
110248 break;
110249 case 199: /* term ::= CTIME_KW */
110250 {
110251 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
110252 ** treated as functions that return constants */
110253 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
110254 if( yygotominor.yy118.pExpr ){
110255 yygotominor.yy118.pExpr->op = TK_CONST_FUNC;
110256 }
110257 spanSet(&yygotominor.yy118, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110258 }
110259 break;
110260 case 200: /* expr ::= expr AND expr */
110261 case 201: /* expr ::= expr OR expr */ yytestcase(yyruleno==201);
110262 case 202: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==202);
110263 case 203: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==203);
110264 case 204: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==204);
110265 case 205: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==205);
110266 case 206: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==206);
110267 case 207: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==207);
110268 {spanBinaryExpr(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);}
110269 break;
110270 case 208: /* likeop ::= LIKE_KW */
110271 case 210: /* likeop ::= MATCH */ yytestcase(yyruleno==210);
110272 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 0;}
110273 break;
110274 case 209: /* likeop ::= NOT LIKE_KW */
110275 case 211: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==211);
110276 {yygotominor.yy342.eOperator = yymsp[0].minor.yy0; yygotominor.yy342.not = 1;}
110277 break;
110278 case 212: /* expr ::= expr likeop expr */
110279 {
110280 ExprList *pList;
110281 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy118.pExpr);
110282 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy118.pExpr);
110283 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy342.eOperator);
110284 if( yymsp[-1].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110285 yygotominor.yy118.zStart = yymsp[-2].minor.yy118.zStart;
110286 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110287 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
110288 }
110289 break;
110290 case 213: /* expr ::= expr likeop expr ESCAPE expr */
110291 {
110292 ExprList *pList;
110293 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110294 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy118.pExpr);
110295 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
110296 yygotominor.yy118.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy342.eOperator);
110297 if( yymsp[-3].minor.yy342.not ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110298 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110299 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110300 if( yygotominor.yy118.pExpr ) yygotominor.yy118.pExpr->flags |= EP_InfixFunc;
110301 }
110302 break;
110303 case 214: /* expr ::= expr ISNULL|NOTNULL */
110304 {spanUnaryPostfix(&yygotominor.yy118,pParse,yymsp[0].major,&yymsp[-1].minor.yy118,&yymsp[0].minor.yy0);}
110305 break;
110306 case 215: /* expr ::= expr NOT NULL */
110307 {spanUnaryPostfix(&yygotominor.yy118,pParse,TK_NOTNULL,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy0);}
110308 break;
110309 case 216: /* expr ::= expr IS expr */
110310 {
110311 spanBinaryExpr(&yygotominor.yy118,pParse,TK_IS,&yymsp[-2].minor.yy118,&yymsp[0].minor.yy118);
110312 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_ISNULL);
110313 }
110314 break;
110315 case 217: /* expr ::= expr IS NOT expr */
110316 {
110317 spanBinaryExpr(&yygotominor.yy118,pParse,TK_ISNOT,&yymsp[-3].minor.yy118,&yymsp[0].minor.yy118);
110318 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy118.pExpr, yygotominor.yy118.pExpr, TK_NOTNULL);
110319 }
110320 break;
110321 case 218: /* expr ::= NOT expr */
110322 case 219: /* expr ::= BITNOT expr */ yytestcase(yyruleno==219);
110323 {spanUnaryPrefix(&yygotominor.yy118,pParse,yymsp[-1].major,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110324 break;
110325 case 220: /* expr ::= MINUS expr */
110326 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UMINUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110327 break;
110328 case 221: /* expr ::= PLUS expr */
110329 {spanUnaryPrefix(&yygotominor.yy118,pParse,TK_UPLUS,&yymsp[0].minor.yy118,&yymsp[-1].minor.yy0);}
110330 break;
110331 case 224: /* expr ::= expr between_op expr AND expr */
110332 {
110333 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110334 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy118.pExpr);
110335 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110336 if( yygotominor.yy118.pExpr ){
110337 yygotominor.yy118.pExpr->x.pList = pList;
110338 }else{
110339 sqlite3ExprListDelete(pParse->db, pList);
110340 }
110341 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110342 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110343 yygotominor.yy118.zEnd = yymsp[0].minor.yy118.zEnd;
110344 }
110345 break;
110346 case 227: /* expr ::= expr in_op LP exprlist RP */
110347 {
110348 if( yymsp[-1].minor.yy322==0 ){
110349 /* Expressions of the form
110350 **
110351 ** expr1 IN ()
110352 ** expr1 NOT IN ()
110353 **
110354 ** simplify to constants 0 (false) and 1 (true), respectively,
110355 ** regardless of the value of expr1.
110356 */
110357 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy4]);
110358 sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy118.pExpr);
110359 }else{
110360 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110361 if( yygotominor.yy118.pExpr ){
110362 yygotominor.yy118.pExpr->x.pList = yymsp[-1].minor.yy322;
110363 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110364 }else{
110365 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
110366 }
110367 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110368 }
110369 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110370 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110371 }
110372 break;
110373 case 228: /* expr ::= LP select RP */
110374 {
110375 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
110376 if( yygotominor.yy118.pExpr ){
110377 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
110378 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110379 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110380 }else{
110381 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110382 }
110383 yygotominor.yy118.zStart = yymsp[-2].minor.yy0.z;
110384 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110385 }
110386 break;
110387 case 229: /* expr ::= expr in_op LP select RP */
110388 {
110389 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy118.pExpr, 0, 0);
110390 if( yygotominor.yy118.pExpr ){
110391 yygotominor.yy118.pExpr->x.pSelect = yymsp[-1].minor.yy387;
110392 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110393 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110394 }else{
110395 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110396 }
110397 if( yymsp[-3].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110398 yygotominor.yy118.zStart = yymsp[-4].minor.yy118.zStart;
110399 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110400 }
110401 break;
110402 case 230: /* expr ::= expr in_op nm dbnm */
110403 {
110404 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
110405 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy118.pExpr, 0, 0);
110406 if( yygotominor.yy118.pExpr ){
110407 yygotominor.yy118.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
110408 ExprSetProperty(yygotominor.yy118.pExpr, EP_xIsSelect);
110409 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110410 }else{
110411 sqlite3SrcListDelete(pParse->db, pSrc);
110412 }
110413 if( yymsp[-2].minor.yy4 ) yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy118.pExpr, 0, 0);
110414 yygotominor.yy118.zStart = yymsp[-3].minor.yy118.zStart;
110415 yygotominor.yy118.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
110416 }
110417 break;
110418 case 231: /* expr ::= EXISTS LP select RP */
110419 {
110420 Expr *p = yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
110421 if( p ){
110422 p->x.pSelect = yymsp[-1].minor.yy387;
110423 ExprSetProperty(p, EP_xIsSelect);
110424 sqlite3ExprSetHeight(pParse, p);
110425 }else{
110426 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy387);
110427 }
110428 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
110429 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110430 }
110431 break;
110432 case 232: /* expr ::= CASE case_operand case_exprlist case_else END */
110433 {
110434 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy314, yymsp[-1].minor.yy314, 0);
110435 if( yygotominor.yy118.pExpr ){
110436 yygotominor.yy118.pExpr->x.pList = yymsp[-2].minor.yy322;
110437 sqlite3ExprSetHeight(pParse, yygotominor.yy118.pExpr);
110438 }else{
110439 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
110440 }
110441 yygotominor.yy118.zStart = yymsp[-4].minor.yy0.z;
110442 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110443 }
110444 break;
110445 case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
110446 {
110447 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy118.pExpr);
110448 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
110449 }
110450 break;
110451 case 234: /* case_exprlist ::= WHEN expr THEN expr */
110452 {
110453 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy118.pExpr);
110454 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yygotominor.yy322, yymsp[0].minor.yy118.pExpr);
110455 }
110456 break;
110457 case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
 
 
 
 
 
 
110458 {
110459 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
110460 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy322, yymsp[-9].minor.yy4,
110461 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy4);
110462 }
110463 break;
110464 case 244: /* uniqueflag ::= UNIQUE */
110465 case 298: /* raisetype ::= ABORT */ yytestcase(yyruleno==298);
110466 {yygotominor.yy4 = OE_Abort;}
110467 break;
110468 case 245: /* uniqueflag ::= */
110469 {yygotominor.yy4 = OE_None;}
110470 break;
110471 case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */
110472 {
110473 Expr *p = 0;
110474 if( yymsp[-1].minor.yy0.n>0 ){
110475 p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
110476 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110477 }
110478 yygotominor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, p);
110479 sqlite3ExprListSetName(pParse,yygotominor.yy322,&yymsp[-2].minor.yy0,1);
110480 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
110481 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110482 }
110483 break;
110484 case 249: /* idxlist ::= nm collate sortorder */
110485 {
110486 Expr *p = 0;
110487 if( yymsp[-1].minor.yy0.n>0 ){
110488 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
110489 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110490 }
110491 yygotominor.yy322 = sqlite3ExprListAppend(pParse,0, p);
110492 sqlite3ExprListSetName(pParse, yygotominor.yy322, &yymsp[-2].minor.yy0, 1);
110493 sqlite3ExprListCheckLength(pParse, yygotominor.yy322, "index");
110494 if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy4;
110495 }
110496 break;
110497 case 250: /* collate ::= */
110498 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
110499 break;
110500 case 252: /* cmd ::= DROP INDEX ifexists fullname */
110501 {sqlite3DropIndex(pParse, yymsp[0].minor.yy259, yymsp[-1].minor.yy4);}
110502 break;
110503 case 253: /* cmd ::= VACUUM */
110504 case 254: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==254);
110505 {sqlite3Vacuum(pParse);}
110506 break;
110507 case 255: /* cmd ::= PRAGMA nm dbnm */
110508 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
110509 break;
110510 case 256: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
110511 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
110512 break;
110513 case 257: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
110514 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
110515 break;
110516 case 258: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
110517 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
110518 break;
110519 case 259: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
110520 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
110521 break;
110522 case 270: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
110523 {
110524 Token all;
110525 all.z = yymsp[-3].minor.yy0.z;
110526 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
110527 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy203, &all);
110528 }
110529 break;
110530 case 271: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
110531 {
110532 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);
110533 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
110534 }
110535 break;
110536 case 272: /* trigger_time ::= BEFORE */
110537 case 275: /* trigger_time ::= */ yytestcase(yyruleno==275);
110538 { yygotominor.yy4 = TK_BEFORE; }
110539 break;
110540 case 273: /* trigger_time ::= AFTER */
110541 { yygotominor.yy4 = TK_AFTER; }
110542 break;
110543 case 274: /* trigger_time ::= INSTEAD OF */
110544 { yygotominor.yy4 = TK_INSTEAD;}
110545 break;
110546 case 276: /* trigger_event ::= DELETE|INSERT */
110547 case 277: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==277);
110548 {yygotominor.yy90.a = yymsp[0].major; yygotominor.yy90.b = 0;}
110549 break;
110550 case 278: /* trigger_event ::= UPDATE OF inscollist */
110551 {yygotominor.yy90.a = TK_UPDATE; yygotominor.yy90.b = yymsp[0].minor.yy384;}
110552 break;
110553 case 281: /* when_clause ::= */
110554 case 303: /* key_opt ::= */ yytestcase(yyruleno==303);
110555 { yygotominor.yy314 = 0; }
110556 break;
110557 case 282: /* when_clause ::= WHEN expr */
110558 case 304: /* key_opt ::= KEY expr */ yytestcase(yyruleno==304);
110559 { yygotominor.yy314 = yymsp[0].minor.yy118.pExpr; }
110560 break;
110561 case 283: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
110562 {
110563 assert( yymsp[-2].minor.yy203!=0 );
110564 yymsp[-2].minor.yy203->pLast->pNext = yymsp[-1].minor.yy203;
110565 yymsp[-2].minor.yy203->pLast = yymsp[-1].minor.yy203;
110566 yygotominor.yy203 = yymsp[-2].minor.yy203;
110567 }
110568 break;
110569 case 284: /* trigger_cmd_list ::= trigger_cmd SEMI */
110570 {
110571 assert( yymsp[-1].minor.yy203!=0 );
110572 yymsp[-1].minor.yy203->pLast = yymsp[-1].minor.yy203;
110573 yygotominor.yy203 = yymsp[-1].minor.yy203;
110574 }
110575 break;
110576 case 286: /* trnm ::= nm DOT nm */
110577 {
110578 yygotominor.yy0 = yymsp[0].minor.yy0;
110579 sqlite3ErrorMsg(pParse,
110580 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
110581 "statements within triggers");
110582 }
110583 break;
110584 case 288: /* tridxby ::= INDEXED BY nm */
110585 {
110586 sqlite3ErrorMsg(pParse,
110587 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
110588 "within triggers");
110589 }
110590 break;
110591 case 289: /* tridxby ::= NOT INDEXED */
110592 {
110593 sqlite3ErrorMsg(pParse,
110594 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
110595 "within triggers");
110596 }
110597 break;
110598 case 290: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
110599 { yygotominor.yy203 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy314, yymsp[-5].minor.yy210); }
110600 break;
110601 case 291: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt VALUES LP itemlist RP */
110602 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy384, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy210);}
110603 break;
110604 case 292: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
110605 {yygotominor.yy203 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy384, 0, yymsp[0].minor.yy387, yymsp[-4].minor.yy210);}
110606 break;
110607 case 293: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
110608 {yygotominor.yy203 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy314);}
110609 break;
110610 case 294: /* trigger_cmd ::= select */
110611 {yygotominor.yy203 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy387); }
110612 break;
110613 case 295: /* expr ::= RAISE LP IGNORE RP */
110614 {
110615 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
110616 if( yygotominor.yy118.pExpr ){
110617 yygotominor.yy118.pExpr->affinity = OE_Ignore;
110618 }
110619 yygotominor.yy118.zStart = yymsp[-3].minor.yy0.z;
110620 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110621 }
110622 break;
110623 case 296: /* expr ::= RAISE LP raisetype COMMA nm RP */
110624 {
110625 yygotominor.yy118.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
110626 if( yygotominor.yy118.pExpr ) {
110627 yygotominor.yy118.pExpr->affinity = (char)yymsp[-3].minor.yy4;
110628 }
110629 yygotominor.yy118.zStart = yymsp[-5].minor.yy0.z;
110630 yygotominor.yy118.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110631 }
110632 break;
110633 case 297: /* raisetype ::= ROLLBACK */
110634 {yygotominor.yy4 = OE_Rollback;}
110635 break;
110636 case 299: /* raisetype ::= FAIL */
110637 {yygotominor.yy4 = OE_Fail;}
110638 break;
110639 case 300: /* cmd ::= DROP TRIGGER ifexists fullname */
110640 {
110641 sqlite3DropTrigger(pParse,yymsp[0].minor.yy259,yymsp[-1].minor.yy4);
110642 }
110643 break;
110644 case 301: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
110645 {
110646 sqlite3Attach(pParse, yymsp[-3].minor.yy118.pExpr, yymsp[-1].minor.yy118.pExpr, yymsp[0].minor.yy314);
110647 }
110648 break;
110649 case 302: /* cmd ::= DETACH database_kw_opt expr */
110650 {
110651 sqlite3Detach(pParse, yymsp[0].minor.yy118.pExpr);
110652 }
110653 break;
110654 case 307: /* cmd ::= REINDEX */
110655 {sqlite3Reindex(pParse, 0, 0);}
110656 break;
110657 case 308: /* cmd ::= REINDEX nm dbnm */
110658 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110659 break;
110660 case 309: /* cmd ::= ANALYZE */
110661 {sqlite3Analyze(pParse, 0, 0);}
110662 break;
110663 case 310: /* cmd ::= ANALYZE nm dbnm */
110664 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110665 break;
110666 case 311: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
110667 {
110668 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy259,&yymsp[0].minor.yy0);
110669 }
110670 break;
110671 case 312: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
110672 {
110673 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
110674 }
110675 break;
110676 case 313: /* add_column_fullname ::= fullname */
110677 {
110678 pParse->db->lookaside.bEnabled = 0;
110679 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy259);
110680 }
110681 break;
110682 case 316: /* cmd ::= create_vtab */
110683 {sqlite3VtabFinishParse(pParse,0);}
110684 break;
110685 case 317: /* cmd ::= create_vtab LP vtabarglist RP */
110686 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
110687 break;
110688 case 318: /* create_vtab ::= createkw VIRTUAL TABLE nm dbnm USING nm */
110689 {
110690 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
110691 }
110692 break;
110693 case 321: /* vtabarg ::= */
110694 {sqlite3VtabArgInit(pParse);}
110695 break;
110696 case 323: /* vtabargtoken ::= ANY */
110697 case 324: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==324);
110698 case 325: /* lp ::= LP */ yytestcase(yyruleno==325);
110699 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
110700 break;
110701 default:
110702 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
110703 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
@@ -110722,25 +110819,23 @@
110722 /* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62);
110723 /* (90) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==90);
110724 /* (91) conslist ::= conslist tcons */ yytestcase(yyruleno==91);
110725 /* (92) conslist ::= tcons */ yytestcase(yyruleno==92);
110726 /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);
110727 /* (268) plus_opt ::= PLUS */ yytestcase(yyruleno==268);
110728 /* (269) plus_opt ::= */ yytestcase(yyruleno==269);
110729 /* (279) foreach_clause ::= */ yytestcase(yyruleno==279);
110730 /* (280) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==280);
110731 /* (287) tridxby ::= */ yytestcase(yyruleno==287);
110732 /* (305) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==305);
110733 /* (306) database_kw_opt ::= */ yytestcase(yyruleno==306);
110734 /* (314) kwcolumn_opt ::= */ yytestcase(yyruleno==314);
110735 /* (315) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==315);
110736 /* (319) vtabarglist ::= vtabarg */ yytestcase(yyruleno==319);
110737 /* (320) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==320);
110738 /* (322) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==322);
110739 /* (326) anylist ::= */ yytestcase(yyruleno==326);
110740 /* (327) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==327);
110741 /* (328) anylist ::= anylist ANY */ yytestcase(yyruleno==328);
110742 break;
110743 };
110744 yygoto = yyRuleInfo[yyruleno].lhs;
110745 yysize = yyRuleInfo[yyruleno].nrhs;
110746 yypParser->yyidx -= yysize;
@@ -115167,11 +115262,12 @@
115167 /*
115168 ** Return a boolean value for a query parameter.
115169 */
115170 SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
115171 const char *z = sqlite3_uri_parameter(zFilename, zParam);
115172 return z ? sqlite3GetBoolean(z) : (bDflt!=0);
 
115173 }
115174
115175 /*
115176 ** Return a 64-bit integer value for a query parameter.
115177 */
@@ -116503,11 +116599,11 @@
116503 /* fts3_write.c */
116504 SQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*);
116505 SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *);
116506 SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *);
116507 SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *);
116508 SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, sqlite3_int64,
116509 sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**);
116510 SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
116511 Fts3Table*,int,const char*,int,int,Fts3SegReader**);
116512 SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *);
116513 SQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, sqlite3_stmt **);
@@ -118931,11 +119027,13 @@
118931 if( rc!=SQLITE_OK ) goto finished;
118932 if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;
118933 }
118934
118935 rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1,
118936 iStartBlock, iLeavesEndBlock, iEndBlock, zRoot, nRoot, &pSeg
 
 
118937 );
118938 if( rc!=SQLITE_OK ) goto finished;
118939 rc = fts3SegReaderCursorAppend(pCsr, pSeg);
118940 }
118941 }
@@ -124753,10 +124851,11 @@
124753 ** fts3SegReaderFirstDocid()
124754 ** fts3SegReaderNextDocid()
124755 */
124756 struct Fts3SegReader {
124757 int iIdx; /* Index within level, or 0x7FFFFFFF for PT */
 
124758
124759 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
124760 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
124761 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
124762 sqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */
@@ -125730,10 +125829,22 @@
125730 ){
125731 rc = fts3SegReaderIncrRead(pReader);
125732 }
125733 return rc;
125734 }
 
 
 
 
 
 
 
 
 
 
 
 
125735
125736 /*
125737 ** Move the iterator passed as the first argument to the next term in the
125738 ** segment. If successful, SQLITE_OK is returned. If there is no next term,
125739 ** SQLITE_DONE. Otherwise, an SQLite error code.
@@ -125770,16 +125881,11 @@
125770 assert( pReader->aNode );
125771 }
125772 return SQLITE_OK;
125773 }
125774
125775 if( !fts3SegReaderIsRootOnly(pReader) ){
125776 sqlite3_free(pReader->aNode);
125777 sqlite3_blob_close(pReader->pBlob);
125778 pReader->pBlob = 0;
125779 }
125780 pReader->aNode = 0;
125781
125782 /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
125783 ** blocks have already been traversed. */
125784 assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );
125785 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
@@ -126022,10 +126128,11 @@
126022 /*
126023 ** Allocate a new SegReader object.
126024 */
126025 SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
126026 int iAge, /* Segment "age". */
 
126027 sqlite3_int64 iStartLeaf, /* First leaf to traverse */
126028 sqlite3_int64 iEndLeaf, /* Final leaf to traverse */
126029 sqlite3_int64 iEndBlock, /* Final block of segment */
126030 const char *zRoot, /* Buffer containing root node */
126031 int nRoot, /* Size of buffer containing root node */
@@ -126043,10 +126150,11 @@
126043 if( !pReader ){
126044 return SQLITE_NOMEM;
126045 }
126046 memset(pReader, 0, sizeof(Fts3SegReader));
126047 pReader->iIdx = iAge;
 
126048 pReader->iStartBlock = iStartLeaf;
126049 pReader->iLeafEndBlock = iEndLeaf;
126050 pReader->iEndBlock = iEndBlock;
126051
126052 if( nExtra ){
@@ -127045,15 +127153,20 @@
127045 ** equal or greater value than the specified term. This prevents many
127046 ** unnecessary merge/sort operations for the case where single segment
127047 ** b-tree leaf nodes contain more than one term.
127048 */
127049 for(i=0; pCsr->bRestart==0 && i<pCsr->nSegment; i++){
 
127050 Fts3SegReader *pSeg = pCsr->apSegment[i];
127051 do {
127052 int rc = fts3SegReaderNext(p, pSeg, 0);
127053 if( rc!=SQLITE_OK ) return rc;
127054 }while( zTerm && fts3SegReaderTermCmp(pSeg, zTerm, nTerm)<0 );
 
 
 
 
127055 }
127056 fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp);
127057
127058 return SQLITE_OK;
127059 }
@@ -127170,11 +127283,16 @@
127170
127171 /* Advance the first pCsr->nAdvance entries in the apSegment[] array
127172 ** forward. Then sort the list in order of current term again.
127173 */
127174 for(i=0; i<pCsr->nAdvance; i++){
127175 rc = fts3SegReaderNext(p, apSegment[i], 0);
 
 
 
 
 
127176 if( rc!=SQLITE_OK ) return rc;
127177 }
127178 fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp);
127179 pCsr->nAdvance = 0;
127180
127181
--- 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.7.11. 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.
@@ -655,13 +655,13 @@
655 **
656 ** See also: [sqlite3_libversion()],
657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
658 ** [sqlite_version()] and [sqlite_source_id()].
659 */
660 #define SQLITE_VERSION "3.7.11"
661 #define SQLITE_VERSION_NUMBER 3007011
662 #define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
663
664 /*
665 ** CAPI3REF: Run-Time Library Version Numbers
666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
667 **
@@ -3180,33 +3180,41 @@
3180 **
3181 ** These are utility routines, useful to VFS implementations, that check
3182 ** to see if a database file was a URI that contained a specific query
3183 ** parameter, and if so obtains the value of that query parameter.
3184 **
3185 ** If F is the database filename pointer passed into the xOpen() method of
3186 ** a VFS implementation when the flags parameter to xOpen() has one or
3187 ** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
3188 ** P is the name of the query parameter, then
3189 ** sqlite3_uri_parameter(F,P) returns the value of the P
3190 ** parameter if it exists or a NULL pointer if P does not appear as a
3191 ** query parameter on F. If P is a query parameter of F
3192 ** has no explicit value, then sqlite3_uri_parameter(F,P) returns
3193 ** a pointer to an empty string.
3194 **
3195 ** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
3196 ** parameter and returns true (1) or false (0) according to the value
3197 ** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
3198 ** value of query parameter P is one of "yes", "true", or "on" in any
3199 ** case or if the value begins with a non-zero number. The
3200 ** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
3201 ** query parameter P is one of "no", "false", or "off" in any case or
3202 ** if the value begins with a numeric zero. If P is not a query
3203 ** parameter on F or if the value of P is does not match any of the
3204 ** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
3205 **
3206 ** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
3207 ** 64-bit signed integer and returns that integer, or D if P does not
3208 ** exist. If the value of P is something other than an integer, then
3209 ** zero is returned.
3210 **
3211 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
3212 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
3213 ** is not a database file pathname pointer that SQLite passed into the xOpen
3214 ** VFS method, then the behavior of this routine is undefined and probably
3215 ** undesirable.
3216 */
3217 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3218 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3219 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3220
@@ -6758,11 +6766,11 @@
6766 ** functions.
6767 **
6768 ** [[the xShrink() page cache method]]
6769 ** ^SQLite invokes the xShrink() method when it wants the page cache to
6770 ** free up as much of heap memory as possible. The page cache implementation
6771 ** is not obligated to free any memory, but well-behaved implementations should
6772 ** do their best.
6773 */
6774 typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
6775 struct sqlite3_pcache_methods2 {
6776 int iVersion;
@@ -8010,13 +8018,17 @@
8018 */
8019 #define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0])))
8020
8021 /*
8022 ** The following value as a destructor means to use sqlite3DbFree().
8023 ** The sqlite3DbFree() routine requires two parameters instead of the
8024 ** one parameter that destructors normally want. So we have to introduce
8025 ** this magic value that the code knows to handle differently. Any
8026 ** pointer will work here as long as it is distinct from SQLITE_STATIC
8027 ** and SQLITE_TRANSIENT.
8028 */
8029 #define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
8030
8031 /*
8032 ** When SQLITE_OMIT_WSD is defined, it means that the target platform does
8033 ** not support Writable Static Data (WSD) such as global and static variables.
8034 ** All variables must either be on the stack or dynamically allocated from
@@ -8172,14 +8184,13 @@
8184 **
8185 ** NOTE: These values must match the corresponding PAGER_ values in
8186 ** pager.h.
8187 */
8188 #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
8189 #define BTREE_MEMORY 2 /* This is an in-memory DB */
8190 #define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */
8191 #define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */
 
8192
8193 SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
8194 SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
8195 SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);
8196 SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);
@@ -8848,12 +8859,11 @@
8859 ** Allowed values for the flags parameter to sqlite3PagerOpen().
8860 **
8861 ** NOTE: These values must match the corresponding BTREE_ values in btree.h.
8862 */
8863 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
8864 #define PAGER_MEMORY 0x0002 /* In-memory database */
 
8865
8866 /*
8867 ** Valid values for the second argument to sqlite3PagerLockingMode().
8868 */
8869 #define PAGER_LOCKINGMODE_QUERY -1
@@ -9006,12 +9016,12 @@
9016 struct PgHdr {
9017 sqlite3_pcache_page *pPage; /* Pcache object page handle */
9018 void *pData; /* Page data */
9019 void *pExtra; /* Extra content */
9020 PgHdr *pDirty; /* Transient list of dirty pages */
 
9021 Pager *pPager; /* The pager this page is part of */
9022 Pgno pgno; /* Page number for this page */
9023 #ifdef SQLITE_CHECK_PAGES
9024 u32 pageHash; /* Hash of page content */
9025 #endif
9026 u16 flags; /* PGHDR flags defined below */
9027
@@ -9235,15 +9245,27 @@
9245 # define SQLITE_TEMPNAME_SIZE 200
9246 #endif
9247
9248 /*
9249 ** Determine if we are dealing with Windows NT.
9250 **
9251 ** We ought to be able to determine if we are compiling for win98 or winNT
9252 ** using the _WIN32_WINNT macro as follows:
9253 **
9254 ** #if defined(_WIN32_WINNT)
9255 ** # define SQLITE_OS_WINNT 1
9256 ** #else
9257 ** # define SQLITE_OS_WINNT 0
9258 ** #endif
9259 **
9260 ** However, vs2005 does not set _WIN32_WINNT by default, as it ought to,
9261 ** so the above test does not work. We'll just assume that everything is
9262 ** winNT unless the programmer explicitly says otherwise by setting
9263 ** SQLITE_OS_WINNT to 0.
9264 */
9265 #if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)
9266 # define SQLITE_OS_WINNT 1
 
 
9267 #endif
9268
9269 /*
9270 ** Determine if we are dealing with WindowsCE - which has a much
9271 ** reduced API.
@@ -9637,39 +9659,20 @@
9659 FuncDef *a[23]; /* Hash table for functions */
9660 };
9661
9662 /*
9663 ** Each database connection is an instance of the following structure.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9664 */
9665 struct sqlite3 {
9666 sqlite3_vfs *pVfs; /* OS Interface */
9667 struct Vdbe *pVdbe; /* List of active virtual machines */
9668 CollSeq *pDfltColl; /* The default collating sequence (BINARY) */
9669 sqlite3_mutex *mutex; /* Connection mutex */
9670 Db *aDb; /* All backends */
9671 int nDb; /* Number of backends currently in use */
9672 int flags; /* Miscellaneous flags. See below */
9673 i64 lastRowid; /* ROWID of most recent insert (see above) */
9674 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
9675 int errCode; /* Most recent error code (SQLITE_*) */
9676 int errMask; /* & result codes with this before returning */
9677 u8 autoCommit; /* The auto-commit flag. */
9678 u8 temp_store; /* 1: file 2: memory 0: default */
@@ -9676,31 +9679,27 @@
9679 u8 mallocFailed; /* True if we have seen a malloc failure */
9680 u8 dfltLockMode; /* Default locking-mode for attached dbs */
9681 signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
9682 u8 suppressErr; /* Do not issue error messages if true */
9683 u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
9684 u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
9685 int nextPagesize; /* Pagesize after VACUUM if >0 */
 
 
 
9686 u32 magic; /* Magic number for detect library misuse */
9687 int nChange; /* Value returned by sqlite3_changes() */
9688 int nTotalChange; /* Value returned by sqlite3_total_changes() */
 
9689 int aLimit[SQLITE_N_LIMIT]; /* Limits */
9690 struct sqlite3InitInfo { /* Information used during initialization */
 
9691 int newTnum; /* Rootpage of table being initialized */
9692 u8 iDb; /* Which db file is being initialized */
9693 u8 busy; /* TRUE if currently initializing */
9694 u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */
9695 } init;
 
 
 
9696 int activeVdbeCnt; /* Number of VDBEs currently executing */
9697 int writeVdbeCnt; /* Number of active VDBEs that are writing */
9698 int vdbeExecCnt; /* Number of nested calls to VdbeExec() */
9699 int nExtension; /* Number of loaded extensions */
9700 void **aExtension; /* Array of shared library handles */
9701 void (*xTrace)(void*,const char*); /* Trace function */
9702 void *pTraceArg; /* Argument to the trace function */
9703 void (*xProfile)(void*,const char*,u64); /* Profiling function */
9704 void *pProfileArg; /* Argument to profile function */
9705 void *pCommitArg; /* Argument to xCommitCallback() */
@@ -9733,25 +9732,24 @@
9732 int (*xProgress)(void *); /* The progress callback */
9733 void *pProgressArg; /* Argument to the progress callback */
9734 int nProgressOps; /* Number of opcodes for progress callback */
9735 #endif
9736 #ifndef SQLITE_OMIT_VIRTUALTABLE
9737 int nVTrans; /* Allocated size of aVTrans */
9738 Hash aModule; /* populated by sqlite3_create_module() */
9739 VtabCtx *pVtabCtx; /* Context for active vtab connect/create */
9740 VTable **aVTrans; /* Virtual tables with open transactions */
 
9741 VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */
9742 #endif
9743 FuncDefHash aFunc; /* Hash table of connection functions */
9744 Hash aCollSeq; /* All collating sequences */
9745 BusyHandler busyHandler; /* Busy callback */
 
9746 Db aDbStatic[2]; /* Static space for the 2 default backends */
9747 Savepoint *pSavepoint; /* List of active savepoints */
9748 int busyTimeout; /* Busy handler timeout, in msec */
9749 int nSavepoint; /* Number of non-transaction savepoints */
9750 int nStatement; /* Number of nested statement-transactions */
 
9751 i64 nDeferredCons; /* Net deferred constraints this transaction. */
9752 int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
9753
9754 #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
9755 /* The following variables are all protected by the STATIC_MASTER
@@ -9790,12 +9788,11 @@
9788 #define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */
9789 /* result set is empty */
9790 #define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */
9791 #define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */
9792 #define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */
9793 /* 0x00020000 Unused */
 
9794 #define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */
9795 #define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */
9796 #define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */
9797 #define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */
9798 #define SQLITE_CkptFullFSync 0x00400000 /* Use full fsync for checkpoint */
@@ -9880,11 +9877,10 @@
9877 */
9878 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
9879 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
9880 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
9881 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
 
9882 #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */
9883 #define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */
9884
9885 /*
9886 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
@@ -10163,12 +10159,10 @@
10159 #define TF_Readonly 0x01 /* Read-only system table */
10160 #define TF_Ephemeral 0x02 /* An ephemeral table */
10161 #define TF_HasPrimaryKey 0x04 /* Table has a primary key */
10162 #define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
10163 #define TF_Virtual 0x10 /* Is a virtual table */
 
 
10164
10165
10166 /*
10167 ** Test to see whether or not a table is a virtual table. This is
10168 ** done as a macro so that it will be optimized out when virtual
@@ -10326,23 +10320,23 @@
10320 ** algorithm to employ whenever an attempt is made to insert a non-unique
10321 ** element.
10322 */
10323 struct Index {
10324 char *zName; /* Name of this index */
 
10325 int *aiColumn; /* Which columns are used by this index. 1st is 0 */
10326 tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
10327 Table *pTable; /* The SQL table being indexed */
 
 
 
 
10328 char *zColAff; /* String defining the affinity of each column */
10329 Index *pNext; /* The next index associated with the same table */
10330 Schema *pSchema; /* Schema containing this index */
10331 u8 *aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */
10332 char **azColl; /* Array of collation sequence names for index */
10333 int nColumn; /* Number of columns in the table used by this index */
10334 int tnum; /* Page containing root of this index in database file */
10335 u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
10336 u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
10337 u8 bUnordered; /* Use this index for == or IN queries only */
10338 #ifdef SQLITE_ENABLE_STAT3
10339 int nSample; /* Number of elements in aSample[] */
10340 tRowcnt avgEq; /* Average nEq value for key values not in aSample */
10341 IndexSample *aSample; /* Samples of the left-most key */
10342 #endif
@@ -10397,22 +10391,21 @@
10391 ** from source tables rather than from accumulators */
10392 u8 useSortingIdx; /* In direct mode, reference the sorting index rather
10393 ** than the source table */
10394 int sortingIdx; /* Cursor number of the sorting index */
10395 int sortingIdxPTab; /* Cursor number of pseudo-table */
 
10396 int nSortingColumn; /* Number of columns in the sorting index */
10397 ExprList *pGroupBy; /* The group by clause */
10398 struct AggInfo_col { /* For each column used in source tables */
10399 Table *pTab; /* Source table */
10400 int iTable; /* Cursor number of the source table */
10401 int iColumn; /* Column number within the source table */
10402 int iSorterColumn; /* Column number in the sorting index */
10403 int iMem; /* Memory location that acts as accumulator */
10404 Expr *pExpr; /* The original expression */
10405 } *aCol;
10406 int nColumn; /* Number of used entries in aCol[] */
 
10407 int nAccumulator; /* Number of columns that show through to the output.
10408 ** Additional columns are used only as parameters to
10409 ** aggregate functions */
10410 struct AggInfo_func { /* For each aggregate function */
10411 Expr *pExpr; /* Expression encoding the function */
@@ -10419,11 +10412,10 @@
10412 FuncDef *pFunc; /* The aggregate function implementation */
10413 int iMem; /* Memory location that acts as accumulator */
10414 int iDistinct; /* Ephemeral table used to enforce DISTINCT */
10415 } *aFunc;
10416 int nFunc; /* Number of entries in aFunc[] */
 
10417 };
10418
10419 /*
10420 ** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
10421 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -10616,21 +10608,20 @@
10608 ** also be used as the argument to a function, in which case the a.zName
10609 ** field is not used.
10610 */
10611 struct ExprList {
10612 int nExpr; /* Number of expressions on the list */
 
10613 int iECursor; /* VDBE Cursor associated with this ExprList */
10614 struct ExprList_item { /* For each expression in the list */
10615 Expr *pExpr; /* The list of expressions */
10616 char *zName; /* Token associated with this expression */
10617 char *zSpan; /* Original text of the expression */
10618 u8 sortOrder; /* 1 for DESC or 0 for ASC */
10619 u8 done; /* A flag to indicate when processing is finished */
10620 u16 iOrderByCol; /* For ORDER BY, column number in result set */
10621 u16 iAlias; /* Index into Parse.aAlias[] for zName */
10622 } *a; /* Alloc a power of two greater or equal to nExpr */
10623 };
10624
10625 /*
10626 ** An instance of this structure is used by the parser to record both
10627 ** the parse tree for an expression and the span of input text for an
@@ -10661,11 +10652,10 @@
10652 struct IdList_item {
10653 char *zName; /* Name of the identifier */
10654 int idx; /* Index in some Table.aCol[] of a column named zName */
10655 } *a;
10656 int nId; /* Number of identifiers on the list */
 
10657 };
10658
10659 /*
10660 ** The bitmask datatype defined below is used for various optimizations.
10661 **
@@ -10905,10 +10895,13 @@
10895 struct Select {
10896 ExprList *pEList; /* The fields of the result */
10897 u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
10898 char affinity; /* MakeRecord with this affinity for SRT_Set */
10899 u16 selFlags; /* Various SF_* values */
10900 int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
10901 int addrOpenEphm[3]; /* OP_OpenEphem opcodes related to this select */
10902 double nSelectRow; /* Estimated number of result rows */
10903 SrcList *pSrc; /* The FROM clause */
10904 Expr *pWhere; /* The WHERE clause */
10905 ExprList *pGroupBy; /* The GROUP BY clause */
10906 Expr *pHaving; /* The HAVING clause */
10907 ExprList *pOrderBy; /* The ORDER BY clause */
@@ -10915,13 +10908,10 @@
10908 Select *pPrior; /* Prior select in a compound select statement */
10909 Select *pNext; /* Next select to the left in a compound */
10910 Select *pRightmost; /* Right-most select in a compound select statement */
10911 Expr *pLimit; /* LIMIT expression. NULL means not used. */
10912 Expr *pOffset; /* OFFSET expression. NULL means not used. */
 
 
 
10913 };
10914
10915 /*
10916 ** Allowed values for Select.selFlags. The "SF" prefix stands for
10917 ** "Select Flag".
@@ -10931,10 +10921,11 @@
10921 #define SF_Aggregate 0x04 /* Contains aggregate functions */
10922 #define SF_UsesEphemeral 0x08 /* Uses the OpenEphemeral opcode */
10923 #define SF_Expanded 0x10 /* sqlite3SelectExpand() called on this */
10924 #define SF_HasTypeInfo 0x20 /* FROM subqueries have Table metadata */
10925 #define SF_UseSorter 0x40 /* Sort using a sorter */
10926 #define SF_Values 0x80 /* Synthesized from VALUES clause */
10927
10928
10929 /*
10930 ** The results of a select can be distributed in several ways. The
10931 ** "SRT" prefix means "SELECT Result Type".
@@ -11008,14 +10999,14 @@
10999 ** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
11000 ** a mask of new.* columns used by the program.
11001 */
11002 struct TriggerPrg {
11003 Trigger *pTrigger; /* Trigger this program was coded from */
11004 TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */
11005 SubProgram *pProgram; /* Program implementing pTrigger/orconf */
11006 int orconf; /* Default ON CONFLICT policy */
11007 u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */
 
11008 };
11009
11010 /*
11011 ** The yDbMask datatype for the bitmask of all attached databases.
11012 */
@@ -11041,18 +11032,22 @@
11032 ** compiled. Function sqlite3TableLock() is used to add entries to the
11033 ** list.
11034 */
11035 struct Parse {
11036 sqlite3 *db; /* The main database structure */
 
11037 char *zErrMsg; /* An error message */
11038 Vdbe *pVdbe; /* An engine for executing database bytecode */
11039 int rc; /* Return code from execution */
11040 u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
11041 u8 checkSchema; /* Causes schema cookie check after an error */
11042 u8 nested; /* Number of nested calls to the parser/code generator */
11043 u8 nTempReg; /* Number of temporary registers in aTempReg[] */
11044 u8 nTempInUse; /* Number of aTempReg[] currently checked out */
11045 u8 nColCache; /* Number of entries in aColCache[] */
11046 u8 iColCache; /* Next entry in aColCache[] to replace */
11047 u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
11048 u8 mayAbort; /* True if statement may throw an ABORT exception */
11049 int aTempReg[8]; /* Holding area for temporary registers */
11050 int nRangeReg; /* Size of the temporary register block */
11051 int iRangeReg; /* First register in temporary register block */
11052 int nErr; /* Number of errors seen */
11053 int nTab; /* Number of previously allocated VDBE cursors */
@@ -11060,12 +11055,10 @@
11055 int nSet; /* Number of sets used so far */
11056 int nOnce; /* Number of OP_Once instructions so far */
11057 int ckBase; /* Base register of data during check constraints */
11058 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
11059 int iCacheCnt; /* Counter used to generate aColCache[].lru values */
 
 
11060 struct yColCache {
11061 int iTable; /* Table cursor number */
11062 int iColumn; /* Table column number */
11063 u8 tempReg; /* iReg is a temp register that needs to be freed */
11064 int iLevel; /* Nesting level */
@@ -11072,65 +11065,67 @@
11065 int iReg; /* Reg with value of this column. 0 means none. */
11066 int lru; /* Least recently used entry has the smallest value */
11067 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
11068 yDbMask writeMask; /* Start a write transaction on these databases */
11069 yDbMask cookieMask; /* Bitmask of schema verified databases */
 
 
11070 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */
11071 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
11072 int regRowid; /* Register holding rowid of CREATE TABLE entry */
11073 int regRoot; /* Register holding root page number for new objects */
11074 int nMaxArg; /* Max args passed to user function by sub-program */
11075 #ifndef SQLITE_OMIT_SHARED_CACHE
11076 int nTableLock; /* Number of locks in aTableLock */
11077 TableLock *aTableLock; /* Required table locks for shared-cache mode */
11078 #endif
 
 
11079 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
 
11080
11081 /* Information used while coding trigger programs. */
11082 Parse *pToplevel; /* Parse structure for main program (or NULL) */
11083 Table *pTriggerTab; /* Table triggers are being coded for */
11084 double nQueryLoop; /* Estimated number of iterations of a query */
11085 u32 oldmask; /* Mask of old.* columns referenced */
11086 u32 newmask; /* Mask of new.* columns referenced */
11087 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
11088 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
11089 u8 disableTriggers; /* True to disable triggers */
 
11090
11091 /* Above is constant between recursions. Below is reset before and after
11092 ** each recursion */
11093
11094 int nVar; /* Number of '?' variables seen in the SQL so far */
11095 int nzVar; /* Number of available slots in azVar[] */
11096 u8 explain; /* True if the EXPLAIN flag is found on the query */
11097 #ifndef SQLITE_OMIT_VIRTUALTABLE
11098 u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
11099 int nVtabLock; /* Number of virtual tables to lock */
11100 #endif
11101 int nAlias; /* Number of aliased result set columns */
11102 int nHeight; /* Expression tree height of current sub-select */
11103 #ifndef SQLITE_OMIT_EXPLAIN
11104 int iSelectId; /* ID of current select for EXPLAIN output */
11105 int iNextSelectId; /* Next available select ID for EXPLAIN output */
11106 #endif
11107 char **azVar; /* Pointers to names of parameters */
11108 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
11109 int *aAlias; /* Register used to hold aliased result */
11110 const char *zTail; /* All SQL text past the last semicolon parsed */
11111 Table *pNewTable; /* A table being constructed by CREATE TABLE */
11112 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
11113 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
11114 Token sNameToken; /* Token with unqualified schema object name */
11115 Token sLastToken; /* The last token parsed */
11116 #ifndef SQLITE_OMIT_VIRTUALTABLE
11117 Token sArg; /* Complete text of a module argument */
11118 Table **apVtabLock; /* Pointer to virtual tables needing locking */
11119 #endif
11120 Table *pZombieTab; /* List of Table objects to delete after code gen */
11121 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
 
 
 
 
 
 
 
 
11122 };
11123
11124 /*
11125 ** Return true if currently inside an sqlite3_declare_vtab() call.
11126 */
11127 #ifdef SQLITE_OMIT_VIRTUALTABLE
11128 #define IN_DECLARE_VTAB 0
11129 #else
11130 #define IN_DECLARE_VTAB (pParse->declareVtab)
11131 #endif
@@ -11277,12 +11272,12 @@
11272 ** A pointer to this structure is used to communicate information
11273 ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
11274 */
11275 typedef struct {
11276 sqlite3 *db; /* The database being initialized */
 
11277 char **pzErrMsg; /* Error message stored here */
11278 int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
11279 int rc; /* Result code stored here */
11280 } InitData;
11281
11282 /*
11283 ** Structure containing global configuration data for the SQLite library.
@@ -11603,11 +11598,11 @@
11598 #else
11599 # define sqlite3AutoincrementBegin(X)
11600 # define sqlite3AutoincrementEnd(X)
11601 #endif
11602 SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
11603 SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
11604 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
11605 SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
11606 SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
11607 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
11608 SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
@@ -11841,11 +11836,11 @@
11836 #ifdef SQLITE_ENABLE_8_3_NAMES
11837 SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*);
11838 #else
11839 # define sqlite3FileSuffix3(X,Y)
11840 #endif
11841 SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,int);
11842
11843 SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
11844 SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
11845 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
11846 void(*)(void*));
@@ -11967,11 +11962,11 @@
11962 SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int);
11963 SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*);
11964 # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
11965 #endif
11966 SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
11967 SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int);
11968 SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*);
11969 SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*);
11970 SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*);
11971 SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
11972 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
@@ -12896,25 +12891,25 @@
12891 ** set to NULL if the currently executing frame is the main program.
12892 */
12893 typedef struct VdbeFrame VdbeFrame;
12894 struct VdbeFrame {
12895 Vdbe *v; /* VM this frame belongs to */
12896 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
12897 Op *aOp; /* Program instructions for parent frame */
 
12898 Mem *aMem; /* Array of memory cells for parent frame */
 
12899 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */
 
12900 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
 
12901 void *token; /* Copy of SubProgram.token */
12902 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
12903 u16 nCursor; /* Number of entries in apCsr */
12904 int pc; /* Program Counter in parent (calling) frame */
12905 int nOp; /* Size of aOp array */
12906 int nMem; /* Number of entries in aMem */
12907 int nOnceFlag; /* Number of entries in aOnceFlag */
12908 int nChildMem; /* Number of memory cells for child frame */
12909 int nChildCsr; /* Number of cursors for child frame */
 
12910 int nChange; /* Statement changes (Vdbe.nChanges) */
 
12911 };
12912
12913 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
12914
12915 /*
@@ -13037,12 +13032,13 @@
13032 struct sqlite3_context {
13033 FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
13034 VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */
13035 Mem s; /* The return value is stored here */
13036 Mem *pMem; /* Memory cell used to store aggregate context */
 
13037 CollSeq *pColl; /* Collating sequence */
13038 int isError; /* Error code returned by the function. */
13039 int skipFlag; /* Skip skip accumulator loading if true */
13040 };
13041
13042 /*
13043 ** An Explain object accumulates indented output which is helpful
13044 ** in describing recursive data structures.
@@ -13079,11 +13075,10 @@
13075 Mem *pResultSet; /* Pointer to an array of results */
13076 int nMem; /* Number of memory locations currently allocated */
13077 int nOp; /* Number of instructions in the program */
13078 int nOpAlloc; /* Number of slots allocated for aOp[] */
13079 int nLabel; /* Number of labels used */
 
13080 int *aLabel; /* Space to hold the labels */
13081 u16 nResColumn; /* Number of columns in one row of the result set */
13082 u16 nCursor; /* Number of slots in apCsr[] */
13083 u32 magic; /* Magic number for sanity checking */
13084 char *zErrMsg; /* Error message written here */
@@ -15146,11 +15141,39 @@
15141 ** This file contains low-level memory allocation drivers for when
15142 ** SQLite will use the standard C-library malloc/realloc/free interface
15143 ** to obtain the memory it needs.
15144 **
15145 ** This file contains implementations of the low-level memory allocation
15146 ** routines specified in the sqlite3_mem_methods object. The content of
15147 ** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The
15148 ** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the
15149 ** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The
15150 ** default configuration is to use memory allocation routines in this
15151 ** file.
15152 **
15153 ** C-preprocessor macro summary:
15154 **
15155 ** HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if
15156 ** the malloc_usable_size() interface exists
15157 ** on the target platform. Or, this symbol
15158 ** can be set manually, if desired.
15159 ** If an equivalent interface exists by
15160 ** a different name, using a separate -D
15161 ** option to rename it. This symbol will
15162 ** be enabled automatically on windows
15163 ** systems, and malloc_usable_size() will
15164 ** be redefined to _msize(), unless the
15165 ** SQLITE_WITHOUT_MSIZE macro is defined.
15166 **
15167 ** SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone
15168 ** memory allocator. Set this symbol to enable
15169 ** building on older macs.
15170 **
15171 ** SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of
15172 ** _msize() on windows systems. This might
15173 ** be necessary when compiling for Delphi,
15174 ** for example.
15175 */
15176
15177 /*
15178 ** This version of the memory allocator is the default. It is
15179 ** used when no other memory allocator is specified using compile-time
@@ -15157,21 +15180,25 @@
15180 ** macros.
15181 */
15182 #ifdef SQLITE_SYSTEM_MALLOC
15183
15184 /*
15185 ** Windows systems have malloc_usable_size() but it is called _msize().
15186 ** The use of _msize() is automatic, but can be disabled by compiling
15187 ** with -DSQLITE_WITHOUT_MSIZE
15188 */
15189 #if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN \
15190 && !defined(SQLITE_WITHOUT_MSIZE)
15191 # define HAVE_MALLOC_USABLE_SIZE 1
15192 # define SQLITE_MALLOCSIZE _msize
15193 #endif
15194
15195 #if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
15196
15197 /*
15198 ** Use the zone allocator available on apple products unless the
15199 ** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.
15200 */
15201 #include <sys/sysctl.h>
15202 #include <malloc/malloc.h>
15203 #include <libkern/OSAtomic.h>
15204 static malloc_zone_t* _sqliteZone_;
@@ -15182,21 +15209,24 @@
15209 (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))
15210
15211 #else /* if not __APPLE__ */
15212
15213 /*
15214 ** Use standard C library malloc and free on non-Apple systems.
15215 ** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
15216 */
15217 #define SQLITE_MALLOC(x) malloc(x)
15218 #define SQLITE_FREE(x) free(x)
15219 #define SQLITE_REALLOC(x,y) realloc((x),(y))
15220
15221 #ifdef HAVE_MALLOC_USABLE_SIZE
15222 # ifndef SQLITE_MALLOCSIZE
15223 # include <malloc.h>
15224 # define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
15225 # endif
15226 #else
15227 # undef SQLITE_MALLOCSIZE
15228 #endif
15229
15230 #endif /* __APPLE__ or not __APPLE__ */
15231
15232 /*
@@ -15314,11 +15344,11 @@
15344
15345 /*
15346 ** Initialize this module.
15347 */
15348 static int sqlite3MemInit(void *NotUsed){
15349 #if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
15350 int cpuCount;
15351 size_t len;
15352 if( _sqliteZone_ ){
15353 return SQLITE_OK;
15354 }
@@ -36786,20 +36816,19 @@
36816 int szExtra; /* Size of extra space in bytes */
36817 int bPurgeable; /* True if cache is purgeable */
36818 unsigned int nMin; /* Minimum number of pages reserved */
36819 unsigned int nMax; /* Configured "cache_size" value */
36820 unsigned int n90pct; /* nMax*9/10 */
36821 unsigned int iMaxKey; /* Largest key seen since xTruncate() */
36822
36823 /* Hash table of all pages. The following variables may only be accessed
36824 ** when the accessor is holding the PGroup mutex.
36825 */
36826 unsigned int nRecyclable; /* Number of pages in the LRU list */
36827 unsigned int nPage; /* Total number of pages in apHash */
36828 unsigned int nHash; /* Number of slots in apHash[] */
36829 PgHdr1 **apHash; /* Hash table for fast lookup by key */
 
 
36830 };
36831
36832 /*
36833 ** Each cache entry is represented by an instance of the following
36834 ** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of
@@ -36839,12 +36868,12 @@
36868 int nSlot; /* The number of pcache slots */
36869 int nReserve; /* Try to keep nFreeSlot above this */
36870 void *pStart, *pEnd; /* Bounds of pagecache malloc range */
36871 /* Above requires no mutex. Use mutex below for variable that follow. */
36872 sqlite3_mutex *mutex; /* Mutex for accessing the following: */
 
36873 PgFreeslot *pFree; /* Free page blocks */
36874 int nFreeSlot; /* Number of unused pcache slots */
36875 /* The following value requires a mutex to change. We skip the mutex on
36876 ** reading because (1) most platforms read a 32-bit integer atomically and
36877 ** (2) even if an incorrect value is read, no great harm is done since this
36878 ** is really just an optimization. */
36879 int bUnderPressure; /* True if low on PAGECACHE memory */
@@ -38898,11 +38927,10 @@
38927 struct Pager {
38928 sqlite3_vfs *pVfs; /* OS functions to use for IO */
38929 u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
38930 u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */
38931 u8 useJournal; /* Use a rollback journal on this file */
 
38932 u8 noSync; /* Do not sync the journal if true */
38933 u8 fullSync; /* Do extra syncs of the journal for robustness */
38934 u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */
38935 u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */
38936 u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
@@ -39146,11 +39174,11 @@
39174 break;
39175
39176 case PAGER_READER:
39177 assert( pPager->errCode==SQLITE_OK );
39178 assert( p->eLock!=UNKNOWN_LOCK );
39179 assert( p->eLock>=SHARED_LOCK );
39180 break;
39181
39182 case PAGER_WRITER_LOCKED:
39183 assert( p->eLock!=UNKNOWN_LOCK );
39184 assert( pPager->errCode==SQLITE_OK );
@@ -41355,11 +41383,11 @@
41383 ** if the database size is not available. The database size is not
41384 ** available from the WAL sub-system if the log file is empty or
41385 ** contains no valid committed transactions.
41386 */
41387 assert( pPager->eState==PAGER_OPEN );
41388 assert( pPager->eLock>=SHARED_LOCK );
41389 nPage = sqlite3WalDbsize(pPager->pWal);
41390
41391 /* If the database size was not available from the WAL sub-system,
41392 ** determine it based on the size of the database file. If the size
41393 ** of the database file is not an integer multiple of the page-size,
@@ -41410,11 +41438,11 @@
41438 ** other connection.
41439 */
41440 static int pagerOpenWalIfPresent(Pager *pPager){
41441 int rc = SQLITE_OK;
41442 assert( pPager->eState==PAGER_OPEN );
41443 assert( pPager->eLock>=SHARED_LOCK );
41444
41445 if( !pPager->tempFile ){
41446 int isWal; /* True if WAL file exists */
41447 Pgno nPage; /* Size of the database file */
41448
@@ -42573,11 +42601,11 @@
42601 ** along with each page reference. This space is available to the user
42602 ** via the sqlite3PagerGetExtra() API.
42603 **
42604 ** The flags argument is used to specify properties that affect the
42605 ** operation of the pager. It should be passed some bitwise combination
42606 ** of the PAGER_* flags.
42607 **
42608 ** The vfsFlags parameter is a bitmask to pass to the flags parameter
42609 ** of the xOpen() method of the supplied VFS when opening files.
42610 **
42611 ** If the pager object is allocated and the specified file opened
@@ -42604,11 +42632,10 @@
42632 int readOnly = 0; /* True if this is a read-only file */
42633 int journalFileSize; /* Bytes to allocate for each journal fd */
42634 char *zPathname = 0; /* Full path to database file */
42635 int nPathname = 0; /* Number of bytes in zPathname */
42636 int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
 
42637 int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
42638 u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
42639 const char *zUri = 0; /* URI args to copy */
42640 int nUri = 0; /* Number of bytes of URI args at *zUri */
42641
@@ -42811,11 +42838,10 @@
42838
42839 PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename));
42840 IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename))
42841
42842 pPager->useJournal = (u8)useJournal;
 
42843 /* pPager->stmtOpen = 0; */
42844 /* pPager->stmtInUse = 0; */
42845 /* pPager->nRef = 0; */
42846 /* pPager->stmtSize = 0; */
42847 /* pPager->stmtJSize = 0; */
@@ -43033,18 +43059,15 @@
43059
43060 if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
43061 int bHotJournal = 1; /* True if there exists a hot journal-file */
43062
43063 assert( !MEMDB );
43064
43065 rc = pager_wait_on_lock(pPager, SHARED_LOCK);
43066 if( rc!=SQLITE_OK ){
43067 assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );
43068 goto failed;
 
 
 
43069 }
43070
43071 /* If a journal file exists, and there is no RESERVED lock on the
43072 ** database file, then it either needs to be played back or deleted.
43073 */
@@ -45048,11 +45071,11 @@
45071 */
45072 static int pagerOpenWal(Pager *pPager){
45073 int rc = SQLITE_OK;
45074
45075 assert( pPager->pWal==0 && pPager->tempFile==0 );
45076 assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );
45077
45078 /* If the pager is already in exclusive-mode, the WAL module will use
45079 ** heap-memory for the wal-index instead of the VFS shared-memory
45080 ** implementation. Take the exclusive lock now, before opening the WAL
45081 ** file, to make sure this is safe.
@@ -48561,14 +48584,13 @@
48584 u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
48585 u16 cellOffset; /* Index in aData of first cell pointer */
48586 u16 nFree; /* Number of free bytes on the page */
48587 u16 nCell; /* Number of cells on this page, local and ovfl */
48588 u16 maskPage; /* Mask for page offset */
48589 u16 aiOvfl[5]; /* Insert the i-th overflow cell before the aiOvfl-th
48590 ** non-overflow cell */
48591 u8 *apOvfl[5]; /* Pointers to the body of overflow cells */
 
48592 BtShared *pBt; /* Pointer to BtShared that this page is part of */
48593 u8 *aData; /* Pointer to disk image of the page data */
48594 u8 *aDataEnd; /* One byte past the end of usable data */
48595 u8 *aCellIdx; /* The cell index area */
48596 DbPage *pDbPage; /* Pager page handle */
@@ -48772,10 +48794,13 @@
48794 struct BtCursor {
48795 Btree *pBtree; /* The Btree to which this cursor belongs */
48796 BtShared *pBt; /* The BtShared this cursor points to */
48797 BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
48798 struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
48799 #ifndef SQLITE_OMIT_INCRBLOB
48800 Pgno *aOverflow; /* Cache of overflow page locations */
48801 #endif
48802 Pgno pgnoRoot; /* The root page of this tree */
48803 sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */
48804 CellInfo info; /* A parse of the cell we are pointing at */
48805 i64 nKey; /* Size of pKey, or last integer key */
48806 void *pKey; /* Saved key that was cursor's last known position */
@@ -48783,11 +48808,10 @@
48808 u8 wrFlag; /* True if writable */
48809 u8 atLast; /* Cursor pointing to the last entry */
48810 u8 validNKey; /* True if info.nKey is valid */
48811 u8 eState; /* One of the CURSOR_XXX constants (see below) */
48812 #ifndef SQLITE_OMIT_INCRBLOB
 
48813 u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */
48814 #endif
48815 i16 iPage; /* Index of current page in apPage */
48816 u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */
48817 MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
@@ -48912,12 +48936,12 @@
48936 */
48937 typedef struct IntegrityCk IntegrityCk;
48938 struct IntegrityCk {
48939 BtShared *pBt; /* The tree being checked out */
48940 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
 
48941 int *anRef; /* Number of times each page is referenced */
48942 Pgno nPage; /* Number of pages in the database */
48943 int mxErr; /* Stop accumulating errors when this reaches zero */
48944 int nErr; /* Number of messages written to zErrMsg so far */
48945 int mallocFailed; /* A memory allocation error has occurred */
48946 StrAccum errMsg; /* Accumulate the error message text here */
48947 };
@@ -50073,16 +50097,14 @@
50097 static u8 *findOverflowCell(MemPage *pPage, int iCell){
50098 int i;
50099 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
50100 for(i=pPage->nOverflow-1; i>=0; i--){
50101 int k;
50102 k = pPage->aiOvfl[i];
 
 
50103 if( k<=iCell ){
50104 if( k==iCell ){
50105 return pPage->apOvfl[i];
50106 }
50107 iCell--;
50108 }
50109 }
50110 return findCell(pPage, iCell);
@@ -50892,15 +50914,12 @@
50914 ** when sqlite3BtreeClose() is called.
50915 **
50916 ** If zFilename is ":memory:" then an in-memory database is created
50917 ** that is automatically destroyed when it is closed.
50918 **
50919 ** The "flags" parameter is a bitmask that might contain bits like
50920 ** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY.
 
 
 
50921 **
50922 ** If the database is already opened in the same database connection
50923 ** and we are in shared cache mode, then the open will fail with an
50924 ** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared
50925 ** objects in the same database connection since doing so will lead
@@ -50943,13 +50962,10 @@
50962 assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );
50963
50964 /* A BTREE_SINGLE database is always a temporary and/or ephemeral */
50965 assert( (flags & BTREE_SINGLE)==0 || isTempDb );
50966
 
 
 
50967 if( isMemdb ){
50968 flags |= BTREE_MEMORY;
50969 }
50970 if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
50971 vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
@@ -53397,11 +53413,11 @@
53413 return SQLITE_CORRUPT_BKPT;
53414 }
53415 return SQLITE_OK;
53416 }
53417
53418 #if 0
53419 /*
53420 ** Page pParent is an internal (non-leaf) tree page. This function
53421 ** asserts that page number iChild is the left-child if the iIdx'th
53422 ** cell in page pParent. Or, if iIdx is equal to the total number of
53423 ** cells in pParent, that page number iChild is the right-child of
@@ -53430,15 +53446,25 @@
53446 static void moveToParent(BtCursor *pCur){
53447 assert( cursorHoldsMutex(pCur) );
53448 assert( pCur->eState==CURSOR_VALID );
53449 assert( pCur->iPage>0 );
53450 assert( pCur->apPage[pCur->iPage] );
53451
53452 /* UPDATE: It is actually possible for the condition tested by the assert
53453 ** below to be untrue if the database file is corrupt. This can occur if
53454 ** one cursor has modified page pParent while a reference to it is held
53455 ** by a second cursor. Which can only happen if a single page is linked
53456 ** into more than one b-tree structure in a corrupt database. */
53457 #if 0
53458 assertParentIndex(
53459 pCur->apPage[pCur->iPage-1],
53460 pCur->aiIdx[pCur->iPage-1],
53461 pCur->apPage[pCur->iPage]->pgno
53462 );
53463 #endif
53464 testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );
53465
53466 releasePage(pCur->apPage[pCur->iPage]);
53467 pCur->iPage--;
53468 pCur->info.nSize = 0;
53469 pCur->validNKey = 0;
53470 }
@@ -53904,11 +53930,17 @@
53930 pCur->skipNext = 0;
53931
53932 pPage = pCur->apPage[pCur->iPage];
53933 idx = ++pCur->aiIdx[pCur->iPage];
53934 assert( pPage->isInit );
53935
53936 /* If the database file is corrupt, it is possible for the value of idx
53937 ** to be invalid here. This can only occur if a second cursor modifies
53938 ** the page while cursor pCur is holding a reference to it. Which can
53939 ** only happen if the database is corrupt in such a way as to link the
53940 ** page into more than one b-tree structure. */
53941 testcase( idx>pPage->nCell );
53942
53943 pCur->info.nSize = 0;
53944 pCur->validNKey = 0;
53945 if( idx>=pPage->nCell ){
53946 if( !pPage->leaf ){
@@ -54714,11 +54746,11 @@
54746 ** content of the cell.
54747 **
54748 ** If the cell content will fit on the page, then put it there. If it
54749 ** will not fit, then make a copy of the cell content into pTemp if
54750 ** pTemp is not null. Regardless of pTemp, allocate a new entry
54751 ** in pPage->apOvfl[] and make it point to the cell content (either
54752 ** in pTemp or the original pCell) and also record its index.
54753 ** Allocating a new entry in pPage->aCell[] implies that
54754 ** pPage->nOverflow is incremented.
54755 **
54756 ** If nSkip is non-zero, then do not copy the first nSkip bytes of the
@@ -54748,11 +54780,12 @@
54780
54781 if( *pRC ) return;
54782
54783 assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
54784 assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 );
54785 assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
54786 assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
54787 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
54788 /* The cell should normally be sized correctly. However, when moving a
54789 ** malformed cell from a leaf page to an interior page, if the cell size
54790 ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size
54791 ** might be less than 8 (leaf-size + pointer) on the interior node. Hence
@@ -54765,13 +54798,13 @@
54798 }
54799 if( iChild ){
54800 put4byte(pCell, iChild);
54801 }
54802 j = pPage->nOverflow++;
54803 assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) );
54804 pPage->apOvfl[j] = pCell;
54805 pPage->aiOvfl[j] = (u16)i;
54806 }else{
54807 int rc = sqlite3PagerWrite(pPage->pDbPage);
54808 if( rc!=SQLITE_OK ){
54809 *pRC = rc;
54810 return;
@@ -54915,11 +54948,11 @@
54948 rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
54949
54950 if( rc==SQLITE_OK ){
54951
54952 u8 *pOut = &pSpace[4];
54953 u8 *pCell = pPage->apOvfl[0];
54954 u16 szCell = cellSizePtr(pPage, pCell);
54955 u8 *pStop;
54956
54957 assert( sqlite3PagerIswriteable(pNew->pDbPage) );
54958 assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
@@ -55025,11 +55058,11 @@
55058 ** parent page stored in the pointer map is page pTo. If pFrom contained
55059 ** any cells with overflow page pointers, then the corresponding pointer
55060 ** map entries are also updated so that the parent page is page pTo.
55061 **
55062 ** If pFrom is currently carrying any overflow cells (entries in the
55063 ** MemPage.apOvfl[] array), they are not copied to pTo.
55064 **
55065 ** Before returning, page pTo is reinitialized using btreeInitPage().
55066 **
55067 ** The performance of this function is not critical. It is only used by
55068 ** the balance_shallower() and balance_deeper() procedures, neither of
@@ -55162,11 +55195,11 @@
55195 ** this overflow cell is present, it must be the cell with
55196 ** index iParentIdx. This scenario comes about when this function
55197 ** is called (indirectly) from sqlite3BtreeDelete().
55198 */
55199 assert( pParent->nOverflow==0 || pParent->nOverflow==1 );
55200 assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
55201
55202 if( !aOvflSpace ){
55203 return SQLITE_NOMEM;
55204 }
55205
@@ -55209,12 +55242,12 @@
55242 goto balance_cleanup;
55243 }
55244 nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
55245 if( (i--)==0 ) break;
55246
55247 if( i+nxDiv==pParent->aiOvfl[0] && pParent->nOverflow ){
55248 apDiv[i] = pParent->apOvfl[0];
55249 pgno = get4byte(apDiv[i]);
55250 szNew[i] = cellSizePtr(pParent, apDiv[i]);
55251 pParent->nOverflow = 0;
55252 }else{
55253 apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);
@@ -55651,11 +55684,11 @@
55684 ** actually moved between pages. */
55685 MemPage *pNew = apNew[0];
55686 MemPage *pOld = apCopy[0];
55687 int nOverflow = pOld->nOverflow;
55688 int iNextOld = pOld->nCell + nOverflow;
55689 int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1);
55690 j = 0; /* Current 'old' sibling page */
55691 k = 0; /* Current 'new' sibling page */
55692 for(i=0; i<nCell; i++){
55693 int isDivider = 0;
55694 while( i==iNextOld ){
@@ -55665,18 +55698,18 @@
55698 assert( j+1 < ArraySize(apCopy) );
55699 pOld = apCopy[++j];
55700 iNextOld = i + !leafData + pOld->nCell + pOld->nOverflow;
55701 if( pOld->nOverflow ){
55702 nOverflow = pOld->nOverflow;
55703 iOverflow = i + !leafData + pOld->aiOvfl[0];
55704 }
55705 isDivider = !leafData;
55706 }
55707
55708 assert(nOverflow>0 || iOverflow<i );
55709 assert(nOverflow<2 || pOld->aiOvfl[0]==pOld->aiOvfl[1]-1);
55710 assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1);
55711 if( i==iOverflow ){
55712 isDivider = 1;
55713 if( (--nOverflow)>0 ){
55714 iOverflow++;
55715 }
@@ -55793,11 +55826,14 @@
55826 assert( pChild->nCell==pRoot->nCell );
55827
55828 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
55829
55830 /* Copy the overflow cells from pRoot to pChild */
55831 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
55832 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
55833 memcpy(pChild->apOvfl, pRoot->apOvfl,
55834 pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));
55835 pChild->nOverflow = pRoot->nOverflow;
55836
55837 /* Zero the contents of pRoot. Then install pChild as the right-child. */
55838 zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);
55839 put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);
@@ -55856,11 +55892,11 @@
55892 rc = sqlite3PagerWrite(pParent->pDbPage);
55893 if( rc==SQLITE_OK ){
55894 #ifndef SQLITE_OMIT_QUICKBALANCE
55895 if( pPage->hasData
55896 && pPage->nOverflow==1
55897 && pPage->aiOvfl[0]==pPage->nCell
55898 && pParent->pgno!=1
55899 && pParent->nCell==iIdx
55900 ){
55901 /* Call balance_quick() to create a new sibling of pPage on which
55902 ** to store the overflow cell. balance_quick() inserts a new cell
@@ -58277,10 +58313,11 @@
58313
58314 if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
58315 memcpy(pMem->zMalloc, pMem->z, pMem->n);
58316 }
58317 if( pMem->flags&MEM_Dyn && pMem->xDel ){
58318 assert( pMem->xDel!=SQLITE_DYNAMIC );
58319 pMem->xDel((void *)(pMem->z));
58320 }
58321
58322 pMem->z = pMem->zMalloc;
58323 if( pMem->z==0 ){
@@ -58456,10 +58493,11 @@
58493 sqlite3VdbeMemFinalize(p, p->u.pDef);
58494 assert( (p->flags & MEM_Agg)==0 );
58495 sqlite3VdbeMemRelease(p);
58496 }else if( p->flags&MEM_Dyn && p->xDel ){
58497 assert( (p->flags&MEM_RowSet)==0 );
58498 assert( p->xDel!=SQLITE_DYNAMIC );
58499 p->xDel((void *)p->z);
58500 p->xDel = 0;
58501 }else if( p->flags&MEM_RowSet ){
58502 sqlite3RowSetClear(p->u.pRowSet);
58503 }else if( p->flags&MEM_Frame ){
@@ -59573,18 +59611,15 @@
59611 ** Hence, a negative P2 value is a label that has yet to be resolved.
59612 **
59613 ** Zero is returned if a malloc() fails.
59614 */
59615 SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *p){
59616 int i = p->nLabel++;
 
59617 assert( p->magic==VDBE_MAGIC_INIT );
59618 if( (i & (i-1))==0 ){
59619 p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
59620 (i*2+1)*sizeof(p->aLabel[0]));
 
 
59621 }
59622 if( p->aLabel ){
59623 p->aLabel[i] = -1;
59624 }
59625 return -1-i;
@@ -61625,16 +61660,10 @@
61660 }else{
61661 sqlite3VdbeSetChanges(db, 0);
61662 }
61663 p->nChange = 0;
61664 }
 
 
 
 
 
 
61665
61666 /* Release the locks */
61667 sqlite3VdbeLeave(p);
61668 }
61669
@@ -66051,23 +66080,30 @@
66080 arithmetic_result_is_null:
66081 sqlite3VdbeMemSetNull(pOut);
66082 break;
66083 }
66084
66085 /* Opcode: CollSeq P1 * * P4
66086 **
66087 ** P4 is a pointer to a CollSeq struct. If the next call to a user function
66088 ** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will
66089 ** be returned. This is used by the built-in min(), max() and nullif()
66090 ** functions.
66091 **
66092 ** If P1 is not zero, then it is a register that a subsequent min() or
66093 ** max() aggregate will set to 1 if the current row is not the minimum or
66094 ** maximum. The P1 register is initialized to 0 by this instruction.
66095 **
66096 ** The interface used by the implementation of the aforementioned functions
66097 ** to retrieve the collation sequence set by this opcode is not available
66098 ** publicly, only to user functions defined in func.c.
66099 */
66100 case OP_CollSeq: {
66101 assert( pOp->p4type==P4_COLLSEQ );
66102 if( pOp->p1 ){
66103 sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0);
66104 }
66105 break;
66106 }
66107
66108 /* Opcode: Function P1 P2 P3 P4 P5
66109 **
@@ -67597,11 +67633,11 @@
67633 ** If a write-transaction is started and the Vdbe.usesStmtJournal flag is
67634 ** true (this flag is set if the Vdbe may modify more than one row and may
67635 ** throw an ABORT exception), a statement transaction may also be opened.
67636 ** More specifically, a statement transaction is opened iff the database
67637 ** connection is currently not in autocommit mode, or if there are other
67638 ** active statements. A statement transaction allows the changes made by this
67639 ** VDBE to be rolled back after an error without having to roll back the
67640 ** entire transaction. If no error is encountered, the statement transaction
67641 ** will automatically commit when the VDBE halts.
67642 **
67643 ** If P2 is zero, then a read-lock is obtained on the database file.
@@ -69641,10 +69677,11 @@
69677 if( rc==SQLITE_OK ) rc = u.by.initData.rc;
69678 sqlite3DbFree(db, u.by.zSql);
69679 db->init.busy = 0;
69680 }
69681 }
69682 if( rc ) sqlite3ResetInternalSchema(db, -1);
69683 if( rc==SQLITE_NOMEM ){
69684 goto no_mem;
69685 }
69686 break;
69687 }
@@ -69983,11 +70020,10 @@
70020 p->apCsr = (VdbeCursor **)&aMem[p->nMem+1];
70021 p->aOp = aOp = u.cc.pProgram->aOp;
70022 p->nOp = u.cc.pProgram->nOp;
70023 p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor];
70024 p->nOnceFlag = u.cc.pProgram->nOnce;
 
70025 pc = -1;
70026 memset(p->aOnceFlag, 0, p->nOnceFlag);
70027
70028 break;
70029 }
@@ -70178,10 +70214,11 @@
70214 u.cf.ctx.s.zMalloc = 0;
70215 u.cf.ctx.s.xDel = 0;
70216 u.cf.ctx.s.db = db;
70217 u.cf.ctx.isError = 0;
70218 u.cf.ctx.pColl = 0;
70219 u.cf.ctx.skipFlag = 0;
70220 if( u.cf.ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){
70221 assert( pOp>p->aOp );
70222 assert( pOp[-1].p4type==P4_COLLSEQ );
70223 assert( pOp[-1].opcode==OP_CollSeq );
70224 u.cf.ctx.pColl = pOp[-1].p4.pColl;
@@ -70189,10 +70226,15 @@
70226 (u.cf.ctx.pFunc->xStep)(&u.cf.ctx, u.cf.n, u.cf.apVal); /* IMP: R-24505-23230 */
70227 if( u.cf.ctx.isError ){
70228 sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&u.cf.ctx.s));
70229 rc = u.cf.ctx.isError;
70230 }
70231 if( u.cf.ctx.skipFlag ){
70232 assert( pOp[-1].opcode==OP_CollSeq );
70233 u.cf.i = pOp[-1].p1;
70234 if( u.cf.i ) sqlite3VdbeMemSetInt64(&aMem[u.cf.i], 1);
70235 }
70236
70237 sqlite3VdbeMemRelease(&u.cf.ctx.s);
70238
70239 break;
70240 }
@@ -71582,21 +71624,21 @@
71624 ** In other words, each time we advance to the next sorter element, log2(N)
71625 ** key comparison operations are required, where N is the number of segments
71626 ** being merged (rounded up to the next power of 2).
71627 */
71628 struct VdbeSorter {
 
 
 
 
71629 i64 iWriteOff; /* Current write offset within file pTemp1 */
71630 i64 iReadOff; /* Current read offset within file pTemp1 */
71631 int nInMemory; /* Current size of pRecord list as PMA */
71632 int nTree; /* Used size of aTree/aIter (power of 2) */
71633 int nPMA; /* Number of PMAs stored in pTemp1 */
 
71634 int mnPmaSize; /* Minimum PMA size, in bytes */
71635 int mxPmaSize; /* Maximum PMA size, in bytes. 0==no limit */
71636 VdbeSorterIter *aIter; /* Array of iterators to merge */
71637 int *aTree; /* Current state of incremental merge */
71638 sqlite3_file *pTemp1; /* PMA file 1 */
71639 SorterRecord *pRecord; /* Head of in-memory record list */
71640 UnpackedRecord *pUnpacked; /* Used to unpack keys */
71641 };
71642
71643 /*
71644 ** The following type is an iterator for a PMA. It caches the current key in
@@ -71603,14 +71645,14 @@
71645 ** variables nKey/aKey. If the iterator is at EOF, pFile==0.
71646 */
71647 struct VdbeSorterIter {
71648 i64 iReadOff; /* Current read offset */
71649 i64 iEof; /* 1 byte past EOF for this iterator */
 
71650 int nAlloc; /* Bytes of space at aAlloc */
 
71651 int nKey; /* Number of bytes in key */
71652 sqlite3_file *pFile; /* File iterator is reading from */
71653 u8 *aAlloc; /* Allocated space */
71654 u8 *aKey; /* Pointer to current key */
71655 };
71656
71657 /*
71658 ** A structure to store a single record. All in-memory records are connected
@@ -75093,12 +75135,13 @@
75135 int i;
75136 if( p==0 ) return 0;
75137 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
75138 if( pNew==0 ) return 0;
75139 pNew->iECursor = 0;
75140 pNew->nExpr = i = p->nExpr;
75141 if( (flags & EXPRDUP_REDUCE)==0 ) for(i=1; i<p->nExpr; i+=i){}
75142 pNew->a = pItem = sqlite3DbMallocRaw(db, i*sizeof(p->a[0]) );
75143 if( pItem==0 ){
75144 sqlite3DbFree(db, pNew);
75145 return 0;
75146 }
75147 pOldItem = p->a;
@@ -75162,16 +75205,19 @@
75205 IdList *pNew;
75206 int i;
75207 if( p==0 ) return 0;
75208 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
75209 if( pNew==0 ) return 0;
75210 pNew->nId = p->nId;
75211 pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );
75212 if( pNew->a==0 ){
75213 sqlite3DbFree(db, pNew);
75214 return 0;
75215 }
75216 /* Note that because the size of the allocation for p->a[] is not
75217 ** necessarily a power of two, sqlite3IdListAppend() may not be called
75218 ** on the duplicate created by this function. */
75219 for(i=0; i<p->nId; i++){
75220 struct IdList_item *pNewItem = &pNew->a[i];
75221 struct IdList_item *pOldItem = &p->a[i];
75222 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
75223 pNewItem->idx = pOldItem->idx;
@@ -75229,21 +75275,20 @@
75275 if( pList==0 ){
75276 pList = sqlite3DbMallocZero(db, sizeof(ExprList) );
75277 if( pList==0 ){
75278 goto no_mem;
75279 }
75280 pList->a = sqlite3DbMallocRaw(db, sizeof(pList->a[0]));
75281 if( pList->a==0 ) goto no_mem;
75282 }else if( (pList->nExpr & (pList->nExpr-1))==0 ){
75283 struct ExprList_item *a;
75284 assert( pList->nExpr>0 );
75285 a = sqlite3DbRealloc(db, pList->a, pList->nExpr*2*sizeof(pList->a[0]));
75286 if( a==0 ){
75287 goto no_mem;
75288 }
75289 pList->a = a;
 
75290 }
75291 assert( pList->a!=0 );
75292 if( 1 ){
75293 struct ExprList_item *pItem = &pList->a[pList->nExpr++];
75294 memset(pItem, 0, sizeof(*pItem));
@@ -75330,12 +75375,11 @@
75375 */
75376 SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
75377 int i;
75378 struct ExprList_item *pItem;
75379 if( pList==0 ) return;
75380 assert( pList->a!=0 || pList->nExpr==0 );
 
75381 for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
75382 sqlite3ExprDelete(db, pItem->pExpr);
75383 sqlite3DbFree(db, pItem->zName);
75384 sqlite3DbFree(db, pItem->zSpan);
75385 }
@@ -78012,13 +78056,11 @@
78056 int i;
78057 pInfo->aCol = sqlite3ArrayAllocate(
78058 db,
78059 pInfo->aCol,
78060 sizeof(pInfo->aCol[0]),
 
78061 &pInfo->nColumn,
 
78062 &i
78063 );
78064 return i;
78065 }
78066
@@ -78030,13 +78072,11 @@
78072 int i;
78073 pInfo->aFunc = sqlite3ArrayAllocate(
78074 db,
78075 pInfo->aFunc,
78076 sizeof(pInfo->aFunc[0]),
 
78077 &pInfo->nFunc,
 
78078 &i
78079 );
78080 return i;
78081 }
78082
@@ -78809,11 +78849,11 @@
78849 "name = CASE "
78850 "WHEN type='table' THEN %Q "
78851 "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
78852 "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
78853 "ELSE name END "
78854 "WHERE tbl_name=%Q COLLATE nocase AND "
78855 "(type='table' OR type='index' OR type='trigger');",
78856 zDb, SCHEMA_TABLE(iDb), zName, zName, zName,
78857 #ifndef SQLITE_OMIT_TRIGGER
78858 zName,
78859 #endif
@@ -82678,11 +82718,10 @@
82718 assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
82719 db->mallocFailed = 1;
82720 return;
82721 }
82722 pParse->pNewTable = 0;
 
82723 db->flags |= SQLITE_InternChanges;
82724
82725 #ifndef SQLITE_OMIT_ALTERTABLE
82726 if( !p->pSelect ){
82727 const char *zName = (const char *)pParse->sNameToken.z;
@@ -84099,31 +84138,27 @@
84138 */
84139 SQLITE_PRIVATE void *sqlite3ArrayAllocate(
84140 sqlite3 *db, /* Connection to notify of malloc failures */
84141 void *pArray, /* Array of objects. Might be reallocated */
84142 int szEntry, /* Size of each object in the array */
 
84143 int *pnEntry, /* Number of objects currently in use */
 
84144 int *pIdx /* Write the index of a new slot here */
84145 ){
84146 char *z;
84147 int n = *pnEntry;
84148 if( (n & (n-1))==0 ){
84149 int sz = (n==0) ? 1 : 2*n;
84150 void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);
 
84151 if( pNew==0 ){
84152 *pIdx = -1;
84153 return pArray;
84154 }
 
84155 pArray = pNew;
84156 }
84157 z = (char*)pArray;
84158 memset(&z[n * szEntry], 0, szEntry);
84159 *pIdx = n;
84160 ++*pnEntry;
84161 return pArray;
84162 }
84163
84164 /*
@@ -84135,19 +84170,16 @@
84170 SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){
84171 int i;
84172 if( pList==0 ){
84173 pList = sqlite3DbMallocZero(db, sizeof(IdList) );
84174 if( pList==0 ) return 0;
 
84175 }
84176 pList->a = sqlite3ArrayAllocate(
84177 db,
84178 pList->a,
84179 sizeof(pList->a[0]),
 
84180 &pList->nId,
 
84181 &i
84182 );
84183 if( i<0 ){
84184 sqlite3IdListDelete(db, pList);
84185 return 0;
@@ -86002,10 +86034,18 @@
86034 ** Return the collating function associated with a function.
86035 */
86036 static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
86037 return context->pColl;
86038 }
86039
86040 /*
86041 ** Indicate that the accumulator load should be skipped on this
86042 ** iteration of the aggregate loop.
86043 */
86044 static void sqlite3SkipAccumulatorLoad(sqlite3_context *context){
86045 context->skipFlag = 1;
86046 }
86047
86048 /*
86049 ** Implementation of the non-aggregate min() and max() functions
86050 */
86051 static void minmaxFunc(
@@ -87309,15 +87349,16 @@
87349 ){
87350 Mem *pArg = (Mem *)argv[0];
87351 Mem *pBest;
87352 UNUSED_PARAMETER(NotUsed);
87353
 
87354 pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
87355 if( !pBest ) return;
87356
87357 if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
87358 if( pBest->flags ) sqlite3SkipAccumulatorLoad(context);
87359 }else if( pBest->flags ){
87360 int max;
87361 int cmp;
87362 CollSeq *pColl = sqlite3GetFuncCollSeq(context);
87363 /* This step function is used for both the min() and max() aggregates,
87364 ** the only difference between the two being that the sense of the
@@ -87329,20 +87370,22 @@
87370 */
87371 max = sqlite3_user_data(context)!=0;
87372 cmp = sqlite3MemCompare(pBest, pArg, pColl);
87373 if( (max && cmp<0) || (!max && cmp>0) ){
87374 sqlite3VdbeMemCopy(pBest, pArg);
87375 }else{
87376 sqlite3SkipAccumulatorLoad(context);
87377 }
87378 }else{
87379 sqlite3VdbeMemCopy(pBest, pArg);
87380 }
87381 }
87382 static void minMaxFinalize(sqlite3_context *context){
87383 sqlite3_value *pRes;
87384 pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);
87385 if( pRes ){
87386 if( pRes->flags ){
87387 sqlite3_result_value(context, pRes);
87388 }
87389 sqlite3VdbeMemRelease(pRes);
87390 }
87391 }
@@ -91920,18 +91963,19 @@
91963 */
91964
91965 /*
91966 ** Interpret the given string as a safety level. Return 0 for OFF,
91967 ** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
91968 ** unrecognized string argument. The FULL option is disallowed
91969 ** if the omitFull parameter it 1.
91970 **
91971 ** Note that the values returned are one less that the values that
91972 ** should be passed into sqlite3BtreeSetSafetyLevel(). The is done
91973 ** to support legacy SQL code. The safety level used to be boolean
91974 ** and older scripts may have used numbers 0 for OFF and 1 for ON.
91975 */
91976 static u8 getSafetyLevel(const char *z, int omitFull, int dflt){
91977 /* 123456789 123456789 */
91978 static const char zText[] = "onoffalseyestruefull";
91979 static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
91980 static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
91981 static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2};
@@ -91938,23 +91982,23 @@
91982 int i, n;
91983 if( sqlite3Isdigit(*z) ){
91984 return (u8)sqlite3Atoi(z);
91985 }
91986 n = sqlite3Strlen30(z);
91987 for(i=0; i<ArraySize(iLength)-omitFull; i++){
91988 if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
91989 return iValue[i];
91990 }
91991 }
91992 return dflt;
91993 }
91994
91995 /*
91996 ** Interpret the given string as a boolean value.
91997 */
91998 SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z, int dflt){
91999 return getSafetyLevel(z,1,dflt)!=0;
92000 }
92001
92002 /* The sqlite3GetBoolean() function is used by other modules but the
92003 ** remainder of this file is specific to PRAGMA processing. So omit
92004 ** the rest of the file if PRAGMAs are omitted from the build.
@@ -92093,11 +92137,10 @@
92137 #ifndef SQLITE_OMIT_CHECK
92138 { "ignore_check_constraints", SQLITE_IgnoreChecks },
92139 #endif
92140 /* The following is VERY experimental */
92141 { "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode },
 
92142
92143 /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
92144 ** flag if there are any active statements. */
92145 { "read_uncommitted", SQLITE_ReadUncommitted },
92146 { "recursive_triggers", SQLITE_RecTriggers },
@@ -92125,11 +92168,11 @@
92168 /* Foreign key support may not be enabled or disabled while not
92169 ** in auto-commit mode. */
92170 mask &= ~(SQLITE_ForeignKeys);
92171 }
92172
92173 if( sqlite3GetBoolean(zRight, 0) ){
92174 db->flags |= mask;
92175 }else{
92176 db->flags &= ~mask;
92177 }
92178
@@ -92341,11 +92384,11 @@
92384 if( sqlite3StrICmp(zLeft,"secure_delete")==0 ){
92385 Btree *pBt = pDb->pBt;
92386 int b = -1;
92387 assert( pBt!=0 );
92388 if( zRight ){
92389 b = sqlite3GetBoolean(zRight, 0);
92390 }
92391 if( pId2->n==0 && b>=0 ){
92392 int ii;
92393 for(ii=0; ii<db->nDb; ii++){
92394 sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -92746,11 +92789,11 @@
92789 }else{
92790 if( !db->autoCommit ){
92791 sqlite3ErrorMsg(pParse,
92792 "Safety level may not be changed inside a transaction");
92793 }else{
92794 pDb->safety_level = getSafetyLevel(zRight,0,1)+1;
92795 }
92796 }
92797 }else
92798 #endif /* SQLITE_OMIT_PAGER_PRAGMAS */
92799
@@ -92945,11 +92988,11 @@
92988 #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
92989
92990 #ifndef NDEBUG
92991 if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
92992 if( zRight ){
92993 if( sqlite3GetBoolean(zRight, 0) ){
92994 sqlite3ParserTrace(stderr, "parser: ");
92995 }else{
92996 sqlite3ParserTrace(0, 0);
92997 }
92998 }
@@ -92959,11 +93002,11 @@
93002 /* Reinstall the LIKE and GLOB functions. The variant of LIKE
93003 ** used will be case sensitive or not depending on the RHS.
93004 */
93005 if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
93006 if( zRight ){
93007 sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
93008 }
93009 }else
93010
93011 #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
93012 # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
@@ -94385,10 +94428,11 @@
94428 }
94429 if( pEList==0 ){
94430 pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0));
94431 }
94432 pNew->pEList = pEList;
94433 if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));
94434 pNew->pSrc = pSrc;
94435 pNew->pWhere = pWhere;
94436 pNew->pGroupBy = pGroupBy;
94437 pNew->pHaving = pHaving;
94438 pNew->pOrderBy = pOrderBy;
@@ -95923,12 +95967,16 @@
95967 /* Make sure all SELECTs in the statement have the same number of elements
95968 ** in their result sets.
95969 */
95970 assert( p->pEList && pPrior->pEList );
95971 if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
95972 if( p->selFlags & SF_Values ){
95973 sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms");
95974 }else{
95975 sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
95976 " do not have the same number of result columns", selectOpName(p->op));
95977 }
95978 rc = 1;
95979 goto multi_select_end;
95980 }
95981
95982 /* Compound SELECTs that have an ORDER BY clause are handled separately.
@@ -96540,11 +96588,11 @@
96588 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
96589 if( pNew==0 ) return SQLITE_NOMEM;
96590 pNew->flags |= EP_IntValue;
96591 pNew->u.iValue = i;
96592 pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
96593 if( pOrderBy ) pOrderBy->a[nOrderBy++].iOrderByCol = (u16)i;
96594 }
96595 }
96596 }
96597
96598 /* Compute the comparison permutation and keyinfo that is used with
@@ -97903,10 +97951,12 @@
97951 ** the current cursor position.
97952 */
97953 static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
97954 Vdbe *v = pParse->pVdbe;
97955 int i;
97956 int regHit = 0;
97957 int addrHitTest = 0;
97958 struct AggInfo_func *pF;
97959 struct AggInfo_col *pC;
97960
97961 pAggInfo->directMode = 1;
97962 sqlite3ExprCacheClear(pParse);
@@ -97938,11 +97988,12 @@
97988 pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
97989 }
97990 if( !pColl ){
97991 pColl = pParse->db->pDfltColl;
97992 }
97993 if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;
97994 sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
97995 }
97996 sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,
97997 (void*)pF->pFunc, P4_FUNCDEF);
97998 sqlite3VdbeChangeP5(v, (u8)nArg);
97999 sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
@@ -97961,16 +98012,22 @@
98012 ** text or blob value. See ticket [883034dcb5].
98013 **
98014 ** Another solution would be to change the OP_SCopy used to copy cached
98015 ** values to an OP_Copy.
98016 */
98017 if( regHit ){
98018 addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit);
98019 }
98020 sqlite3ExprCacheClear(pParse);
98021 for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
98022 sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
98023 }
98024 pAggInfo->directMode = 0;
98025 sqlite3ExprCacheClear(pParse);
98026 if( addrHitTest ){
98027 sqlite3VdbeJumpHere(v, addrHitTest);
98028 }
98029 }
98030
98031 /*
98032 ** Add a single OP_Explain instruction to the VDBE to explain a simple
98033 ** count(*) query ("SELECT count(*) FROM pTab").
@@ -98907,11 +98964,11 @@
98964 sqlite3ExplainPop(pVdbe);
98965 }
98966
98967 /* End of the structure debug printing code
98968 *****************************************************************************/
98969 #endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */
98970
98971 /************** End of select.c **********************************************/
98972 /************** Begin file table.c *******************************************/
98973 /*
98974 ** 2001 September 15
@@ -101534,17 +101591,18 @@
101591 */
101592 SQLITE_PRIVATE void sqlite3VtabBeginParse(
101593 Parse *pParse, /* Parsing context */
101594 Token *pName1, /* Name of new table, or database name */
101595 Token *pName2, /* Name of new table or NULL */
101596 Token *pModuleName, /* Name of the module for the virtual table */
101597 int ifNotExists /* No error if the table already exists */
101598 ){
101599 int iDb; /* The database the table is being created in */
101600 Table *pTable; /* The new virtual table */
101601 sqlite3 *db; /* Database connection */
101602
101603 sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists);
101604 pTable = pParse->pNewTable;
101605 if( pTable==0 ) return;
101606 assert( 0==pTable->pIndex );
101607
101608 db = pParse->db;
@@ -101575,11 +101633,11 @@
101633 ** This routine takes the module argument that has been accumulating
101634 ** in pParse->zArg[] and appends it to the list of arguments on the
101635 ** virtual table currently under construction in pParse->pTable.
101636 */
101637 static void addArgumentToVtab(Parse *pParse){
101638 if( pParse->sArg.z && pParse->pNewTable ){
101639 const char *z = (const char*)pParse->sArg.z;
101640 int n = pParse->sArg.n;
101641 sqlite3 *db = pParse->db;
101642 addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));
101643 }
@@ -107620,10 +107678,18 @@
107678 /*
107679 ** An instance of this structure holds the ATTACH key and the key type.
107680 */
107681 struct AttachKey { int type; Token key; };
107682
107683 /*
107684 ** One or more VALUES claues
107685 */
107686 struct ValueList {
107687 ExprList *pList;
107688 Select *pSelect;
107689 };
107690
107691
107692 /* This is a utility routine used to set the ExprSpan.zStart and
107693 ** ExprSpan.zEnd values of pOut so that the span covers the complete
107694 ** range of text beginning with pStart and going to the end of pEnd.
107695 */
@@ -107743,40 +107809,41 @@
107809 ** YYNRULE the number of rules in the grammar
107810 ** YYERRORSYMBOL is the code number of the error symbol. If not
107811 ** defined, then do no error processing.
107812 */
107813 #define YYCODETYPE unsigned char
107814 #define YYNOCODE 251
107815 #define YYACTIONTYPE unsigned short int
107816 #define YYWILDCARD 67
107817 #define sqlite3ParserTOKENTYPE Token
107818 typedef union {
107819 int yyinit;
107820 sqlite3ParserTOKENTYPE yy0;
107821 struct LimitVal yy64;
107822 Expr* yy122;
107823 Select* yy159;
107824 IdList* yy180;
107825 struct {int value; int mask;} yy207;
107826 u8 yy258;
107827 struct LikeOp yy318;
107828 TriggerStep* yy327;
107829 ExprSpan yy342;
107830 SrcList* yy347;
107831 int yy392;
107832 struct TrigEvent yy410;
107833 ExprList* yy442;
107834 struct ValueList yy487;
107835 } YYMINORTYPE;
107836 #ifndef YYSTACKDEPTH
107837 #define YYSTACKDEPTH 100
107838 #endif
107839 #define sqlite3ParserARG_SDECL Parse *pParse;
107840 #define sqlite3ParserARG_PDECL ,Parse *pParse
107841 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
107842 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
107843 #define YYNSTATE 629
107844 #define YYNRULE 327
107845 #define YYFALLBACK 1
107846 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
107847 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
107848 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
107849
@@ -107842,477 +107909,480 @@
107909 ** shifting terminals.
107910 ** yy_reduce_ofst[] For each state, the offset into yy_action for
107911 ** shifting non-terminals after a reduce.
107912 ** yy_default[] Default action for each state.
107913 */
107914 #define YY_ACTTAB_COUNT (1580)
107915 static const YYACTIONTYPE yy_action[] = {
107916 /* 0 */ 310, 328, 574, 573, 15, 172, 187, 596, 56, 56,
107917 /* 10 */ 56, 56, 49, 54, 54, 54, 54, 53, 53, 52,
107918 /* 20 */ 52, 52, 51, 234, 622, 621, 626, 622, 621, 299,
107919 /* 30 */ 589, 583, 56, 56, 56, 56, 236, 54, 54, 54,
107920 /* 40 */ 54, 53, 53, 52, 52, 52, 51, 234, 351, 57,
107921 /* 50 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107922 /* 60 */ 56, 56, 570, 54, 54, 54, 54, 53, 53, 52,
107923 /* 70 */ 52, 52, 51, 234, 310, 596, 326, 607, 233, 232,
107924 /* 80 */ 33, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107925 /* 90 */ 51, 234, 619, 618, 326, 619, 618, 166, 605, 492,
107926 /* 100 */ 381, 378, 377, 235, 589, 583, 554, 495, 1, 59,
107927 /* 110 */ 19, 376, 622, 621, 53, 53, 52, 52, 52, 51,
107928 /* 120 */ 234, 571, 571, 57, 58, 48, 581, 580, 582, 582,
107929 /* 130 */ 55, 55, 56, 56, 56, 56, 215, 54, 54, 54,
107930 /* 140 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 224,
107931 /* 150 */ 50, 47, 147, 177, 139, 281, 384, 276, 383, 169,
107932 /* 160 */ 408, 553, 578, 578, 622, 621, 272, 224, 439, 550,
107933 /* 170 */ 552, 410, 139, 281, 384, 276, 383, 169, 589, 583,
107934 /* 180 */ 619, 618, 280, 620, 272, 195, 413, 309, 440, 441,
107935 /* 190 */ 567, 491, 214, 279, 560, 600, 92, 57, 58, 48,
107936 /* 200 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
107937 /* 210 */ 559, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107938 /* 220 */ 51, 234, 310, 464, 233, 232, 558, 133, 519, 50,
107939 /* 230 */ 47, 147, 619, 618, 565, 436, 397, 515, 514, 518,
107940 /* 240 */ 410, 387, 438, 389, 437, 622, 621, 442, 570, 433,
107941 /* 250 */ 203, 390, 589, 583, 6, 413, 166, 670, 250, 381,
107942 /* 260 */ 378, 377, 525, 190, 600, 92, 594, 571, 571, 465,
107943 /* 270 */ 376, 57, 58, 48, 581, 580, 582, 582, 55, 55,
107944 /* 280 */ 56, 56, 56, 56, 599, 54, 54, 54, 54, 53,
107945 /* 290 */ 53, 52, 52, 52, 51, 234, 310, 592, 592, 592,
107946 /* 300 */ 490, 182, 247, 548, 249, 397, 273, 410, 7, 439,
107947 /* 310 */ 398, 606, 67, 619, 618, 620, 472, 256, 347, 255,
107948 /* 320 */ 473, 620, 413, 576, 620, 65, 589, 583, 236, 440,
107949 /* 330 */ 336, 600, 92, 68, 364, 192, 481, 622, 621, 547,
107950 /* 340 */ 622, 621, 560, 323, 207, 57, 58, 48, 581, 580,
107951 /* 350 */ 582, 582, 55, 55, 56, 56, 56, 56, 559, 54,
107952 /* 360 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
107953 /* 370 */ 310, 410, 397, 146, 558, 531, 401, 348, 599, 166,
107954 /* 380 */ 248, 204, 381, 378, 377, 541, 413, 171, 337, 570,
107955 /* 390 */ 622, 621, 40, 376, 38, 600, 74, 465, 548, 490,
107956 /* 400 */ 589, 583, 532, 350, 579, 619, 618, 297, 619, 618,
107957 /* 410 */ 480, 67, 470, 39, 620, 599, 406, 574, 573, 57,
107958 /* 420 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107959 /* 430 */ 56, 56, 577, 54, 54, 54, 54, 53, 53, 52,
107960 /* 440 */ 52, 52, 51, 234, 310, 256, 347, 255, 530, 52,
107961 /* 450 */ 52, 52, 51, 234, 345, 564, 236, 386, 619, 618,
107962 /* 460 */ 957, 185, 418, 2, 408, 410, 578, 578, 198, 197,
107963 /* 470 */ 196, 499, 183, 167, 589, 583, 671, 570, 505, 506,
107964 /* 480 */ 413, 267, 601, 672, 546, 208, 602, 36, 601, 600,
107965 /* 490 */ 91, 468, 602, 57, 58, 48, 581, 580, 582, 582,
107966 /* 500 */ 55, 55, 56, 56, 56, 56, 202, 54, 54, 54,
107967 /* 510 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 599,
107968 /* 520 */ 157, 408, 527, 578, 578, 263, 490, 265, 410, 873,
107969 /* 530 */ 410, 474, 474, 366, 373, 410, 504, 428, 67, 290,
107970 /* 540 */ 599, 620, 352, 413, 408, 413, 578, 578, 589, 583,
107971 /* 550 */ 413, 382, 600, 92, 600, 16, 543, 62, 503, 600,
107972 /* 560 */ 92, 408, 346, 578, 578, 168, 45, 57, 58, 48,
107973 /* 570 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
107974 /* 580 */ 200, 54, 54, 54, 54, 53, 53, 52, 52, 52,
107975 /* 590 */ 51, 234, 310, 393, 395, 534, 510, 617, 616, 615,
107976 /* 600 */ 318, 314, 172, 66, 596, 410, 338, 596, 324, 571,
107977 /* 610 */ 571, 50, 47, 147, 599, 629, 627, 330, 539, 315,
107978 /* 620 */ 413, 30, 589, 583, 272, 236, 199, 144, 176, 600,
107979 /* 630 */ 73, 420, 947, 620, 947, 420, 946, 351, 946, 175,
107980 /* 640 */ 596, 57, 58, 48, 581, 580, 582, 582, 55, 55,
107981 /* 650 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53,
107982 /* 660 */ 53, 52, 52, 52, 51, 234, 310, 261, 410, 413,
107983 /* 670 */ 269, 208, 596, 363, 410, 596, 424, 360, 600, 69,
107984 /* 680 */ 424, 327, 620, 413, 50, 47, 147, 410, 358, 413,
107985 /* 690 */ 575, 553, 600, 94, 483, 509, 589, 583, 600, 97,
107986 /* 700 */ 552, 484, 413, 620, 188, 599, 551, 563, 596, 566,
107987 /* 710 */ 334, 600, 95, 205, 201, 57, 58, 48, 581, 580,
107988 /* 720 */ 582, 582, 55, 55, 56, 56, 56, 56, 352, 54,
107989 /* 730 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
107990 /* 740 */ 310, 410, 261, 410, 167, 22, 356, 599, 359, 623,
107991 /* 750 */ 50, 47, 147, 548, 357, 562, 413, 620, 413, 332,
107992 /* 760 */ 523, 270, 410, 167, 620, 600, 104, 600, 103, 603,
107993 /* 770 */ 589, 583, 339, 539, 304, 423, 222, 413, 174, 304,
107994 /* 780 */ 422, 561, 567, 405, 214, 260, 600, 106, 620, 57,
107995 /* 790 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56,
107996 /* 800 */ 56, 56, 410, 54, 54, 54, 54, 53, 53, 52,
107997 /* 810 */ 52, 52, 51, 234, 310, 410, 557, 413, 410, 421,
107998 /* 820 */ 273, 35, 512, 146, 421, 12, 600, 107, 213, 144,
107999 /* 830 */ 413, 410, 32, 413, 410, 620, 365, 353, 358, 600,
108000 /* 840 */ 134, 11, 600, 135, 589, 583, 413, 21, 548, 413,
108001 /* 850 */ 316, 148, 620, 620, 170, 600, 98, 223, 600, 102,
108002 /* 860 */ 374, 168, 167, 57, 58, 48, 581, 580, 582, 582,
108003 /* 870 */ 55, 55, 56, 56, 56, 56, 410, 54, 54, 54,
108004 /* 880 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 410,
108005 /* 890 */ 273, 413, 410, 273, 212, 469, 410, 167, 628, 2,
108006 /* 900 */ 600, 101, 545, 221, 413, 620, 130, 413, 620, 410,
108007 /* 910 */ 539, 413, 537, 600, 93, 315, 600, 100, 589, 583,
108008 /* 920 */ 600, 77, 425, 305, 413, 620, 254, 322, 599, 458,
108009 /* 930 */ 320, 171, 543, 600, 96, 521, 520, 57, 58, 48,
108010 /* 940 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56,
108011 /* 950 */ 410, 54, 54, 54, 54, 53, 53, 52, 52, 52,
108012 /* 960 */ 51, 234, 310, 410, 273, 413, 410, 457, 358, 35,
108013 /* 970 */ 426, 230, 306, 319, 600, 138, 467, 520, 413, 620,
108014 /* 980 */ 143, 413, 410, 620, 410, 353, 529, 600, 137, 142,
108015 /* 990 */ 600, 136, 589, 583, 604, 261, 528, 413, 229, 413,
108016 /* 1000 */ 620, 321, 495, 28, 543, 543, 600, 76, 600, 90,
108017 /* 1010 */ 620, 57, 46, 48, 581, 580, 582, 582, 55, 55,
108018 /* 1020 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53,
108019 /* 1030 */ 53, 52, 52, 52, 51, 234, 310, 261, 451, 413,
108020 /* 1040 */ 410, 211, 611, 285, 283, 610, 609, 502, 600, 89,
108021 /* 1050 */ 380, 217, 620, 128, 140, 413, 220, 620, 410, 409,
108022 /* 1060 */ 620, 620, 588, 587, 600, 75, 589, 583, 271, 620,
108023 /* 1070 */ 51, 234, 127, 413, 620, 599, 627, 330, 27, 375,
108024 /* 1080 */ 449, 279, 600, 88, 585, 584, 58, 48, 581, 580,
108025 /* 1090 */ 582, 582, 55, 55, 56, 56, 56, 56, 410, 54,
108026 /* 1100 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234,
108027 /* 1110 */ 310, 586, 410, 413, 410, 261, 593, 165, 399, 556,
108028 /* 1120 */ 126, 371, 600, 87, 478, 186, 123, 413, 367, 413,
108029 /* 1130 */ 620, 620, 410, 620, 620, 410, 600, 99, 600, 86,
108030 /* 1140 */ 589, 583, 475, 122, 258, 171, 471, 413, 160, 121,
108031 /* 1150 */ 413, 14, 159, 463, 25, 24, 600, 17, 448, 600,
108032 /* 1160 */ 85, 48, 581, 580, 582, 582, 55, 55, 56, 56,
108033 /* 1170 */ 56, 56, 158, 54, 54, 54, 54, 53, 53, 52,
108034 /* 1180 */ 52, 52, 51, 234, 44, 404, 261, 3, 544, 261,
108035 /* 1190 */ 540, 414, 621, 460, 119, 118, 538, 275, 10, 349,
108036 /* 1200 */ 4, 620, 407, 620, 620, 620, 116, 44, 404, 410,
108037 /* 1210 */ 3, 620, 620, 410, 414, 621, 456, 454, 252, 450,
108038 /* 1220 */ 508, 402, 111, 109, 413, 407, 155, 444, 413, 447,
108039 /* 1230 */ 435, 565, 219, 600, 84, 620, 108, 600, 83, 64,
108040 /* 1240 */ 434, 417, 625, 150, 402, 333, 410, 237, 238, 124,
108041 /* 1250 */ 274, 41, 42, 533, 565, 206, 189, 261, 43, 412,
108042 /* 1260 */ 411, 413, 261, 594, 488, 620, 329, 149, 419, 268,
108043 /* 1270 */ 600, 72, 620, 266, 41, 42, 181, 620, 410, 620,
108044 /* 1280 */ 105, 43, 412, 411, 620, 624, 594, 614, 620, 599,
108045 /* 1290 */ 228, 125, 313, 413, 592, 592, 592, 591, 590, 13,
108046 /* 1300 */ 218, 410, 600, 71, 236, 244, 44, 404, 264, 3,
108047 /* 1310 */ 312, 613, 340, 414, 621, 180, 413, 592, 592, 592,
108048 /* 1320 */ 591, 590, 13, 620, 407, 600, 82, 410, 416, 34,
108049 /* 1330 */ 404, 410, 3, 410, 262, 410, 414, 621, 612, 331,
108050 /* 1340 */ 178, 415, 413, 402, 8, 236, 413, 407, 413, 620,
108051 /* 1350 */ 413, 600, 81, 565, 257, 600, 80, 600, 70, 600,
108052 /* 1360 */ 18, 598, 361, 462, 461, 30, 402, 294, 31, 620,
108053 /* 1370 */ 293, 354, 251, 41, 42, 410, 565, 620, 620, 620,
108054 /* 1380 */ 43, 412, 411, 453, 396, 594, 620, 620, 394, 61,
108055 /* 1390 */ 413, 292, 443, 622, 621, 243, 41, 42, 620, 600,
108056 /* 1400 */ 79, 597, 291, 43, 412, 411, 60, 620, 594, 240,
108057 /* 1410 */ 620, 410, 231, 37, 555, 173, 592, 592, 592, 591,
108058 /* 1420 */ 590, 13, 216, 239, 620, 184, 413, 302, 301, 300,
108059 /* 1430 */ 179, 298, 388, 565, 452, 600, 78, 286, 620, 592,
108060 /* 1440 */ 592, 592, 591, 590, 13, 429, 29, 413, 151, 289,
108061 /* 1450 */ 242, 145, 392, 194, 193, 288, 600, 9, 542, 241,
108062 /* 1460 */ 620, 525, 391, 284, 620, 594, 620, 620, 522, 536,
108063 /* 1470 */ 620, 535, 153, 385, 465, 516, 282, 325, 154, 517,
108064 /* 1480 */ 277, 152, 512, 511, 513, 129, 226, 308, 487, 486,
108065 /* 1490 */ 485, 164, 372, 493, 307, 227, 592, 592, 592, 225,
108066 /* 1500 */ 479, 163, 368, 370, 162, 476, 210, 477, 26, 259,
108067 /* 1510 */ 161, 466, 362, 141, 132, 120, 117, 455, 156, 115,
108068 /* 1520 */ 344, 343, 256, 342, 245, 114, 113, 446, 311, 112,
108069 /* 1530 */ 23, 317, 432, 236, 131, 431, 110, 430, 20, 427,
108070 /* 1540 */ 608, 595, 295, 63, 379, 287, 509, 191, 278, 403,
108071 /* 1550 */ 572, 569, 497, 498, 496, 494, 335, 459, 445, 303,
108072 /* 1560 */ 296, 246, 341, 355, 5, 568, 369, 507, 253, 549,
108073 /* 1570 */ 526, 209, 400, 501, 500, 524, 234, 958, 489, 482,
108074 };
108075 static const YYCODETYPE yy_lookahead[] = {
108076 /* 0 */ 19, 169, 170, 171, 22, 24, 24, 26, 77, 78,
108077 /* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
108078 /* 20 */ 89, 90, 91, 92, 26, 27, 1, 26, 27, 15,
108079 /* 30 */ 49, 50, 77, 78, 79, 80, 116, 82, 83, 84,
108080 /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 128, 68,
108081 /* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108082 /* 60 */ 79, 80, 230, 82, 83, 84, 85, 86, 87, 88,
108083 /* 70 */ 89, 90, 91, 92, 19, 94, 19, 23, 86, 87,
108084 /* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108085 /* 90 */ 91, 92, 94, 95, 19, 94, 95, 96, 172, 173,
108086 /* 100 */ 99, 100, 101, 197, 49, 50, 177, 181, 22, 54,
108087 /* 110 */ 204, 110, 26, 27, 86, 87, 88, 89, 90, 91,
108088 /* 120 */ 92, 129, 130, 68, 69, 70, 71, 72, 73, 74,
108089 /* 130 */ 75, 76, 77, 78, 79, 80, 22, 82, 83, 84,
108090 /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 92,
108091 /* 150 */ 221, 222, 223, 96, 97, 98, 99, 100, 101, 102,
108092 /* 160 */ 112, 32, 114, 115, 26, 27, 109, 92, 150, 25,
108093 /* 170 */ 41, 150, 97, 98, 99, 100, 101, 102, 49, 50,
108094 /* 180 */ 94, 95, 98, 165, 109, 25, 165, 163, 170, 171,
108095 /* 190 */ 166, 167, 168, 109, 12, 174, 175, 68, 69, 70,
108096 /* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108097 /* 210 */ 28, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108098 /* 220 */ 91, 92, 19, 11, 86, 87, 44, 24, 46, 221,
108099 /* 230 */ 222, 223, 94, 95, 66, 97, 215, 7, 8, 57,
108100 /* 240 */ 150, 220, 104, 19, 106, 26, 27, 229, 230, 241,
108101 /* 250 */ 160, 27, 49, 50, 22, 165, 96, 118, 16, 99,
108102 /* 260 */ 100, 101, 94, 119, 174, 175, 98, 129, 130, 57,
108103 /* 270 */ 110, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108104 /* 280 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86,
108105 /* 290 */ 87, 88, 89, 90, 91, 92, 19, 129, 130, 131,
108106 /* 300 */ 150, 23, 60, 25, 62, 215, 150, 150, 76, 150,
108107 /* 310 */ 220, 161, 162, 94, 95, 165, 30, 105, 106, 107,
108108 /* 320 */ 34, 165, 165, 23, 165, 25, 49, 50, 116, 170,
108109 /* 330 */ 171, 174, 175, 22, 48, 185, 186, 26, 27, 120,
108110 /* 340 */ 26, 27, 12, 187, 160, 68, 69, 70, 71, 72,
108111 /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 28, 82,
108112 /* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108113 /* 370 */ 19, 150, 215, 95, 44, 23, 46, 220, 194, 96,
108114 /* 380 */ 138, 160, 99, 100, 101, 23, 165, 25, 229, 230,
108115 /* 390 */ 26, 27, 135, 110, 137, 174, 175, 57, 120, 150,
108116 /* 400 */ 49, 50, 88, 219, 113, 94, 95, 158, 94, 95,
108117 /* 410 */ 161, 162, 21, 136, 165, 194, 169, 170, 171, 68,
108118 /* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108119 /* 430 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88,
108120 /* 440 */ 89, 90, 91, 92, 19, 105, 106, 107, 23, 88,
108121 /* 450 */ 89, 90, 91, 92, 63, 23, 116, 88, 94, 95,
108122 /* 460 */ 142, 143, 144, 145, 112, 150, 114, 115, 105, 106,
108123 /* 470 */ 107, 23, 23, 25, 49, 50, 118, 230, 97, 98,
108124 /* 480 */ 165, 16, 113, 118, 120, 160, 117, 136, 113, 174,
108125 /* 490 */ 175, 100, 117, 68, 69, 70, 71, 72, 73, 74,
108126 /* 500 */ 75, 76, 77, 78, 79, 80, 160, 82, 83, 84,
108127 /* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 194,
108128 /* 520 */ 25, 112, 23, 114, 115, 60, 150, 62, 150, 138,
108129 /* 530 */ 150, 105, 106, 107, 19, 150, 36, 161, 162, 224,
108130 /* 540 */ 194, 165, 217, 165, 112, 165, 114, 115, 49, 50,
108131 /* 550 */ 165, 51, 174, 175, 174, 175, 166, 232, 58, 174,
108132 /* 560 */ 175, 112, 237, 114, 115, 50, 22, 68, 69, 70,
108133 /* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108134 /* 580 */ 160, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108135 /* 590 */ 91, 92, 19, 215, 214, 205, 23, 7, 8, 9,
108136 /* 600 */ 215, 155, 24, 22, 26, 150, 97, 26, 108, 129,
108137 /* 610 */ 130, 221, 222, 223, 194, 0, 1, 2, 150, 104,
108138 /* 620 */ 165, 126, 49, 50, 109, 116, 206, 207, 118, 174,
108139 /* 630 */ 175, 22, 23, 165, 25, 22, 23, 128, 25, 118,
108140 /* 640 */ 26, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108141 /* 650 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
108142 /* 660 */ 87, 88, 89, 90, 91, 92, 19, 150, 150, 165,
108143 /* 670 */ 23, 160, 94, 227, 150, 94, 67, 231, 174, 175,
108144 /* 680 */ 67, 213, 165, 165, 221, 222, 223, 150, 150, 165,
108145 /* 690 */ 23, 32, 174, 175, 181, 182, 49, 50, 174, 175,
108146 /* 700 */ 41, 188, 165, 165, 22, 194, 177, 11, 94, 23,
108147 /* 710 */ 193, 174, 175, 160, 22, 68, 69, 70, 71, 72,
108148 /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 217, 82,
108149 /* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108150 /* 740 */ 19, 150, 150, 150, 25, 24, 19, 194, 237, 150,
108151 /* 750 */ 221, 222, 223, 25, 27, 23, 165, 165, 165, 242,
108152 /* 760 */ 165, 23, 150, 25, 165, 174, 175, 174, 175, 174,
108153 /* 770 */ 49, 50, 219, 150, 22, 23, 238, 165, 25, 22,
108154 /* 780 */ 23, 23, 166, 167, 168, 193, 174, 175, 165, 68,
108155 /* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108156 /* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88,
108157 /* 810 */ 89, 90, 91, 92, 19, 150, 23, 165, 150, 67,
108158 /* 820 */ 150, 25, 103, 95, 67, 35, 174, 175, 206, 207,
108159 /* 830 */ 165, 150, 25, 165, 150, 165, 213, 150, 150, 174,
108160 /* 840 */ 175, 35, 174, 175, 49, 50, 165, 52, 120, 165,
108161 /* 850 */ 245, 246, 165, 165, 35, 174, 175, 187, 174, 175,
108162 /* 860 */ 23, 50, 25, 68, 69, 70, 71, 72, 73, 74,
108163 /* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84,
108164 /* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150,
108165 /* 890 */ 150, 165, 150, 150, 160, 23, 150, 25, 144, 145,
108166 /* 900 */ 174, 175, 120, 216, 165, 165, 22, 165, 165, 150,
108167 /* 910 */ 150, 165, 27, 174, 175, 104, 174, 175, 49, 50,
108168 /* 920 */ 174, 175, 247, 248, 165, 165, 238, 187, 194, 23,
108169 /* 930 */ 187, 25, 166, 174, 175, 190, 191, 68, 69, 70,
108170 /* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
108171 /* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90,
108172 /* 960 */ 91, 92, 19, 150, 150, 165, 150, 23, 150, 25,
108173 /* 970 */ 23, 205, 25, 213, 174, 175, 190, 191, 165, 165,
108174 /* 980 */ 118, 165, 150, 165, 150, 150, 23, 174, 175, 39,
108175 /* 990 */ 174, 175, 49, 50, 173, 150, 23, 165, 52, 165,
108176 /* 1000 */ 165, 187, 181, 22, 166, 166, 174, 175, 174, 175,
108177 /* 1010 */ 165, 68, 69, 70, 71, 72, 73, 74, 75, 76,
108178 /* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
108179 /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 150, 193, 165,
108180 /* 1040 */ 150, 160, 150, 205, 205, 150, 150, 29, 174, 175,
108181 /* 1050 */ 52, 216, 165, 22, 150, 165, 238, 165, 150, 150,
108182 /* 1060 */ 165, 165, 49, 50, 174, 175, 49, 50, 23, 165,
108183 /* 1070 */ 91, 92, 22, 165, 165, 194, 1, 2, 22, 52,
108184 /* 1080 */ 193, 109, 174, 175, 71, 72, 69, 70, 71, 72,
108185 /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
108186 /* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
108187 /* 1110 */ 19, 98, 150, 165, 150, 150, 150, 102, 150, 150,
108188 /* 1120 */ 22, 19, 174, 175, 20, 24, 104, 165, 43, 165,
108189 /* 1130 */ 165, 165, 150, 165, 165, 150, 174, 175, 174, 175,
108190 /* 1140 */ 49, 50, 59, 53, 138, 25, 53, 165, 104, 22,
108191 /* 1150 */ 165, 5, 118, 1, 76, 76, 174, 175, 193, 174,
108192 /* 1160 */ 175, 70, 71, 72, 73, 74, 75, 76, 77, 78,
108193 /* 1170 */ 79, 80, 35, 82, 83, 84, 85, 86, 87, 88,
108194 /* 1180 */ 89, 90, 91, 92, 19, 20, 150, 22, 150, 150,
108195 /* 1190 */ 150, 26, 27, 27, 108, 127, 150, 150, 22, 25,
108196 /* 1200 */ 22, 165, 37, 165, 165, 165, 119, 19, 20, 150,
108197 /* 1210 */ 22, 165, 165, 150, 26, 27, 23, 1, 16, 20,
108198 /* 1220 */ 150, 56, 119, 108, 165, 37, 121, 128, 165, 193,
108199 /* 1230 */ 23, 66, 193, 174, 175, 165, 127, 174, 175, 16,
108200 /* 1240 */ 23, 146, 147, 15, 56, 65, 150, 152, 140, 154,
108201 /* 1250 */ 150, 86, 87, 88, 66, 160, 22, 150, 93, 94,
108202 /* 1260 */ 95, 165, 150, 98, 150, 165, 3, 246, 4, 150,
108203 /* 1270 */ 174, 175, 165, 150, 86, 87, 6, 165, 150, 165,
108204 /* 1280 */ 164, 93, 94, 95, 165, 149, 98, 149, 165, 194,
108205 /* 1290 */ 180, 180, 249, 165, 129, 130, 131, 132, 133, 134,
108206 /* 1300 */ 193, 150, 174, 175, 116, 193, 19, 20, 150, 22,
108207 /* 1310 */ 249, 149, 217, 26, 27, 151, 165, 129, 130, 131,
108208 /* 1320 */ 132, 133, 134, 165, 37, 174, 175, 150, 149, 19,
108209 /* 1330 */ 20, 150, 22, 150, 150, 150, 26, 27, 13, 244,
108210 /* 1340 */ 151, 159, 165, 56, 25, 116, 165, 37, 165, 165,
108211 /* 1350 */ 165, 174, 175, 66, 150, 174, 175, 174, 175, 174,
108212 /* 1360 */ 175, 194, 150, 150, 150, 126, 56, 199, 124, 165,
108213 /* 1370 */ 200, 150, 150, 86, 87, 150, 66, 165, 165, 165,
108214 /* 1380 */ 93, 94, 95, 150, 122, 98, 165, 165, 123, 22,
108215 /* 1390 */ 165, 201, 150, 26, 27, 150, 86, 87, 165, 174,
108216 /* 1400 */ 175, 203, 202, 93, 94, 95, 125, 165, 98, 150,
108217 /* 1410 */ 165, 150, 225, 135, 157, 118, 129, 130, 131, 132,
108218 /* 1420 */ 133, 134, 5, 150, 165, 157, 165, 10, 11, 12,
108219 /* 1430 */ 13, 14, 150, 66, 17, 174, 175, 210, 165, 129,
108220 /* 1440 */ 130, 131, 132, 133, 134, 150, 104, 165, 31, 150,
108221 /* 1450 */ 33, 150, 150, 86, 87, 150, 174, 175, 211, 42,
108222 /* 1460 */ 165, 94, 121, 210, 165, 98, 165, 165, 176, 211,
108223 /* 1470 */ 165, 211, 55, 104, 57, 184, 210, 47, 61, 176,
108224 /* 1480 */ 176, 64, 103, 176, 178, 22, 92, 179, 176, 176,
108225 /* 1490 */ 176, 156, 18, 184, 179, 228, 129, 130, 131, 228,
108226 /* 1500 */ 157, 156, 45, 157, 156, 236, 157, 157, 135, 235,
108227 /* 1510 */ 156, 189, 157, 68, 218, 189, 22, 199, 156, 192,
108228 /* 1520 */ 157, 18, 105, 106, 107, 192, 192, 199, 111, 192,
108229 /* 1530 */ 240, 157, 40, 116, 218, 157, 189, 157, 240, 38,
108230 /* 1540 */ 153, 166, 198, 243, 178, 209, 182, 196, 177, 226,
108231 /* 1550 */ 230, 230, 166, 177, 177, 166, 139, 199, 199, 148,
108232 /* 1560 */ 195, 209, 209, 239, 196, 166, 234, 183, 239, 208,
108233 /* 1570 */ 174, 233, 191, 183, 183, 174, 92, 250, 186, 186,
108234 };
108235 #define YY_SHIFT_USE_DFLT (-81)
108236 #define YY_SHIFT_COUNT (417)
108237 #define YY_SHIFT_MIN (-80)
108238 #define YY_SHIFT_MAX (1503)
108239 static const short yy_shift_ofst[] = {
108240 /* 0 */ 1075, 1188, 1417, 1188, 1287, 1287, 138, 138, 1, -19,
108241 /* 10 */ 1287, 1287, 1287, 1287, 340, -2, 129, 129, 795, 1165,
108242 /* 20 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108243 /* 30 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108244 /* 40 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1310, 1287,
108245 /* 50 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287,
108246 /* 60 */ 1287, 1287, 212, -2, -2, -8, -8, 614, 1229, 55,
108247 /* 70 */ 721, 647, 573, 499, 425, 351, 277, 203, 869, 869,
108248 /* 80 */ 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
108249 /* 90 */ 869, 869, 869, 943, 869, 1017, 1091, 1091, -69, -45,
108250 /* 100 */ -45, -45, -45, -45, -1, 57, 28, 361, -2, -2,
108251 /* 110 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108252 /* 120 */ -2, -2, -2, -2, 391, 515, -2, -2, -2, -2,
108253 /* 130 */ -2, 509, -80, 614, 979, 1484, -81, -81, -81, 1367,
108254 /* 140 */ 75, 182, 182, 314, 311, 364, 219, 86, 613, 609,
108255 /* 150 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108256 /* 160 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108257 /* 170 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
108258 /* 180 */ -2, -2, 578, 578, 578, 615, 1229, 1229, 1229, -81,
108259 /* 190 */ -81, -81, 160, 168, 168, 283, 500, 500, 500, 278,
108260 /* 200 */ 449, 330, 432, 409, 352, 48, 48, 48, 48, 426,
108261 /* 210 */ 286, 48, 48, 728, 581, 369, 590, 495, 224, 224,
108262 /* 220 */ 727, 495, 727, 719, 614, 659, 614, 659, 811, 659,
108263 /* 230 */ 224, 257, 480, 480, 614, 144, 375, -18, 1501, 1297,
108264 /* 240 */ 1297, 1492, 1492, 1297, 1494, 1445, 1239, 1503, 1503, 1503,
108265 /* 250 */ 1503, 1297, 1474, 1239, 1494, 1445, 1445, 1297, 1474, 1373,
108266 /* 260 */ 1457, 1297, 1297, 1474, 1297, 1474, 1297, 1474, 1463, 1369,
108267 /* 270 */ 1369, 1369, 1430, 1394, 1394, 1463, 1369, 1379, 1369, 1430,
108268 /* 280 */ 1369, 1369, 1341, 1342, 1341, 1342, 1341, 1342, 1297, 1297,
108269 /* 290 */ 1278, 1281, 1262, 1244, 1265, 1239, 1229, 1319, 1325, 1325,
108270 /* 300 */ 1270, 1270, 1270, 1270, -81, -81, -81, -81, -81, -81,
108271 /* 310 */ 1013, 242, 757, 752, 465, 363, 947, 232, 944, 906,
108272 /* 320 */ 872, 837, 738, 448, 381, 230, 84, 362, 300, 1264,
108273 /* 330 */ 1263, 1234, 1108, 1228, 1180, 1223, 1217, 1207, 1099, 1174,
108274 /* 340 */ 1109, 1115, 1103, 1199, 1105, 1202, 1216, 1087, 1193, 1178,
108275 /* 350 */ 1174, 1176, 1068, 1079, 1078, 1086, 1166, 1137, 1034, 1152,
108276 /* 360 */ 1146, 1127, 1044, 1006, 1093, 1120, 1090, 1083, 1085, 1022,
108277 /* 370 */ 1101, 1104, 1102, 972, 1015, 1098, 1027, 1056, 1050, 1045,
108278 /* 380 */ 1031, 998, 1018, 981, 946, 950, 973, 963, 862, 885,
108279 /* 390 */ 819, 884, 782, 796, 806, 807, 790, 796, 793, 758,
108280 /* 400 */ 753, 732, 692, 696, 682, 686, 667, 544, 291, 521,
108281 /* 410 */ 510, 365, 358, 139, 114, 54, 14, 25,
108282 };
108283 #define YY_REDUCE_USE_DFLT (-169)
108284 #define YY_REDUCE_COUNT (309)
108285 #define YY_REDUCE_MIN (-168)
108286 #define YY_REDUCE_MAX (1411)
108287 static const short yy_reduce_ofst[] = {
108288 /* 0 */ 318, 90, 1095, 221, 157, 21, 159, 18, 150, 390,
108289 /* 10 */ 385, 378, 380, 315, 325, 249, 529, -71, 8, 1282,
108290 /* 20 */ 1261, 1225, 1185, 1183, 1181, 1177, 1151, 1128, 1096, 1063,
108291 /* 30 */ 1059, 985, 982, 964, 962, 948, 908, 890, 874, 834,
108292 /* 40 */ 832, 816, 813, 800, 759, 746, 742, 739, 726, 684,
108293 /* 50 */ 681, 668, 665, 652, 612, 593, 591, 537, 524, 518,
108294 /* 60 */ 504, 455, 511, 376, 517, 247, -168, 24, 420, 463,
108295 /* 70 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108296 /* 80 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108297 /* 90 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
108298 /* 100 */ 463, 463, 463, 463, 463, -74, 463, 463, 1112, 835,
108299 /* 110 */ 1107, 1039, 1036, 965, 887, 845, 818, 760, 688, 687,
108300 /* 120 */ 538, 743, 623, 592, 446, 513, 814, 740, 670, 156,
108301 /* 130 */ 468, 553, 184, 616, 463, 463, 463, 463, 463, 595,
108302 /* 140 */ 821, 786, 745, 909, 1305, 1302, 1301, 1299, 675, 675,
108303 /* 150 */ 1295, 1273, 1259, 1245, 1242, 1233, 1222, 1221, 1214, 1213,
108304 /* 160 */ 1212, 1204, 1184, 1158, 1123, 1119, 1114, 1100, 1070, 1047,
108305 /* 170 */ 1046, 1040, 1038, 969, 968, 966, 909, 904, 896, 895,
108306 /* 180 */ 892, 599, 839, 838, 766, 754, 881, 734, 346, 605,
108307 /* 190 */ 622, -94, 1393, 1401, 1396, 1392, 1391, 1390, 1384, 1361,
108308 /* 200 */ 1365, 1381, 1365, 1365, 1365, 1365, 1365, 1365, 1365, 1332,
108309 /* 210 */ 1338, 1365, 1365, 1361, 1399, 1368, 1411, 1359, 1353, 1352,
108310 /* 220 */ 1329, 1358, 1324, 1366, 1389, 1377, 1386, 1376, 1364, 1371,
108311 /* 230 */ 1336, 1323, 1321, 1320, 1375, 1344, 1351, 1387, 1300, 1380,
108312 /* 240 */ 1378, 1298, 1290, 1374, 1316, 1347, 1328, 1337, 1334, 1333,
108313 /* 250 */ 1327, 1363, 1362, 1318, 1296, 1326, 1322, 1355, 1354, 1269,
108314 /* 260 */ 1274, 1350, 1349, 1348, 1346, 1345, 1343, 1335, 1315, 1314,
108315 /* 270 */ 1313, 1312, 1309, 1271, 1267, 1308, 1307, 1306, 1304, 1291,
108316 /* 280 */ 1303, 1292, 1260, 1266, 1258, 1253, 1247, 1227, 1268, 1257,
108317 /* 290 */ 1187, 1198, 1200, 1190, 1170, 1168, 1167, 1182, 1189, 1164,
108318 /* 300 */ 1179, 1162, 1138, 1136, 1061, 1043, 1021, 1111, 1110, 1116,
 
108319 };
108320 static const YYACTIONTYPE yy_default[] = {
108321 /* 0 */ 634, 868, 956, 956, 868, 868, 956, 956, 956, 758,
108322 /* 10 */ 956, 956, 956, 866, 956, 956, 786, 786, 930, 956,
108323 /* 20 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108324 /* 30 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108325 /* 40 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108326 /* 50 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108327 /* 60 */ 956, 956, 956, 956, 956, 956, 956, 673, 762, 792,
108328 /* 70 */ 956, 956, 956, 956, 956, 956, 956, 956, 929, 931,
108329 /* 80 */ 800, 799, 909, 773, 797, 790, 794, 869, 862, 863,
108330 /* 90 */ 861, 865, 870, 956, 793, 829, 846, 828, 840, 845,
108331 /* 100 */ 852, 844, 841, 831, 830, 665, 832, 833, 956, 956,
108332 /* 110 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108333 /* 120 */ 956, 956, 956, 956, 660, 727, 956, 956, 956, 956,
108334 /* 130 */ 956, 956, 956, 956, 834, 835, 849, 848, 847, 956,
108335 /* 140 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108336 /* 150 */ 956, 936, 934, 956, 881, 956, 956, 956, 956, 956,
108337 /* 160 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108338 /* 170 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108339 /* 180 */ 956, 640, 758, 758, 758, 634, 956, 956, 956, 948,
108340 /* 190 */ 762, 752, 718, 956, 956, 956, 956, 956, 956, 956,
108341 /* 200 */ 956, 956, 956, 956, 956, 802, 741, 919, 921, 956,
108342 /* 210 */ 902, 739, 662, 760, 675, 750, 642, 796, 775, 775,
108343 /* 220 */ 914, 796, 914, 699, 956, 786, 956, 786, 696, 786,
108344 /* 230 */ 775, 864, 956, 956, 956, 759, 750, 956, 941, 766,
108345 /* 240 */ 766, 933, 933, 766, 808, 731, 796, 738, 738, 738,
108346 /* 250 */ 738, 766, 657, 796, 808, 731, 731, 766, 657, 908,
108347 /* 260 */ 906, 766, 766, 657, 766, 657, 766, 657, 874, 729,
108348 /* 270 */ 729, 729, 714, 878, 878, 874, 729, 699, 729, 714,
108349 /* 280 */ 729, 729, 779, 774, 779, 774, 779, 774, 766, 766,
108350 /* 290 */ 956, 791, 780, 789, 787, 796, 956, 717, 650, 650,
108351 /* 300 */ 639, 639, 639, 639, 953, 953, 948, 701, 701, 683,
108352 /* 310 */ 956, 956, 956, 956, 956, 956, 956, 883, 956, 956,
108353 /* 320 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108354 /* 330 */ 635, 943, 956, 956, 940, 956, 956, 956, 956, 801,
108355 /* 340 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108356 /* 350 */ 918, 956, 956, 956, 956, 956, 956, 956, 912, 956,
108357 /* 360 */ 956, 956, 956, 956, 956, 905, 904, 956, 956, 956,
108358 /* 370 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108359 /* 380 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956,
108360 /* 390 */ 956, 956, 956, 788, 956, 781, 956, 867, 956, 956,
108361 /* 400 */ 956, 956, 956, 956, 956, 956, 956, 956, 744, 817,
108362 /* 410 */ 956, 816, 820, 815, 667, 956, 648, 956, 631, 636,
108363 /* 420 */ 952, 955, 954, 951, 950, 949, 944, 942, 939, 938,
108364 /* 430 */ 937, 935, 932, 928, 887, 885, 892, 891, 890, 889,
108365 /* 440 */ 888, 886, 884, 882, 803, 798, 795, 927, 880, 740,
108366 /* 450 */ 737, 736, 656, 945, 911, 920, 807, 806, 809, 917,
108367 /* 460 */ 916, 915, 913, 910, 897, 805, 804, 732, 872, 871,
108368 /* 470 */ 659, 901, 900, 899, 903, 907, 898, 768, 658, 655,
108369 /* 480 */ 664, 721, 720, 728, 726, 725, 724, 723, 722, 719,
108370 /* 490 */ 666, 674, 685, 713, 698, 697, 877, 879, 876, 875,
108371 /* 500 */ 706, 705, 711, 710, 709, 708, 707, 704, 703, 702,
108372 /* 510 */ 695, 694, 700, 693, 716, 715, 712, 692, 735, 734,
108373 /* 520 */ 733, 730, 691, 690, 689, 820, 688, 687, 826, 825,
108374 /* 530 */ 813, 856, 755, 754, 753, 765, 764, 777, 776, 811,
108375 /* 540 */ 810, 778, 763, 757, 756, 772, 771, 770, 769, 761,
108376 /* 550 */ 751, 783, 785, 784, 782, 858, 767, 855, 926, 925,
108377 /* 560 */ 924, 923, 922, 860, 859, 827, 824, 678, 679, 895,
108378 /* 570 */ 894, 896, 893, 681, 680, 677, 676, 857, 746, 745,
108379 /* 580 */ 853, 850, 842, 838, 854, 851, 843, 839, 837, 836,
108380 /* 590 */ 822, 821, 819, 818, 814, 823, 669, 747, 743, 742,
108381 /* 600 */ 812, 749, 748, 686, 684, 682, 663, 661, 654, 652,
108382 /* 610 */ 651, 653, 649, 647, 646, 645, 644, 643, 672, 671,
108383 /* 620 */ 670, 668, 667, 641, 638, 637, 633, 632, 630,
108384 };
108385
108386 /* The next table maps tokens into fallback tokens. If a construct
108387 ** like the following:
108388 **
@@ -108521,20 +108591,20 @@
108591 "ifexists", "fullname", "oneselect", "multiselect_op",
108592 "distinct", "selcollist", "from", "where_opt",
108593 "groupby_opt", "having_opt", "orderby_opt", "limit_opt",
108594 "sclp", "as", "seltablist", "stl_prefix",
108595 "joinop", "indexed_opt", "on_opt", "using_opt",
108596 "joinop2", "inscollist", "sortlist", "nexprlist",
108597 "setlist", "insert_cmd", "inscollist_opt", "valuelist",
108598 "exprlist", "likeop", "between_op", "in_op",
108599 "case_operand", "case_exprlist", "case_else", "uniqueflag",
108600 "collate", "nmnum", "number", "trigger_decl",
108601 "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause",
108602 "when_clause", "trigger_cmd", "trnm", "tridxby",
108603 "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt",
108604 "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken",
108605 "lp", "anylist",
108606 };
108607 #endif /* NDEBUG */
108608
108609 #ifndef NDEBUG
108610 /* For tracing reduce actions, the names of all rules are required.
@@ -108691,186 +108761,184 @@
108761 /* 148 */ "indexed_opt ::= NOT INDEXED",
108762 /* 149 */ "using_opt ::= USING LP inscollist RP",
108763 /* 150 */ "using_opt ::=",
108764 /* 151 */ "orderby_opt ::=",
108765 /* 152 */ "orderby_opt ::= ORDER BY sortlist",
108766 /* 153 */ "sortlist ::= sortlist COMMA expr sortorder",
108767 /* 154 */ "sortlist ::= expr sortorder",
108768 /* 155 */ "sortorder ::= ASC",
108769 /* 156 */ "sortorder ::= DESC",
108770 /* 157 */ "sortorder ::=",
108771 /* 158 */ "groupby_opt ::=",
108772 /* 159 */ "groupby_opt ::= GROUP BY nexprlist",
108773 /* 160 */ "having_opt ::=",
108774 /* 161 */ "having_opt ::= HAVING expr",
108775 /* 162 */ "limit_opt ::=",
108776 /* 163 */ "limit_opt ::= LIMIT expr",
108777 /* 164 */ "limit_opt ::= LIMIT expr OFFSET expr",
108778 /* 165 */ "limit_opt ::= LIMIT expr COMMA expr",
108779 /* 166 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt",
108780 /* 167 */ "where_opt ::=",
108781 /* 168 */ "where_opt ::= WHERE expr",
108782 /* 169 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt",
108783 /* 170 */ "setlist ::= setlist COMMA nm EQ expr",
108784 /* 171 */ "setlist ::= nm EQ expr",
108785 /* 172 */ "cmd ::= insert_cmd INTO fullname inscollist_opt valuelist",
108786 /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
108787 /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
108788 /* 175 */ "insert_cmd ::= INSERT orconf",
108789 /* 176 */ "insert_cmd ::= REPLACE",
108790 /* 177 */ "valuelist ::= VALUES LP nexprlist RP",
108791 /* 178 */ "valuelist ::= valuelist COMMA LP exprlist RP",
108792 /* 179 */ "inscollist_opt ::=",
108793 /* 180 */ "inscollist_opt ::= LP inscollist RP",
108794 /* 181 */ "inscollist ::= inscollist COMMA nm",
108795 /* 182 */ "inscollist ::= nm",
108796 /* 183 */ "expr ::= term",
108797 /* 184 */ "expr ::= LP expr RP",
108798 /* 185 */ "term ::= NULL",
108799 /* 186 */ "expr ::= id",
108800 /* 187 */ "expr ::= JOIN_KW",
108801 /* 188 */ "expr ::= nm DOT nm",
108802 /* 189 */ "expr ::= nm DOT nm DOT nm",
108803 /* 190 */ "term ::= INTEGER|FLOAT|BLOB",
108804 /* 191 */ "term ::= STRING",
108805 /* 192 */ "expr ::= REGISTER",
108806 /* 193 */ "expr ::= VARIABLE",
108807 /* 194 */ "expr ::= expr COLLATE ids",
108808 /* 195 */ "expr ::= CAST LP expr AS typetoken RP",
108809 /* 196 */ "expr ::= ID LP distinct exprlist RP",
108810 /* 197 */ "expr ::= ID LP STAR RP",
108811 /* 198 */ "term ::= CTIME_KW",
108812 /* 199 */ "expr ::= expr AND expr",
108813 /* 200 */ "expr ::= expr OR expr",
108814 /* 201 */ "expr ::= expr LT|GT|GE|LE expr",
108815 /* 202 */ "expr ::= expr EQ|NE expr",
108816 /* 203 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
108817 /* 204 */ "expr ::= expr PLUS|MINUS expr",
108818 /* 205 */ "expr ::= expr STAR|SLASH|REM expr",
108819 /* 206 */ "expr ::= expr CONCAT expr",
108820 /* 207 */ "likeop ::= LIKE_KW",
108821 /* 208 */ "likeop ::= NOT LIKE_KW",
108822 /* 209 */ "likeop ::= MATCH",
108823 /* 210 */ "likeop ::= NOT MATCH",
108824 /* 211 */ "expr ::= expr likeop expr",
108825 /* 212 */ "expr ::= expr likeop expr ESCAPE expr",
108826 /* 213 */ "expr ::= expr ISNULL|NOTNULL",
108827 /* 214 */ "expr ::= expr NOT NULL",
108828 /* 215 */ "expr ::= expr IS expr",
108829 /* 216 */ "expr ::= expr IS NOT expr",
108830 /* 217 */ "expr ::= NOT expr",
108831 /* 218 */ "expr ::= BITNOT expr",
108832 /* 219 */ "expr ::= MINUS expr",
108833 /* 220 */ "expr ::= PLUS expr",
108834 /* 221 */ "between_op ::= BETWEEN",
108835 /* 222 */ "between_op ::= NOT BETWEEN",
108836 /* 223 */ "expr ::= expr between_op expr AND expr",
108837 /* 224 */ "in_op ::= IN",
108838 /* 225 */ "in_op ::= NOT IN",
108839 /* 226 */ "expr ::= expr in_op LP exprlist RP",
108840 /* 227 */ "expr ::= LP select RP",
108841 /* 228 */ "expr ::= expr in_op LP select RP",
108842 /* 229 */ "expr ::= expr in_op nm dbnm",
108843 /* 230 */ "expr ::= EXISTS LP select RP",
108844 /* 231 */ "expr ::= CASE case_operand case_exprlist case_else END",
108845 /* 232 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
108846 /* 233 */ "case_exprlist ::= WHEN expr THEN expr",
108847 /* 234 */ "case_else ::= ELSE expr",
108848 /* 235 */ "case_else ::=",
108849 /* 236 */ "case_operand ::= expr",
108850 /* 237 */ "case_operand ::=",
108851 /* 238 */ "exprlist ::= nexprlist",
108852 /* 239 */ "exprlist ::=",
108853 /* 240 */ "nexprlist ::= nexprlist COMMA expr",
108854 /* 241 */ "nexprlist ::= expr",
108855 /* 242 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
108856 /* 243 */ "uniqueflag ::= UNIQUE",
108857 /* 244 */ "uniqueflag ::=",
108858 /* 245 */ "idxlist_opt ::=",
108859 /* 246 */ "idxlist_opt ::= LP idxlist RP",
108860 /* 247 */ "idxlist ::= idxlist COMMA nm collate sortorder",
108861 /* 248 */ "idxlist ::= nm collate sortorder",
108862 /* 249 */ "collate ::=",
108863 /* 250 */ "collate ::= COLLATE ids",
108864 /* 251 */ "cmd ::= DROP INDEX ifexists fullname",
108865 /* 252 */ "cmd ::= VACUUM",
108866 /* 253 */ "cmd ::= VACUUM nm",
108867 /* 254 */ "cmd ::= PRAGMA nm dbnm",
108868 /* 255 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
108869 /* 256 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
108870 /* 257 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
108871 /* 258 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
108872 /* 259 */ "nmnum ::= plus_num",
108873 /* 260 */ "nmnum ::= nm",
108874 /* 261 */ "nmnum ::= ON",
108875 /* 262 */ "nmnum ::= DELETE",
108876 /* 263 */ "nmnum ::= DEFAULT",
108877 /* 264 */ "plus_num ::= PLUS number",
108878 /* 265 */ "plus_num ::= number",
108879 /* 266 */ "minus_num ::= MINUS number",
108880 /* 267 */ "number ::= INTEGER|FLOAT",
108881 /* 268 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
108882 /* 269 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
108883 /* 270 */ "trigger_time ::= BEFORE",
108884 /* 271 */ "trigger_time ::= AFTER",
108885 /* 272 */ "trigger_time ::= INSTEAD OF",
108886 /* 273 */ "trigger_time ::=",
108887 /* 274 */ "trigger_event ::= DELETE|INSERT",
108888 /* 275 */ "trigger_event ::= UPDATE",
108889 /* 276 */ "trigger_event ::= UPDATE OF inscollist",
108890 /* 277 */ "foreach_clause ::=",
108891 /* 278 */ "foreach_clause ::= FOR EACH ROW",
108892 /* 279 */ "when_clause ::=",
108893 /* 280 */ "when_clause ::= WHEN expr",
108894 /* 281 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
108895 /* 282 */ "trigger_cmd_list ::= trigger_cmd SEMI",
108896 /* 283 */ "trnm ::= nm",
108897 /* 284 */ "trnm ::= nm DOT nm",
108898 /* 285 */ "tridxby ::=",
108899 /* 286 */ "tridxby ::= INDEXED BY nm",
108900 /* 287 */ "tridxby ::= NOT INDEXED",
108901 /* 288 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
108902 /* 289 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist",
108903 /* 290 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select",
108904 /* 291 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
108905 /* 292 */ "trigger_cmd ::= select",
108906 /* 293 */ "expr ::= RAISE LP IGNORE RP",
108907 /* 294 */ "expr ::= RAISE LP raisetype COMMA nm RP",
108908 /* 295 */ "raisetype ::= ROLLBACK",
108909 /* 296 */ "raisetype ::= ABORT",
108910 /* 297 */ "raisetype ::= FAIL",
108911 /* 298 */ "cmd ::= DROP TRIGGER ifexists fullname",
108912 /* 299 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
108913 /* 300 */ "cmd ::= DETACH database_kw_opt expr",
108914 /* 301 */ "key_opt ::=",
108915 /* 302 */ "key_opt ::= KEY expr",
108916 /* 303 */ "database_kw_opt ::= DATABASE",
108917 /* 304 */ "database_kw_opt ::=",
108918 /* 305 */ "cmd ::= REINDEX",
108919 /* 306 */ "cmd ::= REINDEX nm dbnm",
108920 /* 307 */ "cmd ::= ANALYZE",
108921 /* 308 */ "cmd ::= ANALYZE nm dbnm",
108922 /* 309 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
108923 /* 310 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
108924 /* 311 */ "add_column_fullname ::= fullname",
108925 /* 312 */ "kwcolumn_opt ::=",
108926 /* 313 */ "kwcolumn_opt ::= COLUMNKW",
108927 /* 314 */ "cmd ::= create_vtab",
108928 /* 315 */ "cmd ::= create_vtab LP vtabarglist RP",
108929 /* 316 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
108930 /* 317 */ "vtabarglist ::= vtabarg",
108931 /* 318 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
108932 /* 319 */ "vtabarg ::=",
108933 /* 320 */ "vtabarg ::= vtabarg vtabargtoken",
108934 /* 321 */ "vtabargtoken ::= ANY",
108935 /* 322 */ "vtabargtoken ::= lp anylist RP",
108936 /* 323 */ "lp ::= LP",
108937 /* 324 */ "anylist ::=",
108938 /* 325 */ "anylist ::= anylist LP anylist RP",
108939 /* 326 */ "anylist ::= anylist ANY",
 
 
108940 };
108941 #endif /* NDEBUG */
108942
108943
108944 #if YYSTACKDEPTH<=0
@@ -108948,71 +109016,77 @@
109016 ** inside the C code.
109017 */
109018 case 160: /* select */
109019 case 194: /* oneselect */
109020 {
109021 sqlite3SelectDelete(pParse->db, (yypminor->yy159));
109022 }
109023 break;
109024 case 174: /* term */
109025 case 175: /* expr */
109026 {
109027 sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr);
109028 }
109029 break;
109030 case 179: /* idxlist_opt */
109031 case 187: /* idxlist */
109032 case 197: /* selcollist */
109033 case 200: /* groupby_opt */
109034 case 202: /* orderby_opt */
109035 case 204: /* sclp */
109036 case 214: /* sortlist */
109037 case 215: /* nexprlist */
109038 case 216: /* setlist */
109039 case 220: /* exprlist */
109040 case 225: /* case_exprlist */
 
109041 {
109042 sqlite3ExprListDelete(pParse->db, (yypminor->yy442));
109043 }
109044 break;
109045 case 193: /* fullname */
109046 case 198: /* from */
109047 case 206: /* seltablist */
109048 case 207: /* stl_prefix */
109049 {
109050 sqlite3SrcListDelete(pParse->db, (yypminor->yy347));
109051 }
109052 break;
109053 case 199: /* where_opt */
109054 case 201: /* having_opt */
109055 case 210: /* on_opt */
109056 case 224: /* case_operand */
109057 case 226: /* case_else */
109058 case 236: /* when_clause */
109059 case 241: /* key_opt */
 
109060 {
109061 sqlite3ExprDelete(pParse->db, (yypminor->yy122));
109062 }
109063 break;
109064 case 211: /* using_opt */
109065 case 213: /* inscollist */
109066 case 218: /* inscollist_opt */
109067 {
109068 sqlite3IdListDelete(pParse->db, (yypminor->yy180));
109069 }
109070 break;
109071 case 219: /* valuelist */
109072 {
109073
109074 sqlite3ExprListDelete(pParse->db, (yypminor->yy487).pList);
109075 sqlite3SelectDelete(pParse->db, (yypminor->yy487).pSelect);
109076
109077 }
109078 break;
109079 case 232: /* trigger_cmd_list */
109080 case 237: /* trigger_cmd */
109081 {
109082 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327));
109083 }
109084 break;
109085 case 234: /* trigger_event */
109086 {
109087 sqlite3IdListDelete(pParse->db, (yypminor->yy410).b);
109088 }
109089 break;
109090 default: break; /* If no destructor action specified: do nothing */
109091 }
109092 }
@@ -109408,11 +109482,10 @@
109482 { 211, 0 },
109483 { 202, 0 },
109484 { 202, 3 },
109485 { 214, 4 },
109486 { 214, 2 },
 
109487 { 177, 1 },
109488 { 177, 1 },
109489 { 177, 0 },
109490 { 200, 0 },
109491 { 200, 3 },
@@ -109424,21 +109497,21 @@
109497 { 203, 4 },
109498 { 147, 5 },
109499 { 199, 0 },
109500 { 199, 2 },
109501 { 147, 7 },
109502 { 216, 5 },
109503 { 216, 3 },
109504 { 147, 5 },
109505 { 147, 5 },
109506 { 147, 6 },
109507 { 217, 2 },
109508 { 217, 1 },
109509 { 219, 4 },
109510 { 219, 5 },
109511 { 218, 0 },
109512 { 218, 3 },
109513 { 213, 3 },
109514 { 213, 1 },
109515 { 175, 1 },
109516 { 175, 3 },
109517 { 174, 1 },
@@ -109461,14 +109534,14 @@
109534 { 175, 3 },
109535 { 175, 3 },
109536 { 175, 3 },
109537 { 175, 3 },
109538 { 175, 3 },
109539 { 221, 1 },
109540 { 221, 2 },
109541 { 221, 1 },
109542 { 221, 2 },
109543 { 175, 3 },
109544 { 175, 5 },
109545 { 175, 2 },
109546 { 175, 3 },
109547 { 175, 3 },
@@ -109475,117 +109548,116 @@
109548 { 175, 4 },
109549 { 175, 2 },
109550 { 175, 2 },
109551 { 175, 2 },
109552 { 175, 2 },
109553 { 222, 1 },
109554 { 222, 2 },
109555 { 175, 5 },
109556 { 223, 1 },
109557 { 223, 2 },
 
 
 
109558 { 175, 5 },
109559 { 175, 3 },
109560 { 175, 5 },
109561 { 175, 4 },
109562 { 175, 4 },
109563 { 175, 5 },
109564 { 225, 5 },
109565 { 225, 4 },
109566 { 226, 2 },
109567 { 226, 0 },
109568 { 224, 1 },
109569 { 224, 0 },
109570 { 220, 1 },
109571 { 220, 0 },
109572 { 215, 3 },
109573 { 215, 1 },
109574 { 147, 11 },
109575 { 227, 1 },
109576 { 227, 0 },
109577 { 179, 0 },
109578 { 179, 3 },
109579 { 187, 5 },
109580 { 187, 3 },
109581 { 228, 0 },
109582 { 228, 2 },
109583 { 147, 4 },
109584 { 147, 1 },
109585 { 147, 2 },
109586 { 147, 3 },
109587 { 147, 5 },
109588 { 147, 6 },
109589 { 147, 5 },
109590 { 147, 6 },
109591 { 229, 1 },
109592 { 229, 1 },
109593 { 229, 1 },
109594 { 229, 1 },
109595 { 229, 1 },
109596 { 170, 2 },
109597 { 170, 1 },
109598 { 171, 2 },
109599 { 230, 1 },
 
 
109600 { 147, 5 },
109601 { 231, 11 },
109602 { 233, 1 },
109603 { 233, 1 },
109604 { 233, 2 },
109605 { 233, 0 },
109606 { 234, 1 },
109607 { 234, 1 },
109608 { 234, 3 },
109609 { 235, 0 },
109610 { 235, 3 },
109611 { 236, 0 },
109612 { 236, 2 },
109613 { 232, 3 },
109614 { 232, 2 },
109615 { 238, 1 },
109616 { 238, 3 },
109617 { 239, 0 },
109618 { 239, 3 },
109619 { 239, 2 },
109620 { 237, 7 },
109621 { 237, 5 },
109622 { 237, 5 },
109623 { 237, 5 },
109624 { 237, 1 },
 
 
 
 
109625 { 175, 4 },
109626 { 175, 6 },
109627 { 191, 1 },
109628 { 191, 1 },
109629 { 191, 1 },
109630 { 147, 4 },
109631 { 147, 6 },
109632 { 147, 3 },
109633 { 241, 0 },
109634 { 241, 2 },
109635 { 240, 1 },
109636 { 240, 0 },
109637 { 147, 1 },
109638 { 147, 3 },
109639 { 147, 1 },
109640 { 147, 3 },
109641 { 147, 6 },
109642 { 147, 6 },
109643 { 242, 1 },
109644 { 243, 0 },
109645 { 243, 1 },
109646 { 147, 1 },
109647 { 147, 4 },
109648 { 244, 8 },
109649 { 245, 1 },
109650 { 245, 3 },
109651 { 246, 0 },
109652 { 246, 2 },
109653 { 247, 1 },
109654 { 247, 3 },
109655 { 248, 1 },
109656 { 249, 0 },
109657 { 249, 4 },
109658 { 249, 2 },
 
 
 
 
109659 };
109660
109661 static void yy_accept(yyParser*); /* Forward Declaration */
109662
109663 /*
@@ -109649,21 +109721,21 @@
109721 break;
109722 case 8: /* cmdx ::= cmd */
109723 { sqlite3FinishCoding(pParse); }
109724 break;
109725 case 9: /* cmd ::= BEGIN transtype trans_opt */
109726 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);}
109727 break;
109728 case 13: /* transtype ::= */
109729 {yygotominor.yy392 = TK_DEFERRED;}
109730 break;
109731 case 14: /* transtype ::= DEFERRED */
109732 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15);
109733 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16);
109734 case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115);
109735 case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117);
109736 {yygotominor.yy392 = yymsp[0].major;}
109737 break;
109738 case 17: /* cmd ::= COMMIT trans_opt */
109739 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18);
109740 {sqlite3CommitTransaction(pParse);}
109741 break;
@@ -109685,11 +109757,11 @@
109757 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
109758 }
109759 break;
109760 case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
109761 {
109762 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392);
109763 }
109764 break;
109765 case 27: /* createkw ::= CREATE */
109766 {
109767 pParse->db->lookaside.bEnabled = 0;
@@ -109704,33 +109776,33 @@
109776 case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==87);
109777 case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98);
109778 case 109: /* ifexists ::= */ yytestcase(yyruleno==109);
109779 case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120);
109780 case 121: /* distinct ::= */ yytestcase(yyruleno==121);
109781 case 221: /* between_op ::= BETWEEN */ yytestcase(yyruleno==221);
109782 case 224: /* in_op ::= IN */ yytestcase(yyruleno==224);
109783 {yygotominor.yy392 = 0;}
109784 break;
109785 case 29: /* ifnotexists ::= IF NOT EXISTS */
109786 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30);
109787 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71);
109788 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==86);
109789 case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108);
109790 case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119);
109791 case 222: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==222);
109792 case 225: /* in_op ::= NOT IN */ yytestcase(yyruleno==225);
109793 {yygotominor.yy392 = 1;}
109794 break;
109795 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */
109796 {
109797 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
109798 }
109799 break;
109800 case 33: /* create_table_args ::= AS select */
109801 {
109802 sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy159);
109803 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);
109804 }
109805 break;
109806 case 36: /* column ::= columnid type carglist */
109807 {
109808 yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
@@ -109753,20 +109825,21 @@
109825 case 49: /* typename ::= ids */ yytestcase(yyruleno==49);
109826 case 127: /* as ::= AS nm */ yytestcase(yyruleno==127);
109827 case 128: /* as ::= ids */ yytestcase(yyruleno==128);
109828 case 138: /* dbnm ::= DOT nm */ yytestcase(yyruleno==138);
109829 case 147: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==147);
109830 case 250: /* collate ::= COLLATE ids */ yytestcase(yyruleno==250);
109831 case 259: /* nmnum ::= plus_num */ yytestcase(yyruleno==259);
109832 case 260: /* nmnum ::= nm */ yytestcase(yyruleno==260);
109833 case 261: /* nmnum ::= ON */ yytestcase(yyruleno==261);
109834 case 262: /* nmnum ::= DELETE */ yytestcase(yyruleno==262);
109835 case 263: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==263);
109836 case 264: /* plus_num ::= PLUS number */ yytestcase(yyruleno==264);
109837 case 265: /* plus_num ::= number */ yytestcase(yyruleno==265);
109838 case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266);
109839 case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267);
109840 case 283: /* trnm ::= nm */ yytestcase(yyruleno==283);
109841 {yygotominor.yy0 = yymsp[0].minor.yy0;}
109842 break;
109843 case 45: /* type ::= typetoken */
109844 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
109845 break;
@@ -109785,21 +109858,21 @@
109858 case 50: /* typename ::= typename ids */
109859 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
109860 break;
109861 case 57: /* ccons ::= DEFAULT term */
109862 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59);
109863 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);}
109864 break;
109865 case 58: /* ccons ::= DEFAULT LP expr RP */
109866 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);}
109867 break;
109868 case 60: /* ccons ::= DEFAULT MINUS term */
109869 {
109870 ExprSpan v;
109871 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0);
109872 v.zStart = yymsp[-1].minor.yy0.z;
109873 v.zEnd = yymsp[0].minor.yy342.zEnd;
109874 sqlite3AddDefaultValue(pParse,&v);
109875 }
109876 break;
109877 case 61: /* ccons ::= DEFAULT id */
109878 {
@@ -109807,897 +109880,921 @@
109880 spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0);
109881 sqlite3AddDefaultValue(pParse,&v);
109882 }
109883 break;
109884 case 63: /* ccons ::= NOT NULL onconf */
109885 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);}
109886 break;
109887 case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
109888 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);}
109889 break;
109890 case 65: /* ccons ::= UNIQUE onconf */
109891 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);}
109892 break;
109893 case 66: /* ccons ::= CHECK LP expr RP */
109894 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);}
109895 break;
109896 case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */
109897 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);}
109898 break;
109899 case 68: /* ccons ::= defer_subclause */
109900 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);}
109901 break;
109902 case 69: /* ccons ::= COLLATE ids */
109903 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
109904 break;
109905 case 72: /* refargs ::= */
109906 { yygotominor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */}
109907 break;
109908 case 73: /* refargs ::= refargs refarg */
109909 { yygotominor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; }
109910 break;
109911 case 74: /* refarg ::= MATCH nm */
109912 case 75: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==75);
109913 { yygotominor.yy207.value = 0; yygotominor.yy207.mask = 0x000000; }
109914 break;
109915 case 76: /* refarg ::= ON DELETE refact */
109916 { yygotominor.yy207.value = yymsp[0].minor.yy392; yygotominor.yy207.mask = 0x0000ff; }
109917 break;
109918 case 77: /* refarg ::= ON UPDATE refact */
109919 { yygotominor.yy207.value = yymsp[0].minor.yy392<<8; yygotominor.yy207.mask = 0x00ff00; }
109920 break;
109921 case 78: /* refact ::= SET NULL */
109922 { yygotominor.yy392 = OE_SetNull; /* EV: R-33326-45252 */}
109923 break;
109924 case 79: /* refact ::= SET DEFAULT */
109925 { yygotominor.yy392 = OE_SetDflt; /* EV: R-33326-45252 */}
109926 break;
109927 case 80: /* refact ::= CASCADE */
109928 { yygotominor.yy392 = OE_Cascade; /* EV: R-33326-45252 */}
109929 break;
109930 case 81: /* refact ::= RESTRICT */
109931 { yygotominor.yy392 = OE_Restrict; /* EV: R-33326-45252 */}
109932 break;
109933 case 82: /* refact ::= NO ACTION */
109934 { yygotominor.yy392 = OE_None; /* EV: R-33326-45252 */}
109935 break;
109936 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
109937 case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==99);
109938 case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==101);
109939 case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104);
109940 {yygotominor.yy392 = yymsp[0].minor.yy392;}
109941 break;
109942 case 88: /* conslist_opt ::= */
109943 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
109944 break;
109945 case 89: /* conslist_opt ::= COMMA conslist */
109946 {yygotominor.yy0 = yymsp[-1].minor.yy0;}
109947 break;
109948 case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
109949 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);}
109950 break;
109951 case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */
109952 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);}
109953 break;
109954 case 96: /* tcons ::= CHECK LP expr RP onconf */
109955 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);}
109956 break;
109957 case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
109958 {
109959 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392);
109960 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392);
109961 }
109962 break;
109963 case 100: /* onconf ::= */
109964 {yygotominor.yy392 = OE_Default;}
109965 break;
109966 case 102: /* orconf ::= */
109967 {yygotominor.yy258 = OE_Default;}
109968 break;
109969 case 103: /* orconf ::= OR resolvetype */
109970 {yygotominor.yy258 = (u8)yymsp[0].minor.yy392;}
109971 break;
109972 case 105: /* resolvetype ::= IGNORE */
109973 {yygotominor.yy392 = OE_Ignore;}
109974 break;
109975 case 106: /* resolvetype ::= REPLACE */
109976 {yygotominor.yy392 = OE_Replace;}
109977 break;
109978 case 107: /* cmd ::= DROP TABLE ifexists fullname */
109979 {
109980 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392);
109981 }
109982 break;
109983 case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */
109984 {
109985 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy159, yymsp[-6].minor.yy392, yymsp[-4].minor.yy392);
109986 }
109987 break;
109988 case 111: /* cmd ::= DROP VIEW ifexists fullname */
109989 {
109990 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392);
109991 }
109992 break;
109993 case 112: /* cmd ::= select */
109994 {
109995 SelectDest dest = {SRT_Output, 0, 0, 0, 0};
109996 sqlite3Select(pParse, yymsp[0].minor.yy159, &dest);
109997 sqlite3ExplainBegin(pParse->pVdbe);
109998 sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy159);
109999 sqlite3ExplainFinish(pParse->pVdbe);
110000 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159);
110001 }
110002 break;
110003 case 113: /* select ::= oneselect */
110004 {yygotominor.yy159 = yymsp[0].minor.yy159;}
110005 break;
110006 case 114: /* select ::= select multiselect_op oneselect */
110007 {
110008 if( yymsp[0].minor.yy159 ){
110009 yymsp[0].minor.yy159->op = (u8)yymsp[-1].minor.yy392;
110010 yymsp[0].minor.yy159->pPrior = yymsp[-2].minor.yy159;
110011 }else{
110012 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy159);
110013 }
110014 yygotominor.yy159 = yymsp[0].minor.yy159;
110015 }
110016 break;
110017 case 116: /* multiselect_op ::= UNION ALL */
110018 {yygotominor.yy392 = TK_ALL;}
110019 break;
110020 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
110021 {
110022 yygotominor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset);
110023 }
110024 break;
110025 case 122: /* sclp ::= selcollist COMMA */
110026 case 246: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==246);
110027 {yygotominor.yy442 = yymsp[-1].minor.yy442;}
110028 break;
110029 case 123: /* sclp ::= */
110030 case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151);
110031 case 158: /* groupby_opt ::= */ yytestcase(yyruleno==158);
110032 case 239: /* exprlist ::= */ yytestcase(yyruleno==239);
110033 case 245: /* idxlist_opt ::= */ yytestcase(yyruleno==245);
110034 {yygotominor.yy442 = 0;}
110035 break;
110036 case 124: /* selcollist ::= sclp expr as */
110037 {
110038 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr);
110039 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[0].minor.yy0, 1);
110040 sqlite3ExprListSetSpan(pParse,yygotominor.yy442,&yymsp[-1].minor.yy342);
110041 }
110042 break;
110043 case 125: /* selcollist ::= sclp STAR */
110044 {
110045 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0);
110046 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p);
110047 }
110048 break;
110049 case 126: /* selcollist ::= sclp nm DOT STAR */
110050 {
110051 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
110052 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110053 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
110054 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot);
110055 }
110056 break;
110057 case 129: /* as ::= */
110058 {yygotominor.yy0.n = 0;}
110059 break;
110060 case 130: /* from ::= */
110061 {yygotominor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy347));}
110062 break;
110063 case 131: /* from ::= FROM seltablist */
110064 {
110065 yygotominor.yy347 = yymsp[0].minor.yy347;
110066 sqlite3SrcListShiftJoinType(yygotominor.yy347);
110067 }
110068 break;
110069 case 132: /* stl_prefix ::= seltablist joinop */
110070 {
110071 yygotominor.yy347 = yymsp[-1].minor.yy347;
110072 if( ALWAYS(yygotominor.yy347 && yygotominor.yy347->nSrc>0) ) yygotominor.yy347->a[yygotominor.yy347->nSrc-1].jointype = (u8)yymsp[0].minor.yy392;
110073 }
110074 break;
110075 case 133: /* stl_prefix ::= */
110076 {yygotominor.yy347 = 0;}
110077 break;
110078 case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
110079 {
110080 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110081 sqlite3SrcListIndexedBy(pParse, yygotominor.yy347, &yymsp[-2].minor.yy0);
110082 }
110083 break;
110084 case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
110085 {
110086 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110087 }
110088 break;
110089 case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
110090 {
110091 if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){
110092 yygotominor.yy347 = yymsp[-4].minor.yy347;
110093 }else{
110094 Select *pSubquery;
110095 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347);
110096 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0);
110097 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180);
110098 }
110099 }
110100 break;
110101 case 137: /* dbnm ::= */
110102 case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146);
110103 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
110104 break;
110105 case 139: /* fullname ::= nm dbnm */
110106 {yygotominor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
110107 break;
110108 case 140: /* joinop ::= COMMA|JOIN */
110109 { yygotominor.yy392 = JT_INNER; }
110110 break;
110111 case 141: /* joinop ::= JOIN_KW JOIN */
110112 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
110113 break;
110114 case 142: /* joinop ::= JOIN_KW nm JOIN */
110115 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
110116 break;
110117 case 143: /* joinop ::= JOIN_KW nm nm JOIN */
110118 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
110119 break;
110120 case 144: /* on_opt ::= ON expr */
110121 case 161: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==161);
110122 case 168: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==168);
110123 case 234: /* case_else ::= ELSE expr */ yytestcase(yyruleno==234);
110124 case 236: /* case_operand ::= expr */ yytestcase(yyruleno==236);
110125 {yygotominor.yy122 = yymsp[0].minor.yy342.pExpr;}
 
110126 break;
110127 case 145: /* on_opt ::= */
110128 case 160: /* having_opt ::= */ yytestcase(yyruleno==160);
110129 case 167: /* where_opt ::= */ yytestcase(yyruleno==167);
110130 case 235: /* case_else ::= */ yytestcase(yyruleno==235);
110131 case 237: /* case_operand ::= */ yytestcase(yyruleno==237);
110132 {yygotominor.yy122 = 0;}
110133 break;
110134 case 148: /* indexed_opt ::= NOT INDEXED */
110135 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;}
110136 break;
110137 case 149: /* using_opt ::= USING LP inscollist RP */
110138 case 180: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==180);
110139 {yygotominor.yy180 = yymsp[-1].minor.yy180;}
110140 break;
110141 case 150: /* using_opt ::= */
110142 case 179: /* inscollist_opt ::= */ yytestcase(yyruleno==179);
110143 {yygotominor.yy180 = 0;}
110144 break;
110145 case 152: /* orderby_opt ::= ORDER BY sortlist */
110146 case 159: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==159);
110147 case 238: /* exprlist ::= nexprlist */ yytestcase(yyruleno==238);
110148 {yygotominor.yy442 = yymsp[0].minor.yy442;}
110149 break;
110150 case 153: /* sortlist ::= sortlist COMMA expr sortorder */
110151 {
110152 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr);
110153 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110154 }
110155 break;
110156 case 154: /* sortlist ::= expr sortorder */
110157 {
110158 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr);
110159 if( yygotominor.yy442 && ALWAYS(yygotominor.yy442->a) ) yygotominor.yy442->a[0].sortOrder = (u8)yymsp[0].minor.yy392;
110160 }
110161 break;
110162 case 155: /* sortorder ::= ASC */
110163 case 157: /* sortorder ::= */ yytestcase(yyruleno==157);
110164 {yygotominor.yy392 = SQLITE_SO_ASC;}
110165 break;
110166 case 156: /* sortorder ::= DESC */
110167 {yygotominor.yy392 = SQLITE_SO_DESC;}
110168 break;
110169 case 162: /* limit_opt ::= */
110170 {yygotominor.yy64.pLimit = 0; yygotominor.yy64.pOffset = 0;}
110171 break;
110172 case 163: /* limit_opt ::= LIMIT expr */
110173 {yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yygotominor.yy64.pOffset = 0;}
110174 break;
110175 case 164: /* limit_opt ::= LIMIT expr OFFSET expr */
110176 {yygotominor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;}
110177 break;
110178 case 165: /* limit_opt ::= LIMIT expr COMMA expr */
110179 {yygotominor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;}
110180 break;
110181 case 166: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */
110182 {
110183 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0);
110184 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122);
110185 }
110186 break;
110187 case 169: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */
110188 {
110189 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0);
110190 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list");
110191 sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy258);
110192 }
110193 break;
110194 case 170: /* setlist ::= setlist COMMA nm EQ expr */
110195 {
110196 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr);
110197 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110198 }
110199 break;
110200 case 171: /* setlist ::= nm EQ expr */
110201 {
110202 yygotominor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr);
110203 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110204 }
110205 break;
110206 case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt valuelist */
110207 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}
110208 break;
110209 case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
110210 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, 0, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy258);}
110211 break;
110212 case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
110213 {sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy258);}
110214 break;
110215 case 175: /* insert_cmd ::= INSERT orconf */
110216 {yygotominor.yy258 = yymsp[0].minor.yy258;}
110217 break;
110218 case 176: /* insert_cmd ::= REPLACE */
110219 {yygotominor.yy258 = OE_Replace;}
110220 break;
110221 case 177: /* valuelist ::= VALUES LP nexprlist RP */
110222 {
110223 yygotominor.yy487.pList = yymsp[-1].minor.yy442;
110224 yygotominor.yy487.pSelect = 0;
110225 }
110226 break;
110227 case 178: /* valuelist ::= valuelist COMMA LP exprlist RP */
110228 {
110229 Select *pRight = sqlite3SelectNew(pParse, yymsp[-1].minor.yy442, 0, 0, 0, 0, 0, 0, 0, 0);
110230 if( yymsp[-4].minor.yy487.pList ){
110231 yymsp[-4].minor.yy487.pSelect = sqlite3SelectNew(pParse, yymsp[-4].minor.yy487.pList, 0, 0, 0, 0, 0, 0, 0, 0);
110232 yymsp[-4].minor.yy487.pList = 0;
110233 }
110234 yygotominor.yy487.pList = 0;
110235 if( yymsp[-4].minor.yy487.pSelect==0 || pRight==0 ){
110236 sqlite3SelectDelete(pParse->db, pRight);
110237 sqlite3SelectDelete(pParse->db, yymsp[-4].minor.yy487.pSelect);
110238 yygotominor.yy487.pSelect = 0;
110239 }else{
110240 pRight->op = TK_ALL;
110241 pRight->pPrior = yymsp[-4].minor.yy487.pSelect;
110242 pRight->selFlags |= SF_Values;
110243 pRight->pPrior->selFlags |= SF_Values;
110244 yygotominor.yy487.pSelect = pRight;
110245 }
110246 }
110247 break;
110248 case 181: /* inscollist ::= inscollist COMMA nm */
110249 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);}
110250 break;
110251 case 182: /* inscollist ::= nm */
110252 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
110253 break;
110254 case 183: /* expr ::= term */
110255 {yygotominor.yy342 = yymsp[0].minor.yy342;}
110256 break;
110257 case 184: /* expr ::= LP expr RP */
110258 {yygotominor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr; spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);}
110259 break;
110260 case 185: /* term ::= NULL */
110261 case 190: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==190);
110262 case 191: /* term ::= STRING */ yytestcase(yyruleno==191);
110263 {spanExpr(&yygotominor.yy342, pParse, yymsp[0].major, &yymsp[0].minor.yy0);}
110264 break;
110265 case 186: /* expr ::= id */
110266 case 187: /* expr ::= JOIN_KW */ yytestcase(yyruleno==187);
110267 {spanExpr(&yygotominor.yy342, pParse, TK_ID, &yymsp[0].minor.yy0);}
110268 break;
110269 case 188: /* expr ::= nm DOT nm */
110270 {
110271 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110272 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110273 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
110274 spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
110275 }
110276 break;
110277 case 189: /* expr ::= nm DOT nm DOT nm */
110278 {
110279 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
110280 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
110281 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
110282 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
110283 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
110284 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110285 }
110286 break;
110287 case 192: /* expr ::= REGISTER */
110288 {
110289 /* When doing a nested parse, one can include terms in an expression
110290 ** that look like this: #1 #2 ... These terms refer to registers
110291 ** in the virtual machine. #N is the N-th register. */
110292 if( pParse->nested==0 ){
110293 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0);
110294 yygotominor.yy342.pExpr = 0;
110295 }else{
110296 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0);
110297 if( yygotominor.yy342.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy342.pExpr->iTable);
110298 }
110299 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110300 }
110301 break;
110302 case 193: /* expr ::= VARIABLE */
110303 {
110304 spanExpr(&yygotominor.yy342, pParse, TK_VARIABLE, &yymsp[0].minor.yy0);
110305 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy342.pExpr);
110306 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110307 }
110308 break;
110309 case 194: /* expr ::= expr COLLATE ids */
110310 {
110311 yygotominor.yy342.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0);
110312 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;
110313 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110314 }
110315 break;
110316 case 195: /* expr ::= CAST LP expr AS typetoken RP */
110317 {
110318 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0);
110319 spanSet(&yygotominor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
110320 }
110321 break;
110322 case 196: /* expr ::= ID LP distinct exprlist RP */
110323 {
110324 if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
110325 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
110326 }
110327 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0);
110328 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
110329 if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){
110330 yygotominor.yy342.pExpr->flags |= EP_Distinct;
110331 }
110332 }
110333 break;
110334 case 197: /* expr ::= ID LP STAR RP */
110335 {
110336 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
110337 spanSet(&yygotominor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
110338 }
110339 break;
110340 case 198: /* term ::= CTIME_KW */
110341 {
110342 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
110343 ** treated as functions that return constants */
110344 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
110345 if( yygotominor.yy342.pExpr ){
110346 yygotominor.yy342.pExpr->op = TK_CONST_FUNC;
110347 }
110348 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
110349 }
110350 break;
110351 case 199: /* expr ::= expr AND expr */
110352 case 200: /* expr ::= expr OR expr */ yytestcase(yyruleno==200);
110353 case 201: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==201);
110354 case 202: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==202);
110355 case 203: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==203);
110356 case 204: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==204);
110357 case 205: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==205);
110358 case 206: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==206);
110359 {spanBinaryExpr(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);}
110360 break;
110361 case 207: /* likeop ::= LIKE_KW */
110362 case 209: /* likeop ::= MATCH */ yytestcase(yyruleno==209);
110363 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 0;}
110364 break;
110365 case 208: /* likeop ::= NOT LIKE_KW */
110366 case 210: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==210);
110367 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 1;}
110368 break;
110369 case 211: /* expr ::= expr likeop expr */
110370 {
110371 ExprList *pList;
110372 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr);
110373 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr);
110374 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator);
110375 if( yymsp[-1].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110376 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart;
110377 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110378 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;
110379 }
110380 break;
110381 case 212: /* expr ::= expr likeop expr ESCAPE expr */
110382 {
110383 ExprList *pList;
110384 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110385 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr);
110386 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);
110387 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator);
110388 if( yymsp[-3].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110389 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110390 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110391 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc;
110392 }
110393 break;
110394 case 213: /* expr ::= expr ISNULL|NOTNULL */
110395 {spanUnaryPostfix(&yygotominor.yy342,pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);}
110396 break;
110397 case 214: /* expr ::= expr NOT NULL */
110398 {spanUnaryPostfix(&yygotominor.yy342,pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);}
110399 break;
110400 case 215: /* expr ::= expr IS expr */
110401 {
110402 spanBinaryExpr(&yygotominor.yy342,pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);
110403 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_ISNULL);
110404 }
110405 break;
110406 case 216: /* expr ::= expr IS NOT expr */
110407 {
110408 spanBinaryExpr(&yygotominor.yy342,pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342);
110409 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExpr, TK_NOTNULL);
110410 }
110411 break;
110412 case 217: /* expr ::= NOT expr */
110413 case 218: /* expr ::= BITNOT expr */ yytestcase(yyruleno==218);
110414 {spanUnaryPrefix(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110415 break;
110416 case 219: /* expr ::= MINUS expr */
110417 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110418 break;
110419 case 220: /* expr ::= PLUS expr */
110420 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);}
110421 break;
110422 case 223: /* expr ::= expr between_op expr AND expr */
110423 {
110424 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110425 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr);
110426 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110427 if( yygotominor.yy342.pExpr ){
110428 yygotominor.yy342.pExpr->x.pList = pList;
110429 }else{
110430 sqlite3ExprListDelete(pParse->db, pList);
110431 }
110432 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110433 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110434 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd;
110435 }
110436 break;
110437 case 226: /* expr ::= expr in_op LP exprlist RP */
110438 {
110439 if( yymsp[-1].minor.yy442==0 ){
110440 /* Expressions of the form
110441 **
110442 ** expr1 IN ()
110443 ** expr1 NOT IN ()
110444 **
110445 ** simplify to constants 0 (false) and 1 (true), respectively,
110446 ** regardless of the value of expr1.
110447 */
110448 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]);
110449 sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr);
110450 }else{
110451 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110452 if( yygotominor.yy342.pExpr ){
110453 yygotominor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442;
110454 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110455 }else{
110456 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442);
110457 }
110458 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110459 }
110460 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110461 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110462 }
110463 break;
110464 case 227: /* expr ::= LP select RP */
110465 {
110466 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
110467 if( yygotominor.yy342.pExpr ){
110468 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;
110469 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110470 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110471 }else{
110472 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110473 }
110474 yygotominor.yy342.zStart = yymsp[-2].minor.yy0.z;
110475 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110476 }
110477 break;
110478 case 228: /* expr ::= expr in_op LP select RP */
110479 {
110480 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0);
110481 if( yygotominor.yy342.pExpr ){
110482 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159;
110483 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110484 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110485 }else{
110486 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110487 }
110488 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110489 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart;
110490 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110491 }
110492 break;
110493 case 229: /* expr ::= expr in_op nm dbnm */
110494 {
110495 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
110496 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0);
110497 if( yygotominor.yy342.pExpr ){
110498 yygotominor.yy342.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
110499 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect);
110500 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110501 }else{
110502 sqlite3SrcListDelete(pParse->db, pSrc);
110503 }
110504 if( yymsp[-2].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy342.pExpr, 0, 0);
110505 yygotominor.yy342.zStart = yymsp[-3].minor.yy342.zStart;
110506 yygotominor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n];
110507 }
110508 break;
110509 case 230: /* expr ::= EXISTS LP select RP */
110510 {
110511 Expr *p = yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
110512 if( p ){
110513 p->x.pSelect = yymsp[-1].minor.yy159;
110514 ExprSetProperty(p, EP_xIsSelect);
110515 sqlite3ExprSetHeight(pParse, p);
110516 }else{
110517 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159);
110518 }
110519 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;
110520 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110521 }
110522 break;
110523 case 231: /* expr ::= CASE case_operand case_exprlist case_else END */
110524 {
110525 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, yymsp[-1].minor.yy122, 0);
110526 if( yygotominor.yy342.pExpr ){
110527 yygotominor.yy342.pExpr->x.pList = yymsp[-2].minor.yy442;
110528 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr);
110529 }else{
110530 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442);
110531 }
110532 yygotominor.yy342.zStart = yymsp[-4].minor.yy0.z;
110533 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110534 }
110535 break;
110536 case 232: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
110537 {
110538 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr);
110539 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);
110540 }
110541 break;
110542 case 233: /* case_exprlist ::= WHEN expr THEN expr */
110543 {
110544 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr);
110545 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].minor.yy342.pExpr);
110546 }
110547 break;
110548 case 240: /* nexprlist ::= nexprlist COMMA expr */
110549 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);}
110550 break;
110551 case 241: /* nexprlist ::= expr */
110552 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr);}
110553 break;
110554 case 242: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
110555 {
110556 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0,
110557 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy442, yymsp[-9].minor.yy392,
110558 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy392);
110559 }
110560 break;
110561 case 243: /* uniqueflag ::= UNIQUE */
110562 case 296: /* raisetype ::= ABORT */ yytestcase(yyruleno==296);
110563 {yygotominor.yy392 = OE_Abort;}
110564 break;
110565 case 244: /* uniqueflag ::= */
110566 {yygotominor.yy392 = OE_None;}
110567 break;
110568 case 247: /* idxlist ::= idxlist COMMA nm collate sortorder */
110569 {
110570 Expr *p = 0;
110571 if( yymsp[-1].minor.yy0.n>0 ){
110572 p = sqlite3Expr(pParse->db, TK_COLUMN, 0);
110573 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110574 }
110575 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, p);
110576 sqlite3ExprListSetName(pParse,yygotominor.yy442,&yymsp[-2].minor.yy0,1);
110577 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index");
110578 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110579 }
110580 break;
110581 case 248: /* idxlist ::= nm collate sortorder */
110582 {
110583 Expr *p = 0;
110584 if( yymsp[-1].minor.yy0.n>0 ){
110585 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
110586 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0);
110587 }
110588 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, p);
110589 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1);
110590 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index");
110591 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy392;
110592 }
110593 break;
110594 case 249: /* collate ::= */
110595 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
110596 break;
110597 case 251: /* cmd ::= DROP INDEX ifexists fullname */
110598 {sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);}
110599 break;
110600 case 252: /* cmd ::= VACUUM */
110601 case 253: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==253);
110602 {sqlite3Vacuum(pParse);}
110603 break;
110604 case 254: /* cmd ::= PRAGMA nm dbnm */
110605 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
110606 break;
110607 case 255: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
110608 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
110609 break;
110610 case 256: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
110611 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
110612 break;
110613 case 257: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
110614 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
110615 break;
110616 case 258: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
110617 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
110618 break;
110619 case 268: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
110620 {
110621 Token all;
110622 all.z = yymsp[-3].minor.yy0.z;
110623 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
110624 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all);
110625 }
110626 break;
110627 case 269: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
110628 {
110629 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392);
110630 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
110631 }
110632 break;
110633 case 270: /* trigger_time ::= BEFORE */
110634 case 273: /* trigger_time ::= */ yytestcase(yyruleno==273);
110635 { yygotominor.yy392 = TK_BEFORE; }
110636 break;
110637 case 271: /* trigger_time ::= AFTER */
110638 { yygotominor.yy392 = TK_AFTER; }
110639 break;
110640 case 272: /* trigger_time ::= INSTEAD OF */
110641 { yygotominor.yy392 = TK_INSTEAD;}
110642 break;
110643 case 274: /* trigger_event ::= DELETE|INSERT */
110644 case 275: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==275);
110645 {yygotominor.yy410.a = yymsp[0].major; yygotominor.yy410.b = 0;}
110646 break;
110647 case 276: /* trigger_event ::= UPDATE OF inscollist */
110648 {yygotominor.yy410.a = TK_UPDATE; yygotominor.yy410.b = yymsp[0].minor.yy180;}
110649 break;
110650 case 279: /* when_clause ::= */
110651 case 301: /* key_opt ::= */ yytestcase(yyruleno==301);
110652 { yygotominor.yy122 = 0; }
110653 break;
110654 case 280: /* when_clause ::= WHEN expr */
110655 case 302: /* key_opt ::= KEY expr */ yytestcase(yyruleno==302);
110656 { yygotominor.yy122 = yymsp[0].minor.yy342.pExpr; }
110657 break;
110658 case 281: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
110659 {
110660 assert( yymsp[-2].minor.yy327!=0 );
110661 yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327;
110662 yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327;
110663 yygotominor.yy327 = yymsp[-2].minor.yy327;
110664 }
110665 break;
110666 case 282: /* trigger_cmd_list ::= trigger_cmd SEMI */
110667 {
110668 assert( yymsp[-1].minor.yy327!=0 );
110669 yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327;
110670 yygotominor.yy327 = yymsp[-1].minor.yy327;
110671 }
110672 break;
110673 case 284: /* trnm ::= nm DOT nm */
110674 {
110675 yygotominor.yy0 = yymsp[0].minor.yy0;
110676 sqlite3ErrorMsg(pParse,
110677 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
110678 "statements within triggers");
110679 }
110680 break;
110681 case 286: /* tridxby ::= INDEXED BY nm */
110682 {
110683 sqlite3ErrorMsg(pParse,
110684 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
110685 "within triggers");
110686 }
110687 break;
110688 case 287: /* tridxby ::= NOT INDEXED */
110689 {
110690 sqlite3ErrorMsg(pParse,
110691 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
110692 "within triggers");
110693 }
110694 break;
110695 case 288: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
110696 { yygotominor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy258); }
110697 break;
110698 case 289: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist */
110699 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy487.pList, yymsp[0].minor.yy487.pSelect, yymsp[-4].minor.yy258);}
110700 break;
110701 case 290: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */
110702 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, 0, yymsp[0].minor.yy159, yymsp[-4].minor.yy258);}
110703 break;
110704 case 291: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
110705 {yygotominor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);}
110706 break;
110707 case 292: /* trigger_cmd ::= select */
110708 {yygotominor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); }
110709 break;
110710 case 293: /* expr ::= RAISE LP IGNORE RP */
110711 {
110712 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0);
110713 if( yygotominor.yy342.pExpr ){
110714 yygotominor.yy342.pExpr->affinity = OE_Ignore;
110715 }
110716 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z;
110717 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110718 }
110719 break;
110720 case 294: /* expr ::= RAISE LP raisetype COMMA nm RP */
110721 {
110722 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0);
110723 if( yygotominor.yy342.pExpr ) {
110724 yygotominor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392;
110725 }
110726 yygotominor.yy342.zStart = yymsp[-5].minor.yy0.z;
110727 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
110728 }
110729 break;
110730 case 295: /* raisetype ::= ROLLBACK */
110731 {yygotominor.yy392 = OE_Rollback;}
110732 break;
110733 case 297: /* raisetype ::= FAIL */
110734 {yygotominor.yy392 = OE_Fail;}
110735 break;
110736 case 298: /* cmd ::= DROP TRIGGER ifexists fullname */
110737 {
110738 sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392);
110739 }
110740 break;
110741 case 299: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
110742 {
110743 sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122);
110744 }
110745 break;
110746 case 300: /* cmd ::= DETACH database_kw_opt expr */
110747 {
110748 sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr);
110749 }
110750 break;
110751 case 305: /* cmd ::= REINDEX */
110752 {sqlite3Reindex(pParse, 0, 0);}
110753 break;
110754 case 306: /* cmd ::= REINDEX nm dbnm */
110755 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110756 break;
110757 case 307: /* cmd ::= ANALYZE */
110758 {sqlite3Analyze(pParse, 0, 0);}
110759 break;
110760 case 308: /* cmd ::= ANALYZE nm dbnm */
110761 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
110762 break;
110763 case 309: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
110764 {
110765 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0);
110766 }
110767 break;
110768 case 310: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
110769 {
110770 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
110771 }
110772 break;
110773 case 311: /* add_column_fullname ::= fullname */
110774 {
110775 pParse->db->lookaside.bEnabled = 0;
110776 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347);
110777 }
110778 break;
110779 case 314: /* cmd ::= create_vtab */
110780 {sqlite3VtabFinishParse(pParse,0);}
110781 break;
110782 case 315: /* cmd ::= create_vtab LP vtabarglist RP */
110783 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
110784 break;
110785 case 316: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
110786 {
110787 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392);
110788 }
110789 break;
110790 case 319: /* vtabarg ::= */
110791 {sqlite3VtabArgInit(pParse);}
110792 break;
110793 case 321: /* vtabargtoken ::= ANY */
110794 case 322: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==322);
110795 case 323: /* lp ::= LP */ yytestcase(yyruleno==323);
110796 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
110797 break;
110798 default:
110799 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
110800 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
@@ -110722,25 +110819,23 @@
110819 /* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62);
110820 /* (90) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==90);
110821 /* (91) conslist ::= conslist tcons */ yytestcase(yyruleno==91);
110822 /* (92) conslist ::= tcons */ yytestcase(yyruleno==92);
110823 /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);
110824 /* (277) foreach_clause ::= */ yytestcase(yyruleno==277);
110825 /* (278) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==278);
110826 /* (285) tridxby ::= */ yytestcase(yyruleno==285);
110827 /* (303) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==303);
110828 /* (304) database_kw_opt ::= */ yytestcase(yyruleno==304);
110829 /* (312) kwcolumn_opt ::= */ yytestcase(yyruleno==312);
110830 /* (313) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==313);
110831 /* (317) vtabarglist ::= vtabarg */ yytestcase(yyruleno==317);
110832 /* (318) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==318);
110833 /* (320) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==320);
110834 /* (324) anylist ::= */ yytestcase(yyruleno==324);
110835 /* (325) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==325);
110836 /* (326) anylist ::= anylist ANY */ yytestcase(yyruleno==326);
 
 
110837 break;
110838 };
110839 yygoto = yyRuleInfo[yyruleno].lhs;
110840 yysize = yyRuleInfo[yyruleno].nrhs;
110841 yypParser->yyidx -= yysize;
@@ -115167,11 +115262,12 @@
115262 /*
115263 ** Return a boolean value for a query parameter.
115264 */
115265 SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){
115266 const char *z = sqlite3_uri_parameter(zFilename, zParam);
115267 bDflt = bDflt!=0;
115268 return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
115269 }
115270
115271 /*
115272 ** Return a 64-bit integer value for a query parameter.
115273 */
@@ -116503,11 +116599,11 @@
116599 /* fts3_write.c */
116600 SQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*);
116601 SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *);
116602 SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *);
116603 SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *);
116604 SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, int, sqlite3_int64,
116605 sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**);
116606 SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
116607 Fts3Table*,int,const char*,int,int,Fts3SegReader**);
116608 SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *);
116609 SQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, sqlite3_stmt **);
@@ -118931,11 +119027,13 @@
119027 if( rc!=SQLITE_OK ) goto finished;
119028 if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;
119029 }
119030
119031 rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1,
119032 (isPrefix==0 && isScan==0),
119033 iStartBlock, iLeavesEndBlock,
119034 iEndBlock, zRoot, nRoot, &pSeg
119035 );
119036 if( rc!=SQLITE_OK ) goto finished;
119037 rc = fts3SegReaderCursorAppend(pCsr, pSeg);
119038 }
119039 }
@@ -124753,10 +124851,11 @@
124851 ** fts3SegReaderFirstDocid()
124852 ** fts3SegReaderNextDocid()
124853 */
124854 struct Fts3SegReader {
124855 int iIdx; /* Index within level, or 0x7FFFFFFF for PT */
124856 int bLookup; /* True for a lookup only */
124857
124858 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
124859 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
124860 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
124861 sqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */
@@ -125730,10 +125829,22 @@
125829 ){
125830 rc = fts3SegReaderIncrRead(pReader);
125831 }
125832 return rc;
125833 }
125834
125835 /*
125836 ** Set an Fts3SegReader cursor to point at EOF.
125837 */
125838 static void fts3SegReaderSetEof(Fts3SegReader *pSeg){
125839 if( !fts3SegReaderIsRootOnly(pSeg) ){
125840 sqlite3_free(pSeg->aNode);
125841 sqlite3_blob_close(pSeg->pBlob);
125842 pSeg->pBlob = 0;
125843 }
125844 pSeg->aNode = 0;
125845 }
125846
125847 /*
125848 ** Move the iterator passed as the first argument to the next term in the
125849 ** segment. If successful, SQLITE_OK is returned. If there is no next term,
125850 ** SQLITE_DONE. Otherwise, an SQLite error code.
@@ -125770,16 +125881,11 @@
125881 assert( pReader->aNode );
125882 }
125883 return SQLITE_OK;
125884 }
125885
125886 fts3SegReaderSetEof(pReader);
 
 
 
 
 
125887
125888 /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf
125889 ** blocks have already been traversed. */
125890 assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );
125891 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
@@ -126022,10 +126128,11 @@
126128 /*
126129 ** Allocate a new SegReader object.
126130 */
126131 SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
126132 int iAge, /* Segment "age". */
126133 int bLookup, /* True for a lookup only */
126134 sqlite3_int64 iStartLeaf, /* First leaf to traverse */
126135 sqlite3_int64 iEndLeaf, /* Final leaf to traverse */
126136 sqlite3_int64 iEndBlock, /* Final block of segment */
126137 const char *zRoot, /* Buffer containing root node */
126138 int nRoot, /* Size of buffer containing root node */
@@ -126043,10 +126150,11 @@
126150 if( !pReader ){
126151 return SQLITE_NOMEM;
126152 }
126153 memset(pReader, 0, sizeof(Fts3SegReader));
126154 pReader->iIdx = iAge;
126155 pReader->bLookup = bLookup;
126156 pReader->iStartBlock = iStartLeaf;
126157 pReader->iLeafEndBlock = iEndLeaf;
126158 pReader->iEndBlock = iEndBlock;
126159
126160 if( nExtra ){
@@ -127045,15 +127153,20 @@
127153 ** equal or greater value than the specified term. This prevents many
127154 ** unnecessary merge/sort operations for the case where single segment
127155 ** b-tree leaf nodes contain more than one term.
127156 */
127157 for(i=0; pCsr->bRestart==0 && i<pCsr->nSegment; i++){
127158 int res = 0;
127159 Fts3SegReader *pSeg = pCsr->apSegment[i];
127160 do {
127161 int rc = fts3SegReaderNext(p, pSeg, 0);
127162 if( rc!=SQLITE_OK ) return rc;
127163 }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );
127164
127165 if( pSeg->bLookup && res!=0 ){
127166 fts3SegReaderSetEof(pSeg);
127167 }
127168 }
127169 fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp);
127170
127171 return SQLITE_OK;
127172 }
@@ -127170,11 +127283,16 @@
127283
127284 /* Advance the first pCsr->nAdvance entries in the apSegment[] array
127285 ** forward. Then sort the list in order of current term again.
127286 */
127287 for(i=0; i<pCsr->nAdvance; i++){
127288 Fts3SegReader *pSeg = apSegment[i];
127289 if( pSeg->bLookup ){
127290 fts3SegReaderSetEof(pSeg);
127291 }else{
127292 rc = fts3SegReaderNext(p, pSeg, 0);
127293 }
127294 if( rc!=SQLITE_OK ) return rc;
127295 }
127296 fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp);
127297 pCsr->nAdvance = 0;
127298
127299
+19 -11
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105105
**
106106
** See also: [sqlite3_libversion()],
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110
-#define SQLITE_VERSION "3.7.10"
111
-#define SQLITE_VERSION_NUMBER 3007010
112
-#define SQLITE_SOURCE_ID "2012-01-11 16:16:08 9e31a275ef494ea8713a1d60a15b84157e57c3ff"
110
+#define SQLITE_VERSION "3.7.11"
111
+#define SQLITE_VERSION_NUMBER 3007011
112
+#define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
@@ -2630,33 +2630,41 @@
26302630
**
26312631
** These are utility routines, useful to VFS implementations, that check
26322632
** to see if a database file was a URI that contained a specific query
26332633
** parameter, and if so obtains the value of that query parameter.
26342634
**
2635
-** If F is the filename pointer passed into the xOpen() method of a VFS
2636
-** implementation and P is the name of the query parameter, then
2635
+** If F is the database filename pointer passed into the xOpen() method of
2636
+** a VFS implementation when the flags parameter to xOpen() has one or
2637
+** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
2638
+** P is the name of the query parameter, then
26372639
** sqlite3_uri_parameter(F,P) returns the value of the P
26382640
** parameter if it exists or a NULL pointer if P does not appear as a
26392641
** query parameter on F. If P is a query parameter of F
26402642
** has no explicit value, then sqlite3_uri_parameter(F,P) returns
26412643
** a pointer to an empty string.
26422644
**
26432645
** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
26442646
** parameter and returns true (1) or false (0) according to the value
2645
-** of P. The value of P is true if it is "yes" or "true" or "on" or
2646
-** a non-zero number and is false otherwise. If P is not a query parameter
2647
-** on F then sqlite3_uri_boolean(F,P,B) returns (B!=0).
2647
+** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
2648
+** value of query parameter P is one of "yes", "true", or "on" in any
2649
+** case or if the value begins with a non-zero number. The
2650
+** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
2651
+** query parameter P is one of "no", "false", or "off" in any case or
2652
+** if the value begins with a numeric zero. If P is not a query
2653
+** parameter on F or if the value of P is does not match any of the
2654
+** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
26482655
**
26492656
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
26502657
** 64-bit signed integer and returns that integer, or D if P does not
26512658
** exist. If the value of P is something other than an integer, then
26522659
** zero is returned.
26532660
**
26542661
** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
26552662
** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
2656
-** is not a pathname pointer that SQLite passed into the xOpen VFS method,
2657
-** then the behavior of this routine is undefined and probably undesirable.
2663
+** is not a database file pathname pointer that SQLite passed into the xOpen
2664
+** VFS method, then the behavior of this routine is undefined and probably
2665
+** undesirable.
26582666
*/
26592667
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
26602668
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
26612669
SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
26622670
@@ -6208,11 +6216,11 @@
62086216
** functions.
62096217
**
62106218
** [[the xShrink() page cache method]]
62116219
** ^SQLite invokes the xShrink() method when it wants the page cache to
62126220
** free up as much of heap memory as possible. The page cache implementation
6213
-** is not obligated to free any memory, but well-behaved implementions should
6221
+** is not obligated to free any memory, but well-behaved implementations should
62146222
** do their best.
62156223
*/
62166224
typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
62176225
struct sqlite3_pcache_methods2 {
62186226
int iVersion;
62196227
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.10"
111 #define SQLITE_VERSION_NUMBER 3007010
112 #define SQLITE_SOURCE_ID "2012-01-11 16:16:08 9e31a275ef494ea8713a1d60a15b84157e57c3ff"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -2630,33 +2630,41 @@
2630 **
2631 ** These are utility routines, useful to VFS implementations, that check
2632 ** to see if a database file was a URI that contained a specific query
2633 ** parameter, and if so obtains the value of that query parameter.
2634 **
2635 ** If F is the filename pointer passed into the xOpen() method of a VFS
2636 ** implementation and P is the name of the query parameter, then
 
 
2637 ** sqlite3_uri_parameter(F,P) returns the value of the P
2638 ** parameter if it exists or a NULL pointer if P does not appear as a
2639 ** query parameter on F. If P is a query parameter of F
2640 ** has no explicit value, then sqlite3_uri_parameter(F,P) returns
2641 ** a pointer to an empty string.
2642 **
2643 ** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
2644 ** parameter and returns true (1) or false (0) according to the value
2645 ** of P. The value of P is true if it is "yes" or "true" or "on" or
2646 ** a non-zero number and is false otherwise. If P is not a query parameter
2647 ** on F then sqlite3_uri_boolean(F,P,B) returns (B!=0).
 
 
 
 
 
2648 **
2649 ** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
2650 ** 64-bit signed integer and returns that integer, or D if P does not
2651 ** exist. If the value of P is something other than an integer, then
2652 ** zero is returned.
2653 **
2654 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
2655 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
2656 ** is not a pathname pointer that SQLite passed into the xOpen VFS method,
2657 ** then the behavior of this routine is undefined and probably undesirable.
 
2658 */
2659 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
2660 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
2661 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
2662
@@ -6208,11 +6216,11 @@
6208 ** functions.
6209 **
6210 ** [[the xShrink() page cache method]]
6211 ** ^SQLite invokes the xShrink() method when it wants the page cache to
6212 ** free up as much of heap memory as possible. The page cache implementation
6213 ** is not obligated to free any memory, but well-behaved implementions should
6214 ** do their best.
6215 */
6216 typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
6217 struct sqlite3_pcache_methods2 {
6218 int iVersion;
6219
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.11"
111 #define SQLITE_VERSION_NUMBER 3007011
112 #define SQLITE_SOURCE_ID "2012-02-07 14:13:50 9497893b1b9219eac4ec2183bd90b4e4b860d9fe"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
@@ -2630,33 +2630,41 @@
2630 **
2631 ** These are utility routines, useful to VFS implementations, that check
2632 ** to see if a database file was a URI that contained a specific query
2633 ** parameter, and if so obtains the value of that query parameter.
2634 **
2635 ** If F is the database filename pointer passed into the xOpen() method of
2636 ** a VFS implementation when the flags parameter to xOpen() has one or
2637 ** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
2638 ** P is the name of the query parameter, then
2639 ** sqlite3_uri_parameter(F,P) returns the value of the P
2640 ** parameter if it exists or a NULL pointer if P does not appear as a
2641 ** query parameter on F. If P is a query parameter of F
2642 ** has no explicit value, then sqlite3_uri_parameter(F,P) returns
2643 ** a pointer to an empty string.
2644 **
2645 ** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
2646 ** parameter and returns true (1) or false (0) according to the value
2647 ** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
2648 ** value of query parameter P is one of "yes", "true", or "on" in any
2649 ** case or if the value begins with a non-zero number. The
2650 ** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
2651 ** query parameter P is one of "no", "false", or "off" in any case or
2652 ** if the value begins with a numeric zero. If P is not a query
2653 ** parameter on F or if the value of P is does not match any of the
2654 ** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
2655 **
2656 ** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
2657 ** 64-bit signed integer and returns that integer, or D if P does not
2658 ** exist. If the value of P is something other than an integer, then
2659 ** zero is returned.
2660 **
2661 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
2662 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
2663 ** is not a database file pathname pointer that SQLite passed into the xOpen
2664 ** VFS method, then the behavior of this routine is undefined and probably
2665 ** undesirable.
2666 */
2667 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
2668 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
2669 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
2670
@@ -6208,11 +6216,11 @@
6216 ** functions.
6217 **
6218 ** [[the xShrink() page cache method]]
6219 ** ^SQLite invokes the xShrink() method when it wants the page cache to
6220 ** free up as much of heap memory as possible. The page cache implementation
6221 ** is not obligated to free any memory, but well-behaved implementations should
6222 ** do their best.
6223 */
6224 typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
6225 struct sqlite3_pcache_methods2 {
6226 int iVersion;
6227

Keyboard Shortcuts

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