Fossil SCM

Merged in trunk.

stephan 2022-01-15 10:09 UTC markdown-tagrefs merge
Commit d11cbb637be32302797e59973b4634edb5cf3170df4808b3d7825f1489e09e16
+7 -7
--- BUILD.txt
+++ BUILD.txt
@@ -55,24 +55,24 @@
5555
and runs various tests with the C compiler to create Makefile
5656
from the Makefile.in template as well as autoconfig.h
5757
5858
* The Makefile just sets up a few macros and then invokes the
5959
real makefile in src/main.mk. The src/main.mk makefile is
60
- automatically generated by a TCL script found at src/makemake.tcl.
61
- Do not edit src/main.mk directly. Update src/makemake.tcl and
60
+ automatically generated by a TCL script found at tools/makemake.tcl.
61
+ Do not edit src/main.mk directly. Update tools/makemake.tcl and
6262
then rerun it.
6363
6464
* The *.h header files are automatically generated using a program
6565
called "makeheaders". Source code to the makeheaders program is
66
- found in src/makeheaders.c. Documentation is found in
67
- src/makeheaders.html.
66
+ found in tools/makeheaders.c. Documentation is found in
67
+ tools/makeheaders.html.
6868
6969
* Most *.c source files are preprocessed using a program called
70
- "translate". The sources to translate are found in src/translate.c.
71
- A header comment in src/translate.c explains in detail what it does.
70
+ "translate". The sources to translate are found in tools/translate.c.
71
+ A header comment in tools/translate.c explains in detail what it does.
7272
73
-* The src/mkindex.c program generates some C code that implements
73
+* The tools/mkindex.c program generates some C code that implements
7474
static lookup tables. See the header comment in the source code
7575
for details on what it does.
7676
7777
Additional information on the build process is available from
7878
http://fossil-scm.org/home/doc/trunk/www/makefile.wiki
7979
--- BUILD.txt
+++ BUILD.txt
@@ -55,24 +55,24 @@
55 and runs various tests with the C compiler to create Makefile
56 from the Makefile.in template as well as autoconfig.h
57
58 * The Makefile just sets up a few macros and then invokes the
59 real makefile in src/main.mk. The src/main.mk makefile is
60 automatically generated by a TCL script found at src/makemake.tcl.
61 Do not edit src/main.mk directly. Update src/makemake.tcl and
62 then rerun it.
63
64 * The *.h header files are automatically generated using a program
65 called "makeheaders". Source code to the makeheaders program is
66 found in src/makeheaders.c. Documentation is found in
67 src/makeheaders.html.
68
69 * Most *.c source files are preprocessed using a program called
70 "translate". The sources to translate are found in src/translate.c.
71 A header comment in src/translate.c explains in detail what it does.
72
73 * The src/mkindex.c program generates some C code that implements
74 static lookup tables. See the header comment in the source code
75 for details on what it does.
76
77 Additional information on the build process is available from
78 http://fossil-scm.org/home/doc/trunk/www/makefile.wiki
79
--- BUILD.txt
+++ BUILD.txt
@@ -55,24 +55,24 @@
55 and runs various tests with the C compiler to create Makefile
56 from the Makefile.in template as well as autoconfig.h
57
58 * The Makefile just sets up a few macros and then invokes the
59 real makefile in src/main.mk. The src/main.mk makefile is
60 automatically generated by a TCL script found at tools/makemake.tcl.
61 Do not edit src/main.mk directly. Update tools/makemake.tcl and
62 then rerun it.
63
64 * The *.h header files are automatically generated using a program
65 called "makeheaders". Source code to the makeheaders program is
66 found in tools/makeheaders.c. Documentation is found in
67 tools/makeheaders.html.
68
69 * Most *.c source files are preprocessed using a program called
70 "translate". The sources to translate are found in tools/translate.c.
71 A header comment in tools/translate.c explains in detail what it does.
72
73 * The tools/mkindex.c program generates some C code that implements
74 static lookup tables. See the header comment in the source code
75 for details on what it does.
76
77 Additional information on the build process is available from
78 http://fossil-scm.org/home/doc/trunk/www/makefile.wiki
79
+1 -1
--- auto.def
+++ auto.def
@@ -33,11 +33,11 @@
3333
}
3434
3535
# Update the minimum required SQLite version number here, and also
3636
# in src/main.c near the sqlite3_libversion_number() call. Take care
3737
# that both places agree!
38
-define MINIMUM_SQLITE_VERSION "3.37.0"
38
+define MINIMUM_SQLITE_VERSION "3.38.0"
3939
4040
# This is useful for people wanting Fossil to use an external SQLite library
4141
# to compare the one they have against the minimum required
4242
if {[opt-bool print-minimum-sqlite-version]} {
4343
puts [get-define MINIMUM_SQLITE_VERSION]
4444
--- auto.def
+++ auto.def
@@ -33,11 +33,11 @@
33 }
34
35 # Update the minimum required SQLite version number here, and also
36 # in src/main.c near the sqlite3_libversion_number() call. Take care
37 # that both places agree!
38 define MINIMUM_SQLITE_VERSION "3.37.0"
39
40 # This is useful for people wanting Fossil to use an external SQLite library
41 # to compare the one they have against the minimum required
42 if {[opt-bool print-minimum-sqlite-version]} {
43 puts [get-define MINIMUM_SQLITE_VERSION]
44
--- auto.def
+++ auto.def
@@ -33,11 +33,11 @@
33 }
34
35 # Update the minimum required SQLite version number here, and also
36 # in src/main.c near the sqlite3_libversion_number() call. Take care
37 # that both places agree!
38 define MINIMUM_SQLITE_VERSION "3.38.0"
39
40 # This is useful for people wanting Fossil to use an external SQLite library
41 # to compare the one they have against the minimum required
42 if {[opt-bool print-minimum-sqlite-version]} {
43 puts [get-define MINIMUM_SQLITE_VERSION]
44
+221 -172
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -443,19 +443,10 @@
443443
/*
444444
** True if an interrupt (Control-C) has been received.
445445
*/
446446
static volatile int seenInterrupt = 0;
447447
448
-#ifdef SQLITE_DEBUG
449
-/*
450
-** Out-of-memory simulator variables
451
-*/
452
-static unsigned int oomCounter = 0; /* Simulate OOM when equals 1 */
453
-static unsigned int oomRepeat = 0; /* Number of OOMs in a row */
454
-static void*(*defaultMalloc)(int) = 0; /* The low-level malloc routine */
455
-#endif /* SQLITE_DEBUG */
456
-
457448
/*
458449
** This is the name of our program. It is set in main(), used
459450
** in a number of other places, mostly for error messages.
460451
*/
461452
static char *Argv0;
@@ -503,52 +494,16 @@
503494
static void shell_out_of_memory(void){
504495
raw_printf(stderr,"Error: out of memory\n");
505496
exit(1);
506497
}
507498
508
-#ifdef SQLITE_DEBUG
509
-/* This routine is called when a simulated OOM occurs. It is broken
510
-** out as a separate routine to make it easy to set a breakpoint on
511
-** the OOM
512
-*/
513
-void shellOomFault(void){
514
- if( oomRepeat>0 ){
515
- oomRepeat--;
516
- }else{
517
- oomCounter--;
518
- }
519
-}
520
-#endif /* SQLITE_DEBUG */
521
-
522
-#ifdef SQLITE_DEBUG
523
-/* This routine is a replacement malloc() that is used to simulate
524
-** Out-Of-Memory (OOM) errors for testing purposes.
525
-*/
526
-static void *oomMalloc(int nByte){
527
- if( oomCounter ){
528
- if( oomCounter==1 ){
529
- shellOomFault();
530
- return 0;
531
- }else{
532
- oomCounter--;
533
- }
534
- }
535
- return defaultMalloc(nByte);
536
-}
537
-#endif /* SQLITE_DEBUG */
538
-
539
-#ifdef SQLITE_DEBUG
540
-/* Register the OOM simulator. This must occur before any memory
541
-** allocations */
542
-static void registerOomSimulator(void){
543
- sqlite3_mem_methods mem;
544
- sqlite3_config(SQLITE_CONFIG_GETMALLOC, &mem);
545
- defaultMalloc = mem.xMalloc;
546
- mem.xMalloc = oomMalloc;
547
- sqlite3_config(SQLITE_CONFIG_MALLOC, &mem);
548
-}
549
-#endif
499
+/* Check a pointer to see if it is NULL. If it is NULL, exit with an
500
+** out-of-memory error.
501
+*/
502
+static void shell_check_oom(void *p){
503
+ if( p==0 ) shell_out_of_memory();
504
+}
550505
551506
/*
552507
** Write I/O traces to the following stream.
553508
*/
554509
#ifdef SQLITE_ENABLE_IOTRACE
@@ -701,11 +656,11 @@
701656
702657
while( 1 ){
703658
if( n+100>nLine ){
704659
nLine = nLine*2 + 100;
705660
zLine = realloc(zLine, nLine);
706
- if( zLine==0 ) shell_out_of_memory();
661
+ shell_check_oom(zLine);
707662
}
708663
if( fgets(&zLine[n], nLine - n, in)==0 ){
709664
if( n==0 ){
710665
free(zLine);
711666
return 0;
@@ -728,11 +683,11 @@
728683
char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
729684
if( zTrans ){
730685
int nTrans = strlen30(zTrans)+1;
731686
if( nTrans>nLine ){
732687
zLine = realloc(zLine, nTrans);
733
- if( zLine==0 ) shell_out_of_memory();
688
+ shell_check_oom(zLine);
734689
}
735690
memcpy(zLine, zTrans, nTrans);
736691
sqlite3_free(zTrans);
737692
}
738693
}
@@ -875,11 +830,11 @@
875830
}
876831
877832
if( p->z==0 || p->n+len>=p->nAlloc ){
878833
p->nAlloc = p->nAlloc*2 + len + 20;
879834
p->z = realloc(p->z, p->nAlloc);
880
- if( p->z==0 ) shell_out_of_memory();
835
+ shell_check_oom(p->z);
881836
}
882837
883838
if( quote ){
884839
char *zCsr = p->z+p->n;
885840
*zCsr++ = quote;
@@ -930,10 +885,11 @@
930885
char *zDiv = "(";
931886
int nRow = 0;
932887
933888
zSql = sqlite3_mprintf("PRAGMA \"%w\".table_info=%Q;",
934889
zSchema ? zSchema : "main", zName);
890
+ shell_check_oom(zSql);
935891
sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
936892
sqlite3_free(zSql);
937893
initText(&s);
938894
if( zSchema ){
939895
cQuote = quoteChar(zSchema);
@@ -946,10 +902,11 @@
946902
while( sqlite3_step(pStmt)==SQLITE_ROW ){
947903
const char *zCol = (const char*)sqlite3_column_text(pStmt, 1);
948904
nRow++;
949905
appendText(&s, zDiv, 0);
950906
zDiv = ",";
907
+ if( zCol==0 ) zCol = "";
951908
cQuote = quoteChar(zCol);
952909
appendText(&s, zCol, cQuote);
953910
}
954911
appendText(&s, ")", 0);
955912
sqlite3_finalize(pStmt);
@@ -969,13 +926,15 @@
969926
static void shellModuleSchema(
970927
sqlite3_context *pCtx,
971928
int nVal,
972929
sqlite3_value **apVal
973930
){
974
- const char *zName = (const char*)sqlite3_value_text(apVal[0]);
975
- char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
931
+ const char *zName;
932
+ char *zFake;
976933
UNUSED_PARAMETER(nVal);
934
+ zName = (const char*)sqlite3_value_text(apVal[0]);
935
+ zFake = zName ? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
977936
if( zFake ){
978937
sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
979938
-1, sqlite3_free);
980939
free(zFake);
981940
}
@@ -1859,10 +1818,11 @@
18591818
SHA3Context *p,
18601819
const unsigned char *aData,
18611820
unsigned int nData
18621821
){
18631822
unsigned int i = 0;
1823
+ if( aData==0 ) return;
18641824
#if SHA3_BYTEORDER==1234
18651825
if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
18661826
for(; i+7<nData; i+=8){
18671827
p->u.s[p->nLoaded/8] ^= *(u64*)&aData[i];
18681828
p->nLoaded += 8;
@@ -2517,14 +2477,15 @@
25172477
const char *zFile, /* File to write */
25182478
sqlite3_value *pData, /* Data to write */
25192479
mode_t mode, /* MODE parameter passed to writefile() */
25202480
sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
25212481
){
2482
+ if( zFile==0 ) return 1;
25222483
#if !defined(_WIN32) && !defined(WIN32)
25232484
if( S_ISLNK(mode) ){
25242485
const char *zTo = (const char*)sqlite3_value_text(pData);
2525
- if( symlink(zTo, zFile)<0 ) return 1;
2486
+ if( zTo==0 || symlink(zTo, zFile)<0 ) return 1;
25262487
}else
25272488
#endif
25282489
{
25292490
if( S_ISDIR(mode) ){
25302491
if( mkdir(zFile, mode) ){
@@ -5886,11 +5847,11 @@
58865847
if( (idxNum & 3)==3 ){
58875848
/* Both start= and stop= boundaries are available. This is the
58885849
** the preferred case */
58895850
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
58905851
pIdxInfo->estimatedRows = 1000;
5891
- if( pIdxInfo->nOrderBy==1 ){
5852
+ if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){
58925853
if( pIdxInfo->aOrderBy[0].desc ){
58935854
idxNum |= 8;
58945855
}else{
58955856
idxNum |= 16;
58965857
}
@@ -6721,17 +6682,19 @@
67216682
const sqlite3_api_routines *pApi
67226683
){
67236684
int rc = SQLITE_OK;
67246685
SQLITE_EXTENSION_INIT2(pApi);
67256686
(void)pzErrMsg; /* Unused */
6726
- rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6727
- 0, re_sql_func, 0, 0);
6687
+ rc = sqlite3_create_function(db, "regexp", 2,
6688
+ SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
6689
+ 0, re_sql_func, 0, 0);
67286690
if( rc==SQLITE_OK ){
67296691
/* The regexpi(PATTERN,STRING) function is a case-insensitive version
67306692
** of regexp(PATTERN,STRING). */
6731
- rc = sqlite3_create_function(db, "regexpi", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6732
- (void*)db, re_sql_func, 0, 0);
6693
+ rc = sqlite3_create_function(db, "regexpi", 2,
6694
+ SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
6695
+ (void*)db, re_sql_func, 0, 0);
67336696
}
67346697
return rc;
67356698
}
67366699
67376700
/************************* End ../ext/misc/regexp.c ********************/
@@ -9939,21 +9902,29 @@
99399902
IdxTable **ppOut, /* OUT: New object (if successful) */
99409903
char **pzErrmsg /* OUT: Error message (if not) */
99419904
){
99429905
sqlite3_stmt *p1 = 0;
99439906
int nCol = 0;
9944
- int nTab = STRLEN(zTab);
9945
- int nByte = sizeof(IdxTable) + nTab + 1;
9907
+ int nTab;
9908
+ int nByte;
99469909
IdxTable *pNew = 0;
99479910
int rc, rc2;
99489911
char *pCsr = 0;
99499912
int nPk = 0;
99509913
9914
+ *ppOut = 0;
9915
+ if( zTab==0 ) return SQLITE_ERROR;
9916
+ nTab = STRLEN(zTab);
9917
+ nByte = sizeof(IdxTable) + nTab + 1;
99519918
rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
99529919
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
99539920
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
99549921
const char *zColSeq = 0;
9922
+ if( zCol==0 ){
9923
+ rc = SQLITE_ERROR;
9924
+ break;
9925
+ }
99559926
nByte += 1 + STRLEN(zCol);
99569927
rc = sqlite3_table_column_metadata(
99579928
db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
99589929
);
99599930
if( zColSeq==0 ) zColSeq = "binary";
@@ -9976,11 +9947,13 @@
99769947
99779948
nCol = 0;
99789949
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
99799950
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
99809951
const char *zColSeq = 0;
9981
- int nCopy = STRLEN(zCol) + 1;
9952
+ int nCopy;
9953
+ if( zCol==0 ) continue;
9954
+ nCopy = STRLEN(zCol) + 1;
99829955
pNew->aCol[nCol].zName = pCsr;
99839956
pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
99849957
memcpy(pCsr, zCol, nCopy);
99859958
pCsr += nCopy;
99869959
@@ -10128,10 +10101,11 @@
1012810101
while( rc==SQLITE_OK && sqlite3_step(pIdxList)==SQLITE_ROW ){
1012910102
int bMatch = 1;
1013010103
IdxConstraint *pT = pTail;
1013110104
sqlite3_stmt *pInfo = 0;
1013210105
const char *zIdx = (const char*)sqlite3_column_text(pIdxList, 1);
10106
+ if( zIdx==0 ) continue;
1013310107
1013410108
/* Zero the IdxConstraint.bFlag values in the pEq list */
1013510109
for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0;
1013610110
1013710111
rc = idxPrintfPrepareStmt(dbm, &pInfo, 0, "PRAGMA index_xInfo=%Q", zIdx);
@@ -10539,10 +10513,11 @@
1053910513
1054010514
/* Create the table and its triggers in the temp schema */
1054110515
rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab);
1054210516
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSelect) ){
1054310517
const char *zCreate = (const char*)sqlite3_column_text(pSelect, 0);
10518
+ if( zCreate==0 ) continue;
1054410519
rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr);
1054510520
}
1054610521
idxFinalize(&rc, pSelect);
1054710522
1054810523
/* Rename the table in the temp schema to zInt */
@@ -10641,12 +10616,13 @@
1064110616
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){
1064210617
const char *zType = (const char*)sqlite3_column_text(pSchema, 0);
1064310618
const char *zName = (const char*)sqlite3_column_text(pSchema, 1);
1064410619
const char *zSql = (const char*)sqlite3_column_text(pSchema, 2);
1064510620
10621
+ if( zType==0 || zName==0 ) continue;
1064610622
if( zType[0]=='v' || zType[1]=='r' ){
10647
- rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
10623
+ if( zSql ) rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
1064810624
}else{
1064910625
IdxTable *pTab;
1065010626
rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg);
1065110627
if( rc==SQLITE_OK ){
1065210628
int i;
@@ -10779,10 +10755,11 @@
1077910755
break;
1078010756
1078110757
case SQLITE_BLOB:
1078210758
case SQLITE_TEXT: {
1078310759
int nByte = sqlite3_value_bytes(argv[1]);
10760
+ const void *pData = 0;
1078410761
if( nByte>pSlot->nByte ){
1078510762
char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
1078610763
if( zNew==0 ){
1078710764
sqlite3_result_error_nomem(pCtx);
1078810765
return;
@@ -10790,13 +10767,15 @@
1079010767
pSlot->nByte = nByte*2;
1079110768
pSlot->z = zNew;
1079210769
}
1079310770
pSlot->n = nByte;
1079410771
if( pSlot->eType==SQLITE_BLOB ){
10795
- memcpy(pSlot->z, sqlite3_value_blob(argv[1]), nByte);
10772
+ pData = sqlite3_value_blob(argv[1]);
10773
+ if( pData ) memcpy(pSlot->z, pData, nByte);
1079610774
}else{
10797
- memcpy(pSlot->z, sqlite3_value_text(argv[1]), nByte);
10775
+ pData = sqlite3_value_text(argv[1]);
10776
+ memcpy(pSlot->z, pData, nByte);
1079810777
}
1079910778
break;
1080010779
}
1080110780
}
1080210781
}
@@ -11003,10 +10982,11 @@
1100310982
1100410983
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pAllIndex) ){
1100510984
i64 iRowid = sqlite3_column_int64(pAllIndex, 0);
1100610985
const char *zTab = (const char*)sqlite3_column_text(pAllIndex, 1);
1100710986
const char *zIdx = (const char*)sqlite3_column_text(pAllIndex, 2);
10987
+ if( zTab==0 || zIdx==0 ) continue;
1100810988
if( p->iSample<100 && iPrev!=iRowid ){
1100910989
samplectx.target = (double)p->iSample / 100.0;
1101010990
samplectx.iTarget = p->iSample;
1101110991
samplectx.nRow = 0.0;
1101210992
samplectx.nRet = 0.0;
@@ -11069,18 +11049,18 @@
1106911049
}
1107011050
1107111051
1107211052
/* Copy the entire schema of database [db] into [dbm]. */
1107311053
if( rc==SQLITE_OK ){
11074
- sqlite3_stmt *pSql;
11054
+ sqlite3_stmt *pSql = 0;
1107511055
rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
1107611056
"SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'"
1107711057
" AND sql NOT LIKE 'CREATE VIRTUAL %%'"
1107811058
);
1107911059
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
1108011060
const char *zSql = (const char*)sqlite3_column_text(pSql, 0);
11081
- rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
11061
+ if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
1108211062
}
1108311063
idxFinalize(&rc, pSql);
1108411064
}
1108511065
1108611066
/* Create the vtab schema */
@@ -12831,10 +12811,11 @@
1283112811
break;
1283212812
}
1283312813
}
1283412814
if( i==0 || strstr(z, p->colSeparator)!=0 ){
1283512815
char *zQuoted = sqlite3_mprintf("\"%w\"", z);
12816
+ shell_check_oom(zQuoted);
1283612817
utf8_printf(out, "%s", zQuoted);
1283712818
sqlite3_free(zQuoted);
1283812819
}else{
1283912820
utf8_printf(out, "%s", z);
1284012821
}
@@ -13005,11 +12986,11 @@
1300512986
int nText = strlen30(zText);
1300612987
if( p->autoEQPtest ){
1300712988
utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText);
1300812989
}
1300912990
pNew = sqlite3_malloc64( sizeof(*pNew) + nText );
13010
- if( pNew==0 ) shell_out_of_memory();
12991
+ shell_check_oom(pNew);
1301112992
pNew->iEqpId = iEqpId;
1301212993
pNew->iParentId = p2;
1301312994
memcpy(pNew->zText, zText, nText+1);
1301412995
pNew->pNext = 0;
1301512996
if( p->sGraph.pLast ){
@@ -13226,10 +13207,11 @@
1322613207
){
1322713208
utf8_printf(p->out, "%s;\n", azArg[0]);
1322813209
break;
1322913210
}
1323013211
z = sqlite3_mprintf("%s", azArg[0]);
13212
+ shell_check_oom(z);
1323113213
j = 0;
1323213214
for(i=0; IsSpace(z[i]); i++){}
1323313215
for(; (c = z[i])!=0; i++){
1323413216
if( IsSpace(c) ){
1323513217
if( z[j-1]=='\r' ) z[j-1] = '\n';
@@ -13357,10 +13339,11 @@
1335713339
raw_printf(p->out,"(");
1335813340
for(i=0; i<nArg; i++){
1335913341
if( i>0 ) raw_printf(p->out, ",");
1336013342
if( quoteChar(azCol[i]) ){
1336113343
char *z = sqlite3_mprintf("\"%w\"", azCol[i]);
13344
+ shell_check_oom(z);
1336213345
utf8_printf(p->out, "%s", z);
1336313346
sqlite3_free(z);
1336413347
}else{
1336513348
raw_printf(p->out, "%s", azCol[i]);
1336613349
}
@@ -13602,20 +13585,61 @@
1360213585
if( zName==0 ) return;
1360313586
cQuote = quoteChar(zName);
1360413587
n = strlen30(zName);
1360513588
if( cQuote ) n += n+2;
1360613589
z = p->zDestTable = malloc( n+1 );
13607
- if( z==0 ) shell_out_of_memory();
13590
+ shell_check_oom(z);
1360813591
n = 0;
1360913592
if( cQuote ) z[n++] = cQuote;
1361013593
for(i=0; zName[i]; i++){
1361113594
z[n++] = zName[i];
1361213595
if( zName[i]==cQuote ) z[n++] = cQuote;
1361313596
}
1361413597
if( cQuote ) z[n++] = cQuote;
1361513598
z[n] = 0;
1361613599
}
13600
+
13601
+/*
13602
+** Maybe construct two lines of text that point out the position of a
13603
+** syntax error. Return a pointer to the text, in memory obtained from
13604
+** sqlite3_malloc(). Or, if the most recent error does not involve a
13605
+** specific token that we can point to, return an empty string.
13606
+**
13607
+** In all cases, the memory returned is obtained from sqlite3_malloc64()
13608
+** and should be released by the caller invoking sqlite3_free().
13609
+*/
13610
+static char *shell_error_context(const char *zSql, sqlite3 *db){
13611
+ int iOffset;
13612
+ size_t len;
13613
+ char *zCode;
13614
+ char *zMsg;
13615
+ int i;
13616
+ if( db==0
13617
+ || zSql==0
13618
+ || (iOffset = sqlite3_error_offset(db))<0
13619
+ ){
13620
+ return sqlite3_mprintf("");
13621
+ }
13622
+ while( iOffset>50 ){
13623
+ iOffset--;
13624
+ zSql++;
13625
+ while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
13626
+ }
13627
+ len = strlen(zSql);
13628
+ if( len>78 ){
13629
+ len = 78;
13630
+ while( (zSql[len]&0xc0)==0x80 ) len--;
13631
+ }
13632
+ zCode = sqlite3_mprintf("%.*s", len, zSql);
13633
+ for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
13634
+ if( iOffset<25 ){
13635
+ zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode, iOffset, "");
13636
+ }else{
13637
+ zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode, iOffset-14, "");
13638
+ }
13639
+ return zMsg;
13640
+}
1361713641
1361813642
1361913643
/*
1362013644
** Execute a query statement that will generate SQL output. Print
1362113645
** the result columns, comma-separated, on a line and then add a
@@ -13635,12 +13659,14 @@
1363513659
int nResult;
1363613660
int i;
1363713661
const char *z;
1363813662
rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
1363913663
if( rc!=SQLITE_OK || !pSelect ){
13640
- utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc,
13641
- sqlite3_errmsg(p->db));
13664
+ char *zContext = shell_error_context(zSelect, p->db);
13665
+ utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n%s", rc,
13666
+ sqlite3_errmsg(p->db), zContext);
13667
+ sqlite3_free(zContext);
1364213668
if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
1364313669
return rc;
1364413670
}
1364513671
rc = sqlite3_step(pSelect);
1364613672
nResult = sqlite3_column_count(pSelect);
@@ -13672,15 +13698,21 @@
1367213698
** Allocate space and save off string indicating current error.
1367313699
*/
1367413700
static char *save_err_msg(
1367513701
sqlite3 *db, /* Database to query */
1367613702
const char *zWhen, /* Qualifier (format) wrapper */
13677
- int rc /* Error code returned from API */
13703
+ int rc, /* Error code returned from API */
13704
+ const char *zSql /* SQL string, or NULL */
1367813705
){
13679
- if( zWhen==0 )
13680
- zWhen = "%s (%d)";
13681
- return sqlite3_mprintf(zWhen, sqlite3_errmsg(db), rc);
13706
+ char *zErr;
13707
+ char *zContext;
13708
+ if( zWhen==0 ) zWhen = "%s (%d)%s";
13709
+ zContext = shell_error_context(zSql, db);
13710
+ zErr = sqlite3_mprintf(zWhen, sqlite3_errmsg(db), rc, zContext);
13711
+ shell_check_oom(zErr);
13712
+ sqlite3_free(zContext);
13713
+ return zErr;
1368213714
}
1368313715
1368413716
#ifdef __linux__
1368513717
/*
1368613718
** Attempt to display I/O stats on Linux using /proc/PID/io
@@ -14024,13 +14056,13 @@
1402414056
}
1402514057
}
1402614058
}
1402714059
nAlloc += 100;
1402814060
p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
14029
- if( p->aiIndent==0 ) shell_out_of_memory();
14061
+ shell_check_oom(p->aiIndent);
1403014062
abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
14031
- if( abYield==0 ) shell_out_of_memory();
14063
+ shell_check_oom(abYield);
1403214064
}
1403314065
abYield[iOp] = str_in_array(zOp, azYield);
1403414066
p->aiIndent[iOp] = 0;
1403514067
p->nIndent = iOp+1;
1403614068
@@ -14235,29 +14267,29 @@
1423514267
if( rc!=SQLITE_ROW ) return;
1423614268
nColumn = sqlite3_column_count(pStmt);
1423714269
nAlloc = nColumn*4;
1423814270
if( nAlloc<=0 ) nAlloc = 1;
1423914271
azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
14240
- if( azData==0 ) shell_out_of_memory();
14272
+ shell_check_oom(azData);
1424114273
for(i=0; i<nColumn; i++){
1424214274
azData[i] = strdup(sqlite3_column_name(pStmt,i));
1424314275
}
1424414276
do{
1424514277
if( (nRow+2)*nColumn >= nAlloc ){
1424614278
nAlloc *= 2;
1424714279
azData = sqlite3_realloc64(azData, nAlloc*sizeof(char*));
14248
- if( azData==0 ) shell_out_of_memory();
14280
+ shell_check_oom(azData);
1424914281
}
1425014282
nRow++;
1425114283
for(i=0; i<nColumn; i++){
1425214284
z = (const char*)sqlite3_column_text(pStmt,i);
1425314285
azData[nRow*nColumn + i] = z ? strdup(z) : 0;
1425414286
}
1425514287
}while( sqlite3_step(pStmt)==SQLITE_ROW );
1425614288
if( nColumn>p->nWidth ){
1425714289
p->colWidth = realloc(p->colWidth, (nColumn+1)*2*sizeof(int));
14258
- if( p->colWidth==0 ) shell_out_of_memory();
14290
+ shell_check_oom(p->colWidth);
1425914291
for(i=p->nWidth; i<nColumn; i++) p->colWidth[i] = 0;
1426014292
p->nWidth = nColumn;
1426114293
p->actualWidth = &p->colWidth[nColumn];
1426214294
}
1426314295
memset(p->actualWidth, 0, nColumn*sizeof(int));
@@ -14411,11 +14443,14 @@
1441114443
do{
1441214444
nRow++;
1441314445
/* extract the data and data types */
1441414446
for(i=0; i<nCol; i++){
1441514447
aiTypes[i] = x = sqlite3_column_type(pStmt, i);
14416
- if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
14448
+ if( x==SQLITE_BLOB
14449
+ && pArg
14450
+ && (pArg->cMode==MODE_Insert || pArg->cMode==MODE_Quote)
14451
+ ){
1441714452
azVals[i] = "";
1441814453
}else{
1441914454
azVals[i] = (char*)sqlite3_column_text(pStmt, i);
1442014455
}
1442114456
if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
@@ -14436,11 +14471,14 @@
1443614471
} while( SQLITE_ROW == rc );
1443714472
sqlite3_free(pData);
1443814473
if( pArg->cMode==MODE_Json ){
1443914474
fputs("]\n", pArg->out);
1444014475
}else if( pArg->cMode==MODE_Count ){
14441
- printf("%llu row%s\n", nRow, nRow!=1 ? "s" : "");
14476
+ char zBuf[200];
14477
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%llu row%s\n",
14478
+ nRow, nRow!=1 ? "s" : "");
14479
+ printf("%s", zBuf);
1444214480
}
1444314481
}
1444414482
}
1444514483
}
1444614484
@@ -14560,18 +14598,19 @@
1456014598
}
1456114599
1456214600
if( rc==SQLITE_OK ){
1456314601
pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
1456414602
if( pState->expert.pExpert==0 ){
14565
- raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr);
14603
+ raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr ? zErr : "out of memory");
1456614604
rc = SQLITE_ERROR;
1456714605
}else{
1456814606
sqlite3_expert_config(
1456914607
pState->expert.pExpert, EXPERT_CONFIG_SAMPLE, iSample
1457014608
);
1457114609
}
1457214610
}
14611
+ sqlite3_free(zErr);
1457314612
1457414613
return rc;
1457514614
}
1457614615
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
1457714616
@@ -14609,11 +14648,11 @@
1460914648
while( zSql[0] && (SQLITE_OK == rc) ){
1461014649
static const char *zStmtSql;
1461114650
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
1461214651
if( SQLITE_OK != rc ){
1461314652
if( pzErrMsg ){
14614
- *pzErrMsg = save_err_msg(db, "in prepare, %s (%d)", rc);
14653
+ *pzErrMsg = save_err_msg(db, "in prepare, %s (%d)%s", rc, zSql);
1461514654
}
1461614655
}else{
1461714656
if( !pStmt ){
1461814657
/* this happens for a comment or white-space */
1461914658
zSql = zLeftover;
@@ -14644,10 +14683,11 @@
1464414683
sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP);
1464514684
if( pArg->autoEQP>=AUTOEQP_trigger ){
1464614685
sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0);
1464714686
}
1464814687
zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
14688
+ shell_check_oom(zEQP);
1464914689
rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1465014690
if( rc==SQLITE_OK ){
1465114691
while( sqlite3_step(pExplain)==SQLITE_ROW ){
1465214692
const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3);
1465314693
int iEqpId = sqlite3_column_int(pExplain, 0);
@@ -14661,10 +14701,11 @@
1466114701
sqlite3_finalize(pExplain);
1466214702
sqlite3_free(zEQP);
1466314703
if( pArg->autoEQP>=AUTOEQP_full ){
1466414704
/* Also do an EXPLAIN for ".eqp full" mode */
1466514705
zEQP = sqlite3_mprintf("EXPLAIN %s", zStmtSql);
14706
+ shell_check_oom(zEQP);
1466614707
rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1466714708
if( rc==SQLITE_OK ){
1466814709
pArg->cMode = MODE_Explain;
1466914710
explain_data_prepare(pArg, pExplain);
1467014711
exec_prepared_stmt(pArg, pExplain);
@@ -14723,11 +14764,11 @@
1472314764
if( rc!=SQLITE_NOMEM ) rc = rc2;
1472414765
if( rc==SQLITE_OK ){
1472514766
zSql = zLeftover;
1472614767
while( IsSpace(zSql[0]) ) zSql++;
1472714768
}else if( pzErrMsg ){
14728
- *pzErrMsg = save_err_msg(db, "stepping, %s (%d)", rc);
14769
+ *pzErrMsg = save_err_msg(db, "stepping, %s (%d)", rc, 0);
1472914770
}
1473014771
1473114772
/* clear saved stmt handle */
1473214773
if( pArg ){
1473314774
pArg->pStmt = NULL;
@@ -14773,20 +14814,22 @@
1477314814
int isIPK = 0; /* True if one PRIMARY KEY column of type INTEGER */
1477414815
int preserveRowid = ShellHasFlag(p, SHFLG_PreserveRowid);
1477514816
int rc;
1477614817
1477714818
zSql = sqlite3_mprintf("PRAGMA table_info=%Q", zTab);
14819
+ shell_check_oom(zSql);
1477814820
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
1477914821
sqlite3_free(zSql);
1478014822
if( rc ) return 0;
1478114823
while( sqlite3_step(pStmt)==SQLITE_ROW ){
1478214824
if( nCol>=nAlloc-2 ){
1478314825
nAlloc = nAlloc*2 + nCol + 10;
1478414826
azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
14785
- if( azCol==0 ) shell_out_of_memory();
14827
+ shell_check_oom(azCol);
1478614828
}
1478714829
azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
14830
+ shell_check_oom(azCol[nCol]);
1478814831
if( sqlite3_column_int(pStmt, 5) ){
1478914832
nPK++;
1479014833
if( nPK==1
1479114834
&& sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
1479214835
"INTEGER")==0
@@ -14816,10 +14859,11 @@
1481614859
** there is a "pk" entry in "PRAGMA index_list". There will be
1481714860
** no "pk" index if the PRIMARY KEY really is an alias for the ROWID.
1481814861
*/
1481914862
zSql = sqlite3_mprintf("SELECT 1 FROM pragma_index_list(%Q)"
1482014863
" WHERE origin='pk'", zTab);
14864
+ shell_check_oom(zSql);
1482114865
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
1482214866
sqlite3_free(zSql);
1482314867
if( rc ){
1482414868
freeColumnList(azCol);
1482514869
return 0;
@@ -14907,10 +14951,11 @@
1490714951
}
1490814952
zIns = sqlite3_mprintf(
1490914953
"INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)"
1491014954
"VALUES('table','%q','%q',0,'%q');",
1491114955
zTable, zTable, zSql);
14956
+ shell_check_oom(zIns);
1491214957
utf8_printf(p->out, "%s\n", zIns);
1491314958
sqlite3_free(zIns);
1491414959
return 0;
1491514960
}else{
1491614961
printSchemaLine(p->out, zSql, ";\n");
@@ -15150,13 +15195,10 @@
1515015195
".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
1515115196
" If FILE begins with '|' then open as a pipe",
1515215197
" --bom Put a UTF8 byte-order mark at the beginning",
1515315198
" -e Send output to the system text editor",
1515415199
" -x Send output as CSV to a spreadsheet (same as \".excel\")",
15155
-#ifdef SQLITE_DEBUG
15156
- ".oom ?--repeat M? ?N? Simulate an OOM error on the N-th allocation",
15157
-#endif
1515815200
".open ?OPTIONS? ?FILE? Close existing database and reopen FILE",
1515915201
" Options:",
1516015202
" --append Use appendvfs to append database to the end of FILE",
1516115203
#ifndef SQLITE_OMIT_DESERIALIZE
1516215204
" --deserialize Load into memory using sqlite3_deserialize()",
@@ -15188,11 +15230,12 @@
1518815230
" --quiet|-q No output except at interrupts",
1518915231
" --reset Reset the count for each input and interrupt",
1519015232
#endif
1519115233
".prompt MAIN CONTINUE Replace the standard prompts",
1519215234
".quit Exit this program",
15193
- ".read FILE Read input from FILE",
15235
+ ".read FILE Read input from FILE or command output",
15236
+ " If FILE begins with \"|\", it is a command that generates the input.",
1519415237
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1519515238
".recover Recover as much data as possible from corrupt db.",
1519615239
" --freelist-corrupt Assume the freelist is corrupt",
1519715240
" --recovery-db NAME Store recovery metadata in database file NAME",
1519815241
" --lost-and-found TABLE Alternative name for the lost-and-found table",
@@ -15308,10 +15351,11 @@
1530815351
}
1530915352
}
1531015353
}else{
1531115354
/* Look for commands that for which zPattern is an exact prefix */
1531215355
zPat = sqlite3_mprintf(".%s*", zPattern);
15356
+ shell_check_oom(zPat);
1531315357
for(i=0; i<ArraySize(azHelp); i++){
1531415358
if( sqlite3_strglob(zPat, azHelp[i])==0 ){
1531515359
utf8_printf(out, "%s\n", azHelp[i]);
1531615360
j = i+1;
1531715361
n++;
@@ -15330,10 +15374,11 @@
1533015374
return n;
1533115375
}
1533215376
/* Look for commands that contain zPattern anywhere. Show the complete
1533315377
** text of all commands that match. */
1533415378
zPat = sqlite3_mprintf("%%%s%%", zPattern);
15379
+ shell_check_oom(zPat);
1533515380
for(i=0; i<ArraySize(azHelp); i++){
1533615381
if( azHelp[i][0]=='.' ) j = i;
1533715382
if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
1533815383
utf8_printf(out, "%s\n", azHelp[j]);
1533915384
while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
@@ -15518,14 +15563,11 @@
1551815563
if( rc!=2 ) goto readHexDb_error;
1551915564
if( n<0 ) goto readHexDb_error;
1552015565
if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error;
1552115566
n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */
1552215567
a = sqlite3_malloc( n ? n : 1 );
15523
- if( a==0 ){
15524
- utf8_printf(stderr, "Out of memory!\n");
15525
- goto readHexDb_error;
15526
- }
15568
+ shell_check_oom(a);
1552715569
memset(a, 0, n);
1552815570
if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){
1552915571
utf8_printf(stderr, "invalid pagesize\n");
1553015572
goto readHexDb_error;
1553115573
}
@@ -15652,11 +15694,11 @@
1565215694
int argc,
1565315695
sqlite3_value **argv
1565415696
){
1565515697
const char *zText = (const char*)sqlite3_value_text(argv[0]);
1565615698
UNUSED_PARAMETER(argc);
15657
- if( zText[0]=='\'' ){
15699
+ if( zText && zText[0]=='\'' ){
1565815700
int nText = sqlite3_value_bytes(argv[0]);
1565915701
int i;
1566015702
char zBuf1[20];
1566115703
char zBuf2[20];
1566215704
const char *zNL = 0;
@@ -15829,10 +15871,11 @@
1582915871
editFunc, 0, 0);
1583015872
#endif
1583115873
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1583215874
char *zSql = sqlite3_mprintf(
1583315875
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
15876
+ shell_check_oom(zSql);
1583415877
sqlite3_exec(p->db, zSql, 0, 0, 0);
1583515878
sqlite3_free(zSql);
1583615879
}
1583715880
#ifndef SQLITE_OMIT_DESERIALIZE
1583815881
else
@@ -15886,15 +15929,17 @@
1588615929
if( state==0 ){
1588715930
char *zSql;
1588815931
sqlite3_finalize(pStmt);
1588915932
zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
1589015933
" FROM completion(%Q) ORDER BY 1", text);
15934
+ shell_check_oom(zSql);
1589115935
sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
1589215936
sqlite3_free(zSql);
1589315937
}
1589415938
if( sqlite3_step(pStmt)==SQLITE_ROW ){
15895
- zRet = strdup((const char*)sqlite3_column_text(pStmt, 0));
15939
+ const char *z = (const char*)sqlite3_column_text(pStmt,0);
15940
+ zRet = z ? strdup(z) : 0;
1589615941
}else{
1589715942
sqlite3_finalize(pStmt);
1589815943
pStmt = 0;
1589915944
zRet = 0;
1590015945
}
@@ -15923,17 +15968,18 @@
1592315968
iStart = i+1;
1592415969
memcpy(zBuf, zLine, iStart);
1592515970
zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
1592615971
" FROM completion(%Q,%Q) ORDER BY 1",
1592715972
&zLine[iStart], zLine);
15973
+ shell_check_oom(zSql);
1592815974
sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
1592915975
sqlite3_free(zSql);
1593015976
sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
1593115977
while( sqlite3_step(pStmt)==SQLITE_ROW ){
1593215978
const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
1593315979
int nCompletion = sqlite3_column_bytes(pStmt, 0);
15934
- if( iStart+nCompletion < sizeof(zBuf)-1 ){
15980
+ if( iStart+nCompletion < sizeof(zBuf)-1 && zCompletion ){
1593515981
memcpy(zBuf+iStart, zCompletion, nCompletion+1);
1593615982
linenoiseAddCompletion(lc, zBuf);
1593715983
}
1593815984
}
1593915985
sqlite3_finalize(pStmt);
@@ -16164,11 +16210,11 @@
1616416210
/* Append a single byte to z[] */
1616516211
static void import_append_char(ImportCtx *p, int c){
1616616212
if( p->n+1>=p->nAlloc ){
1616716213
p->nAlloc += p->nAlloc + 100;
1616816214
p->z = sqlite3_realloc64(p->z, p->nAlloc);
16169
- if( p->z==0 ) shell_out_of_memory();
16215
+ shell_check_oom(p->z);
1617016216
}
1617116217
p->z[p->n++] = (char)c;
1617216218
}
1617316219
1617416220
/* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -16316,20 +16362,21 @@
1631616362
int k = 0;
1631716363
int cnt = 0;
1631816364
const int spinRate = 10000;
1631916365
1632016366
zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
16367
+ shell_check_oom(zQuery);
1632116368
rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1632216369
if( rc ){
1632316370
utf8_printf(stderr, "Error %d: %s on [%s]\n",
1632416371
sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
1632516372
zQuery);
1632616373
goto end_data_xfer;
1632716374
}
1632816375
n = sqlite3_column_count(pQuery);
1632916376
zInsert = sqlite3_malloc64(200 + nTable + n*3);
16330
- if( zInsert==0 ) shell_out_of_memory();
16377
+ shell_check_oom(zInsert);
1633116378
sqlite3_snprintf(200+nTable,zInsert,
1633216379
"INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
1633316380
i = strlen30(zInsert);
1633416381
for(j=1; j<n; j++){
1633516382
memcpy(zInsert+i, ",?", 2);
@@ -16388,10 +16435,11 @@
1638816435
if( rc==SQLITE_DONE ) break;
1638916436
sqlite3_finalize(pQuery);
1639016437
sqlite3_free(zQuery);
1639116438
zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
1639216439
zTable);
16440
+ shell_check_oom(zQuery);
1639316441
rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1639416442
if( rc ){
1639516443
utf8_printf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
1639616444
break;
1639716445
}
@@ -16424,10 +16472,11 @@
1642416472
const unsigned char *zSql;
1642516473
char *zErrMsg = 0;
1642616474
1642716475
zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
1642816476
" WHERE %s", zWhere);
16477
+ shell_check_oom(zQuery);
1642916478
rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1643016479
if( rc ){
1643116480
utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
1643216481
sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
1643316482
zQuery);
@@ -16434,10 +16483,11 @@
1643416483
goto end_schema_xfer;
1643516484
}
1643616485
while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
1643716486
zName = sqlite3_column_text(pQuery, 0);
1643816487
zSql = sqlite3_column_text(pQuery, 1);
16488
+ if( zName==0 || zSql==0 ) continue;
1643916489
printf("%s... ", zName); fflush(stdout);
1644016490
sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
1644116491
if( zErrMsg ){
1644216492
utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
1644316493
sqlite3_free(zErrMsg);
@@ -16451,10 +16501,11 @@
1645116501
if( rc!=SQLITE_DONE ){
1645216502
sqlite3_finalize(pQuery);
1645316503
sqlite3_free(zQuery);
1645416504
zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
1645516505
" WHERE %s ORDER BY rowid DESC", zWhere);
16506
+ shell_check_oom(zQuery);
1645616507
rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1645716508
if( rc ){
1645816509
utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
1645916510
sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
1646016511
zQuery);
@@ -16461,10 +16512,11 @@
1646116512
goto end_schema_xfer;
1646216513
}
1646316514
while( sqlite3_step(pQuery)==SQLITE_ROW ){
1646416515
zName = sqlite3_column_text(pQuery, 0);
1646516516
zSql = sqlite3_column_text(pQuery, 1);
16517
+ if( zName==0 || zSql==0 ) continue;
1646616518
printf("%s... ", zName); fflush(stdout);
1646716519
sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
1646816520
if( zErrMsg ){
1646916521
utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
1647016522
sqlite3_free(zErrMsg);
@@ -16845,13 +16897,11 @@
1684516897
}
1684616898
p->zTempFile = sqlite3_mprintf("%s/temp%llx.%s", zTemp, r, zSuffix);
1684716899
}else{
1684816900
p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
1684916901
}
16850
- if( p->zTempFile==0 ){
16851
- shell_out_of_memory();
16852
- }
16902
+ shell_check_oom(p->zTempFile);
1685316903
}
1685416904
1685516905
1685616906
/*
1685716907
** The implementation of SQL scalar function fkey_collate_clause(), used
@@ -17028,18 +17078,18 @@
1702817078
const char *zFrom = (const char*)sqlite3_column_text(pSql, 2);
1702917079
const char *zTarget = (const char*)sqlite3_column_text(pSql, 3);
1703017080
const char *zCI = (const char*)sqlite3_column_text(pSql, 4);
1703117081
const char *zParent = (const char*)sqlite3_column_text(pSql, 5);
1703217082
17083
+ if( zEQP==0 ) continue;
17084
+ if( zGlob==0 ) continue;
1703317085
rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1703417086
if( rc!=SQLITE_OK ) break;
1703517087
if( SQLITE_ROW==sqlite3_step(pExplain) ){
1703617088
const char *zPlan = (const char*)sqlite3_column_text(pExplain, 3);
17037
- res = (
17038
- 0==sqlite3_strglob(zGlob, zPlan)
17039
- || 0==sqlite3_strglob(zGlobIPK, zPlan)
17040
- );
17089
+ res = zPlan!=0 && ( 0==sqlite3_strglob(zGlob, zPlan)
17090
+ || 0==sqlite3_strglob(zGlobIPK, zPlan));
1704117091
}
1704217092
rc = sqlite3_finalize(pExplain);
1704317093
if( rc!=SQLITE_OK ) break;
1704417094
1704517095
if( res<0 ){
@@ -18140,10 +18190,11 @@
1814018190
, zName, zName
1814118191
);
1814218192
if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPkFinder) ){
1814318193
pTab->iPk = sqlite3_column_int(pPkFinder, 0);
1814418194
zPk = (const char*)sqlite3_column_text(pPkFinder, 1);
18195
+ if( zPk==0 ){ zPk = "_"; /* Defensive. Should never happen */ }
1814518196
}
1814618197
}
1814718198
1814818199
pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName);
1814918200
pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1));
@@ -18224,12 +18275,14 @@
1822418275
break;
1822518276
}
1822618277
if( sqlite3_stricmp(zType, "table")==0 ){
1822718278
zName = (const char*)sqlite3_column_text(pStmt, 1);
1822818279
zSql = (const char*)sqlite3_column_text(pStmt, 2);
18229
- pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol);
18230
- break;
18280
+ if( zName!=0 && zSql!=0 ){
18281
+ pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol);
18282
+ break;
18283
+ }
1823118284
}
1823218285
}
1823318286
1823418287
shellFinalize(pRc, pStmt);
1823518288
*pbNoop = bNoop;
@@ -18919,12 +18972,13 @@
1891918972
rc = 1;
1892018973
}else{
1892118974
while( sqlite3_step(pStmt)==SQLITE_ROW ){
1892218975
const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
1892318976
const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
18977
+ if( zSchema==0 || zFile==0 ) continue;
1892418978
azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
18925
- if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
18979
+ shell_check_oom(azName);
1892618980
azName[nName*2] = strdup(zSchema);
1892718981
azName[nName*2+1] = strdup(zFile);
1892818982
nName++;
1892918983
}
1893018984
}
@@ -19176,12 +19230,19 @@
1917619230
}
1917719231
}else
1917819232
1917919233
#ifndef SQLITE_OMIT_VIRTUALTABLE
1918019234
if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){
19181
- open_db(p, 0);
19182
- expertDotCommand(p, azArg, nArg);
19235
+ if( p->bSafeMode ){
19236
+ raw_printf(stderr,
19237
+ "Cannot run experimental commands such as \"%s\" in safe mode\n",
19238
+ azArg[0]);
19239
+ rc = 1;
19240
+ }else{
19241
+ open_db(p, 0);
19242
+ expertDotCommand(p, azArg, nArg);
19243
+ }
1918319244
}else
1918419245
#endif
1918519246
1918619247
if( c=='f' && strncmp(azArg[0], "filectrl", n)==0 ){
1918719248
static const struct {
@@ -19969,11 +20030,12 @@
1996920030
if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
1997020031
if( nArg!=2 ){
1997120032
raw_printf(stderr, "Usage: .nonce NONCE\n");
1997220033
rc = 1;
1997320034
}else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
19974
- raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n", p->lineno, azArg[1]);
20035
+ raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n",
20036
+ p->lineno, azArg[1]);
1997520037
exit(1);
1997620038
}else{
1997720039
p->bSafeMode = 0;
1997820040
return 0; /* Return immediately to bypass the safe mode reset
1997920041
** at the end of this procedure */
@@ -19988,39 +20050,12 @@
1998820050
raw_printf(stderr, "Usage: .nullvalue STRING\n");
1998920051
rc = 1;
1999020052
}
1999120053
}else
1999220054
19993
-#ifdef SQLITE_DEBUG
19994
- if( c=='o' && strcmp(azArg[0],"oom")==0 ){
19995
- int i;
19996
- for(i=1; i<nArg; i++){
19997
- const char *z = azArg[i];
19998
- if( z[0]=='-' && z[1]=='-' ) z++;
19999
- if( strcmp(z,"-repeat")==0 ){
20000
- if( i==nArg-1 ){
20001
- raw_printf(p->out, "missing argument on \"%s\"\n", azArg[i]);
20002
- rc = 1;
20003
- }else{
20004
- oomRepeat = (int)integerValue(azArg[++i]);
20005
- }
20006
- }else if( IsDigit(z[0]) ){
20007
- oomCounter = (int)integerValue(azArg[i]);
20008
- }else{
20009
- raw_printf(p->out, "unknown argument: \"%s\"\n", azArg[i]);
20010
- raw_printf(p->out, "Usage: .oom [--repeat N] [M]\n");
20011
- rc = 1;
20012
- }
20013
- }
20014
- if( rc==0 ){
20015
- raw_printf(p->out, "oomCounter = %d\n", oomCounter);
20016
- raw_printf(p->out, "oomRepeat = %d\n", oomRepeat);
20017
- }
20018
- }else
20019
-#endif /* SQLITE_DEBUG */
20020
-
2002120055
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
20056
+ const char *zFN = 0; /* Pointer to constant filename */
2002220057
char *zNewFilename = 0; /* Name of the database file to open */
2002320058
int iName = 1; /* Index in azArg[] of the filename */
2002420059
int newFlag = 0; /* True to delete file before opening */
2002520060
int openMode = SHELL_OPEN_UNSPEC;
2002620061
@@ -20049,16 +20084,16 @@
2004920084
#endif /* SQLITE_OMIT_DESERIALIZE */
2005020085
}else if( z[0]=='-' ){
2005120086
utf8_printf(stderr, "unknown option: %s\n", z);
2005220087
rc = 1;
2005320088
goto meta_command_exit;
20054
- }else if( zNewFilename ){
20089
+ }else if( zFN ){
2005520090
utf8_printf(stderr, "extra argument: \"%s\"\n", z);
2005620091
rc = 1;
2005720092
goto meta_command_exit;
2005820093
}else{
20059
- zNewFilename = sqlite3_mprintf("%s", z);
20094
+ zFN = z;
2006020095
}
2006120096
}
2006220097
2006320098
/* Close the existing database */
2006420099
session_close_all(p, -1);
@@ -20070,19 +20105,25 @@
2007020105
p->openMode = openMode;
2007120106
p->openFlags = 0;
2007220107
p->szMax = 0;
2007320108
2007420109
/* If a filename is specified, try to open it first */
20075
- if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
20076
- if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
20110
+ if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
20111
+ if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
2007720112
if( p->bSafeMode
2007820113
&& p->openMode!=SHELL_OPEN_HEXDB
20079
- && zNewFilename
20080
- && strcmp(zNewFilename,":memory:")!=0
20114
+ && zFN
20115
+ && strcmp(zFN,":memory:")!=0
2008120116
){
2008220117
failIfSafeMode(p, "cannot open disk-based database files in safe mode");
2008320118
}
20119
+ if( zFN ){
20120
+ zNewFilename = sqlite3_mprintf("%s", zFN);
20121
+ shell_check_oom(zNewFilename);
20122
+ }else{
20123
+ zNewFilename = 0;
20124
+ }
2008420125
p->pAuxDb->zDbFilename = zNewFilename;
2008520126
open_db(p, OPEN_DB_KEEPALIVE);
2008620127
if( p->db==0 ){
2008720128
utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
2008820129
sqlite3_free(zNewFilename);
@@ -20132,11 +20173,11 @@
2013220173
rc = 1;
2013320174
goto meta_command_exit;
2013420175
}
2013520176
}else if( zFile==0 && eMode!='e' && eMode!='x' ){
2013620177
zFile = sqlite3_mprintf("%s", z);
20137
- if( zFile[0]=='|' ){
20178
+ if( zFile && zFile[0]=='|' ){
2013820179
while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
2013920180
break;
2014020181
}
2014120182
}else{
2014220183
utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
@@ -20145,11 +20186,13 @@
2014520186
rc = 1;
2014620187
sqlite3_free(zFile);
2014720188
goto meta_command_exit;
2014820189
}
2014920190
}
20150
- if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
20191
+ if( zFile==0 ){
20192
+ zFile = sqlite3_mprintf("stdout");
20193
+ }
2015120194
if( bOnce ){
2015220195
p->outCount = 2;
2015320196
}else{
2015420197
p->outCount = 0;
2015520198
}
@@ -20172,10 +20215,11 @@
2017220215
}
2017320216
sqlite3_free(zFile);
2017420217
zFile = sqlite3_mprintf("%s", p->zTempFile);
2017520218
}
2017620219
#endif /* SQLITE_NOHAVE_SYSTEM */
20220
+ shell_check_oom(zFile);
2017720221
if( zFile[0]=='|' ){
2017820222
#ifdef SQLITE_OMIT_POPEN
2017920223
raw_printf(stderr, "Error: pipes are not supported in this OS\n");
2018020224
rc = 1;
2018120225
p->out = stdout;
@@ -20268,21 +20312,21 @@
2026820312
const char *zValue = azArg[3];
2026920313
bind_table_init(p);
2027020314
zSql = sqlite3_mprintf(
2027120315
"REPLACE INTO temp.sqlite_parameters(key,value)"
2027220316
"VALUES(%Q,%s);", zKey, zValue);
20273
- if( zSql==0 ) shell_out_of_memory();
20317
+ shell_check_oom(zSql);
2027420318
pStmt = 0;
2027520319
rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2027620320
sqlite3_free(zSql);
2027720321
if( rx!=SQLITE_OK ){
2027820322
sqlite3_finalize(pStmt);
2027920323
pStmt = 0;
2028020324
zSql = sqlite3_mprintf(
2028120325
"REPLACE INTO temp.sqlite_parameters(key,value)"
2028220326
"VALUES(%Q,%Q);", zKey, zValue);
20283
- if( zSql==0 ) shell_out_of_memory();
20327
+ shell_check_oom(zSql);
2028420328
rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2028520329
sqlite3_free(zSql);
2028620330
if( rx!=SQLITE_OK ){
2028720331
utf8_printf(p->out, "Error: %s\n", sqlite3_errmsg(p->db));
2028820332
sqlite3_finalize(pStmt);
@@ -20299,11 +20343,11 @@
2029920343
** exists.
2030020344
*/
2030120345
if( nArg==3 && strcmp(azArg[1],"unset")==0 ){
2030220346
char *zSql = sqlite3_mprintf(
2030320347
"DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]);
20304
- if( zSql==0 ) shell_out_of_memory();
20348
+ shell_check_oom(zSql);
2030520349
sqlite3_exec(p->db, zSql, 0, 0, 0);
2030620350
sqlite3_free(zSql);
2030720351
}else
2030820352
/* If no command name matches, show a syntax error */
2030920353
parameter_syntax_error:
@@ -20525,10 +20569,11 @@
2052520569
" name text,\n"
2052620570
" tbl_name text,\n"
2052720571
" rootpage integer,\n"
2052820572
" sql text\n"
2052920573
")", zName);
20574
+ shell_check_oom(new_argv[0]);
2053020575
new_argv[1] = 0;
2053120576
new_colv[0] = "sql";
2053220577
new_colv[1] = 0;
2053320578
callback(&data, 1, new_argv, new_colv);
2053420579
sqlite3_free(new_argv[0]);
@@ -20576,12 +20621,14 @@
2057620621
}
2057720622
#endif
2057820623
appendText(&sSelect, ") WHERE ", 0);
2057920624
if( zName ){
2058020625
char *zQarg = sqlite3_mprintf("%Q", zName);
20581
- int bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 ||
20582
- strchr(zName, '[') != 0;
20626
+ int bGlob;
20627
+ shell_check_oom(zQarg);
20628
+ bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 ||
20629
+ strchr(zName, '[') != 0;
2058320630
if( strchr(zName, '.') ){
2058420631
appendText(&sSelect, "lower(printf('%s.%s',sname,tbl_name))", 0);
2058520632
}else{
2058620633
appendText(&sSelect, "lower(tbl_name)", 0);
2058720634
}
@@ -20740,11 +20787,12 @@
2074020787
if( pSession->azFilter==0 ){
2074120788
raw_printf(stderr, "Error: out or memory\n");
2074220789
exit(1);
2074320790
}
2074420791
for(ii=1; ii<nCmd; ii++){
20745
- pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
20792
+ char *x = pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
20793
+ shell_check_oom(x);
2074620794
}
2074720795
pSession->nFilter = ii-1;
2074820796
}
2074920797
}else
2075020798
@@ -20812,10 +20860,11 @@
2081220860
}
2081320861
pSession->nFilter = 0;
2081420862
sqlite3session_table_filter(pSession->p, session_filter, pSession);
2081520863
pAuxDb->nSession++;
2081620864
pSession->zName = sqlite3_mprintf("%s", zName);
20865
+ shell_check_oom(pSession->zName);
2081720866
}else
2081820867
/* If no command name matches, show a syntax error */
2081920868
session_syntax_error:
2082020869
showHelp(p->out, "session");
2082120870
}else
@@ -20905,15 +20954,16 @@
2090520954
int tno = sqlite3_column_int(pStmt, 0);
2090620955
const char *zOp = (const char*)sqlite3_column_text(pStmt, 1);
2090720956
const char *zSql = (const char*)sqlite3_column_text(pStmt, 2);
2090820957
const char *zAns = (const char*)sqlite3_column_text(pStmt, 3);
2090920958
20959
+ if( zOp==0 ) continue;
20960
+ if( zSql==0 ) continue;
20961
+ if( zAns==0 ) continue;
2091020962
k = 0;
2091120963
if( bVerbose>0 ){
20912
- char *zQuote = sqlite3_mprintf("%q", zSql);
2091320964
printf("%d: %s %s\n", tno, zOp, zSql);
20914
- sqlite3_free(zQuote);
2091520965
}
2091620966
if( strcmp(zOp,"memo")==0 ){
2091720967
utf8_printf(p->out, "%s\n", zSql);
2091820968
}else
2091920969
if( strcmp(zOp,"run")==0 ){
@@ -21027,10 +21077,11 @@
2102721077
initText(&sSql);
2102821078
appendText(&sSql, "WITH [sha3sum$query](a,b) AS(",0);
2102921079
zSep = "VALUES(";
2103021080
while( SQLITE_ROW==sqlite3_step(pStmt) ){
2103121081
const char *zTab = (const char*)sqlite3_column_text(pStmt,0);
21082
+ if( zTab==0 ) continue;
2103221083
if( zLike && sqlite3_strlike(zLike, zTab, 0)!=0 ) continue;
2103321084
if( strncmp(zTab, "sqlite_",7)!=0 ){
2103421085
appendText(&sQuery,"SELECT * FROM ", 0);
2103521086
appendText(&sQuery,zTab,'"');
2103621087
appendText(&sQuery," NOT INDEXED;", 0);
@@ -21067,10 +21118,11 @@
2106721118
"%s))"
2106821119
" SELECT lower(hex(sha3_query(group_concat(a,''),%d))) AS hash"
2106921120
" FROM [sha3sum$query]",
2107021121
sSql.z, iSize);
2107121122
}
21123
+ shell_check_oom(zSql);
2107221124
freeText(&sQuery);
2107321125
freeText(&sSql);
2107421126
if( bDebug ){
2107521127
utf8_printf(p->out, "%s\n", zSql);
2107621128
}else{
@@ -21090,15 +21142,15 @@
2109021142
raw_printf(stderr, "Usage: .system COMMAND\n");
2109121143
rc = 1;
2109221144
goto meta_command_exit;
2109321145
}
2109421146
zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
21095
- for(i=2; i<nArg; i++){
21147
+ for(i=2; i<nArg && zCmd!=0; i++){
2109621148
zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
2109721149
zCmd, azArg[i]);
2109821150
}
21099
- x = system(zCmd);
21151
+ x = zCmd!=0 ? system(zCmd) : 1;
2110021152
sqlite3_free(zCmd);
2110121153
if( x ) raw_printf(stderr, "System command returns %d\n", x);
2110221154
}else
2110321155
#endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
2110421156
@@ -21230,16 +21282,16 @@
2123021282
while( sqlite3_step(pStmt)==SQLITE_ROW ){
2123121283
if( nRow>=nAlloc ){
2123221284
char **azNew;
2123321285
int n2 = nAlloc*2 + 10;
2123421286
azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
21235
- if( azNew==0 ) shell_out_of_memory();
21287
+ shell_check_oom(azNew);
2123621288
nAlloc = n2;
2123721289
azResult = azNew;
2123821290
}
2123921291
azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
21240
- if( 0==azResult[nRow] ) shell_out_of_memory();
21292
+ shell_check_oom(azResult[nRow]);
2124121293
nRow++;
2124221294
}
2124321295
if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
2124421296
rc = shellDatabaseError(p->db);
2124521297
}
@@ -22004,11 +22056,11 @@
2200422056
nLine = strlen30(zLine);
2200522057
if( nSql+nLine+2>=nAlloc ){
2200622058
/* Grow buffer by half-again increments when big. */
2200722059
nAlloc = nSql+(nSql>>1)+nLine+100;
2200822060
zSql = realloc(zSql, nAlloc);
22009
- if( zSql==0 ) shell_out_of_memory();
22061
+ shell_check_oom(zSql);
2201022062
}
2201122063
if( nSql==0 ){
2201222064
int i;
2201322065
for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
2201422066
assert( nAlloc>0 && zSql!=0 );
@@ -22136,10 +22188,11 @@
2213622188
raw_printf(stderr, "-- warning: cannot find home directory;"
2213722189
" cannot read ~/.sqliterc\n");
2213822190
return;
2213922191
}
2214022192
zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
22193
+ shell_check_oom(zBuf);
2214122194
sqliterc = zBuf;
2214222195
}
2214322196
p->in = fopen(sqliterc,"rb");
2214422197
if( p->in ){
2214522198
if( stdin_is_interactive ){
@@ -22334,14 +22387,10 @@
2233422387
setBinaryMode(stdin, 0);
2233522388
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
2233622389
stdin_is_interactive = isatty(0);
2233722390
stdout_is_console = isatty(1);
2233822391
22339
-#ifdef SQLITE_DEBUG
22340
- registerOomSimulator();
22341
-#endif
22342
-
2234322392
#if !defined(_WIN32_WCE)
2234422393
if( getenv("SQLITE_DEBUG_BREAK") ){
2234522394
if( isatty(0) && isatty(2) ){
2234622395
fprintf(stderr,
2234722396
"attach debugger to process %d and press any key to continue.\n",
@@ -22377,20 +22426,20 @@
2237722426
** memory that does not come from the SQLite memory allocator.
2237822427
*/
2237922428
#if !SQLITE_SHELL_IS_UTF8
2238022429
sqlite3_initialize();
2238122430
argvToFree = malloc(sizeof(argv[0])*argc*2);
22431
+ shell_check_oom(argvToFree);
2238222432
argcToFree = argc;
2238322433
argv = argvToFree + argc;
22384
- if( argv==0 ) shell_out_of_memory();
2238522434
for(i=0; i<argc; i++){
2238622435
char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
2238722436
int n;
22388
- if( z==0 ) shell_out_of_memory();
22437
+ shell_check_oom(z);
2238922438
n = (int)strlen(z);
2239022439
argv[i] = malloc( n+1 );
22391
- if( argv[i]==0 ) shell_out_of_memory();
22440
+ shell_check_oom(argv[i]);
2239222441
memcpy(argv[i], z, n+1);
2239322442
argvToFree[i] = argv[i];
2239422443
sqlite3_free(z);
2239522444
}
2239622445
sqlite3_shutdown();
@@ -22436,11 +22485,11 @@
2243622485
/* Excesss arguments are interpreted as SQL (or dot-commands) and
2243722486
** mean that nothing is read from stdin */
2243822487
readStdin = 0;
2243922488
nCmd++;
2244022489
azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
22441
- if( azCmd==0 ) shell_out_of_memory();
22490
+ shell_check_oom(azCmd);
2244222491
azCmd[nCmd-1] = z;
2244322492
}
2244422493
}
2244522494
if( z[1]=='-' ) z++;
2244622495
if( strcmp(z,"-separator")==0
2244722496
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -443,19 +443,10 @@
443 /*
444 ** True if an interrupt (Control-C) has been received.
445 */
446 static volatile int seenInterrupt = 0;
447
448 #ifdef SQLITE_DEBUG
449 /*
450 ** Out-of-memory simulator variables
451 */
452 static unsigned int oomCounter = 0; /* Simulate OOM when equals 1 */
453 static unsigned int oomRepeat = 0; /* Number of OOMs in a row */
454 static void*(*defaultMalloc)(int) = 0; /* The low-level malloc routine */
455 #endif /* SQLITE_DEBUG */
456
457 /*
458 ** This is the name of our program. It is set in main(), used
459 ** in a number of other places, mostly for error messages.
460 */
461 static char *Argv0;
@@ -503,52 +494,16 @@
503 static void shell_out_of_memory(void){
504 raw_printf(stderr,"Error: out of memory\n");
505 exit(1);
506 }
507
508 #ifdef SQLITE_DEBUG
509 /* This routine is called when a simulated OOM occurs. It is broken
510 ** out as a separate routine to make it easy to set a breakpoint on
511 ** the OOM
512 */
513 void shellOomFault(void){
514 if( oomRepeat>0 ){
515 oomRepeat--;
516 }else{
517 oomCounter--;
518 }
519 }
520 #endif /* SQLITE_DEBUG */
521
522 #ifdef SQLITE_DEBUG
523 /* This routine is a replacement malloc() that is used to simulate
524 ** Out-Of-Memory (OOM) errors for testing purposes.
525 */
526 static void *oomMalloc(int nByte){
527 if( oomCounter ){
528 if( oomCounter==1 ){
529 shellOomFault();
530 return 0;
531 }else{
532 oomCounter--;
533 }
534 }
535 return defaultMalloc(nByte);
536 }
537 #endif /* SQLITE_DEBUG */
538
539 #ifdef SQLITE_DEBUG
540 /* Register the OOM simulator. This must occur before any memory
541 ** allocations */
542 static void registerOomSimulator(void){
543 sqlite3_mem_methods mem;
544 sqlite3_config(SQLITE_CONFIG_GETMALLOC, &mem);
545 defaultMalloc = mem.xMalloc;
546 mem.xMalloc = oomMalloc;
547 sqlite3_config(SQLITE_CONFIG_MALLOC, &mem);
548 }
549 #endif
550
551 /*
552 ** Write I/O traces to the following stream.
553 */
554 #ifdef SQLITE_ENABLE_IOTRACE
@@ -701,11 +656,11 @@
701
702 while( 1 ){
703 if( n+100>nLine ){
704 nLine = nLine*2 + 100;
705 zLine = realloc(zLine, nLine);
706 if( zLine==0 ) shell_out_of_memory();
707 }
708 if( fgets(&zLine[n], nLine - n, in)==0 ){
709 if( n==0 ){
710 free(zLine);
711 return 0;
@@ -728,11 +683,11 @@
728 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
729 if( zTrans ){
730 int nTrans = strlen30(zTrans)+1;
731 if( nTrans>nLine ){
732 zLine = realloc(zLine, nTrans);
733 if( zLine==0 ) shell_out_of_memory();
734 }
735 memcpy(zLine, zTrans, nTrans);
736 sqlite3_free(zTrans);
737 }
738 }
@@ -875,11 +830,11 @@
875 }
876
877 if( p->z==0 || p->n+len>=p->nAlloc ){
878 p->nAlloc = p->nAlloc*2 + len + 20;
879 p->z = realloc(p->z, p->nAlloc);
880 if( p->z==0 ) shell_out_of_memory();
881 }
882
883 if( quote ){
884 char *zCsr = p->z+p->n;
885 *zCsr++ = quote;
@@ -930,10 +885,11 @@
930 char *zDiv = "(";
931 int nRow = 0;
932
933 zSql = sqlite3_mprintf("PRAGMA \"%w\".table_info=%Q;",
934 zSchema ? zSchema : "main", zName);
 
935 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
936 sqlite3_free(zSql);
937 initText(&s);
938 if( zSchema ){
939 cQuote = quoteChar(zSchema);
@@ -946,10 +902,11 @@
946 while( sqlite3_step(pStmt)==SQLITE_ROW ){
947 const char *zCol = (const char*)sqlite3_column_text(pStmt, 1);
948 nRow++;
949 appendText(&s, zDiv, 0);
950 zDiv = ",";
 
951 cQuote = quoteChar(zCol);
952 appendText(&s, zCol, cQuote);
953 }
954 appendText(&s, ")", 0);
955 sqlite3_finalize(pStmt);
@@ -969,13 +926,15 @@
969 static void shellModuleSchema(
970 sqlite3_context *pCtx,
971 int nVal,
972 sqlite3_value **apVal
973 ){
974 const char *zName = (const char*)sqlite3_value_text(apVal[0]);
975 char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
976 UNUSED_PARAMETER(nVal);
 
 
977 if( zFake ){
978 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
979 -1, sqlite3_free);
980 free(zFake);
981 }
@@ -1859,10 +1818,11 @@
1859 SHA3Context *p,
1860 const unsigned char *aData,
1861 unsigned int nData
1862 ){
1863 unsigned int i = 0;
 
1864 #if SHA3_BYTEORDER==1234
1865 if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
1866 for(; i+7<nData; i+=8){
1867 p->u.s[p->nLoaded/8] ^= *(u64*)&aData[i];
1868 p->nLoaded += 8;
@@ -2517,14 +2477,15 @@
2517 const char *zFile, /* File to write */
2518 sqlite3_value *pData, /* Data to write */
2519 mode_t mode, /* MODE parameter passed to writefile() */
2520 sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
2521 ){
 
2522 #if !defined(_WIN32) && !defined(WIN32)
2523 if( S_ISLNK(mode) ){
2524 const char *zTo = (const char*)sqlite3_value_text(pData);
2525 if( symlink(zTo, zFile)<0 ) return 1;
2526 }else
2527 #endif
2528 {
2529 if( S_ISDIR(mode) ){
2530 if( mkdir(zFile, mode) ){
@@ -5886,11 +5847,11 @@
5886 if( (idxNum & 3)==3 ){
5887 /* Both start= and stop= boundaries are available. This is the
5888 ** the preferred case */
5889 pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5890 pIdxInfo->estimatedRows = 1000;
5891 if( pIdxInfo->nOrderBy==1 ){
5892 if( pIdxInfo->aOrderBy[0].desc ){
5893 idxNum |= 8;
5894 }else{
5895 idxNum |= 16;
5896 }
@@ -6721,17 +6682,19 @@
6721 const sqlite3_api_routines *pApi
6722 ){
6723 int rc = SQLITE_OK;
6724 SQLITE_EXTENSION_INIT2(pApi);
6725 (void)pzErrMsg; /* Unused */
6726 rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6727 0, re_sql_func, 0, 0);
 
6728 if( rc==SQLITE_OK ){
6729 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
6730 ** of regexp(PATTERN,STRING). */
6731 rc = sqlite3_create_function(db, "regexpi", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
6732 (void*)db, re_sql_func, 0, 0);
 
6733 }
6734 return rc;
6735 }
6736
6737 /************************* End ../ext/misc/regexp.c ********************/
@@ -9939,21 +9902,29 @@
9939 IdxTable **ppOut, /* OUT: New object (if successful) */
9940 char **pzErrmsg /* OUT: Error message (if not) */
9941 ){
9942 sqlite3_stmt *p1 = 0;
9943 int nCol = 0;
9944 int nTab = STRLEN(zTab);
9945 int nByte = sizeof(IdxTable) + nTab + 1;
9946 IdxTable *pNew = 0;
9947 int rc, rc2;
9948 char *pCsr = 0;
9949 int nPk = 0;
9950
 
 
 
 
9951 rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
9952 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
9953 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
9954 const char *zColSeq = 0;
 
 
 
 
9955 nByte += 1 + STRLEN(zCol);
9956 rc = sqlite3_table_column_metadata(
9957 db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
9958 );
9959 if( zColSeq==0 ) zColSeq = "binary";
@@ -9976,11 +9947,13 @@
9976
9977 nCol = 0;
9978 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
9979 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
9980 const char *zColSeq = 0;
9981 int nCopy = STRLEN(zCol) + 1;
 
 
9982 pNew->aCol[nCol].zName = pCsr;
9983 pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
9984 memcpy(pCsr, zCol, nCopy);
9985 pCsr += nCopy;
9986
@@ -10128,10 +10101,11 @@
10128 while( rc==SQLITE_OK && sqlite3_step(pIdxList)==SQLITE_ROW ){
10129 int bMatch = 1;
10130 IdxConstraint *pT = pTail;
10131 sqlite3_stmt *pInfo = 0;
10132 const char *zIdx = (const char*)sqlite3_column_text(pIdxList, 1);
 
10133
10134 /* Zero the IdxConstraint.bFlag values in the pEq list */
10135 for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0;
10136
10137 rc = idxPrintfPrepareStmt(dbm, &pInfo, 0, "PRAGMA index_xInfo=%Q", zIdx);
@@ -10539,10 +10513,11 @@
10539
10540 /* Create the table and its triggers in the temp schema */
10541 rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab);
10542 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSelect) ){
10543 const char *zCreate = (const char*)sqlite3_column_text(pSelect, 0);
 
10544 rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr);
10545 }
10546 idxFinalize(&rc, pSelect);
10547
10548 /* Rename the table in the temp schema to zInt */
@@ -10641,12 +10616,13 @@
10641 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){
10642 const char *zType = (const char*)sqlite3_column_text(pSchema, 0);
10643 const char *zName = (const char*)sqlite3_column_text(pSchema, 1);
10644 const char *zSql = (const char*)sqlite3_column_text(pSchema, 2);
10645
 
10646 if( zType[0]=='v' || zType[1]=='r' ){
10647 rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
10648 }else{
10649 IdxTable *pTab;
10650 rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg);
10651 if( rc==SQLITE_OK ){
10652 int i;
@@ -10779,10 +10755,11 @@
10779 break;
10780
10781 case SQLITE_BLOB:
10782 case SQLITE_TEXT: {
10783 int nByte = sqlite3_value_bytes(argv[1]);
 
10784 if( nByte>pSlot->nByte ){
10785 char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
10786 if( zNew==0 ){
10787 sqlite3_result_error_nomem(pCtx);
10788 return;
@@ -10790,13 +10767,15 @@
10790 pSlot->nByte = nByte*2;
10791 pSlot->z = zNew;
10792 }
10793 pSlot->n = nByte;
10794 if( pSlot->eType==SQLITE_BLOB ){
10795 memcpy(pSlot->z, sqlite3_value_blob(argv[1]), nByte);
 
10796 }else{
10797 memcpy(pSlot->z, sqlite3_value_text(argv[1]), nByte);
 
10798 }
10799 break;
10800 }
10801 }
10802 }
@@ -11003,10 +10982,11 @@
11003
11004 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pAllIndex) ){
11005 i64 iRowid = sqlite3_column_int64(pAllIndex, 0);
11006 const char *zTab = (const char*)sqlite3_column_text(pAllIndex, 1);
11007 const char *zIdx = (const char*)sqlite3_column_text(pAllIndex, 2);
 
11008 if( p->iSample<100 && iPrev!=iRowid ){
11009 samplectx.target = (double)p->iSample / 100.0;
11010 samplectx.iTarget = p->iSample;
11011 samplectx.nRow = 0.0;
11012 samplectx.nRet = 0.0;
@@ -11069,18 +11049,18 @@
11069 }
11070
11071
11072 /* Copy the entire schema of database [db] into [dbm]. */
11073 if( rc==SQLITE_OK ){
11074 sqlite3_stmt *pSql;
11075 rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
11076 "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'"
11077 " AND sql NOT LIKE 'CREATE VIRTUAL %%'"
11078 );
11079 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
11080 const char *zSql = (const char*)sqlite3_column_text(pSql, 0);
11081 rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
11082 }
11083 idxFinalize(&rc, pSql);
11084 }
11085
11086 /* Create the vtab schema */
@@ -12831,10 +12811,11 @@
12831 break;
12832 }
12833 }
12834 if( i==0 || strstr(z, p->colSeparator)!=0 ){
12835 char *zQuoted = sqlite3_mprintf("\"%w\"", z);
 
12836 utf8_printf(out, "%s", zQuoted);
12837 sqlite3_free(zQuoted);
12838 }else{
12839 utf8_printf(out, "%s", z);
12840 }
@@ -13005,11 +12986,11 @@
13005 int nText = strlen30(zText);
13006 if( p->autoEQPtest ){
13007 utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText);
13008 }
13009 pNew = sqlite3_malloc64( sizeof(*pNew) + nText );
13010 if( pNew==0 ) shell_out_of_memory();
13011 pNew->iEqpId = iEqpId;
13012 pNew->iParentId = p2;
13013 memcpy(pNew->zText, zText, nText+1);
13014 pNew->pNext = 0;
13015 if( p->sGraph.pLast ){
@@ -13226,10 +13207,11 @@
13226 ){
13227 utf8_printf(p->out, "%s;\n", azArg[0]);
13228 break;
13229 }
13230 z = sqlite3_mprintf("%s", azArg[0]);
 
13231 j = 0;
13232 for(i=0; IsSpace(z[i]); i++){}
13233 for(; (c = z[i])!=0; i++){
13234 if( IsSpace(c) ){
13235 if( z[j-1]=='\r' ) z[j-1] = '\n';
@@ -13357,10 +13339,11 @@
13357 raw_printf(p->out,"(");
13358 for(i=0; i<nArg; i++){
13359 if( i>0 ) raw_printf(p->out, ",");
13360 if( quoteChar(azCol[i]) ){
13361 char *z = sqlite3_mprintf("\"%w\"", azCol[i]);
 
13362 utf8_printf(p->out, "%s", z);
13363 sqlite3_free(z);
13364 }else{
13365 raw_printf(p->out, "%s", azCol[i]);
13366 }
@@ -13602,20 +13585,61 @@
13602 if( zName==0 ) return;
13603 cQuote = quoteChar(zName);
13604 n = strlen30(zName);
13605 if( cQuote ) n += n+2;
13606 z = p->zDestTable = malloc( n+1 );
13607 if( z==0 ) shell_out_of_memory();
13608 n = 0;
13609 if( cQuote ) z[n++] = cQuote;
13610 for(i=0; zName[i]; i++){
13611 z[n++] = zName[i];
13612 if( zName[i]==cQuote ) z[n++] = cQuote;
13613 }
13614 if( cQuote ) z[n++] = cQuote;
13615 z[n] = 0;
13616 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13617
13618
13619 /*
13620 ** Execute a query statement that will generate SQL output. Print
13621 ** the result columns, comma-separated, on a line and then add a
@@ -13635,12 +13659,14 @@
13635 int nResult;
13636 int i;
13637 const char *z;
13638 rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
13639 if( rc!=SQLITE_OK || !pSelect ){
13640 utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc,
13641 sqlite3_errmsg(p->db));
 
 
13642 if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
13643 return rc;
13644 }
13645 rc = sqlite3_step(pSelect);
13646 nResult = sqlite3_column_count(pSelect);
@@ -13672,15 +13698,21 @@
13672 ** Allocate space and save off string indicating current error.
13673 */
13674 static char *save_err_msg(
13675 sqlite3 *db, /* Database to query */
13676 const char *zWhen, /* Qualifier (format) wrapper */
13677 int rc /* Error code returned from API */
 
13678 ){
13679 if( zWhen==0 )
13680 zWhen = "%s (%d)";
13681 return sqlite3_mprintf(zWhen, sqlite3_errmsg(db), rc);
 
 
 
 
 
13682 }
13683
13684 #ifdef __linux__
13685 /*
13686 ** Attempt to display I/O stats on Linux using /proc/PID/io
@@ -14024,13 +14056,13 @@
14024 }
14025 }
14026 }
14027 nAlloc += 100;
14028 p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
14029 if( p->aiIndent==0 ) shell_out_of_memory();
14030 abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
14031 if( abYield==0 ) shell_out_of_memory();
14032 }
14033 abYield[iOp] = str_in_array(zOp, azYield);
14034 p->aiIndent[iOp] = 0;
14035 p->nIndent = iOp+1;
14036
@@ -14235,29 +14267,29 @@
14235 if( rc!=SQLITE_ROW ) return;
14236 nColumn = sqlite3_column_count(pStmt);
14237 nAlloc = nColumn*4;
14238 if( nAlloc<=0 ) nAlloc = 1;
14239 azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
14240 if( azData==0 ) shell_out_of_memory();
14241 for(i=0; i<nColumn; i++){
14242 azData[i] = strdup(sqlite3_column_name(pStmt,i));
14243 }
14244 do{
14245 if( (nRow+2)*nColumn >= nAlloc ){
14246 nAlloc *= 2;
14247 azData = sqlite3_realloc64(azData, nAlloc*sizeof(char*));
14248 if( azData==0 ) shell_out_of_memory();
14249 }
14250 nRow++;
14251 for(i=0; i<nColumn; i++){
14252 z = (const char*)sqlite3_column_text(pStmt,i);
14253 azData[nRow*nColumn + i] = z ? strdup(z) : 0;
14254 }
14255 }while( sqlite3_step(pStmt)==SQLITE_ROW );
14256 if( nColumn>p->nWidth ){
14257 p->colWidth = realloc(p->colWidth, (nColumn+1)*2*sizeof(int));
14258 if( p->colWidth==0 ) shell_out_of_memory();
14259 for(i=p->nWidth; i<nColumn; i++) p->colWidth[i] = 0;
14260 p->nWidth = nColumn;
14261 p->actualWidth = &p->colWidth[nColumn];
14262 }
14263 memset(p->actualWidth, 0, nColumn*sizeof(int));
@@ -14411,11 +14443,14 @@
14411 do{
14412 nRow++;
14413 /* extract the data and data types */
14414 for(i=0; i<nCol; i++){
14415 aiTypes[i] = x = sqlite3_column_type(pStmt, i);
14416 if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
 
 
 
14417 azVals[i] = "";
14418 }else{
14419 azVals[i] = (char*)sqlite3_column_text(pStmt, i);
14420 }
14421 if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
@@ -14436,11 +14471,14 @@
14436 } while( SQLITE_ROW == rc );
14437 sqlite3_free(pData);
14438 if( pArg->cMode==MODE_Json ){
14439 fputs("]\n", pArg->out);
14440 }else if( pArg->cMode==MODE_Count ){
14441 printf("%llu row%s\n", nRow, nRow!=1 ? "s" : "");
 
 
 
14442 }
14443 }
14444 }
14445 }
14446
@@ -14560,18 +14598,19 @@
14560 }
14561
14562 if( rc==SQLITE_OK ){
14563 pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
14564 if( pState->expert.pExpert==0 ){
14565 raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr);
14566 rc = SQLITE_ERROR;
14567 }else{
14568 sqlite3_expert_config(
14569 pState->expert.pExpert, EXPERT_CONFIG_SAMPLE, iSample
14570 );
14571 }
14572 }
 
14573
14574 return rc;
14575 }
14576 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
14577
@@ -14609,11 +14648,11 @@
14609 while( zSql[0] && (SQLITE_OK == rc) ){
14610 static const char *zStmtSql;
14611 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
14612 if( SQLITE_OK != rc ){
14613 if( pzErrMsg ){
14614 *pzErrMsg = save_err_msg(db, "in prepare, %s (%d)", rc);
14615 }
14616 }else{
14617 if( !pStmt ){
14618 /* this happens for a comment or white-space */
14619 zSql = zLeftover;
@@ -14644,10 +14683,11 @@
14644 sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP);
14645 if( pArg->autoEQP>=AUTOEQP_trigger ){
14646 sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0);
14647 }
14648 zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
 
14649 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
14650 if( rc==SQLITE_OK ){
14651 while( sqlite3_step(pExplain)==SQLITE_ROW ){
14652 const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3);
14653 int iEqpId = sqlite3_column_int(pExplain, 0);
@@ -14661,10 +14701,11 @@
14661 sqlite3_finalize(pExplain);
14662 sqlite3_free(zEQP);
14663 if( pArg->autoEQP>=AUTOEQP_full ){
14664 /* Also do an EXPLAIN for ".eqp full" mode */
14665 zEQP = sqlite3_mprintf("EXPLAIN %s", zStmtSql);
 
14666 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
14667 if( rc==SQLITE_OK ){
14668 pArg->cMode = MODE_Explain;
14669 explain_data_prepare(pArg, pExplain);
14670 exec_prepared_stmt(pArg, pExplain);
@@ -14723,11 +14764,11 @@
14723 if( rc!=SQLITE_NOMEM ) rc = rc2;
14724 if( rc==SQLITE_OK ){
14725 zSql = zLeftover;
14726 while( IsSpace(zSql[0]) ) zSql++;
14727 }else if( pzErrMsg ){
14728 *pzErrMsg = save_err_msg(db, "stepping, %s (%d)", rc);
14729 }
14730
14731 /* clear saved stmt handle */
14732 if( pArg ){
14733 pArg->pStmt = NULL;
@@ -14773,20 +14814,22 @@
14773 int isIPK = 0; /* True if one PRIMARY KEY column of type INTEGER */
14774 int preserveRowid = ShellHasFlag(p, SHFLG_PreserveRowid);
14775 int rc;
14776
14777 zSql = sqlite3_mprintf("PRAGMA table_info=%Q", zTab);
 
14778 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
14779 sqlite3_free(zSql);
14780 if( rc ) return 0;
14781 while( sqlite3_step(pStmt)==SQLITE_ROW ){
14782 if( nCol>=nAlloc-2 ){
14783 nAlloc = nAlloc*2 + nCol + 10;
14784 azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
14785 if( azCol==0 ) shell_out_of_memory();
14786 }
14787 azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
 
14788 if( sqlite3_column_int(pStmt, 5) ){
14789 nPK++;
14790 if( nPK==1
14791 && sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
14792 "INTEGER")==0
@@ -14816,10 +14859,11 @@
14816 ** there is a "pk" entry in "PRAGMA index_list". There will be
14817 ** no "pk" index if the PRIMARY KEY really is an alias for the ROWID.
14818 */
14819 zSql = sqlite3_mprintf("SELECT 1 FROM pragma_index_list(%Q)"
14820 " WHERE origin='pk'", zTab);
 
14821 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
14822 sqlite3_free(zSql);
14823 if( rc ){
14824 freeColumnList(azCol);
14825 return 0;
@@ -14907,10 +14951,11 @@
14907 }
14908 zIns = sqlite3_mprintf(
14909 "INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)"
14910 "VALUES('table','%q','%q',0,'%q');",
14911 zTable, zTable, zSql);
 
14912 utf8_printf(p->out, "%s\n", zIns);
14913 sqlite3_free(zIns);
14914 return 0;
14915 }else{
14916 printSchemaLine(p->out, zSql, ";\n");
@@ -15150,13 +15195,10 @@
15150 ".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
15151 " If FILE begins with '|' then open as a pipe",
15152 " --bom Put a UTF8 byte-order mark at the beginning",
15153 " -e Send output to the system text editor",
15154 " -x Send output as CSV to a spreadsheet (same as \".excel\")",
15155 #ifdef SQLITE_DEBUG
15156 ".oom ?--repeat M? ?N? Simulate an OOM error on the N-th allocation",
15157 #endif
15158 ".open ?OPTIONS? ?FILE? Close existing database and reopen FILE",
15159 " Options:",
15160 " --append Use appendvfs to append database to the end of FILE",
15161 #ifndef SQLITE_OMIT_DESERIALIZE
15162 " --deserialize Load into memory using sqlite3_deserialize()",
@@ -15188,11 +15230,12 @@
15188 " --quiet|-q No output except at interrupts",
15189 " --reset Reset the count for each input and interrupt",
15190 #endif
15191 ".prompt MAIN CONTINUE Replace the standard prompts",
15192 ".quit Exit this program",
15193 ".read FILE Read input from FILE",
 
15194 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
15195 ".recover Recover as much data as possible from corrupt db.",
15196 " --freelist-corrupt Assume the freelist is corrupt",
15197 " --recovery-db NAME Store recovery metadata in database file NAME",
15198 " --lost-and-found TABLE Alternative name for the lost-and-found table",
@@ -15308,10 +15351,11 @@
15308 }
15309 }
15310 }else{
15311 /* Look for commands that for which zPattern is an exact prefix */
15312 zPat = sqlite3_mprintf(".%s*", zPattern);
 
15313 for(i=0; i<ArraySize(azHelp); i++){
15314 if( sqlite3_strglob(zPat, azHelp[i])==0 ){
15315 utf8_printf(out, "%s\n", azHelp[i]);
15316 j = i+1;
15317 n++;
@@ -15330,10 +15374,11 @@
15330 return n;
15331 }
15332 /* Look for commands that contain zPattern anywhere. Show the complete
15333 ** text of all commands that match. */
15334 zPat = sqlite3_mprintf("%%%s%%", zPattern);
 
15335 for(i=0; i<ArraySize(azHelp); i++){
15336 if( azHelp[i][0]=='.' ) j = i;
15337 if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
15338 utf8_printf(out, "%s\n", azHelp[j]);
15339 while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
@@ -15518,14 +15563,11 @@
15518 if( rc!=2 ) goto readHexDb_error;
15519 if( n<0 ) goto readHexDb_error;
15520 if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error;
15521 n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */
15522 a = sqlite3_malloc( n ? n : 1 );
15523 if( a==0 ){
15524 utf8_printf(stderr, "Out of memory!\n");
15525 goto readHexDb_error;
15526 }
15527 memset(a, 0, n);
15528 if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){
15529 utf8_printf(stderr, "invalid pagesize\n");
15530 goto readHexDb_error;
15531 }
@@ -15652,11 +15694,11 @@
15652 int argc,
15653 sqlite3_value **argv
15654 ){
15655 const char *zText = (const char*)sqlite3_value_text(argv[0]);
15656 UNUSED_PARAMETER(argc);
15657 if( zText[0]=='\'' ){
15658 int nText = sqlite3_value_bytes(argv[0]);
15659 int i;
15660 char zBuf1[20];
15661 char zBuf2[20];
15662 const char *zNL = 0;
@@ -15829,10 +15871,11 @@
15829 editFunc, 0, 0);
15830 #endif
15831 if( p->openMode==SHELL_OPEN_ZIPFILE ){
15832 char *zSql = sqlite3_mprintf(
15833 "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
 
15834 sqlite3_exec(p->db, zSql, 0, 0, 0);
15835 sqlite3_free(zSql);
15836 }
15837 #ifndef SQLITE_OMIT_DESERIALIZE
15838 else
@@ -15886,15 +15929,17 @@
15886 if( state==0 ){
15887 char *zSql;
15888 sqlite3_finalize(pStmt);
15889 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
15890 " FROM completion(%Q) ORDER BY 1", text);
 
15891 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
15892 sqlite3_free(zSql);
15893 }
15894 if( sqlite3_step(pStmt)==SQLITE_ROW ){
15895 zRet = strdup((const char*)sqlite3_column_text(pStmt, 0));
 
15896 }else{
15897 sqlite3_finalize(pStmt);
15898 pStmt = 0;
15899 zRet = 0;
15900 }
@@ -15923,17 +15968,18 @@
15923 iStart = i+1;
15924 memcpy(zBuf, zLine, iStart);
15925 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
15926 " FROM completion(%Q,%Q) ORDER BY 1",
15927 &zLine[iStart], zLine);
 
15928 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
15929 sqlite3_free(zSql);
15930 sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
15931 while( sqlite3_step(pStmt)==SQLITE_ROW ){
15932 const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
15933 int nCompletion = sqlite3_column_bytes(pStmt, 0);
15934 if( iStart+nCompletion < sizeof(zBuf)-1 ){
15935 memcpy(zBuf+iStart, zCompletion, nCompletion+1);
15936 linenoiseAddCompletion(lc, zBuf);
15937 }
15938 }
15939 sqlite3_finalize(pStmt);
@@ -16164,11 +16210,11 @@
16164 /* Append a single byte to z[] */
16165 static void import_append_char(ImportCtx *p, int c){
16166 if( p->n+1>=p->nAlloc ){
16167 p->nAlloc += p->nAlloc + 100;
16168 p->z = sqlite3_realloc64(p->z, p->nAlloc);
16169 if( p->z==0 ) shell_out_of_memory();
16170 }
16171 p->z[p->n++] = (char)c;
16172 }
16173
16174 /* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -16316,20 +16362,21 @@
16316 int k = 0;
16317 int cnt = 0;
16318 const int spinRate = 10000;
16319
16320 zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
 
16321 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16322 if( rc ){
16323 utf8_printf(stderr, "Error %d: %s on [%s]\n",
16324 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16325 zQuery);
16326 goto end_data_xfer;
16327 }
16328 n = sqlite3_column_count(pQuery);
16329 zInsert = sqlite3_malloc64(200 + nTable + n*3);
16330 if( zInsert==0 ) shell_out_of_memory();
16331 sqlite3_snprintf(200+nTable,zInsert,
16332 "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
16333 i = strlen30(zInsert);
16334 for(j=1; j<n; j++){
16335 memcpy(zInsert+i, ",?", 2);
@@ -16388,10 +16435,11 @@
16388 if( rc==SQLITE_DONE ) break;
16389 sqlite3_finalize(pQuery);
16390 sqlite3_free(zQuery);
16391 zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
16392 zTable);
 
16393 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16394 if( rc ){
16395 utf8_printf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
16396 break;
16397 }
@@ -16424,10 +16472,11 @@
16424 const unsigned char *zSql;
16425 char *zErrMsg = 0;
16426
16427 zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
16428 " WHERE %s", zWhere);
 
16429 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16430 if( rc ){
16431 utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
16432 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16433 zQuery);
@@ -16434,10 +16483,11 @@
16434 goto end_schema_xfer;
16435 }
16436 while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
16437 zName = sqlite3_column_text(pQuery, 0);
16438 zSql = sqlite3_column_text(pQuery, 1);
 
16439 printf("%s... ", zName); fflush(stdout);
16440 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
16441 if( zErrMsg ){
16442 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
16443 sqlite3_free(zErrMsg);
@@ -16451,10 +16501,11 @@
16451 if( rc!=SQLITE_DONE ){
16452 sqlite3_finalize(pQuery);
16453 sqlite3_free(zQuery);
16454 zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
16455 " WHERE %s ORDER BY rowid DESC", zWhere);
 
16456 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16457 if( rc ){
16458 utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
16459 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16460 zQuery);
@@ -16461,10 +16512,11 @@
16461 goto end_schema_xfer;
16462 }
16463 while( sqlite3_step(pQuery)==SQLITE_ROW ){
16464 zName = sqlite3_column_text(pQuery, 0);
16465 zSql = sqlite3_column_text(pQuery, 1);
 
16466 printf("%s... ", zName); fflush(stdout);
16467 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
16468 if( zErrMsg ){
16469 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
16470 sqlite3_free(zErrMsg);
@@ -16845,13 +16897,11 @@
16845 }
16846 p->zTempFile = sqlite3_mprintf("%s/temp%llx.%s", zTemp, r, zSuffix);
16847 }else{
16848 p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
16849 }
16850 if( p->zTempFile==0 ){
16851 shell_out_of_memory();
16852 }
16853 }
16854
16855
16856 /*
16857 ** The implementation of SQL scalar function fkey_collate_clause(), used
@@ -17028,18 +17078,18 @@
17028 const char *zFrom = (const char*)sqlite3_column_text(pSql, 2);
17029 const char *zTarget = (const char*)sqlite3_column_text(pSql, 3);
17030 const char *zCI = (const char*)sqlite3_column_text(pSql, 4);
17031 const char *zParent = (const char*)sqlite3_column_text(pSql, 5);
17032
 
 
17033 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
17034 if( rc!=SQLITE_OK ) break;
17035 if( SQLITE_ROW==sqlite3_step(pExplain) ){
17036 const char *zPlan = (const char*)sqlite3_column_text(pExplain, 3);
17037 res = (
17038 0==sqlite3_strglob(zGlob, zPlan)
17039 || 0==sqlite3_strglob(zGlobIPK, zPlan)
17040 );
17041 }
17042 rc = sqlite3_finalize(pExplain);
17043 if( rc!=SQLITE_OK ) break;
17044
17045 if( res<0 ){
@@ -18140,10 +18190,11 @@
18140 , zName, zName
18141 );
18142 if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPkFinder) ){
18143 pTab->iPk = sqlite3_column_int(pPkFinder, 0);
18144 zPk = (const char*)sqlite3_column_text(pPkFinder, 1);
 
18145 }
18146 }
18147
18148 pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName);
18149 pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1));
@@ -18224,12 +18275,14 @@
18224 break;
18225 }
18226 if( sqlite3_stricmp(zType, "table")==0 ){
18227 zName = (const char*)sqlite3_column_text(pStmt, 1);
18228 zSql = (const char*)sqlite3_column_text(pStmt, 2);
18229 pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol);
18230 break;
 
 
18231 }
18232 }
18233
18234 shellFinalize(pRc, pStmt);
18235 *pbNoop = bNoop;
@@ -18919,12 +18972,13 @@
18919 rc = 1;
18920 }else{
18921 while( sqlite3_step(pStmt)==SQLITE_ROW ){
18922 const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
18923 const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
 
18924 azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
18925 if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
18926 azName[nName*2] = strdup(zSchema);
18927 azName[nName*2+1] = strdup(zFile);
18928 nName++;
18929 }
18930 }
@@ -19176,12 +19230,19 @@
19176 }
19177 }else
19178
19179 #ifndef SQLITE_OMIT_VIRTUALTABLE
19180 if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){
19181 open_db(p, 0);
19182 expertDotCommand(p, azArg, nArg);
 
 
 
 
 
 
 
19183 }else
19184 #endif
19185
19186 if( c=='f' && strncmp(azArg[0], "filectrl", n)==0 ){
19187 static const struct {
@@ -19969,11 +20030,12 @@
19969 if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
19970 if( nArg!=2 ){
19971 raw_printf(stderr, "Usage: .nonce NONCE\n");
19972 rc = 1;
19973 }else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
19974 raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n", p->lineno, azArg[1]);
 
19975 exit(1);
19976 }else{
19977 p->bSafeMode = 0;
19978 return 0; /* Return immediately to bypass the safe mode reset
19979 ** at the end of this procedure */
@@ -19988,39 +20050,12 @@
19988 raw_printf(stderr, "Usage: .nullvalue STRING\n");
19989 rc = 1;
19990 }
19991 }else
19992
19993 #ifdef SQLITE_DEBUG
19994 if( c=='o' && strcmp(azArg[0],"oom")==0 ){
19995 int i;
19996 for(i=1; i<nArg; i++){
19997 const char *z = azArg[i];
19998 if( z[0]=='-' && z[1]=='-' ) z++;
19999 if( strcmp(z,"-repeat")==0 ){
20000 if( i==nArg-1 ){
20001 raw_printf(p->out, "missing argument on \"%s\"\n", azArg[i]);
20002 rc = 1;
20003 }else{
20004 oomRepeat = (int)integerValue(azArg[++i]);
20005 }
20006 }else if( IsDigit(z[0]) ){
20007 oomCounter = (int)integerValue(azArg[i]);
20008 }else{
20009 raw_printf(p->out, "unknown argument: \"%s\"\n", azArg[i]);
20010 raw_printf(p->out, "Usage: .oom [--repeat N] [M]\n");
20011 rc = 1;
20012 }
20013 }
20014 if( rc==0 ){
20015 raw_printf(p->out, "oomCounter = %d\n", oomCounter);
20016 raw_printf(p->out, "oomRepeat = %d\n", oomRepeat);
20017 }
20018 }else
20019 #endif /* SQLITE_DEBUG */
20020
20021 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
 
20022 char *zNewFilename = 0; /* Name of the database file to open */
20023 int iName = 1; /* Index in azArg[] of the filename */
20024 int newFlag = 0; /* True to delete file before opening */
20025 int openMode = SHELL_OPEN_UNSPEC;
20026
@@ -20049,16 +20084,16 @@
20049 #endif /* SQLITE_OMIT_DESERIALIZE */
20050 }else if( z[0]=='-' ){
20051 utf8_printf(stderr, "unknown option: %s\n", z);
20052 rc = 1;
20053 goto meta_command_exit;
20054 }else if( zNewFilename ){
20055 utf8_printf(stderr, "extra argument: \"%s\"\n", z);
20056 rc = 1;
20057 goto meta_command_exit;
20058 }else{
20059 zNewFilename = sqlite3_mprintf("%s", z);
20060 }
20061 }
20062
20063 /* Close the existing database */
20064 session_close_all(p, -1);
@@ -20070,19 +20105,25 @@
20070 p->openMode = openMode;
20071 p->openFlags = 0;
20072 p->szMax = 0;
20073
20074 /* If a filename is specified, try to open it first */
20075 if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
20076 if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
20077 if( p->bSafeMode
20078 && p->openMode!=SHELL_OPEN_HEXDB
20079 && zNewFilename
20080 && strcmp(zNewFilename,":memory:")!=0
20081 ){
20082 failIfSafeMode(p, "cannot open disk-based database files in safe mode");
20083 }
 
 
 
 
 
 
20084 p->pAuxDb->zDbFilename = zNewFilename;
20085 open_db(p, OPEN_DB_KEEPALIVE);
20086 if( p->db==0 ){
20087 utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
20088 sqlite3_free(zNewFilename);
@@ -20132,11 +20173,11 @@
20132 rc = 1;
20133 goto meta_command_exit;
20134 }
20135 }else if( zFile==0 && eMode!='e' && eMode!='x' ){
20136 zFile = sqlite3_mprintf("%s", z);
20137 if( zFile[0]=='|' ){
20138 while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
20139 break;
20140 }
20141 }else{
20142 utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
@@ -20145,11 +20186,13 @@
20145 rc = 1;
20146 sqlite3_free(zFile);
20147 goto meta_command_exit;
20148 }
20149 }
20150 if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
 
 
20151 if( bOnce ){
20152 p->outCount = 2;
20153 }else{
20154 p->outCount = 0;
20155 }
@@ -20172,10 +20215,11 @@
20172 }
20173 sqlite3_free(zFile);
20174 zFile = sqlite3_mprintf("%s", p->zTempFile);
20175 }
20176 #endif /* SQLITE_NOHAVE_SYSTEM */
 
20177 if( zFile[0]=='|' ){
20178 #ifdef SQLITE_OMIT_POPEN
20179 raw_printf(stderr, "Error: pipes are not supported in this OS\n");
20180 rc = 1;
20181 p->out = stdout;
@@ -20268,21 +20312,21 @@
20268 const char *zValue = azArg[3];
20269 bind_table_init(p);
20270 zSql = sqlite3_mprintf(
20271 "REPLACE INTO temp.sqlite_parameters(key,value)"
20272 "VALUES(%Q,%s);", zKey, zValue);
20273 if( zSql==0 ) shell_out_of_memory();
20274 pStmt = 0;
20275 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
20276 sqlite3_free(zSql);
20277 if( rx!=SQLITE_OK ){
20278 sqlite3_finalize(pStmt);
20279 pStmt = 0;
20280 zSql = sqlite3_mprintf(
20281 "REPLACE INTO temp.sqlite_parameters(key,value)"
20282 "VALUES(%Q,%Q);", zKey, zValue);
20283 if( zSql==0 ) shell_out_of_memory();
20284 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
20285 sqlite3_free(zSql);
20286 if( rx!=SQLITE_OK ){
20287 utf8_printf(p->out, "Error: %s\n", sqlite3_errmsg(p->db));
20288 sqlite3_finalize(pStmt);
@@ -20299,11 +20343,11 @@
20299 ** exists.
20300 */
20301 if( nArg==3 && strcmp(azArg[1],"unset")==0 ){
20302 char *zSql = sqlite3_mprintf(
20303 "DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]);
20304 if( zSql==0 ) shell_out_of_memory();
20305 sqlite3_exec(p->db, zSql, 0, 0, 0);
20306 sqlite3_free(zSql);
20307 }else
20308 /* If no command name matches, show a syntax error */
20309 parameter_syntax_error:
@@ -20525,10 +20569,11 @@
20525 " name text,\n"
20526 " tbl_name text,\n"
20527 " rootpage integer,\n"
20528 " sql text\n"
20529 ")", zName);
 
20530 new_argv[1] = 0;
20531 new_colv[0] = "sql";
20532 new_colv[1] = 0;
20533 callback(&data, 1, new_argv, new_colv);
20534 sqlite3_free(new_argv[0]);
@@ -20576,12 +20621,14 @@
20576 }
20577 #endif
20578 appendText(&sSelect, ") WHERE ", 0);
20579 if( zName ){
20580 char *zQarg = sqlite3_mprintf("%Q", zName);
20581 int bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 ||
20582 strchr(zName, '[') != 0;
 
 
20583 if( strchr(zName, '.') ){
20584 appendText(&sSelect, "lower(printf('%s.%s',sname,tbl_name))", 0);
20585 }else{
20586 appendText(&sSelect, "lower(tbl_name)", 0);
20587 }
@@ -20740,11 +20787,12 @@
20740 if( pSession->azFilter==0 ){
20741 raw_printf(stderr, "Error: out or memory\n");
20742 exit(1);
20743 }
20744 for(ii=1; ii<nCmd; ii++){
20745 pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
 
20746 }
20747 pSession->nFilter = ii-1;
20748 }
20749 }else
20750
@@ -20812,10 +20860,11 @@
20812 }
20813 pSession->nFilter = 0;
20814 sqlite3session_table_filter(pSession->p, session_filter, pSession);
20815 pAuxDb->nSession++;
20816 pSession->zName = sqlite3_mprintf("%s", zName);
 
20817 }else
20818 /* If no command name matches, show a syntax error */
20819 session_syntax_error:
20820 showHelp(p->out, "session");
20821 }else
@@ -20905,15 +20954,16 @@
20905 int tno = sqlite3_column_int(pStmt, 0);
20906 const char *zOp = (const char*)sqlite3_column_text(pStmt, 1);
20907 const char *zSql = (const char*)sqlite3_column_text(pStmt, 2);
20908 const char *zAns = (const char*)sqlite3_column_text(pStmt, 3);
20909
 
 
 
20910 k = 0;
20911 if( bVerbose>0 ){
20912 char *zQuote = sqlite3_mprintf("%q", zSql);
20913 printf("%d: %s %s\n", tno, zOp, zSql);
20914 sqlite3_free(zQuote);
20915 }
20916 if( strcmp(zOp,"memo")==0 ){
20917 utf8_printf(p->out, "%s\n", zSql);
20918 }else
20919 if( strcmp(zOp,"run")==0 ){
@@ -21027,10 +21077,11 @@
21027 initText(&sSql);
21028 appendText(&sSql, "WITH [sha3sum$query](a,b) AS(",0);
21029 zSep = "VALUES(";
21030 while( SQLITE_ROW==sqlite3_step(pStmt) ){
21031 const char *zTab = (const char*)sqlite3_column_text(pStmt,0);
 
21032 if( zLike && sqlite3_strlike(zLike, zTab, 0)!=0 ) continue;
21033 if( strncmp(zTab, "sqlite_",7)!=0 ){
21034 appendText(&sQuery,"SELECT * FROM ", 0);
21035 appendText(&sQuery,zTab,'"');
21036 appendText(&sQuery," NOT INDEXED;", 0);
@@ -21067,10 +21118,11 @@
21067 "%s))"
21068 " SELECT lower(hex(sha3_query(group_concat(a,''),%d))) AS hash"
21069 " FROM [sha3sum$query]",
21070 sSql.z, iSize);
21071 }
 
21072 freeText(&sQuery);
21073 freeText(&sSql);
21074 if( bDebug ){
21075 utf8_printf(p->out, "%s\n", zSql);
21076 }else{
@@ -21090,15 +21142,15 @@
21090 raw_printf(stderr, "Usage: .system COMMAND\n");
21091 rc = 1;
21092 goto meta_command_exit;
21093 }
21094 zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
21095 for(i=2; i<nArg; i++){
21096 zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
21097 zCmd, azArg[i]);
21098 }
21099 x = system(zCmd);
21100 sqlite3_free(zCmd);
21101 if( x ) raw_printf(stderr, "System command returns %d\n", x);
21102 }else
21103 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
21104
@@ -21230,16 +21282,16 @@
21230 while( sqlite3_step(pStmt)==SQLITE_ROW ){
21231 if( nRow>=nAlloc ){
21232 char **azNew;
21233 int n2 = nAlloc*2 + 10;
21234 azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
21235 if( azNew==0 ) shell_out_of_memory();
21236 nAlloc = n2;
21237 azResult = azNew;
21238 }
21239 azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
21240 if( 0==azResult[nRow] ) shell_out_of_memory();
21241 nRow++;
21242 }
21243 if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
21244 rc = shellDatabaseError(p->db);
21245 }
@@ -22004,11 +22056,11 @@
22004 nLine = strlen30(zLine);
22005 if( nSql+nLine+2>=nAlloc ){
22006 /* Grow buffer by half-again increments when big. */
22007 nAlloc = nSql+(nSql>>1)+nLine+100;
22008 zSql = realloc(zSql, nAlloc);
22009 if( zSql==0 ) shell_out_of_memory();
22010 }
22011 if( nSql==0 ){
22012 int i;
22013 for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
22014 assert( nAlloc>0 && zSql!=0 );
@@ -22136,10 +22188,11 @@
22136 raw_printf(stderr, "-- warning: cannot find home directory;"
22137 " cannot read ~/.sqliterc\n");
22138 return;
22139 }
22140 zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
 
22141 sqliterc = zBuf;
22142 }
22143 p->in = fopen(sqliterc,"rb");
22144 if( p->in ){
22145 if( stdin_is_interactive ){
@@ -22334,14 +22387,10 @@
22334 setBinaryMode(stdin, 0);
22335 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
22336 stdin_is_interactive = isatty(0);
22337 stdout_is_console = isatty(1);
22338
22339 #ifdef SQLITE_DEBUG
22340 registerOomSimulator();
22341 #endif
22342
22343 #if !defined(_WIN32_WCE)
22344 if( getenv("SQLITE_DEBUG_BREAK") ){
22345 if( isatty(0) && isatty(2) ){
22346 fprintf(stderr,
22347 "attach debugger to process %d and press any key to continue.\n",
@@ -22377,20 +22426,20 @@
22377 ** memory that does not come from the SQLite memory allocator.
22378 */
22379 #if !SQLITE_SHELL_IS_UTF8
22380 sqlite3_initialize();
22381 argvToFree = malloc(sizeof(argv[0])*argc*2);
 
22382 argcToFree = argc;
22383 argv = argvToFree + argc;
22384 if( argv==0 ) shell_out_of_memory();
22385 for(i=0; i<argc; i++){
22386 char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
22387 int n;
22388 if( z==0 ) shell_out_of_memory();
22389 n = (int)strlen(z);
22390 argv[i] = malloc( n+1 );
22391 if( argv[i]==0 ) shell_out_of_memory();
22392 memcpy(argv[i], z, n+1);
22393 argvToFree[i] = argv[i];
22394 sqlite3_free(z);
22395 }
22396 sqlite3_shutdown();
@@ -22436,11 +22485,11 @@
22436 /* Excesss arguments are interpreted as SQL (or dot-commands) and
22437 ** mean that nothing is read from stdin */
22438 readStdin = 0;
22439 nCmd++;
22440 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
22441 if( azCmd==0 ) shell_out_of_memory();
22442 azCmd[nCmd-1] = z;
22443 }
22444 }
22445 if( z[1]=='-' ) z++;
22446 if( strcmp(z,"-separator")==0
22447
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -443,19 +443,10 @@
443 /*
444 ** True if an interrupt (Control-C) has been received.
445 */
446 static volatile int seenInterrupt = 0;
447
 
 
 
 
 
 
 
 
 
448 /*
449 ** This is the name of our program. It is set in main(), used
450 ** in a number of other places, mostly for error messages.
451 */
452 static char *Argv0;
@@ -503,52 +494,16 @@
494 static void shell_out_of_memory(void){
495 raw_printf(stderr,"Error: out of memory\n");
496 exit(1);
497 }
498
499 /* Check a pointer to see if it is NULL. If it is NULL, exit with an
500 ** out-of-memory error.
501 */
502 static void shell_check_oom(void *p){
503 if( p==0 ) shell_out_of_memory();
504 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
506 /*
507 ** Write I/O traces to the following stream.
508 */
509 #ifdef SQLITE_ENABLE_IOTRACE
@@ -701,11 +656,11 @@
656
657 while( 1 ){
658 if( n+100>nLine ){
659 nLine = nLine*2 + 100;
660 zLine = realloc(zLine, nLine);
661 shell_check_oom(zLine);
662 }
663 if( fgets(&zLine[n], nLine - n, in)==0 ){
664 if( n==0 ){
665 free(zLine);
666 return 0;
@@ -728,11 +683,11 @@
683 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
684 if( zTrans ){
685 int nTrans = strlen30(zTrans)+1;
686 if( nTrans>nLine ){
687 zLine = realloc(zLine, nTrans);
688 shell_check_oom(zLine);
689 }
690 memcpy(zLine, zTrans, nTrans);
691 sqlite3_free(zTrans);
692 }
693 }
@@ -875,11 +830,11 @@
830 }
831
832 if( p->z==0 || p->n+len>=p->nAlloc ){
833 p->nAlloc = p->nAlloc*2 + len + 20;
834 p->z = realloc(p->z, p->nAlloc);
835 shell_check_oom(p->z);
836 }
837
838 if( quote ){
839 char *zCsr = p->z+p->n;
840 *zCsr++ = quote;
@@ -930,10 +885,11 @@
885 char *zDiv = "(";
886 int nRow = 0;
887
888 zSql = sqlite3_mprintf("PRAGMA \"%w\".table_info=%Q;",
889 zSchema ? zSchema : "main", zName);
890 shell_check_oom(zSql);
891 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
892 sqlite3_free(zSql);
893 initText(&s);
894 if( zSchema ){
895 cQuote = quoteChar(zSchema);
@@ -946,10 +902,11 @@
902 while( sqlite3_step(pStmt)==SQLITE_ROW ){
903 const char *zCol = (const char*)sqlite3_column_text(pStmt, 1);
904 nRow++;
905 appendText(&s, zDiv, 0);
906 zDiv = ",";
907 if( zCol==0 ) zCol = "";
908 cQuote = quoteChar(zCol);
909 appendText(&s, zCol, cQuote);
910 }
911 appendText(&s, ")", 0);
912 sqlite3_finalize(pStmt);
@@ -969,13 +926,15 @@
926 static void shellModuleSchema(
927 sqlite3_context *pCtx,
928 int nVal,
929 sqlite3_value **apVal
930 ){
931 const char *zName;
932 char *zFake;
933 UNUSED_PARAMETER(nVal);
934 zName = (const char*)sqlite3_value_text(apVal[0]);
935 zFake = zName ? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
936 if( zFake ){
937 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
938 -1, sqlite3_free);
939 free(zFake);
940 }
@@ -1859,10 +1818,11 @@
1818 SHA3Context *p,
1819 const unsigned char *aData,
1820 unsigned int nData
1821 ){
1822 unsigned int i = 0;
1823 if( aData==0 ) return;
1824 #if SHA3_BYTEORDER==1234
1825 if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
1826 for(; i+7<nData; i+=8){
1827 p->u.s[p->nLoaded/8] ^= *(u64*)&aData[i];
1828 p->nLoaded += 8;
@@ -2517,14 +2477,15 @@
2477 const char *zFile, /* File to write */
2478 sqlite3_value *pData, /* Data to write */
2479 mode_t mode, /* MODE parameter passed to writefile() */
2480 sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
2481 ){
2482 if( zFile==0 ) return 1;
2483 #if !defined(_WIN32) && !defined(WIN32)
2484 if( S_ISLNK(mode) ){
2485 const char *zTo = (const char*)sqlite3_value_text(pData);
2486 if( zTo==0 || symlink(zTo, zFile)<0 ) return 1;
2487 }else
2488 #endif
2489 {
2490 if( S_ISDIR(mode) ){
2491 if( mkdir(zFile, mode) ){
@@ -5886,11 +5847,11 @@
5847 if( (idxNum & 3)==3 ){
5848 /* Both start= and stop= boundaries are available. This is the
5849 ** the preferred case */
5850 pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5851 pIdxInfo->estimatedRows = 1000;
5852 if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){
5853 if( pIdxInfo->aOrderBy[0].desc ){
5854 idxNum |= 8;
5855 }else{
5856 idxNum |= 16;
5857 }
@@ -6721,17 +6682,19 @@
6682 const sqlite3_api_routines *pApi
6683 ){
6684 int rc = SQLITE_OK;
6685 SQLITE_EXTENSION_INIT2(pApi);
6686 (void)pzErrMsg; /* Unused */
6687 rc = sqlite3_create_function(db, "regexp", 2,
6688 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
6689 0, re_sql_func, 0, 0);
6690 if( rc==SQLITE_OK ){
6691 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
6692 ** of regexp(PATTERN,STRING). */
6693 rc = sqlite3_create_function(db, "regexpi", 2,
6694 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
6695 (void*)db, re_sql_func, 0, 0);
6696 }
6697 return rc;
6698 }
6699
6700 /************************* End ../ext/misc/regexp.c ********************/
@@ -9939,21 +9902,29 @@
9902 IdxTable **ppOut, /* OUT: New object (if successful) */
9903 char **pzErrmsg /* OUT: Error message (if not) */
9904 ){
9905 sqlite3_stmt *p1 = 0;
9906 int nCol = 0;
9907 int nTab;
9908 int nByte;
9909 IdxTable *pNew = 0;
9910 int rc, rc2;
9911 char *pCsr = 0;
9912 int nPk = 0;
9913
9914 *ppOut = 0;
9915 if( zTab==0 ) return SQLITE_ERROR;
9916 nTab = STRLEN(zTab);
9917 nByte = sizeof(IdxTable) + nTab + 1;
9918 rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
9919 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
9920 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
9921 const char *zColSeq = 0;
9922 if( zCol==0 ){
9923 rc = SQLITE_ERROR;
9924 break;
9925 }
9926 nByte += 1 + STRLEN(zCol);
9927 rc = sqlite3_table_column_metadata(
9928 db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
9929 );
9930 if( zColSeq==0 ) zColSeq = "binary";
@@ -9976,11 +9947,13 @@
9947
9948 nCol = 0;
9949 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
9950 const char *zCol = (const char*)sqlite3_column_text(p1, 1);
9951 const char *zColSeq = 0;
9952 int nCopy;
9953 if( zCol==0 ) continue;
9954 nCopy = STRLEN(zCol) + 1;
9955 pNew->aCol[nCol].zName = pCsr;
9956 pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
9957 memcpy(pCsr, zCol, nCopy);
9958 pCsr += nCopy;
9959
@@ -10128,10 +10101,11 @@
10101 while( rc==SQLITE_OK && sqlite3_step(pIdxList)==SQLITE_ROW ){
10102 int bMatch = 1;
10103 IdxConstraint *pT = pTail;
10104 sqlite3_stmt *pInfo = 0;
10105 const char *zIdx = (const char*)sqlite3_column_text(pIdxList, 1);
10106 if( zIdx==0 ) continue;
10107
10108 /* Zero the IdxConstraint.bFlag values in the pEq list */
10109 for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0;
10110
10111 rc = idxPrintfPrepareStmt(dbm, &pInfo, 0, "PRAGMA index_xInfo=%Q", zIdx);
@@ -10539,10 +10513,11 @@
10513
10514 /* Create the table and its triggers in the temp schema */
10515 rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab);
10516 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSelect) ){
10517 const char *zCreate = (const char*)sqlite3_column_text(pSelect, 0);
10518 if( zCreate==0 ) continue;
10519 rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr);
10520 }
10521 idxFinalize(&rc, pSelect);
10522
10523 /* Rename the table in the temp schema to zInt */
@@ -10641,12 +10616,13 @@
10616 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){
10617 const char *zType = (const char*)sqlite3_column_text(pSchema, 0);
10618 const char *zName = (const char*)sqlite3_column_text(pSchema, 1);
10619 const char *zSql = (const char*)sqlite3_column_text(pSchema, 2);
10620
10621 if( zType==0 || zName==0 ) continue;
10622 if( zType[0]=='v' || zType[1]=='r' ){
10623 if( zSql ) rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
10624 }else{
10625 IdxTable *pTab;
10626 rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg);
10627 if( rc==SQLITE_OK ){
10628 int i;
@@ -10779,10 +10755,11 @@
10755 break;
10756
10757 case SQLITE_BLOB:
10758 case SQLITE_TEXT: {
10759 int nByte = sqlite3_value_bytes(argv[1]);
10760 const void *pData = 0;
10761 if( nByte>pSlot->nByte ){
10762 char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
10763 if( zNew==0 ){
10764 sqlite3_result_error_nomem(pCtx);
10765 return;
@@ -10790,13 +10767,15 @@
10767 pSlot->nByte = nByte*2;
10768 pSlot->z = zNew;
10769 }
10770 pSlot->n = nByte;
10771 if( pSlot->eType==SQLITE_BLOB ){
10772 pData = sqlite3_value_blob(argv[1]);
10773 if( pData ) memcpy(pSlot->z, pData, nByte);
10774 }else{
10775 pData = sqlite3_value_text(argv[1]);
10776 memcpy(pSlot->z, pData, nByte);
10777 }
10778 break;
10779 }
10780 }
10781 }
@@ -11003,10 +10982,11 @@
10982
10983 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pAllIndex) ){
10984 i64 iRowid = sqlite3_column_int64(pAllIndex, 0);
10985 const char *zTab = (const char*)sqlite3_column_text(pAllIndex, 1);
10986 const char *zIdx = (const char*)sqlite3_column_text(pAllIndex, 2);
10987 if( zTab==0 || zIdx==0 ) continue;
10988 if( p->iSample<100 && iPrev!=iRowid ){
10989 samplectx.target = (double)p->iSample / 100.0;
10990 samplectx.iTarget = p->iSample;
10991 samplectx.nRow = 0.0;
10992 samplectx.nRet = 0.0;
@@ -11069,18 +11049,18 @@
11049 }
11050
11051
11052 /* Copy the entire schema of database [db] into [dbm]. */
11053 if( rc==SQLITE_OK ){
11054 sqlite3_stmt *pSql = 0;
11055 rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
11056 "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'"
11057 " AND sql NOT LIKE 'CREATE VIRTUAL %%'"
11058 );
11059 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
11060 const char *zSql = (const char*)sqlite3_column_text(pSql, 0);
11061 if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
11062 }
11063 idxFinalize(&rc, pSql);
11064 }
11065
11066 /* Create the vtab schema */
@@ -12831,10 +12811,11 @@
12811 break;
12812 }
12813 }
12814 if( i==0 || strstr(z, p->colSeparator)!=0 ){
12815 char *zQuoted = sqlite3_mprintf("\"%w\"", z);
12816 shell_check_oom(zQuoted);
12817 utf8_printf(out, "%s", zQuoted);
12818 sqlite3_free(zQuoted);
12819 }else{
12820 utf8_printf(out, "%s", z);
12821 }
@@ -13005,11 +12986,11 @@
12986 int nText = strlen30(zText);
12987 if( p->autoEQPtest ){
12988 utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText);
12989 }
12990 pNew = sqlite3_malloc64( sizeof(*pNew) + nText );
12991 shell_check_oom(pNew);
12992 pNew->iEqpId = iEqpId;
12993 pNew->iParentId = p2;
12994 memcpy(pNew->zText, zText, nText+1);
12995 pNew->pNext = 0;
12996 if( p->sGraph.pLast ){
@@ -13226,10 +13207,11 @@
13207 ){
13208 utf8_printf(p->out, "%s;\n", azArg[0]);
13209 break;
13210 }
13211 z = sqlite3_mprintf("%s", azArg[0]);
13212 shell_check_oom(z);
13213 j = 0;
13214 for(i=0; IsSpace(z[i]); i++){}
13215 for(; (c = z[i])!=0; i++){
13216 if( IsSpace(c) ){
13217 if( z[j-1]=='\r' ) z[j-1] = '\n';
@@ -13357,10 +13339,11 @@
13339 raw_printf(p->out,"(");
13340 for(i=0; i<nArg; i++){
13341 if( i>0 ) raw_printf(p->out, ",");
13342 if( quoteChar(azCol[i]) ){
13343 char *z = sqlite3_mprintf("\"%w\"", azCol[i]);
13344 shell_check_oom(z);
13345 utf8_printf(p->out, "%s", z);
13346 sqlite3_free(z);
13347 }else{
13348 raw_printf(p->out, "%s", azCol[i]);
13349 }
@@ -13602,20 +13585,61 @@
13585 if( zName==0 ) return;
13586 cQuote = quoteChar(zName);
13587 n = strlen30(zName);
13588 if( cQuote ) n += n+2;
13589 z = p->zDestTable = malloc( n+1 );
13590 shell_check_oom(z);
13591 n = 0;
13592 if( cQuote ) z[n++] = cQuote;
13593 for(i=0; zName[i]; i++){
13594 z[n++] = zName[i];
13595 if( zName[i]==cQuote ) z[n++] = cQuote;
13596 }
13597 if( cQuote ) z[n++] = cQuote;
13598 z[n] = 0;
13599 }
13600
13601 /*
13602 ** Maybe construct two lines of text that point out the position of a
13603 ** syntax error. Return a pointer to the text, in memory obtained from
13604 ** sqlite3_malloc(). Or, if the most recent error does not involve a
13605 ** specific token that we can point to, return an empty string.
13606 **
13607 ** In all cases, the memory returned is obtained from sqlite3_malloc64()
13608 ** and should be released by the caller invoking sqlite3_free().
13609 */
13610 static char *shell_error_context(const char *zSql, sqlite3 *db){
13611 int iOffset;
13612 size_t len;
13613 char *zCode;
13614 char *zMsg;
13615 int i;
13616 if( db==0
13617 || zSql==0
13618 || (iOffset = sqlite3_error_offset(db))<0
13619 ){
13620 return sqlite3_mprintf("");
13621 }
13622 while( iOffset>50 ){
13623 iOffset--;
13624 zSql++;
13625 while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
13626 }
13627 len = strlen(zSql);
13628 if( len>78 ){
13629 len = 78;
13630 while( (zSql[len]&0xc0)==0x80 ) len--;
13631 }
13632 zCode = sqlite3_mprintf("%.*s", len, zSql);
13633 for(i=0; zCode[i]; i++){ if( IsSpace(zSql[i]) ) zCode[i] = ' '; }
13634 if( iOffset<25 ){
13635 zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode, iOffset, "");
13636 }else{
13637 zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode, iOffset-14, "");
13638 }
13639 return zMsg;
13640 }
13641
13642
13643 /*
13644 ** Execute a query statement that will generate SQL output. Print
13645 ** the result columns, comma-separated, on a line and then add a
@@ -13635,12 +13659,14 @@
13659 int nResult;
13660 int i;
13661 const char *z;
13662 rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
13663 if( rc!=SQLITE_OK || !pSelect ){
13664 char *zContext = shell_error_context(zSelect, p->db);
13665 utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n%s", rc,
13666 sqlite3_errmsg(p->db), zContext);
13667 sqlite3_free(zContext);
13668 if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
13669 return rc;
13670 }
13671 rc = sqlite3_step(pSelect);
13672 nResult = sqlite3_column_count(pSelect);
@@ -13672,15 +13698,21 @@
13698 ** Allocate space and save off string indicating current error.
13699 */
13700 static char *save_err_msg(
13701 sqlite3 *db, /* Database to query */
13702 const char *zWhen, /* Qualifier (format) wrapper */
13703 int rc, /* Error code returned from API */
13704 const char *zSql /* SQL string, or NULL */
13705 ){
13706 char *zErr;
13707 char *zContext;
13708 if( zWhen==0 ) zWhen = "%s (%d)%s";
13709 zContext = shell_error_context(zSql, db);
13710 zErr = sqlite3_mprintf(zWhen, sqlite3_errmsg(db), rc, zContext);
13711 shell_check_oom(zErr);
13712 sqlite3_free(zContext);
13713 return zErr;
13714 }
13715
13716 #ifdef __linux__
13717 /*
13718 ** Attempt to display I/O stats on Linux using /proc/PID/io
@@ -14024,13 +14056,13 @@
14056 }
14057 }
14058 }
14059 nAlloc += 100;
14060 p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
14061 shell_check_oom(p->aiIndent);
14062 abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
14063 shell_check_oom(abYield);
14064 }
14065 abYield[iOp] = str_in_array(zOp, azYield);
14066 p->aiIndent[iOp] = 0;
14067 p->nIndent = iOp+1;
14068
@@ -14235,29 +14267,29 @@
14267 if( rc!=SQLITE_ROW ) return;
14268 nColumn = sqlite3_column_count(pStmt);
14269 nAlloc = nColumn*4;
14270 if( nAlloc<=0 ) nAlloc = 1;
14271 azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
14272 shell_check_oom(azData);
14273 for(i=0; i<nColumn; i++){
14274 azData[i] = strdup(sqlite3_column_name(pStmt,i));
14275 }
14276 do{
14277 if( (nRow+2)*nColumn >= nAlloc ){
14278 nAlloc *= 2;
14279 azData = sqlite3_realloc64(azData, nAlloc*sizeof(char*));
14280 shell_check_oom(azData);
14281 }
14282 nRow++;
14283 for(i=0; i<nColumn; i++){
14284 z = (const char*)sqlite3_column_text(pStmt,i);
14285 azData[nRow*nColumn + i] = z ? strdup(z) : 0;
14286 }
14287 }while( sqlite3_step(pStmt)==SQLITE_ROW );
14288 if( nColumn>p->nWidth ){
14289 p->colWidth = realloc(p->colWidth, (nColumn+1)*2*sizeof(int));
14290 shell_check_oom(p->colWidth);
14291 for(i=p->nWidth; i<nColumn; i++) p->colWidth[i] = 0;
14292 p->nWidth = nColumn;
14293 p->actualWidth = &p->colWidth[nColumn];
14294 }
14295 memset(p->actualWidth, 0, nColumn*sizeof(int));
@@ -14411,11 +14443,14 @@
14443 do{
14444 nRow++;
14445 /* extract the data and data types */
14446 for(i=0; i<nCol; i++){
14447 aiTypes[i] = x = sqlite3_column_type(pStmt, i);
14448 if( x==SQLITE_BLOB
14449 && pArg
14450 && (pArg->cMode==MODE_Insert || pArg->cMode==MODE_Quote)
14451 ){
14452 azVals[i] = "";
14453 }else{
14454 azVals[i] = (char*)sqlite3_column_text(pStmt, i);
14455 }
14456 if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
@@ -14436,11 +14471,14 @@
14471 } while( SQLITE_ROW == rc );
14472 sqlite3_free(pData);
14473 if( pArg->cMode==MODE_Json ){
14474 fputs("]\n", pArg->out);
14475 }else if( pArg->cMode==MODE_Count ){
14476 char zBuf[200];
14477 sqlite3_snprintf(sizeof(zBuf), zBuf, "%llu row%s\n",
14478 nRow, nRow!=1 ? "s" : "");
14479 printf("%s", zBuf);
14480 }
14481 }
14482 }
14483 }
14484
@@ -14560,18 +14598,19 @@
14598 }
14599
14600 if( rc==SQLITE_OK ){
14601 pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
14602 if( pState->expert.pExpert==0 ){
14603 raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr ? zErr : "out of memory");
14604 rc = SQLITE_ERROR;
14605 }else{
14606 sqlite3_expert_config(
14607 pState->expert.pExpert, EXPERT_CONFIG_SAMPLE, iSample
14608 );
14609 }
14610 }
14611 sqlite3_free(zErr);
14612
14613 return rc;
14614 }
14615 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
14616
@@ -14609,11 +14648,11 @@
14648 while( zSql[0] && (SQLITE_OK == rc) ){
14649 static const char *zStmtSql;
14650 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
14651 if( SQLITE_OK != rc ){
14652 if( pzErrMsg ){
14653 *pzErrMsg = save_err_msg(db, "in prepare, %s (%d)%s", rc, zSql);
14654 }
14655 }else{
14656 if( !pStmt ){
14657 /* this happens for a comment or white-space */
14658 zSql = zLeftover;
@@ -14644,10 +14683,11 @@
14683 sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP);
14684 if( pArg->autoEQP>=AUTOEQP_trigger ){
14685 sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0);
14686 }
14687 zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
14688 shell_check_oom(zEQP);
14689 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
14690 if( rc==SQLITE_OK ){
14691 while( sqlite3_step(pExplain)==SQLITE_ROW ){
14692 const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3);
14693 int iEqpId = sqlite3_column_int(pExplain, 0);
@@ -14661,10 +14701,11 @@
14701 sqlite3_finalize(pExplain);
14702 sqlite3_free(zEQP);
14703 if( pArg->autoEQP>=AUTOEQP_full ){
14704 /* Also do an EXPLAIN for ".eqp full" mode */
14705 zEQP = sqlite3_mprintf("EXPLAIN %s", zStmtSql);
14706 shell_check_oom(zEQP);
14707 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
14708 if( rc==SQLITE_OK ){
14709 pArg->cMode = MODE_Explain;
14710 explain_data_prepare(pArg, pExplain);
14711 exec_prepared_stmt(pArg, pExplain);
@@ -14723,11 +14764,11 @@
14764 if( rc!=SQLITE_NOMEM ) rc = rc2;
14765 if( rc==SQLITE_OK ){
14766 zSql = zLeftover;
14767 while( IsSpace(zSql[0]) ) zSql++;
14768 }else if( pzErrMsg ){
14769 *pzErrMsg = save_err_msg(db, "stepping, %s (%d)", rc, 0);
14770 }
14771
14772 /* clear saved stmt handle */
14773 if( pArg ){
14774 pArg->pStmt = NULL;
@@ -14773,20 +14814,22 @@
14814 int isIPK = 0; /* True if one PRIMARY KEY column of type INTEGER */
14815 int preserveRowid = ShellHasFlag(p, SHFLG_PreserveRowid);
14816 int rc;
14817
14818 zSql = sqlite3_mprintf("PRAGMA table_info=%Q", zTab);
14819 shell_check_oom(zSql);
14820 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
14821 sqlite3_free(zSql);
14822 if( rc ) return 0;
14823 while( sqlite3_step(pStmt)==SQLITE_ROW ){
14824 if( nCol>=nAlloc-2 ){
14825 nAlloc = nAlloc*2 + nCol + 10;
14826 azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0]));
14827 shell_check_oom(azCol);
14828 }
14829 azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
14830 shell_check_oom(azCol[nCol]);
14831 if( sqlite3_column_int(pStmt, 5) ){
14832 nPK++;
14833 if( nPK==1
14834 && sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
14835 "INTEGER")==0
@@ -14816,10 +14859,11 @@
14859 ** there is a "pk" entry in "PRAGMA index_list". There will be
14860 ** no "pk" index if the PRIMARY KEY really is an alias for the ROWID.
14861 */
14862 zSql = sqlite3_mprintf("SELECT 1 FROM pragma_index_list(%Q)"
14863 " WHERE origin='pk'", zTab);
14864 shell_check_oom(zSql);
14865 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
14866 sqlite3_free(zSql);
14867 if( rc ){
14868 freeColumnList(azCol);
14869 return 0;
@@ -14907,10 +14951,11 @@
14951 }
14952 zIns = sqlite3_mprintf(
14953 "INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)"
14954 "VALUES('table','%q','%q',0,'%q');",
14955 zTable, zTable, zSql);
14956 shell_check_oom(zIns);
14957 utf8_printf(p->out, "%s\n", zIns);
14958 sqlite3_free(zIns);
14959 return 0;
14960 }else{
14961 printSchemaLine(p->out, zSql, ";\n");
@@ -15150,13 +15195,10 @@
15195 ".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
15196 " If FILE begins with '|' then open as a pipe",
15197 " --bom Put a UTF8 byte-order mark at the beginning",
15198 " -e Send output to the system text editor",
15199 " -x Send output as CSV to a spreadsheet (same as \".excel\")",
 
 
 
15200 ".open ?OPTIONS? ?FILE? Close existing database and reopen FILE",
15201 " Options:",
15202 " --append Use appendvfs to append database to the end of FILE",
15203 #ifndef SQLITE_OMIT_DESERIALIZE
15204 " --deserialize Load into memory using sqlite3_deserialize()",
@@ -15188,11 +15230,12 @@
15230 " --quiet|-q No output except at interrupts",
15231 " --reset Reset the count for each input and interrupt",
15232 #endif
15233 ".prompt MAIN CONTINUE Replace the standard prompts",
15234 ".quit Exit this program",
15235 ".read FILE Read input from FILE or command output",
15236 " If FILE begins with \"|\", it is a command that generates the input.",
15237 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
15238 ".recover Recover as much data as possible from corrupt db.",
15239 " --freelist-corrupt Assume the freelist is corrupt",
15240 " --recovery-db NAME Store recovery metadata in database file NAME",
15241 " --lost-and-found TABLE Alternative name for the lost-and-found table",
@@ -15308,10 +15351,11 @@
15351 }
15352 }
15353 }else{
15354 /* Look for commands that for which zPattern is an exact prefix */
15355 zPat = sqlite3_mprintf(".%s*", zPattern);
15356 shell_check_oom(zPat);
15357 for(i=0; i<ArraySize(azHelp); i++){
15358 if( sqlite3_strglob(zPat, azHelp[i])==0 ){
15359 utf8_printf(out, "%s\n", azHelp[i]);
15360 j = i+1;
15361 n++;
@@ -15330,10 +15374,11 @@
15374 return n;
15375 }
15376 /* Look for commands that contain zPattern anywhere. Show the complete
15377 ** text of all commands that match. */
15378 zPat = sqlite3_mprintf("%%%s%%", zPattern);
15379 shell_check_oom(zPat);
15380 for(i=0; i<ArraySize(azHelp); i++){
15381 if( azHelp[i][0]=='.' ) j = i;
15382 if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
15383 utf8_printf(out, "%s\n", azHelp[j]);
15384 while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
@@ -15518,14 +15563,11 @@
15563 if( rc!=2 ) goto readHexDb_error;
15564 if( n<0 ) goto readHexDb_error;
15565 if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error;
15566 n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */
15567 a = sqlite3_malloc( n ? n : 1 );
15568 shell_check_oom(a);
 
 
 
15569 memset(a, 0, n);
15570 if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){
15571 utf8_printf(stderr, "invalid pagesize\n");
15572 goto readHexDb_error;
15573 }
@@ -15652,11 +15694,11 @@
15694 int argc,
15695 sqlite3_value **argv
15696 ){
15697 const char *zText = (const char*)sqlite3_value_text(argv[0]);
15698 UNUSED_PARAMETER(argc);
15699 if( zText && zText[0]=='\'' ){
15700 int nText = sqlite3_value_bytes(argv[0]);
15701 int i;
15702 char zBuf1[20];
15703 char zBuf2[20];
15704 const char *zNL = 0;
@@ -15829,10 +15871,11 @@
15871 editFunc, 0, 0);
15872 #endif
15873 if( p->openMode==SHELL_OPEN_ZIPFILE ){
15874 char *zSql = sqlite3_mprintf(
15875 "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
15876 shell_check_oom(zSql);
15877 sqlite3_exec(p->db, zSql, 0, 0, 0);
15878 sqlite3_free(zSql);
15879 }
15880 #ifndef SQLITE_OMIT_DESERIALIZE
15881 else
@@ -15886,15 +15929,17 @@
15929 if( state==0 ){
15930 char *zSql;
15931 sqlite3_finalize(pStmt);
15932 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
15933 " FROM completion(%Q) ORDER BY 1", text);
15934 shell_check_oom(zSql);
15935 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
15936 sqlite3_free(zSql);
15937 }
15938 if( sqlite3_step(pStmt)==SQLITE_ROW ){
15939 const char *z = (const char*)sqlite3_column_text(pStmt,0);
15940 zRet = z ? strdup(z) : 0;
15941 }else{
15942 sqlite3_finalize(pStmt);
15943 pStmt = 0;
15944 zRet = 0;
15945 }
@@ -15923,17 +15968,18 @@
15968 iStart = i+1;
15969 memcpy(zBuf, zLine, iStart);
15970 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
15971 " FROM completion(%Q,%Q) ORDER BY 1",
15972 &zLine[iStart], zLine);
15973 shell_check_oom(zSql);
15974 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
15975 sqlite3_free(zSql);
15976 sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
15977 while( sqlite3_step(pStmt)==SQLITE_ROW ){
15978 const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
15979 int nCompletion = sqlite3_column_bytes(pStmt, 0);
15980 if( iStart+nCompletion < sizeof(zBuf)-1 && zCompletion ){
15981 memcpy(zBuf+iStart, zCompletion, nCompletion+1);
15982 linenoiseAddCompletion(lc, zBuf);
15983 }
15984 }
15985 sqlite3_finalize(pStmt);
@@ -16164,11 +16210,11 @@
16210 /* Append a single byte to z[] */
16211 static void import_append_char(ImportCtx *p, int c){
16212 if( p->n+1>=p->nAlloc ){
16213 p->nAlloc += p->nAlloc + 100;
16214 p->z = sqlite3_realloc64(p->z, p->nAlloc);
16215 shell_check_oom(p->z);
16216 }
16217 p->z[p->n++] = (char)c;
16218 }
16219
16220 /* Read a single field of CSV text. Compatible with rfc4180 and extended
@@ -16316,20 +16362,21 @@
16362 int k = 0;
16363 int cnt = 0;
16364 const int spinRate = 10000;
16365
16366 zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
16367 shell_check_oom(zQuery);
16368 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16369 if( rc ){
16370 utf8_printf(stderr, "Error %d: %s on [%s]\n",
16371 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16372 zQuery);
16373 goto end_data_xfer;
16374 }
16375 n = sqlite3_column_count(pQuery);
16376 zInsert = sqlite3_malloc64(200 + nTable + n*3);
16377 shell_check_oom(zInsert);
16378 sqlite3_snprintf(200+nTable,zInsert,
16379 "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
16380 i = strlen30(zInsert);
16381 for(j=1; j<n; j++){
16382 memcpy(zInsert+i, ",?", 2);
@@ -16388,10 +16435,11 @@
16435 if( rc==SQLITE_DONE ) break;
16436 sqlite3_finalize(pQuery);
16437 sqlite3_free(zQuery);
16438 zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
16439 zTable);
16440 shell_check_oom(zQuery);
16441 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16442 if( rc ){
16443 utf8_printf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
16444 break;
16445 }
@@ -16424,10 +16472,11 @@
16472 const unsigned char *zSql;
16473 char *zErrMsg = 0;
16474
16475 zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
16476 " WHERE %s", zWhere);
16477 shell_check_oom(zQuery);
16478 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16479 if( rc ){
16480 utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
16481 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16482 zQuery);
@@ -16434,10 +16483,11 @@
16483 goto end_schema_xfer;
16484 }
16485 while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
16486 zName = sqlite3_column_text(pQuery, 0);
16487 zSql = sqlite3_column_text(pQuery, 1);
16488 if( zName==0 || zSql==0 ) continue;
16489 printf("%s... ", zName); fflush(stdout);
16490 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
16491 if( zErrMsg ){
16492 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
16493 sqlite3_free(zErrMsg);
@@ -16451,10 +16501,11 @@
16501 if( rc!=SQLITE_DONE ){
16502 sqlite3_finalize(pQuery);
16503 sqlite3_free(zQuery);
16504 zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_schema"
16505 " WHERE %s ORDER BY rowid DESC", zWhere);
16506 shell_check_oom(zQuery);
16507 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
16508 if( rc ){
16509 utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
16510 sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
16511 zQuery);
@@ -16461,10 +16512,11 @@
16512 goto end_schema_xfer;
16513 }
16514 while( sqlite3_step(pQuery)==SQLITE_ROW ){
16515 zName = sqlite3_column_text(pQuery, 0);
16516 zSql = sqlite3_column_text(pQuery, 1);
16517 if( zName==0 || zSql==0 ) continue;
16518 printf("%s... ", zName); fflush(stdout);
16519 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
16520 if( zErrMsg ){
16521 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
16522 sqlite3_free(zErrMsg);
@@ -16845,13 +16897,11 @@
16897 }
16898 p->zTempFile = sqlite3_mprintf("%s/temp%llx.%s", zTemp, r, zSuffix);
16899 }else{
16900 p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
16901 }
16902 shell_check_oom(p->zTempFile);
 
 
16903 }
16904
16905
16906 /*
16907 ** The implementation of SQL scalar function fkey_collate_clause(), used
@@ -17028,18 +17078,18 @@
17078 const char *zFrom = (const char*)sqlite3_column_text(pSql, 2);
17079 const char *zTarget = (const char*)sqlite3_column_text(pSql, 3);
17080 const char *zCI = (const char*)sqlite3_column_text(pSql, 4);
17081 const char *zParent = (const char*)sqlite3_column_text(pSql, 5);
17082
17083 if( zEQP==0 ) continue;
17084 if( zGlob==0 ) continue;
17085 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
17086 if( rc!=SQLITE_OK ) break;
17087 if( SQLITE_ROW==sqlite3_step(pExplain) ){
17088 const char *zPlan = (const char*)sqlite3_column_text(pExplain, 3);
17089 res = zPlan!=0 && ( 0==sqlite3_strglob(zGlob, zPlan)
17090 || 0==sqlite3_strglob(zGlobIPK, zPlan));
 
 
17091 }
17092 rc = sqlite3_finalize(pExplain);
17093 if( rc!=SQLITE_OK ) break;
17094
17095 if( res<0 ){
@@ -18140,10 +18190,11 @@
18190 , zName, zName
18191 );
18192 if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPkFinder) ){
18193 pTab->iPk = sqlite3_column_int(pPkFinder, 0);
18194 zPk = (const char*)sqlite3_column_text(pPkFinder, 1);
18195 if( zPk==0 ){ zPk = "_"; /* Defensive. Should never happen */ }
18196 }
18197 }
18198
18199 pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName);
18200 pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1));
@@ -18224,12 +18275,14 @@
18275 break;
18276 }
18277 if( sqlite3_stricmp(zType, "table")==0 ){
18278 zName = (const char*)sqlite3_column_text(pStmt, 1);
18279 zSql = (const char*)sqlite3_column_text(pStmt, 2);
18280 if( zName!=0 && zSql!=0 ){
18281 pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol);
18282 break;
18283 }
18284 }
18285 }
18286
18287 shellFinalize(pRc, pStmt);
18288 *pbNoop = bNoop;
@@ -18919,12 +18972,13 @@
18972 rc = 1;
18973 }else{
18974 while( sqlite3_step(pStmt)==SQLITE_ROW ){
18975 const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
18976 const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
18977 if( zSchema==0 || zFile==0 ) continue;
18978 azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
18979 shell_check_oom(azName);
18980 azName[nName*2] = strdup(zSchema);
18981 azName[nName*2+1] = strdup(zFile);
18982 nName++;
18983 }
18984 }
@@ -19176,12 +19230,19 @@
19230 }
19231 }else
19232
19233 #ifndef SQLITE_OMIT_VIRTUALTABLE
19234 if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){
19235 if( p->bSafeMode ){
19236 raw_printf(stderr,
19237 "Cannot run experimental commands such as \"%s\" in safe mode\n",
19238 azArg[0]);
19239 rc = 1;
19240 }else{
19241 open_db(p, 0);
19242 expertDotCommand(p, azArg, nArg);
19243 }
19244 }else
19245 #endif
19246
19247 if( c=='f' && strncmp(azArg[0], "filectrl", n)==0 ){
19248 static const struct {
@@ -19969,11 +20030,12 @@
20030 if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
20031 if( nArg!=2 ){
20032 raw_printf(stderr, "Usage: .nonce NONCE\n");
20033 rc = 1;
20034 }else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
20035 raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n",
20036 p->lineno, azArg[1]);
20037 exit(1);
20038 }else{
20039 p->bSafeMode = 0;
20040 return 0; /* Return immediately to bypass the safe mode reset
20041 ** at the end of this procedure */
@@ -19988,39 +20050,12 @@
20050 raw_printf(stderr, "Usage: .nullvalue STRING\n");
20051 rc = 1;
20052 }
20053 }else
20054
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20055 if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
20056 const char *zFN = 0; /* Pointer to constant filename */
20057 char *zNewFilename = 0; /* Name of the database file to open */
20058 int iName = 1; /* Index in azArg[] of the filename */
20059 int newFlag = 0; /* True to delete file before opening */
20060 int openMode = SHELL_OPEN_UNSPEC;
20061
@@ -20049,16 +20084,16 @@
20084 #endif /* SQLITE_OMIT_DESERIALIZE */
20085 }else if( z[0]=='-' ){
20086 utf8_printf(stderr, "unknown option: %s\n", z);
20087 rc = 1;
20088 goto meta_command_exit;
20089 }else if( zFN ){
20090 utf8_printf(stderr, "extra argument: \"%s\"\n", z);
20091 rc = 1;
20092 goto meta_command_exit;
20093 }else{
20094 zFN = z;
20095 }
20096 }
20097
20098 /* Close the existing database */
20099 session_close_all(p, -1);
@@ -20070,19 +20105,25 @@
20105 p->openMode = openMode;
20106 p->openFlags = 0;
20107 p->szMax = 0;
20108
20109 /* If a filename is specified, try to open it first */
20110 if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
20111 if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
20112 if( p->bSafeMode
20113 && p->openMode!=SHELL_OPEN_HEXDB
20114 && zFN
20115 && strcmp(zFN,":memory:")!=0
20116 ){
20117 failIfSafeMode(p, "cannot open disk-based database files in safe mode");
20118 }
20119 if( zFN ){
20120 zNewFilename = sqlite3_mprintf("%s", zFN);
20121 shell_check_oom(zNewFilename);
20122 }else{
20123 zNewFilename = 0;
20124 }
20125 p->pAuxDb->zDbFilename = zNewFilename;
20126 open_db(p, OPEN_DB_KEEPALIVE);
20127 if( p->db==0 ){
20128 utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
20129 sqlite3_free(zNewFilename);
@@ -20132,11 +20173,11 @@
20173 rc = 1;
20174 goto meta_command_exit;
20175 }
20176 }else if( zFile==0 && eMode!='e' && eMode!='x' ){
20177 zFile = sqlite3_mprintf("%s", z);
20178 if( zFile && zFile[0]=='|' ){
20179 while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
20180 break;
20181 }
20182 }else{
20183 utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
@@ -20145,11 +20186,13 @@
20186 rc = 1;
20187 sqlite3_free(zFile);
20188 goto meta_command_exit;
20189 }
20190 }
20191 if( zFile==0 ){
20192 zFile = sqlite3_mprintf("stdout");
20193 }
20194 if( bOnce ){
20195 p->outCount = 2;
20196 }else{
20197 p->outCount = 0;
20198 }
@@ -20172,10 +20215,11 @@
20215 }
20216 sqlite3_free(zFile);
20217 zFile = sqlite3_mprintf("%s", p->zTempFile);
20218 }
20219 #endif /* SQLITE_NOHAVE_SYSTEM */
20220 shell_check_oom(zFile);
20221 if( zFile[0]=='|' ){
20222 #ifdef SQLITE_OMIT_POPEN
20223 raw_printf(stderr, "Error: pipes are not supported in this OS\n");
20224 rc = 1;
20225 p->out = stdout;
@@ -20268,21 +20312,21 @@
20312 const char *zValue = azArg[3];
20313 bind_table_init(p);
20314 zSql = sqlite3_mprintf(
20315 "REPLACE INTO temp.sqlite_parameters(key,value)"
20316 "VALUES(%Q,%s);", zKey, zValue);
20317 shell_check_oom(zSql);
20318 pStmt = 0;
20319 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
20320 sqlite3_free(zSql);
20321 if( rx!=SQLITE_OK ){
20322 sqlite3_finalize(pStmt);
20323 pStmt = 0;
20324 zSql = sqlite3_mprintf(
20325 "REPLACE INTO temp.sqlite_parameters(key,value)"
20326 "VALUES(%Q,%Q);", zKey, zValue);
20327 shell_check_oom(zSql);
20328 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
20329 sqlite3_free(zSql);
20330 if( rx!=SQLITE_OK ){
20331 utf8_printf(p->out, "Error: %s\n", sqlite3_errmsg(p->db));
20332 sqlite3_finalize(pStmt);
@@ -20299,11 +20343,11 @@
20343 ** exists.
20344 */
20345 if( nArg==3 && strcmp(azArg[1],"unset")==0 ){
20346 char *zSql = sqlite3_mprintf(
20347 "DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]);
20348 shell_check_oom(zSql);
20349 sqlite3_exec(p->db, zSql, 0, 0, 0);
20350 sqlite3_free(zSql);
20351 }else
20352 /* If no command name matches, show a syntax error */
20353 parameter_syntax_error:
@@ -20525,10 +20569,11 @@
20569 " name text,\n"
20570 " tbl_name text,\n"
20571 " rootpage integer,\n"
20572 " sql text\n"
20573 ")", zName);
20574 shell_check_oom(new_argv[0]);
20575 new_argv[1] = 0;
20576 new_colv[0] = "sql";
20577 new_colv[1] = 0;
20578 callback(&data, 1, new_argv, new_colv);
20579 sqlite3_free(new_argv[0]);
@@ -20576,12 +20621,14 @@
20621 }
20622 #endif
20623 appendText(&sSelect, ") WHERE ", 0);
20624 if( zName ){
20625 char *zQarg = sqlite3_mprintf("%Q", zName);
20626 int bGlob;
20627 shell_check_oom(zQarg);
20628 bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 ||
20629 strchr(zName, '[') != 0;
20630 if( strchr(zName, '.') ){
20631 appendText(&sSelect, "lower(printf('%s.%s',sname,tbl_name))", 0);
20632 }else{
20633 appendText(&sSelect, "lower(tbl_name)", 0);
20634 }
@@ -20740,11 +20787,12 @@
20787 if( pSession->azFilter==0 ){
20788 raw_printf(stderr, "Error: out or memory\n");
20789 exit(1);
20790 }
20791 for(ii=1; ii<nCmd; ii++){
20792 char *x = pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
20793 shell_check_oom(x);
20794 }
20795 pSession->nFilter = ii-1;
20796 }
20797 }else
20798
@@ -20812,10 +20860,11 @@
20860 }
20861 pSession->nFilter = 0;
20862 sqlite3session_table_filter(pSession->p, session_filter, pSession);
20863 pAuxDb->nSession++;
20864 pSession->zName = sqlite3_mprintf("%s", zName);
20865 shell_check_oom(pSession->zName);
20866 }else
20867 /* If no command name matches, show a syntax error */
20868 session_syntax_error:
20869 showHelp(p->out, "session");
20870 }else
@@ -20905,15 +20954,16 @@
20954 int tno = sqlite3_column_int(pStmt, 0);
20955 const char *zOp = (const char*)sqlite3_column_text(pStmt, 1);
20956 const char *zSql = (const char*)sqlite3_column_text(pStmt, 2);
20957 const char *zAns = (const char*)sqlite3_column_text(pStmt, 3);
20958
20959 if( zOp==0 ) continue;
20960 if( zSql==0 ) continue;
20961 if( zAns==0 ) continue;
20962 k = 0;
20963 if( bVerbose>0 ){
 
20964 printf("%d: %s %s\n", tno, zOp, zSql);
 
20965 }
20966 if( strcmp(zOp,"memo")==0 ){
20967 utf8_printf(p->out, "%s\n", zSql);
20968 }else
20969 if( strcmp(zOp,"run")==0 ){
@@ -21027,10 +21077,11 @@
21077 initText(&sSql);
21078 appendText(&sSql, "WITH [sha3sum$query](a,b) AS(",0);
21079 zSep = "VALUES(";
21080 while( SQLITE_ROW==sqlite3_step(pStmt) ){
21081 const char *zTab = (const char*)sqlite3_column_text(pStmt,0);
21082 if( zTab==0 ) continue;
21083 if( zLike && sqlite3_strlike(zLike, zTab, 0)!=0 ) continue;
21084 if( strncmp(zTab, "sqlite_",7)!=0 ){
21085 appendText(&sQuery,"SELECT * FROM ", 0);
21086 appendText(&sQuery,zTab,'"');
21087 appendText(&sQuery," NOT INDEXED;", 0);
@@ -21067,10 +21118,11 @@
21118 "%s))"
21119 " SELECT lower(hex(sha3_query(group_concat(a,''),%d))) AS hash"
21120 " FROM [sha3sum$query]",
21121 sSql.z, iSize);
21122 }
21123 shell_check_oom(zSql);
21124 freeText(&sQuery);
21125 freeText(&sSql);
21126 if( bDebug ){
21127 utf8_printf(p->out, "%s\n", zSql);
21128 }else{
@@ -21090,15 +21142,15 @@
21142 raw_printf(stderr, "Usage: .system COMMAND\n");
21143 rc = 1;
21144 goto meta_command_exit;
21145 }
21146 zCmd = sqlite3_mprintf(strchr(azArg[1],' ')==0?"%s":"\"%s\"", azArg[1]);
21147 for(i=2; i<nArg && zCmd!=0; i++){
21148 zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"",
21149 zCmd, azArg[i]);
21150 }
21151 x = zCmd!=0 ? system(zCmd) : 1;
21152 sqlite3_free(zCmd);
21153 if( x ) raw_printf(stderr, "System command returns %d\n", x);
21154 }else
21155 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
21156
@@ -21230,16 +21282,16 @@
21282 while( sqlite3_step(pStmt)==SQLITE_ROW ){
21283 if( nRow>=nAlloc ){
21284 char **azNew;
21285 int n2 = nAlloc*2 + 10;
21286 azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2);
21287 shell_check_oom(azNew);
21288 nAlloc = n2;
21289 azResult = azNew;
21290 }
21291 azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
21292 shell_check_oom(azResult[nRow]);
21293 nRow++;
21294 }
21295 if( sqlite3_finalize(pStmt)!=SQLITE_OK ){
21296 rc = shellDatabaseError(p->db);
21297 }
@@ -22004,11 +22056,11 @@
22056 nLine = strlen30(zLine);
22057 if( nSql+nLine+2>=nAlloc ){
22058 /* Grow buffer by half-again increments when big. */
22059 nAlloc = nSql+(nSql>>1)+nLine+100;
22060 zSql = realloc(zSql, nAlloc);
22061 shell_check_oom(zSql);
22062 }
22063 if( nSql==0 ){
22064 int i;
22065 for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
22066 assert( nAlloc>0 && zSql!=0 );
@@ -22136,10 +22188,11 @@
22188 raw_printf(stderr, "-- warning: cannot find home directory;"
22189 " cannot read ~/.sqliterc\n");
22190 return;
22191 }
22192 zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
22193 shell_check_oom(zBuf);
22194 sqliterc = zBuf;
22195 }
22196 p->in = fopen(sqliterc,"rb");
22197 if( p->in ){
22198 if( stdin_is_interactive ){
@@ -22334,14 +22387,10 @@
22387 setBinaryMode(stdin, 0);
22388 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
22389 stdin_is_interactive = isatty(0);
22390 stdout_is_console = isatty(1);
22391
 
 
 
 
22392 #if !defined(_WIN32_WCE)
22393 if( getenv("SQLITE_DEBUG_BREAK") ){
22394 if( isatty(0) && isatty(2) ){
22395 fprintf(stderr,
22396 "attach debugger to process %d and press any key to continue.\n",
@@ -22377,20 +22426,20 @@
22426 ** memory that does not come from the SQLite memory allocator.
22427 */
22428 #if !SQLITE_SHELL_IS_UTF8
22429 sqlite3_initialize();
22430 argvToFree = malloc(sizeof(argv[0])*argc*2);
22431 shell_check_oom(argvToFree);
22432 argcToFree = argc;
22433 argv = argvToFree + argc;
 
22434 for(i=0; i<argc; i++){
22435 char *z = sqlite3_win32_unicode_to_utf8(wargv[i]);
22436 int n;
22437 shell_check_oom(z);
22438 n = (int)strlen(z);
22439 argv[i] = malloc( n+1 );
22440 shell_check_oom(argv[i]);
22441 memcpy(argv[i], z, n+1);
22442 argvToFree[i] = argv[i];
22443 sqlite3_free(z);
22444 }
22445 sqlite3_shutdown();
@@ -22436,11 +22485,11 @@
22485 /* Excesss arguments are interpreted as SQL (or dot-commands) and
22486 ** mean that nothing is read from stdin */
22487 readStdin = 0;
22488 nCmd++;
22489 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
22490 shell_check_oom(azCmd);
22491 azCmd[nCmd-1] = z;
22492 }
22493 }
22494 if( z[1]=='-' ) z++;
22495 if( strcmp(z,"-separator")==0
22496
+3387 -3185
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455455
#define SQLITE_VERSION "3.38.0"
456456
#define SQLITE_VERSION_NUMBER 3038000
457
-#define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
457
+#define SQLITE_SOURCE_ID "2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -4128,17 +4128,18 @@
41284128
**
41294129
** The values returned by sqlite3_errcode() and/or
41304130
** sqlite3_extended_errcode() might change with each API call.
41314131
** Except, there are some interfaces that are guaranteed to never
41324132
** change the value of the error code. The error-code preserving
4133
-** interfaces are:
4133
+** interfaces include the following:
41344134
**
41354135
** <ul>
41364136
** <li> sqlite3_errcode()
41374137
** <li> sqlite3_extended_errcode()
41384138
** <li> sqlite3_errmsg()
41394139
** <li> sqlite3_errmsg16()
4140
+** <li> sqlite3_error_offset()
41404141
** </ul>
41414142
**
41424143
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
41434144
** text that describes the error, as either UTF-8 or UTF-16 respectively.
41444145
** ^(Memory to hold the error message string is managed internally.
@@ -4148,10 +4149,17 @@
41484149
**
41494150
** ^The sqlite3_errstr() interface returns the English-language text
41504151
** that describes the [result code], as UTF-8.
41514152
** ^(Memory to hold the error message string is managed internally
41524153
** and must not be freed by the application)^.
4154
+**
4155
+** ^If the most recent error references a specific token in the input
4156
+** SQL, the sqlite3_error_offset() interface returns the byte offset
4157
+** of the start of that token. ^The byte offset returned by
4158
+** sqlite3_error_offset() assumes that the input SQL is UTF8.
4159
+** ^If the most error does not reference a specific token in the input
4160
+** SQL, then the sqlite3_error_offset() function returns -1.
41534161
**
41544162
** When the serialized [threading mode] is in use, it might be the
41554163
** case that a second error occurs on a separate thread in between
41564164
** the time of the first error and the call to these interfaces.
41574165
** When that happens, the second error will be reported since these
@@ -4168,10 +4176,11 @@
41684176
SQLITE_API int sqlite3_errcode(sqlite3 *db);
41694177
SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
41704178
SQLITE_API const char *sqlite3_errmsg(sqlite3*);
41714179
SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
41724180
SQLITE_API const char *sqlite3_errstr(int);
4181
+SQLITE_API int sqlite3_error_offset(sqlite3 *db);
41734182
41744183
/*
41754184
** CAPI3REF: Prepared Statement Object
41764185
** KEYWORDS: {prepared statement} {prepared statements}
41774186
**
@@ -9768,18 +9777,37 @@
97689777
97699778
/*
97709779
** CAPI3REF: Determine The Collation For a Virtual Table Constraint
97719780
**
97729781
** This function may only be called from within a call to the [xBestIndex]
9773
-** method of a [virtual table].
9782
+** method of a [virtual table]. This function returns a pointer to a string
9783
+** that is the name of the appropriate collation sequence to use for text
9784
+** comparisons on the constraint identified by its arguments.
97749785
**
9775
-** The first argument must be the sqlite3_index_info object that is the
9776
-** first parameter to the xBestIndex() method. The second argument must be
9777
-** an index into the aConstraint[] array belonging to the sqlite3_index_info
9778
-** structure passed to xBestIndex. This function returns a pointer to a buffer
9779
-** containing the name of the collation sequence for the corresponding
9780
-** constraint.
9786
+** The first argument must be the pointer to the sqlite3_index_info object
9787
+** that is the first parameter to the xBestIndex() method. The second argument
9788
+** must be an index into the aConstraint[] array belonging to the
9789
+** sqlite3_index_info structure passed to xBestIndex.
9790
+**
9791
+** Important:
9792
+** The first parameter must be the same pointer that is passed into the
9793
+** xBestMethod() method. The first parameter may not be a pointer to a
9794
+** different sqlite3_index_info object, even an exact copy.
9795
+**
9796
+** The return value is computed as follows:
9797
+**
9798
+** <ol>
9799
+** <li><p> If the constraint comes from a WHERE clause expression that contains
9800
+** a [COLLATE operator], then the name of the collation specified by
9801
+** that COLLATE operator is returned.
9802
+** <li><p> If there is no COLLATE operator, but the column that is the subject
9803
+** of the constraint specifies an alternative collating sequence via
9804
+** a [COLLATE clause] on the column definition within the CREATE TABLE
9805
+** statement that was passed into [sqlite3_declare_vtab()], then the
9806
+** name of that alternative collating sequence is returned.
9807
+** <li><p> Otherwise, "BINARY" is returned.
9808
+** </ol>
97819809
*/
97829810
SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
97839811
97849812
/*
97859813
** CAPI3REF: Conflict resolution modes
@@ -13565,14 +13593,14 @@
1356513593
#define TK_DETACH 40
1356613594
#define TK_EACH 41
1356713595
#define TK_FAIL 42
1356813596
#define TK_OR 43
1356913597
#define TK_AND 44
13570
-#define TK_MATCH 45
13571
-#define TK_LIKE_KW 46
13572
-#define TK_BETWEEN 47
13573
-#define TK_IS 48
13598
+#define TK_IS 45
13599
+#define TK_MATCH 46
13600
+#define TK_LIKE_KW 47
13601
+#define TK_BETWEEN 48
1357413602
#define TK_IN 49
1357513603
#define TK_ISNULL 50
1357613604
#define TK_NOTNULL 51
1357713605
#define TK_NE 52
1357813606
#define TK_EQ 53
@@ -13632,82 +13660,83 @@
1363213660
#define TK_MINUS 107
1363313661
#define TK_STAR 108
1363413662
#define TK_SLASH 109
1363513663
#define TK_REM 110
1363613664
#define TK_CONCAT 111
13637
-#define TK_COLLATE 112
13638
-#define TK_BITNOT 113
13639
-#define TK_ON 114
13640
-#define TK_INDEXED 115
13641
-#define TK_STRING 116
13642
-#define TK_JOIN_KW 117
13643
-#define TK_CONSTRAINT 118
13644
-#define TK_DEFAULT 119
13645
-#define TK_NULL 120
13646
-#define TK_PRIMARY 121
13647
-#define TK_UNIQUE 122
13648
-#define TK_CHECK 123
13649
-#define TK_REFERENCES 124
13650
-#define TK_AUTOINCR 125
13651
-#define TK_INSERT 126
13652
-#define TK_DELETE 127
13653
-#define TK_UPDATE 128
13654
-#define TK_SET 129
13655
-#define TK_DEFERRABLE 130
13656
-#define TK_FOREIGN 131
13657
-#define TK_DROP 132
13658
-#define TK_UNION 133
13659
-#define TK_ALL 134
13660
-#define TK_EXCEPT 135
13661
-#define TK_INTERSECT 136
13662
-#define TK_SELECT 137
13663
-#define TK_VALUES 138
13664
-#define TK_DISTINCT 139
13665
-#define TK_DOT 140
13666
-#define TK_FROM 141
13667
-#define TK_JOIN 142
13668
-#define TK_USING 143
13669
-#define TK_ORDER 144
13670
-#define TK_GROUP 145
13671
-#define TK_HAVING 146
13672
-#define TK_LIMIT 147
13673
-#define TK_WHERE 148
13674
-#define TK_RETURNING 149
13675
-#define TK_INTO 150
13676
-#define TK_NOTHING 151
13677
-#define TK_FLOAT 152
13678
-#define TK_BLOB 153
13679
-#define TK_INTEGER 154
13680
-#define TK_VARIABLE 155
13681
-#define TK_CASE 156
13682
-#define TK_WHEN 157
13683
-#define TK_THEN 158
13684
-#define TK_ELSE 159
13685
-#define TK_INDEX 160
13686
-#define TK_ALTER 161
13687
-#define TK_ADD 162
13688
-#define TK_WINDOW 163
13689
-#define TK_OVER 164
13690
-#define TK_FILTER 165
13691
-#define TK_COLUMN 166
13692
-#define TK_AGG_FUNCTION 167
13693
-#define TK_AGG_COLUMN 168
13694
-#define TK_TRUEFALSE 169
13695
-#define TK_ISNOT 170
13696
-#define TK_FUNCTION 171
13697
-#define TK_UMINUS 172
13698
-#define TK_UPLUS 173
13699
-#define TK_TRUTH 174
13700
-#define TK_REGISTER 175
13701
-#define TK_VECTOR 176
13702
-#define TK_SELECT_COLUMN 177
13703
-#define TK_IF_NULL_ROW 178
13704
-#define TK_ASTERISK 179
13705
-#define TK_SPAN 180
13706
-#define TK_ERROR 181
13707
-#define TK_SPACE 182
13708
-#define TK_ILLEGAL 183
13665
+#define TK_PTR 112
13666
+#define TK_COLLATE 113
13667
+#define TK_BITNOT 114
13668
+#define TK_ON 115
13669
+#define TK_INDEXED 116
13670
+#define TK_STRING 117
13671
+#define TK_JOIN_KW 118
13672
+#define TK_CONSTRAINT 119
13673
+#define TK_DEFAULT 120
13674
+#define TK_NULL 121
13675
+#define TK_PRIMARY 122
13676
+#define TK_UNIQUE 123
13677
+#define TK_CHECK 124
13678
+#define TK_REFERENCES 125
13679
+#define TK_AUTOINCR 126
13680
+#define TK_INSERT 127
13681
+#define TK_DELETE 128
13682
+#define TK_UPDATE 129
13683
+#define TK_SET 130
13684
+#define TK_DEFERRABLE 131
13685
+#define TK_FOREIGN 132
13686
+#define TK_DROP 133
13687
+#define TK_UNION 134
13688
+#define TK_ALL 135
13689
+#define TK_EXCEPT 136
13690
+#define TK_INTERSECT 137
13691
+#define TK_SELECT 138
13692
+#define TK_VALUES 139
13693
+#define TK_DISTINCT 140
13694
+#define TK_DOT 141
13695
+#define TK_FROM 142
13696
+#define TK_JOIN 143
13697
+#define TK_USING 144
13698
+#define TK_ORDER 145
13699
+#define TK_GROUP 146
13700
+#define TK_HAVING 147
13701
+#define TK_LIMIT 148
13702
+#define TK_WHERE 149
13703
+#define TK_RETURNING 150
13704
+#define TK_INTO 151
13705
+#define TK_NOTHING 152
13706
+#define TK_FLOAT 153
13707
+#define TK_BLOB 154
13708
+#define TK_INTEGER 155
13709
+#define TK_VARIABLE 156
13710
+#define TK_CASE 157
13711
+#define TK_WHEN 158
13712
+#define TK_THEN 159
13713
+#define TK_ELSE 160
13714
+#define TK_INDEX 161
13715
+#define TK_ALTER 162
13716
+#define TK_ADD 163
13717
+#define TK_WINDOW 164
13718
+#define TK_OVER 165
13719
+#define TK_FILTER 166
13720
+#define TK_COLUMN 167
13721
+#define TK_AGG_FUNCTION 168
13722
+#define TK_AGG_COLUMN 169
13723
+#define TK_TRUEFALSE 170
13724
+#define TK_ISNOT 171
13725
+#define TK_FUNCTION 172
13726
+#define TK_UMINUS 173
13727
+#define TK_UPLUS 174
13728
+#define TK_TRUTH 175
13729
+#define TK_REGISTER 176
13730
+#define TK_VECTOR 177
13731
+#define TK_SELECT_COLUMN 178
13732
+#define TK_IF_NULL_ROW 179
13733
+#define TK_ASTERISK 180
13734
+#define TK_SPAN 181
13735
+#define TK_ERROR 182
13736
+#define TK_SPACE 183
13737
+#define TK_ILLEGAL 184
1370913738
1371013739
/************** End of parse.h ***********************************************/
1371113740
/************** Continuing where we left off in sqliteInt.h ******************/
1371213741
#include <stdio.h>
1371313742
#include <stdlib.h>
@@ -15314,15 +15343,15 @@
1531415343
#define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
1531515344
#define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
1531615345
#define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
1531715346
#define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
1531815347
#define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */
15319
-#define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15320
-#define OP_OpenDup 114
15348
+#define OP_OpenDup 113
15349
+#define OP_BitNot 114 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
1532115350
#define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
15322
-#define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15323
-#define OP_OpenEphemeral 117 /* synopsis: nColumn=P2 */
15351
+#define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */
15352
+#define OP_String8 117 /* same as TK_STRING, synopsis: r[P2]='P4' */
1532415353
#define OP_SorterOpen 118
1532515354
#define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
1532615355
#define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */
1532715356
#define OP_Close 121
1532815357
#define OP_ColumnsUsed 122
@@ -15353,12 +15382,12 @@
1535315382
#define OP_SqlExec 147
1535415383
#define OP_ParseSchema 148
1535515384
#define OP_LoadAnalysis 149
1535615385
#define OP_DropTable 150
1535715386
#define OP_DropIndex 151
15358
-#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15359
-#define OP_DropTrigger 153
15387
+#define OP_DropTrigger 152
15388
+#define OP_Real 153 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
1536015389
#define OP_IntegrityCk 154
1536115390
#define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */
1536215391
#define OP_Param 156
1536315392
#define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */
1536415393
#define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */
@@ -15411,16 +15440,16 @@
1541115440
/* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
1541215441
/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\
1541315442
/* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\
1541415443
/* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
1541515444
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15416
-/* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15445
+/* 112 */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00,\
1541715446
/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
1541815447
/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
1541915448
/* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\
1542015449
/* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15421
-/* 152 */ 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
15450
+/* 152 */ 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
1542215451
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
1542315452
/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
1542415453
/* 176 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
1542515454
}
1542615455
@@ -16489,10 +16518,11 @@
1648916518
i64 lastRowid; /* ROWID of most recent insert (see above) */
1649016519
i64 szMmap; /* Default mmap_size setting */
1649116520
u32 nSchemaLock; /* Do not reset the schema when non-zero */
1649216521
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
1649316522
int errCode; /* Most recent error code (SQLITE_*) */
16523
+ int errByteOffset; /* Byte offset of error in SQL statement */
1649416524
int errMask; /* & result codes with this before returning */
1649516525
int iSysErrno; /* Errno value from last system error */
1649616526
u32 dbOptFlags; /* Flags to enable/disable optimizations */
1649716527
u8 enc; /* Text encoding */
1649816528
u8 autoCommit; /* The auto-commit flag. */
@@ -16725,10 +16755,11 @@
1672516755
#define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
1672616756
#define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
1672716757
/* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
1672816758
#define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
1672916759
#define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
16760
+#define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */
1673016761
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1673116762
1673216763
/*
1673316764
** Macros for testing whether or not optimizations are enabled or disabled.
1673416765
*/
@@ -16898,11 +16929,11 @@
1689816929
** Used to create an aggregate function definition implemented by
1689916930
** the C functions xStep and xFinal. The first four parameters
1690016931
** are interpreted in the same way as the first 4 parameters to
1690116932
** FUNCTION().
1690216933
**
16903
-** WFUNCTION(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
16934
+** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
1690416935
** Used to create an aggregate function definition implemented by
1690516936
** the C functions xStep and xFinal. The first four parameters
1690616937
** are interpreted in the same way as the first 4 parameters to
1690716938
** FUNCTION().
1690816939
**
@@ -16925,10 +16956,14 @@
1692516956
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
1692616957
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
1692716958
#define MFUNCTION(zName, nArg, xPtr, xFunc) \
1692816959
{nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
1692916960
xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
16961
+#define JFUNCTION(zName, nArg, iArg, xFunc) \
16962
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS|\
16963
+ SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
16964
+ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
1693016965
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
1693116966
{nArg, SQLITE_FUNC_BUILTIN|\
1693216967
SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
1693316968
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
1693416969
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
@@ -18519,10 +18554,12 @@
1851918554
TableLock *aTableLock; /* Required table locks for shared-cache mode */
1852018555
#endif
1852118556
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
1852218557
Parse *pToplevel; /* Parse structure for main program (or NULL) */
1852318558
Table *pTriggerTab; /* Table triggers are being coded for */
18559
+ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
18560
+ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
1852418561
union {
1852518562
int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
1852618563
Returning *pReturning; /* The RETURNING clause */
1852718564
} u1;
1852818565
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -18573,13 +18610,11 @@
1857318610
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
1857418611
#ifndef SQLITE_OMIT_VIRTUALTABLE
1857518612
Token sArg; /* Complete text of a module argument */
1857618613
Table **apVtabLock; /* Pointer to virtual tables needing locking */
1857718614
#endif
18578
- TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
1857918615
With *pWith; /* Current WITH clause, or NULL */
18580
- ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
1858118616
#ifndef SQLITE_OMIT_ALTERTABLE
1858218617
RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
1858318618
#endif
1858418619
};
1858518620
@@ -19366,11 +19401,11 @@
1936619401
SQLITE_PRIVATE void sqlite3Dequote(char*);
1936719402
SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
1936819403
SQLITE_PRIVATE void sqlite3DequoteToken(Token*);
1936919404
SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*);
1937019405
SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);
19371
-SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **);
19406
+SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*);
1937219407
SQLITE_PRIVATE void sqlite3FinishCoding(Parse*);
1937319408
SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
1937419409
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
1937519410
SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
1937619411
SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
@@ -19646,13 +19681,18 @@
1964619681
SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,const IdList*);
1964719682
SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int);
1964819683
SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*);
1964919684
SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int);
1965019685
SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
19686
+SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum*,sqlite3_value*);
1965119687
SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void);
1965219688
SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void);
19689
+SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void);
1965319690
SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);
19691
+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
19692
+SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3*);
19693
+#endif
1965419694
SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*);
1965519695
SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*);
1965619696
SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int);
1965719697
SQLITE_PRIVATE With *sqlite3WithDup(sqlite3 *db, With *p);
1965819698
@@ -19932,15 +19972,17 @@
1993219972
SQLITE_PRIVATE void sqlite3OomClear(sqlite3*);
1993319973
SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);
1993419974
SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
1993519975
1993619976
SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int);
19977
+SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum*, int);
1993719978
SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
1993819979
SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8);
1993919980
SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
1994019981
SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
1994119982
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
19983
+SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3*,const char*);
1994219984
1994319985
SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
1994419986
SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
1994519987
1994619988
#ifndef SQLITE_OMIT_SUBQUERY
@@ -20104,17 +20146,19 @@
2010420146
SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*);
2010520147
SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int);
2010620148
SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int);
2010720149
SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*);
2010820150
SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *);
20151
+SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3*,int);
2010920152
#else
2011020153
#define sqlite3FkActions(a,b,c,d,e,f)
2011120154
#define sqlite3FkCheck(a,b,c,d,e,f)
2011220155
#define sqlite3FkDropTable(a,b,c)
2011320156
#define sqlite3FkOldmask(a,b) 0
2011420157
#define sqlite3FkRequired(a,b,c,d) 0
2011520158
#define sqlite3FkReferences(a) 0
20159
+ #define sqlite3FkClearTriggerCache(a,b)
2011620160
#endif
2011720161
#ifndef SQLITE_OMIT_FOREIGN_KEY
2011820162
SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*);
2011920163
SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);
2012020164
#else
@@ -20656,10 +20700,13 @@
2065620700
#ifdef SQLITE_DISABLE_FTS4_DEFERRED
2065720701
"DISABLE_FTS4_DEFERRED",
2065820702
#endif
2065920703
#ifdef SQLITE_DISABLE_INTRINSIC
2066020704
"DISABLE_INTRINSIC",
20705
+#endif
20706
+#ifdef SQLITE_DISABLE_JSON
20707
+ "DISABLE_JSON",
2066120708
#endif
2066220709
#ifdef SQLITE_DISABLE_LFS
2066320710
"DISABLE_LFS",
2066420711
#endif
2066520712
#ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
@@ -20735,13 +20782,10 @@
2073520782
"ENABLE_ICU",
2073620783
#endif
2073720784
#ifdef SQLITE_ENABLE_IOTRACE
2073820785
"ENABLE_IOTRACE",
2073920786
#endif
20740
-#ifdef SQLITE_ENABLE_JSON1
20741
- "ENABLE_JSON1",
20742
-#endif
2074320787
#ifdef SQLITE_ENABLE_LOAD_EXTENSION
2074420788
"ENABLE_LOAD_EXTENSION",
2074520789
#endif
2074620790
#ifdef SQLITE_ENABLE_LOCKING_STYLE
2074720791
"ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
@@ -21764,11 +21808,11 @@
2176421808
** * A one-row "pseudotable" stored in a single register
2176521809
*/
2176621810
typedef struct VdbeCursor VdbeCursor;
2176721811
struct VdbeCursor {
2176821812
u8 eCurType; /* One of the CURTYPE_* values above */
21769
- i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */
21813
+ i8 iDb; /* Index of cursor database in db->aDb[] */
2177021814
u8 nullRow; /* True if pointing to a row with no data */
2177121815
u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
2177221816
u8 isTable; /* True for rowid tables. False for indexes */
2177321817
#ifdef SQLITE_DEBUG
2177421818
u8 seekOp; /* Most recent seek operation on this cursor */
@@ -21777,13 +21821,15 @@
2177721821
Bool isEphemeral:1; /* True for an ephemeral table */
2177821822
Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
2177921823
Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
2178021824
Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */
2178121825
u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
21782
- Btree *pBtx; /* Separate file holding temporary table */
21826
+ union { /* pBtx for isEphermeral. pAltMap otherwise */
21827
+ Btree *pBtx; /* Separate file holding temporary table */
21828
+ u32 *aAltMap; /* Mapping from table to index column numbers */
21829
+ } ub;
2178321830
i64 seqCount; /* Sequence counter */
21784
- u32 *aAltMap; /* Mapping from table to index column numbers */
2178521831
2178621832
/* Cached OP_Column parse information is only valid if cacheStatus matches
2178721833
** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
2178821834
** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that
2178921835
** the cache is out of date. */
@@ -22181,11 +22227,11 @@
2218122227
SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor**, u32*);
2218222228
SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*);
2218322229
SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32);
2218422230
SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8);
2218522231
SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
22186
-SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
22232
+SQLITE_PRIVATE void sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
2218722233
SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
2218822234
2218922235
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
2219022236
SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
2219122237
SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
@@ -23319,22 +23365,21 @@
2331923365
**
2332023366
** Where NNN is an arbitrary floating-point number and "days" can be one
2332123367
** of several units of time.
2332223368
*/
2332323369
static const struct {
23324
- u8 eType; /* Transformation type code */
23325
- u8 nName; /* Length of th name */
23326
- char *zName; /* Name of the transformation */
23327
- double rLimit; /* Maximum NNN value for this transform */
23328
- double rXform; /* Constant used for this transform */
23370
+ u8 nName; /* Length of the name */
23371
+ char zName[7]; /* Name of the transformation */
23372
+ float rLimit; /* Maximum NNN value for this transform */
23373
+ float rXform; /* Constant used for this transform */
2332923374
} aXformType[] = {
23330
- { 0, 6, "second", 464269060800.0, 1000.0 },
23331
- { 0, 6, "minute", 7737817680.0, 60000.0 },
23332
- { 0, 4, "hour", 128963628.0, 3600000.0 },
23333
- { 0, 3, "day", 5373485.0, 86400000.0 },
23334
- { 1, 5, "month", 176546.0, 2592000000.0 },
23335
- { 2, 4, "year", 14713.0, 31536000000.0 },
23375
+ { 6, "second", 4.6427e+14, 1.0 },
23376
+ { 6, "minute", 7.7379e+12, 60.0 },
23377
+ { 4, "hour", 1.2897e+11, 3600.0 },
23378
+ { 3, "day", 5373485.0, 86400.0 },
23379
+ { 5, "month", 176546.0, 2592000.0 },
23380
+ { 4, "year", 14713.0, 31536000.0 },
2333623381
};
2333723382
2333823383
/*
2333923384
** Process a modifier to a date-time stamp. The modifiers are
2334023385
** as follows:
@@ -23567,33 +23612,35 @@
2356723612
for(i=0; i<ArraySize(aXformType); i++){
2356823613
if( aXformType[i].nName==n
2356923614
&& sqlite3_strnicmp(aXformType[i].zName, z, n)==0
2357023615
&& r>-aXformType[i].rLimit && r<aXformType[i].rLimit
2357123616
){
23572
- switch( aXformType[i].eType ){
23573
- case 1: { /* Special processing to add months */
23617
+ switch( i ){
23618
+ case 4: { /* Special processing to add months */
2357423619
int x;
23620
+ assert( strcmp(aXformType[i].zName,"month")==0 );
2357523621
computeYMD_HMS(p);
2357623622
p->M += (int)r;
2357723623
x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
2357823624
p->Y += x;
2357923625
p->M -= x*12;
2358023626
p->validJD = 0;
2358123627
r -= (int)r;
2358223628
break;
2358323629
}
23584
- case 2: { /* Special processing to add years */
23630
+ case 5: { /* Special processing to add years */
2358523631
int y = (int)r;
23632
+ assert( strcmp(aXformType[i].zName,"year")==0 );
2358623633
computeYMD_HMS(p);
2358723634
p->Y += y;
2358823635
p->validJD = 0;
2358923636
r -= (int)r;
2359023637
break;
2359123638
}
2359223639
}
2359323640
computeJD(p);
23594
- p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder);
23641
+ p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
2359523642
rc = 0;
2359623643
break;
2359723644
}
2359823645
}
2359923646
clearYMD_HMS_TZ(p);
@@ -29835,10 +29882,11 @@
2983529882
if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
2983629883
pToken = va_arg(ap, Token*);
2983729884
assert( bArgList==0 );
2983829885
if( pToken && pToken->n ){
2983929886
sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
29887
+ sqlite3RecordErrorByteOffset(pAccum->db, pToken->z);
2984029888
}
2984129889
length = width = 0;
2984229890
break;
2984329891
}
2984429892
case etSRCITEM: {
@@ -29889,18 +29937,42 @@
2988929937
zExtra = 0;
2989029938
}
2989129939
}/* End for loop over the format string */
2989229940
} /* End of function */
2989329941
29942
+
29943
+/*
29944
+** The z string points to the first character of a token that is
29945
+** associated with an error. If db does not already have an error
29946
+** byte offset recorded, try to compute the error byte offset for
29947
+** z and set the error byte offset in db.
29948
+*/
29949
+SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
29950
+ const Parse *pParse;
29951
+ const char *zText;
29952
+ const char *zEnd;
29953
+ assert( z!=0 );
29954
+ if( NEVER(db==0) ) return;
29955
+ if( db->errByteOffset!=(-2) ) return;
29956
+ pParse = db->pParse;
29957
+ if( NEVER(pParse==0) ) return;
29958
+ zText =pParse->zTail;
29959
+ if( NEVER(zText==0) ) return;
29960
+ zEnd = &zText[strlen(zText)];
29961
+ if( SQLITE_WITHIN(z,zText,zEnd) ){
29962
+ db->errByteOffset = (int)(z-zText);
29963
+ }
29964
+}
29965
+
2989429966
/*
2989529967
** Enlarge the memory allocation on a StrAccum object so that it is
2989629968
** able to accept at least N more bytes of text.
2989729969
**
2989829970
** Return the number of bytes of text that StrAccum is able to accept
2989929971
** after the attempted enlargement. The value returned might be zero.
2990029972
*/
29901
-static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
29973
+SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum *p, int N){
2990229974
char *zNew;
2990329975
assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */
2990429976
if( p->accError ){
2990529977
testcase(p->accError==SQLITE_TOOBIG);
2990629978
testcase(p->accError==SQLITE_NOMEM);
@@ -32212,20 +32284,25 @@
3221232284
** that would be appropriate.
3221332285
*/
3221432286
SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
3221532287
assert( db!=0 );
3221632288
db->errCode = err_code;
32217
- if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
32289
+ if( err_code || db->pErr ){
32290
+ sqlite3ErrorFinish(db, err_code);
32291
+ }else{
32292
+ db->errByteOffset = -1;
32293
+ }
3221832294
}
3221932295
3222032296
/*
3222132297
** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
3222232298
** and error message.
3222332299
*/
3222432300
SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
3222532301
assert( db!=0 );
3222632302
db->errCode = SQLITE_OK;
32303
+ db->errByteOffset = -1;
3222732304
if( db->pErr ) sqlite3ValueSetNull(db->pErr);
3222832305
}
3222932306
3223032307
/*
3223132308
** Load the sqlite3.iSysErrno field if that is an appropriate thing
@@ -32242,21 +32319,12 @@
3224232319
/*
3224332320
** Set the most recent error code and error string for the sqlite
3224432321
** handle "db". The error code is set to "err_code".
3224532322
**
3224632323
** If it is not NULL, string zFormat specifies the format of the
32247
-** error string in the style of the printf functions: The following
32248
-** format characters are allowed:
32249
-**
32250
-** %s Insert a string
32251
-** %z A string that should be freed after use
32252
-** %d Insert an integer
32253
-** %T Insert a token
32254
-** %S Insert the first element of a SrcList
32255
-**
32256
-** zFormat and any string tokens that follow it are assumed to be
32257
-** encoded in UTF-8.
32324
+** error string. zFormat and any string tokens that follow it are
32325
+** assumed to be encoded in UTF-8.
3225832326
**
3225932327
** To clear the most recent error for sqlite handle "db", sqlite3Error
3226032328
** should be called with err_code set to SQLITE_OK and zFormat set
3226132329
** to NULL.
3226232330
*/
@@ -32276,17 +32344,10 @@
3227632344
}
3227732345
}
3227832346
3227932347
/*
3228032348
** Add an error message to pParse->zErrMsg and increment pParse->nErr.
32281
-** The following formatting characters are allowed:
32282
-**
32283
-** %s Insert a string
32284
-** %z A string that should be freed after use
32285
-** %d Insert an integer
32286
-** %T Insert a token
32287
-** %S Insert the first element of a SrcList
3228832349
**
3228932350
** This function should be used to report any error that occurs while
3229032351
** compiling an SQL statement (i.e. within sqlite3_prepare()). The
3229132352
** last thing the sqlite3_prepare() function does is copy the error
3229232353
** stored by this function into the database handle using sqlite3Error().
@@ -32295,13 +32356,15 @@
3229532356
*/
3229632357
SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
3229732358
char *zMsg;
3229832359
va_list ap;
3229932360
sqlite3 *db = pParse->db;
32361
+ db->errByteOffset = -2;
3230032362
va_start(ap, zFormat);
3230132363
zMsg = sqlite3VMPrintf(db, zFormat, ap);
3230232364
va_end(ap);
32365
+ if( db->errByteOffset<-1 ) db->errByteOffset = -1;
3230332366
if( db->suppressErr ){
3230432367
sqlite3DbFree(db, zMsg);
3230532368
}else{
3230632369
pParse->nErr++;
3230732370
sqlite3DbFree(db, pParse->zErrMsg);
@@ -34211,15 +34274,15 @@
3421134274
/* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
3421234275
/* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
3421334276
/* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
3421434277
/* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
3421534278
/* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34216
- /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34217
- /* 114 */ "OpenDup" OpHelp(""),
34279
+ /* 113 */ "OpenDup" OpHelp(""),
34280
+ /* 114 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
3421834281
/* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34219
- /* 116 */ "String8" OpHelp("r[P2]='P4'"),
34220
- /* 117 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34282
+ /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34283
+ /* 117 */ "String8" OpHelp("r[P2]='P4'"),
3422134284
/* 118 */ "SorterOpen" OpHelp(""),
3422234285
/* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
3422334286
/* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
3422434287
/* 121 */ "Close" OpHelp(""),
3422534288
/* 122 */ "ColumnsUsed" OpHelp(""),
@@ -34250,12 +34313,12 @@
3425034313
/* 147 */ "SqlExec" OpHelp(""),
3425134314
/* 148 */ "ParseSchema" OpHelp(""),
3425234315
/* 149 */ "LoadAnalysis" OpHelp(""),
3425334316
/* 150 */ "DropTable" OpHelp(""),
3425434317
/* 151 */ "DropIndex" OpHelp(""),
34255
- /* 152 */ "Real" OpHelp("r[P2]=P4"),
34256
- /* 153 */ "DropTrigger" OpHelp(""),
34318
+ /* 152 */ "DropTrigger" OpHelp(""),
34319
+ /* 153 */ "Real" OpHelp("r[P2]=P4"),
3425734320
/* 154 */ "IntegrityCk" OpHelp(""),
3425834321
/* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
3425934322
/* 156 */ "Param" OpHelp(""),
3426034323
/* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
3426134324
/* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
@@ -56614,12 +56677,11 @@
5661456677
**
5661556678
** a) The page number is less than or equal to the size of the
5661656679
** current database image, in pages, OR
5661756680
**
5661856681
** b) if the page content were written at this time, it would not
56619
-** be necessary to write the current content out to the sub-journal
56620
-** (as determined by function subjRequiresPage()).
56682
+** be necessary to write the current content out to the sub-journal.
5662156683
**
5662256684
** If the condition asserted by this function were not true, and the
5662356685
** dirty page were to be discarded from the cache via the pagerStress()
5662456686
** routine, pagerStress() would not write the current page content to
5662556687
** the database file. If a savepoint transaction were rolled back after
@@ -56630,12 +56692,20 @@
5663056692
** database image would become corrupt. It is therefore fortunate that
5663156693
** this circumstance cannot arise.
5663256694
*/
5663356695
#if defined(SQLITE_DEBUG)
5663456696
static void assertTruncateConstraintCb(PgHdr *pPg){
56697
+ Pager *pPager = pPg->pPager;
5663556698
assert( pPg->flags&PGHDR_DIRTY );
56636
- assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
56699
+ if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */
56700
+ Pgno pgno = pPg->pgno;
56701
+ int i;
56702
+ for(i=0; i<pPg->pPager->nSavepoint; i++){
56703
+ PagerSavepoint *p = &pPager->aSavepoint[i];
56704
+ assert( p->nOrig<pgno || sqlite3BitvecTestNotNull(p->pInSavepoint,pgno) );
56705
+ }
56706
+ }
5663756707
}
5663856708
static void assertTruncateConstraint(Pager *pPager){
5663956709
sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
5664056710
}
5664156711
#else
@@ -57972,11 +58042,11 @@
5797258042
** other connection managed to get in and roll it back before
5797358043
** this connection obtained the exclusive lock above. Or, it
5797458044
** may mean that the pager was in the error-state when this
5797558045
** function was called and the journal file does not exist.
5797658046
*/
57977
- if( !isOpen(pPager->jfd) ){
58047
+ if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
5797858048
sqlite3_vfs * const pVfs = pPager->pVfs;
5797958049
int bExists; /* True if journal file exists */
5798058050
rc = sqlite3OsAccess(
5798158051
pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);
5798258052
if( rc==SQLITE_OK && bExists ){
@@ -58374,10 +58444,11 @@
5837458444
Pager *pPager, /* The pager open on the database file */
5837558445
Pgno pgno, /* Page number to fetch */
5837658446
DbPage **ppPage, /* Write a pointer to the page here */
5837758447
int flags /* PAGER_GET_XXX flags */
5837858448
){
58449
+ /* printf("PAGE %u\n", pgno); fflush(stdout); */
5837958450
return pPager->xGet(pPager, pgno, ppPage, flags);
5838058451
}
5838158452
5838258453
/*
5838358454
** Acquire a page if it is already in the in-memory cache. Do
@@ -59979,16 +60050,16 @@
5997960050
*/
5998060051
SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
5998160052
u8 eOld = pPager->journalMode; /* Prior journalmode */
5998260053
5998360054
/* The eMode parameter is always valid */
59984
- assert( eMode==PAGER_JOURNALMODE_DELETE
59985
- || eMode==PAGER_JOURNALMODE_TRUNCATE
59986
- || eMode==PAGER_JOURNALMODE_PERSIST
59987
- || eMode==PAGER_JOURNALMODE_OFF
59988
- || eMode==PAGER_JOURNALMODE_WAL
59989
- || eMode==PAGER_JOURNALMODE_MEMORY );
60055
+ assert( eMode==PAGER_JOURNALMODE_DELETE /* 0 */
60056
+ || eMode==PAGER_JOURNALMODE_PERSIST /* 1 */
60057
+ || eMode==PAGER_JOURNALMODE_OFF /* 2 */
60058
+ || eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */
60059
+ || eMode==PAGER_JOURNALMODE_MEMORY /* 4 */
60060
+ || eMode==PAGER_JOURNALMODE_WAL /* 5 */ );
5999060061
5999160062
/* This routine is only called from the OP_JournalMode opcode, and
5999260063
** the logic there will never allow a temporary file to be changed
5999360064
** to WAL mode.
5999460065
*/
@@ -60021,11 +60092,10 @@
6002160092
assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
6002260093
assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
6002360094
6002460095
assert( isOpen(pPager->fd) || pPager->exclusiveMode );
6002560096
if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
60026
-
6002760097
/* In this case we would like to delete the journal file. If it is
6002860098
** not possible, then that is not a problem. Deleting the journal file
6002960099
** here is an optimization only.
6003060100
**
6003160101
** Before deleting the journal file, obtain a RESERVED lock on the
@@ -66854,32 +66924,46 @@
6685466924
6685566925
/* The next block of code is equivalent to:
6685666926
**
6685766927
** pIter += getVarint(pIter, (u64*)&pInfo->nKey);
6685866928
**
66859
- ** The code is inlined to avoid a function call.
66929
+ ** The code is inlined and the loop is unrolled for performance.
66930
+ ** This routine is a high-runner.
6686066931
*/
6686166932
iKey = *pIter;
6686266933
if( iKey>=0x80 ){
66863
- u8 *pEnd = &pIter[7];
66864
- iKey &= 0x7f;
66865
- while(1){
66866
- iKey = (iKey<<7) | (*++pIter & 0x7f);
66867
- if( (*pIter)<0x80 ) break;
66868
- if( pIter>=pEnd ){
66869
- iKey = (iKey<<8) | *++pIter;
66870
- break;
66934
+ u8 x;
66935
+ iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
66936
+ if( x>=0x80 ){
66937
+ iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
66938
+ if( x>=0x80 ){
66939
+ iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66940
+ if( x>=0x80 ){
66941
+ iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66942
+ if( x>=0x80 ){
66943
+ iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66944
+ if( x>=0x80 ){
66945
+ iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66946
+ if( x>=0x80 ){
66947
+ iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66948
+ if( x>=0x80 ){
66949
+ iKey = (iKey<<8) | (*++pIter);
66950
+ }
66951
+ }
66952
+ }
66953
+ }
66954
+ }
6687166955
}
6687266956
}
6687366957
}
6687466958
pIter++;
6687566959
6687666960
pInfo->nKey = *(i64*)&iKey;
6687766961
pInfo->nPayload = nPayload;
6687866962
pInfo->pPayload = pIter;
6687966963
testcase( nPayload==pPage->maxLocal );
66880
- testcase( nPayload==pPage->maxLocal+1 );
66964
+ testcase( nPayload==(u32)pPage->maxLocal+1 );
6688166965
if( nPayload<=pPage->maxLocal ){
6688266966
/* This is the (easy) common case where the entire payload fits
6688366967
** on the local page. No overflow is required.
6688466968
*/
6688566969
pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66912,11 +66996,11 @@
6691266996
pIter++;
6691366997
pInfo->nKey = nPayload;
6691466998
pInfo->nPayload = nPayload;
6691566999
pInfo->pPayload = pIter;
6691667000
testcase( nPayload==pPage->maxLocal );
66917
- testcase( nPayload==pPage->maxLocal+1 );
67001
+ testcase( nPayload==(u32)pPage->maxLocal+1 );
6691867002
if( nPayload<=pPage->maxLocal ){
6691967003
/* This is the (easy) common case where the entire payload fits
6692067004
** on the local page. No overflow is required.
6692167005
*/
6692267006
pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66975,19 +67059,19 @@
6697567059
** past the end of the key value. */
6697667060
pEnd = &pIter[9];
6697767061
while( (*pIter++)&0x80 && pIter<pEnd );
6697867062
}
6697967063
testcase( nSize==pPage->maxLocal );
66980
- testcase( nSize==pPage->maxLocal+1 );
67064
+ testcase( nSize==(u32)pPage->maxLocal+1 );
6698167065
if( nSize<=pPage->maxLocal ){
6698267066
nSize += (u32)(pIter - pCell);
6698367067
if( nSize<4 ) nSize = 4;
6698467068
}else{
6698567069
int minLocal = pPage->minLocal;
6698667070
nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
6698767071
testcase( nSize==pPage->maxLocal );
66988
- testcase( nSize==pPage->maxLocal+1 );
67072
+ testcase( nSize==(u32)pPage->maxLocal+1 );
6698967073
if( nSize>pPage->maxLocal ){
6699067074
nSize = minLocal;
6699167075
}
6699267076
nSize += 4 + (u16)(pIter - pCell);
6699367077
}
@@ -69882,11 +69966,11 @@
6988269966
*/
6988369967
static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
6988469968
int nPage = get4byte(&pPage1->aData[28]);
6988569969
testcase( nPage==0 );
6988669970
if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
69887
- testcase( pBt->nPage!=nPage );
69971
+ testcase( pBt->nPage!=(u32)nPage );
6988869972
pBt->nPage = nPage;
6988969973
}
6989069974
6989169975
/*
6989269976
** Rollback the transaction in progress.
@@ -70903,11 +70987,11 @@
7090370987
if( pCur->iPage ){
7090470988
releasePageNotNull(pCur->pPage);
7090570989
while( --pCur->iPage ){
7090670990
releasePageNotNull(pCur->apPage[pCur->iPage]);
7090770991
}
70908
- pCur->pPage = pCur->apPage[0];
70992
+ pRoot = pCur->pPage = pCur->apPage[0];
7090970993
goto skip_init;
7091070994
}
7091170995
}else if( pCur->pgnoRoot==0 ){
7091270996
pCur->eState = CURSOR_INVALID;
7091370997
return SQLITE_EMPTY;
@@ -70950,11 +71034,10 @@
7095071034
skip_init:
7095171035
pCur->ix = 0;
7095271036
pCur->info.nSize = 0;
7095371037
pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
7095471038
70955
- pRoot = pCur->pPage;
7095671039
if( pRoot->nCell>0 ){
7095771040
pCur->eState = CURSOR_VALID;
7095871041
}else if( !pRoot->leaf ){
7095971042
Pgno subpage;
7096071043
if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
@@ -71191,11 +71274,10 @@
7119171274
assert( pPage->intKey );
7119271275
lwr = 0;
7119371276
upr = pPage->nCell-1;
7119471277
assert( biasRight==0 || biasRight==1 );
7119571278
idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
71196
- pCur->ix = (u16)idx;
7119771279
for(;;){
7119871280
i64 nCellKey;
7119971281
pCell = findCellPastPtr(pPage, idx);
7120071282
if( pPage->intKeyLeaf ){
7120171283
while( 0x80 <= *(pCell++) ){
@@ -71333,11 +71415,10 @@
7133371415
assert( pPage->nCell>0 );
7133471416
assert( pPage->intKey==(pIdxKey==0) );
7133571417
lwr = 0;
7133671418
upr = pPage->nCell-1;
7133771419
idx = upr>>1; /* idx = (lwr+upr)/2; */
71338
- pCur->ix = (u16)idx;
7133971420
for(;;){
7134071421
int nCell; /* Size of the pCell cell in bytes */
7134171422
pCell = findCellPastPtr(pPage, idx);
7134271423
7134371424
/* The maximum supported page-size is 65536 bytes. This means that
@@ -72449,20 +72530,22 @@
7244972530
u8 *ptr; /* Used to move bytes around within data[] */
7245072531
int rc; /* The return code */
7245172532
int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
7245272533
7245372534
if( *pRC ) return;
72454
- assert( idx>=0 && idx<pPage->nCell );
72535
+ assert( idx>=0 );
72536
+ assert( idx<pPage->nCell );
7245572537
assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
7245672538
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
7245772539
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
7245872540
assert( pPage->nFree>=0 );
7245972541
data = pPage->aData;
7246072542
ptr = &pPage->aCellIdx[2*idx];
72543
+ assert( pPage->pBt->usableSize > (u32)(ptr-data) );
7246172544
pc = get2byte(ptr);
7246272545
hdr = pPage->hdrOffset;
72463
- testcase( pc==get2byte(&data[hdr+5]) );
72546
+ testcase( pc==(u32)get2byte(&data[hdr+5]) );
7246472547
testcase( pc+sz==pPage->pBt->usableSize );
7246572548
if( pc+sz > pPage->pBt->usableSize ){
7246672549
*pRC = SQLITE_CORRUPT_BKPT;
7246772550
return;
7246872551
}
@@ -72750,11 +72833,11 @@
7275072833
int k; /* Current slot in pCArray->apEnd[] */
7275172834
u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
7275272835
7275372836
assert( i<iEnd );
7275472837
j = get2byte(&aData[hdr+5]);
72755
- if( NEVER(j>(u32)usableSize) ){ j = 0; }
72838
+ if( j>(u32)usableSize ){ j = 0; }
7275672839
memcpy(&pTmp[j], &aData[j], usableSize - j);
7275772840
7275872841
for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
7275972842
pSrcEnd = pCArray->apEnd[k];
7276072843
@@ -72981,11 +73064,11 @@
7298173064
nCell -= nTail;
7298273065
}
7298373066
7298473067
pData = &aData[get2byteNotZero(&aData[hdr+5])];
7298573068
if( pData<pBegin ) goto editpage_fail;
72986
- if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
73069
+ if( pData>pPg->aDataEnd ) goto editpage_fail;
7298773070
7298873071
/* Add cells to the start of the page */
7298973072
if( iNew<iOld ){
7299073073
int nAdd = MIN(nNew,iOld-iNew);
7299173074
assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -74857,18 +74940,17 @@
7485774940
** but which might be used by alternative storage engines.
7485874941
*/
7485974942
SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
7486074943
Btree *p = pCur->pBtree;
7486174944
BtShared *pBt = p->pBt;
74862
- int rc; /* Return code */
74863
- MemPage *pPage; /* Page to delete cell from */
74864
- unsigned char *pCell; /* Pointer to cell to delete */
74865
- int iCellIdx; /* Index of cell to delete */
74866
- int iCellDepth; /* Depth of node containing pCell */
74867
- CellInfo info; /* Size of the cell being deleted */
74868
- int bSkipnext = 0; /* Leaf cursor in SKIPNEXT state */
74869
- u8 bPreserve = flags & BTREE_SAVEPOSITION; /* Keep cursor valid */
74945
+ int rc; /* Return code */
74946
+ MemPage *pPage; /* Page to delete cell from */
74947
+ unsigned char *pCell; /* Pointer to cell to delete */
74948
+ int iCellIdx; /* Index of cell to delete */
74949
+ int iCellDepth; /* Depth of node containing pCell */
74950
+ CellInfo info; /* Size of the cell being deleted */
74951
+ u8 bPreserve; /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */
7487074952
7487174953
assert( cursorOwnsBtShared(pCur) );
7487274954
assert( pBt->inTransaction==TRANS_WRITE );
7487374955
assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
7487474956
assert( pCur->curFlags & BTCF_WriteFlag );
@@ -74883,22 +74965,35 @@
7488374965
assert( CORRUPT_DB || pCur->eState==CURSOR_VALID );
7488474966
7488574967
iCellDepth = pCur->iPage;
7488674968
iCellIdx = pCur->ix;
7488774969
pPage = pCur->pPage;
74970
+ if( pPage->nCell<=iCellIdx ){
74971
+ return SQLITE_CORRUPT_BKPT;
74972
+ }
7488874973
pCell = findCell(pPage, iCellIdx);
74889
- if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT;
74974
+ if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
74975
+ return SQLITE_CORRUPT_BKPT;
74976
+ }
7489074977
74891
- /* If the bPreserve flag is set to true, then the cursor position must
74978
+ /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
7489274979
** be preserved following this delete operation. If the current delete
7489374980
** will cause a b-tree rebalance, then this is done by saving the cursor
7489474981
** key and leaving the cursor in CURSOR_REQUIRESEEK state before
7489574982
** returning.
7489674983
**
74897
- ** Or, if the current delete will not cause a rebalance, then the cursor
74984
+ ** If the current delete will not cause a rebalance, then the cursor
7489874985
** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately
74899
- ** before or after the deleted entry. In this case set bSkipnext to true. */
74986
+ ** before or after the deleted entry.
74987
+ **
74988
+ ** The bPreserve value records which path is required:
74989
+ **
74990
+ ** bPreserve==0 Not necessary to save the cursor position
74991
+ ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position
74992
+ ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT.
74993
+ */
74994
+ bPreserve = (flags & BTREE_SAVEPOSITION)!=0;
7490074995
if( bPreserve ){
7490174996
if( !pPage->leaf
7490274997
|| (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)
7490374998
|| pPage->nCell==1 /* See dbfuzz001.test for a test case */
7490474999
){
@@ -74905,11 +75000,11 @@
7490575000
/* A b-tree rebalance will be required after deleting this entry.
7490675001
** Save the cursor key. */
7490775002
rc = saveCursorKey(pCur);
7490875003
if( rc ) return rc;
7490975004
}else{
74910
- bSkipnext = 1;
75005
+ bPreserve = 2;
7491175006
}
7491275007
}
7491375008
7491475009
/* If the page containing the entry to delete is not a leaf page, move
7491575010
** the cursor to the largest entry in the tree that is smaller than
@@ -75005,12 +75100,12 @@
7500575100
pCur->pPage = pCur->apPage[pCur->iPage];
7500675101
rc = balance(pCur);
7500775102
}
7500875103
7500975104
if( rc==SQLITE_OK ){
75010
- if( bSkipnext ){
75011
- assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
75105
+ if( bPreserve>1 ){
75106
+ assert( (pCur->iPage==iCellDepth || CORRUPT_DB) );
7501275107
assert( pPage==pCur->pPage || CORRUPT_DB );
7501375108
assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
7501475109
pCur->eState = CURSOR_SKIPNEXT;
7501575110
if( iCellIdx>=pPage->nCell ){
7501675111
pCur->skipNext = -1;
@@ -81704,12 +81799,10 @@
8170481799
*/
8170581800
SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
8170681801
if( pCx==0 ){
8170781802
return;
8170881803
}
81709
- assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE );
81710
- assert( pCx->pBtx==0 || pCx->isEphemeral );
8171181804
switch( pCx->eCurType ){
8171281805
case CURTYPE_SORTER: {
8171381806
sqlite3VdbeSorterClose(p->db, pCx);
8171481807
break;
8171581808
}
@@ -82807,11 +82900,11 @@
8280782900
VdbeCursor *p = *pp;
8280882901
assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
8280982902
if( p->deferredMoveto ){
8281082903
u32 iMap;
8281182904
assert( !p->isEphemeral );
82812
- if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
82905
+ if( p->ub.aAltMap && (iMap = p->ub.aAltMap[1+*piCol])>0 && !p->nullRow ){
8281382906
*pp = p->pAltCursor;
8281482907
*piCol = iMap - 1;
8281582908
return SQLITE_OK;
8281682909
}
8281782910
return sqlite3VdbeFinishMoveto(p);
@@ -83085,18 +83178,18 @@
8308583178
#define FOUR_BYTE_UINT(x) (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
8308683179
#define FOUR_BYTE_INT(x) (16777216*(i8)((x)[0])|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
8308783180
8308883181
/*
8308983182
** Deserialize the data blob pointed to by buf as serial type serial_type
83090
-** and store the result in pMem. Return the number of bytes read.
83183
+** and store the result in pMem.
8309183184
**
8309283185
** This function is implemented as two separate routines for performance.
8309383186
** The few cases that require local variables are broken out into a separate
8309483187
** routine so that in most cases the overhead of moving the stack pointer
8309583188
** is avoided.
8309683189
*/
83097
-static u32 serialGet(
83190
+static void serialGet(
8309883191
const unsigned char *buf, /* Buffer to deserialize from */
8309983192
u32 serial_type, /* Serial type to deserialize */
8310083193
Mem *pMem /* Memory cell to write value into */
8310183194
){
8310283195
u64 x = FOUR_BYTE_UINT(buf);
@@ -83126,13 +83219,12 @@
8312683219
assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
8312783220
swapMixedEndianFloat(x);
8312883221
memcpy(&pMem->u.r, &x, sizeof(x));
8312983222
pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
8313083223
}
83131
- return 8;
8313283224
}
83133
-SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
83225
+SQLITE_PRIVATE void sqlite3VdbeSerialGet(
8313483226
const unsigned char *buf, /* Buffer to deserialize from */
8313583227
u32 serial_type, /* Serial type to deserialize */
8313683228
Mem *pMem /* Memory cell to write value into */
8313783229
){
8313883230
switch( serial_type ){
@@ -83139,41 +83231,41 @@
8313983231
case 10: { /* Internal use only: NULL with virtual table
8314083232
** UPDATE no-change flag set */
8314183233
pMem->flags = MEM_Null|MEM_Zero;
8314283234
pMem->n = 0;
8314383235
pMem->u.nZero = 0;
83144
- break;
83236
+ return;
8314583237
}
8314683238
case 11: /* Reserved for future use */
8314783239
case 0: { /* Null */
8314883240
/* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
8314983241
pMem->flags = MEM_Null;
83150
- break;
83242
+ return;
8315183243
}
8315283244
case 1: {
8315383245
/* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
8315483246
** integer. */
8315583247
pMem->u.i = ONE_BYTE_INT(buf);
8315683248
pMem->flags = MEM_Int;
8315783249
testcase( pMem->u.i<0 );
83158
- return 1;
83250
+ return;
8315983251
}
8316083252
case 2: { /* 2-byte signed integer */
8316183253
/* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
8316283254
** twos-complement integer. */
8316383255
pMem->u.i = TWO_BYTE_INT(buf);
8316483256
pMem->flags = MEM_Int;
8316583257
testcase( pMem->u.i<0 );
83166
- return 2;
83258
+ return;
8316783259
}
8316883260
case 3: { /* 3-byte signed integer */
8316983261
/* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
8317083262
** twos-complement integer. */
8317183263
pMem->u.i = THREE_BYTE_INT(buf);
8317283264
pMem->flags = MEM_Int;
8317383265
testcase( pMem->u.i<0 );
83174
- return 3;
83266
+ return;
8317583267
}
8317683268
case 4: { /* 4-byte signed integer */
8317783269
/* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
8317883270
** twos-complement integer. */
8317983271
pMem->u.i = FOUR_BYTE_INT(buf);
@@ -83181,33 +83273,34 @@
8318183273
/* Work around a sign-extension bug in the HP compiler for HP/UX */
8318283274
if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;
8318383275
#endif
8318483276
pMem->flags = MEM_Int;
8318583277
testcase( pMem->u.i<0 );
83186
- return 4;
83278
+ return;
8318783279
}
8318883280
case 5: { /* 6-byte signed integer */
8318983281
/* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
8319083282
** twos-complement integer. */
8319183283
pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
8319283284
pMem->flags = MEM_Int;
8319383285
testcase( pMem->u.i<0 );
83194
- return 6;
83286
+ return;
8319583287
}
8319683288
case 6: /* 8-byte signed integer */
8319783289
case 7: { /* IEEE floating point */
8319883290
/* These use local variables, so do them in a separate routine
8319983291
** to avoid having to move the frame pointer in the common case */
83200
- return serialGet(buf,serial_type,pMem);
83292
+ serialGet(buf,serial_type,pMem);
83293
+ return;
8320183294
}
8320283295
case 8: /* Integer 0 */
8320383296
case 9: { /* Integer 1 */
8320483297
/* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
8320583298
/* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
8320683299
pMem->u.i = serial_type-8;
8320783300
pMem->flags = MEM_Int;
83208
- return 0;
83301
+ return;
8320983302
}
8321083303
default: {
8321183304
/* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
8321283305
** length.
8321383306
** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
@@ -83214,14 +83307,14 @@
8321483307
** (N-13)/2 bytes in length. */
8321583308
static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
8321683309
pMem->z = (char *)buf;
8321783310
pMem->n = (serial_type-12)/2;
8321883311
pMem->flags = aFlag[serial_type&1];
83219
- return pMem->n;
83312
+ return;
8322083313
}
8322183314
}
83222
- return 0;
83315
+ return;
8322383316
}
8322483317
/*
8322583318
** This routine is used to allocate sufficient space for an UnpackedRecord
8322683319
** structure large enough to be used with sqlite3VdbeRecordUnpack() if
8322783320
** the first argument is a pointer to KeyInfo structure pKeyInfo.
@@ -83280,11 +83373,12 @@
8328083373
pMem->enc = pKeyInfo->enc;
8328183374
pMem->db = pKeyInfo->db;
8328283375
/* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
8328383376
pMem->szMalloc = 0;
8328483377
pMem->z = 0;
83285
- d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
83378
+ sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
83379
+ d += sqlite3VdbeSerialTypeLen(serial_type);
8328683380
pMem++;
8328783381
if( (++u)>=p->nField ) break;
8328883382
}
8328983383
if( d>(u32)nKey && u ){
8329083384
assert( CORRUPT_DB );
@@ -83364,11 +83458,12 @@
8336483458
break;
8336583459
}
8336683460
8336783461
/* Extract the values to be compared.
8336883462
*/
83369
- d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
83463
+ sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
83464
+ d1 += sqlite3VdbeSerialTypeLen(serial_type1);
8337083465
8337183466
/* Do the comparison
8337283467
*/
8337383468
rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
8337483469
pKeyInfo->nAllField>i ? pKeyInfo->aColl[i] : 0);
@@ -84168,11 +84263,11 @@
8416884263
}
8416984264
8417084265
/* The index entry must begin with a header size */
8417184266
getVarint32NR((u8*)m.z, szHdr);
8417284267
testcase( szHdr==3 );
84173
- testcase( szHdr==m.n );
84268
+ testcase( szHdr==(u32)m.n );
8417484269
testcase( szHdr>0x7fffffff );
8417584270
assert( m.n>=0 );
8417684271
if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
8417784272
goto idx_rowid_corruption;
8417884273
}
@@ -87006,11 +87101,10 @@
8700687101
*/
8700787102
static VdbeCursor *allocateCursor(
8700887103
Vdbe *p, /* The virtual machine */
8700987104
int iCur, /* Index of the new VdbeCursor */
8701087105
int nField, /* Number of fields in the table or index */
87011
- int iDb, /* Database the cursor belongs to, or -1 */
8701287106
u8 eCurType /* Type of the new cursor */
8701387107
){
8701487108
/* Find the memory cell that will be used to store the blob of memory
8701587109
** required for this VdbeCursor structure. It is convenient to use a
8701687110
** vdbe memory cell to manage the memory allocation required for a
@@ -87063,11 +87157,10 @@
8706387157
}
8706487158
8706587159
p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
8706687160
memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
8706787161
pCx->eCurType = eCurType;
87068
- pCx->iDb = iDb;
8706987162
pCx->nField = nField;
8707087163
pCx->aOffset = &pCx->aType[nField];
8707187164
if( eCurType==CURTYPE_BTREE ){
8707287165
pCx->uc.pCursor = (BtCursor*)
8707387166
&pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
@@ -87446,11 +87539,10 @@
8744687539
int i, mx;
8744787540
u64 h = 0;
8744887541
8744987542
i = pOp->p3;
8745087543
assert( pOp->p4type==P4_INT32 );
87451
- mx = i + pOp->p4.i;
8745287544
for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
8745387545
const Mem *p = &aMem[i];
8745487546
if( p->flags & (MEM_Int|MEM_IntReal) ){
8745587547
h += p->u.i;
8745687548
}else if( p->flags & MEM_Real ){
@@ -89458,10 +89550,11 @@
8945889550
pDest = &aMem[pOp->p3];
8945989551
memAboutToChange(p, pDest);
8946089552
assert( pC!=0 );
8946189553
assert( p2<(u32)pC->nField );
8946289554
aOffset = pC->aOffset;
89555
+ assert( aOffset==pC->aType+pC->nField );
8946389556
assert( pC->eCurType!=CURTYPE_VTAB );
8946489557
assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );
8946589558
assert( pC->eCurType!=CURTYPE_SORTER );
8946689559
8946789560
if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
@@ -90607,10 +90700,11 @@
9060790700
rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);
9060890701
if( pOp->p2==BTREE_SCHEMA_VERSION ){
9060990702
/* When the schema cookie changes, record the new cookie internally */
9061090703
pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5;
9061190704
db->mDbFlags |= DBFLAG_SchemaChange;
90705
+ sqlite3FkClearTriggerCache(db, pOp->p1);
9061290706
}else if( pOp->p2==BTREE_FILE_FORMAT ){
9061390707
/* Record changes in the file format */
9061490708
pDb->pSchema->file_format = pOp->p3;
9061590709
}
9061690710
if( pOp->p1==1 ){
@@ -90784,12 +90878,13 @@
9078490878
nField = pOp->p4.i;
9078590879
}
9078690880
assert( pOp->p1>=0 );
9078790881
assert( nField>=0 );
9078890882
testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */
90789
- pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE);
90883
+ pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_BTREE);
9079090884
if( pCur==0 ) goto no_mem;
90885
+ pCur->iDb = iDb;
9079190886
pCur->nullRow = 1;
9079290887
pCur->isOrdered = 1;
9079390888
pCur->pgnoRoot = p2;
9079490889
#ifdef SQLITE_DEBUG
9079590890
pCur->wrFlag = wrFlag;
@@ -90827,22 +90922,22 @@
9082790922
9082890923
pOrig = p->apCsr[pOp->p2];
9082990924
assert( pOrig );
9083090925
assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */
9083190926
90832
- pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE);
90927
+ pCx = allocateCursor(p, pOp->p1, pOrig->nField, CURTYPE_BTREE);
9083390928
if( pCx==0 ) goto no_mem;
9083490929
pCx->nullRow = 1;
9083590930
pCx->isEphemeral = 1;
9083690931
pCx->pKeyInfo = pOrig->pKeyInfo;
9083790932
pCx->isTable = pOrig->isTable;
9083890933
pCx->pgnoRoot = pOrig->pgnoRoot;
9083990934
pCx->isOrdered = pOrig->isOrdered;
90840
- pCx->pBtx = pOrig->pBtx;
90935
+ pCx->ub.pBtx = pOrig->ub.pBtx;
9084190936
pCx->hasBeenDuped = 1;
9084290937
pOrig->hasBeenDuped = 1;
90843
- rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
90938
+ rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
9084490939
pCx->pKeyInfo, pCx->uc.pCursor);
9084590940
/* The sqlite3BtreeCursor() routine can only fail for the first cursor
9084690941
** opened for a database. Since there is already an open cursor when this
9084790942
** opcode is run, the sqlite3BtreeCursor() cannot fail */
9084890943
assert( rc==SQLITE_OK );
@@ -90911,48 +91006,48 @@
9091191006
** OP_OpenDup, then erase all existing content so that the table is
9091291007
** empty again, rather than creating a new table. */
9091391008
assert( pCx->isEphemeral );
9091491009
pCx->seqCount = 0;
9091591010
pCx->cacheStatus = CACHE_STALE;
90916
- rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
91011
+ rc = sqlite3BtreeClearTable(pCx->ub.pBtx, pCx->pgnoRoot, 0);
9091791012
}else{
90918
- pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
91013
+ pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_BTREE);
9091991014
if( pCx==0 ) goto no_mem;
9092091015
pCx->isEphemeral = 1;
90921
- rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx,
91016
+ rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->ub.pBtx,
9092291017
BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
9092391018
vfsFlags);
9092491019
if( rc==SQLITE_OK ){
90925
- rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
91020
+ rc = sqlite3BtreeBeginTrans(pCx->ub.pBtx, 1, 0);
9092691021
if( rc==SQLITE_OK ){
9092791022
/* If a transient index is required, create it by calling
9092891023
** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before
9092991024
** opening it. If a transient table is required, just use the
9093091025
** automatically created table with root-page 1 (an BLOB_INTKEY table).
9093191026
*/
9093291027
if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
9093391028
assert( pOp->p4type==P4_KEYINFO );
90934
- rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
91029
+ rc = sqlite3BtreeCreateTable(pCx->ub.pBtx, &pCx->pgnoRoot,
9093591030
BTREE_BLOBKEY | pOp->p5);
9093691031
if( rc==SQLITE_OK ){
9093791032
assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
9093891033
assert( pKeyInfo->db==db );
9093991034
assert( pKeyInfo->enc==ENC(db) );
90940
- rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
91035
+ rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
9094191036
pKeyInfo, pCx->uc.pCursor);
9094291037
}
9094391038
pCx->isTable = 0;
9094491039
}else{
9094591040
pCx->pgnoRoot = SCHEMA_ROOT;
90946
- rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR,
91041
+ rc = sqlite3BtreeCursor(pCx->ub.pBtx, SCHEMA_ROOT, BTREE_WRCSR,
9094791042
0, pCx->uc.pCursor);
9094891043
pCx->isTable = 1;
9094991044
}
9095091045
}
9095191046
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
9095291047
if( rc ){
90953
- sqlite3BtreeClose(pCx->pBtx);
91048
+ sqlite3BtreeClose(pCx->ub.pBtx);
9095491049
}
9095591050
}
9095691051
}
9095791052
if( rc ) goto abort_due_to_error;
9095891053
pCx->nullRow = 1;
@@ -90972,11 +91067,11 @@
9097291067
case OP_SorterOpen: {
9097391068
VdbeCursor *pCx;
9097491069
9097591070
assert( pOp->p1>=0 );
9097691071
assert( pOp->p2>=0 );
90977
- pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER);
91072
+ pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_SORTER);
9097891073
if( pCx==0 ) goto no_mem;
9097991074
pCx->pKeyInfo = pOp->p4.pKeyInfo;
9098091075
assert( pCx->pKeyInfo->db==db );
9098191076
assert( pCx->pKeyInfo->enc==ENC(db) );
9098291077
rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);
@@ -91021,11 +91116,11 @@
9102191116
case OP_OpenPseudo: {
9102291117
VdbeCursor *pCx;
9102391118
9102491119
assert( pOp->p1>=0 );
9102591120
assert( pOp->p3>=0 );
91026
- pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);
91121
+ pCx = allocateCursor(p, pOp->p1, pOp->p3, CURTYPE_PSEUDO);
9102791122
if( pCx==0 ) goto no_mem;
9102891123
pCx->nullRow = 1;
9102991124
pCx->seekResult = pOp->p2;
9103091125
pCx->isTable = 1;
9103191126
/* Give this pseudo-cursor a fake BtCursor pointer so that pCx
@@ -92961,13 +93056,13 @@
9296193056
assert( pTabCur->isTable );
9296293057
pTabCur->nullRow = 0;
9296393058
pTabCur->movetoTarget = rowid;
9296493059
pTabCur->deferredMoveto = 1;
9296593060
assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );
92966
- pTabCur->aAltMap = pOp->p4.ai;
92967
- assert( !pC->isEphemeral );
9296893061
assert( !pTabCur->isEphemeral );
93062
+ pTabCur->ub.aAltMap = pOp->p4.ai;
93063
+ assert( !pC->isEphemeral );
9296993064
pTabCur->pAltCursor = pC;
9297093065
}else{
9297193066
pOut = out2Prerelease(p, pOp);
9297293067
pOut->u.i = rowid;
9297393068
}
@@ -94485,11 +94580,11 @@
9448594580
9448694581
/* Initialize sqlite3_vtab_cursor base class */
9448794582
pVCur->pVtab = pVtab;
9448894583
9448994584
/* Initialize vdbe cursor object */
94490
- pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);
94585
+ pCur = allocateCursor(p, pOp->p1, 0, CURTYPE_VTAB);
9449194586
if( pCur ){
9449294587
pCur->uc.pVCur = pVCur;
9449394588
pVtab->nRef++;
9449494589
}else{
9449594590
assert( db->mallocFailed );
@@ -96810,11 +96905,12 @@
9681096905
if( nWorker>=SORTER_MAX_MERGE_COUNT ){
9681196906
nWorker = SORTER_MAX_MERGE_COUNT-1;
9681296907
}
9681396908
#endif
9681496909
96815
- assert( pCsr->pKeyInfo && pCsr->pBtx==0 );
96910
+ assert( pCsr->pKeyInfo );
96911
+ assert( !pCsr->isEphemeral );
9681696912
assert( pCsr->eCurType==CURTYPE_SORTER );
9681796913
szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
9681896914
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
9681996915
9682096916
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
@@ -99310,11 +99406,11 @@
9931099406
if( size==0 ){
9931199407
memjrnlFreeChunks(p->pFirst);
9931299408
p->pFirst = 0;
9931399409
}else{
9931499410
i64 iOff = p->nChunkSize;
99315
- for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){
99411
+ for(pIter=p->pFirst; ALWAYS(pIter) && iOff<size; pIter=pIter->pNext){
9931699412
iOff += p->nChunkSize;
9931799413
}
9931899414
if( ALWAYS(pIter) ){
9931999415
memjrnlFreeChunks(pIter->pNext);
9932099416
pIter->pNext = 0;
@@ -100064,12 +100160,13 @@
100064100160
hit = 1;
100065100161
}
100066100162
}
100067100163
if( hit || zTab==0 ) continue;
100068100164
}
100069
- if( zDb && pTab->pSchema!=pSchema ){
100070
- continue;
100165
+ if( zDb ){
100166
+ if( pTab->pSchema!=pSchema ) continue;
100167
+ if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue;
100071100168
}
100072100169
if( zTab ){
100073100170
const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
100074100171
assert( zTabName!=0 );
100075100172
if( sqlite3StrICmp(zTabName, zTab)!=0 ){
@@ -100196,10 +100293,11 @@
100196100293
{
100197100294
assert( ExprUseYTab(pExpr) );
100198100295
pExpr->y.pTab = pTab;
100199100296
if( pParse->bReturning ){
100200100297
eNewExprOp = TK_REGISTER;
100298
+ pExpr->op2 = TK_COLUMN;
100201100299
pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable +
100202100300
sqlite3TableColumnToStorage(pTab, iCol) + 1;
100203100301
}else{
100204100302
pExpr->iColumn = (i16)iCol;
100205100303
eNewExprOp = TK_TRIGGER;
@@ -109275,11 +109373,10 @@
109275109373
sqlite3 *db, /* Database handle */
109276109374
const char *zSql, /* SQL to parse */
109277109375
int bTemp /* True if SQL is from temp schema */
109278109376
){
109279109377
int rc;
109280
- char *zErr = 0;
109281109378
109282109379
db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
109283109380
109284109381
/* Parse the SQL statement passed as the first argument. If no error
109285109382
** occurs and the parse does not result in a new table, index or
@@ -109286,14 +109383,11 @@
109286109383
** trigger object, the database must be corrupt. */
109287109384
memset(p, 0, sizeof(Parse));
109288109385
p->eParseMode = PARSE_MODE_RENAME;
109289109386
p->db = db;
109290109387
p->nQueryLoop = 1;
109291
- rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
109292
- assert( p->zErrMsg==0 );
109293
- assert( rc!=SQLITE_OK || zErr==0 );
109294
- p->zErrMsg = zErr;
109388
+ rc = zSql ? sqlite3RunParser(p, zSql) : SQLITE_NOMEM;
109295109389
if( db->mallocFailed ) rc = SQLITE_NOMEM;
109296109390
if( rc==SQLITE_OK
109297109391
&& p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
109298109392
){
109299109393
rc = SQLITE_CORRUPT_BKPT;
@@ -113359,11 +113453,11 @@
113359113453
Returning *pReturning = pParse->u1.pReturning;
113360113454
int addrRewind;
113361113455
int i;
113362113456
int reg;
113363113457
113364
- if( pReturning->nRetCol==0 ){
113458
+ if( NEVER(pReturning->nRetCol==0) ){
113365113459
assert( CORRUPT_DB );
113366113460
}else{
113367113461
sqlite3VdbeAddOp0(v, OP_FkCheck);
113368113462
addrRewind =
113369113463
sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
@@ -113455,11 +113549,11 @@
113455113549
}
113456113550
}
113457113551
113458113552
if( pParse->bReturning ){
113459113553
Returning *pRet = pParse->u1.pReturning;
113460
- if( pRet->nRetCol==0 ){
113554
+ if( NEVER(pRet->nRetCol==0) ){
113461113555
assert( CORRUPT_DB );
113462113556
}else{
113463113557
sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
113464113558
}
113465113559
}
@@ -113496,11 +113590,10 @@
113496113590
** built-in function.
113497113591
*/
113498113592
SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
113499113593
va_list ap;
113500113594
char *zSql;
113501
- char *zErrMsg = 0;
113502113595
sqlite3 *db = pParse->db;
113503113596
u32 savedDbFlags = db->mDbFlags;
113504113597
char saveBuf[PARSE_TAIL_SZ];
113505113598
113506113599
if( pParse->nErr ) return;
@@ -113518,13 +113611,12 @@
113518113611
}
113519113612
pParse->nested++;
113520113613
memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
113521113614
memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
113522113615
db->mDbFlags |= DBFLAG_PreferBuiltin;
113523
- sqlite3RunParser(pParse, zSql, &zErrMsg);
113616
+ sqlite3RunParser(pParse, zSql);
113524113617
db->mDbFlags = savedDbFlags;
113525
- sqlite3DbFree(db, zErrMsg);
113526113618
sqlite3DbFree(db, zSql);
113527113619
memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
113528113620
pParse->nested--;
113529113621
}
113530113622
@@ -119179,11 +119271,10 @@
119179119271
for(i=0; i<nDef; i++){
119180119272
FuncDef *pOther;
119181119273
const char *zName = aDef[i].zName;
119182119274
int nName = sqlite3Strlen30(zName);
119183119275
int h = SQLITE_FUNC_HASH(zName[0], nName);
119184
- assert( zName[0]>='a' && zName[0]<='z' );
119185119276
assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN );
119186119277
pOther = sqlite3FunctionSearch(h, zName);
119187119278
if( pOther ){
119188119279
assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
119189119280
aDef[i].pNext = pOther->pNext;
@@ -120442,10 +120533,21 @@
120442120533
** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT,
120443120534
** SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. */
120444120535
sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
120445120536
}
120446120537
120538
+/* subtype(X)
120539
+**
120540
+** Return the subtype of X
120541
+*/
120542
+static void subtypeFunc(
120543
+ sqlite3_context *context,
120544
+ int argc,
120545
+ sqlite3_value **argv
120546
+){
120547
+ sqlite3_result_int(context, sqlite3_value_subtype(argv[0]));
120548
+}
120447120549
120448120550
/*
120449120551
** Implementation of the length() function
120450120552
*/
120451120553
static void lengthFunc(
@@ -120603,11 +120705,11 @@
120603120705
sqlite3_result_error_nomem(context);
120604120706
goto endInstr;
120605120707
}
120606120708
120607120709
/*
120608
-** Implementation of the printf() function.
120710
+** Implementation of the printf() (a.k.a. format()) SQL function.
120609120711
*/
120610120712
static void printfFunc(
120611120713
sqlite3_context *context,
120612120714
int argc,
120613120715
sqlite3_value **argv
@@ -121372,87 +121474,95 @@
121372121474
'0', '1', '2', '3', '4', '5', '6', '7',
121373121475
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
121374121476
};
121375121477
121376121478
/*
121377
-** Implementation of the QUOTE() function. This function takes a single
121378
-** argument. If the argument is numeric, the return value is the same as
121379
-** the argument. If the argument is NULL, the return value is the string
121380
-** "NULL". Otherwise, the argument is enclosed in single quotes with
121381
-** single-quote escapes.
121479
+** Append to pStr text that is the SQL literal representation of the
121480
+** value contained in pValue.
121382121481
*/
121383
-static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
121384
- assert( argc==1 );
121385
- UNUSED_PARAMETER(argc);
121386
- switch( sqlite3_value_type(argv[0]) ){
121482
+SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){
121483
+ /* As currently implemented, the string must be initially empty.
121484
+ ** we might relax this requirement in the future, but that will
121485
+ ** require enhancements to the implementation. */
121486
+ assert( pStr!=0 && pStr->nChar==0 );
121487
+
121488
+ switch( sqlite3_value_type(pValue) ){
121387121489
case SQLITE_FLOAT: {
121388121490
double r1, r2;
121389
- char zBuf[50];
121390
- r1 = sqlite3_value_double(argv[0]);
121391
- sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1);
121392
- sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);
121393
- if( r1!=r2 ){
121394
- sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1);
121395
- }
121396
- sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
121491
+ const char *zVal;
121492
+ r1 = sqlite3_value_double(pValue);
121493
+ sqlite3_str_appendf(pStr, "%!.15g", r1);
121494
+ zVal = sqlite3_str_value(pStr);
121495
+ if( zVal ){
121496
+ sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8);
121497
+ if( r1!=r2 ){
121498
+ sqlite3_str_reset(pStr);
121499
+ sqlite3_str_appendf(pStr, "%!.20e", r1);
121500
+ }
121501
+ }
121397121502
break;
121398121503
}
121399121504
case SQLITE_INTEGER: {
121400
- sqlite3_result_value(context, argv[0]);
121505
+ sqlite3_str_appendf(pStr, "%lld", sqlite3_value_int64(pValue));
121401121506
break;
121402121507
}
121403121508
case SQLITE_BLOB: {
121404
- char *zText = 0;
121405
- char const *zBlob = sqlite3_value_blob(argv[0]);
121406
- int nBlob = sqlite3_value_bytes(argv[0]);
121407
- assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */
121408
- zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4);
121409
- if( zText ){
121509
+ char const *zBlob = sqlite3_value_blob(pValue);
121510
+ int nBlob = sqlite3_value_bytes(pValue);
121511
+ assert( zBlob==sqlite3_value_blob(pValue) ); /* No encoding change */
121512
+ sqlite3StrAccumEnlarge(pStr, nBlob*2 + 4);
121513
+ if( pStr->accError==0 ){
121514
+ char *zText = pStr->zText;
121410121515
int i;
121411121516
for(i=0; i<nBlob; i++){
121412121517
zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];
121413121518
zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];
121414121519
}
121415121520
zText[(nBlob*2)+2] = '\'';
121416121521
zText[(nBlob*2)+3] = '\0';
121417121522
zText[0] = 'X';
121418121523
zText[1] = '\'';
121419
- sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);
121420
- sqlite3_free(zText);
121524
+ pStr->nChar = nBlob*2 + 3;
121421121525
}
121422121526
break;
121423121527
}
121424121528
case SQLITE_TEXT: {
121425
- int i,j;
121426
- u64 n;
121427
- const unsigned char *zArg = sqlite3_value_text(argv[0]);
121428
- char *z;
121429
-
121430
- if( zArg==0 ) return;
121431
- for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
121432
- z = contextMalloc(context, ((i64)i)+((i64)n)+3);
121433
- if( z ){
121434
- z[0] = '\'';
121435
- for(i=0, j=1; zArg[i]; i++){
121436
- z[j++] = zArg[i];
121437
- if( zArg[i]=='\'' ){
121438
- z[j++] = '\'';
121439
- }
121440
- }
121441
- z[j++] = '\'';
121442
- z[j] = 0;
121443
- sqlite3_result_text(context, z, j, sqlite3_free);
121444
- }
121529
+ const unsigned char *zArg = sqlite3_value_text(pValue);
121530
+ sqlite3_str_appendf(pStr, "%Q", zArg);
121445121531
break;
121446121532
}
121447121533
default: {
121448
- assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
121449
- sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC);
121534
+ assert( sqlite3_value_type(pValue)==SQLITE_NULL );
121535
+ sqlite3_str_append(pStr, "NULL", 4);
121450121536
break;
121451121537
}
121452121538
}
121453121539
}
121540
+
121541
+/*
121542
+** Implementation of the QUOTE() function.
121543
+**
121544
+** The quote(X) function returns the text of an SQL literal which is the
121545
+** value of its argument suitable for inclusion into an SQL statement.
121546
+** Strings are surrounded by single-quotes with escapes on interior quotes
121547
+** as needed. BLOBs are encoded as hexadecimal literals. Strings with
121548
+** embedded NUL characters cannot be represented as string literals in SQL
121549
+** and hence the returned string literal is truncated prior to the first NUL.
121550
+*/
121551
+static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
121552
+ sqlite3_str str;
121553
+ sqlite3 *db = sqlite3_context_db_handle(context);
121554
+ assert( argc==1 );
121555
+ UNUSED_PARAMETER(argc);
121556
+ sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
121557
+ sqlite3QuoteValue(&str,argv[0]);
121558
+ sqlite3_result_text(context, sqlite3StrAccumFinish(&str), str.nChar,
121559
+ SQLITE_DYNAMIC);
121560
+ if( str.accError==SQLITE_NOMEM ){
121561
+ sqlite3_result_error_nomem(context);
121562
+ }
121563
+}
121454121564
121455121565
/*
121456121566
** The unicode() function. Return the integer unicode code-point value
121457121567
** for the first character of the input string.
121458121568
*/
@@ -122583,13 +122693,15 @@
122583122693
FUNCTION(max, -1, 1, 1, minmaxFunc ),
122584122694
FUNCTION(max, 0, 1, 1, 0 ),
122585122695
WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
122586122696
SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
122587122697
FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
122698
+ FUNCTION2(subtype, 1, 0, 0, subtypeFunc, SQLITE_FUNC_TYPEOF),
122588122699
FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH),
122589122700
FUNCTION(instr, 2, 0, 0, instrFunc ),
122590122701
FUNCTION(printf, -1, 0, 0, printfFunc ),
122702
+ FUNCTION(format, -1, 0, 0, printfFunc ),
122591122703
FUNCTION(unicode, 1, 0, 0, unicodeFunc ),
122592122704
FUNCTION(char, -1, 0, 0, charFunc ),
122593122705
FUNCTION(abs, 1, 0, 0, absFunc ),
122594122706
#ifndef SQLITE_OMIT_FLOATING_POINT
122595122707
FUNCTION(round, 1, 0, 0, roundFunc ),
@@ -122684,10 +122796,11 @@
122684122796
#ifndef SQLITE_OMIT_ALTERTABLE
122685122797
sqlite3AlterFunctions();
122686122798
#endif
122687122799
sqlite3WindowFunctions();
122688122800
sqlite3RegisterDateTimeFunctions();
122801
+ sqlite3RegisterJsonFunctions();
122689122802
sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc));
122690122803
122691122804
#if 0 /* Enable to print out how the built-in functions are hashed */
122692122805
{
122693122806
int i;
@@ -123409,10 +123522,29 @@
123409123522
sqlite3SelectDelete(dbMem, pStep->pSelect);
123410123523
sqlite3ExprDelete(dbMem, p->pWhen);
123411123524
sqlite3DbFree(dbMem, p);
123412123525
}
123413123526
}
123527
+
123528
+/*
123529
+** Clear the apTrigger[] cache of CASCADE triggers for all foreign keys
123530
+** in a particular database. This needs to happen when the schema
123531
+** changes.
123532
+*/
123533
+SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3 *db, int iDb){
123534
+ HashElem *k;
123535
+ Hash *pHash = &db->aDb[iDb].pSchema->tblHash;
123536
+ for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k)){
123537
+ Table *pTab = sqliteHashData(k);
123538
+ FKey *pFKey;
123539
+ if( !IsOrdinaryTable(pTab) ) continue;
123540
+ for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){
123541
+ fkTriggerDelete(db, pFKey->apTrigger[0]); pFKey->apTrigger[0] = 0;
123542
+ fkTriggerDelete(db, pFKey->apTrigger[1]); pFKey->apTrigger[1] = 0;
123543
+ }
123544
+ }
123545
+}
123414123546
123415123547
/*
123416123548
** This function is called to generate code that runs when table pTab is
123417123549
** being dropped from the database. The SrcList passed as the second argument
123418123550
** to this function contains a single entry guaranteed to resolve to
@@ -124210,11 +124342,11 @@
124210124342
sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol);
124211124343
VdbeComment((v, "%s", pTab->zName));
124212124344
}else{
124213124345
Index *pPk = sqlite3PrimaryKeyIndex(pTab);
124214124346
assert( pPk!=0 );
124215
- assert( pPk->tnum==pTab->tnum );
124347
+ assert( pPk->tnum==pTab->tnum || CORRUPT_DB );
124216124348
sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb);
124217124349
sqlite3VdbeSetP4KeyInfo(pParse, pPk);
124218124350
VdbeComment((v, "%s", pTab->zName));
124219124351
}
124220124352
}
@@ -126174,10 +126306,11 @@
126174126306
** the UNIQUE constraints have run.
126175126307
*/
126176126308
if( onError==OE_Replace /* IPK rule is REPLACE */
126177126309
&& onError!=overrideError /* Rules for other constraints are different */
126178126310
&& pTab->pIndex /* There exist other constraints */
126311
+ && !upsertIpkDelay /* IPK check already deferred by UPSERT */
126179126312
){
126180126313
ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
126181126314
VdbeComment((v, "defer IPK REPLACE until last"));
126182126315
}
126183126316
@@ -126582,10 +126715,11 @@
126582126715
126583126716
/* If the IPK constraint is a REPLACE, run it last */
126584126717
if( ipkTop ){
126585126718
sqlite3VdbeGoto(v, ipkTop);
126586126719
VdbeComment((v, "Do IPK REPLACE"));
126720
+ assert( ipkBottom>0 );
126587126721
sqlite3VdbeJumpHere(v, ipkBottom);
126588126722
}
126589126723
126590126724
/* Recheck all uniqueness constraints after replace triggers have run */
126591126725
testcase( regTrigCnt!=0 && nReplaceTrig==0 );
@@ -126712,11 +126846,10 @@
126712126846
sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
126713126847
VdbeCoverage(v);
126714126848
}
126715126849
pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
126716126850
if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
126717
- assert( pParse->nested==0 );
126718126851
pik_flags |= OPFLAG_NCHANGE;
126719126852
pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
126720126853
if( update_flags==0 ){
126721126854
codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
126722126855
}
@@ -127802,10 +127935,12 @@
127802127935
sqlite3_int64 (*total_changes64)(sqlite3*);
127803127936
/* Version 3.37.0 and later */
127804127937
int (*autovacuum_pages)(sqlite3*,
127805127938
unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
127806127939
void*, void(*)(void*));
127940
+ /* Version 3.38.0 and later */
127941
+ int (*error_offset)(sqlite3*);
127807127942
};
127808127943
127809127944
/*
127810127945
** This is the function signature used for all extension entry points. It
127811127946
** is also defined in the file "loadext.c".
@@ -128113,10 +128248,12 @@
128113128248
/* Version 3.36.1 and later */
128114128249
#define sqlite3_changes64 sqlite3_api->changes64
128115128250
#define sqlite3_total_changes64 sqlite3_api->total_changes64
128116128251
/* Version 3.37.0 and later */
128117128252
#define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
128253
+/* Version 3.38.0 and later */
128254
+#define sqlite3_error_offset sqlite3_api->error_offset
128118128255
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
128119128256
128120128257
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
128121128258
/* This case when the file really is being compiled as a loadable
128122128259
** extension */
@@ -128602,10 +128739,12 @@
128602128739
/* Version 3.36.1 and later */
128603128740
sqlite3_changes64,
128604128741
sqlite3_total_changes64,
128605128742
/* Version 3.37.0 and later */
128606128743
sqlite3_autovacuum_pages,
128744
+ /* Version 3.38.0 and later */
128745
+ sqlite3_error_offset,
128607128746
};
128608128747
128609128748
/* True if x is the directory separator character
128610128749
*/
128611128750
#if SQLITE_OS_WIN
@@ -132941,10 +133080,14 @@
132941133080
/*
132942133081
** Free all memory allocations in the pParse object
132943133082
*/
132944133083
SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
132945133084
sqlite3 *db = pParse->db;
133085
+ assert( pParse->nested==0 );
133086
+#ifndef SQLITE_OMIT_SHARED_CACHE
133087
+ sqlite3DbFree(db, pParse->aTableLock);
133088
+#endif
132946133089
while( pParse->pCleanup ){
132947133090
ParseCleanup *pCleanup = pParse->pCleanup;
132948133091
pParse->pCleanup = pCleanup->pNext;
132949133092
pCleanup->xCleanup(db, pCleanup->pPtr);
132950133093
sqlite3DbFreeNN(db, pCleanup);
@@ -133020,11 +133163,10 @@
133020133163
u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
133021133164
Vdbe *pReprepare, /* VM being reprepared */
133022133165
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
133023133166
const char **pzTail /* OUT: End of parsed string */
133024133167
){
133025
- char *zErrMsg = 0; /* Error message */
133026133168
int rc = SQLITE_OK; /* Result code */
133027133169
int i; /* Loop counter */
133028133170
Parse sParse; /* Parsing context */
133029133171
133030133172
memset(&sParse, 0, PARSE_HDR_SZ);
@@ -133095,18 +133237,18 @@
133095133237
rc = sqlite3ApiExit(db, SQLITE_TOOBIG);
133096133238
goto end_prepare;
133097133239
}
133098133240
zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
133099133241
if( zSqlCopy ){
133100
- sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
133242
+ sqlite3RunParser(&sParse, zSqlCopy);
133101133243
sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
133102133244
sqlite3DbFree(db, zSqlCopy);
133103133245
}else{
133104133246
sParse.zTail = &zSql[nBytes];
133105133247
}
133106133248
}else{
133107
- sqlite3RunParser(&sParse, zSql, &zErrMsg);
133249
+ sqlite3RunParser(&sParse, zSql);
133108133250
}
133109133251
assert( 0==sParse.nQueryLoop );
133110133252
133111133253
if( pzTail ){
133112133254
*pzTail = sParse.zTail;
@@ -133118,26 +133260,26 @@
133118133260
if( db->mallocFailed ){
133119133261
sParse.rc = SQLITE_NOMEM_BKPT;
133120133262
sParse.checkSchema = 0;
133121133263
}
133122133264
if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
133123
- if( sParse.checkSchema ){
133265
+ if( sParse.checkSchema && db->init.busy==0 ){
133124133266
schemaIsValid(&sParse);
133125133267
}
133126133268
if( sParse.pVdbe ){
133127133269
sqlite3VdbeFinalize(sParse.pVdbe);
133128133270
}
133129133271
assert( 0==(*ppStmt) );
133130133272
rc = sParse.rc;
133131
- if( zErrMsg ){
133132
- sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
133133
- sqlite3DbFree(db, zErrMsg);
133273
+ if( sParse.zErrMsg ){
133274
+ sqlite3ErrorWithMsg(db, rc, "%s", sParse.zErrMsg);
133275
+ sqlite3DbFree(db, sParse.zErrMsg);
133134133276
}else{
133135133277
sqlite3Error(db, rc);
133136133278
}
133137133279
}else{
133138
- assert( zErrMsg==0 );
133280
+ assert( sParse.zErrMsg==0 );
133139133281
*ppStmt = (sqlite3_stmt*)sParse.pVdbe;
133140133282
rc = SQLITE_OK;
133141133283
sqlite3ErrorClear(db);
133142133284
}
133143133285
@@ -136696,10 +136838,12 @@
136696136838
Select *p, /* The right-most of SELECTs to be coded */
136697136839
SelectDest *pDest /* What to do with query results */
136698136840
){
136699136841
int i, j; /* Loop counters */
136700136842
Select *pPrior; /* Another SELECT immediately to our left */
136843
+ Select *pSplit; /* Left-most SELECT in the right-hand group */
136844
+ int nSelect; /* Number of SELECT statements in the compound */
136701136845
Vdbe *v; /* Generate code to this VDBE */
136702136846
SelectDest destA; /* Destination for coroutine A */
136703136847
SelectDest destB; /* Destination for coroutine B */
136704136848
int regAddrA; /* Address register for select-A coroutine */
136705136849
int regAddrB; /* Address register for select-B coroutine */
@@ -136741,12 +136885,11 @@
136741136885
136742136886
136743136887
/* Patch up the ORDER BY clause
136744136888
*/
136745136889
op = p->op;
136746
- pPrior = p->pPrior;
136747
- assert( pPrior->pOrderBy==0 );
136890
+ assert( p->pPrior->pOrderBy==0 );
136748136891
pOrderBy = p->pOrderBy;
136749136892
assert( pOrderBy );
136750136893
nOrderBy = pOrderBy->nExpr;
136751136894
136752136895
/* For operators other than UNION ALL we have to make sure that
@@ -136792,15 +136935,10 @@
136792136935
pKeyMerge = multiSelectOrderByKeyInfo(pParse, p, 1);
136793136936
}else{
136794136937
pKeyMerge = 0;
136795136938
}
136796136939
136797
- /* Reattach the ORDER BY clause to the query.
136798
- */
136799
- p->pOrderBy = pOrderBy;
136800
- pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
136801
-
136802136940
/* Allocate a range of temporary registers and the KeyInfo needed
136803136941
** for the logic that removes duplicate result rows when the
136804136942
** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).
136805136943
*/
136806136944
if( op==TK_ALL ){
@@ -136821,16 +136959,33 @@
136821136959
}
136822136960
}
136823136961
136824136962
/* Separate the left and the right query from one another
136825136963
*/
136826
- p->pPrior = 0;
136964
+ nSelect = 1;
136965
+ if( (op==TK_ALL || op==TK_UNION)
136966
+ && OptimizationEnabled(db, SQLITE_BalancedMerge)
136967
+ ){
136968
+ for(pSplit=p; pSplit->pPrior!=0 && pSplit->op==op; pSplit=pSplit->pPrior){
136969
+ nSelect++;
136970
+ assert( pSplit->pPrior->pNext==pSplit );
136971
+ }
136972
+ }
136973
+ if( nSelect<=3 ){
136974
+ pSplit = p;
136975
+ }else{
136976
+ pSplit = p;
136977
+ for(i=2; i<nSelect; i+=2){ pSplit = pSplit->pPrior; }
136978
+ }
136979
+ pPrior = pSplit->pPrior;
136980
+ pSplit->pPrior = 0;
136827136981
pPrior->pNext = 0;
136982
+ assert( p->pOrderBy == pOrderBy );
136983
+ assert( pOrderBy!=0 || db->mallocFailed );
136984
+ pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
136828136985
sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER");
136829
- if( pPrior->pPrior==0 ){
136830
- sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
136831
- }
136986
+ sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
136832136987
136833136988
/* Compute the limit registers */
136834136989
computeLimitRegisters(pParse, p, labelEnd);
136835136990
if( p->iLimit && op==TK_ALL ){
136836136991
regLimitA = ++pParse->nMem;
@@ -136977,16 +137132,15 @@
136977137132
*/
136978137133
sqlite3VdbeResolveLabel(v, labelEnd);
136979137134
136980137135
/* Reassembly the compound query so that it will be freed correctly
136981137136
** by the calling function */
136982
- if( p->pPrior ){
136983
- sqlite3SelectDelete(db, p->pPrior);
137137
+ if( pSplit->pPrior ){
137138
+ sqlite3SelectDelete(db, pSplit->pPrior);
136984137139
}
136985
- p->pPrior = pPrior;
136986
- pPrior->pNext = p;
136987
-
137140
+ pSplit->pPrior = pPrior;
137141
+ pPrior->pNext = pSplit;
136988137142
sqlite3ExprListDelete(db, pPrior->pOrderBy);
136989137143
pPrior->pOrderBy = 0;
136990137144
136991137145
/*** TBD: Insert subroutine calls to close cursors on incomplete
136992137146
**** subqueries ****/
@@ -142061,11 +142215,11 @@
142061142215
if( db->mallocFailed==0 && pParse->nErr==0 ){
142062142216
sqlite3GenerateColumnNames(pParse, &sSelect);
142063142217
}
142064142218
sqlite3ExprListDelete(db, sSelect.pEList);
142065142219
pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
142066
- if( pNew ){
142220
+ if( !db->mallocFailed ){
142067142221
NameContext sNC;
142068142222
memset(&sNC, 0, sizeof(sNC));
142069142223
if( pReturning->nRetCol==0 ){
142070142224
pReturning->nRetCol = pNew->nExpr;
142071142225
pReturning->iRetCur = pParse->nTab++;
@@ -142073,28 +142227,34 @@
142073142227
sNC.pParse = pParse;
142074142228
sNC.uNC.iBaseReg = regIn;
142075142229
sNC.ncFlags = NC_UBaseReg;
142076142230
pParse->eTriggerOp = pTrigger->op;
142077142231
pParse->pTriggerTab = pTab;
142078
- if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK ){
142232
+ if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK
142233
+ && !db->mallocFailed
142234
+ ){
142079142235
int i;
142080142236
int nCol = pNew->nExpr;
142081142237
int reg = pParse->nMem+1;
142082142238
pParse->nMem += nCol+2;
142083142239
pReturning->iRetReg = reg;
142084142240
for(i=0; i<nCol; i++){
142085142241
Expr *pCol = pNew->a[i].pExpr;
142242
+ assert( pCol!=0 ); /* Due to !db->mallocFailed ~9 lines above */
142086142243
sqlite3ExprCodeFactorable(pParse, pCol, reg+i);
142244
+ if( sqlite3ExprAffinity(pCol)==SQLITE_AFF_REAL ){
142245
+ sqlite3VdbeAddOp1(v, OP_RealAffinity, reg+i);
142246
+ }
142087142247
}
142088142248
sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i);
142089142249
sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1);
142090142250
sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1);
142091142251
}
142092
- sqlite3ExprListDelete(db, pNew);
142093
- pParse->eTriggerOp = 0;
142094
- pParse->pTriggerTab = 0;
142095142252
}
142253
+ sqlite3ExprListDelete(db, pNew);
142254
+ pParse->eTriggerOp = 0;
142255
+ pParse->pTriggerTab = 0;
142096142256
}
142097142257
142098142258
142099142259
142100142260
/*
@@ -145420,11 +145580,10 @@
145420145580
*/
145421145581
SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
145422145582
VtabCtx *pCtx;
145423145583
int rc = SQLITE_OK;
145424145584
Table *pTab;
145425
- char *zErr = 0;
145426145585
Parse sParse;
145427145586
int initBusy;
145428145587
145429145588
#ifdef SQLITE_ENABLE_API_ARMOR
145430145589
if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
@@ -145449,15 +145608,16 @@
145449145608
** in case a bug arises. */
145450145609
assert( db->init.busy==0 );
145451145610
initBusy = db->init.busy;
145452145611
db->init.busy = 0;
145453145612
sParse.nQueryLoop = 1;
145454
- if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
145455
- && sParse.pNewTable
145456
- && !db->mallocFailed
145613
+ if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable)
145614
+ && ALWAYS(sParse.pNewTable!=0)
145615
+ && ALWAYS(!db->mallocFailed)
145457145616
&& IsOrdinaryTable(sParse.pNewTable)
145458145617
){
145618
+ assert( sParse.zErrMsg==0 );
145459145619
if( !pTab->aCol ){
145460145620
Table *pNew = sParse.pNewTable;
145461145621
Index *pIdx;
145462145622
pTab->aCol = pNew->aCol;
145463145623
sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
@@ -145483,12 +145643,13 @@
145483145643
pIdx->pTable = pTab;
145484145644
}
145485145645
}
145486145646
pCtx->bDeclared = 1;
145487145647
}else{
145488
- sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
145489
- sqlite3DbFree(db, zErr);
145648
+ sqlite3ErrorWithMsg(db, SQLITE_ERROR,
145649
+ (sParse.zErrMsg ? "%s" : 0), sParse.zErrMsg);
145650
+ sqlite3DbFree(db, sParse.zErrMsg);
145490145651
rc = SQLITE_ERROR;
145491145652
}
145492145653
sParse.eParseMode = PARSE_MODE_NORMAL;
145493145654
145494145655
if( sParse.pVdbe ){
@@ -146251,11 +146412,11 @@
146251146412
#define TERM_VIRTUAL 0x0002 /* Added by the optimizer. Do not code */
146252146413
#define TERM_CODED 0x0004 /* This term is already coded */
146253146414
#define TERM_COPIED 0x0008 /* Has a child */
146254146415
#define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */
146255146416
#define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */
146256
-#define TERM_OR_OK 0x0040 /* Used during OR-clause processing */
146417
+#define TERM_OK 0x0040 /* Used during OR-clause processing */
146257146418
#define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */
146258146419
#define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */
146259146420
#define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */
146260146421
#define TERM_LIKE 0x0400 /* The original LIKE operator */
146261146422
#define TERM_IS 0x0800 /* Term.pExpr is an IS operator */
@@ -147961,11 +148122,11 @@
147961148122
){
147962148123
while( ++iLevel < pWInfo->nLevel ){
147963148124
WhereLevel *pLevel = &pWInfo->a[iLevel];
147964148125
WhereLoop *pLoop = pLevel->pWLoop;
147965148126
if( pLevel->regFilter==0 ) continue;
147966
- /* ,--- Because constructBloomFilter() has will not have set
148127
+ /* ,--- Because sqlite3ConstructBloomFilter() has will not have set
147967148128
** vvvvv--' pLevel->regFilter if this were true. */
147968148129
if( NEVER(pLoop->prereq & notReady) ) continue;
147969148130
if( pLoop->wsFlags & WHERE_IPK ){
147970148131
WhereTerm *pTerm = pLoop->aLTerm[0];
147971148132
int regRowid;
@@ -147981,10 +148142,11 @@
147981148142
u16 nEq = pLoop->u.btree.nEq;
147982148143
int r1;
147983148144
char *zStartAff;
147984148145
147985148146
assert( pLoop->wsFlags & WHERE_INDEXED );
148147
+ assert( (pLoop->wsFlags & WHERE_COLUMN_IN)==0 );
147986148148
r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff);
147987148149
codeApplyAffinity(pParse, r1, nEq, zStartAff);
147988148150
sqlite3DbFree(pParse->db, zStartAff);
147989148151
sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147990148152
addrNxt, r1, nEq);
@@ -150043,11 +150205,11 @@
150043150205
for(j=0; j<2 && !okToChngToIN; j++){
150044150206
Expr *pLeft = 0;
150045150207
pOrTerm = pOrWc->a;
150046150208
for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){
150047150209
assert( pOrTerm->eOperator & WO_EQ );
150048
- pOrTerm->wtFlags &= ~TERM_OR_OK;
150210
+ pOrTerm->wtFlags &= ~TERM_OK;
150049150211
if( pOrTerm->leftCursor==iCursor ){
150050150212
/* This is the 2-bit case and we are on the second iteration and
150051150213
** current term is from the first iteration. So skip this term. */
150052150214
assert( j==1 );
150053150215
continue;
@@ -150084,11 +150246,11 @@
150084150246
okToChngToIN = 1;
150085150247
for(; i>=0 && okToChngToIN; i--, pOrTerm++){
150086150248
assert( pOrTerm->eOperator & WO_EQ );
150087150249
assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150088150250
if( pOrTerm->leftCursor!=iCursor ){
150089
- pOrTerm->wtFlags &= ~TERM_OR_OK;
150251
+ pOrTerm->wtFlags &= ~TERM_OK;
150090150252
}else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
150091150253
&& sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
150092150254
)){
150093150255
okToChngToIN = 0;
150094150256
}else{
@@ -150100,11 +150262,11 @@
150100150262
affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);
150101150263
affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);
150102150264
if( affRight!=0 && affRight!=affLeft ){
150103150265
okToChngToIN = 0;
150104150266
}else{
150105
- pOrTerm->wtFlags |= TERM_OR_OK;
150267
+ pOrTerm->wtFlags |= TERM_OK;
150106150268
}
150107150269
}
150108150270
}
150109150271
}
150110150272
@@ -150117,11 +150279,11 @@
150117150279
ExprList *pList = 0; /* The RHS of the IN operator */
150118150280
Expr *pLeft = 0; /* The LHS of the IN operator */
150119150281
Expr *pNew; /* The complete IN operator */
150120150282
150121150283
for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
150122
- if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;
150284
+ if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue;
150123150285
assert( pOrTerm->eOperator & WO_EQ );
150124150286
assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150125150287
assert( pOrTerm->leftCursor==iCursor );
150126150288
assert( pOrTerm->u.x.leftColumn==iColumn );
150127150289
pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);
@@ -151651,16 +151813,18 @@
151651151813
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED)
151652151814
static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
151653151815
int i;
151654151816
if( !sqlite3WhereTrace ) return;
151655151817
for(i=0; i<p->nConstraint; i++){
151656
- sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
151818
+ sqlite3DebugPrintf(
151819
+ " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n",
151657151820
i,
151658151821
p->aConstraint[i].iColumn,
151659151822
p->aConstraint[i].iTermOffset,
151660151823
p->aConstraint[i].op,
151661
- p->aConstraint[i].usable);
151824
+ p->aConstraint[i].usable,
151825
+ sqlite3_vtab_collation(p,i));
151662151826
}
151663151827
for(i=0; i<p->nOrderBy; i++){
151664151828
sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n",
151665151829
i,
151666151830
p->aOrderBy[i].iColumn,
@@ -151960,11 +152124,11 @@
151960152124
**
151961152125
** This routine may only be called if it has previously been determined that
151962152126
** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
151963152127
** is set.
151964152128
*/
151965
-static SQLITE_NOINLINE void constructBloomFilter(
152129
+static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
151966152130
WhereInfo *pWInfo, /* The WHERE clause */
151967152131
int iLevel, /* Index in pWInfo->a[] that is pLevel */
151968152132
WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */
151969152133
Bitmask notReady /* Loops that are not ready */
151970152134
){
@@ -152044,17 +152208,24 @@
152044152208
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
152045152209
VdbeCoverage(v);
152046152210
sqlite3VdbeJumpHere(v, addrTop);
152047152211
pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
152048152212
if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
152049
- while( iLevel < pWInfo->nLevel ){
152050
- iLevel++;
152213
+ while( ++iLevel < pWInfo->nLevel ){
152051152214
pLevel = &pWInfo->a[iLevel];
152052152215
pLoop = pLevel->pWLoop;
152053
- if( pLoop==0 ) continue;
152216
+ if( NEVER(pLoop==0) ) continue;
152054152217
if( pLoop->prereq & notReady ) continue;
152055
- if( pLoop->wsFlags & WHERE_BLOOMFILTER ) break;
152218
+ if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN))
152219
+ ==WHERE_BLOOMFILTER
152220
+ ){
152221
+ /* This is a candidate for bloom-filter pull-down (early evaluation).
152222
+ ** The test that WHERE_COLUMN_IN is omitted is important, as we are
152223
+ ** not able to do early evaluation of bloom filters that make use of
152224
+ ** the IN operator */
152225
+ break;
152226
+ }
152056152227
}
152057152228
}while( iLevel < pWInfo->nLevel );
152058152229
sqlite3VdbeJumpHere(v, addrOnce);
152059152230
}
152060152231
@@ -152081,14 +152252,23 @@
152081152252
struct HiddenIndexInfo *pHidden;
152082152253
WhereTerm *pTerm;
152083152254
int nOrderBy;
152084152255
sqlite3_index_info *pIdxInfo;
152085152256
u16 mNoOmit = 0;
152257
+ const Table *pTab;
152086152258
152087
- /* Count the number of possible WHERE clause constraints referring
152088
- ** to this virtual table */
152259
+ assert( pSrc!=0 );
152260
+ pTab = pSrc->pTab;
152261
+ assert( pTab!=0 );
152262
+ assert( IsVirtual(pTab) );
152263
+
152264
+ /* Find all WHERE clause constraints referring to this virtual table.
152265
+ ** Mark each term with the TERM_OK flag. Set nTerm to the number of
152266
+ ** terms found.
152267
+ */
152089152268
for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
152269
+ pTerm->wtFlags &= ~TERM_OK;
152090152270
if( pTerm->leftCursor != pSrc->iCursor ) continue;
152091152271
if( pTerm->prereqRight & mUnusable ) continue;
152092152272
assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
152093152273
testcase( pTerm->eOperator & WO_IN );
152094152274
testcase( pTerm->eOperator & WO_ISNULL );
@@ -152095,12 +152275,23 @@
152095152275
testcase( pTerm->eOperator & WO_IS );
152096152276
testcase( pTerm->eOperator & WO_ALL );
152097152277
if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
152098152278
if( pTerm->wtFlags & TERM_VNULL ) continue;
152099152279
assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
152100
- assert( pTerm->u.x.leftColumn>=(-1) );
152280
+ assert( pTerm->u.x.leftColumn>=XN_ROWID );
152281
+ assert( pTerm->u.x.leftColumn<pTab->nCol );
152282
+
152283
+ /* tag-20191211-002: WHERE-clause constraints are not useful to the
152284
+ ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the
152285
+ ** equivalent restriction for ordinary tables. */
152286
+ if( (pSrc->fg.jointype & JT_LEFT)!=0
152287
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
152288
+ ){
152289
+ continue;
152290
+ }
152101152291
nTerm++;
152292
+ pTerm->wtFlags |= TERM_OK;
152102152293
}
152103152294
152104152295
/* If the ORDER BY clause contains only columns in the current
152105152296
** virtual table then allocate space for the aOrderBy part of
152106152297
** the sqlite3_index_info structure.
@@ -152108,12 +152299,45 @@
152108152299
nOrderBy = 0;
152109152300
if( pOrderBy ){
152110152301
int n = pOrderBy->nExpr;
152111152302
for(i=0; i<n; i++){
152112152303
Expr *pExpr = pOrderBy->a[i].pExpr;
152113
- if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
152304
+ Expr *pE2;
152305
+
152306
+ /* Skip over constant terms in the ORDER BY clause */
152307
+ if( sqlite3ExprIsConstant(pExpr) ){
152308
+ continue;
152309
+ }
152310
+
152311
+ /* Virtual tables are unable to deal with NULLS FIRST */
152114152312
if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break;
152313
+
152314
+ /* First case - a direct column references without a COLLATE operator */
152315
+ if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){
152316
+ assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumn<pTab->nCol );
152317
+ continue;
152318
+ }
152319
+
152320
+ /* 2nd case - a column reference with a COLLATE operator. Only match
152321
+ ** of the COLLATE operator matches the collation of the column. */
152322
+ if( pExpr->op==TK_COLLATE
152323
+ && (pE2 = pExpr->pLeft)->op==TK_COLUMN
152324
+ && pE2->iTable==pSrc->iCursor
152325
+ ){
152326
+ const char *zColl; /* The collating sequence name */
152327
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
152328
+ assert( pExpr->u.zToken!=0 );
152329
+ assert( pE2->iColumn>=XN_ROWID && pE2->iColumn<pTab->nCol );
152330
+ pExpr->iColumn = pE2->iColumn;
152331
+ if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */
152332
+ zColl = sqlite3ColumnColl(&pTab->aCol[pE2->iColumn]);
152333
+ if( zColl==0 ) zColl = sqlite3StrBINARY;
152334
+ if( sqlite3_stricmp(pExpr->u.zToken, zColl)==0 ) continue;
152335
+ }
152336
+
152337
+ /* No matches cause a break out of the loop */
152338
+ break;
152115152339
}
152116152340
if( i==n){
152117152341
nOrderBy = n;
152118152342
}
152119152343
}
@@ -152129,38 +152353,18 @@
152129152353
}
152130152354
pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1];
152131152355
pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1];
152132152356
pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];
152133152357
pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];
152134
- pIdxInfo->nOrderBy = nOrderBy;
152135152358
pIdxInfo->aConstraint = pIdxCons;
152136152359
pIdxInfo->aOrderBy = pIdxOrderBy;
152137152360
pIdxInfo->aConstraintUsage = pUsage;
152138152361
pHidden->pWC = pWC;
152139152362
pHidden->pParse = pParse;
152140152363
for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
152141152364
u16 op;
152142
- if( pTerm->leftCursor != pSrc->iCursor ) continue;
152143
- if( pTerm->prereqRight & mUnusable ) continue;
152144
- assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
152145
- testcase( pTerm->eOperator & WO_IN );
152146
- testcase( pTerm->eOperator & WO_IS );
152147
- testcase( pTerm->eOperator & WO_ISNULL );
152148
- testcase( pTerm->eOperator & WO_ALL );
152149
- if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
152150
- if( pTerm->wtFlags & TERM_VNULL ) continue;
152151
-
152152
- /* tag-20191211-002: WHERE-clause constraints are not useful to the
152153
- ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the
152154
- ** equivalent restriction for ordinary tables. */
152155
- if( (pSrc->fg.jointype & JT_LEFT)!=0
152156
- && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
152157
- ){
152158
- continue;
152159
- }
152160
- assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
152161
- assert( pTerm->u.x.leftColumn>=(-1) );
152365
+ if( (pTerm->wtFlags & TERM_OK)==0 ) continue;
152162152366
pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
152163152367
pIdxCons[j].iTermOffset = i;
152164152368
op = pTerm->eOperator & WO_ALL;
152165152369
if( op==WO_IN ) op = WO_EQ;
152166152370
if( op==WO_AUX ){
@@ -152193,16 +152397,23 @@
152193152397
}
152194152398
}
152195152399
152196152400
j++;
152197152401
}
152402
+ assert( j==nTerm );
152198152403
pIdxInfo->nConstraint = j;
152199
- for(i=0; i<nOrderBy; i++){
152404
+ for(i=j=0; i<nOrderBy; i++){
152200152405
Expr *pExpr = pOrderBy->a[i].pExpr;
152201
- pIdxOrderBy[i].iColumn = pExpr->iColumn;
152202
- pIdxOrderBy[i].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC;
152406
+ if( sqlite3ExprIsConstant(pExpr) ) continue;
152407
+ assert( pExpr->op==TK_COLUMN
152408
+ || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN
152409
+ && pExpr->iColumn==pExpr->pLeft->iColumn) );
152410
+ pIdxOrderBy[j].iColumn = pExpr->iColumn;
152411
+ pIdxOrderBy[j].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC;
152412
+ j++;
152203152413
}
152414
+ pIdxInfo->nOrderBy = j;
152204152415
152205152416
*pmNoOmit = mNoOmit;
152206152417
return pIdxInfo;
152207152418
}
152208152419
@@ -154530,15 +154741,23 @@
154530154741
154531154742
return rc;
154532154743
}
154533154744
154534154745
/*
154535
-** If this function is invoked from within an xBestIndex() callback, it
154536
-** returns a pointer to a buffer containing the name of the collation
154537
-** sequence associated with element iCons of the sqlite3_index_info.aConstraint
154538
-** array. Or, if iCons is out of range or there is no active xBestIndex
154539
-** call, return NULL.
154746
+** Return the collating sequence for a constraint passed into xBestIndex.
154747
+**
154748
+** pIdxInfo must be an sqlite3_index_info structure passed into xBestIndex.
154749
+** This routine depends on there being a HiddenIndexInfo structure immediately
154750
+** following the sqlite3_index_info structure.
154751
+**
154752
+** Return a pointer to the collation name:
154753
+**
154754
+** 1. If there is an explicit COLLATE operator on the constaint, return it.
154755
+**
154756
+** 2. Else, if the column has an alternative collation, return that.
154757
+**
154758
+** 3. Otherwise, return "BINARY".
154540154759
*/
154541154760
SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){
154542154761
HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
154543154762
const char *zRet = 0;
154544154763
if( iCons>=0 && iCons<pIdxInfo->nConstraint ){
@@ -155972,11 +156191,11 @@
155972156191
assert( pWInfo->nLevel>=2 );
155973156192
assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
155974156193
nSearch = pWInfo->a[0].pWLoop->nOut;
155975156194
for(i=1; i<pWInfo->nLevel; i++){
155976156195
WhereLoop *pLoop = pWInfo->a[i].pWLoop;
155977
- const int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
156196
+ const unsigned int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
155978156197
if( (pLoop->wsFlags & reqFlags)==reqFlags
155979156198
/* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
155980156199
&& ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
155981156200
){
155982156201
SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
@@ -156590,11 +156809,11 @@
156590156809
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
156591156810
constructAutomaticIndex(pParse, &pWInfo->sWC,
156592156811
&pTabList->a[pLevel->iFrom], notReady, pLevel);
156593156812
#endif
156594156813
}else{
156595
- constructBloomFilter(pWInfo, ii, pLevel, notReady);
156814
+ sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady);
156596156815
}
156597156816
if( db->mallocFailed ) goto whereBeginError;
156598156817
}
156599156818
addrExplain = sqlite3WhereExplainOneScan(
156600156819
pParse, pTabList, pLevel, wctrlFlags
@@ -160320,14 +160539,14 @@
160320160539
#define TK_DETACH 40
160321160540
#define TK_EACH 41
160322160541
#define TK_FAIL 42
160323160542
#define TK_OR 43
160324160543
#define TK_AND 44
160325
-#define TK_MATCH 45
160326
-#define TK_LIKE_KW 46
160327
-#define TK_BETWEEN 47
160328
-#define TK_IS 48
160544
+#define TK_IS 45
160545
+#define TK_MATCH 46
160546
+#define TK_LIKE_KW 47
160547
+#define TK_BETWEEN 48
160329160548
#define TK_IN 49
160330160549
#define TK_ISNULL 50
160331160550
#define TK_NOTNULL 51
160332160551
#define TK_NE 52
160333160552
#define TK_EQ 53
@@ -160387,82 +160606,83 @@
160387160606
#define TK_MINUS 107
160388160607
#define TK_STAR 108
160389160608
#define TK_SLASH 109
160390160609
#define TK_REM 110
160391160610
#define TK_CONCAT 111
160392
-#define TK_COLLATE 112
160393
-#define TK_BITNOT 113
160394
-#define TK_ON 114
160395
-#define TK_INDEXED 115
160396
-#define TK_STRING 116
160397
-#define TK_JOIN_KW 117
160398
-#define TK_CONSTRAINT 118
160399
-#define TK_DEFAULT 119
160400
-#define TK_NULL 120
160401
-#define TK_PRIMARY 121
160402
-#define TK_UNIQUE 122
160403
-#define TK_CHECK 123
160404
-#define TK_REFERENCES 124
160405
-#define TK_AUTOINCR 125
160406
-#define TK_INSERT 126
160407
-#define TK_DELETE 127
160408
-#define TK_UPDATE 128
160409
-#define TK_SET 129
160410
-#define TK_DEFERRABLE 130
160411
-#define TK_FOREIGN 131
160412
-#define TK_DROP 132
160413
-#define TK_UNION 133
160414
-#define TK_ALL 134
160415
-#define TK_EXCEPT 135
160416
-#define TK_INTERSECT 136
160417
-#define TK_SELECT 137
160418
-#define TK_VALUES 138
160419
-#define TK_DISTINCT 139
160420
-#define TK_DOT 140
160421
-#define TK_FROM 141
160422
-#define TK_JOIN 142
160423
-#define TK_USING 143
160424
-#define TK_ORDER 144
160425
-#define TK_GROUP 145
160426
-#define TK_HAVING 146
160427
-#define TK_LIMIT 147
160428
-#define TK_WHERE 148
160429
-#define TK_RETURNING 149
160430
-#define TK_INTO 150
160431
-#define TK_NOTHING 151
160432
-#define TK_FLOAT 152
160433
-#define TK_BLOB 153
160434
-#define TK_INTEGER 154
160435
-#define TK_VARIABLE 155
160436
-#define TK_CASE 156
160437
-#define TK_WHEN 157
160438
-#define TK_THEN 158
160439
-#define TK_ELSE 159
160440
-#define TK_INDEX 160
160441
-#define TK_ALTER 161
160442
-#define TK_ADD 162
160443
-#define TK_WINDOW 163
160444
-#define TK_OVER 164
160445
-#define TK_FILTER 165
160446
-#define TK_COLUMN 166
160447
-#define TK_AGG_FUNCTION 167
160448
-#define TK_AGG_COLUMN 168
160449
-#define TK_TRUEFALSE 169
160450
-#define TK_ISNOT 170
160451
-#define TK_FUNCTION 171
160452
-#define TK_UMINUS 172
160453
-#define TK_UPLUS 173
160454
-#define TK_TRUTH 174
160455
-#define TK_REGISTER 175
160456
-#define TK_VECTOR 176
160457
-#define TK_SELECT_COLUMN 177
160458
-#define TK_IF_NULL_ROW 178
160459
-#define TK_ASTERISK 179
160460
-#define TK_SPAN 180
160461
-#define TK_ERROR 181
160462
-#define TK_SPACE 182
160463
-#define TK_ILLEGAL 183
160611
+#define TK_PTR 112
160612
+#define TK_COLLATE 113
160613
+#define TK_BITNOT 114
160614
+#define TK_ON 115
160615
+#define TK_INDEXED 116
160616
+#define TK_STRING 117
160617
+#define TK_JOIN_KW 118
160618
+#define TK_CONSTRAINT 119
160619
+#define TK_DEFAULT 120
160620
+#define TK_NULL 121
160621
+#define TK_PRIMARY 122
160622
+#define TK_UNIQUE 123
160623
+#define TK_CHECK 124
160624
+#define TK_REFERENCES 125
160625
+#define TK_AUTOINCR 126
160626
+#define TK_INSERT 127
160627
+#define TK_DELETE 128
160628
+#define TK_UPDATE 129
160629
+#define TK_SET 130
160630
+#define TK_DEFERRABLE 131
160631
+#define TK_FOREIGN 132
160632
+#define TK_DROP 133
160633
+#define TK_UNION 134
160634
+#define TK_ALL 135
160635
+#define TK_EXCEPT 136
160636
+#define TK_INTERSECT 137
160637
+#define TK_SELECT 138
160638
+#define TK_VALUES 139
160639
+#define TK_DISTINCT 140
160640
+#define TK_DOT 141
160641
+#define TK_FROM 142
160642
+#define TK_JOIN 143
160643
+#define TK_USING 144
160644
+#define TK_ORDER 145
160645
+#define TK_GROUP 146
160646
+#define TK_HAVING 147
160647
+#define TK_LIMIT 148
160648
+#define TK_WHERE 149
160649
+#define TK_RETURNING 150
160650
+#define TK_INTO 151
160651
+#define TK_NOTHING 152
160652
+#define TK_FLOAT 153
160653
+#define TK_BLOB 154
160654
+#define TK_INTEGER 155
160655
+#define TK_VARIABLE 156
160656
+#define TK_CASE 157
160657
+#define TK_WHEN 158
160658
+#define TK_THEN 159
160659
+#define TK_ELSE 160
160660
+#define TK_INDEX 161
160661
+#define TK_ALTER 162
160662
+#define TK_ADD 163
160663
+#define TK_WINDOW 164
160664
+#define TK_OVER 165
160665
+#define TK_FILTER 166
160666
+#define TK_COLUMN 167
160667
+#define TK_AGG_FUNCTION 168
160668
+#define TK_AGG_COLUMN 169
160669
+#define TK_TRUEFALSE 170
160670
+#define TK_ISNOT 171
160671
+#define TK_FUNCTION 172
160672
+#define TK_UMINUS 173
160673
+#define TK_UPLUS 174
160674
+#define TK_TRUTH 175
160675
+#define TK_REGISTER 176
160676
+#define TK_VECTOR 177
160677
+#define TK_SELECT_COLUMN 178
160678
+#define TK_IF_NULL_ROW 179
160679
+#define TK_ASTERISK 180
160680
+#define TK_SPAN 181
160681
+#define TK_ERROR 182
160682
+#define TK_SPACE 183
160683
+#define TK_ILLEGAL 184
160464160684
#endif
160465160685
/**************** End token definitions ***************************************/
160466160686
160467160687
/* The next sections is a series of control #defines.
160468160688
** various aspects of the generated parser.
@@ -160518,34 +160738,34 @@
160518160738
#ifndef INTERFACE
160519160739
# define INTERFACE 1
160520160740
#endif
160521160741
/************* Begin control #defines *****************************************/
160522160742
#define YYCODETYPE unsigned short int
160523
-#define YYNOCODE 318
160743
+#define YYNOCODE 319
160524160744
#define YYACTIONTYPE unsigned short int
160525160745
#define YYWILDCARD 101
160526160746
#define sqlite3ParserTOKENTYPE Token
160527160747
typedef union {
160528160748
int yyinit;
160529160749
sqlite3ParserTOKENTYPE yy0;
160530
- With* yy43;
160531
- u32 yy51;
160532
- int yy64;
160533
- struct FrameBound yy81;
160534
- struct {int value; int mask;} yy83;
160535
- TriggerStep* yy95;
160536
- Upsert* yy138;
160537
- IdList* yy240;
160538
- Cte* yy255;
160539
- Select* yy303;
160540
- Window* yy375;
160541
- u8 yy534;
160542
- ExprList* yy562;
160543
- struct TrigEvent yy570;
160544
- const char* yy600;
160545
- SrcList* yy607;
160546
- Expr* yy626;
160750
+ TriggerStep* yy33;
160751
+ Window* yy41;
160752
+ Select* yy47;
160753
+ SrcList* yy131;
160754
+ struct TrigEvent yy180;
160755
+ struct {int value; int mask;} yy231;
160756
+ IdList* yy254;
160757
+ u32 yy285;
160758
+ ExprList* yy322;
160759
+ Cte* yy385;
160760
+ int yy394;
160761
+ Upsert* yy444;
160762
+ u8 yy516;
160763
+ With* yy521;
160764
+ const char* yy522;
160765
+ Expr* yy528;
160766
+ struct FrameBound yy595;
160547160767
} YYMINORTYPE;
160548160768
#ifndef YYSTACKDEPTH
160549160769
#define YYSTACKDEPTH 100
160550160770
#endif
160551160771
#define sqlite3ParserARG_SDECL
@@ -160557,22 +160777,22 @@
160557160777
#define sqlite3ParserCTX_PDECL ,Parse *pParse
160558160778
#define sqlite3ParserCTX_PARAM ,pParse
160559160779
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
160560160780
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
160561160781
#define YYFALLBACK 1
160562
-#define YYNSTATE 572
160563
-#define YYNRULE 401
160564
-#define YYNRULE_WITH_ACTION 339
160565
-#define YYNTOKEN 184
160566
-#define YY_MAX_SHIFT 571
160567
-#define YY_MIN_SHIFTREDUCE 829
160568
-#define YY_MAX_SHIFTREDUCE 1229
160569
-#define YY_ERROR_ACTION 1230
160570
-#define YY_ACCEPT_ACTION 1231
160571
-#define YY_NO_ACTION 1232
160572
-#define YY_MIN_REDUCE 1233
160573
-#define YY_MAX_REDUCE 1633
160782
+#define YYNSTATE 574
160783
+#define YYNRULE 402
160784
+#define YYNRULE_WITH_ACTION 340
160785
+#define YYNTOKEN 185
160786
+#define YY_MAX_SHIFT 573
160787
+#define YY_MIN_SHIFTREDUCE 831
160788
+#define YY_MAX_SHIFTREDUCE 1232
160789
+#define YY_ERROR_ACTION 1233
160790
+#define YY_ACCEPT_ACTION 1234
160791
+#define YY_NO_ACTION 1235
160792
+#define YY_MIN_REDUCE 1236
160793
+#define YY_MAX_REDUCE 1637
160574160794
/************* End control #defines *******************************************/
160575160795
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
160576160796
160577160797
/* Define the yytestcase() macro to be a no-op if is not already defined
160578160798
** otherwise.
@@ -160635,607 +160855,616 @@
160635160855
** yy_reduce_ofst[] For each state, the offset into yy_action for
160636160856
** shifting non-terminals after a reduce.
160637160857
** yy_default[] Default action for each state.
160638160858
**
160639160859
*********** Begin parsing tables **********************************************/
160640
-#define YY_ACTTAB_COUNT (2022)
160860
+#define YY_ACTTAB_COUNT (2070)
160641160861
static const YYACTIONTYPE yy_action[] = {
160642
- /* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564,
160643
- /* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407,
160644
- /* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558,
160645
- /* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966,
160646
- /* 40 */ 296, 1269, 296, 122, 123, 1207, 1207, 1041, 113, 1044,
160647
- /* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407,
160648
- /* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112,
160649
- /* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250,
160650
- /* 80 */ 217, 71, 71, 122, 123, 1207, 1207, 1041, 113, 1044,
160651
- /* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440,
160652
- /* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117,
160653
- /* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513,
160654
- /* 120 */ 1548, 1554, 374, 213, 6, 169, 1154, 522, 1154, 407,
160655
- /* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121,
160656
- /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
160657
- /* 150 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160658
- /* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183,
160659
- /* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124,
160660
- /* 180 */ 567, 1128, 1627, 344, 1627, 497, 119, 119, 119, 119,
160661
- /* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407,
160662
- /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442,
160663
- /* 210 */ 474, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160664
- /* 220 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160665
- /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 208,
160666
- /* 240 */ 539, 1548, 1424, 81, 339, 6, 342, 80, 119, 119,
160667
- /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381,
160668
- /* 260 */ 1126, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160669
- /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 463, 332,
160670
- /* 280 */ 359, 1567, 119, 119, 119, 119, 118, 118, 117, 117,
160671
- /* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573,
160672
- /* 300 */ 571, 2, 1235, 307, 1149, 141, 417, 307, 407, 141,
160673
- /* 310 */ 1183, 98, 1317, 489, 866, 531, 1317, 1149, 215, 512,
160674
- /* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160675
- /* 330 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160676
- /* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001,
160677
- /* 350 */ 1257, 275, 275, 1128, 1628, 1021, 1628, 137, 415, 1600,
160678
- /* 360 */ 561, 272, 1255, 950, 561, 1423, 1183, 1184, 1185, 1594,
160679
- /* 370 */ 866, 1012, 530, 315, 231, 1011, 317, 1276, 231, 119,
160680
- /* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160681
- /* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160682
- /* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013,
160683
- /* 410 */ 446, 877, 564, 306, 555, 407, 447, 1021, 563, 346,
160684
- /* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71,
160685
- /* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122,
160686
- /* 440 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160687
- /* 450 */ 121, 121, 121, 121, 1304, 219, 1283, 1183, 407, 570,
160688
- /* 460 */ 1183, 1235, 503, 1477, 1304, 546, 307, 489, 141, 1011,
160689
- /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 382, 1214, 378,
160690
- /* 480 */ 950, 514, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160691
- /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 472, 119, 119,
160692
- /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283,
160693
- /* 510 */ 275, 275, 1476, 1183, 1184, 1185, 1183, 1184, 1185, 417,
160694
- /* 520 */ 1183, 243, 541, 561, 502, 499, 498, 1001, 407, 478,
160695
- /* 530 */ 1183, 472, 870, 143, 497, 1549, 185, 231, 9, 6,
160696
- /* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160697
- /* 550 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160698
- /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 372, 446,
160699
- /* 570 */ 363, 863, 288, 1183, 397, 1204, 1183, 1184, 1185, 931,
160700
- /* 580 */ 330, 458, 318, 526, 564, 541, 1183, 1184, 1185, 284,
160701
- /* 590 */ 1183, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160702
- /* 600 */ 120, 120, 121, 121, 121, 121, 291, 71, 71, 275,
160703
- /* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160704
- /* 620 */ 116, 442, 561, 1031, 1031, 1042, 1183, 1045, 287, 1183,
160705
- /* 630 */ 1184, 1185, 1204, 137, 218, 542, 1541, 407, 363, 470,
160706
- /* 640 */ 431, 1167, 32, 363, 527, 350, 1183, 1184, 1185, 380,
160707
- /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160708
- /* 660 */ 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160709
- /* 670 */ 120, 120, 121, 121, 121, 121, 407, 392, 1227, 1183,
160710
- /* 680 */ 1022, 1540, 1183, 1184, 1185, 1523, 149, 1307, 1307, 306,
160711
- /* 690 */ 555, 151, 1546, 361, 5, 564, 6, 3, 1035, 1542,
160712
- /* 700 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160713
- /* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71,
160714
- /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160715
- /* 730 */ 442, 1183, 426, 428, 1183, 1183, 1184, 1185, 191, 261,
160716
- /* 740 */ 278, 358, 508, 353, 507, 248, 407, 455, 137, 1539,
160717
- /* 750 */ 1006, 349, 363, 472, 1539, 302, 1228, 405, 281, 119,
160718
- /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160719
- /* 770 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160720
- /* 780 */ 120, 121, 121, 121, 121, 407, 452, 1183, 1184, 1185,
160721
- /* 790 */ 1183, 1184, 1185, 275, 275, 269, 269, 489, 483, 1525,
160722
- /* 800 */ 148, 363, 480, 564, 306, 555, 561, 489, 561, 122,
160723
- /* 810 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160724
- /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 293, 119,
160725
- /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160726
- /* 840 */ 1183, 420, 1316, 564, 98, 417, 199, 13, 13, 150,
160727
- /* 850 */ 306, 555, 1312, 322, 386, 407, 506, 478, 562, 400,
160728
- /* 860 */ 920, 920, 425, 1539, 887, 292, 71, 71, 119, 119,
160729
- /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122,
160730
- /* 880 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160731
- /* 890 */ 121, 121, 121, 121, 564, 1149, 1183, 1184, 1185, 407,
160732
- /* 900 */ 275, 275, 451, 303, 1089, 1089, 486, 448, 1149, 276,
160733
- /* 910 */ 276, 1149, 1539, 561, 319, 286, 321, 71, 71, 429,
160734
- /* 920 */ 451, 450, 561, 952, 101, 1207, 1207, 1041, 113, 1044,
160735
- /* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119,
160736
- /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105,
160737
- /* 950 */ 1183, 1547, 564, 12, 437, 6, 329, 564, 834, 835,
160738
- /* 960 */ 836, 1629, 393, 547, 1106, 246, 245, 244, 1545, 1258,
160739
- /* 970 */ 413, 1521, 6, 1086, 310, 71, 71, 1086, 564, 1107,
160740
- /* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117,
160741
- /* 990 */ 117, 116, 442, 451, 104, 427, 537, 320, 275, 275,
160742
- /* 1000 */ 906, 13, 13, 520, 1482, 1105, 1183, 1184, 1185, 484,
160743
- /* 1010 */ 907, 561, 546, 564, 407, 536, 295, 478, 253, 200,
160744
- /* 1020 */ 1106, 548, 1482, 1484, 1160, 1409, 16, 16, 126, 557,
160745
- /* 1030 */ 413, 479, 311, 951, 407, 1107, 71, 71, 122, 123,
160746
- /* 1040 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160747
- /* 1050 */ 121, 121, 121, 1204, 407, 544, 552, 314, 122, 123,
160748
- /* 1060 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160749
- /* 1070 */ 121, 121, 121, 441, 144, 1160, 468, 146, 122, 111,
160750
- /* 1080 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160751
- /* 1090 */ 121, 121, 121, 247, 12, 1482, 422, 119, 119, 119,
160752
- /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564,
160753
- /* 1110 */ 1204, 207, 404, 403, 858, 950, 294, 119, 119, 119,
160754
- /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 30,
160755
- /* 1130 */ 564, 1409, 55, 55, 1599, 564, 895, 119, 119, 119,
160756
- /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 510, 1409,
160757
- /* 1150 */ 1409, 56, 56, 15, 15, 439, 438, 407, 13, 13,
160758
- /* 1160 */ 31, 1187, 412, 1211, 1183, 1184, 1185, 196, 1213, 306,
160759
- /* 1170 */ 555, 858, 462, 193, 926, 564, 1212, 489, 361, 925,
160760
- /* 1180 */ 1183, 564, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160761
- /* 1190 */ 120, 120, 121, 121, 121, 121, 1544, 1149, 43, 43,
160762
- /* 1200 */ 6, 1214, 423, 1214, 13, 13, 564, 219, 538, 494,
160763
- /* 1210 */ 1149, 108, 556, 1149, 4, 392, 1127, 434, 1187, 194,
160764
- /* 1220 */ 424, 485, 337, 1315, 414, 171, 1253, 1321, 559, 57,
160765
- /* 1230 */ 57, 564, 950, 564, 224, 247, 1183, 1184, 1185, 561,
160766
- /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160767
- /* 1250 */ 442, 443, 564, 517, 13, 13, 44, 44, 275, 275,
160768
- /* 1260 */ 1409, 275, 275, 553, 1353, 529, 213, 549, 456, 543,
160769
- /* 1270 */ 465, 561, 564, 137, 561, 58, 58, 469, 405, 1222,
160770
- /* 1280 */ 405, 274, 217, 108, 556, 110, 4, 405, 275, 275,
160771
- /* 1290 */ 564, 1352, 1021, 564, 1228, 59, 59, 523, 106, 106,
160772
- /* 1300 */ 559, 561, 275, 275, 412, 107, 457, 443, 566, 565,
160773
- /* 1310 */ 564, 8, 1011, 60, 60, 561, 61, 61, 564, 965,
160774
- /* 1320 */ 349, 926, 305, 443, 84, 204, 925, 966, 564, 306,
160775
- /* 1330 */ 555, 435, 405, 62, 62, 553, 476, 105, 564, 103,
160776
- /* 1340 */ 464, 45, 45, 1203, 1011, 1011, 1013, 1014, 27, 533,
160777
- /* 1350 */ 564, 46, 46, 453, 532, 1572, 1171, 445, 1528, 564,
160778
- /* 1360 */ 279, 47, 47, 327, 1021, 390, 390, 389, 264, 387,
160779
- /* 1370 */ 106, 106, 843, 49, 49, 108, 556, 107, 4, 443,
160780
- /* 1380 */ 566, 565, 50, 50, 1011, 225, 564, 313, 564, 96,
160781
- /* 1390 */ 564, 228, 559, 524, 147, 312, 38, 1123, 564, 394,
160782
- /* 1400 */ 466, 328, 280, 98, 544, 564, 17, 564, 323, 63,
160783
- /* 1410 */ 63, 64, 64, 65, 65, 443, 1011, 1011, 1013, 1014,
160784
- /* 1420 */ 27, 14, 14, 289, 564, 227, 564, 553, 66, 66,
160785
- /* 1430 */ 128, 128, 477, 162, 564, 309, 135, 564, 1003, 277,
160786
- /* 1440 */ 252, 533, 564, 1501, 564, 418, 534, 67, 67, 52,
160787
- /* 1450 */ 52, 564, 1287, 226, 564, 1500, 1021, 68, 68, 208,
160788
- /* 1460 */ 69, 69, 106, 106, 1286, 53, 53, 157, 157, 107,
160789
- /* 1470 */ 873, 443, 566, 565, 158, 158, 1011, 76, 76, 564,
160790
- /* 1480 */ 357, 564, 108, 556, 471, 4, 252, 408, 885, 884,
160791
- /* 1490 */ 356, 564, 306, 555, 564, 473, 564, 252, 481, 559,
160792
- /* 1500 */ 564, 334, 54, 54, 72, 72, 564, 230, 1011, 1011,
160793
- /* 1510 */ 1013, 1014, 27, 564, 129, 129, 449, 73, 73, 130,
160794
- /* 1520 */ 130, 564, 443, 131, 131, 519, 564, 873, 564, 127,
160795
- /* 1530 */ 127, 333, 1071, 98, 553, 1349, 156, 156, 564, 495,
160796
- /* 1540 */ 347, 249, 98, 338, 155, 155, 892, 893, 533, 136,
160797
- /* 1550 */ 136, 134, 134, 532, 341, 1171, 445, 1587, 564, 279,
160798
- /* 1560 */ 343, 132, 132, 1021, 390, 390, 389, 264, 387, 106,
160799
- /* 1570 */ 106, 843, 564, 1067, 564, 249, 107, 564, 443, 566,
160800
- /* 1580 */ 565, 133, 133, 1011, 225, 1015, 313, 108, 556, 1071,
160801
- /* 1590 */ 4, 345, 968, 969, 312, 75, 75, 77, 77, 1300,
160802
- /* 1600 */ 74, 74, 564, 1132, 559, 564, 108, 556, 959, 4,
160803
- /* 1610 */ 252, 923, 1083, 110, 1083, 1011, 1011, 1013, 1014, 27,
160804
- /* 1620 */ 1082, 1285, 1082, 559, 227, 42, 42, 443, 48, 48,
160805
- /* 1630 */ 1284, 856, 162, 145, 924, 135, 110, 352, 362, 553,
160806
- /* 1640 */ 1340, 1361, 1015, 1408, 1336, 301, 443, 1561, 1347, 550,
160807
- /* 1650 */ 1414, 551, 226, 202, 1265, 1333, 1256, 1244, 553, 1243,
160808
- /* 1660 */ 490, 1245, 1580, 267, 11, 391, 210, 223, 1021, 1390,
160809
- /* 1670 */ 1395, 282, 365, 367, 106, 106, 930, 369, 454, 285,
160810
- /* 1680 */ 1383, 107, 325, 443, 566, 565, 408, 1021, 1011, 326,
160811
- /* 1690 */ 475, 306, 555, 106, 106, 100, 556, 500, 4, 1400,
160812
- /* 1700 */ 107, 1399, 443, 566, 565, 398, 1283, 1011, 214, 355,
160813
- /* 1710 */ 1473, 290, 559, 1472, 1583, 449, 554, 371, 331, 197,
160814
- /* 1720 */ 1011, 1011, 1013, 1014, 27, 198, 209, 385, 1222, 173,
160815
- /* 1730 */ 221, 256, 1520, 1518, 1219, 443, 79, 416, 206, 1011,
160816
- /* 1740 */ 1011, 1013, 1014, 27, 83, 279, 182, 553, 82, 167,
160817
- /* 1750 */ 390, 390, 389, 264, 387, 35, 1396, 843, 1478, 459,
160818
- /* 1760 */ 175, 177, 460, 493, 178, 179, 180, 233, 96, 396,
160819
- /* 1770 */ 225, 1402, 313, 1401, 36, 1404, 1021, 467, 186, 482,
160820
- /* 1780 */ 312, 399, 106, 106, 237, 1467, 89, 1489, 488, 107,
160821
- /* 1790 */ 239, 443, 566, 565, 268, 336, 1011, 190, 491, 340,
160822
- /* 1800 */ 240, 401, 1246, 241, 509, 1294, 430, 1303, 91, 877,
160823
- /* 1810 */ 227, 215, 1566, 1302, 1301, 1273, 1598, 432, 162, 518,
160824
- /* 1820 */ 1272, 135, 1597, 354, 402, 433, 1271, 1596, 1011, 1011,
160825
- /* 1830 */ 1013, 1014, 27, 1293, 299, 360, 300, 525, 226, 95,
160826
- /* 1840 */ 254, 255, 1344, 364, 436, 125, 544, 1552, 10, 1453,
160827
- /* 1850 */ 379, 1551, 102, 304, 97, 528, 34, 568, 1177, 263,
160828
- /* 1860 */ 265, 266, 569, 1241, 1236, 172, 409, 410, 159, 383,
160829
- /* 1870 */ 377, 366, 408, 1345, 1343, 368, 370, 306, 555, 1342,
160830
- /* 1880 */ 1326, 1325, 1368, 201, 384, 1367, 1505, 1506, 160, 1504,
160831
- /* 1890 */ 1503, 142, 161, 211, 212, 78, 830, 444, 203, 308,
160832
- /* 1900 */ 297, 449, 222, 1081, 139, 1079, 316, 174, 163, 1203,
160833
- /* 1910 */ 229, 176, 232, 909, 324, 1095, 164, 181, 165, 419,
160834
- /* 1920 */ 421, 183, 85, 86, 87, 88, 166, 1098, 235, 234,
160835
- /* 1930 */ 1094, 152, 18, 236, 335, 1087, 252, 1216, 487, 238,
160836
- /* 1940 */ 37, 187, 188, 845, 492, 356, 242, 348, 496, 189,
160837
- /* 1950 */ 90, 93, 19, 20, 168, 875, 501, 351, 92, 504,
160838
- /* 1960 */ 888, 153, 511, 1133, 1165, 154, 298, 1047, 94, 1134,
160839
- /* 1970 */ 39, 958, 216, 271, 273, 192, 953, 110, 1151, 251,
160840
- /* 1980 */ 1155, 21, 1159, 22, 1158, 1139, 1153, 33, 23, 24,
160841
- /* 1990 */ 540, 25, 195, 98, 26, 1062, 1048, 1046, 1050, 1104,
160842
- /* 2000 */ 7, 1103, 257, 258, 1051, 28, 40, 560, 1016, 857,
160843
- /* 2010 */ 109, 29, 919, 138, 259, 260, 170, 1589, 388, 1588,
160844
- /* 2020 */ 1173, 1172,
160862
+ /* 0 */ 566, 1307, 566, 1286, 201, 201, 566, 116, 112, 222,
160863
+ /* 10 */ 566, 1307, 377, 566, 116, 112, 222, 397, 408, 409,
160864
+ /* 20 */ 1260, 378, 1269, 41, 41, 41, 41, 1412, 1517, 71,
160865
+ /* 30 */ 71, 967, 1258, 41, 41, 491, 71, 71, 272, 968,
160866
+ /* 40 */ 298, 476, 298, 123, 124, 114, 1210, 1210, 1044, 1047,
160867
+ /* 50 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 543, 409,
160868
+ /* 60 */ 1234, 1, 1, 573, 2, 1238, 548, 116, 112, 222,
160869
+ /* 70 */ 309, 480, 142, 548, 1272, 524, 116, 112, 222, 1320,
160870
+ /* 80 */ 417, 523, 547, 123, 124, 114, 1210, 1210, 1044, 1047,
160871
+ /* 90 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 424, 116,
160872
+ /* 100 */ 112, 222, 120, 120, 120, 120, 119, 119, 118, 118,
160873
+ /* 110 */ 118, 117, 113, 444, 277, 277, 277, 277, 560, 560,
160874
+ /* 120 */ 560, 1558, 376, 1560, 1186, 375, 1157, 563, 1157, 563,
160875
+ /* 130 */ 409, 1558, 537, 252, 219, 1553, 99, 141, 449, 6,
160876
+ /* 140 */ 365, 233, 120, 120, 120, 120, 119, 119, 118, 118,
160877
+ /* 150 */ 118, 117, 113, 444, 123, 124, 114, 1210, 1210, 1044,
160878
+ /* 160 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 138,
160879
+ /* 170 */ 289, 1186, 1546, 448, 118, 118, 118, 117, 113, 444,
160880
+ /* 180 */ 125, 1186, 1187, 1188, 144, 465, 334, 566, 150, 127,
160881
+ /* 190 */ 444, 122, 122, 122, 122, 115, 120, 120, 120, 120,
160882
+ /* 200 */ 119, 119, 118, 118, 118, 117, 113, 444, 454, 419,
160883
+ /* 210 */ 13, 13, 215, 120, 120, 120, 120, 119, 119, 118,
160884
+ /* 220 */ 118, 118, 117, 113, 444, 422, 308, 557, 1186, 1187,
160885
+ /* 230 */ 1188, 441, 440, 409, 1271, 122, 122, 122, 122, 120,
160886
+ /* 240 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113,
160887
+ /* 250 */ 444, 1543, 98, 1033, 1033, 1045, 1048, 123, 124, 114,
160888
+ /* 260 */ 1210, 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122,
160889
+ /* 270 */ 122, 122, 566, 406, 405, 1186, 566, 409, 1217, 319,
160890
+ /* 280 */ 1217, 80, 81, 120, 120, 120, 120, 119, 119, 118,
160891
+ /* 290 */ 118, 118, 117, 113, 444, 70, 70, 1186, 1604, 71,
160892
+ /* 300 */ 71, 123, 124, 114, 1210, 1210, 1044, 1047, 1036, 1036,
160893
+ /* 310 */ 121, 121, 122, 122, 122, 122, 120, 120, 120, 120,
160894
+ /* 320 */ 119, 119, 118, 118, 118, 117, 113, 444, 1037, 210,
160895
+ /* 330 */ 1186, 365, 1186, 1187, 1188, 245, 548, 399, 504, 501,
160896
+ /* 340 */ 500, 108, 558, 138, 4, 516, 933, 433, 499, 217,
160897
+ /* 350 */ 514, 522, 352, 879, 1186, 1187, 1188, 383, 561, 566,
160898
+ /* 360 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
160899
+ /* 370 */ 113, 444, 277, 277, 16, 16, 1598, 441, 440, 153,
160900
+ /* 380 */ 409, 445, 13, 13, 1279, 563, 1214, 1186, 1187, 1188,
160901
+ /* 390 */ 1003, 1216, 264, 555, 1574, 186, 566, 427, 138, 1215,
160902
+ /* 400 */ 308, 557, 472, 138, 123, 124, 114, 1210, 1210, 1044,
160903
+ /* 410 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 55,
160904
+ /* 420 */ 55, 413, 1023, 507, 1217, 1186, 1217, 474, 106, 106,
160905
+ /* 430 */ 1312, 1312, 1186, 171, 566, 384, 107, 380, 445, 568,
160906
+ /* 440 */ 567, 430, 1543, 1013, 332, 549, 565, 263, 280, 360,
160907
+ /* 450 */ 510, 355, 509, 250, 491, 308, 557, 71, 71, 351,
160908
+ /* 460 */ 308, 557, 374, 120, 120, 120, 120, 119, 119, 118,
160909
+ /* 470 */ 118, 118, 117, 113, 444, 1013, 1013, 1015, 1016, 27,
160910
+ /* 480 */ 277, 277, 1186, 1187, 1188, 1152, 566, 528, 409, 1186,
160911
+ /* 490 */ 1187, 1188, 348, 563, 548, 1260, 533, 517, 1152, 1516,
160912
+ /* 500 */ 317, 1152, 285, 550, 485, 569, 566, 569, 482, 51,
160913
+ /* 510 */ 51, 207, 123, 124, 114, 1210, 1210, 1044, 1047, 1036,
160914
+ /* 520 */ 1036, 121, 121, 122, 122, 122, 122, 171, 1412, 13,
160915
+ /* 530 */ 13, 409, 277, 277, 1186, 505, 119, 119, 118, 118,
160916
+ /* 540 */ 118, 117, 113, 444, 429, 563, 518, 220, 515, 1552,
160917
+ /* 550 */ 365, 546, 1186, 6, 532, 123, 124, 114, 1210, 1210,
160918
+ /* 560 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160919
+ /* 570 */ 145, 120, 120, 120, 120, 119, 119, 118, 118, 118,
160920
+ /* 580 */ 117, 113, 444, 245, 566, 474, 504, 501, 500, 566,
160921
+ /* 590 */ 1481, 1186, 1187, 1188, 1310, 1310, 499, 1186, 149, 425,
160922
+ /* 600 */ 1186, 480, 409, 274, 365, 952, 872, 56, 56, 1186,
160923
+ /* 610 */ 1187, 1188, 71, 71, 120, 120, 120, 120, 119, 119,
160924
+ /* 620 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160925
+ /* 630 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160926
+ /* 640 */ 122, 409, 541, 1552, 83, 865, 98, 6, 928, 529,
160927
+ /* 650 */ 848, 543, 151, 927, 1186, 1187, 1188, 1186, 1187, 1188,
160928
+ /* 660 */ 290, 1543, 187, 1633, 395, 123, 124, 114, 1210, 1210,
160929
+ /* 670 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160930
+ /* 680 */ 566, 954, 566, 453, 953, 120, 120, 120, 120, 119,
160931
+ /* 690 */ 119, 118, 118, 118, 117, 113, 444, 1152, 221, 1186,
160932
+ /* 700 */ 331, 453, 452, 13, 13, 13, 13, 1003, 365, 463,
160933
+ /* 710 */ 1152, 193, 409, 1152, 382, 1543, 1170, 32, 297, 474,
160934
+ /* 720 */ 195, 1527, 5, 952, 120, 120, 120, 120, 119, 119,
160935
+ /* 730 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160936
+ /* 740 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160937
+ /* 750 */ 122, 409, 1067, 419, 1186, 1024, 1186, 1187, 1188, 1186,
160938
+ /* 760 */ 419, 332, 460, 320, 544, 1545, 442, 442, 442, 566,
160939
+ /* 770 */ 3, 117, 113, 444, 453, 123, 124, 114, 1210, 1210,
160940
+ /* 780 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160941
+ /* 790 */ 1473, 566, 15, 15, 293, 120, 120, 120, 120, 119,
160942
+ /* 800 */ 119, 118, 118, 118, 117, 113, 444, 1186, 566, 1486,
160943
+ /* 810 */ 1412, 1186, 1187, 1188, 13, 13, 1186, 1187, 1188, 1544,
160944
+ /* 820 */ 271, 271, 409, 286, 308, 557, 1008, 1486, 1488, 196,
160945
+ /* 830 */ 288, 71, 71, 563, 120, 120, 120, 120, 119, 119,
160946
+ /* 840 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160947
+ /* 850 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160948
+ /* 860 */ 122, 409, 201, 1087, 1186, 1187, 1188, 1324, 304, 1529,
160949
+ /* 870 */ 388, 278, 278, 450, 564, 402, 922, 922, 566, 563,
160950
+ /* 880 */ 566, 426, 491, 480, 563, 123, 124, 114, 1210, 1210,
160951
+ /* 890 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160952
+ /* 900 */ 1486, 71, 71, 13, 13, 120, 120, 120, 120, 119,
160953
+ /* 910 */ 119, 118, 118, 118, 117, 113, 444, 566, 545, 566,
160954
+ /* 920 */ 1577, 573, 2, 1238, 1092, 1092, 488, 1480, 309, 1525,
160955
+ /* 930 */ 142, 324, 409, 836, 837, 838, 312, 1320, 305, 363,
160956
+ /* 940 */ 43, 43, 57, 57, 120, 120, 120, 120, 119, 119,
160957
+ /* 950 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160958
+ /* 960 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160959
+ /* 970 */ 122, 12, 277, 277, 566, 1152, 409, 572, 428, 1238,
160960
+ /* 980 */ 465, 334, 296, 474, 309, 563, 142, 249, 1152, 308,
160961
+ /* 990 */ 557, 1152, 321, 1320, 323, 491, 455, 71, 71, 233,
160962
+ /* 1000 */ 283, 101, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121,
160963
+ /* 1010 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119,
160964
+ /* 1020 */ 119, 118, 118, 118, 117, 113, 444, 1108, 277, 277,
160965
+ /* 1030 */ 1412, 448, 394, 1230, 439, 277, 277, 248, 247, 246,
160966
+ /* 1040 */ 1319, 563, 1109, 313, 198, 294, 491, 1318, 563, 464,
160967
+ /* 1050 */ 566, 1427, 394, 1130, 1023, 233, 414, 1110, 295, 120,
160968
+ /* 1060 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113,
160969
+ /* 1070 */ 444, 1014, 104, 71, 71, 1013, 322, 496, 908, 566,
160970
+ /* 1080 */ 277, 277, 277, 277, 1108, 1261, 415, 448, 909, 361,
160971
+ /* 1090 */ 1571, 1315, 409, 563, 952, 563, 9, 202, 255, 1109,
160972
+ /* 1100 */ 316, 487, 44, 44, 249, 559, 415, 1013, 1013, 1015,
160973
+ /* 1110 */ 443, 1231, 409, 1603, 1110, 897, 123, 124, 114, 1210,
160974
+ /* 1120 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160975
+ /* 1130 */ 122, 1231, 409, 1207, 215, 554, 123, 124, 114, 1210,
160976
+ /* 1140 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160977
+ /* 1150 */ 122, 1131, 1631, 470, 1631, 255, 123, 111, 114, 1210,
160978
+ /* 1160 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160979
+ /* 1170 */ 122, 1131, 1632, 414, 1632, 120, 120, 120, 120, 119,
160980
+ /* 1180 */ 119, 118, 118, 118, 117, 113, 444, 221, 209, 351,
160981
+ /* 1190 */ 1207, 1207, 147, 1426, 491, 120, 120, 120, 120, 119,
160982
+ /* 1200 */ 119, 118, 118, 118, 117, 113, 444, 1256, 539, 519,
160983
+ /* 1210 */ 888, 551, 952, 12, 566, 120, 120, 120, 120, 119,
160984
+ /* 1220 */ 119, 118, 118, 118, 117, 113, 444, 538, 566, 860,
160985
+ /* 1230 */ 1129, 361, 1571, 346, 1356, 409, 1163, 58, 58, 339,
160986
+ /* 1240 */ 1355, 508, 277, 277, 277, 277, 277, 277, 1207, 889,
160987
+ /* 1250 */ 1129, 59, 59, 459, 363, 563, 566, 563, 96, 563,
160988
+ /* 1260 */ 124, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121, 121,
160989
+ /* 1270 */ 122, 122, 122, 122, 566, 1412, 566, 281, 1186, 60,
160990
+ /* 1280 */ 60, 110, 392, 392, 391, 266, 389, 860, 1163, 845,
160991
+ /* 1290 */ 566, 481, 566, 436, 341, 1152, 344, 61, 61, 62,
160992
+ /* 1300 */ 62, 967, 227, 1550, 315, 431, 540, 6, 1152, 968,
160993
+ /* 1310 */ 566, 1152, 314, 45, 45, 46, 46, 512, 120, 120,
160994
+ /* 1320 */ 120, 120, 119, 119, 118, 118, 118, 117, 113, 444,
160995
+ /* 1330 */ 416, 173, 1532, 47, 47, 1186, 1187, 1188, 108, 558,
160996
+ /* 1340 */ 325, 4, 229, 1551, 928, 566, 437, 6, 566, 927,
160997
+ /* 1350 */ 164, 566, 1290, 137, 1190, 561, 566, 1549, 566, 1089,
160998
+ /* 1360 */ 566, 6, 566, 1089, 531, 566, 868, 8, 49, 49,
160999
+ /* 1370 */ 228, 50, 50, 566, 63, 63, 566, 457, 445, 64,
161000
+ /* 1380 */ 64, 65, 65, 14, 14, 66, 66, 407, 129, 129,
161001
+ /* 1390 */ 555, 566, 458, 566, 1505, 486, 67, 67, 566, 52,
161002
+ /* 1400 */ 52, 546, 407, 467, 535, 410, 226, 1023, 566, 534,
161003
+ /* 1410 */ 308, 557, 1190, 407, 68, 68, 69, 69, 566, 1023,
161004
+ /* 1420 */ 566, 53, 53, 868, 1014, 106, 106, 525, 1013, 566,
161005
+ /* 1430 */ 1504, 159, 159, 107, 451, 445, 568, 567, 471, 307,
161006
+ /* 1440 */ 1013, 160, 160, 76, 76, 566, 1548, 466, 407, 407,
161007
+ /* 1450 */ 6, 1225, 54, 54, 478, 276, 219, 566, 887, 886,
161008
+ /* 1460 */ 1013, 1013, 1015, 84, 206, 1206, 230, 282, 72, 72,
161009
+ /* 1470 */ 329, 483, 1013, 1013, 1015, 1016, 27, 1576, 1174, 447,
161010
+ /* 1480 */ 130, 130, 281, 148, 105, 38, 103, 392, 392, 391,
161011
+ /* 1490 */ 266, 389, 566, 1126, 845, 396, 566, 108, 558, 566,
161012
+ /* 1500 */ 4, 311, 566, 30, 17, 566, 279, 227, 566, 315,
161013
+ /* 1510 */ 108, 558, 468, 4, 561, 73, 73, 314, 566, 157,
161014
+ /* 1520 */ 157, 566, 131, 131, 526, 132, 132, 561, 128, 128,
161015
+ /* 1530 */ 566, 158, 158, 566, 31, 291, 566, 445, 330, 521,
161016
+ /* 1540 */ 98, 152, 152, 420, 136, 136, 1005, 229, 254, 555,
161017
+ /* 1550 */ 445, 479, 336, 135, 135, 164, 133, 133, 137, 134,
161018
+ /* 1560 */ 134, 875, 555, 535, 566, 473, 566, 254, 536, 475,
161019
+ /* 1570 */ 335, 254, 98, 894, 895, 228, 535, 566, 1023, 566,
161020
+ /* 1580 */ 1074, 534, 210, 232, 106, 106, 1352, 75, 75, 77,
161021
+ /* 1590 */ 77, 1023, 107, 340, 445, 568, 567, 106, 106, 1013,
161022
+ /* 1600 */ 74, 74, 42, 42, 566, 107, 343, 445, 568, 567,
161023
+ /* 1610 */ 410, 497, 1013, 251, 359, 308, 557, 1135, 349, 875,
161024
+ /* 1620 */ 98, 1070, 345, 251, 358, 1591, 347, 48, 48, 1017,
161025
+ /* 1630 */ 1303, 1013, 1013, 1015, 1016, 27, 1289, 1287, 1074, 451,
161026
+ /* 1640 */ 961, 925, 254, 110, 1013, 1013, 1015, 1016, 27, 1174,
161027
+ /* 1650 */ 447, 970, 971, 281, 108, 558, 1288, 4, 392, 392,
161028
+ /* 1660 */ 391, 266, 389, 1343, 1086, 845, 1086, 1085, 858, 1085,
161029
+ /* 1670 */ 146, 561, 926, 354, 110, 303, 364, 553, 227, 1364,
161030
+ /* 1680 */ 315, 108, 558, 1411, 4, 1339, 492, 1017, 314, 1350,
161031
+ /* 1690 */ 1565, 552, 1417, 1268, 445, 204, 1259, 1247, 561, 1246,
161032
+ /* 1700 */ 1248, 1584, 269, 1336, 367, 369, 555, 371, 11, 212,
161033
+ /* 1710 */ 393, 225, 1393, 284, 1398, 456, 287, 327, 229, 328,
161034
+ /* 1720 */ 292, 445, 1386, 216, 333, 1403, 164, 477, 373, 137,
161035
+ /* 1730 */ 1402, 400, 502, 555, 1286, 1023, 357, 1477, 199, 1587,
161036
+ /* 1740 */ 211, 106, 106, 932, 1476, 1225, 228, 556, 175, 107,
161037
+ /* 1750 */ 200, 445, 568, 567, 258, 387, 1013, 1524, 1522, 223,
161038
+ /* 1760 */ 1222, 418, 1023, 83, 208, 79, 82, 184, 106, 106,
161039
+ /* 1770 */ 1482, 169, 177, 461, 179, 462, 107, 1399, 445, 568,
161040
+ /* 1780 */ 567, 410, 180, 1013, 495, 181, 308, 557, 1013, 1013,
161041
+ /* 1790 */ 1015, 1016, 27, 182, 35, 235, 100, 558, 398, 4,
161042
+ /* 1800 */ 96, 1405, 1404, 36, 484, 469, 1407, 188, 401, 1471,
161043
+ /* 1810 */ 451, 89, 1493, 561, 239, 1013, 1013, 1015, 1016, 27,
161044
+ /* 1820 */ 490, 338, 270, 241, 192, 342, 493, 242, 403, 1249,
161045
+ /* 1830 */ 243, 511, 432, 1297, 1306, 91, 445, 1305, 1304, 879,
161046
+ /* 1840 */ 217, 434, 435, 1570, 1276, 1602, 520, 1601, 555, 301,
161047
+ /* 1850 */ 527, 404, 1275, 302, 356, 1274, 1600, 95, 1347, 366,
161048
+ /* 1860 */ 1296, 362, 1348, 368, 256, 257, 1556, 1555, 438, 1346,
161049
+ /* 1870 */ 370, 126, 1345, 10, 1371, 546, 381, 1023, 102, 1457,
161050
+ /* 1880 */ 97, 530, 34, 106, 106, 570, 1180, 372, 265, 1329,
161051
+ /* 1890 */ 379, 107, 203, 445, 568, 567, 1328, 385, 1013, 1370,
161052
+ /* 1900 */ 386, 267, 268, 571, 1244, 161, 1239, 162, 1509, 1510,
161053
+ /* 1910 */ 1508, 143, 1507, 299, 832, 213, 214, 78, 446, 205,
161054
+ /* 1920 */ 310, 306, 163, 224, 1084, 140, 1082, 318, 165, 176,
161055
+ /* 1930 */ 1013, 1013, 1015, 1016, 27, 178, 1206, 231, 911, 234,
161056
+ /* 1940 */ 326, 1098, 183, 421, 166, 167, 411, 185, 85, 423,
161057
+ /* 1950 */ 412, 86, 174, 87, 168, 88, 1101, 236, 1097, 237,
161058
+ /* 1960 */ 154, 18, 238, 254, 337, 1219, 489, 1090, 240, 190,
161059
+ /* 1970 */ 37, 847, 189, 494, 358, 244, 350, 506, 191, 877,
161060
+ /* 1980 */ 90, 498, 19, 20, 503, 92, 353, 890, 300, 170,
161061
+ /* 1990 */ 155, 93, 513, 94, 1168, 156, 1050, 1137, 39, 218,
161062
+ /* 2000 */ 273, 275, 1136, 960, 194, 955, 110, 1154, 1158, 253,
161063
+ /* 2010 */ 7, 1162, 1156, 21, 22, 1161, 1142, 23, 24, 25,
161064
+ /* 2020 */ 33, 542, 26, 260, 197, 98, 1065, 1051, 1049, 1053,
161065
+ /* 2030 */ 1107, 1054, 1106, 259, 28, 40, 562, 1018, 859, 109,
161066
+ /* 2040 */ 29, 921, 390, 1176, 172, 139, 1175, 1235, 261, 1235,
161067
+ /* 2050 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 262, 1235, 1235,
161068
+ /* 2060 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1593, 1592,
160845161069
};
160846161070
static const YYCODETYPE yy_lookahead[] = {
160847
- /* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192,
160848
- /* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19,
160849
- /* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210,
160850
- /* 30 */ 211, 31, 215, 216, 205, 215, 216, 215, 216, 39,
160851
- /* 40 */ 227, 215, 229, 43, 44, 45, 46, 47, 48, 49,
160852
- /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 19,
160853
- /* 60 */ 238, 239, 238, 239, 215, 273, 274, 275, 273, 274,
160854
- /* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255,
160855
- /* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49,
160856
- /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210,
160857
- /* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109,
160858
- /* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307,
160859
- /* 120 */ 308, 313, 314, 25, 312, 192, 86, 261, 88, 19,
160860
- /* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55,
160861
- /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
160862
- /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160863
- /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115,
160864
- /* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69,
160865
- /* 180 */ 204, 22, 23, 16, 25, 131, 102, 103, 104, 105,
160866
- /* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19,
160867
- /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
160868
- /* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109,
160869
- /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160870
- /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 141,
160871
- /* 240 */ 307, 308, 272, 24, 77, 312, 79, 67, 102, 103,
160872
- /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277,
160873
- /* 260 */ 101, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160874
- /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 127, 128,
160875
- /* 280 */ 310, 311, 102, 103, 104, 105, 106, 107, 108, 109,
160876
- /* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186,
160877
- /* 300 */ 187, 188, 189, 194, 76, 196, 192, 194, 19, 196,
160878
- /* 310 */ 59, 25, 203, 192, 59, 87, 203, 89, 164, 165,
160879
- /* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160880
- /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160881
- /* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73,
160882
- /* 350 */ 192, 238, 239, 22, 23, 100, 25, 81, 237, 229,
160883
- /* 360 */ 251, 23, 204, 25, 251, 272, 115, 116, 117, 214,
160884
- /* 370 */ 115, 116, 144, 192, 265, 120, 262, 222, 265, 102,
160885
- /* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160886
- /* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160887
- /* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154,
160888
- /* 410 */ 297, 125, 192, 137, 138, 19, 295, 100, 192, 23,
160889
- /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216,
160890
- /* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43,
160891
- /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160892
- /* 450 */ 54, 55, 56, 57, 222, 117, 224, 59, 19, 187,
160893
- /* 460 */ 59, 189, 23, 282, 232, 252, 194, 192, 196, 152,
160894
- /* 470 */ 153, 154, 252, 72, 261, 203, 152, 248, 154, 250,
160895
- /* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50,
160896
- /* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103,
160897
- /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267,
160898
- /* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192,
160899
- /* 520 */ 59, 118, 192, 251, 121, 122, 123, 73, 19, 192,
160900
- /* 530 */ 59, 192, 23, 72, 131, 308, 22, 265, 22, 312,
160901
- /* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160902
- /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160903
- /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 192, 297,
160904
- /* 570 */ 192, 23, 267, 59, 203, 59, 115, 116, 117, 108,
160905
- /* 580 */ 126, 127, 128, 192, 192, 192, 115, 116, 117, 262,
160906
- /* 590 */ 59, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160907
- /* 600 */ 52, 53, 54, 55, 56, 57, 267, 215, 216, 238,
160908
- /* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160909
- /* 620 */ 111, 112, 251, 45, 46, 47, 59, 49, 291, 115,
160910
- /* 630 */ 116, 117, 116, 81, 192, 305, 306, 19, 192, 268,
160911
- /* 640 */ 19, 23, 22, 192, 252, 24, 115, 116, 117, 192,
160912
- /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160913
- /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160914
- /* 670 */ 52, 53, 54, 55, 56, 57, 19, 22, 23, 59,
160915
- /* 680 */ 23, 303, 115, 116, 117, 192, 240, 234, 235, 137,
160916
- /* 690 */ 138, 240, 308, 192, 22, 192, 312, 22, 120, 306,
160917
- /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160918
- /* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216,
160919
- /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160920
- /* 730 */ 112, 59, 231, 112, 59, 115, 116, 117, 25, 118,
160921
- /* 740 */ 119, 120, 121, 122, 123, 124, 19, 243, 81, 303,
160922
- /* 750 */ 23, 130, 192, 192, 303, 252, 101, 253, 203, 102,
160923
- /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160924
- /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160925
- /* 780 */ 53, 54, 55, 56, 57, 19, 119, 115, 116, 117,
160926
- /* 790 */ 115, 116, 117, 238, 239, 238, 239, 192, 280, 192,
160927
- /* 800 */ 240, 192, 284, 192, 137, 138, 251, 192, 251, 43,
160928
- /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160929
- /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 267, 102,
160930
- /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160931
- /* 840 */ 59, 230, 237, 192, 25, 192, 192, 215, 216, 240,
160932
- /* 850 */ 137, 138, 237, 16, 200, 19, 66, 192, 133, 205,
160933
- /* 860 */ 135, 136, 230, 303, 74, 203, 215, 216, 102, 103,
160934
- /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
160935
- /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160936
- /* 890 */ 54, 55, 56, 57, 192, 76, 115, 116, 117, 19,
160937
- /* 900 */ 238, 239, 192, 252, 126, 127, 128, 192, 89, 238,
160938
- /* 910 */ 239, 92, 303, 251, 77, 262, 79, 215, 216, 129,
160939
- /* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49,
160940
- /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
160941
- /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12,
160942
- /* 950 */ 59, 308, 192, 212, 252, 312, 291, 192, 7, 8,
160943
- /* 960 */ 9, 300, 301, 203, 27, 126, 127, 128, 308, 207,
160944
- /* 970 */ 208, 192, 312, 29, 192, 215, 216, 33, 192, 42,
160945
- /* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109,
160946
- /* 990 */ 110, 111, 112, 283, 158, 230, 66, 160, 238, 239,
160947
- /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 65,
160948
- /* 1010 */ 73, 251, 252, 192, 19, 85, 230, 192, 24, 24,
160949
- /* 1020 */ 27, 261, 210, 211, 94, 192, 215, 216, 22, 207,
160950
- /* 1030 */ 208, 290, 192, 142, 19, 42, 215, 216, 43, 44,
160951
- /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160952
- /* 1050 */ 55, 56, 57, 59, 19, 144, 63, 192, 43, 44,
160953
- /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160954
- /* 1070 */ 55, 56, 57, 252, 163, 145, 114, 22, 43, 44,
160955
- /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160956
- /* 1090 */ 55, 56, 57, 45, 212, 283, 263, 102, 103, 104,
160957
- /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192,
160958
- /* 1110 */ 116, 149, 106, 107, 59, 25, 291, 102, 103, 104,
160959
- /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 22,
160960
- /* 1130 */ 192, 192, 215, 216, 23, 192, 25, 102, 103, 104,
160961
- /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 108, 192,
160962
- /* 1150 */ 192, 215, 216, 215, 216, 106, 107, 19, 215, 216,
160963
- /* 1160 */ 53, 59, 114, 114, 115, 116, 117, 285, 119, 137,
160964
- /* 1170 */ 138, 116, 290, 230, 134, 192, 127, 192, 192, 139,
160965
- /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51,
160966
- /* 1190 */ 52, 53, 54, 55, 56, 57, 308, 76, 215, 216,
160967
- /* 1200 */ 312, 152, 263, 154, 215, 216, 192, 117, 87, 19,
160968
- /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 231, 116, 230,
160969
- /* 1220 */ 263, 263, 237, 203, 298, 299, 203, 239, 36, 215,
160970
- /* 1230 */ 216, 192, 142, 192, 15, 45, 115, 116, 117, 251,
160971
- /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160972
- /* 1250 */ 112, 59, 192, 203, 215, 216, 215, 216, 238, 239,
160973
- /* 1260 */ 192, 238, 239, 71, 192, 144, 25, 203, 243, 230,
160974
- /* 1270 */ 243, 251, 192, 81, 251, 215, 216, 243, 253, 60,
160975
- /* 1280 */ 253, 255, 256, 19, 20, 25, 22, 253, 238, 239,
160976
- /* 1290 */ 192, 192, 100, 192, 101, 215, 216, 19, 106, 107,
160977
- /* 1300 */ 36, 251, 238, 239, 114, 113, 192, 115, 116, 117,
160978
- /* 1310 */ 192, 47, 120, 215, 216, 251, 215, 216, 192, 31,
160979
- /* 1320 */ 130, 134, 243, 59, 148, 149, 139, 39, 192, 137,
160980
- /* 1330 */ 138, 263, 253, 215, 216, 71, 19, 157, 192, 159,
160981
- /* 1340 */ 128, 215, 216, 25, 152, 153, 154, 155, 156, 85,
160982
- /* 1350 */ 192, 215, 216, 268, 90, 0, 1, 2, 192, 192,
160983
- /* 1360 */ 5, 215, 216, 151, 100, 10, 11, 12, 13, 14,
160984
- /* 1370 */ 106, 107, 17, 215, 216, 19, 20, 113, 22, 115,
160985
- /* 1380 */ 116, 117, 215, 216, 120, 30, 192, 32, 192, 148,
160986
- /* 1390 */ 192, 24, 36, 115, 22, 40, 24, 23, 192, 25,
160987
- /* 1400 */ 128, 23, 99, 25, 144, 192, 22, 192, 192, 215,
160988
- /* 1410 */ 216, 215, 216, 215, 216, 59, 152, 153, 154, 155,
160989
- /* 1420 */ 156, 215, 216, 151, 192, 70, 192, 71, 215, 216,
160990
- /* 1430 */ 215, 216, 115, 78, 192, 132, 81, 192, 23, 22,
160991
- /* 1440 */ 25, 85, 192, 192, 192, 61, 90, 215, 216, 215,
160992
- /* 1450 */ 216, 192, 225, 98, 192, 192, 100, 215, 216, 141,
160993
- /* 1460 */ 215, 216, 106, 107, 225, 215, 216, 215, 216, 113,
160994
- /* 1470 */ 59, 115, 116, 117, 215, 216, 120, 215, 216, 192,
160995
- /* 1480 */ 120, 192, 19, 20, 23, 22, 25, 132, 119, 120,
160996
- /* 1490 */ 130, 192, 137, 138, 192, 23, 192, 25, 192, 36,
160997
- /* 1500 */ 192, 192, 215, 216, 215, 216, 192, 140, 152, 153,
160998
- /* 1510 */ 154, 155, 156, 192, 215, 216, 161, 215, 216, 215,
160999
- /* 1520 */ 216, 192, 59, 215, 216, 19, 192, 116, 192, 215,
161000
- /* 1530 */ 216, 23, 59, 25, 71, 192, 215, 216, 192, 23,
161001
- /* 1540 */ 23, 25, 25, 192, 215, 216, 7, 8, 85, 215,
161002
- /* 1550 */ 216, 215, 216, 90, 192, 1, 2, 140, 192, 5,
161003
- /* 1560 */ 192, 215, 216, 100, 10, 11, 12, 13, 14, 106,
161004
- /* 1570 */ 107, 17, 192, 23, 192, 25, 113, 192, 115, 116,
161005
- /* 1580 */ 117, 215, 216, 120, 30, 59, 32, 19, 20, 116,
161006
- /* 1590 */ 22, 192, 83, 84, 40, 215, 216, 215, 216, 192,
161007
- /* 1600 */ 215, 216, 192, 97, 36, 192, 19, 20, 23, 22,
161008
- /* 1610 */ 25, 23, 152, 25, 154, 152, 153, 154, 155, 156,
161009
- /* 1620 */ 152, 225, 154, 36, 70, 215, 216, 59, 215, 216,
161010
- /* 1630 */ 192, 23, 78, 25, 23, 81, 25, 192, 192, 71,
161011
- /* 1640 */ 257, 192, 116, 192, 192, 254, 59, 317, 192, 192,
161012
- /* 1650 */ 192, 235, 98, 241, 192, 254, 192, 192, 71, 192,
161013
- /* 1660 */ 287, 192, 192, 286, 242, 190, 213, 296, 100, 266,
161014
- /* 1670 */ 270, 244, 254, 254, 106, 107, 108, 254, 258, 258,
161015
- /* 1680 */ 266, 113, 292, 115, 116, 117, 132, 100, 120, 245,
161016
- /* 1690 */ 292, 137, 138, 106, 107, 19, 20, 219, 22, 270,
161017
- /* 1700 */ 113, 270, 115, 116, 117, 270, 224, 120, 228, 218,
161018
- /* 1710 */ 218, 245, 36, 218, 195, 161, 279, 258, 244, 248,
161019
- /* 1720 */ 152, 153, 154, 155, 156, 248, 242, 244, 60, 296,
161020
- /* 1730 */ 296, 140, 199, 199, 38, 59, 293, 199, 149, 152,
161021
- /* 1740 */ 153, 154, 155, 156, 150, 5, 22, 71, 293, 43,
161022
- /* 1750 */ 10, 11, 12, 13, 14, 269, 271, 17, 282, 18,
161023
- /* 1760 */ 233, 236, 199, 18, 236, 236, 236, 198, 148, 245,
161024
- /* 1770 */ 30, 271, 32, 271, 269, 233, 100, 245, 233, 199,
161025
- /* 1780 */ 40, 245, 106, 107, 198, 245, 157, 289, 62, 113,
161026
- /* 1790 */ 198, 115, 116, 117, 199, 288, 120, 22, 220, 199,
161027
- /* 1800 */ 198, 220, 199, 198, 114, 226, 64, 217, 22, 125,
161028
- /* 1810 */ 70, 164, 311, 217, 217, 217, 223, 24, 78, 304,
161029
- /* 1820 */ 219, 81, 223, 217, 220, 112, 217, 217, 152, 153,
161030
- /* 1830 */ 154, 155, 156, 226, 281, 220, 281, 143, 98, 114,
161031
- /* 1840 */ 199, 91, 260, 259, 82, 147, 144, 316, 22, 276,
161032
- /* 1850 */ 199, 316, 157, 278, 146, 145, 25, 201, 13, 193,
161033
- /* 1860 */ 193, 6, 191, 191, 191, 299, 302, 302, 206, 246,
161034
- /* 1870 */ 248, 259, 132, 260, 260, 259, 259, 137, 138, 260,
161035
- /* 1880 */ 249, 249, 264, 247, 245, 264, 212, 212, 206, 212,
161036
- /* 1890 */ 212, 221, 206, 213, 213, 212, 4, 3, 22, 162,
161037
- /* 1900 */ 221, 161, 15, 23, 16, 23, 138, 150, 129, 25,
161038
- /* 1910 */ 24, 141, 143, 20, 16, 1, 129, 141, 129, 61,
161039
- /* 1920 */ 37, 150, 53, 53, 53, 53, 129, 115, 140, 34,
161040
- /* 1930 */ 1, 5, 22, 114, 160, 68, 25, 75, 41, 140,
161041
- /* 1940 */ 24, 68, 114, 20, 19, 130, 124, 23, 67, 22,
161042
- /* 1950 */ 22, 148, 22, 22, 37, 59, 67, 24, 22, 96,
161043
- /* 1960 */ 28, 23, 22, 97, 23, 23, 67, 23, 25, 23,
161044
- /* 1970 */ 22, 115, 140, 23, 23, 22, 142, 25, 88, 34,
161045
- /* 1980 */ 75, 34, 75, 34, 93, 23, 86, 22, 34, 34,
161046
- /* 1990 */ 24, 34, 25, 25, 34, 23, 23, 23, 23, 23,
161047
- /* 2000 */ 44, 23, 25, 22, 11, 22, 22, 25, 23, 23,
161048
- /* 2010 */ 22, 22, 134, 23, 140, 140, 25, 140, 15, 140,
161049
- /* 2020 */ 1, 1, 318, 318, 318, 318, 318, 318, 318, 318,
161050
- /* 2030 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161051
- /* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161052
- /* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161053
- /* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161054
- /* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161055
- /* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161056
- /* 2090 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161057
- /* 2100 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161058
- /* 2110 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161059
- /* 2120 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161060
- /* 2130 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161061
- /* 2140 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161062
- /* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161063
- /* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161064
- /* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161065
- /* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161066
- /* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161067
- /* 2200 */ 318, 318, 318, 318, 318, 318,
161068
-};
161069
-#define YY_SHIFT_COUNT (571)
161071
+ /* 0 */ 193, 223, 193, 225, 193, 193, 193, 274, 275, 276,
161072
+ /* 10 */ 193, 233, 219, 193, 274, 275, 276, 206, 206, 19,
161073
+ /* 20 */ 193, 219, 216, 216, 217, 216, 217, 193, 295, 216,
161074
+ /* 30 */ 217, 31, 205, 216, 217, 193, 216, 217, 213, 39,
161075
+ /* 40 */ 228, 193, 230, 43, 44, 45, 46, 47, 48, 49,
161076
+ /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19,
161077
+ /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276,
161078
+ /* 70 */ 195, 193, 197, 253, 216, 262, 274, 275, 276, 204,
161079
+ /* 80 */ 238, 204, 262, 43, 44, 45, 46, 47, 48, 49,
161080
+ /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 264, 274,
161081
+ /* 100 */ 275, 276, 102, 103, 104, 105, 106, 107, 108, 109,
161082
+ /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211,
161083
+ /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252,
161084
+ /* 130 */ 19, 314, 315, 256, 257, 309, 25, 72, 296, 313,
161085
+ /* 140 */ 193, 266, 102, 103, 104, 105, 106, 107, 108, 109,
161086
+ /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48,
161087
+ /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81,
161088
+ /* 170 */ 292, 59, 307, 298, 108, 109, 110, 111, 112, 113,
161089
+ /* 180 */ 69, 116, 117, 118, 72, 128, 129, 193, 241, 22,
161090
+ /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105,
161091
+ /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 193,
161092
+ /* 210 */ 216, 217, 25, 102, 103, 104, 105, 106, 107, 108,
161093
+ /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117,
161094
+ /* 230 */ 118, 106, 107, 19, 216, 54, 55, 56, 57, 102,
161095
+ /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
161096
+ /* 250 */ 113, 304, 25, 46, 47, 48, 49, 43, 44, 45,
161097
+ /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
161098
+ /* 270 */ 56, 57, 193, 106, 107, 59, 193, 19, 153, 263,
161099
+ /* 280 */ 155, 67, 24, 102, 103, 104, 105, 106, 107, 108,
161100
+ /* 290 */ 109, 110, 111, 112, 113, 216, 217, 59, 230, 216,
161101
+ /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51,
161102
+ /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105,
161103
+ /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 142,
161104
+ /* 330 */ 59, 193, 116, 117, 118, 119, 253, 204, 122, 123,
161105
+ /* 340 */ 124, 19, 20, 81, 22, 262, 108, 19, 132, 165,
161106
+ /* 350 */ 166, 193, 24, 126, 116, 117, 118, 278, 36, 193,
161107
+ /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
161108
+ /* 370 */ 112, 113, 239, 240, 216, 217, 215, 106, 107, 241,
161109
+ /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118,
161110
+ /* 390 */ 73, 120, 26, 71, 193, 22, 193, 231, 81, 128,
161111
+ /* 400 */ 138, 139, 269, 81, 43, 44, 45, 46, 47, 48,
161112
+ /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 216,
161113
+ /* 420 */ 217, 198, 100, 95, 153, 59, 155, 193, 106, 107,
161114
+ /* 430 */ 235, 236, 59, 193, 193, 249, 114, 251, 116, 117,
161115
+ /* 440 */ 118, 113, 304, 121, 127, 204, 193, 119, 120, 121,
161116
+ /* 450 */ 122, 123, 124, 125, 193, 138, 139, 216, 217, 131,
161117
+ /* 460 */ 138, 139, 193, 102, 103, 104, 105, 106, 107, 108,
161118
+ /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157,
161119
+ /* 480 */ 239, 240, 116, 117, 118, 76, 193, 193, 19, 116,
161120
+ /* 490 */ 117, 118, 23, 252, 253, 193, 87, 204, 89, 238,
161121
+ /* 500 */ 193, 92, 268, 262, 281, 203, 193, 205, 285, 216,
161122
+ /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50,
161123
+ /* 520 */ 51, 52, 53, 54, 55, 56, 57, 193, 193, 216,
161124
+ /* 530 */ 217, 19, 239, 240, 59, 23, 106, 107, 108, 109,
161125
+ /* 540 */ 110, 111, 112, 113, 231, 252, 253, 193, 308, 309,
161126
+ /* 550 */ 193, 145, 59, 313, 145, 43, 44, 45, 46, 47,
161127
+ /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161128
+ /* 570 */ 164, 102, 103, 104, 105, 106, 107, 108, 109, 110,
161129
+ /* 580 */ 111, 112, 113, 119, 193, 193, 122, 123, 124, 193,
161130
+ /* 590 */ 283, 116, 117, 118, 235, 236, 132, 59, 241, 264,
161131
+ /* 600 */ 59, 193, 19, 23, 193, 25, 23, 216, 217, 116,
161132
+ /* 610 */ 117, 118, 216, 217, 102, 103, 104, 105, 106, 107,
161133
+ /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161134
+ /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161135
+ /* 640 */ 57, 19, 308, 309, 151, 23, 25, 313, 135, 253,
161136
+ /* 650 */ 21, 193, 241, 140, 116, 117, 118, 116, 117, 118,
161137
+ /* 660 */ 268, 304, 22, 301, 302, 43, 44, 45, 46, 47,
161138
+ /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161139
+ /* 680 */ 193, 143, 193, 193, 143, 102, 103, 104, 105, 106,
161140
+ /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59,
161141
+ /* 700 */ 292, 211, 212, 216, 217, 216, 217, 73, 193, 80,
161142
+ /* 710 */ 89, 25, 19, 92, 193, 304, 23, 22, 231, 193,
161143
+ /* 720 */ 231, 193, 22, 143, 102, 103, 104, 105, 106, 107,
161144
+ /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161145
+ /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161146
+ /* 750 */ 57, 19, 123, 193, 59, 23, 116, 117, 118, 59,
161147
+ /* 760 */ 193, 127, 128, 129, 306, 307, 210, 211, 212, 193,
161148
+ /* 770 */ 22, 111, 112, 113, 284, 43, 44, 45, 46, 47,
161149
+ /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161150
+ /* 790 */ 161, 193, 216, 217, 268, 102, 103, 104, 105, 106,
161151
+ /* 800 */ 107, 108, 109, 110, 111, 112, 113, 59, 193, 193,
161152
+ /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 304,
161153
+ /* 820 */ 239, 240, 19, 263, 138, 139, 23, 211, 212, 231,
161154
+ /* 830 */ 263, 216, 217, 252, 102, 103, 104, 105, 106, 107,
161155
+ /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161156
+ /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161157
+ /* 860 */ 57, 19, 193, 11, 116, 117, 118, 240, 253, 193,
161158
+ /* 870 */ 201, 239, 240, 193, 134, 206, 136, 137, 193, 252,
161159
+ /* 880 */ 193, 264, 193, 193, 252, 43, 44, 45, 46, 47,
161160
+ /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161161
+ /* 900 */ 284, 216, 217, 216, 217, 102, 103, 104, 105, 106,
161162
+ /* 910 */ 107, 108, 109, 110, 111, 112, 113, 193, 231, 193,
161163
+ /* 920 */ 187, 188, 189, 190, 127, 128, 129, 238, 195, 193,
161164
+ /* 930 */ 197, 16, 19, 7, 8, 9, 193, 204, 253, 193,
161165
+ /* 940 */ 216, 217, 216, 217, 102, 103, 104, 105, 106, 107,
161166
+ /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161167
+ /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161168
+ /* 970 */ 57, 213, 239, 240, 193, 76, 19, 188, 232, 190,
161169
+ /* 980 */ 128, 129, 292, 193, 195, 252, 197, 46, 89, 138,
161170
+ /* 990 */ 139, 92, 77, 204, 79, 193, 269, 216, 217, 266,
161171
+ /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52,
161172
+ /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106,
161173
+ /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240,
161174
+ /* 1030 */ 193, 298, 22, 23, 253, 239, 240, 127, 128, 129,
161175
+ /* 1040 */ 238, 252, 27, 193, 286, 204, 193, 204, 252, 291,
161176
+ /* 1050 */ 193, 273, 22, 23, 100, 266, 115, 42, 268, 102,
161177
+ /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
161178
+ /* 1070 */ 113, 117, 159, 216, 217, 121, 161, 19, 63, 193,
161179
+ /* 1080 */ 239, 240, 239, 240, 12, 208, 209, 298, 73, 311,
161180
+ /* 1090 */ 312, 238, 19, 252, 25, 252, 22, 24, 24, 27,
161181
+ /* 1100 */ 193, 264, 216, 217, 46, 208, 209, 153, 154, 155,
161182
+ /* 1110 */ 253, 101, 19, 23, 42, 25, 43, 44, 45, 46,
161183
+ /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161184
+ /* 1130 */ 57, 101, 19, 59, 25, 63, 43, 44, 45, 46,
161185
+ /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161186
+ /* 1150 */ 57, 22, 23, 115, 25, 24, 43, 44, 45, 46,
161187
+ /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161188
+ /* 1170 */ 57, 22, 23, 115, 25, 102, 103, 104, 105, 106,
161189
+ /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 118, 150, 131,
161190
+ /* 1190 */ 59, 117, 22, 273, 193, 102, 103, 104, 105, 106,
161191
+ /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 204, 66, 204,
161192
+ /* 1210 */ 35, 204, 143, 213, 193, 102, 103, 104, 105, 106,
161193
+ /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 85, 193, 59,
161194
+ /* 1230 */ 101, 311, 312, 16, 193, 19, 94, 216, 217, 238,
161195
+ /* 1240 */ 193, 66, 239, 240, 239, 240, 239, 240, 117, 74,
161196
+ /* 1250 */ 101, 216, 217, 193, 193, 252, 193, 252, 149, 252,
161197
+ /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
161198
+ /* 1270 */ 54, 55, 56, 57, 193, 193, 193, 5, 59, 216,
161199
+ /* 1280 */ 217, 25, 10, 11, 12, 13, 14, 117, 146, 17,
161200
+ /* 1290 */ 193, 291, 193, 232, 77, 76, 79, 216, 217, 216,
161201
+ /* 1300 */ 217, 31, 30, 309, 32, 130, 87, 313, 89, 39,
161202
+ /* 1310 */ 193, 92, 40, 216, 217, 216, 217, 108, 102, 103,
161203
+ /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
161204
+ /* 1330 */ 299, 300, 193, 216, 217, 116, 117, 118, 19, 20,
161205
+ /* 1340 */ 193, 22, 70, 309, 135, 193, 264, 313, 193, 140,
161206
+ /* 1350 */ 78, 193, 226, 81, 59, 36, 193, 309, 193, 29,
161207
+ /* 1360 */ 193, 313, 193, 33, 145, 193, 59, 48, 216, 217,
161208
+ /* 1370 */ 98, 216, 217, 193, 216, 217, 193, 244, 59, 216,
161209
+ /* 1380 */ 217, 216, 217, 216, 217, 216, 217, 254, 216, 217,
161210
+ /* 1390 */ 71, 193, 244, 193, 193, 65, 216, 217, 193, 216,
161211
+ /* 1400 */ 217, 145, 254, 244, 85, 133, 15, 100, 193, 90,
161212
+ /* 1410 */ 138, 139, 117, 254, 216, 217, 216, 217, 193, 100,
161213
+ /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 19, 121, 193,
161214
+ /* 1430 */ 193, 216, 217, 114, 162, 116, 117, 118, 244, 244,
161215
+ /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 129, 254, 254,
161216
+ /* 1450 */ 313, 60, 216, 217, 19, 256, 257, 193, 120, 121,
161217
+ /* 1460 */ 153, 154, 155, 149, 150, 25, 24, 99, 216, 217,
161218
+ /* 1470 */ 152, 193, 153, 154, 155, 156, 157, 0, 1, 2,
161219
+ /* 1480 */ 216, 217, 5, 22, 158, 24, 160, 10, 11, 12,
161220
+ /* 1490 */ 13, 14, 193, 23, 17, 25, 193, 19, 20, 193,
161221
+ /* 1500 */ 22, 133, 193, 22, 22, 193, 22, 30, 193, 32,
161222
+ /* 1510 */ 19, 20, 129, 22, 36, 216, 217, 40, 193, 216,
161223
+ /* 1520 */ 217, 193, 216, 217, 116, 216, 217, 36, 216, 217,
161224
+ /* 1530 */ 193, 216, 217, 193, 53, 152, 193, 59, 23, 19,
161225
+ /* 1540 */ 25, 216, 217, 61, 216, 217, 23, 70, 25, 71,
161226
+ /* 1550 */ 59, 116, 193, 216, 217, 78, 216, 217, 81, 216,
161227
+ /* 1560 */ 217, 59, 71, 85, 193, 23, 193, 25, 90, 23,
161228
+ /* 1570 */ 23, 25, 25, 7, 8, 98, 85, 193, 100, 193,
161229
+ /* 1580 */ 59, 90, 142, 141, 106, 107, 193, 216, 217, 216,
161230
+ /* 1590 */ 217, 100, 114, 193, 116, 117, 118, 106, 107, 121,
161231
+ /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118,
161232
+ /* 1610 */ 133, 23, 121, 25, 121, 138, 139, 97, 23, 117,
161233
+ /* 1620 */ 25, 23, 193, 25, 131, 141, 193, 216, 217, 59,
161234
+ /* 1630 */ 193, 153, 154, 155, 156, 157, 226, 193, 117, 162,
161235
+ /* 1640 */ 23, 23, 25, 25, 153, 154, 155, 156, 157, 1,
161236
+ /* 1650 */ 2, 83, 84, 5, 19, 20, 226, 22, 10, 11,
161237
+ /* 1660 */ 12, 13, 14, 258, 153, 17, 155, 153, 23, 155,
161238
+ /* 1670 */ 25, 36, 23, 193, 25, 255, 193, 236, 30, 193,
161239
+ /* 1680 */ 32, 19, 20, 193, 22, 193, 288, 117, 40, 193,
161240
+ /* 1690 */ 318, 193, 193, 193, 59, 242, 193, 193, 36, 193,
161241
+ /* 1700 */ 193, 193, 287, 255, 255, 255, 71, 255, 243, 214,
161242
+ /* 1710 */ 191, 297, 267, 245, 271, 259, 259, 293, 70, 246,
161243
+ /* 1720 */ 246, 59, 267, 229, 245, 271, 78, 293, 259, 81,
161244
+ /* 1730 */ 271, 271, 220, 71, 225, 100, 219, 219, 249, 196,
161245
+ /* 1740 */ 243, 106, 107, 108, 219, 60, 98, 280, 297, 114,
161246
+ /* 1750 */ 249, 116, 117, 118, 141, 245, 121, 200, 200, 297,
161247
+ /* 1760 */ 38, 200, 100, 151, 150, 294, 294, 22, 106, 107,
161248
+ /* 1770 */ 283, 43, 234, 18, 237, 200, 114, 272, 116, 117,
161249
+ /* 1780 */ 118, 133, 237, 121, 18, 237, 138, 139, 153, 154,
161250
+ /* 1790 */ 155, 156, 157, 237, 270, 199, 19, 20, 246, 22,
161251
+ /* 1800 */ 149, 272, 272, 270, 200, 246, 234, 234, 246, 246,
161252
+ /* 1810 */ 162, 158, 290, 36, 199, 153, 154, 155, 156, 157,
161253
+ /* 1820 */ 62, 289, 200, 199, 22, 200, 221, 199, 221, 200,
161254
+ /* 1830 */ 199, 115, 64, 227, 218, 22, 59, 218, 218, 126,
161255
+ /* 1840 */ 165, 24, 113, 312, 218, 224, 305, 224, 71, 282,
161256
+ /* 1850 */ 144, 221, 220, 282, 218, 218, 218, 115, 261, 260,
161257
+ /* 1860 */ 227, 221, 261, 260, 200, 91, 317, 317, 82, 261,
161258
+ /* 1870 */ 260, 148, 261, 22, 265, 145, 200, 100, 158, 277,
161259
+ /* 1880 */ 147, 146, 25, 106, 107, 202, 13, 260, 194, 250,
161260
+ /* 1890 */ 249, 114, 248, 116, 117, 118, 250, 247, 121, 265,
161261
+ /* 1900 */ 246, 194, 6, 192, 192, 207, 192, 207, 213, 213,
161262
+ /* 1910 */ 213, 222, 213, 222, 4, 214, 214, 213, 3, 22,
161263
+ /* 1920 */ 163, 279, 207, 15, 23, 16, 23, 139, 130, 151,
161264
+ /* 1930 */ 153, 154, 155, 156, 157, 142, 25, 24, 20, 144,
161265
+ /* 1940 */ 16, 1, 142, 61, 130, 130, 303, 151, 53, 37,
161266
+ /* 1950 */ 303, 53, 300, 53, 130, 53, 116, 34, 1, 141,
161267
+ /* 1960 */ 5, 22, 115, 25, 161, 75, 41, 68, 141, 115,
161268
+ /* 1970 */ 24, 20, 68, 19, 131, 125, 23, 96, 22, 59,
161269
+ /* 1980 */ 22, 67, 22, 22, 67, 22, 24, 28, 67, 37,
161270
+ /* 1990 */ 23, 149, 22, 25, 23, 23, 23, 23, 22, 141,
161271
+ /* 2000 */ 23, 23, 97, 116, 22, 143, 25, 88, 75, 34,
161272
+ /* 2010 */ 44, 75, 86, 34, 34, 93, 23, 34, 34, 34,
161273
+ /* 2020 */ 22, 24, 34, 22, 25, 25, 23, 23, 23, 23,
161274
+ /* 2030 */ 23, 11, 23, 25, 22, 22, 25, 23, 23, 22,
161275
+ /* 2040 */ 22, 135, 15, 1, 25, 23, 1, 319, 141, 319,
161276
+ /* 2050 */ 319, 319, 319, 319, 319, 319, 319, 141, 319, 319,
161277
+ /* 2060 */ 319, 319, 319, 319, 319, 319, 319, 319, 141, 141,
161278
+ /* 2070 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161279
+ /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161280
+ /* 2090 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161281
+ /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161282
+ /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161283
+ /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161284
+ /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161285
+ /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161286
+ /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161287
+ /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161288
+ /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161289
+ /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161290
+ /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161291
+ /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161292
+ /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161293
+ /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161294
+ /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161295
+ /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161296
+ /* 2250 */ 319, 319, 319, 319, 319,
161297
+};
161298
+#define YY_SHIFT_COUNT (573)
161070161299
#define YY_SHIFT_MIN (0)
161071
-#define YY_SHIFT_MAX (2020)
161300
+#define YY_SHIFT_MAX (2045)
161072161301
static const unsigned short int yy_shift_ofst[] = {
161073
- /* 0 */ 1554, 1355, 1740, 1192, 1192, 552, 1264, 1356, 1463, 1587,
161074
- /* 10 */ 1587, 1587, 276, 0, 0, 180, 1015, 1587, 1587, 1587,
161075
- /* 20 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161076
- /* 30 */ 1049, 1049, 1121, 1121, 54, 667, 552, 552, 552, 552,
161077
- /* 40 */ 552, 40, 110, 219, 289, 396, 439, 509, 548, 618,
161078
- /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
161079
- /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
161080
- /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1568, 1587,
161081
- /* 80 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161082
- /* 90 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161083
- /* 100 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161084
- /* 110 */ 1587, 1587, 1587, 1676, 1587, 1587, 1587, 1587, 1587, 1587,
161085
- /* 120 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 146, 84, 84,
161086
- /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 531,
161087
- /* 140 */ 531, 51, 1190, 531, 531, 324, 324, 531, 713, 713,
161088
- /* 150 */ 713, 713, 151, 154, 154, 4, 149, 2022, 2022, 621,
161089
- /* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228,
161090
- /* 170 */ 251, 159, 331, 531, 531, 531, 531, 531, 531, 531,
161091
- /* 180 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161092
- /* 190 */ 531, 531, 531, 819, 819, 531, 9, 25, 25, 1102,
161093
- /* 200 */ 1102, 911, 1032, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161094
- /* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891,
161095
- /* 220 */ 675, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161096
- /* 230 */ 531, 454, 531, 531, 531, 531, 531, 531, 531, 531,
161097
- /* 240 */ 531, 531, 531, 531, 790, 790, 790, 531, 531, 531,
161098
- /* 250 */ 338, 531, 531, 531, 516, 930, 531, 531, 993, 531,
161099
- /* 260 */ 531, 531, 531, 531, 531, 531, 531, 778, 944, 725,
161100
- /* 270 */ 994, 994, 994, 994, 1090, 725, 725, 1040, 1006, 951,
161101
- /* 280 */ 1219, 962, 1176, 98, 1278, 1176, 1278, 1317, 1241, 962,
161102
- /* 290 */ 962, 1241, 962, 98, 1317, 286, 1111, 1048, 1288, 1288,
161103
- /* 300 */ 1288, 1278, 1260, 1260, 1180, 1318, 1187, 1372, 1668, 1668,
161104
- /* 310 */ 1591, 1591, 1696, 1696, 1591, 1594, 1589, 1724, 1706, 1741,
161105
- /* 320 */ 1741, 1741, 1741, 1591, 1745, 1620, 1589, 1589, 1620, 1724,
161106
- /* 330 */ 1706, 1620, 1706, 1620, 1591, 1745, 1629, 1726, 1591, 1745,
161107
- /* 340 */ 1775, 1591, 1745, 1591, 1745, 1775, 1690, 1690, 1690, 1742,
161108
- /* 350 */ 1786, 1786, 1775, 1690, 1684, 1690, 1742, 1690, 1690, 1647,
161109
- /* 360 */ 1793, 1713, 1713, 1775, 1694, 1725, 1694, 1725, 1694, 1725,
161110
- /* 370 */ 1694, 1725, 1591, 1750, 1750, 1762, 1762, 1698, 1702, 1826,
161111
- /* 380 */ 1591, 1695, 1698, 1708, 1710, 1620, 1831, 1845, 1845, 1855,
161112
- /* 390 */ 1855, 1855, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161113
- /* 400 */ 2022, 2022, 2022, 2022, 2022, 2022, 2022, 578, 837, 655,
161114
- /* 410 */ 1193, 167, 839, 1055, 1374, 1303, 1107, 1367, 1212, 1272,
161115
- /* 420 */ 1378, 1384, 1415, 1461, 1472, 1508, 1516, 1517, 1411, 1369,
161116
- /* 430 */ 1539, 1360, 1506, 1473, 1550, 1585, 1509, 1588, 1460, 1468,
161117
- /* 440 */ 1608, 1611, 1526, 1417, 1892, 1894, 1876, 1737, 1887, 1888,
161118
- /* 450 */ 1880, 1882, 1768, 1757, 1779, 1884, 1884, 1886, 1770, 1893,
161119
- /* 460 */ 1769, 1898, 1914, 1776, 1787, 1884, 1789, 1858, 1883, 1884,
161120
- /* 470 */ 1771, 1869, 1870, 1871, 1872, 1797, 1812, 1895, 1788, 1929,
161121
- /* 480 */ 1926, 1910, 1819, 1774, 1867, 1911, 1873, 1862, 1897, 1799,
161122
- /* 490 */ 1828, 1916, 1923, 1925, 1815, 1822, 1927, 1881, 1928, 1930,
161123
- /* 500 */ 1924, 1931, 1889, 1896, 1933, 1863, 1932, 1936, 1899, 1917,
161124
- /* 510 */ 1938, 1803, 1940, 1941, 1942, 1944, 1943, 1946, 1948, 1866,
161125
- /* 520 */ 1832, 1950, 1951, 1856, 1945, 1953, 1834, 1952, 1947, 1949,
161126
- /* 530 */ 1954, 1955, 1890, 1905, 1900, 1956, 1907, 1891, 1957, 1962,
161127
- /* 540 */ 1965, 1966, 1967, 1968, 1960, 1972, 1952, 1973, 1974, 1975,
161128
- /* 550 */ 1976, 1977, 1978, 1981, 1993, 1983, 1984, 1985, 1986, 1988,
161129
- /* 560 */ 1989, 1982, 1878, 1874, 1875, 1877, 1879, 1991, 1990, 2003,
161130
- /* 570 */ 2019, 2020,
161131
-};
161132
-#define YY_REDUCE_COUNT (406)
161133
-#define YY_REDUCE_MIN (-272)
161134
-#define YY_REDUCE_MAX (1686)
161302
+ /* 0 */ 1648, 1477, 1272, 322, 322, 262, 1319, 1478, 1491, 1662,
161303
+ /* 10 */ 1662, 1662, 317, 0, 0, 214, 1093, 1662, 1662, 1662,
161304
+ /* 20 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161305
+ /* 30 */ 271, 271, 1219, 1219, 216, 88, 262, 262, 262, 262,
161306
+ /* 40 */ 262, 40, 111, 258, 361, 469, 512, 583, 622, 693,
161307
+ /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093,
161308
+ /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
161309
+ /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662,
161310
+ /* 80 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161311
+ /* 90 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161312
+ /* 100 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161313
+ /* 110 */ 1662, 1662, 1662, 1662, 1777, 1662, 1662, 1662, 1662, 1662,
161314
+ /* 120 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 137, 181,
161315
+ /* 130 */ 181, 181, 181, 181, 94, 430, 66, 65, 112, 366,
161316
+ /* 140 */ 475, 475, 629, 1058, 475, 475, 125, 125, 475, 686,
161317
+ /* 150 */ 686, 686, 660, 686, 57, 184, 184, 77, 77, 2070,
161318
+ /* 160 */ 2070, 328, 328, 328, 493, 373, 373, 373, 373, 1015,
161319
+ /* 170 */ 1015, 409, 366, 1129, 1149, 475, 475, 475, 475, 475,
161320
+ /* 180 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
161321
+ /* 190 */ 475, 475, 475, 475, 475, 621, 621, 475, 852, 899,
161322
+ /* 200 */ 899, 1295, 1295, 406, 851, 2070, 2070, 2070, 2070, 2070,
161323
+ /* 210 */ 2070, 2070, 1307, 954, 954, 640, 464, 695, 238, 700,
161324
+ /* 220 */ 538, 541, 748, 475, 475, 475, 475, 475, 475, 475,
161325
+ /* 230 */ 475, 475, 475, 634, 475, 475, 475, 475, 475, 475,
161326
+ /* 240 */ 475, 475, 475, 475, 475, 475, 1175, 1175, 1175, 475,
161327
+ /* 250 */ 475, 475, 580, 475, 475, 475, 1074, 1142, 475, 475,
161328
+ /* 260 */ 1072, 475, 475, 475, 475, 475, 475, 475, 475, 797,
161329
+ /* 270 */ 1330, 740, 1131, 1131, 1131, 1131, 1069, 740, 740, 1209,
161330
+ /* 280 */ 167, 926, 1391, 1038, 1314, 187, 1408, 1314, 1408, 1435,
161331
+ /* 290 */ 1109, 1038, 1038, 1109, 1038, 187, 1435, 227, 1090, 941,
161332
+ /* 300 */ 1270, 1270, 1270, 1408, 1256, 1256, 1326, 1440, 513, 1461,
161333
+ /* 310 */ 1685, 1685, 1613, 1613, 1722, 1722, 1613, 1612, 1614, 1745,
161334
+ /* 320 */ 1728, 1755, 1755, 1755, 1755, 1613, 1766, 1651, 1614, 1614,
161335
+ /* 330 */ 1651, 1745, 1728, 1651, 1728, 1651, 1613, 1766, 1653, 1758,
161336
+ /* 340 */ 1613, 1766, 1802, 1613, 1766, 1613, 1766, 1802, 1716, 1716,
161337
+ /* 350 */ 1716, 1768, 1813, 1813, 1802, 1716, 1713, 1716, 1768, 1716,
161338
+ /* 360 */ 1716, 1675, 1817, 1729, 1729, 1802, 1706, 1742, 1706, 1742,
161339
+ /* 370 */ 1706, 1742, 1706, 1742, 1613, 1774, 1774, 1786, 1786, 1723,
161340
+ /* 380 */ 1730, 1851, 1613, 1720, 1723, 1733, 1735, 1651, 1857, 1873,
161341
+ /* 390 */ 1873, 1896, 1896, 1896, 2070, 2070, 2070, 2070, 2070, 2070,
161342
+ /* 400 */ 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 207,
161343
+ /* 410 */ 915, 1010, 1030, 1217, 910, 1170, 1470, 1368, 1481, 1442,
161344
+ /* 420 */ 1318, 1383, 1515, 1482, 1523, 1542, 1546, 1547, 1588, 1595,
161345
+ /* 430 */ 1502, 1338, 1566, 1493, 1520, 1521, 1598, 1617, 1568, 1618,
161346
+ /* 440 */ 1511, 1514, 1645, 1649, 1570, 1484, 1910, 1915, 1897, 1757,
161347
+ /* 450 */ 1908, 1909, 1901, 1903, 1788, 1778, 1798, 1911, 1911, 1913,
161348
+ /* 460 */ 1793, 1918, 1795, 1924, 1940, 1800, 1814, 1911, 1815, 1882,
161349
+ /* 470 */ 1912, 1911, 1796, 1895, 1898, 1900, 1902, 1824, 1840, 1923,
161350
+ /* 480 */ 1818, 1957, 1955, 1939, 1847, 1803, 1899, 1938, 1904, 1890,
161351
+ /* 490 */ 1925, 1827, 1854, 1946, 1951, 1954, 1843, 1850, 1956, 1914,
161352
+ /* 500 */ 1958, 1960, 1953, 1961, 1917, 1920, 1962, 1881, 1959, 1963,
161353
+ /* 510 */ 1921, 1952, 1967, 1842, 1970, 1971, 1972, 1973, 1968, 1974,
161354
+ /* 520 */ 1976, 1905, 1858, 1977, 1978, 1887, 1975, 1982, 1862, 1981,
161355
+ /* 530 */ 1979, 1980, 1983, 1984, 1919, 1933, 1926, 1966, 1936, 1922,
161356
+ /* 540 */ 1985, 1993, 1998, 1997, 1999, 2000, 1988, 2003, 1981, 2004,
161357
+ /* 550 */ 2005, 2006, 2007, 2008, 2009, 2001, 2020, 2012, 2013, 2014,
161358
+ /* 560 */ 2015, 2017, 2018, 2011, 1906, 1907, 1916, 1927, 1928, 2019,
161359
+ /* 570 */ 2022, 2027, 2042, 2045,
161360
+};
161361
+#define YY_REDUCE_COUNT (408)
161362
+#define YY_REDUCE_MIN (-267)
161363
+#define YY_REDUCE_MAX (1715)
161135161364
static const short yy_reduce_ofst[] = {
161136
- /* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134,
161137
- /* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765,
161138
- /* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821,
161139
- /* 30 */ 710, 812, -188, -67, -187, 555, 662, 1020, 1023, 1050,
161140
- /* 40 */ 1064, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161141
- /* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161142
- /* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161143
- /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 811, 917,
161144
- /* 80 */ 936, 938, 983, 1014, 1041, 1060, 1080, 1098, 1101, 1118,
161145
- /* 90 */ 1126, 1136, 1146, 1158, 1167, 1194, 1196, 1198, 1206, 1213,
161146
- /* 100 */ 1215, 1232, 1234, 1242, 1245, 1250, 1252, 1259, 1262, 1287,
161147
- /* 110 */ 1289, 1299, 1302, 1304, 1308, 1314, 1321, 1329, 1334, 1336,
161148
- /* 120 */ 1346, 1366, 1380, 1382, 1385, 1410, 1413, -267, -267, -267,
161149
- /* 130 */ -267, -267, -267, -267, -267, 446, -267, 451, -24, 121,
161150
- /* 140 */ 560, 518, 232, 609, 330, -181, -111, 654, 557, 671,
161151
- /* 150 */ 557, 671, 882, -30, 93, -267, -267, -267, -267, 155,
161152
- /* 160 */ 155, 155, 181, 242, 305, 339, 561, -218, 453, 227,
161153
- /* 170 */ 158, 661, 661, -171, 114, 327, 653, -166, 275, 605,
161154
- /* 180 */ 615, 337, 833, 665, 939, 957, 825, 958, 985, 501,
161155
- /* 190 */ 986, 378, 1068, 384, 643, 393, 741, 660, 888, 762,
161156
- /* 200 */ 822, 229, 988, 926, 504, 1025, 1027, 1034, 1026, 1079,
161157
- /* 210 */ -204, -174, -151, 18, 130, 198, 226, 376, 391, 442,
161158
- /* 220 */ 457, 493, 607, 715, 779, 782, 840, 865, 1072, 1099,
161159
- /* 230 */ 1114, 1085, 1166, 1216, 1251, 1263, 1306, 1309, 1343, 1351,
161160
- /* 240 */ 1362, 1368, 1399, 1407, 1227, 1239, 1396, 1438, 1445, 1446,
161161
- /* 250 */ 1383, 1449, 1451, 1452, 1391, 1330, 1456, 1457, 1416, 1458,
161162
- /* 260 */ 226, 1462, 1464, 1465, 1467, 1469, 1470, 1373, 1377, 1412,
161163
- /* 270 */ 1401, 1418, 1419, 1423, 1383, 1412, 1412, 1422, 1453, 1475,
161164
- /* 280 */ 1371, 1400, 1403, 1427, 1420, 1414, 1421, 1390, 1444, 1429,
161165
- /* 290 */ 1431, 1466, 1435, 1474, 1398, 1478, 1480, 1482, 1491, 1492,
161166
- /* 300 */ 1495, 1459, 1471, 1477, 1437, 1483, 1484, 1519, 1433, 1434,
161167
- /* 310 */ 1533, 1534, 1443, 1455, 1538, 1476, 1485, 1486, 1527, 1525,
161168
- /* 320 */ 1528, 1529, 1530, 1563, 1569, 1524, 1500, 1502, 1532, 1505,
161169
- /* 330 */ 1542, 1536, 1545, 1540, 1580, 1586, 1498, 1507, 1595, 1592,
161170
- /* 340 */ 1578, 1600, 1602, 1603, 1605, 1581, 1590, 1596, 1597, 1579,
161171
- /* 350 */ 1593, 1599, 1604, 1598, 1601, 1606, 1607, 1609, 1610, 1501,
161172
- /* 360 */ 1515, 1553, 1555, 1615, 1582, 1584, 1613, 1612, 1614, 1616,
161173
- /* 370 */ 1619, 1617, 1641, 1531, 1535, 1618, 1621, 1631, 1622, 1573,
161174
- /* 380 */ 1651, 1575, 1632, 1636, 1623, 1639, 1656, 1666, 1667, 1671,
161175
- /* 390 */ 1672, 1673, 1564, 1565, 1566, 1662, 1674, 1675, 1677, 1678,
161176
- /* 400 */ 1682, 1670, 1679, 1680, 1681, 1683, 1686,
161365
+ /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187,
161366
+ /* 10 */ -180, 83, 133, -207, -198, -267, -175, -6, 166, 313,
161367
+ /* 20 */ 487, 396, 489, 598, 615, 685, 687, 79, 781, 857,
161368
+ /* 30 */ 490, 616, 240, 334, -188, 796, 841, 843, 1003, 1005,
161369
+ /* 40 */ 1007, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161370
+ /* 50 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161371
+ /* 60 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161372
+ /* 70 */ -260, -260, -260, -260, -260, -260, -260, -260, 158, 203,
161373
+ /* 80 */ 391, 576, 724, 726, 886, 1021, 1035, 1063, 1081, 1083,
161374
+ /* 90 */ 1097, 1099, 1117, 1152, 1155, 1158, 1163, 1165, 1167, 1169,
161375
+ /* 100 */ 1172, 1180, 1183, 1198, 1200, 1205, 1215, 1225, 1227, 1236,
161376
+ /* 110 */ 1252, 1264, 1299, 1303, 1306, 1309, 1312, 1315, 1325, 1328,
161377
+ /* 120 */ 1337, 1340, 1343, 1371, 1373, 1384, 1386, 1411, -260, -260,
161378
+ /* 130 */ -260, -260, -260, -260, -260, -260, -260, -53, 138, 302,
161379
+ /* 140 */ -158, 357, 223, -222, 411, 458, -92, 556, 669, 581,
161380
+ /* 150 */ 632, 581, -260, 632, 758, 778, 920, -260, -260, -260,
161381
+ /* 160 */ -260, 161, 161, 161, 307, 234, 392, 526, 790, 195,
161382
+ /* 170 */ 359, -174, -173, 362, 362, -189, 16, 560, 567, 261,
161383
+ /* 180 */ 689, 802, 853, -122, -166, 408, 335, 617, 690, 837,
161384
+ /* 190 */ 1001, 746, 1061, 515, 1082, 994, 1034, -135, 1000, 1048,
161385
+ /* 200 */ 1137, 877, 897, 186, 627, 1031, 1133, 1148, 1159, 1194,
161386
+ /* 210 */ 1199, 1195, -194, -142, 18, -152, 68, 201, 253, 269,
161387
+ /* 220 */ 294, 354, 521, 528, 676, 680, 736, 743, 850, 907,
161388
+ /* 230 */ 1041, 1047, 1060, 727, 1139, 1147, 1201, 1237, 1278, 1359,
161389
+ /* 240 */ 1393, 1400, 1413, 1429, 1433, 1437, 1126, 1410, 1430, 1444,
161390
+ /* 250 */ 1480, 1483, 1405, 1486, 1490, 1492, 1420, 1372, 1496, 1498,
161391
+ /* 260 */ 1441, 1499, 253, 1500, 1503, 1504, 1506, 1507, 1508, 1398,
161392
+ /* 270 */ 1415, 1453, 1448, 1449, 1450, 1452, 1405, 1453, 1453, 1465,
161393
+ /* 280 */ 1495, 1519, 1414, 1443, 1445, 1468, 1456, 1455, 1457, 1424,
161394
+ /* 290 */ 1473, 1454, 1459, 1474, 1460, 1479, 1434, 1512, 1494, 1509,
161395
+ /* 300 */ 1517, 1518, 1525, 1469, 1489, 1501, 1467, 1510, 1497, 1543,
161396
+ /* 310 */ 1451, 1462, 1557, 1558, 1471, 1472, 1561, 1487, 1505, 1524,
161397
+ /* 320 */ 1538, 1537, 1545, 1548, 1556, 1575, 1596, 1552, 1529, 1530,
161398
+ /* 330 */ 1559, 1533, 1572, 1562, 1573, 1563, 1604, 1615, 1522, 1532,
161399
+ /* 340 */ 1622, 1624, 1605, 1625, 1628, 1629, 1631, 1607, 1616, 1619,
161400
+ /* 350 */ 1620, 1606, 1621, 1623, 1630, 1626, 1632, 1636, 1633, 1637,
161401
+ /* 360 */ 1638, 1531, 1541, 1567, 1571, 1640, 1597, 1599, 1601, 1603,
161402
+ /* 370 */ 1608, 1610, 1611, 1627, 1664, 1549, 1550, 1609, 1634, 1639,
161403
+ /* 380 */ 1641, 1602, 1676, 1642, 1646, 1644, 1650, 1654, 1683, 1694,
161404
+ /* 390 */ 1707, 1711, 1712, 1714, 1643, 1647, 1652, 1698, 1695, 1696,
161405
+ /* 400 */ 1697, 1699, 1700, 1689, 1691, 1701, 1702, 1704, 1715,
161177161406
};
161178161407
static const YYACTIONTYPE yy_default[] = {
161179
- /* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462,
161180
- /* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230,
161181
- /* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230,
161182
- /* 30 */ 1230, 1230, 1550, 1550, 1230, 1230, 1230, 1230, 1230, 1230,
161183
- /* 40 */ 1230, 1230, 1380, 1230, 1387, 1230, 1230, 1230, 1230, 1230,
161184
- /* 50 */ 1463, 1464, 1230, 1230, 1230, 1514, 1516, 1479, 1394, 1393,
161185
- /* 60 */ 1392, 1391, 1497, 1358, 1385, 1378, 1382, 1457, 1458, 1456,
161186
- /* 70 */ 1460, 1464, 1463, 1230, 1381, 1428, 1442, 1427, 1230, 1230,
161187
- /* 80 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161188
- /* 90 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161189
- /* 100 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161190
- /* 110 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161191
- /* 120 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1436, 1441, 1447,
161192
- /* 130 */ 1440, 1437, 1430, 1429, 1431, 1230, 1432, 1230, 1254, 1230,
161193
- /* 140 */ 1230, 1251, 1305, 1230, 1230, 1230, 1230, 1230, 1534, 1533,
161194
- /* 150 */ 1230, 1230, 1263, 1422, 1421, 1433, 1434, 1444, 1443, 1522,
161195
- /* 160 */ 1586, 1585, 1480, 1230, 1230, 1230, 1230, 1230, 1230, 1550,
161196
- /* 170 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161197
- /* 180 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161198
- /* 190 */ 1230, 1230, 1230, 1550, 1550, 1230, 1263, 1550, 1550, 1259,
161199
- /* 200 */ 1259, 1365, 1230, 1529, 1332, 1332, 1332, 1332, 1341, 1332,
161200
- /* 210 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161201
- /* 220 */ 1230, 1230, 1230, 1230, 1230, 1519, 1517, 1230, 1230, 1230,
161202
- /* 230 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161203
- /* 240 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161204
- /* 250 */ 1230, 1230, 1230, 1230, 1337, 1230, 1230, 1230, 1230, 1230,
161205
- /* 260 */ 1230, 1230, 1230, 1230, 1230, 1230, 1579, 1230, 1492, 1319,
161206
- /* 270 */ 1337, 1337, 1337, 1337, 1339, 1320, 1318, 1331, 1264, 1237,
161207
- /* 280 */ 1625, 1397, 1386, 1338, 1360, 1386, 1360, 1622, 1384, 1397,
161208
- /* 290 */ 1397, 1384, 1397, 1338, 1622, 1280, 1602, 1275, 1371, 1371,
161209
- /* 300 */ 1371, 1360, 1365, 1365, 1459, 1338, 1331, 1230, 1625, 1625,
161210
- /* 310 */ 1346, 1346, 1624, 1624, 1346, 1480, 1609, 1406, 1308, 1314,
161211
- /* 320 */ 1314, 1314, 1314, 1346, 1248, 1384, 1609, 1609, 1384, 1406,
161212
- /* 330 */ 1308, 1384, 1308, 1384, 1346, 1248, 1496, 1619, 1346, 1248,
161213
- /* 340 */ 1470, 1346, 1248, 1346, 1248, 1470, 1306, 1306, 1306, 1295,
161214
- /* 350 */ 1230, 1230, 1470, 1306, 1280, 1306, 1295, 1306, 1306, 1568,
161215
- /* 360 */ 1230, 1474, 1474, 1470, 1364, 1359, 1364, 1359, 1364, 1359,
161216
- /* 370 */ 1364, 1359, 1346, 1560, 1560, 1374, 1374, 1379, 1365, 1465,
161217
- /* 380 */ 1346, 1230, 1379, 1377, 1375, 1384, 1298, 1582, 1582, 1578,
161218
- /* 390 */ 1578, 1578, 1630, 1630, 1529, 1595, 1263, 1263, 1263, 1263,
161219
- /* 400 */ 1595, 1282, 1282, 1264, 1264, 1263, 1595, 1230, 1230, 1230,
161220
- /* 410 */ 1230, 1230, 1230, 1590, 1230, 1524, 1481, 1350, 1230, 1230,
161221
- /* 420 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161222
- /* 430 */ 1230, 1230, 1535, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161223
- /* 440 */ 1230, 1230, 1230, 1411, 1230, 1233, 1526, 1230, 1230, 1230,
161224
- /* 450 */ 1230, 1230, 1230, 1230, 1230, 1388, 1389, 1351, 1230, 1230,
161225
- /* 460 */ 1230, 1230, 1230, 1230, 1230, 1403, 1230, 1230, 1230, 1398,
161226
- /* 470 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1621, 1230,
161227
- /* 480 */ 1230, 1230, 1230, 1230, 1230, 1495, 1494, 1230, 1230, 1348,
161228
- /* 490 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161229
- /* 500 */ 1230, 1230, 1230, 1278, 1230, 1230, 1230, 1230, 1230, 1230,
161230
- /* 510 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161231
- /* 520 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1376, 1230, 1230,
161232
- /* 530 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161233
- /* 540 */ 1230, 1230, 1565, 1366, 1230, 1230, 1612, 1230, 1230, 1230,
161234
- /* 550 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161235
- /* 560 */ 1230, 1606, 1322, 1413, 1230, 1412, 1416, 1252, 1230, 1242,
161236
- /* 570 */ 1230, 1230,
161408
+ /* 0 */ 1637, 1637, 1637, 1466, 1233, 1344, 1233, 1233, 1233, 1466,
161409
+ /* 10 */ 1466, 1466, 1233, 1374, 1374, 1519, 1266, 1233, 1233, 1233,
161410
+ /* 20 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1465, 1233, 1233,
161411
+ /* 30 */ 1233, 1233, 1554, 1554, 1233, 1233, 1233, 1233, 1233, 1233,
161412
+ /* 40 */ 1233, 1233, 1383, 1233, 1390, 1233, 1233, 1233, 1233, 1233,
161413
+ /* 50 */ 1467, 1468, 1233, 1233, 1233, 1518, 1520, 1483, 1397, 1396,
161414
+ /* 60 */ 1395, 1394, 1501, 1361, 1388, 1381, 1385, 1461, 1462, 1460,
161415
+ /* 70 */ 1464, 1468, 1467, 1233, 1384, 1431, 1445, 1430, 1233, 1233,
161416
+ /* 80 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161417
+ /* 90 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161418
+ /* 100 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161419
+ /* 110 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161420
+ /* 120 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1439, 1444,
161421
+ /* 130 */ 1451, 1443, 1440, 1433, 1432, 1434, 1435, 1233, 1233, 1257,
161422
+ /* 140 */ 1233, 1233, 1254, 1308, 1233, 1233, 1233, 1233, 1233, 1538,
161423
+ /* 150 */ 1537, 1233, 1436, 1233, 1266, 1425, 1424, 1448, 1437, 1447,
161424
+ /* 160 */ 1446, 1526, 1590, 1589, 1484, 1233, 1233, 1233, 1233, 1233,
161425
+ /* 170 */ 1233, 1554, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161426
+ /* 180 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161427
+ /* 190 */ 1233, 1233, 1233, 1233, 1233, 1554, 1554, 1233, 1266, 1554,
161428
+ /* 200 */ 1554, 1262, 1262, 1368, 1233, 1533, 1335, 1335, 1335, 1335,
161429
+ /* 210 */ 1344, 1335, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161430
+ /* 220 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1523, 1521, 1233,
161431
+ /* 230 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161432
+ /* 240 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161433
+ /* 250 */ 1233, 1233, 1233, 1233, 1233, 1233, 1340, 1233, 1233, 1233,
161434
+ /* 260 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1583, 1233,
161435
+ /* 270 */ 1496, 1322, 1340, 1340, 1340, 1340, 1342, 1323, 1321, 1334,
161436
+ /* 280 */ 1267, 1240, 1629, 1400, 1389, 1341, 1363, 1389, 1363, 1626,
161437
+ /* 290 */ 1387, 1400, 1400, 1387, 1400, 1341, 1626, 1283, 1606, 1278,
161438
+ /* 300 */ 1374, 1374, 1374, 1363, 1368, 1368, 1463, 1341, 1334, 1233,
161439
+ /* 310 */ 1629, 1629, 1349, 1349, 1628, 1628, 1349, 1484, 1613, 1409,
161440
+ /* 320 */ 1311, 1317, 1317, 1317, 1317, 1349, 1251, 1387, 1613, 1613,
161441
+ /* 330 */ 1387, 1409, 1311, 1387, 1311, 1387, 1349, 1251, 1500, 1623,
161442
+ /* 340 */ 1349, 1251, 1474, 1349, 1251, 1349, 1251, 1474, 1309, 1309,
161443
+ /* 350 */ 1309, 1298, 1233, 1233, 1474, 1309, 1283, 1309, 1298, 1309,
161444
+ /* 360 */ 1309, 1572, 1233, 1478, 1478, 1474, 1367, 1362, 1367, 1362,
161445
+ /* 370 */ 1367, 1362, 1367, 1362, 1349, 1564, 1564, 1377, 1377, 1382,
161446
+ /* 380 */ 1368, 1469, 1349, 1233, 1382, 1380, 1378, 1387, 1301, 1586,
161447
+ /* 390 */ 1586, 1582, 1582, 1582, 1634, 1634, 1533, 1599, 1266, 1266,
161448
+ /* 400 */ 1266, 1266, 1599, 1285, 1285, 1267, 1267, 1266, 1599, 1233,
161449
+ /* 410 */ 1233, 1233, 1233, 1233, 1233, 1594, 1233, 1528, 1485, 1353,
161450
+ /* 420 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161451
+ /* 430 */ 1233, 1233, 1233, 1233, 1539, 1233, 1233, 1233, 1233, 1233,
161452
+ /* 440 */ 1233, 1233, 1233, 1233, 1233, 1414, 1233, 1236, 1530, 1233,
161453
+ /* 450 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1391, 1392, 1354,
161454
+ /* 460 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1406, 1233, 1233,
161455
+ /* 470 */ 1233, 1401, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161456
+ /* 480 */ 1625, 1233, 1233, 1233, 1233, 1233, 1233, 1499, 1498, 1233,
161457
+ /* 490 */ 1233, 1351, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161458
+ /* 500 */ 1233, 1233, 1233, 1233, 1233, 1281, 1233, 1233, 1233, 1233,
161459
+ /* 510 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161460
+ /* 520 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1379,
161461
+ /* 530 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161462
+ /* 540 */ 1233, 1233, 1233, 1233, 1569, 1369, 1233, 1233, 1616, 1233,
161463
+ /* 550 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161464
+ /* 560 */ 1233, 1233, 1233, 1610, 1325, 1416, 1233, 1415, 1419, 1255,
161465
+ /* 570 */ 1233, 1245, 1233, 1233,
161237161466
};
161238161467
/********** End of lemon-generated parsing tables *****************************/
161239161468
161240161469
/* The next table maps tokens (terminal symbols) into fallback tokens.
161241161470
** If a construct like the following:
@@ -161296,14 +161525,14 @@
161296161525
59, /* DETACH => ID */
161297161526
59, /* EACH => ID */
161298161527
59, /* FAIL => ID */
161299161528
0, /* OR => nothing */
161300161529
0, /* AND => nothing */
161530
+ 0, /* IS => nothing */
161301161531
59, /* MATCH => ID */
161302161532
59, /* LIKE_KW => ID */
161303161533
0, /* BETWEEN => nothing */
161304
- 0, /* IS => nothing */
161305161534
0, /* IN => nothing */
161306161535
0, /* ISNULL => nothing */
161307161536
0, /* NOTNULL => nothing */
161308161537
0, /* NE => nothing */
161309161538
0, /* EQ => nothing */
@@ -161363,10 +161592,11 @@
161363161592
0, /* MINUS => nothing */
161364161593
0, /* STAR => nothing */
161365161594
0, /* SLASH => nothing */
161366161595
0, /* REM => nothing */
161367161596
0, /* CONCAT => nothing */
161597
+ 0, /* PTR => nothing */
161368161598
0, /* COLLATE => nothing */
161369161599
0, /* BITNOT => nothing */
161370161600
0, /* ON => nothing */
161371161601
0, /* INDEXED => nothing */
161372161602
0, /* STRING => nothing */
@@ -161568,14 +161798,14 @@
161568161798
/* 40 */ "DETACH",
161569161799
/* 41 */ "EACH",
161570161800
/* 42 */ "FAIL",
161571161801
/* 43 */ "OR",
161572161802
/* 44 */ "AND",
161573
- /* 45 */ "MATCH",
161574
- /* 46 */ "LIKE_KW",
161575
- /* 47 */ "BETWEEN",
161576
- /* 48 */ "IS",
161803
+ /* 45 */ "IS",
161804
+ /* 46 */ "MATCH",
161805
+ /* 47 */ "LIKE_KW",
161806
+ /* 48 */ "BETWEEN",
161577161807
/* 49 */ "IN",
161578161808
/* 50 */ "ISNULL",
161579161809
/* 51 */ "NOTNULL",
161580161810
/* 52 */ "NE",
161581161811
/* 53 */ "EQ",
@@ -161635,216 +161865,217 @@
161635161865
/* 107 */ "MINUS",
161636161866
/* 108 */ "STAR",
161637161867
/* 109 */ "SLASH",
161638161868
/* 110 */ "REM",
161639161869
/* 111 */ "CONCAT",
161640
- /* 112 */ "COLLATE",
161641
- /* 113 */ "BITNOT",
161642
- /* 114 */ "ON",
161643
- /* 115 */ "INDEXED",
161644
- /* 116 */ "STRING",
161645
- /* 117 */ "JOIN_KW",
161646
- /* 118 */ "CONSTRAINT",
161647
- /* 119 */ "DEFAULT",
161648
- /* 120 */ "NULL",
161649
- /* 121 */ "PRIMARY",
161650
- /* 122 */ "UNIQUE",
161651
- /* 123 */ "CHECK",
161652
- /* 124 */ "REFERENCES",
161653
- /* 125 */ "AUTOINCR",
161654
- /* 126 */ "INSERT",
161655
- /* 127 */ "DELETE",
161656
- /* 128 */ "UPDATE",
161657
- /* 129 */ "SET",
161658
- /* 130 */ "DEFERRABLE",
161659
- /* 131 */ "FOREIGN",
161660
- /* 132 */ "DROP",
161661
- /* 133 */ "UNION",
161662
- /* 134 */ "ALL",
161663
- /* 135 */ "EXCEPT",
161664
- /* 136 */ "INTERSECT",
161665
- /* 137 */ "SELECT",
161666
- /* 138 */ "VALUES",
161667
- /* 139 */ "DISTINCT",
161668
- /* 140 */ "DOT",
161669
- /* 141 */ "FROM",
161670
- /* 142 */ "JOIN",
161671
- /* 143 */ "USING",
161672
- /* 144 */ "ORDER",
161673
- /* 145 */ "GROUP",
161674
- /* 146 */ "HAVING",
161675
- /* 147 */ "LIMIT",
161676
- /* 148 */ "WHERE",
161677
- /* 149 */ "RETURNING",
161678
- /* 150 */ "INTO",
161679
- /* 151 */ "NOTHING",
161680
- /* 152 */ "FLOAT",
161681
- /* 153 */ "BLOB",
161682
- /* 154 */ "INTEGER",
161683
- /* 155 */ "VARIABLE",
161684
- /* 156 */ "CASE",
161685
- /* 157 */ "WHEN",
161686
- /* 158 */ "THEN",
161687
- /* 159 */ "ELSE",
161688
- /* 160 */ "INDEX",
161689
- /* 161 */ "ALTER",
161690
- /* 162 */ "ADD",
161691
- /* 163 */ "WINDOW",
161692
- /* 164 */ "OVER",
161693
- /* 165 */ "FILTER",
161694
- /* 166 */ "COLUMN",
161695
- /* 167 */ "AGG_FUNCTION",
161696
- /* 168 */ "AGG_COLUMN",
161697
- /* 169 */ "TRUEFALSE",
161698
- /* 170 */ "ISNOT",
161699
- /* 171 */ "FUNCTION",
161700
- /* 172 */ "UMINUS",
161701
- /* 173 */ "UPLUS",
161702
- /* 174 */ "TRUTH",
161703
- /* 175 */ "REGISTER",
161704
- /* 176 */ "VECTOR",
161705
- /* 177 */ "SELECT_COLUMN",
161706
- /* 178 */ "IF_NULL_ROW",
161707
- /* 179 */ "ASTERISK",
161708
- /* 180 */ "SPAN",
161709
- /* 181 */ "ERROR",
161710
- /* 182 */ "SPACE",
161711
- /* 183 */ "ILLEGAL",
161712
- /* 184 */ "input",
161713
- /* 185 */ "cmdlist",
161714
- /* 186 */ "ecmd",
161715
- /* 187 */ "cmdx",
161716
- /* 188 */ "explain",
161717
- /* 189 */ "cmd",
161718
- /* 190 */ "transtype",
161719
- /* 191 */ "trans_opt",
161720
- /* 192 */ "nm",
161721
- /* 193 */ "savepoint_opt",
161722
- /* 194 */ "create_table",
161723
- /* 195 */ "create_table_args",
161724
- /* 196 */ "createkw",
161725
- /* 197 */ "temp",
161726
- /* 198 */ "ifnotexists",
161727
- /* 199 */ "dbnm",
161728
- /* 200 */ "columnlist",
161729
- /* 201 */ "conslist_opt",
161730
- /* 202 */ "table_option_set",
161731
- /* 203 */ "select",
161732
- /* 204 */ "table_option",
161733
- /* 205 */ "columnname",
161734
- /* 206 */ "carglist",
161735
- /* 207 */ "typetoken",
161736
- /* 208 */ "typename",
161737
- /* 209 */ "signed",
161738
- /* 210 */ "plus_num",
161739
- /* 211 */ "minus_num",
161740
- /* 212 */ "scanpt",
161741
- /* 213 */ "scantok",
161742
- /* 214 */ "ccons",
161743
- /* 215 */ "term",
161744
- /* 216 */ "expr",
161745
- /* 217 */ "onconf",
161746
- /* 218 */ "sortorder",
161747
- /* 219 */ "autoinc",
161748
- /* 220 */ "eidlist_opt",
161749
- /* 221 */ "refargs",
161750
- /* 222 */ "defer_subclause",
161751
- /* 223 */ "generated",
161752
- /* 224 */ "refarg",
161753
- /* 225 */ "refact",
161754
- /* 226 */ "init_deferred_pred_opt",
161755
- /* 227 */ "conslist",
161756
- /* 228 */ "tconscomma",
161757
- /* 229 */ "tcons",
161758
- /* 230 */ "sortlist",
161759
- /* 231 */ "eidlist",
161760
- /* 232 */ "defer_subclause_opt",
161761
- /* 233 */ "orconf",
161762
- /* 234 */ "resolvetype",
161763
- /* 235 */ "raisetype",
161764
- /* 236 */ "ifexists",
161765
- /* 237 */ "fullname",
161766
- /* 238 */ "selectnowith",
161767
- /* 239 */ "oneselect",
161768
- /* 240 */ "wqlist",
161769
- /* 241 */ "multiselect_op",
161770
- /* 242 */ "distinct",
161771
- /* 243 */ "selcollist",
161772
- /* 244 */ "from",
161773
- /* 245 */ "where_opt",
161774
- /* 246 */ "groupby_opt",
161775
- /* 247 */ "having_opt",
161776
- /* 248 */ "orderby_opt",
161777
- /* 249 */ "limit_opt",
161778
- /* 250 */ "window_clause",
161779
- /* 251 */ "values",
161780
- /* 252 */ "nexprlist",
161781
- /* 253 */ "sclp",
161782
- /* 254 */ "as",
161783
- /* 255 */ "seltablist",
161784
- /* 256 */ "stl_prefix",
161785
- /* 257 */ "joinop",
161786
- /* 258 */ "indexed_opt",
161787
- /* 259 */ "on_opt",
161788
- /* 260 */ "using_opt",
161789
- /* 261 */ "exprlist",
161790
- /* 262 */ "xfullname",
161791
- /* 263 */ "idlist",
161792
- /* 264 */ "nulls",
161793
- /* 265 */ "with",
161794
- /* 266 */ "where_opt_ret",
161795
- /* 267 */ "setlist",
161796
- /* 268 */ "insert_cmd",
161797
- /* 269 */ "idlist_opt",
161798
- /* 270 */ "upsert",
161799
- /* 271 */ "returning",
161800
- /* 272 */ "filter_over",
161801
- /* 273 */ "likeop",
161802
- /* 274 */ "between_op",
161803
- /* 275 */ "in_op",
161804
- /* 276 */ "paren_exprlist",
161805
- /* 277 */ "case_operand",
161806
- /* 278 */ "case_exprlist",
161807
- /* 279 */ "case_else",
161808
- /* 280 */ "uniqueflag",
161809
- /* 281 */ "collate",
161810
- /* 282 */ "vinto",
161811
- /* 283 */ "nmnum",
161812
- /* 284 */ "trigger_decl",
161813
- /* 285 */ "trigger_cmd_list",
161814
- /* 286 */ "trigger_time",
161815
- /* 287 */ "trigger_event",
161816
- /* 288 */ "foreach_clause",
161817
- /* 289 */ "when_clause",
161818
- /* 290 */ "trigger_cmd",
161819
- /* 291 */ "trnm",
161820
- /* 292 */ "tridxby",
161821
- /* 293 */ "database_kw_opt",
161822
- /* 294 */ "key_opt",
161823
- /* 295 */ "add_column_fullname",
161824
- /* 296 */ "kwcolumn_opt",
161825
- /* 297 */ "create_vtab",
161826
- /* 298 */ "vtabarglist",
161827
- /* 299 */ "vtabarg",
161828
- /* 300 */ "vtabargtoken",
161829
- /* 301 */ "lp",
161830
- /* 302 */ "anylist",
161831
- /* 303 */ "wqitem",
161832
- /* 304 */ "wqas",
161833
- /* 305 */ "windowdefn_list",
161834
- /* 306 */ "windowdefn",
161835
- /* 307 */ "window",
161836
- /* 308 */ "frame_opt",
161837
- /* 309 */ "part_opt",
161838
- /* 310 */ "filter_clause",
161839
- /* 311 */ "over_clause",
161840
- /* 312 */ "range_or_rows",
161841
- /* 313 */ "frame_bound",
161842
- /* 314 */ "frame_bound_s",
161843
- /* 315 */ "frame_bound_e",
161844
- /* 316 */ "frame_exclude_opt",
161845
- /* 317 */ "frame_exclude",
161870
+ /* 112 */ "PTR",
161871
+ /* 113 */ "COLLATE",
161872
+ /* 114 */ "BITNOT",
161873
+ /* 115 */ "ON",
161874
+ /* 116 */ "INDEXED",
161875
+ /* 117 */ "STRING",
161876
+ /* 118 */ "JOIN_KW",
161877
+ /* 119 */ "CONSTRAINT",
161878
+ /* 120 */ "DEFAULT",
161879
+ /* 121 */ "NULL",
161880
+ /* 122 */ "PRIMARY",
161881
+ /* 123 */ "UNIQUE",
161882
+ /* 124 */ "CHECK",
161883
+ /* 125 */ "REFERENCES",
161884
+ /* 126 */ "AUTOINCR",
161885
+ /* 127 */ "INSERT",
161886
+ /* 128 */ "DELETE",
161887
+ /* 129 */ "UPDATE",
161888
+ /* 130 */ "SET",
161889
+ /* 131 */ "DEFERRABLE",
161890
+ /* 132 */ "FOREIGN",
161891
+ /* 133 */ "DROP",
161892
+ /* 134 */ "UNION",
161893
+ /* 135 */ "ALL",
161894
+ /* 136 */ "EXCEPT",
161895
+ /* 137 */ "INTERSECT",
161896
+ /* 138 */ "SELECT",
161897
+ /* 139 */ "VALUES",
161898
+ /* 140 */ "DISTINCT",
161899
+ /* 141 */ "DOT",
161900
+ /* 142 */ "FROM",
161901
+ /* 143 */ "JOIN",
161902
+ /* 144 */ "USING",
161903
+ /* 145 */ "ORDER",
161904
+ /* 146 */ "GROUP",
161905
+ /* 147 */ "HAVING",
161906
+ /* 148 */ "LIMIT",
161907
+ /* 149 */ "WHERE",
161908
+ /* 150 */ "RETURNING",
161909
+ /* 151 */ "INTO",
161910
+ /* 152 */ "NOTHING",
161911
+ /* 153 */ "FLOAT",
161912
+ /* 154 */ "BLOB",
161913
+ /* 155 */ "INTEGER",
161914
+ /* 156 */ "VARIABLE",
161915
+ /* 157 */ "CASE",
161916
+ /* 158 */ "WHEN",
161917
+ /* 159 */ "THEN",
161918
+ /* 160 */ "ELSE",
161919
+ /* 161 */ "INDEX",
161920
+ /* 162 */ "ALTER",
161921
+ /* 163 */ "ADD",
161922
+ /* 164 */ "WINDOW",
161923
+ /* 165 */ "OVER",
161924
+ /* 166 */ "FILTER",
161925
+ /* 167 */ "COLUMN",
161926
+ /* 168 */ "AGG_FUNCTION",
161927
+ /* 169 */ "AGG_COLUMN",
161928
+ /* 170 */ "TRUEFALSE",
161929
+ /* 171 */ "ISNOT",
161930
+ /* 172 */ "FUNCTION",
161931
+ /* 173 */ "UMINUS",
161932
+ /* 174 */ "UPLUS",
161933
+ /* 175 */ "TRUTH",
161934
+ /* 176 */ "REGISTER",
161935
+ /* 177 */ "VECTOR",
161936
+ /* 178 */ "SELECT_COLUMN",
161937
+ /* 179 */ "IF_NULL_ROW",
161938
+ /* 180 */ "ASTERISK",
161939
+ /* 181 */ "SPAN",
161940
+ /* 182 */ "ERROR",
161941
+ /* 183 */ "SPACE",
161942
+ /* 184 */ "ILLEGAL",
161943
+ /* 185 */ "input",
161944
+ /* 186 */ "cmdlist",
161945
+ /* 187 */ "ecmd",
161946
+ /* 188 */ "cmdx",
161947
+ /* 189 */ "explain",
161948
+ /* 190 */ "cmd",
161949
+ /* 191 */ "transtype",
161950
+ /* 192 */ "trans_opt",
161951
+ /* 193 */ "nm",
161952
+ /* 194 */ "savepoint_opt",
161953
+ /* 195 */ "create_table",
161954
+ /* 196 */ "create_table_args",
161955
+ /* 197 */ "createkw",
161956
+ /* 198 */ "temp",
161957
+ /* 199 */ "ifnotexists",
161958
+ /* 200 */ "dbnm",
161959
+ /* 201 */ "columnlist",
161960
+ /* 202 */ "conslist_opt",
161961
+ /* 203 */ "table_option_set",
161962
+ /* 204 */ "select",
161963
+ /* 205 */ "table_option",
161964
+ /* 206 */ "columnname",
161965
+ /* 207 */ "carglist",
161966
+ /* 208 */ "typetoken",
161967
+ /* 209 */ "typename",
161968
+ /* 210 */ "signed",
161969
+ /* 211 */ "plus_num",
161970
+ /* 212 */ "minus_num",
161971
+ /* 213 */ "scanpt",
161972
+ /* 214 */ "scantok",
161973
+ /* 215 */ "ccons",
161974
+ /* 216 */ "term",
161975
+ /* 217 */ "expr",
161976
+ /* 218 */ "onconf",
161977
+ /* 219 */ "sortorder",
161978
+ /* 220 */ "autoinc",
161979
+ /* 221 */ "eidlist_opt",
161980
+ /* 222 */ "refargs",
161981
+ /* 223 */ "defer_subclause",
161982
+ /* 224 */ "generated",
161983
+ /* 225 */ "refarg",
161984
+ /* 226 */ "refact",
161985
+ /* 227 */ "init_deferred_pred_opt",
161986
+ /* 228 */ "conslist",
161987
+ /* 229 */ "tconscomma",
161988
+ /* 230 */ "tcons",
161989
+ /* 231 */ "sortlist",
161990
+ /* 232 */ "eidlist",
161991
+ /* 233 */ "defer_subclause_opt",
161992
+ /* 234 */ "orconf",
161993
+ /* 235 */ "resolvetype",
161994
+ /* 236 */ "raisetype",
161995
+ /* 237 */ "ifexists",
161996
+ /* 238 */ "fullname",
161997
+ /* 239 */ "selectnowith",
161998
+ /* 240 */ "oneselect",
161999
+ /* 241 */ "wqlist",
162000
+ /* 242 */ "multiselect_op",
162001
+ /* 243 */ "distinct",
162002
+ /* 244 */ "selcollist",
162003
+ /* 245 */ "from",
162004
+ /* 246 */ "where_opt",
162005
+ /* 247 */ "groupby_opt",
162006
+ /* 248 */ "having_opt",
162007
+ /* 249 */ "orderby_opt",
162008
+ /* 250 */ "limit_opt",
162009
+ /* 251 */ "window_clause",
162010
+ /* 252 */ "values",
162011
+ /* 253 */ "nexprlist",
162012
+ /* 254 */ "sclp",
162013
+ /* 255 */ "as",
162014
+ /* 256 */ "seltablist",
162015
+ /* 257 */ "stl_prefix",
162016
+ /* 258 */ "joinop",
162017
+ /* 259 */ "indexed_opt",
162018
+ /* 260 */ "on_opt",
162019
+ /* 261 */ "using_opt",
162020
+ /* 262 */ "exprlist",
162021
+ /* 263 */ "xfullname",
162022
+ /* 264 */ "idlist",
162023
+ /* 265 */ "nulls",
162024
+ /* 266 */ "with",
162025
+ /* 267 */ "where_opt_ret",
162026
+ /* 268 */ "setlist",
162027
+ /* 269 */ "insert_cmd",
162028
+ /* 270 */ "idlist_opt",
162029
+ /* 271 */ "upsert",
162030
+ /* 272 */ "returning",
162031
+ /* 273 */ "filter_over",
162032
+ /* 274 */ "likeop",
162033
+ /* 275 */ "between_op",
162034
+ /* 276 */ "in_op",
162035
+ /* 277 */ "paren_exprlist",
162036
+ /* 278 */ "case_operand",
162037
+ /* 279 */ "case_exprlist",
162038
+ /* 280 */ "case_else",
162039
+ /* 281 */ "uniqueflag",
162040
+ /* 282 */ "collate",
162041
+ /* 283 */ "vinto",
162042
+ /* 284 */ "nmnum",
162043
+ /* 285 */ "trigger_decl",
162044
+ /* 286 */ "trigger_cmd_list",
162045
+ /* 287 */ "trigger_time",
162046
+ /* 288 */ "trigger_event",
162047
+ /* 289 */ "foreach_clause",
162048
+ /* 290 */ "when_clause",
162049
+ /* 291 */ "trigger_cmd",
162050
+ /* 292 */ "trnm",
162051
+ /* 293 */ "tridxby",
162052
+ /* 294 */ "database_kw_opt",
162053
+ /* 295 */ "key_opt",
162054
+ /* 296 */ "add_column_fullname",
162055
+ /* 297 */ "kwcolumn_opt",
162056
+ /* 298 */ "create_vtab",
162057
+ /* 299 */ "vtabarglist",
162058
+ /* 300 */ "vtabarg",
162059
+ /* 301 */ "vtabargtoken",
162060
+ /* 302 */ "lp",
162061
+ /* 303 */ "anylist",
162062
+ /* 304 */ "wqitem",
162063
+ /* 305 */ "wqas",
162064
+ /* 306 */ "windowdefn_list",
162065
+ /* 307 */ "windowdefn",
162066
+ /* 308 */ "window",
162067
+ /* 309 */ "frame_opt",
162068
+ /* 310 */ "part_opt",
162069
+ /* 311 */ "filter_clause",
162070
+ /* 312 */ "over_clause",
162071
+ /* 313 */ "range_or_rows",
162072
+ /* 314 */ "frame_bound",
162073
+ /* 315 */ "frame_bound_s",
162074
+ /* 316 */ "frame_bound_e",
162075
+ /* 317 */ "frame_exclude_opt",
162076
+ /* 318 */ "frame_exclude",
161846162077
};
161847162078
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
161848162079
161849162080
#ifndef NDEBUG
161850162081
/* For tracing reduce actions, the names of all rules are required.
@@ -162060,199 +162291,200 @@
162060162291
/* 207 */ "expr ::= expr IS expr",
162061162292
/* 208 */ "expr ::= expr IS NOT expr",
162062162293
/* 209 */ "expr ::= NOT expr",
162063162294
/* 210 */ "expr ::= BITNOT expr",
162064162295
/* 211 */ "expr ::= PLUS|MINUS expr",
162065
- /* 212 */ "between_op ::= BETWEEN",
162066
- /* 213 */ "between_op ::= NOT BETWEEN",
162067
- /* 214 */ "expr ::= expr between_op expr AND expr",
162068
- /* 215 */ "in_op ::= IN",
162069
- /* 216 */ "in_op ::= NOT IN",
162070
- /* 217 */ "expr ::= expr in_op LP exprlist RP",
162071
- /* 218 */ "expr ::= LP select RP",
162072
- /* 219 */ "expr ::= expr in_op LP select RP",
162073
- /* 220 */ "expr ::= expr in_op nm dbnm paren_exprlist",
162074
- /* 221 */ "expr ::= EXISTS LP select RP",
162075
- /* 222 */ "expr ::= CASE case_operand case_exprlist case_else END",
162076
- /* 223 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
162077
- /* 224 */ "case_exprlist ::= WHEN expr THEN expr",
162078
- /* 225 */ "case_else ::= ELSE expr",
162079
- /* 226 */ "case_else ::=",
162080
- /* 227 */ "case_operand ::= expr",
162081
- /* 228 */ "case_operand ::=",
162082
- /* 229 */ "exprlist ::=",
162083
- /* 230 */ "nexprlist ::= nexprlist COMMA expr",
162084
- /* 231 */ "nexprlist ::= expr",
162085
- /* 232 */ "paren_exprlist ::=",
162086
- /* 233 */ "paren_exprlist ::= LP exprlist RP",
162087
- /* 234 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
162088
- /* 235 */ "uniqueflag ::= UNIQUE",
162089
- /* 236 */ "uniqueflag ::=",
162090
- /* 237 */ "eidlist_opt ::=",
162091
- /* 238 */ "eidlist_opt ::= LP eidlist RP",
162092
- /* 239 */ "eidlist ::= eidlist COMMA nm collate sortorder",
162093
- /* 240 */ "eidlist ::= nm collate sortorder",
162094
- /* 241 */ "collate ::=",
162095
- /* 242 */ "collate ::= COLLATE ID|STRING",
162096
- /* 243 */ "cmd ::= DROP INDEX ifexists fullname",
162097
- /* 244 */ "cmd ::= VACUUM vinto",
162098
- /* 245 */ "cmd ::= VACUUM nm vinto",
162099
- /* 246 */ "vinto ::= INTO expr",
162100
- /* 247 */ "vinto ::=",
162101
- /* 248 */ "cmd ::= PRAGMA nm dbnm",
162102
- /* 249 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
162103
- /* 250 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
162104
- /* 251 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
162105
- /* 252 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
162106
- /* 253 */ "plus_num ::= PLUS INTEGER|FLOAT",
162107
- /* 254 */ "minus_num ::= MINUS INTEGER|FLOAT",
162108
- /* 255 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
162109
- /* 256 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
162110
- /* 257 */ "trigger_time ::= BEFORE|AFTER",
162111
- /* 258 */ "trigger_time ::= INSTEAD OF",
162112
- /* 259 */ "trigger_time ::=",
162113
- /* 260 */ "trigger_event ::= DELETE|INSERT",
162114
- /* 261 */ "trigger_event ::= UPDATE",
162115
- /* 262 */ "trigger_event ::= UPDATE OF idlist",
162116
- /* 263 */ "when_clause ::=",
162117
- /* 264 */ "when_clause ::= WHEN expr",
162118
- /* 265 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
162119
- /* 266 */ "trigger_cmd_list ::= trigger_cmd SEMI",
162120
- /* 267 */ "trnm ::= nm DOT nm",
162121
- /* 268 */ "tridxby ::= INDEXED BY nm",
162122
- /* 269 */ "tridxby ::= NOT INDEXED",
162123
- /* 270 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
162124
- /* 271 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
162125
- /* 272 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
162126
- /* 273 */ "trigger_cmd ::= scanpt select scanpt",
162127
- /* 274 */ "expr ::= RAISE LP IGNORE RP",
162128
- /* 275 */ "expr ::= RAISE LP raisetype COMMA nm RP",
162129
- /* 276 */ "raisetype ::= ROLLBACK",
162130
- /* 277 */ "raisetype ::= ABORT",
162131
- /* 278 */ "raisetype ::= FAIL",
162132
- /* 279 */ "cmd ::= DROP TRIGGER ifexists fullname",
162133
- /* 280 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
162134
- /* 281 */ "cmd ::= DETACH database_kw_opt expr",
162135
- /* 282 */ "key_opt ::=",
162136
- /* 283 */ "key_opt ::= KEY expr",
162137
- /* 284 */ "cmd ::= REINDEX",
162138
- /* 285 */ "cmd ::= REINDEX nm dbnm",
162139
- /* 286 */ "cmd ::= ANALYZE",
162140
- /* 287 */ "cmd ::= ANALYZE nm dbnm",
162141
- /* 288 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
162142
- /* 289 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
162143
- /* 290 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
162144
- /* 291 */ "add_column_fullname ::= fullname",
162145
- /* 292 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
162146
- /* 293 */ "cmd ::= create_vtab",
162147
- /* 294 */ "cmd ::= create_vtab LP vtabarglist RP",
162148
- /* 295 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
162149
- /* 296 */ "vtabarg ::=",
162150
- /* 297 */ "vtabargtoken ::= ANY",
162151
- /* 298 */ "vtabargtoken ::= lp anylist RP",
162152
- /* 299 */ "lp ::= LP",
162153
- /* 300 */ "with ::= WITH wqlist",
162154
- /* 301 */ "with ::= WITH RECURSIVE wqlist",
162155
- /* 302 */ "wqas ::= AS",
162156
- /* 303 */ "wqas ::= AS MATERIALIZED",
162157
- /* 304 */ "wqas ::= AS NOT MATERIALIZED",
162158
- /* 305 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
162159
- /* 306 */ "wqlist ::= wqitem",
162160
- /* 307 */ "wqlist ::= wqlist COMMA wqitem",
162161
- /* 308 */ "windowdefn_list ::= windowdefn",
162162
- /* 309 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
162163
- /* 310 */ "windowdefn ::= nm AS LP window RP",
162164
- /* 311 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
162165
- /* 312 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
162166
- /* 313 */ "window ::= ORDER BY sortlist frame_opt",
162167
- /* 314 */ "window ::= nm ORDER BY sortlist frame_opt",
162168
- /* 315 */ "window ::= frame_opt",
162169
- /* 316 */ "window ::= nm frame_opt",
162170
- /* 317 */ "frame_opt ::=",
162171
- /* 318 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
162172
- /* 319 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
162173
- /* 320 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
162174
- /* 321 */ "frame_bound_s ::= frame_bound",
162175
- /* 322 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
162176
- /* 323 */ "frame_bound_e ::= frame_bound",
162177
- /* 324 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
162178
- /* 325 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
162179
- /* 326 */ "frame_bound ::= CURRENT ROW",
162180
- /* 327 */ "frame_exclude_opt ::=",
162181
- /* 328 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
162182
- /* 329 */ "frame_exclude ::= NO OTHERS",
162183
- /* 330 */ "frame_exclude ::= CURRENT ROW",
162184
- /* 331 */ "frame_exclude ::= GROUP|TIES",
162185
- /* 332 */ "window_clause ::= WINDOW windowdefn_list",
162186
- /* 333 */ "filter_over ::= filter_clause over_clause",
162187
- /* 334 */ "filter_over ::= over_clause",
162188
- /* 335 */ "filter_over ::= filter_clause",
162189
- /* 336 */ "over_clause ::= OVER LP window RP",
162190
- /* 337 */ "over_clause ::= OVER nm",
162191
- /* 338 */ "filter_clause ::= FILTER LP WHERE expr RP",
162192
- /* 339 */ "input ::= cmdlist",
162193
- /* 340 */ "cmdlist ::= cmdlist ecmd",
162194
- /* 341 */ "cmdlist ::= ecmd",
162195
- /* 342 */ "ecmd ::= SEMI",
162196
- /* 343 */ "ecmd ::= cmdx SEMI",
162197
- /* 344 */ "ecmd ::= explain cmdx SEMI",
162198
- /* 345 */ "trans_opt ::=",
162199
- /* 346 */ "trans_opt ::= TRANSACTION",
162200
- /* 347 */ "trans_opt ::= TRANSACTION nm",
162201
- /* 348 */ "savepoint_opt ::= SAVEPOINT",
162202
- /* 349 */ "savepoint_opt ::=",
162203
- /* 350 */ "cmd ::= create_table create_table_args",
162204
- /* 351 */ "table_option_set ::= table_option",
162205
- /* 352 */ "columnlist ::= columnlist COMMA columnname carglist",
162206
- /* 353 */ "columnlist ::= columnname carglist",
162207
- /* 354 */ "nm ::= ID|INDEXED",
162208
- /* 355 */ "nm ::= STRING",
162209
- /* 356 */ "nm ::= JOIN_KW",
162210
- /* 357 */ "typetoken ::= typename",
162211
- /* 358 */ "typename ::= ID|STRING",
162212
- /* 359 */ "signed ::= plus_num",
162213
- /* 360 */ "signed ::= minus_num",
162214
- /* 361 */ "carglist ::= carglist ccons",
162215
- /* 362 */ "carglist ::=",
162216
- /* 363 */ "ccons ::= NULL onconf",
162217
- /* 364 */ "ccons ::= GENERATED ALWAYS AS generated",
162218
- /* 365 */ "ccons ::= AS generated",
162219
- /* 366 */ "conslist_opt ::= COMMA conslist",
162220
- /* 367 */ "conslist ::= conslist tconscomma tcons",
162221
- /* 368 */ "conslist ::= tcons",
162222
- /* 369 */ "tconscomma ::=",
162223
- /* 370 */ "defer_subclause_opt ::= defer_subclause",
162224
- /* 371 */ "resolvetype ::= raisetype",
162225
- /* 372 */ "selectnowith ::= oneselect",
162226
- /* 373 */ "oneselect ::= values",
162227
- /* 374 */ "sclp ::= selcollist COMMA",
162228
- /* 375 */ "as ::= ID|STRING",
162229
- /* 376 */ "returning ::=",
162230
- /* 377 */ "expr ::= term",
162231
- /* 378 */ "likeop ::= LIKE_KW|MATCH",
162232
- /* 379 */ "exprlist ::= nexprlist",
162233
- /* 380 */ "nmnum ::= plus_num",
162234
- /* 381 */ "nmnum ::= nm",
162235
- /* 382 */ "nmnum ::= ON",
162236
- /* 383 */ "nmnum ::= DELETE",
162237
- /* 384 */ "nmnum ::= DEFAULT",
162238
- /* 385 */ "plus_num ::= INTEGER|FLOAT",
162239
- /* 386 */ "foreach_clause ::=",
162240
- /* 387 */ "foreach_clause ::= FOR EACH ROW",
162241
- /* 388 */ "trnm ::= nm",
162242
- /* 389 */ "tridxby ::=",
162243
- /* 390 */ "database_kw_opt ::= DATABASE",
162244
- /* 391 */ "database_kw_opt ::=",
162245
- /* 392 */ "kwcolumn_opt ::=",
162246
- /* 393 */ "kwcolumn_opt ::= COLUMNKW",
162247
- /* 394 */ "vtabarglist ::= vtabarg",
162248
- /* 395 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
162249
- /* 396 */ "vtabarg ::= vtabarg vtabargtoken",
162250
- /* 397 */ "anylist ::=",
162251
- /* 398 */ "anylist ::= anylist LP anylist RP",
162252
- /* 399 */ "anylist ::= anylist ANY",
162253
- /* 400 */ "with ::=",
162296
+ /* 212 */ "expr ::= expr PTR expr",
162297
+ /* 213 */ "between_op ::= BETWEEN",
162298
+ /* 214 */ "between_op ::= NOT BETWEEN",
162299
+ /* 215 */ "expr ::= expr between_op expr AND expr",
162300
+ /* 216 */ "in_op ::= IN",
162301
+ /* 217 */ "in_op ::= NOT IN",
162302
+ /* 218 */ "expr ::= expr in_op LP exprlist RP",
162303
+ /* 219 */ "expr ::= LP select RP",
162304
+ /* 220 */ "expr ::= expr in_op LP select RP",
162305
+ /* 221 */ "expr ::= expr in_op nm dbnm paren_exprlist",
162306
+ /* 222 */ "expr ::= EXISTS LP select RP",
162307
+ /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END",
162308
+ /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
162309
+ /* 225 */ "case_exprlist ::= WHEN expr THEN expr",
162310
+ /* 226 */ "case_else ::= ELSE expr",
162311
+ /* 227 */ "case_else ::=",
162312
+ /* 228 */ "case_operand ::= expr",
162313
+ /* 229 */ "case_operand ::=",
162314
+ /* 230 */ "exprlist ::=",
162315
+ /* 231 */ "nexprlist ::= nexprlist COMMA expr",
162316
+ /* 232 */ "nexprlist ::= expr",
162317
+ /* 233 */ "paren_exprlist ::=",
162318
+ /* 234 */ "paren_exprlist ::= LP exprlist RP",
162319
+ /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
162320
+ /* 236 */ "uniqueflag ::= UNIQUE",
162321
+ /* 237 */ "uniqueflag ::=",
162322
+ /* 238 */ "eidlist_opt ::=",
162323
+ /* 239 */ "eidlist_opt ::= LP eidlist RP",
162324
+ /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder",
162325
+ /* 241 */ "eidlist ::= nm collate sortorder",
162326
+ /* 242 */ "collate ::=",
162327
+ /* 243 */ "collate ::= COLLATE ID|STRING",
162328
+ /* 244 */ "cmd ::= DROP INDEX ifexists fullname",
162329
+ /* 245 */ "cmd ::= VACUUM vinto",
162330
+ /* 246 */ "cmd ::= VACUUM nm vinto",
162331
+ /* 247 */ "vinto ::= INTO expr",
162332
+ /* 248 */ "vinto ::=",
162333
+ /* 249 */ "cmd ::= PRAGMA nm dbnm",
162334
+ /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
162335
+ /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
162336
+ /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
162337
+ /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
162338
+ /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT",
162339
+ /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT",
162340
+ /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
162341
+ /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
162342
+ /* 258 */ "trigger_time ::= BEFORE|AFTER",
162343
+ /* 259 */ "trigger_time ::= INSTEAD OF",
162344
+ /* 260 */ "trigger_time ::=",
162345
+ /* 261 */ "trigger_event ::= DELETE|INSERT",
162346
+ /* 262 */ "trigger_event ::= UPDATE",
162347
+ /* 263 */ "trigger_event ::= UPDATE OF idlist",
162348
+ /* 264 */ "when_clause ::=",
162349
+ /* 265 */ "when_clause ::= WHEN expr",
162350
+ /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
162351
+ /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI",
162352
+ /* 268 */ "trnm ::= nm DOT nm",
162353
+ /* 269 */ "tridxby ::= INDEXED BY nm",
162354
+ /* 270 */ "tridxby ::= NOT INDEXED",
162355
+ /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
162356
+ /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
162357
+ /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
162358
+ /* 274 */ "trigger_cmd ::= scanpt select scanpt",
162359
+ /* 275 */ "expr ::= RAISE LP IGNORE RP",
162360
+ /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP",
162361
+ /* 277 */ "raisetype ::= ROLLBACK",
162362
+ /* 278 */ "raisetype ::= ABORT",
162363
+ /* 279 */ "raisetype ::= FAIL",
162364
+ /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname",
162365
+ /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
162366
+ /* 282 */ "cmd ::= DETACH database_kw_opt expr",
162367
+ /* 283 */ "key_opt ::=",
162368
+ /* 284 */ "key_opt ::= KEY expr",
162369
+ /* 285 */ "cmd ::= REINDEX",
162370
+ /* 286 */ "cmd ::= REINDEX nm dbnm",
162371
+ /* 287 */ "cmd ::= ANALYZE",
162372
+ /* 288 */ "cmd ::= ANALYZE nm dbnm",
162373
+ /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
162374
+ /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
162375
+ /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
162376
+ /* 292 */ "add_column_fullname ::= fullname",
162377
+ /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
162378
+ /* 294 */ "cmd ::= create_vtab",
162379
+ /* 295 */ "cmd ::= create_vtab LP vtabarglist RP",
162380
+ /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
162381
+ /* 297 */ "vtabarg ::=",
162382
+ /* 298 */ "vtabargtoken ::= ANY",
162383
+ /* 299 */ "vtabargtoken ::= lp anylist RP",
162384
+ /* 300 */ "lp ::= LP",
162385
+ /* 301 */ "with ::= WITH wqlist",
162386
+ /* 302 */ "with ::= WITH RECURSIVE wqlist",
162387
+ /* 303 */ "wqas ::= AS",
162388
+ /* 304 */ "wqas ::= AS MATERIALIZED",
162389
+ /* 305 */ "wqas ::= AS NOT MATERIALIZED",
162390
+ /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
162391
+ /* 307 */ "wqlist ::= wqitem",
162392
+ /* 308 */ "wqlist ::= wqlist COMMA wqitem",
162393
+ /* 309 */ "windowdefn_list ::= windowdefn",
162394
+ /* 310 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
162395
+ /* 311 */ "windowdefn ::= nm AS LP window RP",
162396
+ /* 312 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
162397
+ /* 313 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
162398
+ /* 314 */ "window ::= ORDER BY sortlist frame_opt",
162399
+ /* 315 */ "window ::= nm ORDER BY sortlist frame_opt",
162400
+ /* 316 */ "window ::= frame_opt",
162401
+ /* 317 */ "window ::= nm frame_opt",
162402
+ /* 318 */ "frame_opt ::=",
162403
+ /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
162404
+ /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
162405
+ /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
162406
+ /* 322 */ "frame_bound_s ::= frame_bound",
162407
+ /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
162408
+ /* 324 */ "frame_bound_e ::= frame_bound",
162409
+ /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
162410
+ /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
162411
+ /* 327 */ "frame_bound ::= CURRENT ROW",
162412
+ /* 328 */ "frame_exclude_opt ::=",
162413
+ /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
162414
+ /* 330 */ "frame_exclude ::= NO OTHERS",
162415
+ /* 331 */ "frame_exclude ::= CURRENT ROW",
162416
+ /* 332 */ "frame_exclude ::= GROUP|TIES",
162417
+ /* 333 */ "window_clause ::= WINDOW windowdefn_list",
162418
+ /* 334 */ "filter_over ::= filter_clause over_clause",
162419
+ /* 335 */ "filter_over ::= over_clause",
162420
+ /* 336 */ "filter_over ::= filter_clause",
162421
+ /* 337 */ "over_clause ::= OVER LP window RP",
162422
+ /* 338 */ "over_clause ::= OVER nm",
162423
+ /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP",
162424
+ /* 340 */ "input ::= cmdlist",
162425
+ /* 341 */ "cmdlist ::= cmdlist ecmd",
162426
+ /* 342 */ "cmdlist ::= ecmd",
162427
+ /* 343 */ "ecmd ::= SEMI",
162428
+ /* 344 */ "ecmd ::= cmdx SEMI",
162429
+ /* 345 */ "ecmd ::= explain cmdx SEMI",
162430
+ /* 346 */ "trans_opt ::=",
162431
+ /* 347 */ "trans_opt ::= TRANSACTION",
162432
+ /* 348 */ "trans_opt ::= TRANSACTION nm",
162433
+ /* 349 */ "savepoint_opt ::= SAVEPOINT",
162434
+ /* 350 */ "savepoint_opt ::=",
162435
+ /* 351 */ "cmd ::= create_table create_table_args",
162436
+ /* 352 */ "table_option_set ::= table_option",
162437
+ /* 353 */ "columnlist ::= columnlist COMMA columnname carglist",
162438
+ /* 354 */ "columnlist ::= columnname carglist",
162439
+ /* 355 */ "nm ::= ID|INDEXED",
162440
+ /* 356 */ "nm ::= STRING",
162441
+ /* 357 */ "nm ::= JOIN_KW",
162442
+ /* 358 */ "typetoken ::= typename",
162443
+ /* 359 */ "typename ::= ID|STRING",
162444
+ /* 360 */ "signed ::= plus_num",
162445
+ /* 361 */ "signed ::= minus_num",
162446
+ /* 362 */ "carglist ::= carglist ccons",
162447
+ /* 363 */ "carglist ::=",
162448
+ /* 364 */ "ccons ::= NULL onconf",
162449
+ /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
162450
+ /* 366 */ "ccons ::= AS generated",
162451
+ /* 367 */ "conslist_opt ::= COMMA conslist",
162452
+ /* 368 */ "conslist ::= conslist tconscomma tcons",
162453
+ /* 369 */ "conslist ::= tcons",
162454
+ /* 370 */ "tconscomma ::=",
162455
+ /* 371 */ "defer_subclause_opt ::= defer_subclause",
162456
+ /* 372 */ "resolvetype ::= raisetype",
162457
+ /* 373 */ "selectnowith ::= oneselect",
162458
+ /* 374 */ "oneselect ::= values",
162459
+ /* 375 */ "sclp ::= selcollist COMMA",
162460
+ /* 376 */ "as ::= ID|STRING",
162461
+ /* 377 */ "returning ::=",
162462
+ /* 378 */ "expr ::= term",
162463
+ /* 379 */ "likeop ::= LIKE_KW|MATCH",
162464
+ /* 380 */ "exprlist ::= nexprlist",
162465
+ /* 381 */ "nmnum ::= plus_num",
162466
+ /* 382 */ "nmnum ::= nm",
162467
+ /* 383 */ "nmnum ::= ON",
162468
+ /* 384 */ "nmnum ::= DELETE",
162469
+ /* 385 */ "nmnum ::= DEFAULT",
162470
+ /* 386 */ "plus_num ::= INTEGER|FLOAT",
162471
+ /* 387 */ "foreach_clause ::=",
162472
+ /* 388 */ "foreach_clause ::= FOR EACH ROW",
162473
+ /* 389 */ "trnm ::= nm",
162474
+ /* 390 */ "tridxby ::=",
162475
+ /* 391 */ "database_kw_opt ::= DATABASE",
162476
+ /* 392 */ "database_kw_opt ::=",
162477
+ /* 393 */ "kwcolumn_opt ::=",
162478
+ /* 394 */ "kwcolumn_opt ::= COLUMNKW",
162479
+ /* 395 */ "vtabarglist ::= vtabarg",
162480
+ /* 396 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
162481
+ /* 397 */ "vtabarg ::= vtabarg vtabargtoken",
162482
+ /* 398 */ "anylist ::=",
162483
+ /* 399 */ "anylist ::= anylist LP anylist RP",
162484
+ /* 400 */ "anylist ::= anylist ANY",
162485
+ /* 401 */ "with ::=",
162254162486
};
162255162487
#endif /* NDEBUG */
162256162488
162257162489
162258162490
#if YYSTACKDEPTH<=0
@@ -162374,103 +162606,103 @@
162374162606
** Note: during a reduce, the only symbols destroyed are those
162375162607
** which appear on the RHS of the rule, but which are *not* used
162376162608
** inside the C code.
162377162609
*/
162378162610
/********* Begin destructor definitions ***************************************/
162379
- case 203: /* select */
162380
- case 238: /* selectnowith */
162381
- case 239: /* oneselect */
162382
- case 251: /* values */
162383
-{
162384
-sqlite3SelectDelete(pParse->db, (yypminor->yy303));
162385
-}
162386
- break;
162387
- case 215: /* term */
162388
- case 216: /* expr */
162389
- case 245: /* where_opt */
162390
- case 247: /* having_opt */
162391
- case 259: /* on_opt */
162392
- case 266: /* where_opt_ret */
162393
- case 277: /* case_operand */
162394
- case 279: /* case_else */
162395
- case 282: /* vinto */
162396
- case 289: /* when_clause */
162397
- case 294: /* key_opt */
162398
- case 310: /* filter_clause */
162399
-{
162400
-sqlite3ExprDelete(pParse->db, (yypminor->yy626));
162401
-}
162402
- break;
162403
- case 220: /* eidlist_opt */
162404
- case 230: /* sortlist */
162405
- case 231: /* eidlist */
162406
- case 243: /* selcollist */
162407
- case 246: /* groupby_opt */
162408
- case 248: /* orderby_opt */
162409
- case 252: /* nexprlist */
162410
- case 253: /* sclp */
162411
- case 261: /* exprlist */
162412
- case 267: /* setlist */
162413
- case 276: /* paren_exprlist */
162414
- case 278: /* case_exprlist */
162415
- case 309: /* part_opt */
162416
-{
162417
-sqlite3ExprListDelete(pParse->db, (yypminor->yy562));
162418
-}
162419
- break;
162420
- case 237: /* fullname */
162421
- case 244: /* from */
162422
- case 255: /* seltablist */
162423
- case 256: /* stl_prefix */
162424
- case 262: /* xfullname */
162425
-{
162426
-sqlite3SrcListDelete(pParse->db, (yypminor->yy607));
162427
-}
162428
- break;
162429
- case 240: /* wqlist */
162430
-{
162431
-sqlite3WithDelete(pParse->db, (yypminor->yy43));
162432
-}
162433
- break;
162434
- case 250: /* window_clause */
162435
- case 305: /* windowdefn_list */
162436
-{
162437
-sqlite3WindowListDelete(pParse->db, (yypminor->yy375));
162438
-}
162439
- break;
162440
- case 260: /* using_opt */
162441
- case 263: /* idlist */
162442
- case 269: /* idlist_opt */
162443
-{
162444
-sqlite3IdListDelete(pParse->db, (yypminor->yy240));
162445
-}
162446
- break;
162447
- case 272: /* filter_over */
162448
- case 306: /* windowdefn */
162449
- case 307: /* window */
162450
- case 308: /* frame_opt */
162451
- case 311: /* over_clause */
162452
-{
162453
-sqlite3WindowDelete(pParse->db, (yypminor->yy375));
162454
-}
162455
- break;
162456
- case 285: /* trigger_cmd_list */
162457
- case 290: /* trigger_cmd */
162458
-{
162459
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy95));
162460
-}
162461
- break;
162462
- case 287: /* trigger_event */
162463
-{
162464
-sqlite3IdListDelete(pParse->db, (yypminor->yy570).b);
162465
-}
162466
- break;
162467
- case 313: /* frame_bound */
162468
- case 314: /* frame_bound_s */
162469
- case 315: /* frame_bound_e */
162470
-{
162471
-sqlite3ExprDelete(pParse->db, (yypminor->yy81).pExpr);
162611
+ case 204: /* select */
162612
+ case 239: /* selectnowith */
162613
+ case 240: /* oneselect */
162614
+ case 252: /* values */
162615
+{
162616
+sqlite3SelectDelete(pParse->db, (yypminor->yy47));
162617
+}
162618
+ break;
162619
+ case 216: /* term */
162620
+ case 217: /* expr */
162621
+ case 246: /* where_opt */
162622
+ case 248: /* having_opt */
162623
+ case 260: /* on_opt */
162624
+ case 267: /* where_opt_ret */
162625
+ case 278: /* case_operand */
162626
+ case 280: /* case_else */
162627
+ case 283: /* vinto */
162628
+ case 290: /* when_clause */
162629
+ case 295: /* key_opt */
162630
+ case 311: /* filter_clause */
162631
+{
162632
+sqlite3ExprDelete(pParse->db, (yypminor->yy528));
162633
+}
162634
+ break;
162635
+ case 221: /* eidlist_opt */
162636
+ case 231: /* sortlist */
162637
+ case 232: /* eidlist */
162638
+ case 244: /* selcollist */
162639
+ case 247: /* groupby_opt */
162640
+ case 249: /* orderby_opt */
162641
+ case 253: /* nexprlist */
162642
+ case 254: /* sclp */
162643
+ case 262: /* exprlist */
162644
+ case 268: /* setlist */
162645
+ case 277: /* paren_exprlist */
162646
+ case 279: /* case_exprlist */
162647
+ case 310: /* part_opt */
162648
+{
162649
+sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
162650
+}
162651
+ break;
162652
+ case 238: /* fullname */
162653
+ case 245: /* from */
162654
+ case 256: /* seltablist */
162655
+ case 257: /* stl_prefix */
162656
+ case 263: /* xfullname */
162657
+{
162658
+sqlite3SrcListDelete(pParse->db, (yypminor->yy131));
162659
+}
162660
+ break;
162661
+ case 241: /* wqlist */
162662
+{
162663
+sqlite3WithDelete(pParse->db, (yypminor->yy521));
162664
+}
162665
+ break;
162666
+ case 251: /* window_clause */
162667
+ case 306: /* windowdefn_list */
162668
+{
162669
+sqlite3WindowListDelete(pParse->db, (yypminor->yy41));
162670
+}
162671
+ break;
162672
+ case 261: /* using_opt */
162673
+ case 264: /* idlist */
162674
+ case 270: /* idlist_opt */
162675
+{
162676
+sqlite3IdListDelete(pParse->db, (yypminor->yy254));
162677
+}
162678
+ break;
162679
+ case 273: /* filter_over */
162680
+ case 307: /* windowdefn */
162681
+ case 308: /* window */
162682
+ case 309: /* frame_opt */
162683
+ case 312: /* over_clause */
162684
+{
162685
+sqlite3WindowDelete(pParse->db, (yypminor->yy41));
162686
+}
162687
+ break;
162688
+ case 286: /* trigger_cmd_list */
162689
+ case 291: /* trigger_cmd */
162690
+{
162691
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33));
162692
+}
162693
+ break;
162694
+ case 288: /* trigger_event */
162695
+{
162696
+sqlite3IdListDelete(pParse->db, (yypminor->yy180).b);
162697
+}
162698
+ break;
162699
+ case 314: /* frame_bound */
162700
+ case 315: /* frame_bound_s */
162701
+ case 316: /* frame_bound_e */
162702
+{
162703
+sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr);
162472162704
}
162473162705
break;
162474162706
/********* End destructor definitions *****************************************/
162475162707
default: break; /* If no destructor action specified: do nothing */
162476162708
}
@@ -162757,411 +162989,412 @@
162757162989
}
162758162990
162759162991
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
162760162992
** of that rule */
162761162993
static const YYCODETYPE yyRuleInfoLhs[] = {
162762
- 188, /* (0) explain ::= EXPLAIN */
162763
- 188, /* (1) explain ::= EXPLAIN QUERY PLAN */
162764
- 187, /* (2) cmdx ::= cmd */
162765
- 189, /* (3) cmd ::= BEGIN transtype trans_opt */
162766
- 190, /* (4) transtype ::= */
162767
- 190, /* (5) transtype ::= DEFERRED */
162768
- 190, /* (6) transtype ::= IMMEDIATE */
162769
- 190, /* (7) transtype ::= EXCLUSIVE */
162770
- 189, /* (8) cmd ::= COMMIT|END trans_opt */
162771
- 189, /* (9) cmd ::= ROLLBACK trans_opt */
162772
- 189, /* (10) cmd ::= SAVEPOINT nm */
162773
- 189, /* (11) cmd ::= RELEASE savepoint_opt nm */
162774
- 189, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
162775
- 194, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
162776
- 196, /* (14) createkw ::= CREATE */
162777
- 198, /* (15) ifnotexists ::= */
162778
- 198, /* (16) ifnotexists ::= IF NOT EXISTS */
162779
- 197, /* (17) temp ::= TEMP */
162780
- 197, /* (18) temp ::= */
162781
- 195, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
162782
- 195, /* (20) create_table_args ::= AS select */
162783
- 202, /* (21) table_option_set ::= */
162784
- 202, /* (22) table_option_set ::= table_option_set COMMA table_option */
162785
- 204, /* (23) table_option ::= WITHOUT nm */
162786
- 204, /* (24) table_option ::= nm */
162787
- 205, /* (25) columnname ::= nm typetoken */
162788
- 207, /* (26) typetoken ::= */
162789
- 207, /* (27) typetoken ::= typename LP signed RP */
162790
- 207, /* (28) typetoken ::= typename LP signed COMMA signed RP */
162791
- 208, /* (29) typename ::= typename ID|STRING */
162792
- 212, /* (30) scanpt ::= */
162793
- 213, /* (31) scantok ::= */
162794
- 214, /* (32) ccons ::= CONSTRAINT nm */
162795
- 214, /* (33) ccons ::= DEFAULT scantok term */
162796
- 214, /* (34) ccons ::= DEFAULT LP expr RP */
162797
- 214, /* (35) ccons ::= DEFAULT PLUS scantok term */
162798
- 214, /* (36) ccons ::= DEFAULT MINUS scantok term */
162799
- 214, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
162800
- 214, /* (38) ccons ::= NOT NULL onconf */
162801
- 214, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
162802
- 214, /* (40) ccons ::= UNIQUE onconf */
162803
- 214, /* (41) ccons ::= CHECK LP expr RP */
162804
- 214, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
162805
- 214, /* (43) ccons ::= defer_subclause */
162806
- 214, /* (44) ccons ::= COLLATE ID|STRING */
162807
- 223, /* (45) generated ::= LP expr RP */
162808
- 223, /* (46) generated ::= LP expr RP ID */
162809
- 219, /* (47) autoinc ::= */
162810
- 219, /* (48) autoinc ::= AUTOINCR */
162811
- 221, /* (49) refargs ::= */
162812
- 221, /* (50) refargs ::= refargs refarg */
162813
- 224, /* (51) refarg ::= MATCH nm */
162814
- 224, /* (52) refarg ::= ON INSERT refact */
162815
- 224, /* (53) refarg ::= ON DELETE refact */
162816
- 224, /* (54) refarg ::= ON UPDATE refact */
162817
- 225, /* (55) refact ::= SET NULL */
162818
- 225, /* (56) refact ::= SET DEFAULT */
162819
- 225, /* (57) refact ::= CASCADE */
162820
- 225, /* (58) refact ::= RESTRICT */
162821
- 225, /* (59) refact ::= NO ACTION */
162822
- 222, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
162823
- 222, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
162824
- 226, /* (62) init_deferred_pred_opt ::= */
162825
- 226, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
162826
- 226, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
162827
- 201, /* (65) conslist_opt ::= */
162828
- 228, /* (66) tconscomma ::= COMMA */
162829
- 229, /* (67) tcons ::= CONSTRAINT nm */
162830
- 229, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
162831
- 229, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
162832
- 229, /* (70) tcons ::= CHECK LP expr RP onconf */
162833
- 229, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
162834
- 232, /* (72) defer_subclause_opt ::= */
162835
- 217, /* (73) onconf ::= */
162836
- 217, /* (74) onconf ::= ON CONFLICT resolvetype */
162837
- 233, /* (75) orconf ::= */
162838
- 233, /* (76) orconf ::= OR resolvetype */
162839
- 234, /* (77) resolvetype ::= IGNORE */
162840
- 234, /* (78) resolvetype ::= REPLACE */
162841
- 189, /* (79) cmd ::= DROP TABLE ifexists fullname */
162842
- 236, /* (80) ifexists ::= IF EXISTS */
162843
- 236, /* (81) ifexists ::= */
162844
- 189, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
162845
- 189, /* (83) cmd ::= DROP VIEW ifexists fullname */
162846
- 189, /* (84) cmd ::= select */
162847
- 203, /* (85) select ::= WITH wqlist selectnowith */
162848
- 203, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
162849
- 203, /* (87) select ::= selectnowith */
162850
- 238, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
162851
- 241, /* (89) multiselect_op ::= UNION */
162852
- 241, /* (90) multiselect_op ::= UNION ALL */
162853
- 241, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
162854
- 239, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
162855
- 239, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
162856
- 251, /* (94) values ::= VALUES LP nexprlist RP */
162857
- 251, /* (95) values ::= values COMMA LP nexprlist RP */
162858
- 242, /* (96) distinct ::= DISTINCT */
162859
- 242, /* (97) distinct ::= ALL */
162860
- 242, /* (98) distinct ::= */
162861
- 253, /* (99) sclp ::= */
162862
- 243, /* (100) selcollist ::= sclp scanpt expr scanpt as */
162863
- 243, /* (101) selcollist ::= sclp scanpt STAR */
162864
- 243, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
162865
- 254, /* (103) as ::= AS nm */
162866
- 254, /* (104) as ::= */
162867
- 244, /* (105) from ::= */
162868
- 244, /* (106) from ::= FROM seltablist */
162869
- 256, /* (107) stl_prefix ::= seltablist joinop */
162870
- 256, /* (108) stl_prefix ::= */
162871
- 255, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
162872
- 255, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
162873
- 255, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
162874
- 255, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
162875
- 199, /* (113) dbnm ::= */
162876
- 199, /* (114) dbnm ::= DOT nm */
162877
- 237, /* (115) fullname ::= nm */
162878
- 237, /* (116) fullname ::= nm DOT nm */
162879
- 262, /* (117) xfullname ::= nm */
162880
- 262, /* (118) xfullname ::= nm DOT nm */
162881
- 262, /* (119) xfullname ::= nm DOT nm AS nm */
162882
- 262, /* (120) xfullname ::= nm AS nm */
162883
- 257, /* (121) joinop ::= COMMA|JOIN */
162884
- 257, /* (122) joinop ::= JOIN_KW JOIN */
162885
- 257, /* (123) joinop ::= JOIN_KW nm JOIN */
162886
- 257, /* (124) joinop ::= JOIN_KW nm nm JOIN */
162887
- 259, /* (125) on_opt ::= ON expr */
162888
- 259, /* (126) on_opt ::= */
162889
- 258, /* (127) indexed_opt ::= */
162890
- 258, /* (128) indexed_opt ::= INDEXED BY nm */
162891
- 258, /* (129) indexed_opt ::= NOT INDEXED */
162892
- 260, /* (130) using_opt ::= USING LP idlist RP */
162893
- 260, /* (131) using_opt ::= */
162894
- 248, /* (132) orderby_opt ::= */
162895
- 248, /* (133) orderby_opt ::= ORDER BY sortlist */
162896
- 230, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
162897
- 230, /* (135) sortlist ::= expr sortorder nulls */
162898
- 218, /* (136) sortorder ::= ASC */
162899
- 218, /* (137) sortorder ::= DESC */
162900
- 218, /* (138) sortorder ::= */
162901
- 264, /* (139) nulls ::= NULLS FIRST */
162902
- 264, /* (140) nulls ::= NULLS LAST */
162903
- 264, /* (141) nulls ::= */
162904
- 246, /* (142) groupby_opt ::= */
162905
- 246, /* (143) groupby_opt ::= GROUP BY nexprlist */
162906
- 247, /* (144) having_opt ::= */
162907
- 247, /* (145) having_opt ::= HAVING expr */
162908
- 249, /* (146) limit_opt ::= */
162909
- 249, /* (147) limit_opt ::= LIMIT expr */
162910
- 249, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
162911
- 249, /* (149) limit_opt ::= LIMIT expr COMMA expr */
162912
- 189, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
162913
- 245, /* (151) where_opt ::= */
162914
- 245, /* (152) where_opt ::= WHERE expr */
162915
- 266, /* (153) where_opt_ret ::= */
162916
- 266, /* (154) where_opt_ret ::= WHERE expr */
162917
- 266, /* (155) where_opt_ret ::= RETURNING selcollist */
162918
- 266, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
162919
- 189, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
162920
- 267, /* (158) setlist ::= setlist COMMA nm EQ expr */
162921
- 267, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
162922
- 267, /* (160) setlist ::= nm EQ expr */
162923
- 267, /* (161) setlist ::= LP idlist RP EQ expr */
162924
- 189, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
162925
- 189, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
162926
- 270, /* (164) upsert ::= */
162927
- 270, /* (165) upsert ::= RETURNING selcollist */
162928
- 270, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
162929
- 270, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
162930
- 270, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
162931
- 270, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
162932
- 271, /* (170) returning ::= RETURNING selcollist */
162933
- 268, /* (171) insert_cmd ::= INSERT orconf */
162934
- 268, /* (172) insert_cmd ::= REPLACE */
162935
- 269, /* (173) idlist_opt ::= */
162936
- 269, /* (174) idlist_opt ::= LP idlist RP */
162937
- 263, /* (175) idlist ::= idlist COMMA nm */
162938
- 263, /* (176) idlist ::= nm */
162939
- 216, /* (177) expr ::= LP expr RP */
162940
- 216, /* (178) expr ::= ID|INDEXED */
162941
- 216, /* (179) expr ::= JOIN_KW */
162942
- 216, /* (180) expr ::= nm DOT nm */
162943
- 216, /* (181) expr ::= nm DOT nm DOT nm */
162944
- 215, /* (182) term ::= NULL|FLOAT|BLOB */
162945
- 215, /* (183) term ::= STRING */
162946
- 215, /* (184) term ::= INTEGER */
162947
- 216, /* (185) expr ::= VARIABLE */
162948
- 216, /* (186) expr ::= expr COLLATE ID|STRING */
162949
- 216, /* (187) expr ::= CAST LP expr AS typetoken RP */
162950
- 216, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
162951
- 216, /* (189) expr ::= ID|INDEXED LP STAR RP */
162952
- 216, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
162953
- 216, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
162954
- 215, /* (192) term ::= CTIME_KW */
162955
- 216, /* (193) expr ::= LP nexprlist COMMA expr RP */
162956
- 216, /* (194) expr ::= expr AND expr */
162957
- 216, /* (195) expr ::= expr OR expr */
162958
- 216, /* (196) expr ::= expr LT|GT|GE|LE expr */
162959
- 216, /* (197) expr ::= expr EQ|NE expr */
162960
- 216, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
162961
- 216, /* (199) expr ::= expr PLUS|MINUS expr */
162962
- 216, /* (200) expr ::= expr STAR|SLASH|REM expr */
162963
- 216, /* (201) expr ::= expr CONCAT expr */
162964
- 273, /* (202) likeop ::= NOT LIKE_KW|MATCH */
162965
- 216, /* (203) expr ::= expr likeop expr */
162966
- 216, /* (204) expr ::= expr likeop expr ESCAPE expr */
162967
- 216, /* (205) expr ::= expr ISNULL|NOTNULL */
162968
- 216, /* (206) expr ::= expr NOT NULL */
162969
- 216, /* (207) expr ::= expr IS expr */
162970
- 216, /* (208) expr ::= expr IS NOT expr */
162971
- 216, /* (209) expr ::= NOT expr */
162972
- 216, /* (210) expr ::= BITNOT expr */
162973
- 216, /* (211) expr ::= PLUS|MINUS expr */
162974
- 274, /* (212) between_op ::= BETWEEN */
162975
- 274, /* (213) between_op ::= NOT BETWEEN */
162976
- 216, /* (214) expr ::= expr between_op expr AND expr */
162977
- 275, /* (215) in_op ::= IN */
162978
- 275, /* (216) in_op ::= NOT IN */
162979
- 216, /* (217) expr ::= expr in_op LP exprlist RP */
162980
- 216, /* (218) expr ::= LP select RP */
162981
- 216, /* (219) expr ::= expr in_op LP select RP */
162982
- 216, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */
162983
- 216, /* (221) expr ::= EXISTS LP select RP */
162984
- 216, /* (222) expr ::= CASE case_operand case_exprlist case_else END */
162985
- 278, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */
162986
- 278, /* (224) case_exprlist ::= WHEN expr THEN expr */
162987
- 279, /* (225) case_else ::= ELSE expr */
162988
- 279, /* (226) case_else ::= */
162989
- 277, /* (227) case_operand ::= expr */
162990
- 277, /* (228) case_operand ::= */
162991
- 261, /* (229) exprlist ::= */
162992
- 252, /* (230) nexprlist ::= nexprlist COMMA expr */
162993
- 252, /* (231) nexprlist ::= expr */
162994
- 276, /* (232) paren_exprlist ::= */
162995
- 276, /* (233) paren_exprlist ::= LP exprlist RP */
162996
- 189, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
162997
- 280, /* (235) uniqueflag ::= UNIQUE */
162998
- 280, /* (236) uniqueflag ::= */
162999
- 220, /* (237) eidlist_opt ::= */
163000
- 220, /* (238) eidlist_opt ::= LP eidlist RP */
163001
- 231, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */
163002
- 231, /* (240) eidlist ::= nm collate sortorder */
163003
- 281, /* (241) collate ::= */
163004
- 281, /* (242) collate ::= COLLATE ID|STRING */
163005
- 189, /* (243) cmd ::= DROP INDEX ifexists fullname */
163006
- 189, /* (244) cmd ::= VACUUM vinto */
163007
- 189, /* (245) cmd ::= VACUUM nm vinto */
163008
- 282, /* (246) vinto ::= INTO expr */
163009
- 282, /* (247) vinto ::= */
163010
- 189, /* (248) cmd ::= PRAGMA nm dbnm */
163011
- 189, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */
163012
- 189, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163013
- 189, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */
163014
- 189, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163015
- 210, /* (253) plus_num ::= PLUS INTEGER|FLOAT */
163016
- 211, /* (254) minus_num ::= MINUS INTEGER|FLOAT */
163017
- 189, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163018
- 284, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163019
- 286, /* (257) trigger_time ::= BEFORE|AFTER */
163020
- 286, /* (258) trigger_time ::= INSTEAD OF */
163021
- 286, /* (259) trigger_time ::= */
163022
- 287, /* (260) trigger_event ::= DELETE|INSERT */
163023
- 287, /* (261) trigger_event ::= UPDATE */
163024
- 287, /* (262) trigger_event ::= UPDATE OF idlist */
163025
- 289, /* (263) when_clause ::= */
163026
- 289, /* (264) when_clause ::= WHEN expr */
163027
- 285, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163028
- 285, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */
163029
- 291, /* (267) trnm ::= nm DOT nm */
163030
- 292, /* (268) tridxby ::= INDEXED BY nm */
163031
- 292, /* (269) tridxby ::= NOT INDEXED */
163032
- 290, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163033
- 290, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163034
- 290, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163035
- 290, /* (273) trigger_cmd ::= scanpt select scanpt */
163036
- 216, /* (274) expr ::= RAISE LP IGNORE RP */
163037
- 216, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */
163038
- 235, /* (276) raisetype ::= ROLLBACK */
163039
- 235, /* (277) raisetype ::= ABORT */
163040
- 235, /* (278) raisetype ::= FAIL */
163041
- 189, /* (279) cmd ::= DROP TRIGGER ifexists fullname */
163042
- 189, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163043
- 189, /* (281) cmd ::= DETACH database_kw_opt expr */
163044
- 294, /* (282) key_opt ::= */
163045
- 294, /* (283) key_opt ::= KEY expr */
163046
- 189, /* (284) cmd ::= REINDEX */
163047
- 189, /* (285) cmd ::= REINDEX nm dbnm */
163048
- 189, /* (286) cmd ::= ANALYZE */
163049
- 189, /* (287) cmd ::= ANALYZE nm dbnm */
163050
- 189, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */
163051
- 189, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163052
- 189, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163053
- 295, /* (291) add_column_fullname ::= fullname */
163054
- 189, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163055
- 189, /* (293) cmd ::= create_vtab */
163056
- 189, /* (294) cmd ::= create_vtab LP vtabarglist RP */
163057
- 297, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163058
- 299, /* (296) vtabarg ::= */
163059
- 300, /* (297) vtabargtoken ::= ANY */
163060
- 300, /* (298) vtabargtoken ::= lp anylist RP */
163061
- 301, /* (299) lp ::= LP */
163062
- 265, /* (300) with ::= WITH wqlist */
163063
- 265, /* (301) with ::= WITH RECURSIVE wqlist */
163064
- 304, /* (302) wqas ::= AS */
163065
- 304, /* (303) wqas ::= AS MATERIALIZED */
163066
- 304, /* (304) wqas ::= AS NOT MATERIALIZED */
163067
- 303, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */
163068
- 240, /* (306) wqlist ::= wqitem */
163069
- 240, /* (307) wqlist ::= wqlist COMMA wqitem */
163070
- 305, /* (308) windowdefn_list ::= windowdefn */
163071
- 305, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163072
- 306, /* (310) windowdefn ::= nm AS LP window RP */
163073
- 307, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163074
- 307, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163075
- 307, /* (313) window ::= ORDER BY sortlist frame_opt */
163076
- 307, /* (314) window ::= nm ORDER BY sortlist frame_opt */
163077
- 307, /* (315) window ::= frame_opt */
163078
- 307, /* (316) window ::= nm frame_opt */
163079
- 308, /* (317) frame_opt ::= */
163080
- 308, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163081
- 308, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163082
- 312, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */
163083
- 314, /* (321) frame_bound_s ::= frame_bound */
163084
- 314, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */
163085
- 315, /* (323) frame_bound_e ::= frame_bound */
163086
- 315, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */
163087
- 313, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */
163088
- 313, /* (326) frame_bound ::= CURRENT ROW */
163089
- 316, /* (327) frame_exclude_opt ::= */
163090
- 316, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */
163091
- 317, /* (329) frame_exclude ::= NO OTHERS */
163092
- 317, /* (330) frame_exclude ::= CURRENT ROW */
163093
- 317, /* (331) frame_exclude ::= GROUP|TIES */
163094
- 250, /* (332) window_clause ::= WINDOW windowdefn_list */
163095
- 272, /* (333) filter_over ::= filter_clause over_clause */
163096
- 272, /* (334) filter_over ::= over_clause */
163097
- 272, /* (335) filter_over ::= filter_clause */
163098
- 311, /* (336) over_clause ::= OVER LP window RP */
163099
- 311, /* (337) over_clause ::= OVER nm */
163100
- 310, /* (338) filter_clause ::= FILTER LP WHERE expr RP */
163101
- 184, /* (339) input ::= cmdlist */
163102
- 185, /* (340) cmdlist ::= cmdlist ecmd */
163103
- 185, /* (341) cmdlist ::= ecmd */
163104
- 186, /* (342) ecmd ::= SEMI */
163105
- 186, /* (343) ecmd ::= cmdx SEMI */
163106
- 186, /* (344) ecmd ::= explain cmdx SEMI */
163107
- 191, /* (345) trans_opt ::= */
163108
- 191, /* (346) trans_opt ::= TRANSACTION */
163109
- 191, /* (347) trans_opt ::= TRANSACTION nm */
163110
- 193, /* (348) savepoint_opt ::= SAVEPOINT */
163111
- 193, /* (349) savepoint_opt ::= */
163112
- 189, /* (350) cmd ::= create_table create_table_args */
163113
- 202, /* (351) table_option_set ::= table_option */
163114
- 200, /* (352) columnlist ::= columnlist COMMA columnname carglist */
163115
- 200, /* (353) columnlist ::= columnname carglist */
163116
- 192, /* (354) nm ::= ID|INDEXED */
163117
- 192, /* (355) nm ::= STRING */
163118
- 192, /* (356) nm ::= JOIN_KW */
163119
- 207, /* (357) typetoken ::= typename */
163120
- 208, /* (358) typename ::= ID|STRING */
163121
- 209, /* (359) signed ::= plus_num */
163122
- 209, /* (360) signed ::= minus_num */
163123
- 206, /* (361) carglist ::= carglist ccons */
163124
- 206, /* (362) carglist ::= */
163125
- 214, /* (363) ccons ::= NULL onconf */
163126
- 214, /* (364) ccons ::= GENERATED ALWAYS AS generated */
163127
- 214, /* (365) ccons ::= AS generated */
163128
- 201, /* (366) conslist_opt ::= COMMA conslist */
163129
- 227, /* (367) conslist ::= conslist tconscomma tcons */
163130
- 227, /* (368) conslist ::= tcons */
163131
- 228, /* (369) tconscomma ::= */
163132
- 232, /* (370) defer_subclause_opt ::= defer_subclause */
163133
- 234, /* (371) resolvetype ::= raisetype */
163134
- 238, /* (372) selectnowith ::= oneselect */
163135
- 239, /* (373) oneselect ::= values */
163136
- 253, /* (374) sclp ::= selcollist COMMA */
163137
- 254, /* (375) as ::= ID|STRING */
163138
- 271, /* (376) returning ::= */
163139
- 216, /* (377) expr ::= term */
163140
- 273, /* (378) likeop ::= LIKE_KW|MATCH */
163141
- 261, /* (379) exprlist ::= nexprlist */
163142
- 283, /* (380) nmnum ::= plus_num */
163143
- 283, /* (381) nmnum ::= nm */
163144
- 283, /* (382) nmnum ::= ON */
163145
- 283, /* (383) nmnum ::= DELETE */
163146
- 283, /* (384) nmnum ::= DEFAULT */
163147
- 210, /* (385) plus_num ::= INTEGER|FLOAT */
163148
- 288, /* (386) foreach_clause ::= */
163149
- 288, /* (387) foreach_clause ::= FOR EACH ROW */
163150
- 291, /* (388) trnm ::= nm */
163151
- 292, /* (389) tridxby ::= */
163152
- 293, /* (390) database_kw_opt ::= DATABASE */
163153
- 293, /* (391) database_kw_opt ::= */
163154
- 296, /* (392) kwcolumn_opt ::= */
163155
- 296, /* (393) kwcolumn_opt ::= COLUMNKW */
163156
- 298, /* (394) vtabarglist ::= vtabarg */
163157
- 298, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */
163158
- 299, /* (396) vtabarg ::= vtabarg vtabargtoken */
163159
- 302, /* (397) anylist ::= */
163160
- 302, /* (398) anylist ::= anylist LP anylist RP */
163161
- 302, /* (399) anylist ::= anylist ANY */
163162
- 265, /* (400) with ::= */
162994
+ 189, /* (0) explain ::= EXPLAIN */
162995
+ 189, /* (1) explain ::= EXPLAIN QUERY PLAN */
162996
+ 188, /* (2) cmdx ::= cmd */
162997
+ 190, /* (3) cmd ::= BEGIN transtype trans_opt */
162998
+ 191, /* (4) transtype ::= */
162999
+ 191, /* (5) transtype ::= DEFERRED */
163000
+ 191, /* (6) transtype ::= IMMEDIATE */
163001
+ 191, /* (7) transtype ::= EXCLUSIVE */
163002
+ 190, /* (8) cmd ::= COMMIT|END trans_opt */
163003
+ 190, /* (9) cmd ::= ROLLBACK trans_opt */
163004
+ 190, /* (10) cmd ::= SAVEPOINT nm */
163005
+ 190, /* (11) cmd ::= RELEASE savepoint_opt nm */
163006
+ 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
163007
+ 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
163008
+ 197, /* (14) createkw ::= CREATE */
163009
+ 199, /* (15) ifnotexists ::= */
163010
+ 199, /* (16) ifnotexists ::= IF NOT EXISTS */
163011
+ 198, /* (17) temp ::= TEMP */
163012
+ 198, /* (18) temp ::= */
163013
+ 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
163014
+ 196, /* (20) create_table_args ::= AS select */
163015
+ 203, /* (21) table_option_set ::= */
163016
+ 203, /* (22) table_option_set ::= table_option_set COMMA table_option */
163017
+ 205, /* (23) table_option ::= WITHOUT nm */
163018
+ 205, /* (24) table_option ::= nm */
163019
+ 206, /* (25) columnname ::= nm typetoken */
163020
+ 208, /* (26) typetoken ::= */
163021
+ 208, /* (27) typetoken ::= typename LP signed RP */
163022
+ 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */
163023
+ 209, /* (29) typename ::= typename ID|STRING */
163024
+ 213, /* (30) scanpt ::= */
163025
+ 214, /* (31) scantok ::= */
163026
+ 215, /* (32) ccons ::= CONSTRAINT nm */
163027
+ 215, /* (33) ccons ::= DEFAULT scantok term */
163028
+ 215, /* (34) ccons ::= DEFAULT LP expr RP */
163029
+ 215, /* (35) ccons ::= DEFAULT PLUS scantok term */
163030
+ 215, /* (36) ccons ::= DEFAULT MINUS scantok term */
163031
+ 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
163032
+ 215, /* (38) ccons ::= NOT NULL onconf */
163033
+ 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
163034
+ 215, /* (40) ccons ::= UNIQUE onconf */
163035
+ 215, /* (41) ccons ::= CHECK LP expr RP */
163036
+ 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
163037
+ 215, /* (43) ccons ::= defer_subclause */
163038
+ 215, /* (44) ccons ::= COLLATE ID|STRING */
163039
+ 224, /* (45) generated ::= LP expr RP */
163040
+ 224, /* (46) generated ::= LP expr RP ID */
163041
+ 220, /* (47) autoinc ::= */
163042
+ 220, /* (48) autoinc ::= AUTOINCR */
163043
+ 222, /* (49) refargs ::= */
163044
+ 222, /* (50) refargs ::= refargs refarg */
163045
+ 225, /* (51) refarg ::= MATCH nm */
163046
+ 225, /* (52) refarg ::= ON INSERT refact */
163047
+ 225, /* (53) refarg ::= ON DELETE refact */
163048
+ 225, /* (54) refarg ::= ON UPDATE refact */
163049
+ 226, /* (55) refact ::= SET NULL */
163050
+ 226, /* (56) refact ::= SET DEFAULT */
163051
+ 226, /* (57) refact ::= CASCADE */
163052
+ 226, /* (58) refact ::= RESTRICT */
163053
+ 226, /* (59) refact ::= NO ACTION */
163054
+ 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
163055
+ 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
163056
+ 227, /* (62) init_deferred_pred_opt ::= */
163057
+ 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
163058
+ 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
163059
+ 202, /* (65) conslist_opt ::= */
163060
+ 229, /* (66) tconscomma ::= COMMA */
163061
+ 230, /* (67) tcons ::= CONSTRAINT nm */
163062
+ 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
163063
+ 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
163064
+ 230, /* (70) tcons ::= CHECK LP expr RP onconf */
163065
+ 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
163066
+ 233, /* (72) defer_subclause_opt ::= */
163067
+ 218, /* (73) onconf ::= */
163068
+ 218, /* (74) onconf ::= ON CONFLICT resolvetype */
163069
+ 234, /* (75) orconf ::= */
163070
+ 234, /* (76) orconf ::= OR resolvetype */
163071
+ 235, /* (77) resolvetype ::= IGNORE */
163072
+ 235, /* (78) resolvetype ::= REPLACE */
163073
+ 190, /* (79) cmd ::= DROP TABLE ifexists fullname */
163074
+ 237, /* (80) ifexists ::= IF EXISTS */
163075
+ 237, /* (81) ifexists ::= */
163076
+ 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
163077
+ 190, /* (83) cmd ::= DROP VIEW ifexists fullname */
163078
+ 190, /* (84) cmd ::= select */
163079
+ 204, /* (85) select ::= WITH wqlist selectnowith */
163080
+ 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
163081
+ 204, /* (87) select ::= selectnowith */
163082
+ 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
163083
+ 242, /* (89) multiselect_op ::= UNION */
163084
+ 242, /* (90) multiselect_op ::= UNION ALL */
163085
+ 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
163086
+ 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
163087
+ 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
163088
+ 252, /* (94) values ::= VALUES LP nexprlist RP */
163089
+ 252, /* (95) values ::= values COMMA LP nexprlist RP */
163090
+ 243, /* (96) distinct ::= DISTINCT */
163091
+ 243, /* (97) distinct ::= ALL */
163092
+ 243, /* (98) distinct ::= */
163093
+ 254, /* (99) sclp ::= */
163094
+ 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */
163095
+ 244, /* (101) selcollist ::= sclp scanpt STAR */
163096
+ 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
163097
+ 255, /* (103) as ::= AS nm */
163098
+ 255, /* (104) as ::= */
163099
+ 245, /* (105) from ::= */
163100
+ 245, /* (106) from ::= FROM seltablist */
163101
+ 257, /* (107) stl_prefix ::= seltablist joinop */
163102
+ 257, /* (108) stl_prefix ::= */
163103
+ 256, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
163104
+ 256, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
163105
+ 256, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
163106
+ 256, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
163107
+ 200, /* (113) dbnm ::= */
163108
+ 200, /* (114) dbnm ::= DOT nm */
163109
+ 238, /* (115) fullname ::= nm */
163110
+ 238, /* (116) fullname ::= nm DOT nm */
163111
+ 263, /* (117) xfullname ::= nm */
163112
+ 263, /* (118) xfullname ::= nm DOT nm */
163113
+ 263, /* (119) xfullname ::= nm DOT nm AS nm */
163114
+ 263, /* (120) xfullname ::= nm AS nm */
163115
+ 258, /* (121) joinop ::= COMMA|JOIN */
163116
+ 258, /* (122) joinop ::= JOIN_KW JOIN */
163117
+ 258, /* (123) joinop ::= JOIN_KW nm JOIN */
163118
+ 258, /* (124) joinop ::= JOIN_KW nm nm JOIN */
163119
+ 260, /* (125) on_opt ::= ON expr */
163120
+ 260, /* (126) on_opt ::= */
163121
+ 259, /* (127) indexed_opt ::= */
163122
+ 259, /* (128) indexed_opt ::= INDEXED BY nm */
163123
+ 259, /* (129) indexed_opt ::= NOT INDEXED */
163124
+ 261, /* (130) using_opt ::= USING LP idlist RP */
163125
+ 261, /* (131) using_opt ::= */
163126
+ 249, /* (132) orderby_opt ::= */
163127
+ 249, /* (133) orderby_opt ::= ORDER BY sortlist */
163128
+ 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
163129
+ 231, /* (135) sortlist ::= expr sortorder nulls */
163130
+ 219, /* (136) sortorder ::= ASC */
163131
+ 219, /* (137) sortorder ::= DESC */
163132
+ 219, /* (138) sortorder ::= */
163133
+ 265, /* (139) nulls ::= NULLS FIRST */
163134
+ 265, /* (140) nulls ::= NULLS LAST */
163135
+ 265, /* (141) nulls ::= */
163136
+ 247, /* (142) groupby_opt ::= */
163137
+ 247, /* (143) groupby_opt ::= GROUP BY nexprlist */
163138
+ 248, /* (144) having_opt ::= */
163139
+ 248, /* (145) having_opt ::= HAVING expr */
163140
+ 250, /* (146) limit_opt ::= */
163141
+ 250, /* (147) limit_opt ::= LIMIT expr */
163142
+ 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
163143
+ 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */
163144
+ 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
163145
+ 246, /* (151) where_opt ::= */
163146
+ 246, /* (152) where_opt ::= WHERE expr */
163147
+ 267, /* (153) where_opt_ret ::= */
163148
+ 267, /* (154) where_opt_ret ::= WHERE expr */
163149
+ 267, /* (155) where_opt_ret ::= RETURNING selcollist */
163150
+ 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
163151
+ 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
163152
+ 268, /* (158) setlist ::= setlist COMMA nm EQ expr */
163153
+ 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
163154
+ 268, /* (160) setlist ::= nm EQ expr */
163155
+ 268, /* (161) setlist ::= LP idlist RP EQ expr */
163156
+ 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
163157
+ 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
163158
+ 271, /* (164) upsert ::= */
163159
+ 271, /* (165) upsert ::= RETURNING selcollist */
163160
+ 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
163161
+ 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
163162
+ 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
163163
+ 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
163164
+ 272, /* (170) returning ::= RETURNING selcollist */
163165
+ 269, /* (171) insert_cmd ::= INSERT orconf */
163166
+ 269, /* (172) insert_cmd ::= REPLACE */
163167
+ 270, /* (173) idlist_opt ::= */
163168
+ 270, /* (174) idlist_opt ::= LP idlist RP */
163169
+ 264, /* (175) idlist ::= idlist COMMA nm */
163170
+ 264, /* (176) idlist ::= nm */
163171
+ 217, /* (177) expr ::= LP expr RP */
163172
+ 217, /* (178) expr ::= ID|INDEXED */
163173
+ 217, /* (179) expr ::= JOIN_KW */
163174
+ 217, /* (180) expr ::= nm DOT nm */
163175
+ 217, /* (181) expr ::= nm DOT nm DOT nm */
163176
+ 216, /* (182) term ::= NULL|FLOAT|BLOB */
163177
+ 216, /* (183) term ::= STRING */
163178
+ 216, /* (184) term ::= INTEGER */
163179
+ 217, /* (185) expr ::= VARIABLE */
163180
+ 217, /* (186) expr ::= expr COLLATE ID|STRING */
163181
+ 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
163182
+ 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
163183
+ 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
163184
+ 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
163185
+ 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
163186
+ 216, /* (192) term ::= CTIME_KW */
163187
+ 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
163188
+ 217, /* (194) expr ::= expr AND expr */
163189
+ 217, /* (195) expr ::= expr OR expr */
163190
+ 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
163191
+ 217, /* (197) expr ::= expr EQ|NE expr */
163192
+ 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
163193
+ 217, /* (199) expr ::= expr PLUS|MINUS expr */
163194
+ 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
163195
+ 217, /* (201) expr ::= expr CONCAT expr */
163196
+ 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
163197
+ 217, /* (203) expr ::= expr likeop expr */
163198
+ 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
163199
+ 217, /* (205) expr ::= expr ISNULL|NOTNULL */
163200
+ 217, /* (206) expr ::= expr NOT NULL */
163201
+ 217, /* (207) expr ::= expr IS expr */
163202
+ 217, /* (208) expr ::= expr IS NOT expr */
163203
+ 217, /* (209) expr ::= NOT expr */
163204
+ 217, /* (210) expr ::= BITNOT expr */
163205
+ 217, /* (211) expr ::= PLUS|MINUS expr */
163206
+ 217, /* (212) expr ::= expr PTR expr */
163207
+ 275, /* (213) between_op ::= BETWEEN */
163208
+ 275, /* (214) between_op ::= NOT BETWEEN */
163209
+ 217, /* (215) expr ::= expr between_op expr AND expr */
163210
+ 276, /* (216) in_op ::= IN */
163211
+ 276, /* (217) in_op ::= NOT IN */
163212
+ 217, /* (218) expr ::= expr in_op LP exprlist RP */
163213
+ 217, /* (219) expr ::= LP select RP */
163214
+ 217, /* (220) expr ::= expr in_op LP select RP */
163215
+ 217, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */
163216
+ 217, /* (222) expr ::= EXISTS LP select RP */
163217
+ 217, /* (223) expr ::= CASE case_operand case_exprlist case_else END */
163218
+ 279, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163219
+ 279, /* (225) case_exprlist ::= WHEN expr THEN expr */
163220
+ 280, /* (226) case_else ::= ELSE expr */
163221
+ 280, /* (227) case_else ::= */
163222
+ 278, /* (228) case_operand ::= expr */
163223
+ 278, /* (229) case_operand ::= */
163224
+ 262, /* (230) exprlist ::= */
163225
+ 253, /* (231) nexprlist ::= nexprlist COMMA expr */
163226
+ 253, /* (232) nexprlist ::= expr */
163227
+ 277, /* (233) paren_exprlist ::= */
163228
+ 277, /* (234) paren_exprlist ::= LP exprlist RP */
163229
+ 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163230
+ 281, /* (236) uniqueflag ::= UNIQUE */
163231
+ 281, /* (237) uniqueflag ::= */
163232
+ 221, /* (238) eidlist_opt ::= */
163233
+ 221, /* (239) eidlist_opt ::= LP eidlist RP */
163234
+ 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */
163235
+ 232, /* (241) eidlist ::= nm collate sortorder */
163236
+ 282, /* (242) collate ::= */
163237
+ 282, /* (243) collate ::= COLLATE ID|STRING */
163238
+ 190, /* (244) cmd ::= DROP INDEX ifexists fullname */
163239
+ 190, /* (245) cmd ::= VACUUM vinto */
163240
+ 190, /* (246) cmd ::= VACUUM nm vinto */
163241
+ 283, /* (247) vinto ::= INTO expr */
163242
+ 283, /* (248) vinto ::= */
163243
+ 190, /* (249) cmd ::= PRAGMA nm dbnm */
163244
+ 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */
163245
+ 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163246
+ 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */
163247
+ 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163248
+ 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */
163249
+ 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */
163250
+ 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163251
+ 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163252
+ 287, /* (258) trigger_time ::= BEFORE|AFTER */
163253
+ 287, /* (259) trigger_time ::= INSTEAD OF */
163254
+ 287, /* (260) trigger_time ::= */
163255
+ 288, /* (261) trigger_event ::= DELETE|INSERT */
163256
+ 288, /* (262) trigger_event ::= UPDATE */
163257
+ 288, /* (263) trigger_event ::= UPDATE OF idlist */
163258
+ 290, /* (264) when_clause ::= */
163259
+ 290, /* (265) when_clause ::= WHEN expr */
163260
+ 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163261
+ 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */
163262
+ 292, /* (268) trnm ::= nm DOT nm */
163263
+ 293, /* (269) tridxby ::= INDEXED BY nm */
163264
+ 293, /* (270) tridxby ::= NOT INDEXED */
163265
+ 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163266
+ 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163267
+ 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163268
+ 291, /* (274) trigger_cmd ::= scanpt select scanpt */
163269
+ 217, /* (275) expr ::= RAISE LP IGNORE RP */
163270
+ 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */
163271
+ 236, /* (277) raisetype ::= ROLLBACK */
163272
+ 236, /* (278) raisetype ::= ABORT */
163273
+ 236, /* (279) raisetype ::= FAIL */
163274
+ 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */
163275
+ 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163276
+ 190, /* (282) cmd ::= DETACH database_kw_opt expr */
163277
+ 295, /* (283) key_opt ::= */
163278
+ 295, /* (284) key_opt ::= KEY expr */
163279
+ 190, /* (285) cmd ::= REINDEX */
163280
+ 190, /* (286) cmd ::= REINDEX nm dbnm */
163281
+ 190, /* (287) cmd ::= ANALYZE */
163282
+ 190, /* (288) cmd ::= ANALYZE nm dbnm */
163283
+ 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */
163284
+ 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163285
+ 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163286
+ 296, /* (292) add_column_fullname ::= fullname */
163287
+ 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163288
+ 190, /* (294) cmd ::= create_vtab */
163289
+ 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */
163290
+ 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163291
+ 300, /* (297) vtabarg ::= */
163292
+ 301, /* (298) vtabargtoken ::= ANY */
163293
+ 301, /* (299) vtabargtoken ::= lp anylist RP */
163294
+ 302, /* (300) lp ::= LP */
163295
+ 266, /* (301) with ::= WITH wqlist */
163296
+ 266, /* (302) with ::= WITH RECURSIVE wqlist */
163297
+ 305, /* (303) wqas ::= AS */
163298
+ 305, /* (304) wqas ::= AS MATERIALIZED */
163299
+ 305, /* (305) wqas ::= AS NOT MATERIALIZED */
163300
+ 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */
163301
+ 241, /* (307) wqlist ::= wqitem */
163302
+ 241, /* (308) wqlist ::= wqlist COMMA wqitem */
163303
+ 306, /* (309) windowdefn_list ::= windowdefn */
163304
+ 306, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163305
+ 307, /* (311) windowdefn ::= nm AS LP window RP */
163306
+ 308, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163307
+ 308, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163308
+ 308, /* (314) window ::= ORDER BY sortlist frame_opt */
163309
+ 308, /* (315) window ::= nm ORDER BY sortlist frame_opt */
163310
+ 308, /* (316) window ::= frame_opt */
163311
+ 308, /* (317) window ::= nm frame_opt */
163312
+ 309, /* (318) frame_opt ::= */
163313
+ 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163314
+ 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163315
+ 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
163316
+ 315, /* (322) frame_bound_s ::= frame_bound */
163317
+ 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
163318
+ 316, /* (324) frame_bound_e ::= frame_bound */
163319
+ 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
163320
+ 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
163321
+ 314, /* (327) frame_bound ::= CURRENT ROW */
163322
+ 317, /* (328) frame_exclude_opt ::= */
163323
+ 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
163324
+ 318, /* (330) frame_exclude ::= NO OTHERS */
163325
+ 318, /* (331) frame_exclude ::= CURRENT ROW */
163326
+ 318, /* (332) frame_exclude ::= GROUP|TIES */
163327
+ 251, /* (333) window_clause ::= WINDOW windowdefn_list */
163328
+ 273, /* (334) filter_over ::= filter_clause over_clause */
163329
+ 273, /* (335) filter_over ::= over_clause */
163330
+ 273, /* (336) filter_over ::= filter_clause */
163331
+ 312, /* (337) over_clause ::= OVER LP window RP */
163332
+ 312, /* (338) over_clause ::= OVER nm */
163333
+ 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
163334
+ 185, /* (340) input ::= cmdlist */
163335
+ 186, /* (341) cmdlist ::= cmdlist ecmd */
163336
+ 186, /* (342) cmdlist ::= ecmd */
163337
+ 187, /* (343) ecmd ::= SEMI */
163338
+ 187, /* (344) ecmd ::= cmdx SEMI */
163339
+ 187, /* (345) ecmd ::= explain cmdx SEMI */
163340
+ 192, /* (346) trans_opt ::= */
163341
+ 192, /* (347) trans_opt ::= TRANSACTION */
163342
+ 192, /* (348) trans_opt ::= TRANSACTION nm */
163343
+ 194, /* (349) savepoint_opt ::= SAVEPOINT */
163344
+ 194, /* (350) savepoint_opt ::= */
163345
+ 190, /* (351) cmd ::= create_table create_table_args */
163346
+ 203, /* (352) table_option_set ::= table_option */
163347
+ 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */
163348
+ 201, /* (354) columnlist ::= columnname carglist */
163349
+ 193, /* (355) nm ::= ID|INDEXED */
163350
+ 193, /* (356) nm ::= STRING */
163351
+ 193, /* (357) nm ::= JOIN_KW */
163352
+ 208, /* (358) typetoken ::= typename */
163353
+ 209, /* (359) typename ::= ID|STRING */
163354
+ 210, /* (360) signed ::= plus_num */
163355
+ 210, /* (361) signed ::= minus_num */
163356
+ 207, /* (362) carglist ::= carglist ccons */
163357
+ 207, /* (363) carglist ::= */
163358
+ 215, /* (364) ccons ::= NULL onconf */
163359
+ 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
163360
+ 215, /* (366) ccons ::= AS generated */
163361
+ 202, /* (367) conslist_opt ::= COMMA conslist */
163362
+ 228, /* (368) conslist ::= conslist tconscomma tcons */
163363
+ 228, /* (369) conslist ::= tcons */
163364
+ 229, /* (370) tconscomma ::= */
163365
+ 233, /* (371) defer_subclause_opt ::= defer_subclause */
163366
+ 235, /* (372) resolvetype ::= raisetype */
163367
+ 239, /* (373) selectnowith ::= oneselect */
163368
+ 240, /* (374) oneselect ::= values */
163369
+ 254, /* (375) sclp ::= selcollist COMMA */
163370
+ 255, /* (376) as ::= ID|STRING */
163371
+ 272, /* (377) returning ::= */
163372
+ 217, /* (378) expr ::= term */
163373
+ 274, /* (379) likeop ::= LIKE_KW|MATCH */
163374
+ 262, /* (380) exprlist ::= nexprlist */
163375
+ 284, /* (381) nmnum ::= plus_num */
163376
+ 284, /* (382) nmnum ::= nm */
163377
+ 284, /* (383) nmnum ::= ON */
163378
+ 284, /* (384) nmnum ::= DELETE */
163379
+ 284, /* (385) nmnum ::= DEFAULT */
163380
+ 211, /* (386) plus_num ::= INTEGER|FLOAT */
163381
+ 289, /* (387) foreach_clause ::= */
163382
+ 289, /* (388) foreach_clause ::= FOR EACH ROW */
163383
+ 292, /* (389) trnm ::= nm */
163384
+ 293, /* (390) tridxby ::= */
163385
+ 294, /* (391) database_kw_opt ::= DATABASE */
163386
+ 294, /* (392) database_kw_opt ::= */
163387
+ 297, /* (393) kwcolumn_opt ::= */
163388
+ 297, /* (394) kwcolumn_opt ::= COLUMNKW */
163389
+ 299, /* (395) vtabarglist ::= vtabarg */
163390
+ 299, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */
163391
+ 300, /* (397) vtabarg ::= vtabarg vtabargtoken */
163392
+ 303, /* (398) anylist ::= */
163393
+ 303, /* (399) anylist ::= anylist LP anylist RP */
163394
+ 303, /* (400) anylist ::= anylist ANY */
163395
+ 266, /* (401) with ::= */
163163163396
};
163164163397
163165163398
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
163166163399
** of symbols on the right-hand side of that rule. */
163167163400
static const signed char yyRuleInfoNRhs[] = {
@@ -163375,199 +163608,200 @@
163375163608
-3, /* (207) expr ::= expr IS expr */
163376163609
-4, /* (208) expr ::= expr IS NOT expr */
163377163610
-2, /* (209) expr ::= NOT expr */
163378163611
-2, /* (210) expr ::= BITNOT expr */
163379163612
-2, /* (211) expr ::= PLUS|MINUS expr */
163380
- -1, /* (212) between_op ::= BETWEEN */
163381
- -2, /* (213) between_op ::= NOT BETWEEN */
163382
- -5, /* (214) expr ::= expr between_op expr AND expr */
163383
- -1, /* (215) in_op ::= IN */
163384
- -2, /* (216) in_op ::= NOT IN */
163385
- -5, /* (217) expr ::= expr in_op LP exprlist RP */
163386
- -3, /* (218) expr ::= LP select RP */
163387
- -5, /* (219) expr ::= expr in_op LP select RP */
163388
- -5, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */
163389
- -4, /* (221) expr ::= EXISTS LP select RP */
163390
- -5, /* (222) expr ::= CASE case_operand case_exprlist case_else END */
163391
- -5, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163392
- -4, /* (224) case_exprlist ::= WHEN expr THEN expr */
163393
- -2, /* (225) case_else ::= ELSE expr */
163394
- 0, /* (226) case_else ::= */
163395
- -1, /* (227) case_operand ::= expr */
163396
- 0, /* (228) case_operand ::= */
163397
- 0, /* (229) exprlist ::= */
163398
- -3, /* (230) nexprlist ::= nexprlist COMMA expr */
163399
- -1, /* (231) nexprlist ::= expr */
163400
- 0, /* (232) paren_exprlist ::= */
163401
- -3, /* (233) paren_exprlist ::= LP exprlist RP */
163402
- -12, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163403
- -1, /* (235) uniqueflag ::= UNIQUE */
163404
- 0, /* (236) uniqueflag ::= */
163405
- 0, /* (237) eidlist_opt ::= */
163406
- -3, /* (238) eidlist_opt ::= LP eidlist RP */
163407
- -5, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */
163408
- -3, /* (240) eidlist ::= nm collate sortorder */
163409
- 0, /* (241) collate ::= */
163410
- -2, /* (242) collate ::= COLLATE ID|STRING */
163411
- -4, /* (243) cmd ::= DROP INDEX ifexists fullname */
163412
- -2, /* (244) cmd ::= VACUUM vinto */
163413
- -3, /* (245) cmd ::= VACUUM nm vinto */
163414
- -2, /* (246) vinto ::= INTO expr */
163415
- 0, /* (247) vinto ::= */
163416
- -3, /* (248) cmd ::= PRAGMA nm dbnm */
163417
- -5, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */
163418
- -6, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163419
- -5, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */
163420
- -6, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163421
- -2, /* (253) plus_num ::= PLUS INTEGER|FLOAT */
163422
- -2, /* (254) minus_num ::= MINUS INTEGER|FLOAT */
163423
- -5, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163424
- -11, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163425
- -1, /* (257) trigger_time ::= BEFORE|AFTER */
163426
- -2, /* (258) trigger_time ::= INSTEAD OF */
163427
- 0, /* (259) trigger_time ::= */
163428
- -1, /* (260) trigger_event ::= DELETE|INSERT */
163429
- -1, /* (261) trigger_event ::= UPDATE */
163430
- -3, /* (262) trigger_event ::= UPDATE OF idlist */
163431
- 0, /* (263) when_clause ::= */
163432
- -2, /* (264) when_clause ::= WHEN expr */
163433
- -3, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163434
- -2, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */
163435
- -3, /* (267) trnm ::= nm DOT nm */
163436
- -3, /* (268) tridxby ::= INDEXED BY nm */
163437
- -2, /* (269) tridxby ::= NOT INDEXED */
163438
- -9, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163439
- -8, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163440
- -6, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163441
- -3, /* (273) trigger_cmd ::= scanpt select scanpt */
163442
- -4, /* (274) expr ::= RAISE LP IGNORE RP */
163443
- -6, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */
163444
- -1, /* (276) raisetype ::= ROLLBACK */
163445
- -1, /* (277) raisetype ::= ABORT */
163446
- -1, /* (278) raisetype ::= FAIL */
163447
- -4, /* (279) cmd ::= DROP TRIGGER ifexists fullname */
163448
- -6, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163449
- -3, /* (281) cmd ::= DETACH database_kw_opt expr */
163450
- 0, /* (282) key_opt ::= */
163451
- -2, /* (283) key_opt ::= KEY expr */
163452
- -1, /* (284) cmd ::= REINDEX */
163453
- -3, /* (285) cmd ::= REINDEX nm dbnm */
163454
- -1, /* (286) cmd ::= ANALYZE */
163455
- -3, /* (287) cmd ::= ANALYZE nm dbnm */
163456
- -6, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */
163457
- -7, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163458
- -6, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163459
- -1, /* (291) add_column_fullname ::= fullname */
163460
- -8, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163461
- -1, /* (293) cmd ::= create_vtab */
163462
- -4, /* (294) cmd ::= create_vtab LP vtabarglist RP */
163463
- -8, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163464
- 0, /* (296) vtabarg ::= */
163465
- -1, /* (297) vtabargtoken ::= ANY */
163466
- -3, /* (298) vtabargtoken ::= lp anylist RP */
163467
- -1, /* (299) lp ::= LP */
163468
- -2, /* (300) with ::= WITH wqlist */
163469
- -3, /* (301) with ::= WITH RECURSIVE wqlist */
163470
- -1, /* (302) wqas ::= AS */
163471
- -2, /* (303) wqas ::= AS MATERIALIZED */
163472
- -3, /* (304) wqas ::= AS NOT MATERIALIZED */
163473
- -6, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */
163474
- -1, /* (306) wqlist ::= wqitem */
163475
- -3, /* (307) wqlist ::= wqlist COMMA wqitem */
163476
- -1, /* (308) windowdefn_list ::= windowdefn */
163477
- -3, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163478
- -5, /* (310) windowdefn ::= nm AS LP window RP */
163479
- -5, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163480
- -6, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163481
- -4, /* (313) window ::= ORDER BY sortlist frame_opt */
163482
- -5, /* (314) window ::= nm ORDER BY sortlist frame_opt */
163483
- -1, /* (315) window ::= frame_opt */
163484
- -2, /* (316) window ::= nm frame_opt */
163485
- 0, /* (317) frame_opt ::= */
163486
- -3, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163487
- -6, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163488
- -1, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */
163489
- -1, /* (321) frame_bound_s ::= frame_bound */
163490
- -2, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */
163491
- -1, /* (323) frame_bound_e ::= frame_bound */
163492
- -2, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */
163493
- -2, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */
163494
- -2, /* (326) frame_bound ::= CURRENT ROW */
163495
- 0, /* (327) frame_exclude_opt ::= */
163496
- -2, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */
163497
- -2, /* (329) frame_exclude ::= NO OTHERS */
163498
- -2, /* (330) frame_exclude ::= CURRENT ROW */
163499
- -1, /* (331) frame_exclude ::= GROUP|TIES */
163500
- -2, /* (332) window_clause ::= WINDOW windowdefn_list */
163501
- -2, /* (333) filter_over ::= filter_clause over_clause */
163502
- -1, /* (334) filter_over ::= over_clause */
163503
- -1, /* (335) filter_over ::= filter_clause */
163504
- -4, /* (336) over_clause ::= OVER LP window RP */
163505
- -2, /* (337) over_clause ::= OVER nm */
163506
- -5, /* (338) filter_clause ::= FILTER LP WHERE expr RP */
163507
- -1, /* (339) input ::= cmdlist */
163508
- -2, /* (340) cmdlist ::= cmdlist ecmd */
163509
- -1, /* (341) cmdlist ::= ecmd */
163510
- -1, /* (342) ecmd ::= SEMI */
163511
- -2, /* (343) ecmd ::= cmdx SEMI */
163512
- -3, /* (344) ecmd ::= explain cmdx SEMI */
163513
- 0, /* (345) trans_opt ::= */
163514
- -1, /* (346) trans_opt ::= TRANSACTION */
163515
- -2, /* (347) trans_opt ::= TRANSACTION nm */
163516
- -1, /* (348) savepoint_opt ::= SAVEPOINT */
163517
- 0, /* (349) savepoint_opt ::= */
163518
- -2, /* (350) cmd ::= create_table create_table_args */
163519
- -1, /* (351) table_option_set ::= table_option */
163520
- -4, /* (352) columnlist ::= columnlist COMMA columnname carglist */
163521
- -2, /* (353) columnlist ::= columnname carglist */
163522
- -1, /* (354) nm ::= ID|INDEXED */
163523
- -1, /* (355) nm ::= STRING */
163524
- -1, /* (356) nm ::= JOIN_KW */
163525
- -1, /* (357) typetoken ::= typename */
163526
- -1, /* (358) typename ::= ID|STRING */
163527
- -1, /* (359) signed ::= plus_num */
163528
- -1, /* (360) signed ::= minus_num */
163529
- -2, /* (361) carglist ::= carglist ccons */
163530
- 0, /* (362) carglist ::= */
163531
- -2, /* (363) ccons ::= NULL onconf */
163532
- -4, /* (364) ccons ::= GENERATED ALWAYS AS generated */
163533
- -2, /* (365) ccons ::= AS generated */
163534
- -2, /* (366) conslist_opt ::= COMMA conslist */
163535
- -3, /* (367) conslist ::= conslist tconscomma tcons */
163536
- -1, /* (368) conslist ::= tcons */
163537
- 0, /* (369) tconscomma ::= */
163538
- -1, /* (370) defer_subclause_opt ::= defer_subclause */
163539
- -1, /* (371) resolvetype ::= raisetype */
163540
- -1, /* (372) selectnowith ::= oneselect */
163541
- -1, /* (373) oneselect ::= values */
163542
- -2, /* (374) sclp ::= selcollist COMMA */
163543
- -1, /* (375) as ::= ID|STRING */
163544
- 0, /* (376) returning ::= */
163545
- -1, /* (377) expr ::= term */
163546
- -1, /* (378) likeop ::= LIKE_KW|MATCH */
163547
- -1, /* (379) exprlist ::= nexprlist */
163548
- -1, /* (380) nmnum ::= plus_num */
163549
- -1, /* (381) nmnum ::= nm */
163550
- -1, /* (382) nmnum ::= ON */
163551
- -1, /* (383) nmnum ::= DELETE */
163552
- -1, /* (384) nmnum ::= DEFAULT */
163553
- -1, /* (385) plus_num ::= INTEGER|FLOAT */
163554
- 0, /* (386) foreach_clause ::= */
163555
- -3, /* (387) foreach_clause ::= FOR EACH ROW */
163556
- -1, /* (388) trnm ::= nm */
163557
- 0, /* (389) tridxby ::= */
163558
- -1, /* (390) database_kw_opt ::= DATABASE */
163559
- 0, /* (391) database_kw_opt ::= */
163560
- 0, /* (392) kwcolumn_opt ::= */
163561
- -1, /* (393) kwcolumn_opt ::= COLUMNKW */
163562
- -1, /* (394) vtabarglist ::= vtabarg */
163563
- -3, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */
163564
- -2, /* (396) vtabarg ::= vtabarg vtabargtoken */
163565
- 0, /* (397) anylist ::= */
163566
- -4, /* (398) anylist ::= anylist LP anylist RP */
163567
- -2, /* (399) anylist ::= anylist ANY */
163568
- 0, /* (400) with ::= */
163613
+ -3, /* (212) expr ::= expr PTR expr */
163614
+ -1, /* (213) between_op ::= BETWEEN */
163615
+ -2, /* (214) between_op ::= NOT BETWEEN */
163616
+ -5, /* (215) expr ::= expr between_op expr AND expr */
163617
+ -1, /* (216) in_op ::= IN */
163618
+ -2, /* (217) in_op ::= NOT IN */
163619
+ -5, /* (218) expr ::= expr in_op LP exprlist RP */
163620
+ -3, /* (219) expr ::= LP select RP */
163621
+ -5, /* (220) expr ::= expr in_op LP select RP */
163622
+ -5, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */
163623
+ -4, /* (222) expr ::= EXISTS LP select RP */
163624
+ -5, /* (223) expr ::= CASE case_operand case_exprlist case_else END */
163625
+ -5, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163626
+ -4, /* (225) case_exprlist ::= WHEN expr THEN expr */
163627
+ -2, /* (226) case_else ::= ELSE expr */
163628
+ 0, /* (227) case_else ::= */
163629
+ -1, /* (228) case_operand ::= expr */
163630
+ 0, /* (229) case_operand ::= */
163631
+ 0, /* (230) exprlist ::= */
163632
+ -3, /* (231) nexprlist ::= nexprlist COMMA expr */
163633
+ -1, /* (232) nexprlist ::= expr */
163634
+ 0, /* (233) paren_exprlist ::= */
163635
+ -3, /* (234) paren_exprlist ::= LP exprlist RP */
163636
+ -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163637
+ -1, /* (236) uniqueflag ::= UNIQUE */
163638
+ 0, /* (237) uniqueflag ::= */
163639
+ 0, /* (238) eidlist_opt ::= */
163640
+ -3, /* (239) eidlist_opt ::= LP eidlist RP */
163641
+ -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */
163642
+ -3, /* (241) eidlist ::= nm collate sortorder */
163643
+ 0, /* (242) collate ::= */
163644
+ -2, /* (243) collate ::= COLLATE ID|STRING */
163645
+ -4, /* (244) cmd ::= DROP INDEX ifexists fullname */
163646
+ -2, /* (245) cmd ::= VACUUM vinto */
163647
+ -3, /* (246) cmd ::= VACUUM nm vinto */
163648
+ -2, /* (247) vinto ::= INTO expr */
163649
+ 0, /* (248) vinto ::= */
163650
+ -3, /* (249) cmd ::= PRAGMA nm dbnm */
163651
+ -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */
163652
+ -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163653
+ -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */
163654
+ -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163655
+ -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */
163656
+ -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */
163657
+ -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163658
+ -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163659
+ -1, /* (258) trigger_time ::= BEFORE|AFTER */
163660
+ -2, /* (259) trigger_time ::= INSTEAD OF */
163661
+ 0, /* (260) trigger_time ::= */
163662
+ -1, /* (261) trigger_event ::= DELETE|INSERT */
163663
+ -1, /* (262) trigger_event ::= UPDATE */
163664
+ -3, /* (263) trigger_event ::= UPDATE OF idlist */
163665
+ 0, /* (264) when_clause ::= */
163666
+ -2, /* (265) when_clause ::= WHEN expr */
163667
+ -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163668
+ -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */
163669
+ -3, /* (268) trnm ::= nm DOT nm */
163670
+ -3, /* (269) tridxby ::= INDEXED BY nm */
163671
+ -2, /* (270) tridxby ::= NOT INDEXED */
163672
+ -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163673
+ -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163674
+ -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163675
+ -3, /* (274) trigger_cmd ::= scanpt select scanpt */
163676
+ -4, /* (275) expr ::= RAISE LP IGNORE RP */
163677
+ -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */
163678
+ -1, /* (277) raisetype ::= ROLLBACK */
163679
+ -1, /* (278) raisetype ::= ABORT */
163680
+ -1, /* (279) raisetype ::= FAIL */
163681
+ -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */
163682
+ -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163683
+ -3, /* (282) cmd ::= DETACH database_kw_opt expr */
163684
+ 0, /* (283) key_opt ::= */
163685
+ -2, /* (284) key_opt ::= KEY expr */
163686
+ -1, /* (285) cmd ::= REINDEX */
163687
+ -3, /* (286) cmd ::= REINDEX nm dbnm */
163688
+ -1, /* (287) cmd ::= ANALYZE */
163689
+ -3, /* (288) cmd ::= ANALYZE nm dbnm */
163690
+ -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */
163691
+ -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163692
+ -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163693
+ -1, /* (292) add_column_fullname ::= fullname */
163694
+ -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163695
+ -1, /* (294) cmd ::= create_vtab */
163696
+ -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */
163697
+ -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163698
+ 0, /* (297) vtabarg ::= */
163699
+ -1, /* (298) vtabargtoken ::= ANY */
163700
+ -3, /* (299) vtabargtoken ::= lp anylist RP */
163701
+ -1, /* (300) lp ::= LP */
163702
+ -2, /* (301) with ::= WITH wqlist */
163703
+ -3, /* (302) with ::= WITH RECURSIVE wqlist */
163704
+ -1, /* (303) wqas ::= AS */
163705
+ -2, /* (304) wqas ::= AS MATERIALIZED */
163706
+ -3, /* (305) wqas ::= AS NOT MATERIALIZED */
163707
+ -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */
163708
+ -1, /* (307) wqlist ::= wqitem */
163709
+ -3, /* (308) wqlist ::= wqlist COMMA wqitem */
163710
+ -1, /* (309) windowdefn_list ::= windowdefn */
163711
+ -3, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163712
+ -5, /* (311) windowdefn ::= nm AS LP window RP */
163713
+ -5, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163714
+ -6, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163715
+ -4, /* (314) window ::= ORDER BY sortlist frame_opt */
163716
+ -5, /* (315) window ::= nm ORDER BY sortlist frame_opt */
163717
+ -1, /* (316) window ::= frame_opt */
163718
+ -2, /* (317) window ::= nm frame_opt */
163719
+ 0, /* (318) frame_opt ::= */
163720
+ -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163721
+ -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163722
+ -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
163723
+ -1, /* (322) frame_bound_s ::= frame_bound */
163724
+ -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
163725
+ -1, /* (324) frame_bound_e ::= frame_bound */
163726
+ -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
163727
+ -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
163728
+ -2, /* (327) frame_bound ::= CURRENT ROW */
163729
+ 0, /* (328) frame_exclude_opt ::= */
163730
+ -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
163731
+ -2, /* (330) frame_exclude ::= NO OTHERS */
163732
+ -2, /* (331) frame_exclude ::= CURRENT ROW */
163733
+ -1, /* (332) frame_exclude ::= GROUP|TIES */
163734
+ -2, /* (333) window_clause ::= WINDOW windowdefn_list */
163735
+ -2, /* (334) filter_over ::= filter_clause over_clause */
163736
+ -1, /* (335) filter_over ::= over_clause */
163737
+ -1, /* (336) filter_over ::= filter_clause */
163738
+ -4, /* (337) over_clause ::= OVER LP window RP */
163739
+ -2, /* (338) over_clause ::= OVER nm */
163740
+ -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
163741
+ -1, /* (340) input ::= cmdlist */
163742
+ -2, /* (341) cmdlist ::= cmdlist ecmd */
163743
+ -1, /* (342) cmdlist ::= ecmd */
163744
+ -1, /* (343) ecmd ::= SEMI */
163745
+ -2, /* (344) ecmd ::= cmdx SEMI */
163746
+ -3, /* (345) ecmd ::= explain cmdx SEMI */
163747
+ 0, /* (346) trans_opt ::= */
163748
+ -1, /* (347) trans_opt ::= TRANSACTION */
163749
+ -2, /* (348) trans_opt ::= TRANSACTION nm */
163750
+ -1, /* (349) savepoint_opt ::= SAVEPOINT */
163751
+ 0, /* (350) savepoint_opt ::= */
163752
+ -2, /* (351) cmd ::= create_table create_table_args */
163753
+ -1, /* (352) table_option_set ::= table_option */
163754
+ -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */
163755
+ -2, /* (354) columnlist ::= columnname carglist */
163756
+ -1, /* (355) nm ::= ID|INDEXED */
163757
+ -1, /* (356) nm ::= STRING */
163758
+ -1, /* (357) nm ::= JOIN_KW */
163759
+ -1, /* (358) typetoken ::= typename */
163760
+ -1, /* (359) typename ::= ID|STRING */
163761
+ -1, /* (360) signed ::= plus_num */
163762
+ -1, /* (361) signed ::= minus_num */
163763
+ -2, /* (362) carglist ::= carglist ccons */
163764
+ 0, /* (363) carglist ::= */
163765
+ -2, /* (364) ccons ::= NULL onconf */
163766
+ -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
163767
+ -2, /* (366) ccons ::= AS generated */
163768
+ -2, /* (367) conslist_opt ::= COMMA conslist */
163769
+ -3, /* (368) conslist ::= conslist tconscomma tcons */
163770
+ -1, /* (369) conslist ::= tcons */
163771
+ 0, /* (370) tconscomma ::= */
163772
+ -1, /* (371) defer_subclause_opt ::= defer_subclause */
163773
+ -1, /* (372) resolvetype ::= raisetype */
163774
+ -1, /* (373) selectnowith ::= oneselect */
163775
+ -1, /* (374) oneselect ::= values */
163776
+ -2, /* (375) sclp ::= selcollist COMMA */
163777
+ -1, /* (376) as ::= ID|STRING */
163778
+ 0, /* (377) returning ::= */
163779
+ -1, /* (378) expr ::= term */
163780
+ -1, /* (379) likeop ::= LIKE_KW|MATCH */
163781
+ -1, /* (380) exprlist ::= nexprlist */
163782
+ -1, /* (381) nmnum ::= plus_num */
163783
+ -1, /* (382) nmnum ::= nm */
163784
+ -1, /* (383) nmnum ::= ON */
163785
+ -1, /* (384) nmnum ::= DELETE */
163786
+ -1, /* (385) nmnum ::= DEFAULT */
163787
+ -1, /* (386) plus_num ::= INTEGER|FLOAT */
163788
+ 0, /* (387) foreach_clause ::= */
163789
+ -3, /* (388) foreach_clause ::= FOR EACH ROW */
163790
+ -1, /* (389) trnm ::= nm */
163791
+ 0, /* (390) tridxby ::= */
163792
+ -1, /* (391) database_kw_opt ::= DATABASE */
163793
+ 0, /* (392) database_kw_opt ::= */
163794
+ 0, /* (393) kwcolumn_opt ::= */
163795
+ -1, /* (394) kwcolumn_opt ::= COLUMNKW */
163796
+ -1, /* (395) vtabarglist ::= vtabarg */
163797
+ -3, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */
163798
+ -2, /* (397) vtabarg ::= vtabarg vtabargtoken */
163799
+ 0, /* (398) anylist ::= */
163800
+ -4, /* (399) anylist ::= anylist LP anylist RP */
163801
+ -2, /* (400) anylist ::= anylist ANY */
163802
+ 0, /* (401) with ::= */
163569163803
};
163570163804
163571163805
static void yy_accept(yyParser*); /* Forward Declaration */
163572163806
163573163807
/*
@@ -163615,20 +163849,20 @@
163615163849
break;
163616163850
case 2: /* cmdx ::= cmd */
163617163851
{ sqlite3FinishCoding(pParse); }
163618163852
break;
163619163853
case 3: /* cmd ::= BEGIN transtype trans_opt */
163620
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy64);}
163854
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);}
163621163855
break;
163622163856
case 4: /* transtype ::= */
163623
-{yymsp[1].minor.yy64 = TK_DEFERRED;}
163857
+{yymsp[1].minor.yy394 = TK_DEFERRED;}
163624163858
break;
163625163859
case 5: /* transtype ::= DEFERRED */
163626163860
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
163627163861
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
163628
- case 320: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==320);
163629
-{yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/}
163862
+ case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321);
163863
+{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
163630163864
break;
163631163865
case 8: /* cmd ::= COMMIT|END trans_opt */
163632163866
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
163633163867
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
163634163868
break;
@@ -163647,11 +163881,11 @@
163647163881
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
163648163882
}
163649163883
break;
163650163884
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
163651163885
{
163652
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy64,0,0,yymsp[-2].minor.yy64);
163886
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394);
163653163887
}
163654163888
break;
163655163889
case 14: /* createkw ::= CREATE */
163656163890
{disableLookaside(pParse);}
163657163891
break;
@@ -163660,57 +163894,57 @@
163660163894
case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
163661163895
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
163662163896
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
163663163897
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
163664163898
case 98: /* distinct ::= */ yytestcase(yyruleno==98);
163665
- case 241: /* collate ::= */ yytestcase(yyruleno==241);
163666
-{yymsp[1].minor.yy64 = 0;}
163899
+ case 242: /* collate ::= */ yytestcase(yyruleno==242);
163900
+{yymsp[1].minor.yy394 = 0;}
163667163901
break;
163668163902
case 16: /* ifnotexists ::= IF NOT EXISTS */
163669
-{yymsp[-2].minor.yy64 = 1;}
163903
+{yymsp[-2].minor.yy394 = 1;}
163670163904
break;
163671163905
case 17: /* temp ::= TEMP */
163672
-{yymsp[0].minor.yy64 = pParse->db->init.busy==0;}
163906
+{yymsp[0].minor.yy394 = pParse->db->init.busy==0;}
163673163907
break;
163674163908
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
163675163909
{
163676
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy51,0);
163910
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0);
163677163911
}
163678163912
break;
163679163913
case 20: /* create_table_args ::= AS select */
163680163914
{
163681
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy303);
163682
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303);
163915
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47);
163916
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
163683163917
}
163684163918
break;
163685163919
case 21: /* table_option_set ::= */
163686
-{yymsp[1].minor.yy51 = 0;}
163920
+{yymsp[1].minor.yy285 = 0;}
163687163921
break;
163688163922
case 22: /* table_option_set ::= table_option_set COMMA table_option */
163689
-{yylhsminor.yy51 = yymsp[-2].minor.yy51|yymsp[0].minor.yy51;}
163690
- yymsp[-2].minor.yy51 = yylhsminor.yy51;
163923
+{yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;}
163924
+ yymsp[-2].minor.yy285 = yylhsminor.yy285;
163691163925
break;
163692163926
case 23: /* table_option ::= WITHOUT nm */
163693163927
{
163694163928
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
163695
- yymsp[-1].minor.yy51 = TF_WithoutRowid | TF_NoVisibleRowid;
163929
+ yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid;
163696163930
}else{
163697
- yymsp[-1].minor.yy51 = 0;
163931
+ yymsp[-1].minor.yy285 = 0;
163698163932
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163699163933
}
163700163934
}
163701163935
break;
163702163936
case 24: /* table_option ::= nm */
163703163937
{
163704163938
if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
163705
- yylhsminor.yy51 = TF_Strict;
163939
+ yylhsminor.yy285 = TF_Strict;
163706163940
}else{
163707
- yylhsminor.yy51 = 0;
163941
+ yylhsminor.yy285 = 0;
163708163942
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163709163943
}
163710163944
}
163711
- yymsp[0].minor.yy51 = yylhsminor.yy51;
163945
+ yymsp[0].minor.yy285 = yylhsminor.yy285;
163712163946
break;
163713163947
case 25: /* columnname ::= nm typetoken */
163714163948
{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
163715163949
break;
163716163950
case 26: /* typetoken ::= */
@@ -163732,11 +163966,11 @@
163732163966
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
163733163967
break;
163734163968
case 30: /* scanpt ::= */
163735163969
{
163736163970
assert( yyLookahead!=YYNOCODE );
163737
- yymsp[1].minor.yy600 = yyLookaheadToken.z;
163971
+ yymsp[1].minor.yy522 = yyLookaheadToken.z;
163738163972
}
163739163973
break;
163740163974
case 31: /* scantok ::= */
163741163975
{
163742163976
assert( yyLookahead!=YYNOCODE );
@@ -163746,21 +163980,21 @@
163746163980
case 32: /* ccons ::= CONSTRAINT nm */
163747163981
case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
163748163982
{pParse->constraintName = yymsp[0].minor.yy0;}
163749163983
break;
163750163984
case 33: /* ccons ::= DEFAULT scantok term */
163751
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163985
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163752163986
break;
163753163987
case 34: /* ccons ::= DEFAULT LP expr RP */
163754
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
163988
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
163755163989
break;
163756163990
case 35: /* ccons ::= DEFAULT PLUS scantok term */
163757
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163991
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163758163992
break;
163759163993
case 36: /* ccons ::= DEFAULT MINUS scantok term */
163760163994
{
163761
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy626, 0);
163995
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0);
163762163996
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
163763163997
}
163764163998
break;
163765163999
case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
163766164000
{
@@ -163771,308 +164005,308 @@
163771164005
}
163772164006
sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
163773164007
}
163774164008
break;
163775164009
case 38: /* ccons ::= NOT NULL onconf */
163776
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy64);}
164010
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);}
163777164011
break;
163778164012
case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
163779
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy64,yymsp[0].minor.yy64,yymsp[-2].minor.yy64);}
164013
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);}
163780164014
break;
163781164015
case 40: /* ccons ::= UNIQUE onconf */
163782
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy64,0,0,0,0,
164016
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0,
163783164017
SQLITE_IDXTYPE_UNIQUE);}
163784164018
break;
163785164019
case 41: /* ccons ::= CHECK LP expr RP */
163786
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
164020
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
163787164021
break;
163788164022
case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
163789
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy562,yymsp[0].minor.yy64);}
164023
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);}
163790164024
break;
163791164025
case 43: /* ccons ::= defer_subclause */
163792
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy64);}
164026
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);}
163793164027
break;
163794164028
case 44: /* ccons ::= COLLATE ID|STRING */
163795164029
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
163796164030
break;
163797164031
case 45: /* generated ::= LP expr RP */
163798
-{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy626,0);}
164032
+{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);}
163799164033
break;
163800164034
case 46: /* generated ::= LP expr RP ID */
163801
-{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy626,&yymsp[0].minor.yy0);}
164035
+{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);}
163802164036
break;
163803164037
case 48: /* autoinc ::= AUTOINCR */
163804
-{yymsp[0].minor.yy64 = 1;}
164038
+{yymsp[0].minor.yy394 = 1;}
163805164039
break;
163806164040
case 49: /* refargs ::= */
163807
-{ yymsp[1].minor.yy64 = OE_None*0x0101; /* EV: R-19803-45884 */}
164041
+{ yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */}
163808164042
break;
163809164043
case 50: /* refargs ::= refargs refarg */
163810
-{ yymsp[-1].minor.yy64 = (yymsp[-1].minor.yy64 & ~yymsp[0].minor.yy83.mask) | yymsp[0].minor.yy83.value; }
164044
+{ yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; }
163811164045
break;
163812164046
case 51: /* refarg ::= MATCH nm */
163813
-{ yymsp[-1].minor.yy83.value = 0; yymsp[-1].minor.yy83.mask = 0x000000; }
164047
+{ yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; }
163814164048
break;
163815164049
case 52: /* refarg ::= ON INSERT refact */
163816
-{ yymsp[-2].minor.yy83.value = 0; yymsp[-2].minor.yy83.mask = 0x000000; }
164050
+{ yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; }
163817164051
break;
163818164052
case 53: /* refarg ::= ON DELETE refact */
163819
-{ yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64; yymsp[-2].minor.yy83.mask = 0x0000ff; }
164053
+{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; }
163820164054
break;
163821164055
case 54: /* refarg ::= ON UPDATE refact */
163822
-{ yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64<<8; yymsp[-2].minor.yy83.mask = 0x00ff00; }
164056
+{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; }
163823164057
break;
163824164058
case 55: /* refact ::= SET NULL */
163825
-{ yymsp[-1].minor.yy64 = OE_SetNull; /* EV: R-33326-45252 */}
164059
+{ yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */}
163826164060
break;
163827164061
case 56: /* refact ::= SET DEFAULT */
163828
-{ yymsp[-1].minor.yy64 = OE_SetDflt; /* EV: R-33326-45252 */}
164062
+{ yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */}
163829164063
break;
163830164064
case 57: /* refact ::= CASCADE */
163831
-{ yymsp[0].minor.yy64 = OE_Cascade; /* EV: R-33326-45252 */}
164065
+{ yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */}
163832164066
break;
163833164067
case 58: /* refact ::= RESTRICT */
163834
-{ yymsp[0].minor.yy64 = OE_Restrict; /* EV: R-33326-45252 */}
164068
+{ yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */}
163835164069
break;
163836164070
case 59: /* refact ::= NO ACTION */
163837
-{ yymsp[-1].minor.yy64 = OE_None; /* EV: R-33326-45252 */}
164071
+{ yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */}
163838164072
break;
163839164073
case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
163840
-{yymsp[-2].minor.yy64 = 0;}
164074
+{yymsp[-2].minor.yy394 = 0;}
163841164075
break;
163842164076
case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
163843164077
case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
163844164078
case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
163845
-{yymsp[-1].minor.yy64 = yymsp[0].minor.yy64;}
164079
+{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
163846164080
break;
163847164081
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
163848164082
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
163849
- case 213: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==213);
163850
- case 216: /* in_op ::= NOT IN */ yytestcase(yyruleno==216);
163851
- case 242: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==242);
163852
-{yymsp[-1].minor.yy64 = 1;}
164083
+ case 214: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==214);
164084
+ case 217: /* in_op ::= NOT IN */ yytestcase(yyruleno==217);
164085
+ case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243);
164086
+{yymsp[-1].minor.yy394 = 1;}
163853164087
break;
163854164088
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
163855
-{yymsp[-1].minor.yy64 = 0;}
164089
+{yymsp[-1].minor.yy394 = 0;}
163856164090
break;
163857164091
case 66: /* tconscomma ::= COMMA */
163858164092
{pParse->constraintName.n = 0;}
163859164093
break;
163860164094
case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
163861
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy562,yymsp[0].minor.yy64,yymsp[-2].minor.yy64,0);}
164095
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);}
163862164096
break;
163863164097
case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
163864
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy562,yymsp[0].minor.yy64,0,0,0,0,
164098
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0,
163865164099
SQLITE_IDXTYPE_UNIQUE);}
163866164100
break;
163867164101
case 70: /* tcons ::= CHECK LP expr RP onconf */
163868
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy626,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
164102
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
163869164103
break;
163870164104
case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
163871164105
{
163872
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy562, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[-1].minor.yy64);
163873
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy64);
164106
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394);
164107
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394);
163874164108
}
163875164109
break;
163876164110
case 73: /* onconf ::= */
163877164111
case 75: /* orconf ::= */ yytestcase(yyruleno==75);
163878
-{yymsp[1].minor.yy64 = OE_Default;}
164112
+{yymsp[1].minor.yy394 = OE_Default;}
163879164113
break;
163880164114
case 74: /* onconf ::= ON CONFLICT resolvetype */
163881
-{yymsp[-2].minor.yy64 = yymsp[0].minor.yy64;}
164115
+{yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;}
163882164116
break;
163883164117
case 77: /* resolvetype ::= IGNORE */
163884
-{yymsp[0].minor.yy64 = OE_Ignore;}
164118
+{yymsp[0].minor.yy394 = OE_Ignore;}
163885164119
break;
163886164120
case 78: /* resolvetype ::= REPLACE */
163887164121
case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172);
163888
-{yymsp[0].minor.yy64 = OE_Replace;}
164122
+{yymsp[0].minor.yy394 = OE_Replace;}
163889164123
break;
163890164124
case 79: /* cmd ::= DROP TABLE ifexists fullname */
163891164125
{
163892
- sqlite3DropTable(pParse, yymsp[0].minor.yy607, 0, yymsp[-1].minor.yy64);
164126
+ sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394);
163893164127
}
163894164128
break;
163895164129
case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
163896164130
{
163897
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[0].minor.yy303, yymsp[-7].minor.yy64, yymsp[-5].minor.yy64);
164131
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394);
163898164132
}
163899164133
break;
163900164134
case 83: /* cmd ::= DROP VIEW ifexists fullname */
163901164135
{
163902
- sqlite3DropTable(pParse, yymsp[0].minor.yy607, 1, yymsp[-1].minor.yy64);
164136
+ sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394);
163903164137
}
163904164138
break;
163905164139
case 84: /* cmd ::= select */
163906164140
{
163907164141
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
163908
- sqlite3Select(pParse, yymsp[0].minor.yy303, &dest);
163909
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303);
164142
+ sqlite3Select(pParse, yymsp[0].minor.yy47, &dest);
164143
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
163910164144
}
163911164145
break;
163912164146
case 85: /* select ::= WITH wqlist selectnowith */
163913
-{yymsp[-2].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);}
164147
+{yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
163914164148
break;
163915164149
case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
163916
-{yymsp[-3].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);}
164150
+{yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
163917164151
break;
163918164152
case 87: /* select ::= selectnowith */
163919164153
{
163920
- Select *p = yymsp[0].minor.yy303;
164154
+ Select *p = yymsp[0].minor.yy47;
163921164155
if( p ){
163922164156
parserDoubleLinkSelect(pParse, p);
163923164157
}
163924
- yymsp[0].minor.yy303 = p; /*A-overwrites-X*/
164158
+ yymsp[0].minor.yy47 = p; /*A-overwrites-X*/
163925164159
}
163926164160
break;
163927164161
case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
163928164162
{
163929
- Select *pRhs = yymsp[0].minor.yy303;
163930
- Select *pLhs = yymsp[-2].minor.yy303;
164163
+ Select *pRhs = yymsp[0].minor.yy47;
164164
+ Select *pLhs = yymsp[-2].minor.yy47;
163931164165
if( pRhs && pRhs->pPrior ){
163932164166
SrcList *pFrom;
163933164167
Token x;
163934164168
x.n = 0;
163935164169
parserDoubleLinkSelect(pParse, pRhs);
163936164170
pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
163937164171
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
163938164172
}
163939164173
if( pRhs ){
163940
- pRhs->op = (u8)yymsp[-1].minor.yy64;
164174
+ pRhs->op = (u8)yymsp[-1].minor.yy394;
163941164175
pRhs->pPrior = pLhs;
163942164176
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
163943164177
pRhs->selFlags &= ~SF_MultiValue;
163944
- if( yymsp[-1].minor.yy64!=TK_ALL ) pParse->hasCompound = 1;
164178
+ if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1;
163945164179
}else{
163946164180
sqlite3SelectDelete(pParse->db, pLhs);
163947164181
}
163948
- yymsp[-2].minor.yy303 = pRhs;
164182
+ yymsp[-2].minor.yy47 = pRhs;
163949164183
}
163950164184
break;
163951164185
case 89: /* multiselect_op ::= UNION */
163952164186
case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
163953
-{yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-OP*/}
164187
+{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/}
163954164188
break;
163955164189
case 90: /* multiselect_op ::= UNION ALL */
163956
-{yymsp[-1].minor.yy64 = TK_ALL;}
164190
+{yymsp[-1].minor.yy394 = TK_ALL;}
163957164191
break;
163958164192
case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
163959164193
{
163960
- yymsp[-8].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy562,yymsp[-5].minor.yy607,yymsp[-4].minor.yy626,yymsp[-3].minor.yy562,yymsp[-2].minor.yy626,yymsp[-1].minor.yy562,yymsp[-7].minor.yy64,yymsp[0].minor.yy626);
164194
+ yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528);
163961164195
}
163962164196
break;
163963164197
case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
163964164198
{
163965
- yymsp[-9].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy562,yymsp[-6].minor.yy607,yymsp[-5].minor.yy626,yymsp[-4].minor.yy562,yymsp[-3].minor.yy626,yymsp[-1].minor.yy562,yymsp[-8].minor.yy64,yymsp[0].minor.yy626);
163966
- if( yymsp[-9].minor.yy303 ){
163967
- yymsp[-9].minor.yy303->pWinDefn = yymsp[-2].minor.yy375;
164199
+ yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528);
164200
+ if( yymsp[-9].minor.yy47 ){
164201
+ yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41;
163968164202
}else{
163969
- sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy375);
164203
+ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41);
163970164204
}
163971164205
}
163972164206
break;
163973164207
case 94: /* values ::= VALUES LP nexprlist RP */
163974164208
{
163975
- yymsp[-3].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values,0);
164209
+ yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
163976164210
}
163977164211
break;
163978164212
case 95: /* values ::= values COMMA LP nexprlist RP */
163979164213
{
163980
- Select *pRight, *pLeft = yymsp[-4].minor.yy303;
163981
- pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values|SF_MultiValue,0);
164214
+ Select *pRight, *pLeft = yymsp[-4].minor.yy47;
164215
+ pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
163982164216
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
163983164217
if( pRight ){
163984164218
pRight->op = TK_ALL;
163985164219
pRight->pPrior = pLeft;
163986
- yymsp[-4].minor.yy303 = pRight;
164220
+ yymsp[-4].minor.yy47 = pRight;
163987164221
}else{
163988
- yymsp[-4].minor.yy303 = pLeft;
164222
+ yymsp[-4].minor.yy47 = pLeft;
163989164223
}
163990164224
}
163991164225
break;
163992164226
case 96: /* distinct ::= DISTINCT */
163993
-{yymsp[0].minor.yy64 = SF_Distinct;}
164227
+{yymsp[0].minor.yy394 = SF_Distinct;}
163994164228
break;
163995164229
case 97: /* distinct ::= ALL */
163996
-{yymsp[0].minor.yy64 = SF_All;}
164230
+{yymsp[0].minor.yy394 = SF_All;}
163997164231
break;
163998164232
case 99: /* sclp ::= */
163999164233
case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
164000164234
case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
164001
- case 229: /* exprlist ::= */ yytestcase(yyruleno==229);
164002
- case 232: /* paren_exprlist ::= */ yytestcase(yyruleno==232);
164003
- case 237: /* eidlist_opt ::= */ yytestcase(yyruleno==237);
164004
-{yymsp[1].minor.yy562 = 0;}
164235
+ case 230: /* exprlist ::= */ yytestcase(yyruleno==230);
164236
+ case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233);
164237
+ case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238);
164238
+{yymsp[1].minor.yy322 = 0;}
164005164239
break;
164006164240
case 100: /* selcollist ::= sclp scanpt expr scanpt as */
164007164241
{
164008
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[-2].minor.yy626);
164009
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[0].minor.yy0, 1);
164010
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy562,yymsp[-3].minor.yy600,yymsp[-1].minor.yy600);
164242
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
164243
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1);
164244
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522);
164011164245
}
164012164246
break;
164013164247
case 101: /* selcollist ::= sclp scanpt STAR */
164014164248
{
164015164249
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
164016
- yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy562, p);
164250
+ yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
164017164251
}
164018164252
break;
164019164253
case 102: /* selcollist ::= sclp scanpt nm DOT STAR */
164020164254
{
164021164255
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
164022164256
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164023164257
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
164024
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, pDot);
164258
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
164025164259
}
164026164260
break;
164027164261
case 103: /* as ::= AS nm */
164028164262
case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114);
164029
- case 253: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==253);
164030
- case 254: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==254);
164263
+ case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254);
164264
+ case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
164031164265
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
164032164266
break;
164033164267
case 105: /* from ::= */
164034164268
case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
164035
-{yymsp[1].minor.yy607 = 0;}
164269
+{yymsp[1].minor.yy131 = 0;}
164036164270
break;
164037164271
case 106: /* from ::= FROM seltablist */
164038164272
{
164039
- yymsp[-1].minor.yy607 = yymsp[0].minor.yy607;
164040
- sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy607);
164273
+ yymsp[-1].minor.yy131 = yymsp[0].minor.yy131;
164274
+ sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy131);
164041164275
}
164042164276
break;
164043164277
case 107: /* stl_prefix ::= seltablist joinop */
164044164278
{
164045
- if( ALWAYS(yymsp[-1].minor.yy607 && yymsp[-1].minor.yy607->nSrc>0) ) yymsp[-1].minor.yy607->a[yymsp[-1].minor.yy607->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy64;
164279
+ if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394;
164046164280
}
164047164281
break;
164048164282
case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
164049164283
{
164050
- yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164051
- sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy607, &yymsp[-2].minor.yy0);
164284
+ yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164285
+ sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy131, &yymsp[-2].minor.yy0);
164052164286
}
164053164287
break;
164054164288
case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
164055164289
{
164056
- yymsp[-8].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy607,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164057
- sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy607, yymsp[-4].minor.yy562);
164290
+ yymsp[-8].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy131,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164291
+ sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy131, yymsp[-4].minor.yy322);
164058164292
}
164059164293
break;
164060164294
case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
164061164295
{
164062
- yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy303,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164296
+ yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy47,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164063164297
}
164064164298
break;
164065164299
case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
164066164300
{
164067
- if( yymsp[-6].minor.yy607==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy626==0 && yymsp[0].minor.yy240==0 ){
164068
- yymsp[-6].minor.yy607 = yymsp[-4].minor.yy607;
164069
- }else if( yymsp[-4].minor.yy607->nSrc==1 ){
164070
- yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164071
- if( yymsp[-6].minor.yy607 ){
164072
- SrcItem *pNew = &yymsp[-6].minor.yy607->a[yymsp[-6].minor.yy607->nSrc-1];
164073
- SrcItem *pOld = yymsp[-4].minor.yy607->a;
164301
+ if( yymsp[-6].minor.yy131==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy528==0 && yymsp[0].minor.yy254==0 ){
164302
+ yymsp[-6].minor.yy131 = yymsp[-4].minor.yy131;
164303
+ }else if( yymsp[-4].minor.yy131->nSrc==1 ){
164304
+ yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164305
+ if( yymsp[-6].minor.yy131 ){
164306
+ SrcItem *pNew = &yymsp[-6].minor.yy131->a[yymsp[-6].minor.yy131->nSrc-1];
164307
+ SrcItem *pOld = yymsp[-4].minor.yy131->a;
164074164308
pNew->zName = pOld->zName;
164075164309
pNew->zDatabase = pOld->zDatabase;
164076164310
pNew->pSelect = pOld->pSelect;
164077164311
if( pOld->fg.isTabFunc ){
164078164312
pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -164081,240 +164315,240 @@
164081164315
pNew->fg.isTabFunc = 1;
164082164316
}
164083164317
pOld->zName = pOld->zDatabase = 0;
164084164318
pOld->pSelect = 0;
164085164319
}
164086
- sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy607);
164320
+ sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy131);
164087164321
}else{
164088164322
Select *pSubquery;
164089
- sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy607);
164090
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy607,0,0,0,0,SF_NestedFrom,0);
164091
- yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164323
+ sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy131);
164324
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy131,0,0,0,0,SF_NestedFrom,0);
164325
+ yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164092164326
}
164093164327
}
164094164328
break;
164095164329
case 113: /* dbnm ::= */
164096164330
case 127: /* indexed_opt ::= */ yytestcase(yyruleno==127);
164097164331
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
164098164332
break;
164099164333
case 115: /* fullname ::= nm */
164100164334
{
164101
- yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
164102
- if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0);
164335
+ yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
164336
+ if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
164103164337
}
164104
- yymsp[0].minor.yy607 = yylhsminor.yy607;
164338
+ yymsp[0].minor.yy131 = yylhsminor.yy131;
164105164339
break;
164106164340
case 116: /* fullname ::= nm DOT nm */
164107164341
{
164108
- yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
164109
- if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0);
164342
+ yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
164343
+ if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
164110164344
}
164111
- yymsp[-2].minor.yy607 = yylhsminor.yy607;
164345
+ yymsp[-2].minor.yy131 = yylhsminor.yy131;
164112164346
break;
164113164347
case 117: /* xfullname ::= nm */
164114
-{yymsp[0].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
164348
+{yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
164115164349
break;
164116164350
case 118: /* xfullname ::= nm DOT nm */
164117
-{yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
164351
+{yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
164118164352
break;
164119164353
case 119: /* xfullname ::= nm DOT nm AS nm */
164120164354
{
164121
- yymsp[-4].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
164122
- if( yymsp[-4].minor.yy607 ) yymsp[-4].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164355
+ yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
164356
+ if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164123164357
}
164124164358
break;
164125164359
case 120: /* xfullname ::= nm AS nm */
164126164360
{
164127
- yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
164128
- if( yymsp[-2].minor.yy607 ) yymsp[-2].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164361
+ yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
164362
+ if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164129164363
}
164130164364
break;
164131164365
case 121: /* joinop ::= COMMA|JOIN */
164132
-{ yymsp[0].minor.yy64 = JT_INNER; }
164366
+{ yymsp[0].minor.yy394 = JT_INNER; }
164133164367
break;
164134164368
case 122: /* joinop ::= JOIN_KW JOIN */
164135
-{yymsp[-1].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
164369
+{yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
164136164370
break;
164137164371
case 123: /* joinop ::= JOIN_KW nm JOIN */
164138
-{yymsp[-2].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
164372
+{yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
164139164373
break;
164140164374
case 124: /* joinop ::= JOIN_KW nm nm JOIN */
164141
-{yymsp[-3].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
164375
+{yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
164142164376
break;
164143164377
case 125: /* on_opt ::= ON expr */
164144164378
case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145);
164145164379
case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
164146164380
case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
164147
- case 225: /* case_else ::= ELSE expr */ yytestcase(yyruleno==225);
164148
- case 246: /* vinto ::= INTO expr */ yytestcase(yyruleno==246);
164149
-{yymsp[-1].minor.yy626 = yymsp[0].minor.yy626;}
164381
+ case 226: /* case_else ::= ELSE expr */ yytestcase(yyruleno==226);
164382
+ case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247);
164383
+{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
164150164384
break;
164151164385
case 126: /* on_opt ::= */
164152164386
case 144: /* having_opt ::= */ yytestcase(yyruleno==144);
164153164387
case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
164154164388
case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
164155164389
case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
164156
- case 226: /* case_else ::= */ yytestcase(yyruleno==226);
164157
- case 228: /* case_operand ::= */ yytestcase(yyruleno==228);
164158
- case 247: /* vinto ::= */ yytestcase(yyruleno==247);
164159
-{yymsp[1].minor.yy626 = 0;}
164390
+ case 227: /* case_else ::= */ yytestcase(yyruleno==227);
164391
+ case 229: /* case_operand ::= */ yytestcase(yyruleno==229);
164392
+ case 248: /* vinto ::= */ yytestcase(yyruleno==248);
164393
+{yymsp[1].minor.yy528 = 0;}
164160164394
break;
164161164395
case 128: /* indexed_opt ::= INDEXED BY nm */
164162164396
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
164163164397
break;
164164164398
case 129: /* indexed_opt ::= NOT INDEXED */
164165164399
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
164166164400
break;
164167164401
case 130: /* using_opt ::= USING LP idlist RP */
164168
-{yymsp[-3].minor.yy240 = yymsp[-1].minor.yy240;}
164402
+{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
164169164403
break;
164170164404
case 131: /* using_opt ::= */
164171164405
case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173);
164172
-{yymsp[1].minor.yy240 = 0;}
164406
+{yymsp[1].minor.yy254 = 0;}
164173164407
break;
164174164408
case 133: /* orderby_opt ::= ORDER BY sortlist */
164175164409
case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143);
164176
-{yymsp[-2].minor.yy562 = yymsp[0].minor.yy562;}
164410
+{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
164177164411
break;
164178164412
case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */
164179164413
{
164180
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562,yymsp[-2].minor.yy626);
164181
- sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64);
164414
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528);
164415
+ sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
164182164416
}
164183164417
break;
164184164418
case 135: /* sortlist ::= expr sortorder nulls */
164185164419
{
164186
- yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy626); /*A-overwrites-Y*/
164187
- sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64);
164420
+ yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/
164421
+ sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
164188164422
}
164189164423
break;
164190164424
case 136: /* sortorder ::= ASC */
164191
-{yymsp[0].minor.yy64 = SQLITE_SO_ASC;}
164425
+{yymsp[0].minor.yy394 = SQLITE_SO_ASC;}
164192164426
break;
164193164427
case 137: /* sortorder ::= DESC */
164194
-{yymsp[0].minor.yy64 = SQLITE_SO_DESC;}
164428
+{yymsp[0].minor.yy394 = SQLITE_SO_DESC;}
164195164429
break;
164196164430
case 138: /* sortorder ::= */
164197164431
case 141: /* nulls ::= */ yytestcase(yyruleno==141);
164198
-{yymsp[1].minor.yy64 = SQLITE_SO_UNDEFINED;}
164432
+{yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;}
164199164433
break;
164200164434
case 139: /* nulls ::= NULLS FIRST */
164201
-{yymsp[-1].minor.yy64 = SQLITE_SO_ASC;}
164435
+{yymsp[-1].minor.yy394 = SQLITE_SO_ASC;}
164202164436
break;
164203164437
case 140: /* nulls ::= NULLS LAST */
164204
-{yymsp[-1].minor.yy64 = SQLITE_SO_DESC;}
164438
+{yymsp[-1].minor.yy394 = SQLITE_SO_DESC;}
164205164439
break;
164206164440
case 147: /* limit_opt ::= LIMIT expr */
164207
-{yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,0);}
164441
+{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
164208164442
break;
164209164443
case 148: /* limit_opt ::= LIMIT expr OFFSET expr */
164210
-{yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164444
+{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164211164445
break;
164212164446
case 149: /* limit_opt ::= LIMIT expr COMMA expr */
164213
-{yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,yymsp[-2].minor.yy626);}
164447
+{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);}
164214164448
break;
164215164449
case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
164216164450
{
164217
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy607, &yymsp[-1].minor.yy0);
164218
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy607,yymsp[0].minor.yy626,0,0);
164451
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0);
164452
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0);
164219164453
}
164220164454
break;
164221164455
case 155: /* where_opt_ret ::= RETURNING selcollist */
164222
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-1].minor.yy626 = 0;}
164456
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;}
164223164457
break;
164224164458
case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
164225
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-3].minor.yy626 = yymsp[-2].minor.yy626;}
164459
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;}
164226164460
break;
164227164461
case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
164228164462
{
164229
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy607, &yymsp[-4].minor.yy0);
164230
- sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy562,"set list");
164231
- yymsp[-5].minor.yy607 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy607, yymsp[-1].minor.yy607);
164232
- sqlite3Update(pParse,yymsp[-5].minor.yy607,yymsp[-2].minor.yy562,yymsp[0].minor.yy626,yymsp[-6].minor.yy64,0,0,0);
164463
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0);
164464
+ sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list");
164465
+ yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, yymsp[-1].minor.yy131);
164466
+ sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0);
164233164467
}
164234164468
break;
164235164469
case 158: /* setlist ::= setlist COMMA nm EQ expr */
164236164470
{
164237
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[0].minor.yy626);
164238
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, 1);
164471
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
164472
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
164239164473
}
164240164474
break;
164241164475
case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
164242164476
{
164243
- yymsp[-6].minor.yy562 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy562, yymsp[-3].minor.yy240, yymsp[0].minor.yy626);
164477
+ yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
164244164478
}
164245164479
break;
164246164480
case 160: /* setlist ::= nm EQ expr */
164247164481
{
164248
- yylhsminor.yy562 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy626);
164249
- sqlite3ExprListSetName(pParse, yylhsminor.yy562, &yymsp[-2].minor.yy0, 1);
164482
+ yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528);
164483
+ sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
164250164484
}
164251
- yymsp[-2].minor.yy562 = yylhsminor.yy562;
164485
+ yymsp[-2].minor.yy322 = yylhsminor.yy322;
164252164486
break;
164253164487
case 161: /* setlist ::= LP idlist RP EQ expr */
164254164488
{
164255
- yymsp[-4].minor.yy562 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy240, yymsp[0].minor.yy626);
164489
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
164256164490
}
164257164491
break;
164258164492
case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
164259164493
{
164260
- sqlite3Insert(pParse, yymsp[-3].minor.yy607, yymsp[-1].minor.yy303, yymsp[-2].minor.yy240, yymsp[-5].minor.yy64, yymsp[0].minor.yy138);
164494
+ sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444);
164261164495
}
164262164496
break;
164263164497
case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
164264164498
{
164265
- sqlite3Insert(pParse, yymsp[-4].minor.yy607, 0, yymsp[-3].minor.yy240, yymsp[-6].minor.yy64, 0);
164499
+ sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0);
164266164500
}
164267164501
break;
164268164502
case 164: /* upsert ::= */
164269
-{ yymsp[1].minor.yy138 = 0; }
164503
+{ yymsp[1].minor.yy444 = 0; }
164270164504
break;
164271164505
case 165: /* upsert ::= RETURNING selcollist */
164272
-{ yymsp[-1].minor.yy138 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy562); }
164506
+{ yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); }
164273164507
break;
164274164508
case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
164275
-{ yymsp[-11].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy562,yymsp[-6].minor.yy626,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,yymsp[0].minor.yy138);}
164509
+{ yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);}
164276164510
break;
164277164511
case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
164278
-{ yymsp[-8].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy562,yymsp[-3].minor.yy626,0,0,yymsp[0].minor.yy138); }
164512
+{ yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); }
164279164513
break;
164280164514
case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */
164281
-{ yymsp[-4].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
164515
+{ yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
164282164516
break;
164283164517
case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
164284
-{ yymsp[-7].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,0);}
164518
+{ yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);}
164285164519
break;
164286164520
case 170: /* returning ::= RETURNING selcollist */
164287
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy562);}
164521
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy322);}
164288164522
break;
164289164523
case 174: /* idlist_opt ::= LP idlist RP */
164290
-{yymsp[-2].minor.yy240 = yymsp[-1].minor.yy240;}
164524
+{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
164291164525
break;
164292164526
case 175: /* idlist ::= idlist COMMA nm */
164293
-{yymsp[-2].minor.yy240 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy240,&yymsp[0].minor.yy0);}
164527
+{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
164294164528
break;
164295164529
case 176: /* idlist ::= nm */
164296
-{yymsp[0].minor.yy240 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
164530
+{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
164297164531
break;
164298164532
case 177: /* expr ::= LP expr RP */
164299
-{yymsp[-2].minor.yy626 = yymsp[-1].minor.yy626;}
164533
+{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
164300164534
break;
164301164535
case 178: /* expr ::= ID|INDEXED */
164302164536
case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
164303
-{yymsp[0].minor.yy626=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164537
+{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164304164538
break;
164305164539
case 180: /* expr ::= nm DOT nm */
164306164540
{
164307164541
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164308164542
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
164309164543
if( IN_RENAME_OBJECT ){
164310164544
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
164311164545
sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
164312164546
}
164313
- yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
164547
+ yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
164314164548
}
164315
- yymsp[-2].minor.yy626 = yylhsminor.yy626;
164549
+ yymsp[-2].minor.yy528 = yylhsminor.yy528;
164316164550
break;
164317164551
case 181: /* expr ::= nm DOT nm DOT nm */
164318164552
{
164319164553
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
164320164554
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -164322,768 +164556,776 @@
164322164556
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
164323164557
if( IN_RENAME_OBJECT ){
164324164558
sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
164325164559
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
164326164560
}
164327
- yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
164561
+ yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
164328164562
}
164329
- yymsp[-4].minor.yy626 = yylhsminor.yy626;
164563
+ yymsp[-4].minor.yy528 = yylhsminor.yy528;
164330164564
break;
164331164565
case 182: /* term ::= NULL|FLOAT|BLOB */
164332164566
case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
164333
-{yymsp[0].minor.yy626=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164567
+{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164334164568
break;
164335164569
case 184: /* term ::= INTEGER */
164336164570
{
164337
- yylhsminor.yy626 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
164571
+ yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
164338164572
}
164339
- yymsp[0].minor.yy626 = yylhsminor.yy626;
164573
+ yymsp[0].minor.yy528 = yylhsminor.yy528;
164340164574
break;
164341164575
case 185: /* expr ::= VARIABLE */
164342164576
{
164343164577
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
164344164578
u32 n = yymsp[0].minor.yy0.n;
164345
- yymsp[0].minor.yy626 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
164346
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy626, n);
164579
+ yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
164580
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
164347164581
}else{
164348164582
/* When doing a nested parse, one can include terms in an expression
164349164583
** that look like this: #1 #2 ... These terms refer to registers
164350164584
** in the virtual machine. #N is the N-th register. */
164351164585
Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
164352164586
assert( t.n>=2 );
164353164587
if( pParse->nested==0 ){
164354164588
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
164355
- yymsp[0].minor.yy626 = 0;
164589
+ yymsp[0].minor.yy528 = 0;
164356164590
}else{
164357
- yymsp[0].minor.yy626 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
164358
- if( yymsp[0].minor.yy626 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy626->iTable);
164591
+ yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
164592
+ if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
164359164593
}
164360164594
}
164361164595
}
164362164596
break;
164363164597
case 186: /* expr ::= expr COLLATE ID|STRING */
164364164598
{
164365
- yymsp[-2].minor.yy626 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy626, &yymsp[0].minor.yy0, 1);
164599
+ yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
164366164600
}
164367164601
break;
164368164602
case 187: /* expr ::= CAST LP expr AS typetoken RP */
164369164603
{
164370
- yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
164371
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy626, yymsp[-3].minor.yy626, 0);
164604
+ yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
164605
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
164372164606
}
164373164607
break;
164374164608
case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
164375164609
{
164376
- yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy64);
164610
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
164377164611
}
164378
- yymsp[-4].minor.yy626 = yylhsminor.yy626;
164612
+ yymsp[-4].minor.yy528 = yylhsminor.yy528;
164379164613
break;
164380164614
case 189: /* expr ::= ID|INDEXED LP STAR RP */
164381164615
{
164382
- yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
164616
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
164383164617
}
164384
- yymsp[-3].minor.yy626 = yylhsminor.yy626;
164618
+ yymsp[-3].minor.yy528 = yylhsminor.yy528;
164385164619
break;
164386164620
case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
164387164621
{
164388
- yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy562, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy64);
164389
- sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375);
164622
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
164623
+ sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
164390164624
}
164391
- yymsp[-5].minor.yy626 = yylhsminor.yy626;
164625
+ yymsp[-5].minor.yy528 = yylhsminor.yy528;
164392164626
break;
164393164627
case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
164394164628
{
164395
- yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
164396
- sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375);
164629
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
164630
+ sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
164397164631
}
164398
- yymsp[-4].minor.yy626 = yylhsminor.yy626;
164632
+ yymsp[-4].minor.yy528 = yylhsminor.yy528;
164399164633
break;
164400164634
case 192: /* term ::= CTIME_KW */
164401164635
{
164402
- yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
164636
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
164403164637
}
164404
- yymsp[0].minor.yy626 = yylhsminor.yy626;
164638
+ yymsp[0].minor.yy528 = yylhsminor.yy528;
164405164639
break;
164406164640
case 193: /* expr ::= LP nexprlist COMMA expr RP */
164407164641
{
164408
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626);
164409
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
164410
- if( yymsp[-4].minor.yy626 ){
164411
- yymsp[-4].minor.yy626->x.pList = pList;
164642
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
164643
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
164644
+ if( yymsp[-4].minor.yy528 ){
164645
+ yymsp[-4].minor.yy528->x.pList = pList;
164412164646
if( ALWAYS(pList->nExpr) ){
164413
- yymsp[-4].minor.yy626->flags |= pList->a[0].pExpr->flags & EP_Propagate;
164647
+ yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate;
164414164648
}
164415164649
}else{
164416164650
sqlite3ExprListDelete(pParse->db, pList);
164417164651
}
164418164652
}
164419164653
break;
164420164654
case 194: /* expr ::= expr AND expr */
164421
-{yymsp[-2].minor.yy626=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164655
+{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164422164656
break;
164423164657
case 195: /* expr ::= expr OR expr */
164424164658
case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
164425164659
case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
164426164660
case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
164427164661
case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
164428164662
case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
164429164663
case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
164430
-{yymsp[-2].minor.yy626=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164664
+{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164431164665
break;
164432164666
case 202: /* likeop ::= NOT LIKE_KW|MATCH */
164433164667
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
164434164668
break;
164435164669
case 203: /* expr ::= expr likeop expr */
164436164670
{
164437164671
ExprList *pList;
164438164672
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
164439164673
yymsp[-1].minor.yy0.n &= 0x7fffffff;
164440
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy626);
164441
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy626);
164442
- yymsp[-2].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164443
- if( bNot ) yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy626, 0);
164444
- if( yymsp[-2].minor.yy626 ) yymsp[-2].minor.yy626->flags |= EP_InfixFunc;
164674
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
164675
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528);
164676
+ yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164677
+ if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
164678
+ if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
164445164679
}
164446164680
break;
164447164681
case 204: /* expr ::= expr likeop expr ESCAPE expr */
164448164682
{
164449164683
ExprList *pList;
164450164684
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
164451164685
yymsp[-3].minor.yy0.n &= 0x7fffffff;
164452
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164453
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy626);
164454
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626);
164455
- yymsp[-4].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
164456
- if( bNot ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164457
- if( yymsp[-4].minor.yy626 ) yymsp[-4].minor.yy626->flags |= EP_InfixFunc;
164686
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164687
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528);
164688
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
164689
+ yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
164690
+ if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164691
+ if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
164458164692
}
164459164693
break;
164460164694
case 205: /* expr ::= expr ISNULL|NOTNULL */
164461
-{yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy626,0);}
164695
+{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
164462164696
break;
164463164697
case 206: /* expr ::= expr NOT NULL */
164464
-{yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy626,0);}
164698
+{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
164465164699
break;
164466164700
case 207: /* expr ::= expr IS expr */
164467164701
{
164468
- yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);
164469
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-2].minor.yy626, TK_ISNULL);
164702
+ yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
164703
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
164470164704
}
164471164705
break;
164472164706
case 208: /* expr ::= expr IS NOT expr */
164473164707
{
164474
- yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy626,yymsp[0].minor.yy626);
164475
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-3].minor.yy626, TK_NOTNULL);
164708
+ yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
164709
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
164476164710
}
164477164711
break;
164478164712
case 209: /* expr ::= NOT expr */
164479164713
case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210);
164480
-{yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy626, 0);/*A-overwrites-B*/}
164714
+{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
164481164715
break;
164482164716
case 211: /* expr ::= PLUS|MINUS expr */
164483164717
{
164484
- yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy626, 0);
164718
+ yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
164485164719
/*A-overwrites-B*/
164486164720
}
164487164721
break;
164488
- case 212: /* between_op ::= BETWEEN */
164489
- case 215: /* in_op ::= IN */ yytestcase(yyruleno==215);
164490
-{yymsp[0].minor.yy64 = 0;}
164722
+ case 212: /* expr ::= expr PTR expr */
164723
+{
164724
+ ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
164725
+ pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
164726
+ yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164727
+}
164728
+ yymsp[-2].minor.yy528 = yylhsminor.yy528;
164491164729
break;
164492
- case 214: /* expr ::= expr between_op expr AND expr */
164730
+ case 213: /* between_op ::= BETWEEN */
164731
+ case 216: /* in_op ::= IN */ yytestcase(yyruleno==216);
164732
+{yymsp[0].minor.yy394 = 0;}
164733
+ break;
164734
+ case 215: /* expr ::= expr between_op expr AND expr */
164493164735
{
164494
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164495
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626);
164496
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy626, 0);
164497
- if( yymsp[-4].minor.yy626 ){
164498
- yymsp[-4].minor.yy626->x.pList = pList;
164736
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164737
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
164738
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
164739
+ if( yymsp[-4].minor.yy528 ){
164740
+ yymsp[-4].minor.yy528->x.pList = pList;
164499164741
}else{
164500164742
sqlite3ExprListDelete(pParse->db, pList);
164501164743
}
164502
- if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164744
+ if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164503164745
}
164504164746
break;
164505
- case 217: /* expr ::= expr in_op LP exprlist RP */
164747
+ case 218: /* expr ::= expr in_op LP exprlist RP */
164506164748
{
164507
- if( yymsp[-1].minor.yy562==0 ){
164749
+ if( yymsp[-1].minor.yy322==0 ){
164508164750
/* Expressions of the form
164509164751
**
164510164752
** expr1 IN ()
164511164753
** expr1 NOT IN ()
164512164754
**
164513164755
** simplify to constants 0 (false) and 1 (true), respectively,
164514164756
** regardless of the value of expr1.
164515164757
*/
164516
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy626);
164517
- yymsp[-4].minor.yy626 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy64 ? "1" : "0");
164758
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528);
164759
+ yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy394 ? "1" : "0");
164518164760
}else{
164519
- Expr *pRHS = yymsp[-1].minor.yy562->a[0].pExpr;
164520
- if( yymsp[-1].minor.yy562->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy626->op!=TK_VECTOR ){
164521
- yymsp[-1].minor.yy562->a[0].pExpr = 0;
164522
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562);
164761
+ Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
164762
+ if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){
164763
+ yymsp[-1].minor.yy322->a[0].pExpr = 0;
164764
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
164523164765
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
164524
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy626, pRHS);
164766
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS);
164525164767
}else{
164526
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164527
- if( yymsp[-4].minor.yy626==0 ){
164528
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562);
164529
- }else if( yymsp[-4].minor.yy626->pLeft->op==TK_VECTOR ){
164530
- int nExpr = yymsp[-4].minor.yy626->pLeft->x.pList->nExpr;
164531
- Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy562);
164768
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164769
+ if( yymsp[-4].minor.yy528==0 ){
164770
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
164771
+ }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){
164772
+ int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr;
164773
+ Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322);
164532164774
if( pSelectRHS ){
164533164775
parserDoubleLinkSelect(pParse, pSelectRHS);
164534
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelectRHS);
164535
- }
164536
- }else{
164537
- yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy562;
164538
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626);
164539
- }
164540
- }
164541
- if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164542
- }
164543
- }
164544
- break;
164545
- case 218: /* expr ::= LP select RP */
164546
-{
164547
- yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
164548
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy626, yymsp[-1].minor.yy303);
164549
- }
164550
- break;
164551
- case 219: /* expr ::= expr in_op LP select RP */
164552
-{
164553
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164554
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, yymsp[-1].minor.yy303);
164555
- if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164556
- }
164557
- break;
164558
- case 220: /* expr ::= expr in_op nm dbnm paren_exprlist */
164776
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS);
164777
+ }
164778
+ }else{
164779
+ yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322;
164780
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
164781
+ }
164782
+ }
164783
+ if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164784
+ }
164785
+ }
164786
+ break;
164787
+ case 219: /* expr ::= LP select RP */
164788
+{
164789
+ yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
164790
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
164791
+ }
164792
+ break;
164793
+ case 220: /* expr ::= expr in_op LP select RP */
164794
+{
164795
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164796
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
164797
+ if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164798
+ }
164799
+ break;
164800
+ case 221: /* expr ::= expr in_op nm dbnm paren_exprlist */
164559164801
{
164560164802
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
164561164803
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
164562
- if( yymsp[0].minor.yy562 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy562);
164563
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164564
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelect);
164565
- if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164804
+ if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
164805
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164806
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
164807
+ if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164566164808
}
164567164809
break;
164568
- case 221: /* expr ::= EXISTS LP select RP */
164810
+ case 222: /* expr ::= EXISTS LP select RP */
164569164811
{
164570164812
Expr *p;
164571
- p = yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
164572
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy303);
164573
- }
164574
- break;
164575
- case 222: /* expr ::= CASE case_operand case_exprlist case_else END */
164576
-{
164577
- yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy626, 0);
164578
- if( yymsp[-4].minor.yy626 ){
164579
- yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy626 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626) : yymsp[-2].minor.yy562;
164580
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626);
164581
- }else{
164582
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy562);
164583
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626);
164584
- }
164585
-}
164586
- break;
164587
- case 223: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
164588
-{
164589
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[-2].minor.yy626);
164590
- yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[0].minor.yy626);
164591
-}
164592
- break;
164593
- case 224: /* case_exprlist ::= WHEN expr THEN expr */
164594
-{
164595
- yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164596
- yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy562, yymsp[0].minor.yy626);
164597
-}
164598
- break;
164599
- case 227: /* case_operand ::= expr */
164600
-{yymsp[0].minor.yy626 = yymsp[0].minor.yy626; /*A-overwrites-X*/}
164601
- break;
164602
- case 230: /* nexprlist ::= nexprlist COMMA expr */
164603
-{yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[0].minor.yy626);}
164604
- break;
164605
- case 231: /* nexprlist ::= expr */
164606
-{yymsp[0].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy626); /*A-overwrites-Y*/}
164607
- break;
164608
- case 233: /* paren_exprlist ::= LP exprlist RP */
164609
- case 238: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==238);
164610
-{yymsp[-2].minor.yy562 = yymsp[-1].minor.yy562;}
164611
- break;
164612
- case 234: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
164813
+ p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
164814
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
164815
+ }
164816
+ break;
164817
+ case 223: /* expr ::= CASE case_operand case_exprlist case_else END */
164818
+{
164819
+ yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
164820
+ if( yymsp[-4].minor.yy528 ){
164821
+ yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
164822
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
164823
+ }else{
164824
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
164825
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
164826
+ }
164827
+}
164828
+ break;
164829
+ case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
164830
+{
164831
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
164832
+ yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
164833
+}
164834
+ break;
164835
+ case 225: /* case_exprlist ::= WHEN expr THEN expr */
164836
+{
164837
+ yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164838
+ yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
164839
+}
164840
+ break;
164841
+ case 228: /* case_operand ::= expr */
164842
+{yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
164843
+ break;
164844
+ case 231: /* nexprlist ::= nexprlist COMMA expr */
164845
+{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
164846
+ break;
164847
+ case 232: /* nexprlist ::= expr */
164848
+{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
164849
+ break;
164850
+ case 234: /* paren_exprlist ::= LP exprlist RP */
164851
+ case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239);
164852
+{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
164853
+ break;
164854
+ case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
164613164855
{
164614164856
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
164615
- sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy562, yymsp[-10].minor.yy64,
164616
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy626, SQLITE_SO_ASC, yymsp[-8].minor.yy64, SQLITE_IDXTYPE_APPDEF);
164857
+ sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
164858
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
164617164859
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
164618164860
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
164619164861
}
164620164862
}
164621164863
break;
164622
- case 235: /* uniqueflag ::= UNIQUE */
164623
- case 277: /* raisetype ::= ABORT */ yytestcase(yyruleno==277);
164624
-{yymsp[0].minor.yy64 = OE_Abort;}
164625
- break;
164626
- case 236: /* uniqueflag ::= */
164627
-{yymsp[1].minor.yy64 = OE_None;}
164628
- break;
164629
- case 239: /* eidlist ::= eidlist COMMA nm collate sortorder */
164630
-{
164631
- yymsp[-4].minor.yy562 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64);
164632
-}
164633
- break;
164634
- case 240: /* eidlist ::= nm collate sortorder */
164635
-{
164636
- yymsp[-2].minor.yy562 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64); /*A-overwrites-Y*/
164637
-}
164638
- break;
164639
- case 243: /* cmd ::= DROP INDEX ifexists fullname */
164640
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy607, yymsp[-1].minor.yy64);}
164641
- break;
164642
- case 244: /* cmd ::= VACUUM vinto */
164643
-{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy626);}
164644
- break;
164645
- case 245: /* cmd ::= VACUUM nm vinto */
164646
-{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy626);}
164647
- break;
164648
- case 248: /* cmd ::= PRAGMA nm dbnm */
164864
+ case 236: /* uniqueflag ::= UNIQUE */
164865
+ case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278);
164866
+{yymsp[0].minor.yy394 = OE_Abort;}
164867
+ break;
164868
+ case 237: /* uniqueflag ::= */
164869
+{yymsp[1].minor.yy394 = OE_None;}
164870
+ break;
164871
+ case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */
164872
+{
164873
+ yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
164874
+}
164875
+ break;
164876
+ case 241: /* eidlist ::= nm collate sortorder */
164877
+{
164878
+ yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
164879
+}
164880
+ break;
164881
+ case 244: /* cmd ::= DROP INDEX ifexists fullname */
164882
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
164883
+ break;
164884
+ case 245: /* cmd ::= VACUUM vinto */
164885
+{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
164886
+ break;
164887
+ case 246: /* cmd ::= VACUUM nm vinto */
164888
+{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
164889
+ break;
164890
+ case 249: /* cmd ::= PRAGMA nm dbnm */
164649164891
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
164650164892
break;
164651
- case 249: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
164893
+ case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
164652164894
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
164653164895
break;
164654
- case 250: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
164896
+ case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
164655164897
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
164656164898
break;
164657
- case 251: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
164899
+ case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
164658164900
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
164659164901
break;
164660
- case 252: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
164902
+ case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
164661164903
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
164662164904
break;
164663
- case 255: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
164905
+ case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
164664164906
{
164665164907
Token all;
164666164908
all.z = yymsp[-3].minor.yy0.z;
164667164909
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
164668
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy95, &all);
164910
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
164669164911
}
164670164912
break;
164671
- case 256: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
164913
+ case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
164672164914
{
164673
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy64, yymsp[-4].minor.yy570.a, yymsp[-4].minor.yy570.b, yymsp[-2].minor.yy607, yymsp[0].minor.yy626, yymsp[-10].minor.yy64, yymsp[-8].minor.yy64);
164915
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
164674164916
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
164675164917
}
164676164918
break;
164677
- case 257: /* trigger_time ::= BEFORE|AFTER */
164678
-{ yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/ }
164679
- break;
164680
- case 258: /* trigger_time ::= INSTEAD OF */
164681
-{ yymsp[-1].minor.yy64 = TK_INSTEAD;}
164682
- break;
164683
- case 259: /* trigger_time ::= */
164684
-{ yymsp[1].minor.yy64 = TK_BEFORE; }
164685
- break;
164686
- case 260: /* trigger_event ::= DELETE|INSERT */
164687
- case 261: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==261);
164688
-{yymsp[0].minor.yy570.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy570.b = 0;}
164689
- break;
164690
- case 262: /* trigger_event ::= UPDATE OF idlist */
164691
-{yymsp[-2].minor.yy570.a = TK_UPDATE; yymsp[-2].minor.yy570.b = yymsp[0].minor.yy240;}
164692
- break;
164693
- case 263: /* when_clause ::= */
164694
- case 282: /* key_opt ::= */ yytestcase(yyruleno==282);
164695
-{ yymsp[1].minor.yy626 = 0; }
164696
- break;
164697
- case 264: /* when_clause ::= WHEN expr */
164698
- case 283: /* key_opt ::= KEY expr */ yytestcase(yyruleno==283);
164699
-{ yymsp[-1].minor.yy626 = yymsp[0].minor.yy626; }
164700
- break;
164701
- case 265: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
164702
-{
164703
- assert( yymsp[-2].minor.yy95!=0 );
164704
- yymsp[-2].minor.yy95->pLast->pNext = yymsp[-1].minor.yy95;
164705
- yymsp[-2].minor.yy95->pLast = yymsp[-1].minor.yy95;
164706
-}
164707
- break;
164708
- case 266: /* trigger_cmd_list ::= trigger_cmd SEMI */
164709
-{
164710
- assert( yymsp[-1].minor.yy95!=0 );
164711
- yymsp[-1].minor.yy95->pLast = yymsp[-1].minor.yy95;
164712
-}
164713
- break;
164714
- case 267: /* trnm ::= nm DOT nm */
164919
+ case 258: /* trigger_time ::= BEFORE|AFTER */
164920
+{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
164921
+ break;
164922
+ case 259: /* trigger_time ::= INSTEAD OF */
164923
+{ yymsp[-1].minor.yy394 = TK_INSTEAD;}
164924
+ break;
164925
+ case 260: /* trigger_time ::= */
164926
+{ yymsp[1].minor.yy394 = TK_BEFORE; }
164927
+ break;
164928
+ case 261: /* trigger_event ::= DELETE|INSERT */
164929
+ case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262);
164930
+{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
164931
+ break;
164932
+ case 263: /* trigger_event ::= UPDATE OF idlist */
164933
+{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
164934
+ break;
164935
+ case 264: /* when_clause ::= */
164936
+ case 283: /* key_opt ::= */ yytestcase(yyruleno==283);
164937
+{ yymsp[1].minor.yy528 = 0; }
164938
+ break;
164939
+ case 265: /* when_clause ::= WHEN expr */
164940
+ case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284);
164941
+{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
164942
+ break;
164943
+ case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
164944
+{
164945
+ assert( yymsp[-2].minor.yy33!=0 );
164946
+ yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
164947
+ yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
164948
+}
164949
+ break;
164950
+ case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */
164951
+{
164952
+ assert( yymsp[-1].minor.yy33!=0 );
164953
+ yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
164954
+}
164955
+ break;
164956
+ case 268: /* trnm ::= nm DOT nm */
164715164957
{
164716164958
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
164717164959
sqlite3ErrorMsg(pParse,
164718164960
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
164719164961
"statements within triggers");
164720164962
}
164721164963
break;
164722
- case 268: /* tridxby ::= INDEXED BY nm */
164964
+ case 269: /* tridxby ::= INDEXED BY nm */
164723164965
{
164724164966
sqlite3ErrorMsg(pParse,
164725164967
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
164726164968
"within triggers");
164727164969
}
164728164970
break;
164729
- case 269: /* tridxby ::= NOT INDEXED */
164971
+ case 270: /* tridxby ::= NOT INDEXED */
164730164972
{
164731164973
sqlite3ErrorMsg(pParse,
164732164974
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
164733164975
"within triggers");
164734164976
}
164735164977
break;
164736
- case 270: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
164737
-{yylhsminor.yy95 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy607, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626, yymsp[-7].minor.yy64, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy600);}
164738
- yymsp[-8].minor.yy95 = yylhsminor.yy95;
164739
- break;
164740
- case 271: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
164741
-{
164742
- yylhsminor.yy95 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy240,yymsp[-2].minor.yy303,yymsp[-6].minor.yy64,yymsp[-1].minor.yy138,yymsp[-7].minor.yy600,yymsp[0].minor.yy600);/*yylhsminor.yy95-overwrites-yymsp[-6].minor.yy64*/
164743
-}
164744
- yymsp[-7].minor.yy95 = yylhsminor.yy95;
164745
- break;
164746
- case 272: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
164747
-{yylhsminor.yy95 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy626, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy600);}
164748
- yymsp[-5].minor.yy95 = yylhsminor.yy95;
164749
- break;
164750
- case 273: /* trigger_cmd ::= scanpt select scanpt */
164751
-{yylhsminor.yy95 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy303, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); /*yylhsminor.yy95-overwrites-yymsp[-1].minor.yy303*/}
164752
- yymsp[-2].minor.yy95 = yylhsminor.yy95;
164753
- break;
164754
- case 274: /* expr ::= RAISE LP IGNORE RP */
164755
-{
164756
- yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
164757
- if( yymsp[-3].minor.yy626 ){
164758
- yymsp[-3].minor.yy626->affExpr = OE_Ignore;
164759
- }
164760
-}
164761
- break;
164762
- case 275: /* expr ::= RAISE LP raisetype COMMA nm RP */
164763
-{
164764
- yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
164765
- if( yymsp[-5].minor.yy626 ) {
164766
- yymsp[-5].minor.yy626->affExpr = (char)yymsp[-3].minor.yy64;
164767
- }
164768
-}
164769
- break;
164770
- case 276: /* raisetype ::= ROLLBACK */
164771
-{yymsp[0].minor.yy64 = OE_Rollback;}
164772
- break;
164773
- case 278: /* raisetype ::= FAIL */
164774
-{yymsp[0].minor.yy64 = OE_Fail;}
164775
- break;
164776
- case 279: /* cmd ::= DROP TRIGGER ifexists fullname */
164777
-{
164778
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy607,yymsp[-1].minor.yy64);
164779
-}
164780
- break;
164781
- case 280: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
164782
-{
164783
- sqlite3Attach(pParse, yymsp[-3].minor.yy626, yymsp[-1].minor.yy626, yymsp[0].minor.yy626);
164784
-}
164785
- break;
164786
- case 281: /* cmd ::= DETACH database_kw_opt expr */
164787
-{
164788
- sqlite3Detach(pParse, yymsp[0].minor.yy626);
164789
-}
164790
- break;
164791
- case 284: /* cmd ::= REINDEX */
164978
+ case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
164979
+{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
164980
+ yymsp[-8].minor.yy33 = yylhsminor.yy33;
164981
+ break;
164982
+ case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
164983
+{
164984
+ yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
164985
+}
164986
+ yymsp[-7].minor.yy33 = yylhsminor.yy33;
164987
+ break;
164988
+ case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
164989
+{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
164990
+ yymsp[-5].minor.yy33 = yylhsminor.yy33;
164991
+ break;
164992
+ case 274: /* trigger_cmd ::= scanpt select scanpt */
164993
+{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
164994
+ yymsp[-2].minor.yy33 = yylhsminor.yy33;
164995
+ break;
164996
+ case 275: /* expr ::= RAISE LP IGNORE RP */
164997
+{
164998
+ yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
164999
+ if( yymsp[-3].minor.yy528 ){
165000
+ yymsp[-3].minor.yy528->affExpr = OE_Ignore;
165001
+ }
165002
+}
165003
+ break;
165004
+ case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */
165005
+{
165006
+ yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
165007
+ if( yymsp[-5].minor.yy528 ) {
165008
+ yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
165009
+ }
165010
+}
165011
+ break;
165012
+ case 277: /* raisetype ::= ROLLBACK */
165013
+{yymsp[0].minor.yy394 = OE_Rollback;}
165014
+ break;
165015
+ case 279: /* raisetype ::= FAIL */
165016
+{yymsp[0].minor.yy394 = OE_Fail;}
165017
+ break;
165018
+ case 280: /* cmd ::= DROP TRIGGER ifexists fullname */
165019
+{
165020
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
165021
+}
165022
+ break;
165023
+ case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
165024
+{
165025
+ sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
165026
+}
165027
+ break;
165028
+ case 282: /* cmd ::= DETACH database_kw_opt expr */
165029
+{
165030
+ sqlite3Detach(pParse, yymsp[0].minor.yy528);
165031
+}
165032
+ break;
165033
+ case 285: /* cmd ::= REINDEX */
164792165034
{sqlite3Reindex(pParse, 0, 0);}
164793165035
break;
164794
- case 285: /* cmd ::= REINDEX nm dbnm */
165036
+ case 286: /* cmd ::= REINDEX nm dbnm */
164795165037
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
164796165038
break;
164797
- case 286: /* cmd ::= ANALYZE */
165039
+ case 287: /* cmd ::= ANALYZE */
164798165040
{sqlite3Analyze(pParse, 0, 0);}
164799165041
break;
164800
- case 287: /* cmd ::= ANALYZE nm dbnm */
165042
+ case 288: /* cmd ::= ANALYZE nm dbnm */
164801165043
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
164802165044
break;
164803
- case 288: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
165045
+ case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
164804165046
{
164805
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy607,&yymsp[0].minor.yy0);
165047
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
164806165048
}
164807165049
break;
164808
- case 289: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
165050
+ case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
164809165051
{
164810165052
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
164811165053
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
164812165054
}
164813165055
break;
164814
- case 290: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
165056
+ case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
164815165057
{
164816
- sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy607, &yymsp[0].minor.yy0);
165058
+ sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
164817165059
}
164818165060
break;
164819
- case 291: /* add_column_fullname ::= fullname */
165061
+ case 292: /* add_column_fullname ::= fullname */
164820165062
{
164821165063
disableLookaside(pParse);
164822
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy607);
164823
-}
164824
- break;
164825
- case 292: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
164826
-{
164827
- sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy607, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
164828
-}
164829
- break;
164830
- case 293: /* cmd ::= create_vtab */
165064
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
165065
+}
165066
+ break;
165067
+ case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
165068
+{
165069
+ sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
165070
+}
165071
+ break;
165072
+ case 294: /* cmd ::= create_vtab */
164831165073
{sqlite3VtabFinishParse(pParse,0);}
164832165074
break;
164833
- case 294: /* cmd ::= create_vtab LP vtabarglist RP */
165075
+ case 295: /* cmd ::= create_vtab LP vtabarglist RP */
164834165076
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
164835165077
break;
164836
- case 295: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
165078
+ case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
164837165079
{
164838
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy64);
165080
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
164839165081
}
164840165082
break;
164841
- case 296: /* vtabarg ::= */
165083
+ case 297: /* vtabarg ::= */
164842165084
{sqlite3VtabArgInit(pParse);}
164843165085
break;
164844
- case 297: /* vtabargtoken ::= ANY */
164845
- case 298: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==298);
164846
- case 299: /* lp ::= LP */ yytestcase(yyruleno==299);
165086
+ case 298: /* vtabargtoken ::= ANY */
165087
+ case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299);
165088
+ case 300: /* lp ::= LP */ yytestcase(yyruleno==300);
164847165089
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
164848165090
break;
164849
- case 300: /* with ::= WITH wqlist */
164850
- case 301: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==301);
164851
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy43, 1); }
164852
- break;
164853
- case 302: /* wqas ::= AS */
164854
-{yymsp[0].minor.yy534 = M10d_Any;}
164855
- break;
164856
- case 303: /* wqas ::= AS MATERIALIZED */
164857
-{yymsp[-1].minor.yy534 = M10d_Yes;}
164858
- break;
164859
- case 304: /* wqas ::= AS NOT MATERIALIZED */
164860
-{yymsp[-2].minor.yy534 = M10d_No;}
164861
- break;
164862
- case 305: /* wqitem ::= nm eidlist_opt wqas LP select RP */
164863
-{
164864
- yymsp[-5].minor.yy255 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy562, yymsp[-1].minor.yy303, yymsp[-3].minor.yy534); /*A-overwrites-X*/
164865
-}
164866
- break;
164867
- case 306: /* wqlist ::= wqitem */
164868
-{
164869
- yymsp[0].minor.yy43 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy255); /*A-overwrites-X*/
164870
-}
164871
- break;
164872
- case 307: /* wqlist ::= wqlist COMMA wqitem */
164873
-{
164874
- yymsp[-2].minor.yy43 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy43, yymsp[0].minor.yy255);
164875
-}
164876
- break;
164877
- case 308: /* windowdefn_list ::= windowdefn */
164878
-{ yylhsminor.yy375 = yymsp[0].minor.yy375; }
164879
- yymsp[0].minor.yy375 = yylhsminor.yy375;
164880
- break;
164881
- case 309: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
164882
-{
164883
- assert( yymsp[0].minor.yy375!=0 );
164884
- sqlite3WindowChain(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy375);
164885
- yymsp[0].minor.yy375->pNextWin = yymsp[-2].minor.yy375;
164886
- yylhsminor.yy375 = yymsp[0].minor.yy375;
164887
-}
164888
- yymsp[-2].minor.yy375 = yylhsminor.yy375;
164889
- break;
164890
- case 310: /* windowdefn ::= nm AS LP window RP */
164891
-{
164892
- if( ALWAYS(yymsp[-1].minor.yy375) ){
164893
- yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
164894
- }
164895
- yylhsminor.yy375 = yymsp[-1].minor.yy375;
164896
-}
164897
- yymsp[-4].minor.yy375 = yylhsminor.yy375;
164898
- break;
164899
- case 311: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
164900
-{
164901
- yymsp[-4].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, 0);
164902
-}
164903
- break;
164904
- case 312: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
164905
-{
164906
- yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, &yymsp[-5].minor.yy0);
164907
-}
164908
- yymsp[-5].minor.yy375 = yylhsminor.yy375;
164909
- break;
164910
- case 313: /* window ::= ORDER BY sortlist frame_opt */
164911
-{
164912
- yymsp[-3].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, 0);
164913
-}
164914
- break;
164915
- case 314: /* window ::= nm ORDER BY sortlist frame_opt */
164916
-{
164917
- yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0);
164918
-}
164919
- yymsp[-4].minor.yy375 = yylhsminor.yy375;
164920
- break;
164921
- case 315: /* window ::= frame_opt */
164922
- case 334: /* filter_over ::= over_clause */ yytestcase(yyruleno==334);
164923
-{
164924
- yylhsminor.yy375 = yymsp[0].minor.yy375;
164925
-}
164926
- yymsp[0].minor.yy375 = yylhsminor.yy375;
164927
- break;
164928
- case 316: /* window ::= nm frame_opt */
164929
-{
164930
- yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, 0, &yymsp[-1].minor.yy0);
164931
-}
164932
- yymsp[-1].minor.yy375 = yylhsminor.yy375;
164933
- break;
164934
- case 317: /* frame_opt ::= */
164935
-{
164936
- yymsp[1].minor.yy375 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
164937
-}
164938
- break;
164939
- case 318: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
164940
-{
164941
- yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy64, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy534);
164942
-}
164943
- yymsp[-2].minor.yy375 = yylhsminor.yy375;
164944
- break;
164945
- case 319: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
164946
-{
164947
- yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy64, yymsp[-3].minor.yy81.eType, yymsp[-3].minor.yy81.pExpr, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, yymsp[0].minor.yy534);
164948
-}
164949
- yymsp[-5].minor.yy375 = yylhsminor.yy375;
164950
- break;
164951
- case 321: /* frame_bound_s ::= frame_bound */
164952
- case 323: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==323);
164953
-{yylhsminor.yy81 = yymsp[0].minor.yy81;}
164954
- yymsp[0].minor.yy81 = yylhsminor.yy81;
164955
- break;
164956
- case 322: /* frame_bound_s ::= UNBOUNDED PRECEDING */
164957
- case 324: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==324);
164958
- case 326: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==326);
164959
-{yylhsminor.yy81.eType = yymsp[-1].major; yylhsminor.yy81.pExpr = 0;}
164960
- yymsp[-1].minor.yy81 = yylhsminor.yy81;
164961
- break;
164962
- case 325: /* frame_bound ::= expr PRECEDING|FOLLOWING */
164963
-{yylhsminor.yy81.eType = yymsp[0].major; yylhsminor.yy81.pExpr = yymsp[-1].minor.yy626;}
164964
- yymsp[-1].minor.yy81 = yylhsminor.yy81;
164965
- break;
164966
- case 327: /* frame_exclude_opt ::= */
164967
-{yymsp[1].minor.yy534 = 0;}
164968
- break;
164969
- case 328: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
164970
-{yymsp[-1].minor.yy534 = yymsp[0].minor.yy534;}
164971
- break;
164972
- case 329: /* frame_exclude ::= NO OTHERS */
164973
- case 330: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==330);
164974
-{yymsp[-1].minor.yy534 = yymsp[-1].major; /*A-overwrites-X*/}
164975
- break;
164976
- case 331: /* frame_exclude ::= GROUP|TIES */
164977
-{yymsp[0].minor.yy534 = yymsp[0].major; /*A-overwrites-X*/}
164978
- break;
164979
- case 332: /* window_clause ::= WINDOW windowdefn_list */
164980
-{ yymsp[-1].minor.yy375 = yymsp[0].minor.yy375; }
164981
- break;
164982
- case 333: /* filter_over ::= filter_clause over_clause */
164983
-{
164984
- if( yymsp[0].minor.yy375 ){
164985
- yymsp[0].minor.yy375->pFilter = yymsp[-1].minor.yy626;
164986
- }else{
164987
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626);
164988
- }
164989
- yylhsminor.yy375 = yymsp[0].minor.yy375;
164990
-}
164991
- yymsp[-1].minor.yy375 = yylhsminor.yy375;
164992
- break;
164993
- case 335: /* filter_over ::= filter_clause */
164994
-{
164995
- yylhsminor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
164996
- if( yylhsminor.yy375 ){
164997
- yylhsminor.yy375->eFrmType = TK_FILTER;
164998
- yylhsminor.yy375->pFilter = yymsp[0].minor.yy626;
164999
- }else{
165000
- sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy626);
165001
- }
165002
-}
165003
- yymsp[0].minor.yy375 = yylhsminor.yy375;
165004
- break;
165005
- case 336: /* over_clause ::= OVER LP window RP */
165006
-{
165007
- yymsp[-3].minor.yy375 = yymsp[-1].minor.yy375;
165008
- assert( yymsp[-3].minor.yy375!=0 );
165009
-}
165010
- break;
165011
- case 337: /* over_clause ::= OVER nm */
165012
-{
165013
- yymsp[-1].minor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165014
- if( yymsp[-1].minor.yy375 ){
165015
- yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
165016
- }
165017
-}
165018
- break;
165019
- case 338: /* filter_clause ::= FILTER LP WHERE expr RP */
165020
-{ yymsp[-4].minor.yy626 = yymsp[-1].minor.yy626; }
165091
+ case 301: /* with ::= WITH wqlist */
165092
+ case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302);
165093
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
165094
+ break;
165095
+ case 303: /* wqas ::= AS */
165096
+{yymsp[0].minor.yy516 = M10d_Any;}
165097
+ break;
165098
+ case 304: /* wqas ::= AS MATERIALIZED */
165099
+{yymsp[-1].minor.yy516 = M10d_Yes;}
165100
+ break;
165101
+ case 305: /* wqas ::= AS NOT MATERIALIZED */
165102
+{yymsp[-2].minor.yy516 = M10d_No;}
165103
+ break;
165104
+ case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */
165105
+{
165106
+ yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
165107
+}
165108
+ break;
165109
+ case 307: /* wqlist ::= wqitem */
165110
+{
165111
+ yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
165112
+}
165113
+ break;
165114
+ case 308: /* wqlist ::= wqlist COMMA wqitem */
165115
+{
165116
+ yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
165117
+}
165118
+ break;
165119
+ case 309: /* windowdefn_list ::= windowdefn */
165120
+{ yylhsminor.yy41 = yymsp[0].minor.yy41; }
165121
+ yymsp[0].minor.yy41 = yylhsminor.yy41;
165122
+ break;
165123
+ case 310: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
165124
+{
165125
+ assert( yymsp[0].minor.yy41!=0 );
165126
+ sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
165127
+ yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
165128
+ yylhsminor.yy41 = yymsp[0].minor.yy41;
165129
+}
165130
+ yymsp[-2].minor.yy41 = yylhsminor.yy41;
165131
+ break;
165132
+ case 311: /* windowdefn ::= nm AS LP window RP */
165133
+{
165134
+ if( ALWAYS(yymsp[-1].minor.yy41) ){
165135
+ yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
165136
+ }
165137
+ yylhsminor.yy41 = yymsp[-1].minor.yy41;
165138
+}
165139
+ yymsp[-4].minor.yy41 = yylhsminor.yy41;
165140
+ break;
165141
+ case 312: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
165142
+{
165143
+ yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
165144
+}
165145
+ break;
165146
+ case 313: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
165147
+{
165148
+ yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
165149
+}
165150
+ yymsp[-5].minor.yy41 = yylhsminor.yy41;
165151
+ break;
165152
+ case 314: /* window ::= ORDER BY sortlist frame_opt */
165153
+{
165154
+ yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
165155
+}
165156
+ break;
165157
+ case 315: /* window ::= nm ORDER BY sortlist frame_opt */
165158
+{
165159
+ yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
165160
+}
165161
+ yymsp[-4].minor.yy41 = yylhsminor.yy41;
165162
+ break;
165163
+ case 316: /* window ::= frame_opt */
165164
+ case 335: /* filter_over ::= over_clause */ yytestcase(yyruleno==335);
165165
+{
165166
+ yylhsminor.yy41 = yymsp[0].minor.yy41;
165167
+}
165168
+ yymsp[0].minor.yy41 = yylhsminor.yy41;
165169
+ break;
165170
+ case 317: /* window ::= nm frame_opt */
165171
+{
165172
+ yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
165173
+}
165174
+ yymsp[-1].minor.yy41 = yylhsminor.yy41;
165175
+ break;
165176
+ case 318: /* frame_opt ::= */
165177
+{
165178
+ yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
165179
+}
165180
+ break;
165181
+ case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
165182
+{
165183
+ yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
165184
+}
165185
+ yymsp[-2].minor.yy41 = yylhsminor.yy41;
165186
+ break;
165187
+ case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
165188
+{
165189
+ yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
165190
+}
165191
+ yymsp[-5].minor.yy41 = yylhsminor.yy41;
165192
+ break;
165193
+ case 322: /* frame_bound_s ::= frame_bound */
165194
+ case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324);
165195
+{yylhsminor.yy595 = yymsp[0].minor.yy595;}
165196
+ yymsp[0].minor.yy595 = yylhsminor.yy595;
165197
+ break;
165198
+ case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */
165199
+ case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325);
165200
+ case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327);
165201
+{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
165202
+ yymsp[-1].minor.yy595 = yylhsminor.yy595;
165203
+ break;
165204
+ case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */
165205
+{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
165206
+ yymsp[-1].minor.yy595 = yylhsminor.yy595;
165207
+ break;
165208
+ case 328: /* frame_exclude_opt ::= */
165209
+{yymsp[1].minor.yy516 = 0;}
165210
+ break;
165211
+ case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
165212
+{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
165213
+ break;
165214
+ case 330: /* frame_exclude ::= NO OTHERS */
165215
+ case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331);
165216
+{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
165217
+ break;
165218
+ case 332: /* frame_exclude ::= GROUP|TIES */
165219
+{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
165220
+ break;
165221
+ case 333: /* window_clause ::= WINDOW windowdefn_list */
165222
+{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
165223
+ break;
165224
+ case 334: /* filter_over ::= filter_clause over_clause */
165225
+{
165226
+ if( yymsp[0].minor.yy41 ){
165227
+ yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
165228
+ }else{
165229
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
165230
+ }
165231
+ yylhsminor.yy41 = yymsp[0].minor.yy41;
165232
+}
165233
+ yymsp[-1].minor.yy41 = yylhsminor.yy41;
165234
+ break;
165235
+ case 336: /* filter_over ::= filter_clause */
165236
+{
165237
+ yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165238
+ if( yylhsminor.yy41 ){
165239
+ yylhsminor.yy41->eFrmType = TK_FILTER;
165240
+ yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
165241
+ }else{
165242
+ sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
165243
+ }
165244
+}
165245
+ yymsp[0].minor.yy41 = yylhsminor.yy41;
165246
+ break;
165247
+ case 337: /* over_clause ::= OVER LP window RP */
165248
+{
165249
+ yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
165250
+ assert( yymsp[-3].minor.yy41!=0 );
165251
+}
165252
+ break;
165253
+ case 338: /* over_clause ::= OVER nm */
165254
+{
165255
+ yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165256
+ if( yymsp[-1].minor.yy41 ){
165257
+ yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
165258
+ }
165259
+}
165260
+ break;
165261
+ case 339: /* filter_clause ::= FILTER LP WHERE expr RP */
165262
+{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
165021165263
break;
165022165264
default:
165023
- /* (339) input ::= cmdlist */ yytestcase(yyruleno==339);
165024
- /* (340) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==340);
165025
- /* (341) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=341);
165026
- /* (342) ecmd ::= SEMI */ yytestcase(yyruleno==342);
165027
- /* (343) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==343);
165028
- /* (344) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=344);
165029
- /* (345) trans_opt ::= */ yytestcase(yyruleno==345);
165030
- /* (346) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==346);
165031
- /* (347) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==347);
165032
- /* (348) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==348);
165033
- /* (349) savepoint_opt ::= */ yytestcase(yyruleno==349);
165034
- /* (350) cmd ::= create_table create_table_args */ yytestcase(yyruleno==350);
165035
- /* (351) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=351);
165036
- /* (352) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==352);
165037
- /* (353) columnlist ::= columnname carglist */ yytestcase(yyruleno==353);
165038
- /* (354) nm ::= ID|INDEXED */ yytestcase(yyruleno==354);
165039
- /* (355) nm ::= STRING */ yytestcase(yyruleno==355);
165040
- /* (356) nm ::= JOIN_KW */ yytestcase(yyruleno==356);
165041
- /* (357) typetoken ::= typename */ yytestcase(yyruleno==357);
165042
- /* (358) typename ::= ID|STRING */ yytestcase(yyruleno==358);
165043
- /* (359) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=359);
165044
- /* (360) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
165045
- /* (361) carglist ::= carglist ccons */ yytestcase(yyruleno==361);
165046
- /* (362) carglist ::= */ yytestcase(yyruleno==362);
165047
- /* (363) ccons ::= NULL onconf */ yytestcase(yyruleno==363);
165048
- /* (364) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==364);
165049
- /* (365) ccons ::= AS generated */ yytestcase(yyruleno==365);
165050
- /* (366) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==366);
165051
- /* (367) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==367);
165052
- /* (368) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=368);
165053
- /* (369) tconscomma ::= */ yytestcase(yyruleno==369);
165054
- /* (370) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=370);
165055
- /* (371) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=371);
165056
- /* (372) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=372);
165057
- /* (373) oneselect ::= values */ yytestcase(yyruleno==373);
165058
- /* (374) sclp ::= selcollist COMMA */ yytestcase(yyruleno==374);
165059
- /* (375) as ::= ID|STRING */ yytestcase(yyruleno==375);
165060
- /* (376) returning ::= */ yytestcase(yyruleno==376);
165061
- /* (377) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=377);
165062
- /* (378) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==378);
165063
- /* (379) exprlist ::= nexprlist */ yytestcase(yyruleno==379);
165064
- /* (380) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=380);
165065
- /* (381) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=381);
165066
- /* (382) nmnum ::= ON */ yytestcase(yyruleno==382);
165067
- /* (383) nmnum ::= DELETE */ yytestcase(yyruleno==383);
165068
- /* (384) nmnum ::= DEFAULT */ yytestcase(yyruleno==384);
165069
- /* (385) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==385);
165070
- /* (386) foreach_clause ::= */ yytestcase(yyruleno==386);
165071
- /* (387) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==387);
165072
- /* (388) trnm ::= nm */ yytestcase(yyruleno==388);
165073
- /* (389) tridxby ::= */ yytestcase(yyruleno==389);
165074
- /* (390) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==390);
165075
- /* (391) database_kw_opt ::= */ yytestcase(yyruleno==391);
165076
- /* (392) kwcolumn_opt ::= */ yytestcase(yyruleno==392);
165077
- /* (393) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==393);
165078
- /* (394) vtabarglist ::= vtabarg */ yytestcase(yyruleno==394);
165079
- /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==395);
165080
- /* (396) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==396);
165081
- /* (397) anylist ::= */ yytestcase(yyruleno==397);
165082
- /* (398) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==398);
165083
- /* (399) anylist ::= anylist ANY */ yytestcase(yyruleno==399);
165084
- /* (400) with ::= */ yytestcase(yyruleno==400);
165265
+ /* (340) input ::= cmdlist */ yytestcase(yyruleno==340);
165266
+ /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341);
165267
+ /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342);
165268
+ /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343);
165269
+ /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344);
165270
+ /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345);
165271
+ /* (346) trans_opt ::= */ yytestcase(yyruleno==346);
165272
+ /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347);
165273
+ /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348);
165274
+ /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349);
165275
+ /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350);
165276
+ /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351);
165277
+ /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352);
165278
+ /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353);
165279
+ /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354);
165280
+ /* (355) nm ::= ID|INDEXED */ yytestcase(yyruleno==355);
165281
+ /* (356) nm ::= STRING */ yytestcase(yyruleno==356);
165282
+ /* (357) nm ::= JOIN_KW */ yytestcase(yyruleno==357);
165283
+ /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
165284
+ /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
165285
+ /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
165286
+ /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
165287
+ /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
165288
+ /* (363) carglist ::= */ yytestcase(yyruleno==363);
165289
+ /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
165290
+ /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
165291
+ /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
165292
+ /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
165293
+ /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
165294
+ /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
165295
+ /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
165296
+ /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
165297
+ /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
165298
+ /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
165299
+ /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
165300
+ /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
165301
+ /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
165302
+ /* (377) returning ::= */ yytestcase(yyruleno==377);
165303
+ /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378);
165304
+ /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379);
165305
+ /* (380) exprlist ::= nexprlist */ yytestcase(yyruleno==380);
165306
+ /* (381) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=381);
165307
+ /* (382) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=382);
165308
+ /* (383) nmnum ::= ON */ yytestcase(yyruleno==383);
165309
+ /* (384) nmnum ::= DELETE */ yytestcase(yyruleno==384);
165310
+ /* (385) nmnum ::= DEFAULT */ yytestcase(yyruleno==385);
165311
+ /* (386) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==386);
165312
+ /* (387) foreach_clause ::= */ yytestcase(yyruleno==387);
165313
+ /* (388) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==388);
165314
+ /* (389) trnm ::= nm */ yytestcase(yyruleno==389);
165315
+ /* (390) tridxby ::= */ yytestcase(yyruleno==390);
165316
+ /* (391) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==391);
165317
+ /* (392) database_kw_opt ::= */ yytestcase(yyruleno==392);
165318
+ /* (393) kwcolumn_opt ::= */ yytestcase(yyruleno==393);
165319
+ /* (394) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==394);
165320
+ /* (395) vtabarglist ::= vtabarg */ yytestcase(yyruleno==395);
165321
+ /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==396);
165322
+ /* (397) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==397);
165323
+ /* (398) anylist ::= */ yytestcase(yyruleno==398);
165324
+ /* (399) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==399);
165325
+ /* (400) anylist ::= anylist ANY */ yytestcase(yyruleno==400);
165326
+ /* (401) with ::= */ yytestcase(yyruleno==401);
165085165327
break;
165086165328
/********** End reduce actions ************************************************/
165087165329
};
165088165330
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
165089165331
yygoto = yyRuleInfoLhs[yyruleno];
@@ -166202,10 +166444,13 @@
166202166444
case CC_MINUS: {
166203166445
if( z[1]=='-' ){
166204166446
for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
166205166447
*tokenType = TK_SPACE; /* IMP: R-22934-25134 */
166206166448
return i;
166449
+ }else if( z[1]=='>' ){
166450
+ *tokenType = TK_PTR;
166451
+ return 2 + (z[2]=='>');
166207166452
}
166208166453
*tokenType = TK_MINUS;
166209166454
return 1;
166210166455
}
166211166456
case CC_LP: {
@@ -166471,17 +166716,13 @@
166471166716
*tokenType = TK_ID;
166472166717
return i;
166473166718
}
166474166719
166475166720
/*
166476
-** Run the parser on the given SQL string. The parser structure is
166477
-** passed in. An SQLITE_ status code is returned. If an error occurs
166478
-** then an and attempt is made to write an error message into
166479
-** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
166480
-** error message.
166721
+** Run the parser on the given SQL string.
166481166722
*/
166482
-SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
166723
+SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
166483166724
int nErr = 0; /* Number of errors encountered */
166484166725
void *pEngine; /* The LEMON-generated LALR(1) parser */
166485166726
int n = 0; /* Length of the next token token */
166486166727
int tokenType; /* type of the next token */
166487166728
int lastTokenParsed = -1; /* type of the previous token */
@@ -166498,11 +166739,10 @@
166498166739
if( db->nVdbeActive==0 ){
166499166740
AtomicStore(&db->u1.isInterrupted, 0);
166500166741
}
166501166742
pParse->rc = SQLITE_OK;
166502166743
pParse->zTail = zSql;
166503
- assert( pzErrMsg!=0 );
166504166744
#ifdef SQLITE_DEBUG
166505166745
if( db->flags & SQLITE_ParserTrace ){
166506166746
printf("parser: [[[%s]]]\n", zSql);
166507166747
sqlite3ParserTrace(stdout, "parser: ");
166508166748
}else{
@@ -166541,10 +166781,11 @@
166541166781
if( tokenType>=TK_SPACE ){
166542166782
assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
166543166783
#endif /* SQLITE_OMIT_WINDOWFUNC */
166544166784
if( AtomicLoad(&db->u1.isInterrupted) ){
166545166785
pParse->rc = SQLITE_INTERRUPT;
166786
+ pParse->nErr++;
166546166787
break;
166547166788
}
166548166789
if( tokenType==TK_SPACE ){
166549166790
zSql += n;
166550166791
continue;
@@ -166598,45 +166839,30 @@
166598166839
sqlite3ParserFree(pEngine, sqlite3_free);
166599166840
#endif
166600166841
if( db->mallocFailed ){
166601166842
pParse->rc = SQLITE_NOMEM_BKPT;
166602166843
}
166603
- if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
166604
- pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
166605
- }
166606
- assert( pzErrMsg!=0 );
166607
- if( pParse->zErrMsg ){
166608
- *pzErrMsg = pParse->zErrMsg;
166609
- sqlite3_log(pParse->rc, "%s in \"%s\"",
166610
- *pzErrMsg, pParse->zTail);
166611
- pParse->zErrMsg = 0;
166844
+ if( pParse->zErrMsg || (pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE) ){
166845
+ if( pParse->zErrMsg==0 ){
166846
+ pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
166847
+ }
166848
+ sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail);
166612166849
nErr++;
166613166850
}
166614166851
pParse->zTail = zSql;
166615
- if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
166616
- sqlite3VdbeDelete(pParse->pVdbe);
166617
- pParse->pVdbe = 0;
166618
- }
166619
-#ifndef SQLITE_OMIT_SHARED_CACHE
166620
- if( pParse->nested==0 ){
166621
- sqlite3DbFree(db, pParse->aTableLock);
166622
- pParse->aTableLock = 0;
166623
- pParse->nTableLock = 0;
166624
- }
166625
-#endif
166626166852
#ifndef SQLITE_OMIT_VIRTUALTABLE
166627166853
sqlite3_free(pParse->apVtabLock);
166628166854
#endif
166629166855
166630
- if( !IN_SPECIAL_PARSE ){
166856
+ if( pParse->pNewTable && !IN_SPECIAL_PARSE ){
166631166857
/* If the pParse->declareVtab flag is set, do not delete any table
166632166858
** structure built up in pParse->pNewTable. The calling code (see vtab.c)
166633166859
** will take responsibility for freeing the Table structure.
166634166860
*/
166635166861
sqlite3DeleteTable(db, pParse->pNewTable);
166636166862
}
166637
- if( !IN_RENAME_OBJECT ){
166863
+ if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
166638166864
sqlite3DeleteTrigger(db, pParse->pNewTrigger);
166639166865
}
166640166866
sqlite3DbFree(db, pParse->pVList);
166641166867
db->pParse = pParentParse;
166642166868
assert( nErr==0 || pParse->rc!=SQLITE_OK );
@@ -167217,13 +167443,10 @@
167217167443
SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*);
167218167444
#endif
167219167445
#ifdef SQLITE_ENABLE_FTS5
167220167446
SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*);
167221167447
#endif
167222
-#ifdef SQLITE_ENABLE_JSON1
167223
-SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*);
167224
-#endif
167225167448
#ifdef SQLITE_ENABLE_STMTVTAB
167226167449
SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*);
167227167450
#endif
167228167451
167229167452
/*
@@ -167254,12 +167477,12 @@
167254167477
#endif
167255167478
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
167256167479
sqlite3DbstatRegister,
167257167480
#endif
167258167481
sqlite3TestExtInit,
167259
-#ifdef SQLITE_ENABLE_JSON1
167260
- sqlite3Json1Init,
167482
+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
167483
+ sqlite3JsonTableFunctions,
167261167484
#endif
167262167485
#ifdef SQLITE_ENABLE_STMTVTAB
167263167486
sqlite3StmtVtabInit,
167264167487
#endif
167265167488
#ifdef SQLITE_ENABLE_BYTECODE_VTAB
@@ -169763,10 +169986,23 @@
169763169986
}
169764169987
}
169765169988
sqlite3_mutex_leave(db->mutex);
169766169989
return z;
169767169990
}
169991
+
169992
+/*
169993
+** Return the byte offset of the most recent error
169994
+*/
169995
+SQLITE_API int sqlite3_error_offset(sqlite3 *db){
169996
+ int iOffset = -1;
169997
+ if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){
169998
+ sqlite3_mutex_enter(db->mutex);
169999
+ iOffset = db->errByteOffset;
170000
+ sqlite3_mutex_leave(db->mutex);
170001
+ }
170002
+ return iOffset;
170003
+}
169768170004
169769170005
#ifndef SQLITE_OMIT_UTF16
169770170006
/*
169771170007
** Return UTF-16 encoded English language explanation of the most recent
169772170008
** error.
@@ -173514,11 +173750,11 @@
173514173750
SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
173515173751
SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
173516173752
SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
173517173753
173518173754
/* fts3_tokenize_vtab.c */
173519
-SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
173755
+SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*));
173520173756
173521173757
/* fts3_unicode2.c (functions generated by parsing unicode text files) */
173522173758
#ifndef SQLITE_DISABLE_FTS3_UNICODE
173523173759
SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
173524173760
SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -173546,10 +173782,16 @@
173546173782
/* #include "fts3.h" */
173547173783
#ifndef SQLITE_CORE
173548173784
/* # include "sqlite3ext.h" */
173549173785
SQLITE_EXTENSION_INIT1
173550173786
#endif
173787
+
173788
+typedef struct Fts3HashWrapper Fts3HashWrapper;
173789
+struct Fts3HashWrapper {
173790
+ Fts3Hash hash; /* Hash table */
173791
+ int nRef; /* Number of pointers to this object */
173792
+};
173551173793
173552173794
static int fts3EvalNext(Fts3Cursor *pCsr);
173553173795
static int fts3EvalStart(Fts3Cursor *pCsr);
173554173796
static int fts3TermSegReaderCursor(
173555173797
Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **);
@@ -174411,11 +174653,11 @@
174411174653
int argc, /* Number of elements in argv array */
174412174654
const char * const *argv, /* xCreate/xConnect argument array */
174413174655
sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */
174414174656
char **pzErr /* Write any error message here */
174415174657
){
174416
- Fts3Hash *pHash = (Fts3Hash *)pAux;
174658
+ Fts3Hash *pHash = &((Fts3HashWrapper*)pAux)->hash;
174417174659
Fts3Table *p = 0; /* Pointer to allocated vtab */
174418174660
int rc = SQLITE_OK; /* Return code */
174419174661
int i; /* Iterator variable */
174420174662
sqlite3_int64 nByte; /* Size of allocation used for *p */
174421174663
int iCol; /* Column index */
@@ -177246,13 +177488,16 @@
177246177488
** This function is registered as the module destructor (called when an
177247177489
** FTS3 enabled database connection is closed). It frees the memory
177248177490
** allocated for the tokenizer hash table.
177249177491
*/
177250177492
static void hashDestroy(void *p){
177251
- Fts3Hash *pHash = (Fts3Hash *)p;
177252
- sqlite3Fts3HashClear(pHash);
177253
- sqlite3_free(pHash);
177493
+ Fts3HashWrapper *pHash = (Fts3HashWrapper *)p;
177494
+ pHash->nRef--;
177495
+ if( pHash->nRef<=0 ){
177496
+ sqlite3Fts3HashClear(&pHash->hash);
177497
+ sqlite3_free(pHash);
177498
+ }
177254177499
}
177255177500
177256177501
/*
177257177502
** The fts3 built-in tokenizers - "simple", "porter" and "icu"- are
177258177503
** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c
@@ -177278,11 +177523,11 @@
177278177523
** SQLite. If fts3 is built as a dynamically loadable extension, this
177279177524
** function is called by the sqlite3_extension_init() entry point.
177280177525
*/
177281177526
SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
177282177527
int rc = SQLITE_OK;
177283
- Fts3Hash *pHash = 0;
177528
+ Fts3HashWrapper *pHash = 0;
177284177529
const sqlite3_tokenizer_module *pSimple = 0;
177285177530
const sqlite3_tokenizer_module *pPorter = 0;
177286177531
#ifndef SQLITE_DISABLE_FTS3_UNICODE
177287177532
const sqlite3_tokenizer_module *pUnicode = 0;
177288177533
#endif
@@ -177306,70 +177551,74 @@
177306177551
177307177552
sqlite3Fts3SimpleTokenizerModule(&pSimple);
177308177553
sqlite3Fts3PorterTokenizerModule(&pPorter);
177309177554
177310177555
/* Allocate and initialize the hash-table used to store tokenizers. */
177311
- pHash = sqlite3_malloc(sizeof(Fts3Hash));
177556
+ pHash = sqlite3_malloc(sizeof(Fts3HashWrapper));
177312177557
if( !pHash ){
177313177558
rc = SQLITE_NOMEM;
177314177559
}else{
177315
- sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);
177560
+ sqlite3Fts3HashInit(&pHash->hash, FTS3_HASH_STRING, 1);
177561
+ pHash->nRef = 0;
177316177562
}
177317177563
177318177564
/* Load the built-in tokenizers into the hash table */
177319177565
if( rc==SQLITE_OK ){
177320
- if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
177321
- || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
177566
+ if( sqlite3Fts3HashInsert(&pHash->hash, "simple", 7, (void *)pSimple)
177567
+ || sqlite3Fts3HashInsert(&pHash->hash, "porter", 7, (void *)pPorter)
177322177568
177323177569
#ifndef SQLITE_DISABLE_FTS3_UNICODE
177324
- || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
177570
+ || sqlite3Fts3HashInsert(&pHash->hash, "unicode61", 10, (void *)pUnicode)
177325177571
#endif
177326177572
#ifdef SQLITE_ENABLE_ICU
177327
- || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu))
177573
+ || (pIcu && sqlite3Fts3HashInsert(&pHash->hash, "icu", 4, (void *)pIcu))
177328177574
#endif
177329177575
){
177330177576
rc = SQLITE_NOMEM;
177331177577
}
177332177578
}
177333177579
177334177580
#ifdef SQLITE_TEST
177335177581
if( rc==SQLITE_OK ){
177336
- rc = sqlite3Fts3ExprInitTestInterface(db, pHash);
177582
+ rc = sqlite3Fts3ExprInitTestInterface(db, &pHash->hash);
177337177583
}
177338177584
#endif
177339177585
177340177586
/* Create the virtual table wrapper around the hash-table and overload
177341177587
** the four scalar functions. If this is successful, register the
177342177588
** module with sqlite.
177343177589
*/
177344177590
if( SQLITE_OK==rc
177345
- && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
177591
+ && SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
177346177592
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
177347177593
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
177348177594
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
177349177595
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
177350177596
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
177351177597
){
177598
+ pHash->nRef++;
177352177599
rc = sqlite3_create_module_v2(
177353177600
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
177354177601
);
177355177602
if( rc==SQLITE_OK ){
177603
+ pHash->nRef++;
177356177604
rc = sqlite3_create_module_v2(
177357
- db, "fts4", &fts3Module, (void *)pHash, 0
177605
+ db, "fts4", &fts3Module, (void *)pHash, hashDestroy
177358177606
);
177359177607
}
177360177608
if( rc==SQLITE_OK ){
177361
- rc = sqlite3Fts3InitTok(db, (void *)pHash);
177609
+ pHash->nRef++;
177610
+ rc = sqlite3Fts3InitTok(db, (void *)pHash, hashDestroy);
177362177611
}
177363177612
return rc;
177364177613
}
177365177614
177366177615
177367177616
/* An error has occurred. Delete the hash table and return the error code. */
177368177617
assert( rc!=SQLITE_OK );
177369177618
if( pHash ){
177370
- sqlite3Fts3HashClear(pHash);
177619
+ sqlite3Fts3HashClear(&pHash->hash);
177371177620
sqlite3_free(pHash);
177372177621
}
177373177622
return rc;
177374177623
}
177375177624
@@ -177712,11 +177961,11 @@
177712177961
){
177713177962
char *p = *ppIter;
177714177963
177715177964
assert( nDoclist>0 );
177716177965
assert( *pbEof==0 );
177717
- assert( p || *piDocid==0 );
177966
+ assert_fts3_nc( p || *piDocid==0 );
177718177967
assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) );
177719177968
177720177969
if( p==0 ){
177721177970
sqlite3_int64 iDocid = 0;
177722177971
char *pNext = 0;
@@ -183429,11 +183678,11 @@
183429183678
183430183679
/*
183431183680
** Register the fts3tok module with database connection db. Return SQLITE_OK
183432183681
** if successful or an error code if sqlite3_create_module() fails.
183433183682
*/
183434
-SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
183683
+SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){
183435183684
static const sqlite3_module fts3tok_module = {
183436183685
0, /* iVersion */
183437183686
fts3tokConnectMethod, /* xCreate */
183438183687
fts3tokConnectMethod, /* xConnect */
183439183688
fts3tokBestIndexMethod, /* xBestIndex */
@@ -183458,11 +183707,13 @@
183458183707
0, /* xRollbackTo */
183459183708
0 /* xShadowName */
183460183709
};
183461183710
int rc; /* Return code */
183462183711
183463
- rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash);
183712
+ rc = sqlite3_create_module_v2(
183713
+ db, "fts3tokenize", &fts3tok_module, (void*)pHash, xDestroy
183714
+ );
183464183715
return rc;
183465183716
}
183466183717
183467183718
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
183468183719
@@ -191817,11 +192068,11 @@
191817192068
}
191818192069
#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
191819192070
#endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
191820192071
191821192072
/************** End of fts3_unicode2.c ***************************************/
191822
-/************** Begin file json1.c *******************************************/
192073
+/************** Begin file json.c ********************************************/
191823192074
/*
191824192075
** 2015-08-12
191825192076
**
191826192077
** The author disclaims copyright to this source code. In place of
191827192078
** a legal notice, here is a blessing:
@@ -191830,63 +192081,23 @@
191830192081
** May you find forgiveness for yourself and forgive others.
191831192082
** May you share freely, never taking more than you give.
191832192083
**
191833192084
******************************************************************************
191834192085
**
191835
-** This SQLite extension implements JSON functions. The interface is
191836
-** modeled after MySQL JSON functions:
192086
+** This SQLite JSON functions.
191837192087
**
191838
-** https://dev.mysql.com/doc/refman/5.7/en/json.html
192088
+** This file began as an extension in ext/misc/json1.c in 2015. That
192089
+** extension proved so useful that it has now been moved into the core.
191839192090
**
191840192091
** For the time being, all JSON is stored as pure text. (We might add
191841192092
** a JSONB type in the future which stores a binary encoding of JSON in
191842192093
** a BLOB, but there is no support for JSONB in the current implementation.
191843192094
** This implementation parses JSON text at 250 MB/s, so it is hard to see
191844192095
** how JSONB might improve on that.)
191845192096
*/
191846
-#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1)
191847
-#if !defined(SQLITEINT_H)
191848
-/* #include "sqlite3ext.h" */
191849
-#endif
191850
-SQLITE_EXTENSION_INIT1
191851
-/* #include <assert.h> */
191852
-/* #include <string.h> */
191853
-/* #include <stdlib.h> */
191854
-/* #include <stdarg.h> */
191855
-
191856
-/* Mark a function parameter as unused, to suppress nuisance compiler
191857
-** warnings. */
191858
-#ifndef UNUSED_PARAM
191859
-# define UNUSED_PARAM(X) (void)(X)
191860
-#endif
191861
-
191862
-#ifndef LARGEST_INT64
191863
-# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
191864
-# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
191865
-#endif
191866
-
191867
-#ifndef deliberate_fall_through
191868
-# define deliberate_fall_through
191869
-#endif
191870
-
191871
-/*
191872
-** Versions of isspace(), isalnum() and isdigit() to which it is safe
191873
-** to pass signed char values.
191874
-*/
191875
-#ifdef sqlite3Isdigit
191876
- /* Use the SQLite core versions if this routine is part of the
191877
- ** SQLite amalgamation */
191878
-# define safe_isdigit(x) sqlite3Isdigit(x)
191879
-# define safe_isalnum(x) sqlite3Isalnum(x)
191880
-# define safe_isxdigit(x) sqlite3Isxdigit(x)
191881
-#else
191882
- /* Use the standard library for separate compilation */
191883
-#include <ctype.h> /* amalgamator: keep */
191884
-# define safe_isdigit(x) isdigit((unsigned char)(x))
191885
-# define safe_isalnum(x) isalnum((unsigned char)(x))
191886
-# define safe_isxdigit(x) isxdigit((unsigned char)(x))
191887
-#endif
192097
+#ifndef SQLITE_OMIT_JSON
192098
+/* #include "sqliteInt.h" */
191888192099
191889192100
/*
191890192101
** Growing our own isspace() routine this way is twice as fast as
191891192102
** the library isspace() function, resulting in a 7% overall performance
191892192103
** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
@@ -191907,48 +192118,18 @@
191907192118
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191908192119
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191909192120
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191910192121
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191911192122
};
191912
-#define safe_isspace(x) (jsonIsSpace[(unsigned char)x])
191913
-
191914
-#ifndef SQLITE_AMALGAMATION
191915
- /* Unsigned integer types. These are already defined in the sqliteInt.h,
191916
- ** but the definitions need to be repeated for separate compilation. */
191917
- typedef sqlite3_uint64 u64;
191918
- typedef unsigned int u32;
191919
- typedef unsigned short int u16;
191920
- typedef unsigned char u8;
191921
-# if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)
191922
-# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1
191923
-# endif
191924
-# if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS)
191925
-# define ALWAYS(X) (1)
191926
-# define NEVER(X) (0)
191927
-# elif !defined(NDEBUG)
191928
-# define ALWAYS(X) ((X)?1:(assert(0),0))
191929
-# define NEVER(X) ((X)?(assert(0),1):0)
191930
-# else
191931
-# define ALWAYS(X) (X)
191932
-# define NEVER(X) (X)
191933
-# endif
191934
-# define testcase(X)
191935
-#endif
192123
+#define fast_isspace(x) (jsonIsSpace[(unsigned char)x])
192124
+
191936192125
#if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST)
191937192126
# define VVA(X)
191938192127
#else
191939192128
# define VVA(X) X
191940192129
#endif
191941192130
191942
-/*
191943
-** Some of the testcase() macros in this file are problematic for gcov
191944
-** in that they generate false-miss errors randomly. This is a gcov problem,
191945
-** not a problem in this case. But to work around it, we disable the
191946
-** problematic test cases for production builds.
191947
-*/
191948
-#define json_testcase(X)
191949
-
191950192131
/* Objects */
191951192132
typedef struct JsonString JsonString;
191952192133
typedef struct JsonNode JsonNode;
191953192134
typedef struct JsonParse JsonParse;
191954192135
@@ -192402,14 +192583,14 @@
192402192583
/*
192403192584
** Convert a 4-byte hex string into an integer
192404192585
*/
192405192586
static u32 jsonHexToInt4(const char *z){
192406192587
u32 v;
192407
- assert( safe_isxdigit(z[0]) );
192408
- assert( safe_isxdigit(z[1]) );
192409
- assert( safe_isxdigit(z[2]) );
192410
- assert( safe_isxdigit(z[3]) );
192588
+ assert( sqlite3Isxdigit(z[0]) );
192589
+ assert( sqlite3Isxdigit(z[1]) );
192590
+ assert( sqlite3Isxdigit(z[2]) );
192591
+ assert( sqlite3Isxdigit(z[3]) );
192411192592
v = (jsonHexToInt(z[0])<<12)
192412192593
+ (jsonHexToInt(z[1])<<8)
192413192594
+ (jsonHexToInt(z[2])<<4)
192414192595
+ jsonHexToInt(z[3]);
192415192596
return v;
@@ -192640,11 +192821,11 @@
192640192821
/*
192641192822
** Return true if z[] begins with 4 (or more) hexadecimal digits
192642192823
*/
192643192824
static int jsonIs4Hex(const char *z){
192644192825
int i;
192645
- for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
192826
+ for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
192646192827
return 1;
192647192828
}
192648192829
192649192830
/*
192650192831
** Parse a single JSON value which begins at pParse->zJson[i]. Return the
@@ -192659,17 +192840,17 @@
192659192840
u32 j;
192660192841
int iThis;
192661192842
int x;
192662192843
JsonNode *pNode;
192663192844
const char *z = pParse->zJson;
192664
- while( safe_isspace(z[i]) ){ i++; }
192845
+ while( fast_isspace(z[i]) ){ i++; }
192665192846
if( (c = z[i])=='{' ){
192666192847
/* Parse object */
192667192848
iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
192668192849
if( iThis<0 ) return -1;
192669192850
for(j=i+1;;j++){
192670
- while( safe_isspace(z[j]) ){ j++; }
192851
+ while( fast_isspace(z[j]) ){ j++; }
192671192852
if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192672192853
x = jsonParseValue(pParse, j);
192673192854
if( x<0 ){
192674192855
pParse->iDepth--;
192675192856
if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
@@ -192678,18 +192859,18 @@
192678192859
if( pParse->oom ) return -1;
192679192860
pNode = &pParse->aNode[pParse->nNode-1];
192680192861
if( pNode->eType!=JSON_STRING ) return -1;
192681192862
pNode->jnFlags |= JNODE_LABEL;
192682192863
j = x;
192683
- while( safe_isspace(z[j]) ){ j++; }
192864
+ while( fast_isspace(z[j]) ){ j++; }
192684192865
if( z[j]!=':' ) return -1;
192685192866
j++;
192686192867
x = jsonParseValue(pParse, j);
192687192868
pParse->iDepth--;
192688192869
if( x<0 ) return -1;
192689192870
j = x;
192690
- while( safe_isspace(z[j]) ){ j++; }
192871
+ while( fast_isspace(z[j]) ){ j++; }
192691192872
c = z[j];
192692192873
if( c==',' ) continue;
192693192874
if( c!='}' ) return -1;
192694192875
break;
192695192876
}
@@ -192699,20 +192880,20 @@
192699192880
/* Parse array */
192700192881
iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
192701192882
if( iThis<0 ) return -1;
192702192883
memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
192703192884
for(j=i+1;;j++){
192704
- while( safe_isspace(z[j]) ){ j++; }
192885
+ while( fast_isspace(z[j]) ){ j++; }
192705192886
if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192706192887
x = jsonParseValue(pParse, j);
192707192888
pParse->iDepth--;
192708192889
if( x<0 ){
192709192890
if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
192710192891
return -1;
192711192892
}
192712192893
j = x;
192713
- while( safe_isspace(z[j]) ){ j++; }
192894
+ while( fast_isspace(z[j]) ){ j++; }
192714192895
c = z[j];
192715192896
if( c==',' ) continue;
192716192897
if( c!=']' ) return -1;
192717192898
break;
192718192899
}
@@ -192745,21 +192926,21 @@
192745192926
jsonParseAddNode(pParse, JSON_STRING, j+1-i, &z[i]);
192746192927
if( !pParse->oom ) pParse->aNode[pParse->nNode-1].jnFlags = jnFlags;
192747192928
return j+1;
192748192929
}else if( c=='n'
192749192930
&& strncmp(z+i,"null",4)==0
192750
- && !safe_isalnum(z[i+4]) ){
192931
+ && !sqlite3Isalnum(z[i+4]) ){
192751192932
jsonParseAddNode(pParse, JSON_NULL, 0, 0);
192752192933
return i+4;
192753192934
}else if( c=='t'
192754192935
&& strncmp(z+i,"true",4)==0
192755
- && !safe_isalnum(z[i+4]) ){
192936
+ && !sqlite3Isalnum(z[i+4]) ){
192756192937
jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
192757192938
return i+4;
192758192939
}else if( c=='f'
192759192940
&& strncmp(z+i,"false",5)==0
192760
- && !safe_isalnum(z[i+5]) ){
192941
+ && !sqlite3Isalnum(z[i+5]) ){
192761192942
jsonParseAddNode(pParse, JSON_FALSE, 0, 0);
192762192943
return i+5;
192763192944
}else if( c=='-' || (c>='0' && c<='9') ){
192764192945
/* Parse number */
192765192946
u8 seenDP = 0;
@@ -192826,11 +193007,11 @@
192826193007
pParse->zJson = zJson;
192827193008
i = jsonParseValue(pParse, 0);
192828193009
if( pParse->oom ) i = -1;
192829193010
if( i>0 ){
192830193011
assert( pParse->iDepth==0 );
192831
- while( safe_isspace(zJson[i]) ) i++;
193012
+ while( fast_isspace(zJson[i]) ) i++;
192832193013
if( zJson[i] ) i = -1;
192833193014
}
192834193015
if( i<=0 ){
192835193016
if( pCtx!=0 ){
192836193017
if( pParse->oom ){
@@ -193054,11 +193235,11 @@
193054193235
return pNode;
193055193236
}
193056193237
}else if( zPath[0]=='[' ){
193057193238
i = 0;
193058193239
j = 1;
193059
- while( safe_isdigit(zPath[j]) ){
193240
+ while( sqlite3Isdigit(zPath[j]) ){
193060193241
i = i*10 + zPath[j] - '0';
193061193242
j++;
193062193243
}
193063193244
if( j<2 || zPath[j]!=']' ){
193064193245
if( zPath[1]=='#' ){
@@ -193075,17 +193256,17 @@
193075193256
iBase += pBase->u.iAppend;
193076193257
pBase = &pParse->aNode[iBase];
193077193258
j = 1;
193078193259
}
193079193260
j = 2;
193080
- if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){
193261
+ if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){
193081193262
unsigned int x = 0;
193082193263
j = 3;
193083193264
do{
193084193265
x = x*10 + zPath[j] - '0';
193085193266
j++;
193086
- }while( safe_isdigit(zPath[j]) );
193267
+ }while( sqlite3Isdigit(zPath[j]) );
193087193268
if( x>i ) return 0;
193088193269
i -= x;
193089193270
}
193090193271
if( zPath[j]!=']' ){
193091193272
*pzErr = zPath;
@@ -193300,11 +193481,11 @@
193300193481
static void jsonTest1Func(
193301193482
sqlite3_context *ctx,
193302193483
int argc,
193303193484
sqlite3_value **argv
193304193485
){
193305
- UNUSED_PARAM(argc);
193486
+ UNUSED_PARAMETER(argc);
193306193487
sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE);
193307193488
}
193308193489
#endif /* SQLITE_DEBUG */
193309193490
193310193491
/****************************************************************************
@@ -193321,11 +193502,11 @@
193321193502
sqlite3_context *ctx,
193322193503
int argc,
193323193504
sqlite3_value **argv
193324193505
){
193325193506
JsonString jx;
193326
- UNUSED_PARAM(argc);
193507
+ UNUSED_PARAMETER(argc);
193327193508
193328193509
jsonInit(&jx, ctx);
193329193510
jsonAppendValue(&jx, argv[0]);
193330193511
jsonResult(&jx);
193331193512
sqlite3_result_subtype(ctx, JSON_SUBTYPE);
@@ -193392,55 +193573,118 @@
193392193573
}
193393193574
}
193394193575
sqlite3_result_int64(ctx, n);
193395193576
}
193396193577
193578
+/*
193579
+** Bit values for the flags passed into jsonExtractFunc() or
193580
+** jsonSetFunc() via the user-data value.
193581
+*/
193582
+#define JSON_JSON 0x01 /* Result is always JSON */
193583
+#define JSON_SQL 0x02 /* Result is always SQL */
193584
+#define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */
193585
+#define JSON_ISSET 0x04 /* json_set(), not json_insert() */
193586
+
193397193587
/*
193398193588
** json_extract(JSON, PATH, ...)
193589
+** "->"(JSON,PATH)
193590
+** "->>"(JSON,PATH)
193399193591
**
193400
-** Return the element described by PATH. Return NULL if there is no
193401
-** PATH element. If there are multiple PATHs, then return a JSON array
193402
-** with the result from each path. Throw an error if the JSON or any PATH
193403
-** is malformed.
193592
+** Return the element described by PATH. Return NULL if that PATH element
193593
+** is not found.
193594
+**
193595
+** If JSON_JSON is set or if more that one PATH argument is supplied then
193596
+** always return a JSON representation of the result. If JSON_SQL is set,
193597
+** then always return an SQL representation of the result. If neither flag
193598
+** is present and argc==2, then return JSON for objects and arrays and SQL
193599
+** for all other values.
193600
+**
193601
+** When multiple PATH arguments are supplied, the result is a JSON array
193602
+** containing the result of each PATH.
193603
+**
193604
+** Abbreviated JSON path expressions are allows if JSON_ABPATH, for
193605
+** compatibility with PG.
193404193606
*/
193405193607
static void jsonExtractFunc(
193406193608
sqlite3_context *ctx,
193407193609
int argc,
193408193610
sqlite3_value **argv
193409193611
){
193410193612
JsonParse *p; /* The parse */
193411193613
JsonNode *pNode;
193412193614
const char *zPath;
193615
+ int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx));
193413193616
JsonString jx;
193414
- int i;
193415193617
193416193618
if( argc<2 ) return;
193417193619
p = jsonParseCached(ctx, argv, ctx);
193418193620
if( p==0 ) return;
193419
- jsonInit(&jx, ctx);
193420
- jsonAppendChar(&jx, '[');
193421
- for(i=1; i<argc; i++){
193422
- zPath = (const char*)sqlite3_value_text(argv[i]);
193423
- pNode = jsonLookup(p, zPath, 0, ctx);
193424
- if( p->nErr ) break;
193425
- if( argc>2 ){
193621
+ if( argc==2 ){
193622
+ /* With a single PATH argument */
193623
+ zPath = (const char*)sqlite3_value_text(argv[1]);
193624
+ if( zPath==0 ) return;
193625
+ if( flags & JSON_ABPATH ){
193626
+ if( zPath[0]!='$' ){
193627
+ /* The -> and ->> operators accept abbreviated PATH arguments. This
193628
+ ** is mostly for compatibility with PostgreSQL, but also for
193629
+ ** convenience.
193630
+ **
193631
+ ** NUMBER ==> $[NUMBER] // PG compatible
193632
+ ** LABEL ==> $.LABEL // PG compatible
193633
+ ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience
193634
+ */
193635
+ jsonInit(&jx, ctx);
193636
+ if( sqlite3Isdigit(zPath[0]) ){
193637
+ jsonAppendRaw(&jx, "$[", 2);
193638
+ jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
193639
+ jsonAppendRaw(&jx, "]", 2);
193640
+ }else{
193641
+ jsonAppendRaw(&jx, "$.", 1 + (zPath[0]!='['));
193642
+ jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
193643
+ jsonAppendChar(&jx, 0);
193644
+ }
193645
+ pNode = jx.bErr ? 0 : jsonLookup(p, jx.zBuf, 0, ctx);
193646
+ jsonReset(&jx);
193647
+ }else{
193648
+ pNode = jsonLookup(p, zPath, 0, ctx);
193649
+ }
193650
+ if( pNode ){
193651
+ if( flags & JSON_JSON ){
193652
+ jsonReturnJson(pNode, ctx, 0);
193653
+ }else{
193654
+ jsonReturn(pNode, ctx, 0);
193655
+ sqlite3_result_subtype(ctx, 0);
193656
+ }
193657
+ }
193658
+ }else{
193659
+ pNode = jsonLookup(p, zPath, 0, ctx);
193660
+ if( p->nErr==0 && pNode ) jsonReturn(pNode, ctx, 0);
193661
+ }
193662
+ }else{
193663
+ /* Two or more PATH arguments results in a JSON array with each
193664
+ ** element of the array being the value selected by one of the PATHs */
193665
+ int i;
193666
+ jsonInit(&jx, ctx);
193667
+ jsonAppendChar(&jx, '[');
193668
+ for(i=1; i<argc; i++){
193669
+ zPath = (const char*)sqlite3_value_text(argv[i]);
193670
+ pNode = jsonLookup(p, zPath, 0, ctx);
193671
+ if( p->nErr ) break;
193426193672
jsonAppendSeparator(&jx);
193427193673
if( pNode ){
193428193674
jsonRenderNode(pNode, &jx, 0);
193429193675
}else{
193430193676
jsonAppendRaw(&jx, "null", 4);
193431193677
}
193432
- }else if( pNode ){
193433
- jsonReturn(pNode, ctx, 0);
193434
- }
193435
- }
193436
- if( argc>2 && i==argc ){
193437
- jsonAppendChar(&jx, ']');
193438
- jsonResult(&jx);
193439
- sqlite3_result_subtype(ctx, JSON_SUBTYPE);
193440
- }
193441
- jsonReset(&jx);
193678
+ }
193679
+ if( i==argc ){
193680
+ jsonAppendChar(&jx, ']');
193681
+ jsonResult(&jx);
193682
+ sqlite3_result_subtype(ctx, JSON_SUBTYPE);
193683
+ }
193684
+ jsonReset(&jx);
193685
+ }
193442193686
}
193443193687
193444193688
/* This is the RFC 7396 MergePatch algorithm.
193445193689
*/
193446193690
static JsonNode *jsonMergePatch(
@@ -193532,11 +193776,11 @@
193532193776
){
193533193777
JsonParse x; /* The JSON that is being patched */
193534193778
JsonParse y; /* The patch */
193535193779
JsonNode *pResult; /* The result of the merge */
193536193780
193537
- UNUSED_PARAM(argc);
193781
+ UNUSED_PARAMETER(argc);
193538193782
if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
193539193783
if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){
193540193784
jsonParseReset(&x);
193541193785
return;
193542193786
}
@@ -193653,11 +193897,11 @@
193653193897
zPath = (const char*)sqlite3_value_text(argv[i]);
193654193898
pNode = jsonLookup(&x, zPath, 0, ctx);
193655193899
if( x.nErr ) goto replace_err;
193656193900
if( pNode ){
193657193901
assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 );
193658
- json_testcase( pNode->eU!=0 && pNode->eU!=1 );
193902
+ testcase( pNode->eU!=0 && pNode->eU!=1 );
193659193903
pNode->jnFlags |= (u8)JNODE_REPLACE;
193660193904
VVA( pNode->eU = 4 );
193661193905
pNode->u.iReplace = i + 1;
193662193906
}
193663193907
}
@@ -193668,10 +193912,11 @@
193668193912
jsonReturnJson(x.aNode, ctx, argv);
193669193913
}
193670193914
replace_err:
193671193915
jsonParseReset(&x);
193672193916
}
193917
+
193673193918
193674193919
/*
193675193920
** json_set(JSON, PATH, VALUE, ...)
193676193921
**
193677193922
** Set the value at PATH to VALUE. Create the PATH if it does not already
@@ -193691,11 +193936,11 @@
193691193936
JsonParse x; /* The parse */
193692193937
JsonNode *pNode;
193693193938
const char *zPath;
193694193939
u32 i;
193695193940
int bApnd;
193696
- int bIsSet = *(int*)sqlite3_user_data(ctx);
193941
+ int bIsSet = sqlite3_user_data(ctx)!=0;
193697193942
193698193943
if( argc<1 ) return;
193699193944
if( (argc&1)==0 ) {
193700193945
jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert");
193701193946
return;
@@ -193710,11 +193955,11 @@
193710193955
sqlite3_result_error_nomem(ctx);
193711193956
goto jsonSetDone;
193712193957
}else if( x.nErr ){
193713193958
goto jsonSetDone;
193714193959
}else if( pNode && (bApnd || bIsSet) ){
193715
- json_testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 );
193960
+ testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 );
193716193961
assert( pNode->eU!=3 || pNode->eU!=5 );
193717193962
VVA( pNode->eU = 4 );
193718193963
pNode->jnFlags |= (u8)JNODE_REPLACE;
193719193964
pNode->u.iReplace = i + 1;
193720193965
}
@@ -193731,12 +193976,12 @@
193731193976
193732193977
/*
193733193978
** json_type(JSON)
193734193979
** json_type(JSON, PATH)
193735193980
**
193736
-** Return the top-level "type" of a JSON string. Throw an error if
193737
-** either the JSON or PATH inputs are not well-formed.
193981
+** Return the top-level "type" of a JSON string. json_type() raises an
193982
+** error if either the JSON or PATH inputs are not well-formed.
193738193983
*/
193739193984
static void jsonTypeFunc(
193740193985
sqlite3_context *ctx,
193741193986
int argc,
193742193987
sqlite3_value **argv
@@ -193768,11 +194013,11 @@
193768194013
sqlite3_context *ctx,
193769194014
int argc,
193770194015
sqlite3_value **argv
193771194016
){
193772194017
JsonParse *p; /* The parse */
193773
- UNUSED_PARAM(argc);
194018
+ UNUSED_PARAMETER(argc);
193774194019
p = jsonParseCached(ctx, argv, 0);
193775194020
sqlite3_result_int(ctx, p!=0);
193776194021
}
193777194022
193778194023
@@ -193788,11 +194033,11 @@
193788194033
sqlite3_context *ctx,
193789194034
int argc,
193790194035
sqlite3_value **argv
193791194036
){
193792194037
JsonString *pStr;
193793
- UNUSED_PARAM(argc);
194038
+ UNUSED_PARAMETER(argc);
193794194039
pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
193795194040
if( pStr ){
193796194041
if( pStr->zBuf==0 ){
193797194042
jsonInit(pStr, ctx);
193798194043
jsonAppendChar(pStr, '[');
@@ -193848,12 +194093,12 @@
193848194093
int inStr = 0;
193849194094
int nNest = 0;
193850194095
char *z;
193851194096
char c;
193852194097
JsonString *pStr;
193853
- UNUSED_PARAM(argc);
193854
- UNUSED_PARAM(argv);
194098
+ UNUSED_PARAMETER(argc);
194099
+ UNUSED_PARAMETER(argv);
193855194100
pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
193856194101
#ifdef NEVER
193857194102
/* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
193858194103
** always have been called to initalize it */
193859194104
if( NEVER(!pStr) ) return;
@@ -193893,11 +194138,11 @@
193893194138
sqlite3_value **argv
193894194139
){
193895194140
JsonString *pStr;
193896194141
const char *z;
193897194142
u32 n;
193898
- UNUSED_PARAM(argc);
194143
+ UNUSED_PARAMETER(argc);
193899194144
pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
193900194145
if( pStr ){
193901194146
if( pStr->zBuf==0 ){
193902194147
jsonInit(pStr, ctx);
193903194148
jsonAppendChar(pStr, '{');
@@ -193984,14 +194229,14 @@
193984194229
** the last two columns in the table. Should this ever changes, be
193985194230
** sure to update the xBestIndex method. */
193986194231
#define JEACH_JSON 8
193987194232
#define JEACH_ROOT 9
193988194233
193989
- UNUSED_PARAM(pzErr);
193990
- UNUSED_PARAM(argv);
193991
- UNUSED_PARAM(argc);
193992
- UNUSED_PARAM(pAux);
194234
+ UNUSED_PARAMETER(pzErr);
194235
+ UNUSED_PARAMETER(argv);
194236
+ UNUSED_PARAMETER(argc);
194237
+ UNUSED_PARAMETER(pAux);
193993194238
rc = sqlite3_declare_vtab(db,
193994194239
"CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
193995194240
"json HIDDEN,root HIDDEN)");
193996194241
if( rc==SQLITE_OK ){
193997194242
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
@@ -194010,11 +194255,11 @@
194010194255
194011194256
/* constructor for a JsonEachCursor object for json_each(). */
194012194257
static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
194013194258
JsonEachCursor *pCur;
194014194259
194015
- UNUSED_PARAM(p);
194260
+ UNUSED_PARAMETER(p);
194016194261
pCur = sqlite3_malloc( sizeof(*pCur) );
194017194262
if( pCur==0 ) return SQLITE_NOMEM;
194018194263
memset(pCur, 0, sizeof(*pCur));
194019194264
*ppCursor = &pCur->base;
194020194265
return SQLITE_OK;
@@ -194070,11 +194315,11 @@
194070194315
u32 iUp = p->sParse.aUp[p->i];
194071194316
JsonNode *pUp = &p->sParse.aNode[iUp];
194072194317
p->eType = pUp->eType;
194073194318
if( pUp->eType==JSON_ARRAY ){
194074194319
assert( pUp->eU==0 || pUp->eU==3 );
194075
- json_testcase( pUp->eU==3 );
194320
+ testcase( pUp->eU==3 );
194076194321
VVA( pUp->eU = 3 );
194077194322
if( iUp==p->i-1 ){
194078194323
pUp->u.iKey = 0;
194079194324
}else{
194080194325
pUp->u.iKey++;
@@ -194257,11 +194502,11 @@
194257194502
const struct sqlite3_index_constraint *pConstraint;
194258194503
194259194504
/* This implementation assumes that JSON and ROOT are the last two
194260194505
** columns in the table */
194261194506
assert( JEACH_ROOT == JEACH_JSON+1 );
194262
- UNUSED_PARAM(tab);
194507
+ UNUSED_PARAMETER(tab);
194263194508
aIdx[0] = aIdx[1] = -1;
194264194509
pConstraint = pIdxInfo->aConstraint;
194265194510
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
194266194511
int iCol;
194267194512
int iMask;
@@ -194313,12 +194558,12 @@
194313194558
JsonEachCursor *p = (JsonEachCursor*)cur;
194314194559
const char *z;
194315194560
const char *zRoot = 0;
194316194561
sqlite3_int64 n;
194317194562
194318
- UNUSED_PARAM(idxStr);
194319
- UNUSED_PARAM(argc);
194563
+ UNUSED_PARAMETER(idxStr);
194564
+ UNUSED_PARAMETER(argc);
194320194565
jsonEachCursorReset(p);
194321194566
if( idxNum==0 ) return SQLITE_OK;
194322194567
z = (const char*)sqlite3_value_text(argv[0]);
194323194568
if( z==0 ) return SQLITE_OK;
194324194569
n = sqlite3_value_bytes(argv[0]);
@@ -194439,112 +194684,72 @@
194439194684
0, /* xRelease */
194440194685
0, /* xRollbackTo */
194441194686
0 /* xShadowName */
194442194687
};
194443194688
#endif /* SQLITE_OMIT_VIRTUALTABLE */
194444
-
194445
-/****************************************************************************
194446
-** The following routines are the only publically visible identifiers in this
194447
-** file. Call the following routines in order to register the various SQL
194448
-** functions and the virtual table implemented by this file.
194449
-****************************************************************************/
194450
-
194451
-SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){
194452
- int rc = SQLITE_OK;
194453
- unsigned int i;
194454
- static const struct {
194455
- const char *zName;
194456
- int nArg;
194457
- int flag;
194458
- void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
194459
- } aFunc[] = {
194460
- { "json", 1, 0, jsonRemoveFunc },
194461
- { "json_array", -1, 0, jsonArrayFunc },
194462
- { "json_array_length", 1, 0, jsonArrayLengthFunc },
194463
- { "json_array_length", 2, 0, jsonArrayLengthFunc },
194464
- { "json_extract", -1, 0, jsonExtractFunc },
194465
- { "json_insert", -1, 0, jsonSetFunc },
194466
- { "json_object", -1, 0, jsonObjectFunc },
194467
- { "json_patch", 2, 0, jsonPatchFunc },
194468
- { "json_quote", 1, 0, jsonQuoteFunc },
194469
- { "json_remove", -1, 0, jsonRemoveFunc },
194470
- { "json_replace", -1, 0, jsonReplaceFunc },
194471
- { "json_set", -1, 1, jsonSetFunc },
194472
- { "json_type", 1, 0, jsonTypeFunc },
194473
- { "json_type", 2, 0, jsonTypeFunc },
194474
- { "json_valid", 1, 0, jsonValidFunc },
194475
-
194689
+#endif /* !defined(SQLITE_OMIT_JSON) */
194690
+
194691
+/*
194692
+** Register JSON functions.
194693
+*/
194694
+SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){
194695
+#ifndef SQLITE_OMIT_JSON
194696
+ static FuncDef aJsonFunc[] = {
194697
+ JFUNCTION(json, 1, 0, jsonRemoveFunc),
194698
+ JFUNCTION(json_array, -1, 0, jsonArrayFunc),
194699
+ JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc),
194700
+ JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc),
194701
+ JFUNCTION(json_extract, -1, 0, jsonExtractFunc),
194702
+ JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc),
194703
+ JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc),
194704
+ JFUNCTION(json_insert, -1, 0, jsonSetFunc),
194705
+ JFUNCTION(json_object, -1, 0, jsonObjectFunc),
194706
+ JFUNCTION(json_patch, 2, 0, jsonPatchFunc),
194707
+ JFUNCTION(json_quote, 1, 0, jsonQuoteFunc),
194708
+ JFUNCTION(json_remove, -1, 0, jsonRemoveFunc),
194709
+ JFUNCTION(json_replace, -1, 0, jsonReplaceFunc),
194710
+ JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc),
194711
+ JFUNCTION(json_type, 1, 0, jsonTypeFunc),
194712
+ JFUNCTION(json_type, 2, 0, jsonTypeFunc),
194713
+ JFUNCTION(json_valid, 1, 0, jsonValidFunc),
194476194714
#if SQLITE_DEBUG
194477
- /* DEBUG and TESTING functions */
194478
- { "json_parse", 1, 0, jsonParseFunc },
194479
- { "json_test1", 1, 0, jsonTest1Func },
194480
-#endif
194481
- };
194482
- static const struct {
194483
- const char *zName;
194484
- int nArg;
194485
- void (*xStep)(sqlite3_context*,int,sqlite3_value**);
194486
- void (*xFinal)(sqlite3_context*);
194487
- void (*xValue)(sqlite3_context*);
194488
- } aAgg[] = {
194489
- { "json_group_array", 1,
194490
- jsonArrayStep, jsonArrayFinal, jsonArrayValue },
194491
- { "json_group_object", 2,
194492
- jsonObjectStep, jsonObjectFinal, jsonObjectValue },
194493
- };
194494
-#ifndef SQLITE_OMIT_VIRTUALTABLE
194495
- static const struct {
194496
- const char *zName;
194497
- sqlite3_module *pModule;
194715
+ JFUNCTION(json_parse, 1, 0, jsonParseFunc),
194716
+ JFUNCTION(json_test1, 1, 0, jsonTest1Func),
194717
+#endif
194718
+ WAGGREGATE(json_group_array, 1, 0, 0,
194719
+ jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse,
194720
+ SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS),
194721
+ WAGGREGATE(json_group_object, 2, 0, 0,
194722
+ jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse,
194723
+ SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS)
194724
+ };
194725
+ sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc));
194726
+#endif
194727
+}
194728
+
194729
+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
194730
+/*
194731
+** Register the JSON table-valued functions
194732
+*/
194733
+SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3 *db){
194734
+ int rc = SQLITE_OK;
194735
+ static const struct {
194736
+ const char *zName;
194737
+ sqlite3_module *pModule;
194498194738
} aMod[] = {
194499194739
{ "json_each", &jsonEachModule },
194500194740
{ "json_tree", &jsonTreeModule },
194501194741
};
194502
-#endif
194503
- static const int enc =
194504
- SQLITE_UTF8 |
194505
- SQLITE_DETERMINISTIC |
194506
- SQLITE_INNOCUOUS;
194507
- for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
194508
- rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc,
194509
- (void*)&aFunc[i].flag,
194510
- aFunc[i].xFunc, 0, 0);
194511
- }
194512
-#ifndef SQLITE_OMIT_WINDOWFUNC
194513
- for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
194514
- rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
194515
- SQLITE_SUBTYPE | enc, 0,
194516
- aAgg[i].xStep, aAgg[i].xFinal,
194517
- aAgg[i].xValue, jsonGroupInverse, 0);
194518
- }
194519
-#endif
194520
-#ifndef SQLITE_OMIT_VIRTUALTABLE
194742
+ int i;
194521194743
for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
194522194744
rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
194523194745
}
194524
-#endif
194525194746
return rc;
194526194747
}
194527
-
194528
-
194529
-#ifndef SQLITE_CORE
194530
-#ifdef _WIN32
194531
-__declspec(dllexport)
194532
-#endif
194533
-SQLITE_API int sqlite3_json_init(
194534
- sqlite3 *db,
194535
- char **pzErrMsg,
194536
- const sqlite3_api_routines *pApi
194537
-){
194538
- SQLITE_EXTENSION_INIT2(pApi);
194539
- (void)pzErrMsg; /* Unused parameter */
194540
- return sqlite3Json1Init(db);
194541
-}
194542
-#endif
194543
-#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) */
194544
-
194545
-/************** End of json1.c ***********************************************/
194748
+#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */
194749
+
194750
+/************** End of json.c ************************************************/
194546194751
/************** Begin file rtree.c *******************************************/
194547194752
/*
194548194753
** 2001 September 15
194549194754
**
194550194755
** The author disclaims copyright to this source code. In place of
@@ -198974,15 +199179,11 @@
198974199179
# define GEODEBUG(X) if(geo_debug)printf X
198975199180
#else
198976199181
# define GEODEBUG(X)
198977199182
#endif
198978199183
198979
-#ifndef JSON_NULL /* The following stuff repeats things found in json1 */
198980
-/*
198981
-** Versions of isspace(), isalnum() and isdigit() to which it is safe
198982
-** to pass signed char values.
198983
-*/
199184
+/* Character class routines */
198984199185
#ifdef sqlite3Isdigit
198985199186
/* Use the SQLite core versions if this routine is part of the
198986199187
** SQLite amalgamation */
198987199188
# define safe_isdigit(x) sqlite3Isdigit(x)
198988199189
# define safe_isalnum(x) sqlite3Isalnum(x)
@@ -198993,10 +199194,11 @@
198993199194
# define safe_isdigit(x) isdigit((unsigned char)(x))
198994199195
# define safe_isalnum(x) isalnum((unsigned char)(x))
198995199196
# define safe_isxdigit(x) isxdigit((unsigned char)(x))
198996199197
#endif
198997199198
199199
+#ifndef JSON_NULL /* The following stuff repeats things found in json1 */
198998199200
/*
198999199201
** Growing our own isspace() routine this way is twice as fast as
199000199202
** the library isspace() function.
199001199203
*/
199002199204
static const char geopolyIsSpace[] = {
@@ -199015,11 +199217,11 @@
199015199217
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199016199218
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199017199219
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199018199220
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199019199221
};
199020
-#define safe_isspace(x) (geopolyIsSpace[(unsigned char)x])
199222
+#define fast_isspace(x) (geopolyIsSpace[(unsigned char)x])
199021199223
#endif /* JSON NULL - back to original code */
199022199224
199023199225
/* Compiler and version */
199024199226
#ifndef GCC_VERSION
199025199227
#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
@@ -199104,11 +199306,11 @@
199104199306
a[2] = t;
199105199307
}
199106199308
199107199309
/* Skip whitespace. Return the next non-whitespace character. */
199108199310
static char geopolySkipSpace(GeoParse *p){
199109
- while( safe_isspace(p->z[0]) ) p->z++;
199311
+ while( fast_isspace(p->z[0]) ) p->z++;
199110199312
return p->z[0];
199111199313
}
199112199314
199113199315
/* Parse out a number. Write the value into *pVal if pVal!=0.
199114199316
** return non-zero on success and zero if the next token is not a number.
@@ -229084,11 +229286,11 @@
229084229286
assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
229085229287
229086229288
if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
229087229289
int iIdx = 0; /* Index to search */
229088229290
int iPrefixIdx = 0; /* +1 prefix index */
229089
- if( nToken ) memcpy(&buf.p[1], pToken, nToken);
229291
+ if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken);
229090229292
229091229293
/* Figure out which index to search and set iIdx accordingly. If this
229092229294
** is a prefix query for which there is no prefix index, set iIdx to
229093229295
** greater than pConfig->nPrefix to indicate that the query will be
229094229296
** satisfied by scanning multiple terms in the main index.
@@ -233132,11 +233334,11 @@
233132233334
int nArg, /* Number of args */
233133233335
sqlite3_value **apUnused /* Function arguments */
233134233336
){
233135233337
assert( nArg==0 );
233136233338
UNUSED_PARAM2(nArg, apUnused);
233137
- sqlite3_result_text(pCtx, "fts5: 2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882", -1, SQLITE_TRANSIENT);
233339
+ sqlite3_result_text(pCtx, "fts5: 2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec", -1, SQLITE_TRANSIENT);
233138233340
}
233139233341
233140233342
/*
233141233343
** Return true if zName is the extension on one of the shadow tables used
233142233344
** by this module.
233143233345
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.38.0"
456 #define SQLITE_VERSION_NUMBER 3038000
457 #define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -4128,17 +4128,18 @@
4128 **
4129 ** The values returned by sqlite3_errcode() and/or
4130 ** sqlite3_extended_errcode() might change with each API call.
4131 ** Except, there are some interfaces that are guaranteed to never
4132 ** change the value of the error code. The error-code preserving
4133 ** interfaces are:
4134 **
4135 ** <ul>
4136 ** <li> sqlite3_errcode()
4137 ** <li> sqlite3_extended_errcode()
4138 ** <li> sqlite3_errmsg()
4139 ** <li> sqlite3_errmsg16()
 
4140 ** </ul>
4141 **
4142 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4143 ** text that describes the error, as either UTF-8 or UTF-16 respectively.
4144 ** ^(Memory to hold the error message string is managed internally.
@@ -4148,10 +4149,17 @@
4148 **
4149 ** ^The sqlite3_errstr() interface returns the English-language text
4150 ** that describes the [result code], as UTF-8.
4151 ** ^(Memory to hold the error message string is managed internally
4152 ** and must not be freed by the application)^.
 
 
 
 
 
 
 
4153 **
4154 ** When the serialized [threading mode] is in use, it might be the
4155 ** case that a second error occurs on a separate thread in between
4156 ** the time of the first error and the call to these interfaces.
4157 ** When that happens, the second error will be reported since these
@@ -4168,10 +4176,11 @@
4168 SQLITE_API int sqlite3_errcode(sqlite3 *db);
4169 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
4170 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
4171 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
4172 SQLITE_API const char *sqlite3_errstr(int);
 
4173
4174 /*
4175 ** CAPI3REF: Prepared Statement Object
4176 ** KEYWORDS: {prepared statement} {prepared statements}
4177 **
@@ -9768,18 +9777,37 @@
9768
9769 /*
9770 ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9771 **
9772 ** This function may only be called from within a call to the [xBestIndex]
9773 ** method of a [virtual table].
 
 
9774 **
9775 ** The first argument must be the sqlite3_index_info object that is the
9776 ** first parameter to the xBestIndex() method. The second argument must be
9777 ** an index into the aConstraint[] array belonging to the sqlite3_index_info
9778 ** structure passed to xBestIndex. This function returns a pointer to a buffer
9779 ** containing the name of the collation sequence for the corresponding
9780 ** constraint.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9781 */
9782 SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9783
9784 /*
9785 ** CAPI3REF: Conflict resolution modes
@@ -13565,14 +13593,14 @@
13565 #define TK_DETACH 40
13566 #define TK_EACH 41
13567 #define TK_FAIL 42
13568 #define TK_OR 43
13569 #define TK_AND 44
13570 #define TK_MATCH 45
13571 #define TK_LIKE_KW 46
13572 #define TK_BETWEEN 47
13573 #define TK_IS 48
13574 #define TK_IN 49
13575 #define TK_ISNULL 50
13576 #define TK_NOTNULL 51
13577 #define TK_NE 52
13578 #define TK_EQ 53
@@ -13632,82 +13660,83 @@
13632 #define TK_MINUS 107
13633 #define TK_STAR 108
13634 #define TK_SLASH 109
13635 #define TK_REM 110
13636 #define TK_CONCAT 111
13637 #define TK_COLLATE 112
13638 #define TK_BITNOT 113
13639 #define TK_ON 114
13640 #define TK_INDEXED 115
13641 #define TK_STRING 116
13642 #define TK_JOIN_KW 117
13643 #define TK_CONSTRAINT 118
13644 #define TK_DEFAULT 119
13645 #define TK_NULL 120
13646 #define TK_PRIMARY 121
13647 #define TK_UNIQUE 122
13648 #define TK_CHECK 123
13649 #define TK_REFERENCES 124
13650 #define TK_AUTOINCR 125
13651 #define TK_INSERT 126
13652 #define TK_DELETE 127
13653 #define TK_UPDATE 128
13654 #define TK_SET 129
13655 #define TK_DEFERRABLE 130
13656 #define TK_FOREIGN 131
13657 #define TK_DROP 132
13658 #define TK_UNION 133
13659 #define TK_ALL 134
13660 #define TK_EXCEPT 135
13661 #define TK_INTERSECT 136
13662 #define TK_SELECT 137
13663 #define TK_VALUES 138
13664 #define TK_DISTINCT 139
13665 #define TK_DOT 140
13666 #define TK_FROM 141
13667 #define TK_JOIN 142
13668 #define TK_USING 143
13669 #define TK_ORDER 144
13670 #define TK_GROUP 145
13671 #define TK_HAVING 146
13672 #define TK_LIMIT 147
13673 #define TK_WHERE 148
13674 #define TK_RETURNING 149
13675 #define TK_INTO 150
13676 #define TK_NOTHING 151
13677 #define TK_FLOAT 152
13678 #define TK_BLOB 153
13679 #define TK_INTEGER 154
13680 #define TK_VARIABLE 155
13681 #define TK_CASE 156
13682 #define TK_WHEN 157
13683 #define TK_THEN 158
13684 #define TK_ELSE 159
13685 #define TK_INDEX 160
13686 #define TK_ALTER 161
13687 #define TK_ADD 162
13688 #define TK_WINDOW 163
13689 #define TK_OVER 164
13690 #define TK_FILTER 165
13691 #define TK_COLUMN 166
13692 #define TK_AGG_FUNCTION 167
13693 #define TK_AGG_COLUMN 168
13694 #define TK_TRUEFALSE 169
13695 #define TK_ISNOT 170
13696 #define TK_FUNCTION 171
13697 #define TK_UMINUS 172
13698 #define TK_UPLUS 173
13699 #define TK_TRUTH 174
13700 #define TK_REGISTER 175
13701 #define TK_VECTOR 176
13702 #define TK_SELECT_COLUMN 177
13703 #define TK_IF_NULL_ROW 178
13704 #define TK_ASTERISK 179
13705 #define TK_SPAN 180
13706 #define TK_ERROR 181
13707 #define TK_SPACE 182
13708 #define TK_ILLEGAL 183
 
13709
13710 /************** End of parse.h ***********************************************/
13711 /************** Continuing where we left off in sqliteInt.h ******************/
13712 #include <stdio.h>
13713 #include <stdlib.h>
@@ -15314,15 +15343,15 @@
15314 #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15315 #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15316 #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15317 #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15318 #define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */
15319 #define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15320 #define OP_OpenDup 114
15321 #define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
15322 #define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15323 #define OP_OpenEphemeral 117 /* synopsis: nColumn=P2 */
15324 #define OP_SorterOpen 118
15325 #define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15326 #define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */
15327 #define OP_Close 121
15328 #define OP_ColumnsUsed 122
@@ -15353,12 +15382,12 @@
15353 #define OP_SqlExec 147
15354 #define OP_ParseSchema 148
15355 #define OP_LoadAnalysis 149
15356 #define OP_DropTable 150
15357 #define OP_DropIndex 151
15358 #define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15359 #define OP_DropTrigger 153
15360 #define OP_IntegrityCk 154
15361 #define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */
15362 #define OP_Param 156
15363 #define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */
15364 #define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */
@@ -15411,16 +15440,16 @@
15411 /* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
15412 /* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\
15413 /* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\
15414 /* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
15415 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15416 /* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15417 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15418 /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
15419 /* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\
15420 /* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15421 /* 152 */ 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
15422 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15423 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15424 /* 176 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15425 }
15426
@@ -16489,10 +16518,11 @@
16489 i64 lastRowid; /* ROWID of most recent insert (see above) */
16490 i64 szMmap; /* Default mmap_size setting */
16491 u32 nSchemaLock; /* Do not reset the schema when non-zero */
16492 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
16493 int errCode; /* Most recent error code (SQLITE_*) */
 
16494 int errMask; /* & result codes with this before returning */
16495 int iSysErrno; /* Errno value from last system error */
16496 u32 dbOptFlags; /* Flags to enable/disable optimizations */
16497 u8 enc; /* Text encoding */
16498 u8 autoCommit; /* The auto-commit flag. */
@@ -16725,10 +16755,11 @@
16725 #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
16726 #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
16727 /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
16728 #define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
16729 #define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
 
16730 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
16731
16732 /*
16733 ** Macros for testing whether or not optimizations are enabled or disabled.
16734 */
@@ -16898,11 +16929,11 @@
16898 ** Used to create an aggregate function definition implemented by
16899 ** the C functions xStep and xFinal. The first four parameters
16900 ** are interpreted in the same way as the first 4 parameters to
16901 ** FUNCTION().
16902 **
16903 ** WFUNCTION(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
16904 ** Used to create an aggregate function definition implemented by
16905 ** the C functions xStep and xFinal. The first four parameters
16906 ** are interpreted in the same way as the first 4 parameters to
16907 ** FUNCTION().
16908 **
@@ -16925,10 +16956,14 @@
16925 {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
16926 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
16927 #define MFUNCTION(zName, nArg, xPtr, xFunc) \
16928 {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
16929 xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
 
 
 
 
16930 #define INLINE_FUNC(zName, nArg, iArg, mFlags) \
16931 {nArg, SQLITE_FUNC_BUILTIN|\
16932 SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
16933 SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
16934 #define TEST_FUNC(zName, nArg, iArg, mFlags) \
@@ -18519,10 +18554,12 @@
18519 TableLock *aTableLock; /* Required table locks for shared-cache mode */
18520 #endif
18521 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
18522 Parse *pToplevel; /* Parse structure for main program (or NULL) */
18523 Table *pTriggerTab; /* Table triggers are being coded for */
 
 
18524 union {
18525 int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
18526 Returning *pReturning; /* The RETURNING clause */
18527 } u1;
18528 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -18573,13 +18610,11 @@
18573 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
18574 #ifndef SQLITE_OMIT_VIRTUALTABLE
18575 Token sArg; /* Complete text of a module argument */
18576 Table **apVtabLock; /* Pointer to virtual tables needing locking */
18577 #endif
18578 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
18579 With *pWith; /* Current WITH clause, or NULL */
18580 ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
18581 #ifndef SQLITE_OMIT_ALTERTABLE
18582 RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
18583 #endif
18584 };
18585
@@ -19366,11 +19401,11 @@
19366 SQLITE_PRIVATE void sqlite3Dequote(char*);
19367 SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
19368 SQLITE_PRIVATE void sqlite3DequoteToken(Token*);
19369 SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*);
19370 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);
19371 SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **);
19372 SQLITE_PRIVATE void sqlite3FinishCoding(Parse*);
19373 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
19374 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
19375 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
19376 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
@@ -19646,13 +19681,18 @@
19646 SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,const IdList*);
19647 SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int);
19648 SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*);
19649 SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int);
19650 SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
 
19651 SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void);
19652 SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void);
 
19653 SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);
 
 
 
19654 SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*);
19655 SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*);
19656 SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int);
19657 SQLITE_PRIVATE With *sqlite3WithDup(sqlite3 *db, With *p);
19658
@@ -19932,15 +19972,17 @@
19932 SQLITE_PRIVATE void sqlite3OomClear(sqlite3*);
19933 SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);
19934 SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
19935
19936 SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int);
 
19937 SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
19938 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8);
19939 SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
19940 SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
19941 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
 
19942
19943 SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
19944 SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
19945
19946 #ifndef SQLITE_OMIT_SUBQUERY
@@ -20104,17 +20146,19 @@
20104 SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*);
20105 SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int);
20106 SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int);
20107 SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*);
20108 SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *);
 
20109 #else
20110 #define sqlite3FkActions(a,b,c,d,e,f)
20111 #define sqlite3FkCheck(a,b,c,d,e,f)
20112 #define sqlite3FkDropTable(a,b,c)
20113 #define sqlite3FkOldmask(a,b) 0
20114 #define sqlite3FkRequired(a,b,c,d) 0
20115 #define sqlite3FkReferences(a) 0
 
20116 #endif
20117 #ifndef SQLITE_OMIT_FOREIGN_KEY
20118 SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*);
20119 SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);
20120 #else
@@ -20656,10 +20700,13 @@
20656 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
20657 "DISABLE_FTS4_DEFERRED",
20658 #endif
20659 #ifdef SQLITE_DISABLE_INTRINSIC
20660 "DISABLE_INTRINSIC",
 
 
 
20661 #endif
20662 #ifdef SQLITE_DISABLE_LFS
20663 "DISABLE_LFS",
20664 #endif
20665 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
@@ -20735,13 +20782,10 @@
20735 "ENABLE_ICU",
20736 #endif
20737 #ifdef SQLITE_ENABLE_IOTRACE
20738 "ENABLE_IOTRACE",
20739 #endif
20740 #ifdef SQLITE_ENABLE_JSON1
20741 "ENABLE_JSON1",
20742 #endif
20743 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
20744 "ENABLE_LOAD_EXTENSION",
20745 #endif
20746 #ifdef SQLITE_ENABLE_LOCKING_STYLE
20747 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
@@ -21764,11 +21808,11 @@
21764 ** * A one-row "pseudotable" stored in a single register
21765 */
21766 typedef struct VdbeCursor VdbeCursor;
21767 struct VdbeCursor {
21768 u8 eCurType; /* One of the CURTYPE_* values above */
21769 i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */
21770 u8 nullRow; /* True if pointing to a row with no data */
21771 u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
21772 u8 isTable; /* True for rowid tables. False for indexes */
21773 #ifdef SQLITE_DEBUG
21774 u8 seekOp; /* Most recent seek operation on this cursor */
@@ -21777,13 +21821,15 @@
21777 Bool isEphemeral:1; /* True for an ephemeral table */
21778 Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
21779 Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
21780 Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */
21781 u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
21782 Btree *pBtx; /* Separate file holding temporary table */
 
 
 
21783 i64 seqCount; /* Sequence counter */
21784 u32 *aAltMap; /* Mapping from table to index column numbers */
21785
21786 /* Cached OP_Column parse information is only valid if cacheStatus matches
21787 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
21788 ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that
21789 ** the cache is out of date. */
@@ -22181,11 +22227,11 @@
22181 SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor**, u32*);
22182 SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*);
22183 SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32);
22184 SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8);
22185 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
22186 SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
22187 SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
22188
22189 int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
22190 SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
22191 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
@@ -23319,22 +23365,21 @@
23319 **
23320 ** Where NNN is an arbitrary floating-point number and "days" can be one
23321 ** of several units of time.
23322 */
23323 static const struct {
23324 u8 eType; /* Transformation type code */
23325 u8 nName; /* Length of th name */
23326 char *zName; /* Name of the transformation */
23327 double rLimit; /* Maximum NNN value for this transform */
23328 double rXform; /* Constant used for this transform */
23329 } aXformType[] = {
23330 { 0, 6, "second", 464269060800.0, 1000.0 },
23331 { 0, 6, "minute", 7737817680.0, 60000.0 },
23332 { 0, 4, "hour", 128963628.0, 3600000.0 },
23333 { 0, 3, "day", 5373485.0, 86400000.0 },
23334 { 1, 5, "month", 176546.0, 2592000000.0 },
23335 { 2, 4, "year", 14713.0, 31536000000.0 },
23336 };
23337
23338 /*
23339 ** Process a modifier to a date-time stamp. The modifiers are
23340 ** as follows:
@@ -23567,33 +23612,35 @@
23567 for(i=0; i<ArraySize(aXformType); i++){
23568 if( aXformType[i].nName==n
23569 && sqlite3_strnicmp(aXformType[i].zName, z, n)==0
23570 && r>-aXformType[i].rLimit && r<aXformType[i].rLimit
23571 ){
23572 switch( aXformType[i].eType ){
23573 case 1: { /* Special processing to add months */
23574 int x;
 
23575 computeYMD_HMS(p);
23576 p->M += (int)r;
23577 x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
23578 p->Y += x;
23579 p->M -= x*12;
23580 p->validJD = 0;
23581 r -= (int)r;
23582 break;
23583 }
23584 case 2: { /* Special processing to add years */
23585 int y = (int)r;
 
23586 computeYMD_HMS(p);
23587 p->Y += y;
23588 p->validJD = 0;
23589 r -= (int)r;
23590 break;
23591 }
23592 }
23593 computeJD(p);
23594 p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder);
23595 rc = 0;
23596 break;
23597 }
23598 }
23599 clearYMD_HMS_TZ(p);
@@ -29835,10 +29882,11 @@
29835 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
29836 pToken = va_arg(ap, Token*);
29837 assert( bArgList==0 );
29838 if( pToken && pToken->n ){
29839 sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
 
29840 }
29841 length = width = 0;
29842 break;
29843 }
29844 case etSRCITEM: {
@@ -29889,18 +29937,42 @@
29889 zExtra = 0;
29890 }
29891 }/* End for loop over the format string */
29892 } /* End of function */
29893
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29894 /*
29895 ** Enlarge the memory allocation on a StrAccum object so that it is
29896 ** able to accept at least N more bytes of text.
29897 **
29898 ** Return the number of bytes of text that StrAccum is able to accept
29899 ** after the attempted enlargement. The value returned might be zero.
29900 */
29901 static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
29902 char *zNew;
29903 assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */
29904 if( p->accError ){
29905 testcase(p->accError==SQLITE_TOOBIG);
29906 testcase(p->accError==SQLITE_NOMEM);
@@ -32212,20 +32284,25 @@
32212 ** that would be appropriate.
32213 */
32214 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
32215 assert( db!=0 );
32216 db->errCode = err_code;
32217 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
 
 
 
 
32218 }
32219
32220 /*
32221 ** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
32222 ** and error message.
32223 */
32224 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
32225 assert( db!=0 );
32226 db->errCode = SQLITE_OK;
 
32227 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
32228 }
32229
32230 /*
32231 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
@@ -32242,21 +32319,12 @@
32242 /*
32243 ** Set the most recent error code and error string for the sqlite
32244 ** handle "db". The error code is set to "err_code".
32245 **
32246 ** If it is not NULL, string zFormat specifies the format of the
32247 ** error string in the style of the printf functions: The following
32248 ** format characters are allowed:
32249 **
32250 ** %s Insert a string
32251 ** %z A string that should be freed after use
32252 ** %d Insert an integer
32253 ** %T Insert a token
32254 ** %S Insert the first element of a SrcList
32255 **
32256 ** zFormat and any string tokens that follow it are assumed to be
32257 ** encoded in UTF-8.
32258 **
32259 ** To clear the most recent error for sqlite handle "db", sqlite3Error
32260 ** should be called with err_code set to SQLITE_OK and zFormat set
32261 ** to NULL.
32262 */
@@ -32276,17 +32344,10 @@
32276 }
32277 }
32278
32279 /*
32280 ** Add an error message to pParse->zErrMsg and increment pParse->nErr.
32281 ** The following formatting characters are allowed:
32282 **
32283 ** %s Insert a string
32284 ** %z A string that should be freed after use
32285 ** %d Insert an integer
32286 ** %T Insert a token
32287 ** %S Insert the first element of a SrcList
32288 **
32289 ** This function should be used to report any error that occurs while
32290 ** compiling an SQL statement (i.e. within sqlite3_prepare()). The
32291 ** last thing the sqlite3_prepare() function does is copy the error
32292 ** stored by this function into the database handle using sqlite3Error().
@@ -32295,13 +32356,15 @@
32295 */
32296 SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
32297 char *zMsg;
32298 va_list ap;
32299 sqlite3 *db = pParse->db;
 
32300 va_start(ap, zFormat);
32301 zMsg = sqlite3VMPrintf(db, zFormat, ap);
32302 va_end(ap);
 
32303 if( db->suppressErr ){
32304 sqlite3DbFree(db, zMsg);
32305 }else{
32306 pParse->nErr++;
32307 sqlite3DbFree(db, pParse->zErrMsg);
@@ -34211,15 +34274,15 @@
34211 /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
34212 /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
34213 /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
34214 /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
34215 /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34216 /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34217 /* 114 */ "OpenDup" OpHelp(""),
34218 /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34219 /* 116 */ "String8" OpHelp("r[P2]='P4'"),
34220 /* 117 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34221 /* 118 */ "SorterOpen" OpHelp(""),
34222 /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34223 /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34224 /* 121 */ "Close" OpHelp(""),
34225 /* 122 */ "ColumnsUsed" OpHelp(""),
@@ -34250,12 +34313,12 @@
34250 /* 147 */ "SqlExec" OpHelp(""),
34251 /* 148 */ "ParseSchema" OpHelp(""),
34252 /* 149 */ "LoadAnalysis" OpHelp(""),
34253 /* 150 */ "DropTable" OpHelp(""),
34254 /* 151 */ "DropIndex" OpHelp(""),
34255 /* 152 */ "Real" OpHelp("r[P2]=P4"),
34256 /* 153 */ "DropTrigger" OpHelp(""),
34257 /* 154 */ "IntegrityCk" OpHelp(""),
34258 /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34259 /* 156 */ "Param" OpHelp(""),
34260 /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34261 /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
@@ -56614,12 +56677,11 @@
56614 **
56615 ** a) The page number is less than or equal to the size of the
56616 ** current database image, in pages, OR
56617 **
56618 ** b) if the page content were written at this time, it would not
56619 ** be necessary to write the current content out to the sub-journal
56620 ** (as determined by function subjRequiresPage()).
56621 **
56622 ** If the condition asserted by this function were not true, and the
56623 ** dirty page were to be discarded from the cache via the pagerStress()
56624 ** routine, pagerStress() would not write the current page content to
56625 ** the database file. If a savepoint transaction were rolled back after
@@ -56630,12 +56692,20 @@
56630 ** database image would become corrupt. It is therefore fortunate that
56631 ** this circumstance cannot arise.
56632 */
56633 #if defined(SQLITE_DEBUG)
56634 static void assertTruncateConstraintCb(PgHdr *pPg){
 
56635 assert( pPg->flags&PGHDR_DIRTY );
56636 assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
 
 
 
 
 
 
 
56637 }
56638 static void assertTruncateConstraint(Pager *pPager){
56639 sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
56640 }
56641 #else
@@ -57972,11 +58042,11 @@
57972 ** other connection managed to get in and roll it back before
57973 ** this connection obtained the exclusive lock above. Or, it
57974 ** may mean that the pager was in the error-state when this
57975 ** function was called and the journal file does not exist.
57976 */
57977 if( !isOpen(pPager->jfd) ){
57978 sqlite3_vfs * const pVfs = pPager->pVfs;
57979 int bExists; /* True if journal file exists */
57980 rc = sqlite3OsAccess(
57981 pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);
57982 if( rc==SQLITE_OK && bExists ){
@@ -58374,10 +58444,11 @@
58374 Pager *pPager, /* The pager open on the database file */
58375 Pgno pgno, /* Page number to fetch */
58376 DbPage **ppPage, /* Write a pointer to the page here */
58377 int flags /* PAGER_GET_XXX flags */
58378 ){
 
58379 return pPager->xGet(pPager, pgno, ppPage, flags);
58380 }
58381
58382 /*
58383 ** Acquire a page if it is already in the in-memory cache. Do
@@ -59979,16 +60050,16 @@
59979 */
59980 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
59981 u8 eOld = pPager->journalMode; /* Prior journalmode */
59982
59983 /* The eMode parameter is always valid */
59984 assert( eMode==PAGER_JOURNALMODE_DELETE
59985 || eMode==PAGER_JOURNALMODE_TRUNCATE
59986 || eMode==PAGER_JOURNALMODE_PERSIST
59987 || eMode==PAGER_JOURNALMODE_OFF
59988 || eMode==PAGER_JOURNALMODE_WAL
59989 || eMode==PAGER_JOURNALMODE_MEMORY );
59990
59991 /* This routine is only called from the OP_JournalMode opcode, and
59992 ** the logic there will never allow a temporary file to be changed
59993 ** to WAL mode.
59994 */
@@ -60021,11 +60092,10 @@
60021 assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
60022 assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
60023
60024 assert( isOpen(pPager->fd) || pPager->exclusiveMode );
60025 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
60026
60027 /* In this case we would like to delete the journal file. If it is
60028 ** not possible, then that is not a problem. Deleting the journal file
60029 ** here is an optimization only.
60030 **
60031 ** Before deleting the journal file, obtain a RESERVED lock on the
@@ -66854,32 +66924,46 @@
66854
66855 /* The next block of code is equivalent to:
66856 **
66857 ** pIter += getVarint(pIter, (u64*)&pInfo->nKey);
66858 **
66859 ** The code is inlined to avoid a function call.
 
66860 */
66861 iKey = *pIter;
66862 if( iKey>=0x80 ){
66863 u8 *pEnd = &pIter[7];
66864 iKey &= 0x7f;
66865 while(1){
66866 iKey = (iKey<<7) | (*++pIter & 0x7f);
66867 if( (*pIter)<0x80 ) break;
66868 if( pIter>=pEnd ){
66869 iKey = (iKey<<8) | *++pIter;
66870 break;
 
 
 
 
 
 
 
 
 
 
 
 
 
66871 }
66872 }
66873 }
66874 pIter++;
66875
66876 pInfo->nKey = *(i64*)&iKey;
66877 pInfo->nPayload = nPayload;
66878 pInfo->pPayload = pIter;
66879 testcase( nPayload==pPage->maxLocal );
66880 testcase( nPayload==pPage->maxLocal+1 );
66881 if( nPayload<=pPage->maxLocal ){
66882 /* This is the (easy) common case where the entire payload fits
66883 ** on the local page. No overflow is required.
66884 */
66885 pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66912,11 +66996,11 @@
66912 pIter++;
66913 pInfo->nKey = nPayload;
66914 pInfo->nPayload = nPayload;
66915 pInfo->pPayload = pIter;
66916 testcase( nPayload==pPage->maxLocal );
66917 testcase( nPayload==pPage->maxLocal+1 );
66918 if( nPayload<=pPage->maxLocal ){
66919 /* This is the (easy) common case where the entire payload fits
66920 ** on the local page. No overflow is required.
66921 */
66922 pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66975,19 +67059,19 @@
66975 ** past the end of the key value. */
66976 pEnd = &pIter[9];
66977 while( (*pIter++)&0x80 && pIter<pEnd );
66978 }
66979 testcase( nSize==pPage->maxLocal );
66980 testcase( nSize==pPage->maxLocal+1 );
66981 if( nSize<=pPage->maxLocal ){
66982 nSize += (u32)(pIter - pCell);
66983 if( nSize<4 ) nSize = 4;
66984 }else{
66985 int minLocal = pPage->minLocal;
66986 nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
66987 testcase( nSize==pPage->maxLocal );
66988 testcase( nSize==pPage->maxLocal+1 );
66989 if( nSize>pPage->maxLocal ){
66990 nSize = minLocal;
66991 }
66992 nSize += 4 + (u16)(pIter - pCell);
66993 }
@@ -69882,11 +69966,11 @@
69882 */
69883 static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
69884 int nPage = get4byte(&pPage1->aData[28]);
69885 testcase( nPage==0 );
69886 if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
69887 testcase( pBt->nPage!=nPage );
69888 pBt->nPage = nPage;
69889 }
69890
69891 /*
69892 ** Rollback the transaction in progress.
@@ -70903,11 +70987,11 @@
70903 if( pCur->iPage ){
70904 releasePageNotNull(pCur->pPage);
70905 while( --pCur->iPage ){
70906 releasePageNotNull(pCur->apPage[pCur->iPage]);
70907 }
70908 pCur->pPage = pCur->apPage[0];
70909 goto skip_init;
70910 }
70911 }else if( pCur->pgnoRoot==0 ){
70912 pCur->eState = CURSOR_INVALID;
70913 return SQLITE_EMPTY;
@@ -70950,11 +71034,10 @@
70950 skip_init:
70951 pCur->ix = 0;
70952 pCur->info.nSize = 0;
70953 pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
70954
70955 pRoot = pCur->pPage;
70956 if( pRoot->nCell>0 ){
70957 pCur->eState = CURSOR_VALID;
70958 }else if( !pRoot->leaf ){
70959 Pgno subpage;
70960 if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
@@ -71191,11 +71274,10 @@
71191 assert( pPage->intKey );
71192 lwr = 0;
71193 upr = pPage->nCell-1;
71194 assert( biasRight==0 || biasRight==1 );
71195 idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
71196 pCur->ix = (u16)idx;
71197 for(;;){
71198 i64 nCellKey;
71199 pCell = findCellPastPtr(pPage, idx);
71200 if( pPage->intKeyLeaf ){
71201 while( 0x80 <= *(pCell++) ){
@@ -71333,11 +71415,10 @@
71333 assert( pPage->nCell>0 );
71334 assert( pPage->intKey==(pIdxKey==0) );
71335 lwr = 0;
71336 upr = pPage->nCell-1;
71337 idx = upr>>1; /* idx = (lwr+upr)/2; */
71338 pCur->ix = (u16)idx;
71339 for(;;){
71340 int nCell; /* Size of the pCell cell in bytes */
71341 pCell = findCellPastPtr(pPage, idx);
71342
71343 /* The maximum supported page-size is 65536 bytes. This means that
@@ -72449,20 +72530,22 @@
72449 u8 *ptr; /* Used to move bytes around within data[] */
72450 int rc; /* The return code */
72451 int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
72452
72453 if( *pRC ) return;
72454 assert( idx>=0 && idx<pPage->nCell );
 
72455 assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
72456 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
72457 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
72458 assert( pPage->nFree>=0 );
72459 data = pPage->aData;
72460 ptr = &pPage->aCellIdx[2*idx];
 
72461 pc = get2byte(ptr);
72462 hdr = pPage->hdrOffset;
72463 testcase( pc==get2byte(&data[hdr+5]) );
72464 testcase( pc+sz==pPage->pBt->usableSize );
72465 if( pc+sz > pPage->pBt->usableSize ){
72466 *pRC = SQLITE_CORRUPT_BKPT;
72467 return;
72468 }
@@ -72750,11 +72833,11 @@
72750 int k; /* Current slot in pCArray->apEnd[] */
72751 u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
72752
72753 assert( i<iEnd );
72754 j = get2byte(&aData[hdr+5]);
72755 if( NEVER(j>(u32)usableSize) ){ j = 0; }
72756 memcpy(&pTmp[j], &aData[j], usableSize - j);
72757
72758 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
72759 pSrcEnd = pCArray->apEnd[k];
72760
@@ -72981,11 +73064,11 @@
72981 nCell -= nTail;
72982 }
72983
72984 pData = &aData[get2byteNotZero(&aData[hdr+5])];
72985 if( pData<pBegin ) goto editpage_fail;
72986 if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
72987
72988 /* Add cells to the start of the page */
72989 if( iNew<iOld ){
72990 int nAdd = MIN(nNew,iOld-iNew);
72991 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -74857,18 +74940,17 @@
74857 ** but which might be used by alternative storage engines.
74858 */
74859 SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
74860 Btree *p = pCur->pBtree;
74861 BtShared *pBt = p->pBt;
74862 int rc; /* Return code */
74863 MemPage *pPage; /* Page to delete cell from */
74864 unsigned char *pCell; /* Pointer to cell to delete */
74865 int iCellIdx; /* Index of cell to delete */
74866 int iCellDepth; /* Depth of node containing pCell */
74867 CellInfo info; /* Size of the cell being deleted */
74868 int bSkipnext = 0; /* Leaf cursor in SKIPNEXT state */
74869 u8 bPreserve = flags & BTREE_SAVEPOSITION; /* Keep cursor valid */
74870
74871 assert( cursorOwnsBtShared(pCur) );
74872 assert( pBt->inTransaction==TRANS_WRITE );
74873 assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
74874 assert( pCur->curFlags & BTCF_WriteFlag );
@@ -74883,22 +74965,35 @@
74883 assert( CORRUPT_DB || pCur->eState==CURSOR_VALID );
74884
74885 iCellDepth = pCur->iPage;
74886 iCellIdx = pCur->ix;
74887 pPage = pCur->pPage;
 
 
 
74888 pCell = findCell(pPage, iCellIdx);
74889 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT;
 
 
74890
74891 /* If the bPreserve flag is set to true, then the cursor position must
74892 ** be preserved following this delete operation. If the current delete
74893 ** will cause a b-tree rebalance, then this is done by saving the cursor
74894 ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
74895 ** returning.
74896 **
74897 ** Or, if the current delete will not cause a rebalance, then the cursor
74898 ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately
74899 ** before or after the deleted entry. In this case set bSkipnext to true. */
 
 
 
 
 
 
 
 
74900 if( bPreserve ){
74901 if( !pPage->leaf
74902 || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)
74903 || pPage->nCell==1 /* See dbfuzz001.test for a test case */
74904 ){
@@ -74905,11 +75000,11 @@
74905 /* A b-tree rebalance will be required after deleting this entry.
74906 ** Save the cursor key. */
74907 rc = saveCursorKey(pCur);
74908 if( rc ) return rc;
74909 }else{
74910 bSkipnext = 1;
74911 }
74912 }
74913
74914 /* If the page containing the entry to delete is not a leaf page, move
74915 ** the cursor to the largest entry in the tree that is smaller than
@@ -75005,12 +75100,12 @@
75005 pCur->pPage = pCur->apPage[pCur->iPage];
75006 rc = balance(pCur);
75007 }
75008
75009 if( rc==SQLITE_OK ){
75010 if( bSkipnext ){
75011 assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
75012 assert( pPage==pCur->pPage || CORRUPT_DB );
75013 assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
75014 pCur->eState = CURSOR_SKIPNEXT;
75015 if( iCellIdx>=pPage->nCell ){
75016 pCur->skipNext = -1;
@@ -81704,12 +81799,10 @@
81704 */
81705 SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
81706 if( pCx==0 ){
81707 return;
81708 }
81709 assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE );
81710 assert( pCx->pBtx==0 || pCx->isEphemeral );
81711 switch( pCx->eCurType ){
81712 case CURTYPE_SORTER: {
81713 sqlite3VdbeSorterClose(p->db, pCx);
81714 break;
81715 }
@@ -82807,11 +82900,11 @@
82807 VdbeCursor *p = *pp;
82808 assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
82809 if( p->deferredMoveto ){
82810 u32 iMap;
82811 assert( !p->isEphemeral );
82812 if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
82813 *pp = p->pAltCursor;
82814 *piCol = iMap - 1;
82815 return SQLITE_OK;
82816 }
82817 return sqlite3VdbeFinishMoveto(p);
@@ -83085,18 +83178,18 @@
83085 #define FOUR_BYTE_UINT(x) (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
83086 #define FOUR_BYTE_INT(x) (16777216*(i8)((x)[0])|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
83087
83088 /*
83089 ** Deserialize the data blob pointed to by buf as serial type serial_type
83090 ** and store the result in pMem. Return the number of bytes read.
83091 **
83092 ** This function is implemented as two separate routines for performance.
83093 ** The few cases that require local variables are broken out into a separate
83094 ** routine so that in most cases the overhead of moving the stack pointer
83095 ** is avoided.
83096 */
83097 static u32 serialGet(
83098 const unsigned char *buf, /* Buffer to deserialize from */
83099 u32 serial_type, /* Serial type to deserialize */
83100 Mem *pMem /* Memory cell to write value into */
83101 ){
83102 u64 x = FOUR_BYTE_UINT(buf);
@@ -83126,13 +83219,12 @@
83126 assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
83127 swapMixedEndianFloat(x);
83128 memcpy(&pMem->u.r, &x, sizeof(x));
83129 pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
83130 }
83131 return 8;
83132 }
83133 SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
83134 const unsigned char *buf, /* Buffer to deserialize from */
83135 u32 serial_type, /* Serial type to deserialize */
83136 Mem *pMem /* Memory cell to write value into */
83137 ){
83138 switch( serial_type ){
@@ -83139,41 +83231,41 @@
83139 case 10: { /* Internal use only: NULL with virtual table
83140 ** UPDATE no-change flag set */
83141 pMem->flags = MEM_Null|MEM_Zero;
83142 pMem->n = 0;
83143 pMem->u.nZero = 0;
83144 break;
83145 }
83146 case 11: /* Reserved for future use */
83147 case 0: { /* Null */
83148 /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
83149 pMem->flags = MEM_Null;
83150 break;
83151 }
83152 case 1: {
83153 /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
83154 ** integer. */
83155 pMem->u.i = ONE_BYTE_INT(buf);
83156 pMem->flags = MEM_Int;
83157 testcase( pMem->u.i<0 );
83158 return 1;
83159 }
83160 case 2: { /* 2-byte signed integer */
83161 /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
83162 ** twos-complement integer. */
83163 pMem->u.i = TWO_BYTE_INT(buf);
83164 pMem->flags = MEM_Int;
83165 testcase( pMem->u.i<0 );
83166 return 2;
83167 }
83168 case 3: { /* 3-byte signed integer */
83169 /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
83170 ** twos-complement integer. */
83171 pMem->u.i = THREE_BYTE_INT(buf);
83172 pMem->flags = MEM_Int;
83173 testcase( pMem->u.i<0 );
83174 return 3;
83175 }
83176 case 4: { /* 4-byte signed integer */
83177 /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
83178 ** twos-complement integer. */
83179 pMem->u.i = FOUR_BYTE_INT(buf);
@@ -83181,33 +83273,34 @@
83181 /* Work around a sign-extension bug in the HP compiler for HP/UX */
83182 if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;
83183 #endif
83184 pMem->flags = MEM_Int;
83185 testcase( pMem->u.i<0 );
83186 return 4;
83187 }
83188 case 5: { /* 6-byte signed integer */
83189 /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
83190 ** twos-complement integer. */
83191 pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
83192 pMem->flags = MEM_Int;
83193 testcase( pMem->u.i<0 );
83194 return 6;
83195 }
83196 case 6: /* 8-byte signed integer */
83197 case 7: { /* IEEE floating point */
83198 /* These use local variables, so do them in a separate routine
83199 ** to avoid having to move the frame pointer in the common case */
83200 return serialGet(buf,serial_type,pMem);
 
83201 }
83202 case 8: /* Integer 0 */
83203 case 9: { /* Integer 1 */
83204 /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
83205 /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
83206 pMem->u.i = serial_type-8;
83207 pMem->flags = MEM_Int;
83208 return 0;
83209 }
83210 default: {
83211 /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
83212 ** length.
83213 ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
@@ -83214,14 +83307,14 @@
83214 ** (N-13)/2 bytes in length. */
83215 static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
83216 pMem->z = (char *)buf;
83217 pMem->n = (serial_type-12)/2;
83218 pMem->flags = aFlag[serial_type&1];
83219 return pMem->n;
83220 }
83221 }
83222 return 0;
83223 }
83224 /*
83225 ** This routine is used to allocate sufficient space for an UnpackedRecord
83226 ** structure large enough to be used with sqlite3VdbeRecordUnpack() if
83227 ** the first argument is a pointer to KeyInfo structure pKeyInfo.
@@ -83280,11 +83373,12 @@
83280 pMem->enc = pKeyInfo->enc;
83281 pMem->db = pKeyInfo->db;
83282 /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
83283 pMem->szMalloc = 0;
83284 pMem->z = 0;
83285 d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
 
83286 pMem++;
83287 if( (++u)>=p->nField ) break;
83288 }
83289 if( d>(u32)nKey && u ){
83290 assert( CORRUPT_DB );
@@ -83364,11 +83458,12 @@
83364 break;
83365 }
83366
83367 /* Extract the values to be compared.
83368 */
83369 d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
 
83370
83371 /* Do the comparison
83372 */
83373 rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
83374 pKeyInfo->nAllField>i ? pKeyInfo->aColl[i] : 0);
@@ -84168,11 +84263,11 @@
84168 }
84169
84170 /* The index entry must begin with a header size */
84171 getVarint32NR((u8*)m.z, szHdr);
84172 testcase( szHdr==3 );
84173 testcase( szHdr==m.n );
84174 testcase( szHdr>0x7fffffff );
84175 assert( m.n>=0 );
84176 if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
84177 goto idx_rowid_corruption;
84178 }
@@ -87006,11 +87101,10 @@
87006 */
87007 static VdbeCursor *allocateCursor(
87008 Vdbe *p, /* The virtual machine */
87009 int iCur, /* Index of the new VdbeCursor */
87010 int nField, /* Number of fields in the table or index */
87011 int iDb, /* Database the cursor belongs to, or -1 */
87012 u8 eCurType /* Type of the new cursor */
87013 ){
87014 /* Find the memory cell that will be used to store the blob of memory
87015 ** required for this VdbeCursor structure. It is convenient to use a
87016 ** vdbe memory cell to manage the memory allocation required for a
@@ -87063,11 +87157,10 @@
87063 }
87064
87065 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
87066 memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
87067 pCx->eCurType = eCurType;
87068 pCx->iDb = iDb;
87069 pCx->nField = nField;
87070 pCx->aOffset = &pCx->aType[nField];
87071 if( eCurType==CURTYPE_BTREE ){
87072 pCx->uc.pCursor = (BtCursor*)
87073 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
@@ -87446,11 +87539,10 @@
87446 int i, mx;
87447 u64 h = 0;
87448
87449 i = pOp->p3;
87450 assert( pOp->p4type==P4_INT32 );
87451 mx = i + pOp->p4.i;
87452 for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
87453 const Mem *p = &aMem[i];
87454 if( p->flags & (MEM_Int|MEM_IntReal) ){
87455 h += p->u.i;
87456 }else if( p->flags & MEM_Real ){
@@ -89458,10 +89550,11 @@
89458 pDest = &aMem[pOp->p3];
89459 memAboutToChange(p, pDest);
89460 assert( pC!=0 );
89461 assert( p2<(u32)pC->nField );
89462 aOffset = pC->aOffset;
 
89463 assert( pC->eCurType!=CURTYPE_VTAB );
89464 assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );
89465 assert( pC->eCurType!=CURTYPE_SORTER );
89466
89467 if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
@@ -90607,10 +90700,11 @@
90607 rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);
90608 if( pOp->p2==BTREE_SCHEMA_VERSION ){
90609 /* When the schema cookie changes, record the new cookie internally */
90610 pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5;
90611 db->mDbFlags |= DBFLAG_SchemaChange;
 
90612 }else if( pOp->p2==BTREE_FILE_FORMAT ){
90613 /* Record changes in the file format */
90614 pDb->pSchema->file_format = pOp->p3;
90615 }
90616 if( pOp->p1==1 ){
@@ -90784,12 +90878,13 @@
90784 nField = pOp->p4.i;
90785 }
90786 assert( pOp->p1>=0 );
90787 assert( nField>=0 );
90788 testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */
90789 pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE);
90790 if( pCur==0 ) goto no_mem;
 
90791 pCur->nullRow = 1;
90792 pCur->isOrdered = 1;
90793 pCur->pgnoRoot = p2;
90794 #ifdef SQLITE_DEBUG
90795 pCur->wrFlag = wrFlag;
@@ -90827,22 +90922,22 @@
90827
90828 pOrig = p->apCsr[pOp->p2];
90829 assert( pOrig );
90830 assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */
90831
90832 pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE);
90833 if( pCx==0 ) goto no_mem;
90834 pCx->nullRow = 1;
90835 pCx->isEphemeral = 1;
90836 pCx->pKeyInfo = pOrig->pKeyInfo;
90837 pCx->isTable = pOrig->isTable;
90838 pCx->pgnoRoot = pOrig->pgnoRoot;
90839 pCx->isOrdered = pOrig->isOrdered;
90840 pCx->pBtx = pOrig->pBtx;
90841 pCx->hasBeenDuped = 1;
90842 pOrig->hasBeenDuped = 1;
90843 rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
90844 pCx->pKeyInfo, pCx->uc.pCursor);
90845 /* The sqlite3BtreeCursor() routine can only fail for the first cursor
90846 ** opened for a database. Since there is already an open cursor when this
90847 ** opcode is run, the sqlite3BtreeCursor() cannot fail */
90848 assert( rc==SQLITE_OK );
@@ -90911,48 +91006,48 @@
90911 ** OP_OpenDup, then erase all existing content so that the table is
90912 ** empty again, rather than creating a new table. */
90913 assert( pCx->isEphemeral );
90914 pCx->seqCount = 0;
90915 pCx->cacheStatus = CACHE_STALE;
90916 rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
90917 }else{
90918 pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
90919 if( pCx==0 ) goto no_mem;
90920 pCx->isEphemeral = 1;
90921 rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx,
90922 BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
90923 vfsFlags);
90924 if( rc==SQLITE_OK ){
90925 rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
90926 if( rc==SQLITE_OK ){
90927 /* If a transient index is required, create it by calling
90928 ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before
90929 ** opening it. If a transient table is required, just use the
90930 ** automatically created table with root-page 1 (an BLOB_INTKEY table).
90931 */
90932 if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
90933 assert( pOp->p4type==P4_KEYINFO );
90934 rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
90935 BTREE_BLOBKEY | pOp->p5);
90936 if( rc==SQLITE_OK ){
90937 assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
90938 assert( pKeyInfo->db==db );
90939 assert( pKeyInfo->enc==ENC(db) );
90940 rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
90941 pKeyInfo, pCx->uc.pCursor);
90942 }
90943 pCx->isTable = 0;
90944 }else{
90945 pCx->pgnoRoot = SCHEMA_ROOT;
90946 rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR,
90947 0, pCx->uc.pCursor);
90948 pCx->isTable = 1;
90949 }
90950 }
90951 pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
90952 if( rc ){
90953 sqlite3BtreeClose(pCx->pBtx);
90954 }
90955 }
90956 }
90957 if( rc ) goto abort_due_to_error;
90958 pCx->nullRow = 1;
@@ -90972,11 +91067,11 @@
90972 case OP_SorterOpen: {
90973 VdbeCursor *pCx;
90974
90975 assert( pOp->p1>=0 );
90976 assert( pOp->p2>=0 );
90977 pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER);
90978 if( pCx==0 ) goto no_mem;
90979 pCx->pKeyInfo = pOp->p4.pKeyInfo;
90980 assert( pCx->pKeyInfo->db==db );
90981 assert( pCx->pKeyInfo->enc==ENC(db) );
90982 rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);
@@ -91021,11 +91116,11 @@
91021 case OP_OpenPseudo: {
91022 VdbeCursor *pCx;
91023
91024 assert( pOp->p1>=0 );
91025 assert( pOp->p3>=0 );
91026 pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);
91027 if( pCx==0 ) goto no_mem;
91028 pCx->nullRow = 1;
91029 pCx->seekResult = pOp->p2;
91030 pCx->isTable = 1;
91031 /* Give this pseudo-cursor a fake BtCursor pointer so that pCx
@@ -92961,13 +93056,13 @@
92961 assert( pTabCur->isTable );
92962 pTabCur->nullRow = 0;
92963 pTabCur->movetoTarget = rowid;
92964 pTabCur->deferredMoveto = 1;
92965 assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );
92966 pTabCur->aAltMap = pOp->p4.ai;
92967 assert( !pC->isEphemeral );
92968 assert( !pTabCur->isEphemeral );
 
 
92969 pTabCur->pAltCursor = pC;
92970 }else{
92971 pOut = out2Prerelease(p, pOp);
92972 pOut->u.i = rowid;
92973 }
@@ -94485,11 +94580,11 @@
94485
94486 /* Initialize sqlite3_vtab_cursor base class */
94487 pVCur->pVtab = pVtab;
94488
94489 /* Initialize vdbe cursor object */
94490 pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);
94491 if( pCur ){
94492 pCur->uc.pVCur = pVCur;
94493 pVtab->nRef++;
94494 }else{
94495 assert( db->mallocFailed );
@@ -96810,11 +96905,12 @@
96810 if( nWorker>=SORTER_MAX_MERGE_COUNT ){
96811 nWorker = SORTER_MAX_MERGE_COUNT-1;
96812 }
96813 #endif
96814
96815 assert( pCsr->pKeyInfo && pCsr->pBtx==0 );
 
96816 assert( pCsr->eCurType==CURTYPE_SORTER );
96817 szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
96818 sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
96819
96820 pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
@@ -99310,11 +99406,11 @@
99310 if( size==0 ){
99311 memjrnlFreeChunks(p->pFirst);
99312 p->pFirst = 0;
99313 }else{
99314 i64 iOff = p->nChunkSize;
99315 for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){
99316 iOff += p->nChunkSize;
99317 }
99318 if( ALWAYS(pIter) ){
99319 memjrnlFreeChunks(pIter->pNext);
99320 pIter->pNext = 0;
@@ -100064,12 +100160,13 @@
100064 hit = 1;
100065 }
100066 }
100067 if( hit || zTab==0 ) continue;
100068 }
100069 if( zDb && pTab->pSchema!=pSchema ){
100070 continue;
 
100071 }
100072 if( zTab ){
100073 const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
100074 assert( zTabName!=0 );
100075 if( sqlite3StrICmp(zTabName, zTab)!=0 ){
@@ -100196,10 +100293,11 @@
100196 {
100197 assert( ExprUseYTab(pExpr) );
100198 pExpr->y.pTab = pTab;
100199 if( pParse->bReturning ){
100200 eNewExprOp = TK_REGISTER;
 
100201 pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable +
100202 sqlite3TableColumnToStorage(pTab, iCol) + 1;
100203 }else{
100204 pExpr->iColumn = (i16)iCol;
100205 eNewExprOp = TK_TRIGGER;
@@ -109275,11 +109373,10 @@
109275 sqlite3 *db, /* Database handle */
109276 const char *zSql, /* SQL to parse */
109277 int bTemp /* True if SQL is from temp schema */
109278 ){
109279 int rc;
109280 char *zErr = 0;
109281
109282 db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
109283
109284 /* Parse the SQL statement passed as the first argument. If no error
109285 ** occurs and the parse does not result in a new table, index or
@@ -109286,14 +109383,11 @@
109286 ** trigger object, the database must be corrupt. */
109287 memset(p, 0, sizeof(Parse));
109288 p->eParseMode = PARSE_MODE_RENAME;
109289 p->db = db;
109290 p->nQueryLoop = 1;
109291 rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
109292 assert( p->zErrMsg==0 );
109293 assert( rc!=SQLITE_OK || zErr==0 );
109294 p->zErrMsg = zErr;
109295 if( db->mallocFailed ) rc = SQLITE_NOMEM;
109296 if( rc==SQLITE_OK
109297 && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
109298 ){
109299 rc = SQLITE_CORRUPT_BKPT;
@@ -113359,11 +113453,11 @@
113359 Returning *pReturning = pParse->u1.pReturning;
113360 int addrRewind;
113361 int i;
113362 int reg;
113363
113364 if( pReturning->nRetCol==0 ){
113365 assert( CORRUPT_DB );
113366 }else{
113367 sqlite3VdbeAddOp0(v, OP_FkCheck);
113368 addrRewind =
113369 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
@@ -113455,11 +113549,11 @@
113455 }
113456 }
113457
113458 if( pParse->bReturning ){
113459 Returning *pRet = pParse->u1.pReturning;
113460 if( pRet->nRetCol==0 ){
113461 assert( CORRUPT_DB );
113462 }else{
113463 sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
113464 }
113465 }
@@ -113496,11 +113590,10 @@
113496 ** built-in function.
113497 */
113498 SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
113499 va_list ap;
113500 char *zSql;
113501 char *zErrMsg = 0;
113502 sqlite3 *db = pParse->db;
113503 u32 savedDbFlags = db->mDbFlags;
113504 char saveBuf[PARSE_TAIL_SZ];
113505
113506 if( pParse->nErr ) return;
@@ -113518,13 +113611,12 @@
113518 }
113519 pParse->nested++;
113520 memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
113521 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
113522 db->mDbFlags |= DBFLAG_PreferBuiltin;
113523 sqlite3RunParser(pParse, zSql, &zErrMsg);
113524 db->mDbFlags = savedDbFlags;
113525 sqlite3DbFree(db, zErrMsg);
113526 sqlite3DbFree(db, zSql);
113527 memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
113528 pParse->nested--;
113529 }
113530
@@ -119179,11 +119271,10 @@
119179 for(i=0; i<nDef; i++){
119180 FuncDef *pOther;
119181 const char *zName = aDef[i].zName;
119182 int nName = sqlite3Strlen30(zName);
119183 int h = SQLITE_FUNC_HASH(zName[0], nName);
119184 assert( zName[0]>='a' && zName[0]<='z' );
119185 assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN );
119186 pOther = sqlite3FunctionSearch(h, zName);
119187 if( pOther ){
119188 assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
119189 aDef[i].pNext = pOther->pNext;
@@ -120442,10 +120533,21 @@
120442 ** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT,
120443 ** SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. */
120444 sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
120445 }
120446
 
 
 
 
 
 
 
 
 
 
 
120447
120448 /*
120449 ** Implementation of the length() function
120450 */
120451 static void lengthFunc(
@@ -120603,11 +120705,11 @@
120603 sqlite3_result_error_nomem(context);
120604 goto endInstr;
120605 }
120606
120607 /*
120608 ** Implementation of the printf() function.
120609 */
120610 static void printfFunc(
120611 sqlite3_context *context,
120612 int argc,
120613 sqlite3_value **argv
@@ -121372,87 +121474,95 @@
121372 '0', '1', '2', '3', '4', '5', '6', '7',
121373 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
121374 };
121375
121376 /*
121377 ** Implementation of the QUOTE() function. This function takes a single
121378 ** argument. If the argument is numeric, the return value is the same as
121379 ** the argument. If the argument is NULL, the return value is the string
121380 ** "NULL". Otherwise, the argument is enclosed in single quotes with
121381 ** single-quote escapes.
121382 */
121383 static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
121384 assert( argc==1 );
121385 UNUSED_PARAMETER(argc);
121386 switch( sqlite3_value_type(argv[0]) ){
 
 
 
121387 case SQLITE_FLOAT: {
121388 double r1, r2;
121389 char zBuf[50];
121390 r1 = sqlite3_value_double(argv[0]);
121391 sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1);
121392 sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);
121393 if( r1!=r2 ){
121394 sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1);
121395 }
121396 sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
 
 
 
121397 break;
121398 }
121399 case SQLITE_INTEGER: {
121400 sqlite3_result_value(context, argv[0]);
121401 break;
121402 }
121403 case SQLITE_BLOB: {
121404 char *zText = 0;
121405 char const *zBlob = sqlite3_value_blob(argv[0]);
121406 int nBlob = sqlite3_value_bytes(argv[0]);
121407 assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */
121408 zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4);
121409 if( zText ){
121410 int i;
121411 for(i=0; i<nBlob; i++){
121412 zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];
121413 zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];
121414 }
121415 zText[(nBlob*2)+2] = '\'';
121416 zText[(nBlob*2)+3] = '\0';
121417 zText[0] = 'X';
121418 zText[1] = '\'';
121419 sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);
121420 sqlite3_free(zText);
121421 }
121422 break;
121423 }
121424 case SQLITE_TEXT: {
121425 int i,j;
121426 u64 n;
121427 const unsigned char *zArg = sqlite3_value_text(argv[0]);
121428 char *z;
121429
121430 if( zArg==0 ) return;
121431 for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
121432 z = contextMalloc(context, ((i64)i)+((i64)n)+3);
121433 if( z ){
121434 z[0] = '\'';
121435 for(i=0, j=1; zArg[i]; i++){
121436 z[j++] = zArg[i];
121437 if( zArg[i]=='\'' ){
121438 z[j++] = '\'';
121439 }
121440 }
121441 z[j++] = '\'';
121442 z[j] = 0;
121443 sqlite3_result_text(context, z, j, sqlite3_free);
121444 }
121445 break;
121446 }
121447 default: {
121448 assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
121449 sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC);
121450 break;
121451 }
121452 }
121453 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121454
121455 /*
121456 ** The unicode() function. Return the integer unicode code-point value
121457 ** for the first character of the input string.
121458 */
@@ -122583,13 +122693,15 @@
122583 FUNCTION(max, -1, 1, 1, minmaxFunc ),
122584 FUNCTION(max, 0, 1, 1, 0 ),
122585 WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
122586 SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
122587 FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
 
122588 FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH),
122589 FUNCTION(instr, 2, 0, 0, instrFunc ),
122590 FUNCTION(printf, -1, 0, 0, printfFunc ),
 
122591 FUNCTION(unicode, 1, 0, 0, unicodeFunc ),
122592 FUNCTION(char, -1, 0, 0, charFunc ),
122593 FUNCTION(abs, 1, 0, 0, absFunc ),
122594 #ifndef SQLITE_OMIT_FLOATING_POINT
122595 FUNCTION(round, 1, 0, 0, roundFunc ),
@@ -122684,10 +122796,11 @@
122684 #ifndef SQLITE_OMIT_ALTERTABLE
122685 sqlite3AlterFunctions();
122686 #endif
122687 sqlite3WindowFunctions();
122688 sqlite3RegisterDateTimeFunctions();
 
122689 sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc));
122690
122691 #if 0 /* Enable to print out how the built-in functions are hashed */
122692 {
122693 int i;
@@ -123409,10 +123522,29 @@
123409 sqlite3SelectDelete(dbMem, pStep->pSelect);
123410 sqlite3ExprDelete(dbMem, p->pWhen);
123411 sqlite3DbFree(dbMem, p);
123412 }
123413 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123414
123415 /*
123416 ** This function is called to generate code that runs when table pTab is
123417 ** being dropped from the database. The SrcList passed as the second argument
123418 ** to this function contains a single entry guaranteed to resolve to
@@ -124210,11 +124342,11 @@
124210 sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol);
124211 VdbeComment((v, "%s", pTab->zName));
124212 }else{
124213 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
124214 assert( pPk!=0 );
124215 assert( pPk->tnum==pTab->tnum );
124216 sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb);
124217 sqlite3VdbeSetP4KeyInfo(pParse, pPk);
124218 VdbeComment((v, "%s", pTab->zName));
124219 }
124220 }
@@ -126174,10 +126306,11 @@
126174 ** the UNIQUE constraints have run.
126175 */
126176 if( onError==OE_Replace /* IPK rule is REPLACE */
126177 && onError!=overrideError /* Rules for other constraints are different */
126178 && pTab->pIndex /* There exist other constraints */
 
126179 ){
126180 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
126181 VdbeComment((v, "defer IPK REPLACE until last"));
126182 }
126183
@@ -126582,10 +126715,11 @@
126582
126583 /* If the IPK constraint is a REPLACE, run it last */
126584 if( ipkTop ){
126585 sqlite3VdbeGoto(v, ipkTop);
126586 VdbeComment((v, "Do IPK REPLACE"));
 
126587 sqlite3VdbeJumpHere(v, ipkBottom);
126588 }
126589
126590 /* Recheck all uniqueness constraints after replace triggers have run */
126591 testcase( regTrigCnt!=0 && nReplaceTrig==0 );
@@ -126712,11 +126846,10 @@
126712 sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
126713 VdbeCoverage(v);
126714 }
126715 pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
126716 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
126717 assert( pParse->nested==0 );
126718 pik_flags |= OPFLAG_NCHANGE;
126719 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
126720 if( update_flags==0 ){
126721 codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
126722 }
@@ -127802,10 +127935,12 @@
127802 sqlite3_int64 (*total_changes64)(sqlite3*);
127803 /* Version 3.37.0 and later */
127804 int (*autovacuum_pages)(sqlite3*,
127805 unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
127806 void*, void(*)(void*));
 
 
127807 };
127808
127809 /*
127810 ** This is the function signature used for all extension entry points. It
127811 ** is also defined in the file "loadext.c".
@@ -128113,10 +128248,12 @@
128113 /* Version 3.36.1 and later */
128114 #define sqlite3_changes64 sqlite3_api->changes64
128115 #define sqlite3_total_changes64 sqlite3_api->total_changes64
128116 /* Version 3.37.0 and later */
128117 #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
 
 
128118 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
128119
128120 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
128121 /* This case when the file really is being compiled as a loadable
128122 ** extension */
@@ -128602,10 +128739,12 @@
128602 /* Version 3.36.1 and later */
128603 sqlite3_changes64,
128604 sqlite3_total_changes64,
128605 /* Version 3.37.0 and later */
128606 sqlite3_autovacuum_pages,
 
 
128607 };
128608
128609 /* True if x is the directory separator character
128610 */
128611 #if SQLITE_OS_WIN
@@ -132941,10 +133080,14 @@
132941 /*
132942 ** Free all memory allocations in the pParse object
132943 */
132944 SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
132945 sqlite3 *db = pParse->db;
 
 
 
 
132946 while( pParse->pCleanup ){
132947 ParseCleanup *pCleanup = pParse->pCleanup;
132948 pParse->pCleanup = pCleanup->pNext;
132949 pCleanup->xCleanup(db, pCleanup->pPtr);
132950 sqlite3DbFreeNN(db, pCleanup);
@@ -133020,11 +133163,10 @@
133020 u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
133021 Vdbe *pReprepare, /* VM being reprepared */
133022 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
133023 const char **pzTail /* OUT: End of parsed string */
133024 ){
133025 char *zErrMsg = 0; /* Error message */
133026 int rc = SQLITE_OK; /* Result code */
133027 int i; /* Loop counter */
133028 Parse sParse; /* Parsing context */
133029
133030 memset(&sParse, 0, PARSE_HDR_SZ);
@@ -133095,18 +133237,18 @@
133095 rc = sqlite3ApiExit(db, SQLITE_TOOBIG);
133096 goto end_prepare;
133097 }
133098 zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
133099 if( zSqlCopy ){
133100 sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
133101 sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
133102 sqlite3DbFree(db, zSqlCopy);
133103 }else{
133104 sParse.zTail = &zSql[nBytes];
133105 }
133106 }else{
133107 sqlite3RunParser(&sParse, zSql, &zErrMsg);
133108 }
133109 assert( 0==sParse.nQueryLoop );
133110
133111 if( pzTail ){
133112 *pzTail = sParse.zTail;
@@ -133118,26 +133260,26 @@
133118 if( db->mallocFailed ){
133119 sParse.rc = SQLITE_NOMEM_BKPT;
133120 sParse.checkSchema = 0;
133121 }
133122 if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
133123 if( sParse.checkSchema ){
133124 schemaIsValid(&sParse);
133125 }
133126 if( sParse.pVdbe ){
133127 sqlite3VdbeFinalize(sParse.pVdbe);
133128 }
133129 assert( 0==(*ppStmt) );
133130 rc = sParse.rc;
133131 if( zErrMsg ){
133132 sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
133133 sqlite3DbFree(db, zErrMsg);
133134 }else{
133135 sqlite3Error(db, rc);
133136 }
133137 }else{
133138 assert( zErrMsg==0 );
133139 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
133140 rc = SQLITE_OK;
133141 sqlite3ErrorClear(db);
133142 }
133143
@@ -136696,10 +136838,12 @@
136696 Select *p, /* The right-most of SELECTs to be coded */
136697 SelectDest *pDest /* What to do with query results */
136698 ){
136699 int i, j; /* Loop counters */
136700 Select *pPrior; /* Another SELECT immediately to our left */
 
 
136701 Vdbe *v; /* Generate code to this VDBE */
136702 SelectDest destA; /* Destination for coroutine A */
136703 SelectDest destB; /* Destination for coroutine B */
136704 int regAddrA; /* Address register for select-A coroutine */
136705 int regAddrB; /* Address register for select-B coroutine */
@@ -136741,12 +136885,11 @@
136741
136742
136743 /* Patch up the ORDER BY clause
136744 */
136745 op = p->op;
136746 pPrior = p->pPrior;
136747 assert( pPrior->pOrderBy==0 );
136748 pOrderBy = p->pOrderBy;
136749 assert( pOrderBy );
136750 nOrderBy = pOrderBy->nExpr;
136751
136752 /* For operators other than UNION ALL we have to make sure that
@@ -136792,15 +136935,10 @@
136792 pKeyMerge = multiSelectOrderByKeyInfo(pParse, p, 1);
136793 }else{
136794 pKeyMerge = 0;
136795 }
136796
136797 /* Reattach the ORDER BY clause to the query.
136798 */
136799 p->pOrderBy = pOrderBy;
136800 pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
136801
136802 /* Allocate a range of temporary registers and the KeyInfo needed
136803 ** for the logic that removes duplicate result rows when the
136804 ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).
136805 */
136806 if( op==TK_ALL ){
@@ -136821,16 +136959,33 @@
136821 }
136822 }
136823
136824 /* Separate the left and the right query from one another
136825 */
136826 p->pPrior = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136827 pPrior->pNext = 0;
 
 
 
136828 sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER");
136829 if( pPrior->pPrior==0 ){
136830 sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
136831 }
136832
136833 /* Compute the limit registers */
136834 computeLimitRegisters(pParse, p, labelEnd);
136835 if( p->iLimit && op==TK_ALL ){
136836 regLimitA = ++pParse->nMem;
@@ -136977,16 +137132,15 @@
136977 */
136978 sqlite3VdbeResolveLabel(v, labelEnd);
136979
136980 /* Reassembly the compound query so that it will be freed correctly
136981 ** by the calling function */
136982 if( p->pPrior ){
136983 sqlite3SelectDelete(db, p->pPrior);
136984 }
136985 p->pPrior = pPrior;
136986 pPrior->pNext = p;
136987
136988 sqlite3ExprListDelete(db, pPrior->pOrderBy);
136989 pPrior->pOrderBy = 0;
136990
136991 /*** TBD: Insert subroutine calls to close cursors on incomplete
136992 **** subqueries ****/
@@ -142061,11 +142215,11 @@
142061 if( db->mallocFailed==0 && pParse->nErr==0 ){
142062 sqlite3GenerateColumnNames(pParse, &sSelect);
142063 }
142064 sqlite3ExprListDelete(db, sSelect.pEList);
142065 pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
142066 if( pNew ){
142067 NameContext sNC;
142068 memset(&sNC, 0, sizeof(sNC));
142069 if( pReturning->nRetCol==0 ){
142070 pReturning->nRetCol = pNew->nExpr;
142071 pReturning->iRetCur = pParse->nTab++;
@@ -142073,28 +142227,34 @@
142073 sNC.pParse = pParse;
142074 sNC.uNC.iBaseReg = regIn;
142075 sNC.ncFlags = NC_UBaseReg;
142076 pParse->eTriggerOp = pTrigger->op;
142077 pParse->pTriggerTab = pTab;
142078 if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK ){
 
 
142079 int i;
142080 int nCol = pNew->nExpr;
142081 int reg = pParse->nMem+1;
142082 pParse->nMem += nCol+2;
142083 pReturning->iRetReg = reg;
142084 for(i=0; i<nCol; i++){
142085 Expr *pCol = pNew->a[i].pExpr;
 
142086 sqlite3ExprCodeFactorable(pParse, pCol, reg+i);
 
 
 
142087 }
142088 sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i);
142089 sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1);
142090 sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1);
142091 }
142092 sqlite3ExprListDelete(db, pNew);
142093 pParse->eTriggerOp = 0;
142094 pParse->pTriggerTab = 0;
142095 }
 
 
 
142096 }
142097
142098
142099
142100 /*
@@ -145420,11 +145580,10 @@
145420 */
145421 SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
145422 VtabCtx *pCtx;
145423 int rc = SQLITE_OK;
145424 Table *pTab;
145425 char *zErr = 0;
145426 Parse sParse;
145427 int initBusy;
145428
145429 #ifdef SQLITE_ENABLE_API_ARMOR
145430 if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
@@ -145449,15 +145608,16 @@
145449 ** in case a bug arises. */
145450 assert( db->init.busy==0 );
145451 initBusy = db->init.busy;
145452 db->init.busy = 0;
145453 sParse.nQueryLoop = 1;
145454 if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
145455 && sParse.pNewTable
145456 && !db->mallocFailed
145457 && IsOrdinaryTable(sParse.pNewTable)
145458 ){
 
145459 if( !pTab->aCol ){
145460 Table *pNew = sParse.pNewTable;
145461 Index *pIdx;
145462 pTab->aCol = pNew->aCol;
145463 sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
@@ -145483,12 +145643,13 @@
145483 pIdx->pTable = pTab;
145484 }
145485 }
145486 pCtx->bDeclared = 1;
145487 }else{
145488 sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
145489 sqlite3DbFree(db, zErr);
 
145490 rc = SQLITE_ERROR;
145491 }
145492 sParse.eParseMode = PARSE_MODE_NORMAL;
145493
145494 if( sParse.pVdbe ){
@@ -146251,11 +146412,11 @@
146251 #define TERM_VIRTUAL 0x0002 /* Added by the optimizer. Do not code */
146252 #define TERM_CODED 0x0004 /* This term is already coded */
146253 #define TERM_COPIED 0x0008 /* Has a child */
146254 #define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */
146255 #define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */
146256 #define TERM_OR_OK 0x0040 /* Used during OR-clause processing */
146257 #define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */
146258 #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */
146259 #define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */
146260 #define TERM_LIKE 0x0400 /* The original LIKE operator */
146261 #define TERM_IS 0x0800 /* Term.pExpr is an IS operator */
@@ -147961,11 +148122,11 @@
147961 ){
147962 while( ++iLevel < pWInfo->nLevel ){
147963 WhereLevel *pLevel = &pWInfo->a[iLevel];
147964 WhereLoop *pLoop = pLevel->pWLoop;
147965 if( pLevel->regFilter==0 ) continue;
147966 /* ,--- Because constructBloomFilter() has will not have set
147967 ** vvvvv--' pLevel->regFilter if this were true. */
147968 if( NEVER(pLoop->prereq & notReady) ) continue;
147969 if( pLoop->wsFlags & WHERE_IPK ){
147970 WhereTerm *pTerm = pLoop->aLTerm[0];
147971 int regRowid;
@@ -147981,10 +148142,11 @@
147981 u16 nEq = pLoop->u.btree.nEq;
147982 int r1;
147983 char *zStartAff;
147984
147985 assert( pLoop->wsFlags & WHERE_INDEXED );
 
147986 r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff);
147987 codeApplyAffinity(pParse, r1, nEq, zStartAff);
147988 sqlite3DbFree(pParse->db, zStartAff);
147989 sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
147990 addrNxt, r1, nEq);
@@ -150043,11 +150205,11 @@
150043 for(j=0; j<2 && !okToChngToIN; j++){
150044 Expr *pLeft = 0;
150045 pOrTerm = pOrWc->a;
150046 for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){
150047 assert( pOrTerm->eOperator & WO_EQ );
150048 pOrTerm->wtFlags &= ~TERM_OR_OK;
150049 if( pOrTerm->leftCursor==iCursor ){
150050 /* This is the 2-bit case and we are on the second iteration and
150051 ** current term is from the first iteration. So skip this term. */
150052 assert( j==1 );
150053 continue;
@@ -150084,11 +150246,11 @@
150084 okToChngToIN = 1;
150085 for(; i>=0 && okToChngToIN; i--, pOrTerm++){
150086 assert( pOrTerm->eOperator & WO_EQ );
150087 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150088 if( pOrTerm->leftCursor!=iCursor ){
150089 pOrTerm->wtFlags &= ~TERM_OR_OK;
150090 }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
150091 && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
150092 )){
150093 okToChngToIN = 0;
150094 }else{
@@ -150100,11 +150262,11 @@
150100 affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);
150101 affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);
150102 if( affRight!=0 && affRight!=affLeft ){
150103 okToChngToIN = 0;
150104 }else{
150105 pOrTerm->wtFlags |= TERM_OR_OK;
150106 }
150107 }
150108 }
150109 }
150110
@@ -150117,11 +150279,11 @@
150117 ExprList *pList = 0; /* The RHS of the IN operator */
150118 Expr *pLeft = 0; /* The LHS of the IN operator */
150119 Expr *pNew; /* The complete IN operator */
150120
150121 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
150122 if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;
150123 assert( pOrTerm->eOperator & WO_EQ );
150124 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150125 assert( pOrTerm->leftCursor==iCursor );
150126 assert( pOrTerm->u.x.leftColumn==iColumn );
150127 pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);
@@ -151651,16 +151813,18 @@
151651 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED)
151652 static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
151653 int i;
151654 if( !sqlite3WhereTrace ) return;
151655 for(i=0; i<p->nConstraint; i++){
151656 sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
 
151657 i,
151658 p->aConstraint[i].iColumn,
151659 p->aConstraint[i].iTermOffset,
151660 p->aConstraint[i].op,
151661 p->aConstraint[i].usable);
 
151662 }
151663 for(i=0; i<p->nOrderBy; i++){
151664 sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n",
151665 i,
151666 p->aOrderBy[i].iColumn,
@@ -151960,11 +152124,11 @@
151960 **
151961 ** This routine may only be called if it has previously been determined that
151962 ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
151963 ** is set.
151964 */
151965 static SQLITE_NOINLINE void constructBloomFilter(
151966 WhereInfo *pWInfo, /* The WHERE clause */
151967 int iLevel, /* Index in pWInfo->a[] that is pLevel */
151968 WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */
151969 Bitmask notReady /* Loops that are not ready */
151970 ){
@@ -152044,17 +152208,24 @@
152044 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
152045 VdbeCoverage(v);
152046 sqlite3VdbeJumpHere(v, addrTop);
152047 pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
152048 if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
152049 while( iLevel < pWInfo->nLevel ){
152050 iLevel++;
152051 pLevel = &pWInfo->a[iLevel];
152052 pLoop = pLevel->pWLoop;
152053 if( pLoop==0 ) continue;
152054 if( pLoop->prereq & notReady ) continue;
152055 if( pLoop->wsFlags & WHERE_BLOOMFILTER ) break;
 
 
 
 
 
 
 
 
152056 }
152057 }while( iLevel < pWInfo->nLevel );
152058 sqlite3VdbeJumpHere(v, addrOnce);
152059 }
152060
@@ -152081,14 +152252,23 @@
152081 struct HiddenIndexInfo *pHidden;
152082 WhereTerm *pTerm;
152083 int nOrderBy;
152084 sqlite3_index_info *pIdxInfo;
152085 u16 mNoOmit = 0;
 
152086
152087 /* Count the number of possible WHERE clause constraints referring
152088 ** to this virtual table */
 
 
 
 
 
 
 
152089 for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
 
152090 if( pTerm->leftCursor != pSrc->iCursor ) continue;
152091 if( pTerm->prereqRight & mUnusable ) continue;
152092 assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
152093 testcase( pTerm->eOperator & WO_IN );
152094 testcase( pTerm->eOperator & WO_ISNULL );
@@ -152095,12 +152275,23 @@
152095 testcase( pTerm->eOperator & WO_IS );
152096 testcase( pTerm->eOperator & WO_ALL );
152097 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
152098 if( pTerm->wtFlags & TERM_VNULL ) continue;
152099 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
152100 assert( pTerm->u.x.leftColumn>=(-1) );
 
 
 
 
 
 
 
 
 
 
152101 nTerm++;
 
152102 }
152103
152104 /* If the ORDER BY clause contains only columns in the current
152105 ** virtual table then allocate space for the aOrderBy part of
152106 ** the sqlite3_index_info structure.
@@ -152108,12 +152299,45 @@
152108 nOrderBy = 0;
152109 if( pOrderBy ){
152110 int n = pOrderBy->nExpr;
152111 for(i=0; i<n; i++){
152112 Expr *pExpr = pOrderBy->a[i].pExpr;
152113 if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
 
 
 
 
 
 
 
152114 if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152115 }
152116 if( i==n){
152117 nOrderBy = n;
152118 }
152119 }
@@ -152129,38 +152353,18 @@
152129 }
152130 pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1];
152131 pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1];
152132 pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];
152133 pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];
152134 pIdxInfo->nOrderBy = nOrderBy;
152135 pIdxInfo->aConstraint = pIdxCons;
152136 pIdxInfo->aOrderBy = pIdxOrderBy;
152137 pIdxInfo->aConstraintUsage = pUsage;
152138 pHidden->pWC = pWC;
152139 pHidden->pParse = pParse;
152140 for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
152141 u16 op;
152142 if( pTerm->leftCursor != pSrc->iCursor ) continue;
152143 if( pTerm->prereqRight & mUnusable ) continue;
152144 assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
152145 testcase( pTerm->eOperator & WO_IN );
152146 testcase( pTerm->eOperator & WO_IS );
152147 testcase( pTerm->eOperator & WO_ISNULL );
152148 testcase( pTerm->eOperator & WO_ALL );
152149 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
152150 if( pTerm->wtFlags & TERM_VNULL ) continue;
152151
152152 /* tag-20191211-002: WHERE-clause constraints are not useful to the
152153 ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the
152154 ** equivalent restriction for ordinary tables. */
152155 if( (pSrc->fg.jointype & JT_LEFT)!=0
152156 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
152157 ){
152158 continue;
152159 }
152160 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
152161 assert( pTerm->u.x.leftColumn>=(-1) );
152162 pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
152163 pIdxCons[j].iTermOffset = i;
152164 op = pTerm->eOperator & WO_ALL;
152165 if( op==WO_IN ) op = WO_EQ;
152166 if( op==WO_AUX ){
@@ -152193,16 +152397,23 @@
152193 }
152194 }
152195
152196 j++;
152197 }
 
152198 pIdxInfo->nConstraint = j;
152199 for(i=0; i<nOrderBy; i++){
152200 Expr *pExpr = pOrderBy->a[i].pExpr;
152201 pIdxOrderBy[i].iColumn = pExpr->iColumn;
152202 pIdxOrderBy[i].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC;
 
 
 
 
 
152203 }
 
152204
152205 *pmNoOmit = mNoOmit;
152206 return pIdxInfo;
152207 }
152208
@@ -154530,15 +154741,23 @@
154530
154531 return rc;
154532 }
154533
154534 /*
154535 ** If this function is invoked from within an xBestIndex() callback, it
154536 ** returns a pointer to a buffer containing the name of the collation
154537 ** sequence associated with element iCons of the sqlite3_index_info.aConstraint
154538 ** array. Or, if iCons is out of range or there is no active xBestIndex
154539 ** call, return NULL.
 
 
 
 
 
 
 
 
154540 */
154541 SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){
154542 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
154543 const char *zRet = 0;
154544 if( iCons>=0 && iCons<pIdxInfo->nConstraint ){
@@ -155972,11 +156191,11 @@
155972 assert( pWInfo->nLevel>=2 );
155973 assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
155974 nSearch = pWInfo->a[0].pWLoop->nOut;
155975 for(i=1; i<pWInfo->nLevel; i++){
155976 WhereLoop *pLoop = pWInfo->a[i].pWLoop;
155977 const int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
155978 if( (pLoop->wsFlags & reqFlags)==reqFlags
155979 /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
155980 && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
155981 ){
155982 SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
@@ -156590,11 +156809,11 @@
156590 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
156591 constructAutomaticIndex(pParse, &pWInfo->sWC,
156592 &pTabList->a[pLevel->iFrom], notReady, pLevel);
156593 #endif
156594 }else{
156595 constructBloomFilter(pWInfo, ii, pLevel, notReady);
156596 }
156597 if( db->mallocFailed ) goto whereBeginError;
156598 }
156599 addrExplain = sqlite3WhereExplainOneScan(
156600 pParse, pTabList, pLevel, wctrlFlags
@@ -160320,14 +160539,14 @@
160320 #define TK_DETACH 40
160321 #define TK_EACH 41
160322 #define TK_FAIL 42
160323 #define TK_OR 43
160324 #define TK_AND 44
160325 #define TK_MATCH 45
160326 #define TK_LIKE_KW 46
160327 #define TK_BETWEEN 47
160328 #define TK_IS 48
160329 #define TK_IN 49
160330 #define TK_ISNULL 50
160331 #define TK_NOTNULL 51
160332 #define TK_NE 52
160333 #define TK_EQ 53
@@ -160387,82 +160606,83 @@
160387 #define TK_MINUS 107
160388 #define TK_STAR 108
160389 #define TK_SLASH 109
160390 #define TK_REM 110
160391 #define TK_CONCAT 111
160392 #define TK_COLLATE 112
160393 #define TK_BITNOT 113
160394 #define TK_ON 114
160395 #define TK_INDEXED 115
160396 #define TK_STRING 116
160397 #define TK_JOIN_KW 117
160398 #define TK_CONSTRAINT 118
160399 #define TK_DEFAULT 119
160400 #define TK_NULL 120
160401 #define TK_PRIMARY 121
160402 #define TK_UNIQUE 122
160403 #define TK_CHECK 123
160404 #define TK_REFERENCES 124
160405 #define TK_AUTOINCR 125
160406 #define TK_INSERT 126
160407 #define TK_DELETE 127
160408 #define TK_UPDATE 128
160409 #define TK_SET 129
160410 #define TK_DEFERRABLE 130
160411 #define TK_FOREIGN 131
160412 #define TK_DROP 132
160413 #define TK_UNION 133
160414 #define TK_ALL 134
160415 #define TK_EXCEPT 135
160416 #define TK_INTERSECT 136
160417 #define TK_SELECT 137
160418 #define TK_VALUES 138
160419 #define TK_DISTINCT 139
160420 #define TK_DOT 140
160421 #define TK_FROM 141
160422 #define TK_JOIN 142
160423 #define TK_USING 143
160424 #define TK_ORDER 144
160425 #define TK_GROUP 145
160426 #define TK_HAVING 146
160427 #define TK_LIMIT 147
160428 #define TK_WHERE 148
160429 #define TK_RETURNING 149
160430 #define TK_INTO 150
160431 #define TK_NOTHING 151
160432 #define TK_FLOAT 152
160433 #define TK_BLOB 153
160434 #define TK_INTEGER 154
160435 #define TK_VARIABLE 155
160436 #define TK_CASE 156
160437 #define TK_WHEN 157
160438 #define TK_THEN 158
160439 #define TK_ELSE 159
160440 #define TK_INDEX 160
160441 #define TK_ALTER 161
160442 #define TK_ADD 162
160443 #define TK_WINDOW 163
160444 #define TK_OVER 164
160445 #define TK_FILTER 165
160446 #define TK_COLUMN 166
160447 #define TK_AGG_FUNCTION 167
160448 #define TK_AGG_COLUMN 168
160449 #define TK_TRUEFALSE 169
160450 #define TK_ISNOT 170
160451 #define TK_FUNCTION 171
160452 #define TK_UMINUS 172
160453 #define TK_UPLUS 173
160454 #define TK_TRUTH 174
160455 #define TK_REGISTER 175
160456 #define TK_VECTOR 176
160457 #define TK_SELECT_COLUMN 177
160458 #define TK_IF_NULL_ROW 178
160459 #define TK_ASTERISK 179
160460 #define TK_SPAN 180
160461 #define TK_ERROR 181
160462 #define TK_SPACE 182
160463 #define TK_ILLEGAL 183
 
160464 #endif
160465 /**************** End token definitions ***************************************/
160466
160467 /* The next sections is a series of control #defines.
160468 ** various aspects of the generated parser.
@@ -160518,34 +160738,34 @@
160518 #ifndef INTERFACE
160519 # define INTERFACE 1
160520 #endif
160521 /************* Begin control #defines *****************************************/
160522 #define YYCODETYPE unsigned short int
160523 #define YYNOCODE 318
160524 #define YYACTIONTYPE unsigned short int
160525 #define YYWILDCARD 101
160526 #define sqlite3ParserTOKENTYPE Token
160527 typedef union {
160528 int yyinit;
160529 sqlite3ParserTOKENTYPE yy0;
160530 With* yy43;
160531 u32 yy51;
160532 int yy64;
160533 struct FrameBound yy81;
160534 struct {int value; int mask;} yy83;
160535 TriggerStep* yy95;
160536 Upsert* yy138;
160537 IdList* yy240;
160538 Cte* yy255;
160539 Select* yy303;
160540 Window* yy375;
160541 u8 yy534;
160542 ExprList* yy562;
160543 struct TrigEvent yy570;
160544 const char* yy600;
160545 SrcList* yy607;
160546 Expr* yy626;
160547 } YYMINORTYPE;
160548 #ifndef YYSTACKDEPTH
160549 #define YYSTACKDEPTH 100
160550 #endif
160551 #define sqlite3ParserARG_SDECL
@@ -160557,22 +160777,22 @@
160557 #define sqlite3ParserCTX_PDECL ,Parse *pParse
160558 #define sqlite3ParserCTX_PARAM ,pParse
160559 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
160560 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
160561 #define YYFALLBACK 1
160562 #define YYNSTATE 572
160563 #define YYNRULE 401
160564 #define YYNRULE_WITH_ACTION 339
160565 #define YYNTOKEN 184
160566 #define YY_MAX_SHIFT 571
160567 #define YY_MIN_SHIFTREDUCE 829
160568 #define YY_MAX_SHIFTREDUCE 1229
160569 #define YY_ERROR_ACTION 1230
160570 #define YY_ACCEPT_ACTION 1231
160571 #define YY_NO_ACTION 1232
160572 #define YY_MIN_REDUCE 1233
160573 #define YY_MAX_REDUCE 1633
160574 /************* End control #defines *******************************************/
160575 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
160576
160577 /* Define the yytestcase() macro to be a no-op if is not already defined
160578 ** otherwise.
@@ -160635,607 +160855,616 @@
160635 ** yy_reduce_ofst[] For each state, the offset into yy_action for
160636 ** shifting non-terminals after a reduce.
160637 ** yy_default[] Default action for each state.
160638 **
160639 *********** Begin parsing tables **********************************************/
160640 #define YY_ACTTAB_COUNT (2022)
160641 static const YYACTIONTYPE yy_action[] = {
160642 /* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564,
160643 /* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407,
160644 /* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558,
160645 /* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966,
160646 /* 40 */ 296, 1269, 296, 122, 123, 1207, 1207, 1041, 113, 1044,
160647 /* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407,
160648 /* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112,
160649 /* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250,
160650 /* 80 */ 217, 71, 71, 122, 123, 1207, 1207, 1041, 113, 1044,
160651 /* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440,
160652 /* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117,
160653 /* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513,
160654 /* 120 */ 1548, 1554, 374, 213, 6, 169, 1154, 522, 1154, 407,
160655 /* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121,
160656 /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
160657 /* 150 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160658 /* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183,
160659 /* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124,
160660 /* 180 */ 567, 1128, 1627, 344, 1627, 497, 119, 119, 119, 119,
160661 /* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407,
160662 /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442,
160663 /* 210 */ 474, 1469, 119, 119, 119, 119, 118, 118, 117, 117,
160664 /* 220 */ 117, 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044,
160665 /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 208,
160666 /* 240 */ 539, 1548, 1424, 81, 339, 6, 342, 80, 119, 119,
160667 /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381,
160668 /* 260 */ 1126, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160669 /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 463, 332,
160670 /* 280 */ 359, 1567, 119, 119, 119, 119, 118, 118, 117, 117,
160671 /* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573,
160672 /* 300 */ 571, 2, 1235, 307, 1149, 141, 417, 307, 407, 141,
160673 /* 310 */ 1183, 98, 1317, 489, 866, 531, 1317, 1149, 215, 512,
160674 /* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160675 /* 330 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160676 /* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001,
160677 /* 350 */ 1257, 275, 275, 1128, 1628, 1021, 1628, 137, 415, 1600,
160678 /* 360 */ 561, 272, 1255, 950, 561, 1423, 1183, 1184, 1185, 1594,
160679 /* 370 */ 866, 1012, 530, 315, 231, 1011, 317, 1276, 231, 119,
160680 /* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160681 /* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160682 /* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013,
160683 /* 410 */ 446, 877, 564, 306, 555, 407, 447, 1021, 563, 346,
160684 /* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71,
160685 /* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122,
160686 /* 440 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160687 /* 450 */ 121, 121, 121, 121, 1304, 219, 1283, 1183, 407, 570,
160688 /* 460 */ 1183, 1235, 503, 1477, 1304, 546, 307, 489, 141, 1011,
160689 /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 382, 1214, 378,
160690 /* 480 */ 950, 514, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160691 /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 472, 119, 119,
160692 /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283,
160693 /* 510 */ 275, 275, 1476, 1183, 1184, 1185, 1183, 1184, 1185, 417,
160694 /* 520 */ 1183, 243, 541, 561, 502, 499, 498, 1001, 407, 478,
160695 /* 530 */ 1183, 472, 870, 143, 497, 1549, 185, 231, 9, 6,
160696 /* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160697 /* 550 */ 116, 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034,
160698 /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 372, 446,
160699 /* 570 */ 363, 863, 288, 1183, 397, 1204, 1183, 1184, 1185, 931,
160700 /* 580 */ 330, 458, 318, 526, 564, 541, 1183, 1184, 1185, 284,
160701 /* 590 */ 1183, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160702 /* 600 */ 120, 120, 121, 121, 121, 121, 291, 71, 71, 275,
160703 /* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117,
160704 /* 620 */ 116, 442, 561, 1031, 1031, 1042, 1183, 1045, 287, 1183,
160705 /* 630 */ 1184, 1185, 1204, 137, 218, 542, 1541, 407, 363, 470,
160706 /* 640 */ 431, 1167, 32, 363, 527, 350, 1183, 1184, 1185, 380,
160707 /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160708 /* 660 */ 442, 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160709 /* 670 */ 120, 120, 121, 121, 121, 121, 407, 392, 1227, 1183,
160710 /* 680 */ 1022, 1540, 1183, 1184, 1185, 1523, 149, 1307, 1307, 306,
160711 /* 690 */ 555, 151, 1546, 361, 5, 564, 6, 3, 1035, 1542,
160712 /* 700 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160713 /* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71,
160714 /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160715 /* 730 */ 442, 1183, 426, 428, 1183, 1183, 1184, 1185, 191, 261,
160716 /* 740 */ 278, 358, 508, 353, 507, 248, 407, 455, 137, 1539,
160717 /* 750 */ 1006, 349, 363, 472, 1539, 302, 1228, 405, 281, 119,
160718 /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160719 /* 770 */ 122, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120,
160720 /* 780 */ 120, 121, 121, 121, 121, 407, 452, 1183, 1184, 1185,
160721 /* 790 */ 1183, 1184, 1185, 275, 275, 269, 269, 489, 483, 1525,
160722 /* 800 */ 148, 363, 480, 564, 306, 555, 561, 489, 561, 122,
160723 /* 810 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160724 /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 293, 119,
160725 /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442,
160726 /* 840 */ 1183, 420, 1316, 564, 98, 417, 199, 13, 13, 150,
160727 /* 850 */ 306, 555, 1312, 322, 386, 407, 506, 478, 562, 400,
160728 /* 860 */ 920, 920, 425, 1539, 887, 292, 71, 71, 119, 119,
160729 /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122,
160730 /* 880 */ 123, 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120,
160731 /* 890 */ 121, 121, 121, 121, 564, 1149, 1183, 1184, 1185, 407,
160732 /* 900 */ 275, 275, 451, 303, 1089, 1089, 486, 448, 1149, 276,
160733 /* 910 */ 276, 1149, 1539, 561, 319, 286, 321, 71, 71, 429,
160734 /* 920 */ 451, 450, 561, 952, 101, 1207, 1207, 1041, 113, 1044,
160735 /* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119,
160736 /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105,
160737 /* 950 */ 1183, 1547, 564, 12, 437, 6, 329, 564, 834, 835,
160738 /* 960 */ 836, 1629, 393, 547, 1106, 246, 245, 244, 1545, 1258,
160739 /* 970 */ 413, 1521, 6, 1086, 310, 71, 71, 1086, 564, 1107,
160740 /* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117,
160741 /* 990 */ 117, 116, 442, 451, 104, 427, 537, 320, 275, 275,
160742 /* 1000 */ 906, 13, 13, 520, 1482, 1105, 1183, 1184, 1185, 484,
160743 /* 1010 */ 907, 561, 546, 564, 407, 536, 295, 478, 253, 200,
160744 /* 1020 */ 1106, 548, 1482, 1484, 1160, 1409, 16, 16, 126, 557,
160745 /* 1030 */ 413, 479, 311, 951, 407, 1107, 71, 71, 122, 123,
160746 /* 1040 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160747 /* 1050 */ 121, 121, 121, 1204, 407, 544, 552, 314, 122, 123,
160748 /* 1060 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160749 /* 1070 */ 121, 121, 121, 441, 144, 1160, 468, 146, 122, 111,
160750 /* 1080 */ 1207, 1207, 1041, 113, 1044, 1034, 1034, 120, 120, 121,
160751 /* 1090 */ 121, 121, 121, 247, 12, 1482, 422, 119, 119, 119,
160752 /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564,
160753 /* 1110 */ 1204, 207, 404, 403, 858, 950, 294, 119, 119, 119,
160754 /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 30,
160755 /* 1130 */ 564, 1409, 55, 55, 1599, 564, 895, 119, 119, 119,
160756 /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 510, 1409,
160757 /* 1150 */ 1409, 56, 56, 15, 15, 439, 438, 407, 13, 13,
160758 /* 1160 */ 31, 1187, 412, 1211, 1183, 1184, 1185, 196, 1213, 306,
160759 /* 1170 */ 555, 858, 462, 193, 926, 564, 1212, 489, 361, 925,
160760 /* 1180 */ 1183, 564, 123, 1207, 1207, 1041, 113, 1044, 1034, 1034,
160761 /* 1190 */ 120, 120, 121, 121, 121, 121, 1544, 1149, 43, 43,
160762 /* 1200 */ 6, 1214, 423, 1214, 13, 13, 564, 219, 538, 494,
160763 /* 1210 */ 1149, 108, 556, 1149, 4, 392, 1127, 434, 1187, 194,
160764 /* 1220 */ 424, 485, 337, 1315, 414, 171, 1253, 1321, 559, 57,
160765 /* 1230 */ 57, 564, 950, 564, 224, 247, 1183, 1184, 1185, 561,
160766 /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
160767 /* 1250 */ 442, 443, 564, 517, 13, 13, 44, 44, 275, 275,
160768 /* 1260 */ 1409, 275, 275, 553, 1353, 529, 213, 549, 456, 543,
160769 /* 1270 */ 465, 561, 564, 137, 561, 58, 58, 469, 405, 1222,
160770 /* 1280 */ 405, 274, 217, 108, 556, 110, 4, 405, 275, 275,
160771 /* 1290 */ 564, 1352, 1021, 564, 1228, 59, 59, 523, 106, 106,
160772 /* 1300 */ 559, 561, 275, 275, 412, 107, 457, 443, 566, 565,
160773 /* 1310 */ 564, 8, 1011, 60, 60, 561, 61, 61, 564, 965,
160774 /* 1320 */ 349, 926, 305, 443, 84, 204, 925, 966, 564, 306,
160775 /* 1330 */ 555, 435, 405, 62, 62, 553, 476, 105, 564, 103,
160776 /* 1340 */ 464, 45, 45, 1203, 1011, 1011, 1013, 1014, 27, 533,
160777 /* 1350 */ 564, 46, 46, 453, 532, 1572, 1171, 445, 1528, 564,
160778 /* 1360 */ 279, 47, 47, 327, 1021, 390, 390, 389, 264, 387,
160779 /* 1370 */ 106, 106, 843, 49, 49, 108, 556, 107, 4, 443,
160780 /* 1380 */ 566, 565, 50, 50, 1011, 225, 564, 313, 564, 96,
160781 /* 1390 */ 564, 228, 559, 524, 147, 312, 38, 1123, 564, 394,
160782 /* 1400 */ 466, 328, 280, 98, 544, 564, 17, 564, 323, 63,
160783 /* 1410 */ 63, 64, 64, 65, 65, 443, 1011, 1011, 1013, 1014,
160784 /* 1420 */ 27, 14, 14, 289, 564, 227, 564, 553, 66, 66,
160785 /* 1430 */ 128, 128, 477, 162, 564, 309, 135, 564, 1003, 277,
160786 /* 1440 */ 252, 533, 564, 1501, 564, 418, 534, 67, 67, 52,
160787 /* 1450 */ 52, 564, 1287, 226, 564, 1500, 1021, 68, 68, 208,
160788 /* 1460 */ 69, 69, 106, 106, 1286, 53, 53, 157, 157, 107,
160789 /* 1470 */ 873, 443, 566, 565, 158, 158, 1011, 76, 76, 564,
160790 /* 1480 */ 357, 564, 108, 556, 471, 4, 252, 408, 885, 884,
160791 /* 1490 */ 356, 564, 306, 555, 564, 473, 564, 252, 481, 559,
160792 /* 1500 */ 564, 334, 54, 54, 72, 72, 564, 230, 1011, 1011,
160793 /* 1510 */ 1013, 1014, 27, 564, 129, 129, 449, 73, 73, 130,
160794 /* 1520 */ 130, 564, 443, 131, 131, 519, 564, 873, 564, 127,
160795 /* 1530 */ 127, 333, 1071, 98, 553, 1349, 156, 156, 564, 495,
160796 /* 1540 */ 347, 249, 98, 338, 155, 155, 892, 893, 533, 136,
160797 /* 1550 */ 136, 134, 134, 532, 341, 1171, 445, 1587, 564, 279,
160798 /* 1560 */ 343, 132, 132, 1021, 390, 390, 389, 264, 387, 106,
160799 /* 1570 */ 106, 843, 564, 1067, 564, 249, 107, 564, 443, 566,
160800 /* 1580 */ 565, 133, 133, 1011, 225, 1015, 313, 108, 556, 1071,
160801 /* 1590 */ 4, 345, 968, 969, 312, 75, 75, 77, 77, 1300,
160802 /* 1600 */ 74, 74, 564, 1132, 559, 564, 108, 556, 959, 4,
160803 /* 1610 */ 252, 923, 1083, 110, 1083, 1011, 1011, 1013, 1014, 27,
160804 /* 1620 */ 1082, 1285, 1082, 559, 227, 42, 42, 443, 48, 48,
160805 /* 1630 */ 1284, 856, 162, 145, 924, 135, 110, 352, 362, 553,
160806 /* 1640 */ 1340, 1361, 1015, 1408, 1336, 301, 443, 1561, 1347, 550,
160807 /* 1650 */ 1414, 551, 226, 202, 1265, 1333, 1256, 1244, 553, 1243,
160808 /* 1660 */ 490, 1245, 1580, 267, 11, 391, 210, 223, 1021, 1390,
160809 /* 1670 */ 1395, 282, 365, 367, 106, 106, 930, 369, 454, 285,
160810 /* 1680 */ 1383, 107, 325, 443, 566, 565, 408, 1021, 1011, 326,
160811 /* 1690 */ 475, 306, 555, 106, 106, 100, 556, 500, 4, 1400,
160812 /* 1700 */ 107, 1399, 443, 566, 565, 398, 1283, 1011, 214, 355,
160813 /* 1710 */ 1473, 290, 559, 1472, 1583, 449, 554, 371, 331, 197,
160814 /* 1720 */ 1011, 1011, 1013, 1014, 27, 198, 209, 385, 1222, 173,
160815 /* 1730 */ 221, 256, 1520, 1518, 1219, 443, 79, 416, 206, 1011,
160816 /* 1740 */ 1011, 1013, 1014, 27, 83, 279, 182, 553, 82, 167,
160817 /* 1750 */ 390, 390, 389, 264, 387, 35, 1396, 843, 1478, 459,
160818 /* 1760 */ 175, 177, 460, 493, 178, 179, 180, 233, 96, 396,
160819 /* 1770 */ 225, 1402, 313, 1401, 36, 1404, 1021, 467, 186, 482,
160820 /* 1780 */ 312, 399, 106, 106, 237, 1467, 89, 1489, 488, 107,
160821 /* 1790 */ 239, 443, 566, 565, 268, 336, 1011, 190, 491, 340,
160822 /* 1800 */ 240, 401, 1246, 241, 509, 1294, 430, 1303, 91, 877,
160823 /* 1810 */ 227, 215, 1566, 1302, 1301, 1273, 1598, 432, 162, 518,
160824 /* 1820 */ 1272, 135, 1597, 354, 402, 433, 1271, 1596, 1011, 1011,
160825 /* 1830 */ 1013, 1014, 27, 1293, 299, 360, 300, 525, 226, 95,
160826 /* 1840 */ 254, 255, 1344, 364, 436, 125, 544, 1552, 10, 1453,
160827 /* 1850 */ 379, 1551, 102, 304, 97, 528, 34, 568, 1177, 263,
160828 /* 1860 */ 265, 266, 569, 1241, 1236, 172, 409, 410, 159, 383,
160829 /* 1870 */ 377, 366, 408, 1345, 1343, 368, 370, 306, 555, 1342,
160830 /* 1880 */ 1326, 1325, 1368, 201, 384, 1367, 1505, 1506, 160, 1504,
160831 /* 1890 */ 1503, 142, 161, 211, 212, 78, 830, 444, 203, 308,
160832 /* 1900 */ 297, 449, 222, 1081, 139, 1079, 316, 174, 163, 1203,
160833 /* 1910 */ 229, 176, 232, 909, 324, 1095, 164, 181, 165, 419,
160834 /* 1920 */ 421, 183, 85, 86, 87, 88, 166, 1098, 235, 234,
160835 /* 1930 */ 1094, 152, 18, 236, 335, 1087, 252, 1216, 487, 238,
160836 /* 1940 */ 37, 187, 188, 845, 492, 356, 242, 348, 496, 189,
160837 /* 1950 */ 90, 93, 19, 20, 168, 875, 501, 351, 92, 504,
160838 /* 1960 */ 888, 153, 511, 1133, 1165, 154, 298, 1047, 94, 1134,
160839 /* 1970 */ 39, 958, 216, 271, 273, 192, 953, 110, 1151, 251,
160840 /* 1980 */ 1155, 21, 1159, 22, 1158, 1139, 1153, 33, 23, 24,
160841 /* 1990 */ 540, 25, 195, 98, 26, 1062, 1048, 1046, 1050, 1104,
160842 /* 2000 */ 7, 1103, 257, 258, 1051, 28, 40, 560, 1016, 857,
160843 /* 2010 */ 109, 29, 919, 138, 259, 260, 170, 1589, 388, 1588,
160844 /* 2020 */ 1173, 1172,
 
 
 
 
160845 };
160846 static const YYCODETYPE yy_lookahead[] = {
160847 /* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192,
160848 /* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19,
160849 /* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210,
160850 /* 30 */ 211, 31, 215, 216, 205, 215, 216, 215, 216, 39,
160851 /* 40 */ 227, 215, 229, 43, 44, 45, 46, 47, 48, 49,
160852 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 19,
160853 /* 60 */ 238, 239, 238, 239, 215, 273, 274, 275, 273, 274,
160854 /* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255,
160855 /* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49,
160856 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210,
160857 /* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109,
160858 /* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307,
160859 /* 120 */ 308, 313, 314, 25, 312, 192, 86, 261, 88, 19,
160860 /* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55,
160861 /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
160862 /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160863 /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115,
160864 /* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69,
160865 /* 180 */ 204, 22, 23, 16, 25, 131, 102, 103, 104, 105,
160866 /* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19,
160867 /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
160868 /* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109,
160869 /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
160870 /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 141,
160871 /* 240 */ 307, 308, 272, 24, 77, 312, 79, 67, 102, 103,
160872 /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277,
160873 /* 260 */ 101, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160874 /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 127, 128,
160875 /* 280 */ 310, 311, 102, 103, 104, 105, 106, 107, 108, 109,
160876 /* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186,
160877 /* 300 */ 187, 188, 189, 194, 76, 196, 192, 194, 19, 196,
160878 /* 310 */ 59, 25, 203, 192, 59, 87, 203, 89, 164, 165,
160879 /* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160880 /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160881 /* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73,
160882 /* 350 */ 192, 238, 239, 22, 23, 100, 25, 81, 237, 229,
160883 /* 360 */ 251, 23, 204, 25, 251, 272, 115, 116, 117, 214,
160884 /* 370 */ 115, 116, 144, 192, 265, 120, 262, 222, 265, 102,
160885 /* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160886 /* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160887 /* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154,
160888 /* 410 */ 297, 125, 192, 137, 138, 19, 295, 100, 192, 23,
160889 /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216,
160890 /* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43,
160891 /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160892 /* 450 */ 54, 55, 56, 57, 222, 117, 224, 59, 19, 187,
160893 /* 460 */ 59, 189, 23, 282, 232, 252, 194, 192, 196, 152,
160894 /* 470 */ 153, 154, 252, 72, 261, 203, 152, 248, 154, 250,
160895 /* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50,
160896 /* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103,
160897 /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267,
160898 /* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192,
160899 /* 520 */ 59, 118, 192, 251, 121, 122, 123, 73, 19, 192,
160900 /* 530 */ 59, 192, 23, 72, 131, 308, 22, 265, 22, 312,
160901 /* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160902 /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
160903 /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 192, 297,
160904 /* 570 */ 192, 23, 267, 59, 203, 59, 115, 116, 117, 108,
160905 /* 580 */ 126, 127, 128, 192, 192, 192, 115, 116, 117, 262,
160906 /* 590 */ 59, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160907 /* 600 */ 52, 53, 54, 55, 56, 57, 267, 215, 216, 238,
160908 /* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110,
160909 /* 620 */ 111, 112, 251, 45, 46, 47, 59, 49, 291, 115,
160910 /* 630 */ 116, 117, 116, 81, 192, 305, 306, 19, 192, 268,
160911 /* 640 */ 19, 23, 22, 192, 252, 24, 115, 116, 117, 192,
160912 /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160913 /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
160914 /* 670 */ 52, 53, 54, 55, 56, 57, 19, 22, 23, 59,
160915 /* 680 */ 23, 303, 115, 116, 117, 192, 240, 234, 235, 137,
160916 /* 690 */ 138, 240, 308, 192, 22, 192, 312, 22, 120, 306,
160917 /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160918 /* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216,
160919 /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160920 /* 730 */ 112, 59, 231, 112, 59, 115, 116, 117, 25, 118,
160921 /* 740 */ 119, 120, 121, 122, 123, 124, 19, 243, 81, 303,
160922 /* 750 */ 23, 130, 192, 192, 303, 252, 101, 253, 203, 102,
160923 /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160924 /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
160925 /* 780 */ 53, 54, 55, 56, 57, 19, 119, 115, 116, 117,
160926 /* 790 */ 115, 116, 117, 238, 239, 238, 239, 192, 280, 192,
160927 /* 800 */ 240, 192, 284, 192, 137, 138, 251, 192, 251, 43,
160928 /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160929 /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 267, 102,
160930 /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
160931 /* 840 */ 59, 230, 237, 192, 25, 192, 192, 215, 216, 240,
160932 /* 850 */ 137, 138, 237, 16, 200, 19, 66, 192, 133, 205,
160933 /* 860 */ 135, 136, 230, 303, 74, 203, 215, 216, 102, 103,
160934 /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
160935 /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
160936 /* 890 */ 54, 55, 56, 57, 192, 76, 115, 116, 117, 19,
160937 /* 900 */ 238, 239, 192, 252, 126, 127, 128, 192, 89, 238,
160938 /* 910 */ 239, 92, 303, 251, 77, 262, 79, 215, 216, 129,
160939 /* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49,
160940 /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
160941 /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12,
160942 /* 950 */ 59, 308, 192, 212, 252, 312, 291, 192, 7, 8,
160943 /* 960 */ 9, 300, 301, 203, 27, 126, 127, 128, 308, 207,
160944 /* 970 */ 208, 192, 312, 29, 192, 215, 216, 33, 192, 42,
160945 /* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109,
160946 /* 990 */ 110, 111, 112, 283, 158, 230, 66, 160, 238, 239,
160947 /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 65,
160948 /* 1010 */ 73, 251, 252, 192, 19, 85, 230, 192, 24, 24,
160949 /* 1020 */ 27, 261, 210, 211, 94, 192, 215, 216, 22, 207,
160950 /* 1030 */ 208, 290, 192, 142, 19, 42, 215, 216, 43, 44,
160951 /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160952 /* 1050 */ 55, 56, 57, 59, 19, 144, 63, 192, 43, 44,
160953 /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160954 /* 1070 */ 55, 56, 57, 252, 163, 145, 114, 22, 43, 44,
160955 /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
160956 /* 1090 */ 55, 56, 57, 45, 212, 283, 263, 102, 103, 104,
160957 /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192,
160958 /* 1110 */ 116, 149, 106, 107, 59, 25, 291, 102, 103, 104,
160959 /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 22,
160960 /* 1130 */ 192, 192, 215, 216, 23, 192, 25, 102, 103, 104,
160961 /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 108, 192,
160962 /* 1150 */ 192, 215, 216, 215, 216, 106, 107, 19, 215, 216,
160963 /* 1160 */ 53, 59, 114, 114, 115, 116, 117, 285, 119, 137,
160964 /* 1170 */ 138, 116, 290, 230, 134, 192, 127, 192, 192, 139,
160965 /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51,
160966 /* 1190 */ 52, 53, 54, 55, 56, 57, 308, 76, 215, 216,
160967 /* 1200 */ 312, 152, 263, 154, 215, 216, 192, 117, 87, 19,
160968 /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 231, 116, 230,
160969 /* 1220 */ 263, 263, 237, 203, 298, 299, 203, 239, 36, 215,
160970 /* 1230 */ 216, 192, 142, 192, 15, 45, 115, 116, 117, 251,
160971 /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
160972 /* 1250 */ 112, 59, 192, 203, 215, 216, 215, 216, 238, 239,
160973 /* 1260 */ 192, 238, 239, 71, 192, 144, 25, 203, 243, 230,
160974 /* 1270 */ 243, 251, 192, 81, 251, 215, 216, 243, 253, 60,
160975 /* 1280 */ 253, 255, 256, 19, 20, 25, 22, 253, 238, 239,
160976 /* 1290 */ 192, 192, 100, 192, 101, 215, 216, 19, 106, 107,
160977 /* 1300 */ 36, 251, 238, 239, 114, 113, 192, 115, 116, 117,
160978 /* 1310 */ 192, 47, 120, 215, 216, 251, 215, 216, 192, 31,
160979 /* 1320 */ 130, 134, 243, 59, 148, 149, 139, 39, 192, 137,
160980 /* 1330 */ 138, 263, 253, 215, 216, 71, 19, 157, 192, 159,
160981 /* 1340 */ 128, 215, 216, 25, 152, 153, 154, 155, 156, 85,
160982 /* 1350 */ 192, 215, 216, 268, 90, 0, 1, 2, 192, 192,
160983 /* 1360 */ 5, 215, 216, 151, 100, 10, 11, 12, 13, 14,
160984 /* 1370 */ 106, 107, 17, 215, 216, 19, 20, 113, 22, 115,
160985 /* 1380 */ 116, 117, 215, 216, 120, 30, 192, 32, 192, 148,
160986 /* 1390 */ 192, 24, 36, 115, 22, 40, 24, 23, 192, 25,
160987 /* 1400 */ 128, 23, 99, 25, 144, 192, 22, 192, 192, 215,
160988 /* 1410 */ 216, 215, 216, 215, 216, 59, 152, 153, 154, 155,
160989 /* 1420 */ 156, 215, 216, 151, 192, 70, 192, 71, 215, 216,
160990 /* 1430 */ 215, 216, 115, 78, 192, 132, 81, 192, 23, 22,
160991 /* 1440 */ 25, 85, 192, 192, 192, 61, 90, 215, 216, 215,
160992 /* 1450 */ 216, 192, 225, 98, 192, 192, 100, 215, 216, 141,
160993 /* 1460 */ 215, 216, 106, 107, 225, 215, 216, 215, 216, 113,
160994 /* 1470 */ 59, 115, 116, 117, 215, 216, 120, 215, 216, 192,
160995 /* 1480 */ 120, 192, 19, 20, 23, 22, 25, 132, 119, 120,
160996 /* 1490 */ 130, 192, 137, 138, 192, 23, 192, 25, 192, 36,
160997 /* 1500 */ 192, 192, 215, 216, 215, 216, 192, 140, 152, 153,
160998 /* 1510 */ 154, 155, 156, 192, 215, 216, 161, 215, 216, 215,
160999 /* 1520 */ 216, 192, 59, 215, 216, 19, 192, 116, 192, 215,
161000 /* 1530 */ 216, 23, 59, 25, 71, 192, 215, 216, 192, 23,
161001 /* 1540 */ 23, 25, 25, 192, 215, 216, 7, 8, 85, 215,
161002 /* 1550 */ 216, 215, 216, 90, 192, 1, 2, 140, 192, 5,
161003 /* 1560 */ 192, 215, 216, 100, 10, 11, 12, 13, 14, 106,
161004 /* 1570 */ 107, 17, 192, 23, 192, 25, 113, 192, 115, 116,
161005 /* 1580 */ 117, 215, 216, 120, 30, 59, 32, 19, 20, 116,
161006 /* 1590 */ 22, 192, 83, 84, 40, 215, 216, 215, 216, 192,
161007 /* 1600 */ 215, 216, 192, 97, 36, 192, 19, 20, 23, 22,
161008 /* 1610 */ 25, 23, 152, 25, 154, 152, 153, 154, 155, 156,
161009 /* 1620 */ 152, 225, 154, 36, 70, 215, 216, 59, 215, 216,
161010 /* 1630 */ 192, 23, 78, 25, 23, 81, 25, 192, 192, 71,
161011 /* 1640 */ 257, 192, 116, 192, 192, 254, 59, 317, 192, 192,
161012 /* 1650 */ 192, 235, 98, 241, 192, 254, 192, 192, 71, 192,
161013 /* 1660 */ 287, 192, 192, 286, 242, 190, 213, 296, 100, 266,
161014 /* 1670 */ 270, 244, 254, 254, 106, 107, 108, 254, 258, 258,
161015 /* 1680 */ 266, 113, 292, 115, 116, 117, 132, 100, 120, 245,
161016 /* 1690 */ 292, 137, 138, 106, 107, 19, 20, 219, 22, 270,
161017 /* 1700 */ 113, 270, 115, 116, 117, 270, 224, 120, 228, 218,
161018 /* 1710 */ 218, 245, 36, 218, 195, 161, 279, 258, 244, 248,
161019 /* 1720 */ 152, 153, 154, 155, 156, 248, 242, 244, 60, 296,
161020 /* 1730 */ 296, 140, 199, 199, 38, 59, 293, 199, 149, 152,
161021 /* 1740 */ 153, 154, 155, 156, 150, 5, 22, 71, 293, 43,
161022 /* 1750 */ 10, 11, 12, 13, 14, 269, 271, 17, 282, 18,
161023 /* 1760 */ 233, 236, 199, 18, 236, 236, 236, 198, 148, 245,
161024 /* 1770 */ 30, 271, 32, 271, 269, 233, 100, 245, 233, 199,
161025 /* 1780 */ 40, 245, 106, 107, 198, 245, 157, 289, 62, 113,
161026 /* 1790 */ 198, 115, 116, 117, 199, 288, 120, 22, 220, 199,
161027 /* 1800 */ 198, 220, 199, 198, 114, 226, 64, 217, 22, 125,
161028 /* 1810 */ 70, 164, 311, 217, 217, 217, 223, 24, 78, 304,
161029 /* 1820 */ 219, 81, 223, 217, 220, 112, 217, 217, 152, 153,
161030 /* 1830 */ 154, 155, 156, 226, 281, 220, 281, 143, 98, 114,
161031 /* 1840 */ 199, 91, 260, 259, 82, 147, 144, 316, 22, 276,
161032 /* 1850 */ 199, 316, 157, 278, 146, 145, 25, 201, 13, 193,
161033 /* 1860 */ 193, 6, 191, 191, 191, 299, 302, 302, 206, 246,
161034 /* 1870 */ 248, 259, 132, 260, 260, 259, 259, 137, 138, 260,
161035 /* 1880 */ 249, 249, 264, 247, 245, 264, 212, 212, 206, 212,
161036 /* 1890 */ 212, 221, 206, 213, 213, 212, 4, 3, 22, 162,
161037 /* 1900 */ 221, 161, 15, 23, 16, 23, 138, 150, 129, 25,
161038 /* 1910 */ 24, 141, 143, 20, 16, 1, 129, 141, 129, 61,
161039 /* 1920 */ 37, 150, 53, 53, 53, 53, 129, 115, 140, 34,
161040 /* 1930 */ 1, 5, 22, 114, 160, 68, 25, 75, 41, 140,
161041 /* 1940 */ 24, 68, 114, 20, 19, 130, 124, 23, 67, 22,
161042 /* 1950 */ 22, 148, 22, 22, 37, 59, 67, 24, 22, 96,
161043 /* 1960 */ 28, 23, 22, 97, 23, 23, 67, 23, 25, 23,
161044 /* 1970 */ 22, 115, 140, 23, 23, 22, 142, 25, 88, 34,
161045 /* 1980 */ 75, 34, 75, 34, 93, 23, 86, 22, 34, 34,
161046 /* 1990 */ 24, 34, 25, 25, 34, 23, 23, 23, 23, 23,
161047 /* 2000 */ 44, 23, 25, 22, 11, 22, 22, 25, 23, 23,
161048 /* 2010 */ 22, 22, 134, 23, 140, 140, 25, 140, 15, 140,
161049 /* 2020 */ 1, 1, 318, 318, 318, 318, 318, 318, 318, 318,
161050 /* 2030 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161051 /* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161052 /* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161053 /* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161054 /* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161055 /* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161056 /* 2090 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161057 /* 2100 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161058 /* 2110 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161059 /* 2120 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161060 /* 2130 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161061 /* 2140 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161062 /* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161063 /* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161064 /* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161065 /* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161066 /* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318,
161067 /* 2200 */ 318, 318, 318, 318, 318, 318,
161068 };
161069 #define YY_SHIFT_COUNT (571)
 
 
 
 
 
161070 #define YY_SHIFT_MIN (0)
161071 #define YY_SHIFT_MAX (2020)
161072 static const unsigned short int yy_shift_ofst[] = {
161073 /* 0 */ 1554, 1355, 1740, 1192, 1192, 552, 1264, 1356, 1463, 1587,
161074 /* 10 */ 1587, 1587, 276, 0, 0, 180, 1015, 1587, 1587, 1587,
161075 /* 20 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161076 /* 30 */ 1049, 1049, 1121, 1121, 54, 667, 552, 552, 552, 552,
161077 /* 40 */ 552, 40, 110, 219, 289, 396, 439, 509, 548, 618,
161078 /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
161079 /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
161080 /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1568, 1587,
161081 /* 80 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161082 /* 90 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161083 /* 100 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587, 1587,
161084 /* 110 */ 1587, 1587, 1587, 1676, 1587, 1587, 1587, 1587, 1587, 1587,
161085 /* 120 */ 1587, 1587, 1587, 1587, 1587, 1587, 1587, 146, 84, 84,
161086 /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 531,
161087 /* 140 */ 531, 51, 1190, 531, 531, 324, 324, 531, 713, 713,
161088 /* 150 */ 713, 713, 151, 154, 154, 4, 149, 2022, 2022, 621,
161089 /* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228,
161090 /* 170 */ 251, 159, 331, 531, 531, 531, 531, 531, 531, 531,
161091 /* 180 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161092 /* 190 */ 531, 531, 531, 819, 819, 531, 9, 25, 25, 1102,
161093 /* 200 */ 1102, 911, 1032, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161094 /* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891,
161095 /* 220 */ 675, 531, 531, 531, 531, 531, 531, 531, 531, 531,
161096 /* 230 */ 531, 454, 531, 531, 531, 531, 531, 531, 531, 531,
161097 /* 240 */ 531, 531, 531, 531, 790, 790, 790, 531, 531, 531,
161098 /* 250 */ 338, 531, 531, 531, 516, 930, 531, 531, 993, 531,
161099 /* 260 */ 531, 531, 531, 531, 531, 531, 531, 778, 944, 725,
161100 /* 270 */ 994, 994, 994, 994, 1090, 725, 725, 1040, 1006, 951,
161101 /* 280 */ 1219, 962, 1176, 98, 1278, 1176, 1278, 1317, 1241, 962,
161102 /* 290 */ 962, 1241, 962, 98, 1317, 286, 1111, 1048, 1288, 1288,
161103 /* 300 */ 1288, 1278, 1260, 1260, 1180, 1318, 1187, 1372, 1668, 1668,
161104 /* 310 */ 1591, 1591, 1696, 1696, 1591, 1594, 1589, 1724, 1706, 1741,
161105 /* 320 */ 1741, 1741, 1741, 1591, 1745, 1620, 1589, 1589, 1620, 1724,
161106 /* 330 */ 1706, 1620, 1706, 1620, 1591, 1745, 1629, 1726, 1591, 1745,
161107 /* 340 */ 1775, 1591, 1745, 1591, 1745, 1775, 1690, 1690, 1690, 1742,
161108 /* 350 */ 1786, 1786, 1775, 1690, 1684, 1690, 1742, 1690, 1690, 1647,
161109 /* 360 */ 1793, 1713, 1713, 1775, 1694, 1725, 1694, 1725, 1694, 1725,
161110 /* 370 */ 1694, 1725, 1591, 1750, 1750, 1762, 1762, 1698, 1702, 1826,
161111 /* 380 */ 1591, 1695, 1698, 1708, 1710, 1620, 1831, 1845, 1845, 1855,
161112 /* 390 */ 1855, 1855, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
161113 /* 400 */ 2022, 2022, 2022, 2022, 2022, 2022, 2022, 578, 837, 655,
161114 /* 410 */ 1193, 167, 839, 1055, 1374, 1303, 1107, 1367, 1212, 1272,
161115 /* 420 */ 1378, 1384, 1415, 1461, 1472, 1508, 1516, 1517, 1411, 1369,
161116 /* 430 */ 1539, 1360, 1506, 1473, 1550, 1585, 1509, 1588, 1460, 1468,
161117 /* 440 */ 1608, 1611, 1526, 1417, 1892, 1894, 1876, 1737, 1887, 1888,
161118 /* 450 */ 1880, 1882, 1768, 1757, 1779, 1884, 1884, 1886, 1770, 1893,
161119 /* 460 */ 1769, 1898, 1914, 1776, 1787, 1884, 1789, 1858, 1883, 1884,
161120 /* 470 */ 1771, 1869, 1870, 1871, 1872, 1797, 1812, 1895, 1788, 1929,
161121 /* 480 */ 1926, 1910, 1819, 1774, 1867, 1911, 1873, 1862, 1897, 1799,
161122 /* 490 */ 1828, 1916, 1923, 1925, 1815, 1822, 1927, 1881, 1928, 1930,
161123 /* 500 */ 1924, 1931, 1889, 1896, 1933, 1863, 1932, 1936, 1899, 1917,
161124 /* 510 */ 1938, 1803, 1940, 1941, 1942, 1944, 1943, 1946, 1948, 1866,
161125 /* 520 */ 1832, 1950, 1951, 1856, 1945, 1953, 1834, 1952, 1947, 1949,
161126 /* 530 */ 1954, 1955, 1890, 1905, 1900, 1956, 1907, 1891, 1957, 1962,
161127 /* 540 */ 1965, 1966, 1967, 1968, 1960, 1972, 1952, 1973, 1974, 1975,
161128 /* 550 */ 1976, 1977, 1978, 1981, 1993, 1983, 1984, 1985, 1986, 1988,
161129 /* 560 */ 1989, 1982, 1878, 1874, 1875, 1877, 1879, 1991, 1990, 2003,
161130 /* 570 */ 2019, 2020,
161131 };
161132 #define YY_REDUCE_COUNT (406)
161133 #define YY_REDUCE_MIN (-272)
161134 #define YY_REDUCE_MAX (1686)
161135 static const short yy_reduce_ofst[] = {
161136 /* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134,
161137 /* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765,
161138 /* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821,
161139 /* 30 */ 710, 812, -188, -67, -187, 555, 662, 1020, 1023, 1050,
161140 /* 40 */ 1064, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161141 /* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161142 /* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267,
161143 /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 811, 917,
161144 /* 80 */ 936, 938, 983, 1014, 1041, 1060, 1080, 1098, 1101, 1118,
161145 /* 90 */ 1126, 1136, 1146, 1158, 1167, 1194, 1196, 1198, 1206, 1213,
161146 /* 100 */ 1215, 1232, 1234, 1242, 1245, 1250, 1252, 1259, 1262, 1287,
161147 /* 110 */ 1289, 1299, 1302, 1304, 1308, 1314, 1321, 1329, 1334, 1336,
161148 /* 120 */ 1346, 1366, 1380, 1382, 1385, 1410, 1413, -267, -267, -267,
161149 /* 130 */ -267, -267, -267, -267, -267, 446, -267, 451, -24, 121,
161150 /* 140 */ 560, 518, 232, 609, 330, -181, -111, 654, 557, 671,
161151 /* 150 */ 557, 671, 882, -30, 93, -267, -267, -267, -267, 155,
161152 /* 160 */ 155, 155, 181, 242, 305, 339, 561, -218, 453, 227,
161153 /* 170 */ 158, 661, 661, -171, 114, 327, 653, -166, 275, 605,
161154 /* 180 */ 615, 337, 833, 665, 939, 957, 825, 958, 985, 501,
161155 /* 190 */ 986, 378, 1068, 384, 643, 393, 741, 660, 888, 762,
161156 /* 200 */ 822, 229, 988, 926, 504, 1025, 1027, 1034, 1026, 1079,
161157 /* 210 */ -204, -174, -151, 18, 130, 198, 226, 376, 391, 442,
161158 /* 220 */ 457, 493, 607, 715, 779, 782, 840, 865, 1072, 1099,
161159 /* 230 */ 1114, 1085, 1166, 1216, 1251, 1263, 1306, 1309, 1343, 1351,
161160 /* 240 */ 1362, 1368, 1399, 1407, 1227, 1239, 1396, 1438, 1445, 1446,
161161 /* 250 */ 1383, 1449, 1451, 1452, 1391, 1330, 1456, 1457, 1416, 1458,
161162 /* 260 */ 226, 1462, 1464, 1465, 1467, 1469, 1470, 1373, 1377, 1412,
161163 /* 270 */ 1401, 1418, 1419, 1423, 1383, 1412, 1412, 1422, 1453, 1475,
161164 /* 280 */ 1371, 1400, 1403, 1427, 1420, 1414, 1421, 1390, 1444, 1429,
161165 /* 290 */ 1431, 1466, 1435, 1474, 1398, 1478, 1480, 1482, 1491, 1492,
161166 /* 300 */ 1495, 1459, 1471, 1477, 1437, 1483, 1484, 1519, 1433, 1434,
161167 /* 310 */ 1533, 1534, 1443, 1455, 1538, 1476, 1485, 1486, 1527, 1525,
161168 /* 320 */ 1528, 1529, 1530, 1563, 1569, 1524, 1500, 1502, 1532, 1505,
161169 /* 330 */ 1542, 1536, 1545, 1540, 1580, 1586, 1498, 1507, 1595, 1592,
161170 /* 340 */ 1578, 1600, 1602, 1603, 1605, 1581, 1590, 1596, 1597, 1579,
161171 /* 350 */ 1593, 1599, 1604, 1598, 1601, 1606, 1607, 1609, 1610, 1501,
161172 /* 360 */ 1515, 1553, 1555, 1615, 1582, 1584, 1613, 1612, 1614, 1616,
161173 /* 370 */ 1619, 1617, 1641, 1531, 1535, 1618, 1621, 1631, 1622, 1573,
161174 /* 380 */ 1651, 1575, 1632, 1636, 1623, 1639, 1656, 1666, 1667, 1671,
161175 /* 390 */ 1672, 1673, 1564, 1565, 1566, 1662, 1674, 1675, 1677, 1678,
161176 /* 400 */ 1682, 1670, 1679, 1680, 1681, 1683, 1686,
161177 };
161178 static const YYACTIONTYPE yy_default[] = {
161179 /* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462,
161180 /* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230,
161181 /* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230,
161182 /* 30 */ 1230, 1230, 1550, 1550, 1230, 1230, 1230, 1230, 1230, 1230,
161183 /* 40 */ 1230, 1230, 1380, 1230, 1387, 1230, 1230, 1230, 1230, 1230,
161184 /* 50 */ 1463, 1464, 1230, 1230, 1230, 1514, 1516, 1479, 1394, 1393,
161185 /* 60 */ 1392, 1391, 1497, 1358, 1385, 1378, 1382, 1457, 1458, 1456,
161186 /* 70 */ 1460, 1464, 1463, 1230, 1381, 1428, 1442, 1427, 1230, 1230,
161187 /* 80 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161188 /* 90 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161189 /* 100 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161190 /* 110 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161191 /* 120 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1436, 1441, 1447,
161192 /* 130 */ 1440, 1437, 1430, 1429, 1431, 1230, 1432, 1230, 1254, 1230,
161193 /* 140 */ 1230, 1251, 1305, 1230, 1230, 1230, 1230, 1230, 1534, 1533,
161194 /* 150 */ 1230, 1230, 1263, 1422, 1421, 1433, 1434, 1444, 1443, 1522,
161195 /* 160 */ 1586, 1585, 1480, 1230, 1230, 1230, 1230, 1230, 1230, 1550,
161196 /* 170 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161197 /* 180 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161198 /* 190 */ 1230, 1230, 1230, 1550, 1550, 1230, 1263, 1550, 1550, 1259,
161199 /* 200 */ 1259, 1365, 1230, 1529, 1332, 1332, 1332, 1332, 1341, 1332,
161200 /* 210 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161201 /* 220 */ 1230, 1230, 1230, 1230, 1230, 1519, 1517, 1230, 1230, 1230,
161202 /* 230 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161203 /* 240 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161204 /* 250 */ 1230, 1230, 1230, 1230, 1337, 1230, 1230, 1230, 1230, 1230,
161205 /* 260 */ 1230, 1230, 1230, 1230, 1230, 1230, 1579, 1230, 1492, 1319,
161206 /* 270 */ 1337, 1337, 1337, 1337, 1339, 1320, 1318, 1331, 1264, 1237,
161207 /* 280 */ 1625, 1397, 1386, 1338, 1360, 1386, 1360, 1622, 1384, 1397,
161208 /* 290 */ 1397, 1384, 1397, 1338, 1622, 1280, 1602, 1275, 1371, 1371,
161209 /* 300 */ 1371, 1360, 1365, 1365, 1459, 1338, 1331, 1230, 1625, 1625,
161210 /* 310 */ 1346, 1346, 1624, 1624, 1346, 1480, 1609, 1406, 1308, 1314,
161211 /* 320 */ 1314, 1314, 1314, 1346, 1248, 1384, 1609, 1609, 1384, 1406,
161212 /* 330 */ 1308, 1384, 1308, 1384, 1346, 1248, 1496, 1619, 1346, 1248,
161213 /* 340 */ 1470, 1346, 1248, 1346, 1248, 1470, 1306, 1306, 1306, 1295,
161214 /* 350 */ 1230, 1230, 1470, 1306, 1280, 1306, 1295, 1306, 1306, 1568,
161215 /* 360 */ 1230, 1474, 1474, 1470, 1364, 1359, 1364, 1359, 1364, 1359,
161216 /* 370 */ 1364, 1359, 1346, 1560, 1560, 1374, 1374, 1379, 1365, 1465,
161217 /* 380 */ 1346, 1230, 1379, 1377, 1375, 1384, 1298, 1582, 1582, 1578,
161218 /* 390 */ 1578, 1578, 1630, 1630, 1529, 1595, 1263, 1263, 1263, 1263,
161219 /* 400 */ 1595, 1282, 1282, 1264, 1264, 1263, 1595, 1230, 1230, 1230,
161220 /* 410 */ 1230, 1230, 1230, 1590, 1230, 1524, 1481, 1350, 1230, 1230,
161221 /* 420 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161222 /* 430 */ 1230, 1230, 1535, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161223 /* 440 */ 1230, 1230, 1230, 1411, 1230, 1233, 1526, 1230, 1230, 1230,
161224 /* 450 */ 1230, 1230, 1230, 1230, 1230, 1388, 1389, 1351, 1230, 1230,
161225 /* 460 */ 1230, 1230, 1230, 1230, 1230, 1403, 1230, 1230, 1230, 1398,
161226 /* 470 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1621, 1230,
161227 /* 480 */ 1230, 1230, 1230, 1230, 1230, 1495, 1494, 1230, 1230, 1348,
161228 /* 490 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161229 /* 500 */ 1230, 1230, 1230, 1278, 1230, 1230, 1230, 1230, 1230, 1230,
161230 /* 510 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161231 /* 520 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1376, 1230, 1230,
161232 /* 530 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161233 /* 540 */ 1230, 1230, 1565, 1366, 1230, 1230, 1612, 1230, 1230, 1230,
161234 /* 550 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230,
161235 /* 560 */ 1230, 1606, 1322, 1413, 1230, 1412, 1416, 1252, 1230, 1242,
161236 /* 570 */ 1230, 1230,
161237 };
161238 /********** End of lemon-generated parsing tables *****************************/
161239
161240 /* The next table maps tokens (terminal symbols) into fallback tokens.
161241 ** If a construct like the following:
@@ -161296,14 +161525,14 @@
161296 59, /* DETACH => ID */
161297 59, /* EACH => ID */
161298 59, /* FAIL => ID */
161299 0, /* OR => nothing */
161300 0, /* AND => nothing */
 
161301 59, /* MATCH => ID */
161302 59, /* LIKE_KW => ID */
161303 0, /* BETWEEN => nothing */
161304 0, /* IS => nothing */
161305 0, /* IN => nothing */
161306 0, /* ISNULL => nothing */
161307 0, /* NOTNULL => nothing */
161308 0, /* NE => nothing */
161309 0, /* EQ => nothing */
@@ -161363,10 +161592,11 @@
161363 0, /* MINUS => nothing */
161364 0, /* STAR => nothing */
161365 0, /* SLASH => nothing */
161366 0, /* REM => nothing */
161367 0, /* CONCAT => nothing */
 
161368 0, /* COLLATE => nothing */
161369 0, /* BITNOT => nothing */
161370 0, /* ON => nothing */
161371 0, /* INDEXED => nothing */
161372 0, /* STRING => nothing */
@@ -161568,14 +161798,14 @@
161568 /* 40 */ "DETACH",
161569 /* 41 */ "EACH",
161570 /* 42 */ "FAIL",
161571 /* 43 */ "OR",
161572 /* 44 */ "AND",
161573 /* 45 */ "MATCH",
161574 /* 46 */ "LIKE_KW",
161575 /* 47 */ "BETWEEN",
161576 /* 48 */ "IS",
161577 /* 49 */ "IN",
161578 /* 50 */ "ISNULL",
161579 /* 51 */ "NOTNULL",
161580 /* 52 */ "NE",
161581 /* 53 */ "EQ",
@@ -161635,216 +161865,217 @@
161635 /* 107 */ "MINUS",
161636 /* 108 */ "STAR",
161637 /* 109 */ "SLASH",
161638 /* 110 */ "REM",
161639 /* 111 */ "CONCAT",
161640 /* 112 */ "COLLATE",
161641 /* 113 */ "BITNOT",
161642 /* 114 */ "ON",
161643 /* 115 */ "INDEXED",
161644 /* 116 */ "STRING",
161645 /* 117 */ "JOIN_KW",
161646 /* 118 */ "CONSTRAINT",
161647 /* 119 */ "DEFAULT",
161648 /* 120 */ "NULL",
161649 /* 121 */ "PRIMARY",
161650 /* 122 */ "UNIQUE",
161651 /* 123 */ "CHECK",
161652 /* 124 */ "REFERENCES",
161653 /* 125 */ "AUTOINCR",
161654 /* 126 */ "INSERT",
161655 /* 127 */ "DELETE",
161656 /* 128 */ "UPDATE",
161657 /* 129 */ "SET",
161658 /* 130 */ "DEFERRABLE",
161659 /* 131 */ "FOREIGN",
161660 /* 132 */ "DROP",
161661 /* 133 */ "UNION",
161662 /* 134 */ "ALL",
161663 /* 135 */ "EXCEPT",
161664 /* 136 */ "INTERSECT",
161665 /* 137 */ "SELECT",
161666 /* 138 */ "VALUES",
161667 /* 139 */ "DISTINCT",
161668 /* 140 */ "DOT",
161669 /* 141 */ "FROM",
161670 /* 142 */ "JOIN",
161671 /* 143 */ "USING",
161672 /* 144 */ "ORDER",
161673 /* 145 */ "GROUP",
161674 /* 146 */ "HAVING",
161675 /* 147 */ "LIMIT",
161676 /* 148 */ "WHERE",
161677 /* 149 */ "RETURNING",
161678 /* 150 */ "INTO",
161679 /* 151 */ "NOTHING",
161680 /* 152 */ "FLOAT",
161681 /* 153 */ "BLOB",
161682 /* 154 */ "INTEGER",
161683 /* 155 */ "VARIABLE",
161684 /* 156 */ "CASE",
161685 /* 157 */ "WHEN",
161686 /* 158 */ "THEN",
161687 /* 159 */ "ELSE",
161688 /* 160 */ "INDEX",
161689 /* 161 */ "ALTER",
161690 /* 162 */ "ADD",
161691 /* 163 */ "WINDOW",
161692 /* 164 */ "OVER",
161693 /* 165 */ "FILTER",
161694 /* 166 */ "COLUMN",
161695 /* 167 */ "AGG_FUNCTION",
161696 /* 168 */ "AGG_COLUMN",
161697 /* 169 */ "TRUEFALSE",
161698 /* 170 */ "ISNOT",
161699 /* 171 */ "FUNCTION",
161700 /* 172 */ "UMINUS",
161701 /* 173 */ "UPLUS",
161702 /* 174 */ "TRUTH",
161703 /* 175 */ "REGISTER",
161704 /* 176 */ "VECTOR",
161705 /* 177 */ "SELECT_COLUMN",
161706 /* 178 */ "IF_NULL_ROW",
161707 /* 179 */ "ASTERISK",
161708 /* 180 */ "SPAN",
161709 /* 181 */ "ERROR",
161710 /* 182 */ "SPACE",
161711 /* 183 */ "ILLEGAL",
161712 /* 184 */ "input",
161713 /* 185 */ "cmdlist",
161714 /* 186 */ "ecmd",
161715 /* 187 */ "cmdx",
161716 /* 188 */ "explain",
161717 /* 189 */ "cmd",
161718 /* 190 */ "transtype",
161719 /* 191 */ "trans_opt",
161720 /* 192 */ "nm",
161721 /* 193 */ "savepoint_opt",
161722 /* 194 */ "create_table",
161723 /* 195 */ "create_table_args",
161724 /* 196 */ "createkw",
161725 /* 197 */ "temp",
161726 /* 198 */ "ifnotexists",
161727 /* 199 */ "dbnm",
161728 /* 200 */ "columnlist",
161729 /* 201 */ "conslist_opt",
161730 /* 202 */ "table_option_set",
161731 /* 203 */ "select",
161732 /* 204 */ "table_option",
161733 /* 205 */ "columnname",
161734 /* 206 */ "carglist",
161735 /* 207 */ "typetoken",
161736 /* 208 */ "typename",
161737 /* 209 */ "signed",
161738 /* 210 */ "plus_num",
161739 /* 211 */ "minus_num",
161740 /* 212 */ "scanpt",
161741 /* 213 */ "scantok",
161742 /* 214 */ "ccons",
161743 /* 215 */ "term",
161744 /* 216 */ "expr",
161745 /* 217 */ "onconf",
161746 /* 218 */ "sortorder",
161747 /* 219 */ "autoinc",
161748 /* 220 */ "eidlist_opt",
161749 /* 221 */ "refargs",
161750 /* 222 */ "defer_subclause",
161751 /* 223 */ "generated",
161752 /* 224 */ "refarg",
161753 /* 225 */ "refact",
161754 /* 226 */ "init_deferred_pred_opt",
161755 /* 227 */ "conslist",
161756 /* 228 */ "tconscomma",
161757 /* 229 */ "tcons",
161758 /* 230 */ "sortlist",
161759 /* 231 */ "eidlist",
161760 /* 232 */ "defer_subclause_opt",
161761 /* 233 */ "orconf",
161762 /* 234 */ "resolvetype",
161763 /* 235 */ "raisetype",
161764 /* 236 */ "ifexists",
161765 /* 237 */ "fullname",
161766 /* 238 */ "selectnowith",
161767 /* 239 */ "oneselect",
161768 /* 240 */ "wqlist",
161769 /* 241 */ "multiselect_op",
161770 /* 242 */ "distinct",
161771 /* 243 */ "selcollist",
161772 /* 244 */ "from",
161773 /* 245 */ "where_opt",
161774 /* 246 */ "groupby_opt",
161775 /* 247 */ "having_opt",
161776 /* 248 */ "orderby_opt",
161777 /* 249 */ "limit_opt",
161778 /* 250 */ "window_clause",
161779 /* 251 */ "values",
161780 /* 252 */ "nexprlist",
161781 /* 253 */ "sclp",
161782 /* 254 */ "as",
161783 /* 255 */ "seltablist",
161784 /* 256 */ "stl_prefix",
161785 /* 257 */ "joinop",
161786 /* 258 */ "indexed_opt",
161787 /* 259 */ "on_opt",
161788 /* 260 */ "using_opt",
161789 /* 261 */ "exprlist",
161790 /* 262 */ "xfullname",
161791 /* 263 */ "idlist",
161792 /* 264 */ "nulls",
161793 /* 265 */ "with",
161794 /* 266 */ "where_opt_ret",
161795 /* 267 */ "setlist",
161796 /* 268 */ "insert_cmd",
161797 /* 269 */ "idlist_opt",
161798 /* 270 */ "upsert",
161799 /* 271 */ "returning",
161800 /* 272 */ "filter_over",
161801 /* 273 */ "likeop",
161802 /* 274 */ "between_op",
161803 /* 275 */ "in_op",
161804 /* 276 */ "paren_exprlist",
161805 /* 277 */ "case_operand",
161806 /* 278 */ "case_exprlist",
161807 /* 279 */ "case_else",
161808 /* 280 */ "uniqueflag",
161809 /* 281 */ "collate",
161810 /* 282 */ "vinto",
161811 /* 283 */ "nmnum",
161812 /* 284 */ "trigger_decl",
161813 /* 285 */ "trigger_cmd_list",
161814 /* 286 */ "trigger_time",
161815 /* 287 */ "trigger_event",
161816 /* 288 */ "foreach_clause",
161817 /* 289 */ "when_clause",
161818 /* 290 */ "trigger_cmd",
161819 /* 291 */ "trnm",
161820 /* 292 */ "tridxby",
161821 /* 293 */ "database_kw_opt",
161822 /* 294 */ "key_opt",
161823 /* 295 */ "add_column_fullname",
161824 /* 296 */ "kwcolumn_opt",
161825 /* 297 */ "create_vtab",
161826 /* 298 */ "vtabarglist",
161827 /* 299 */ "vtabarg",
161828 /* 300 */ "vtabargtoken",
161829 /* 301 */ "lp",
161830 /* 302 */ "anylist",
161831 /* 303 */ "wqitem",
161832 /* 304 */ "wqas",
161833 /* 305 */ "windowdefn_list",
161834 /* 306 */ "windowdefn",
161835 /* 307 */ "window",
161836 /* 308 */ "frame_opt",
161837 /* 309 */ "part_opt",
161838 /* 310 */ "filter_clause",
161839 /* 311 */ "over_clause",
161840 /* 312 */ "range_or_rows",
161841 /* 313 */ "frame_bound",
161842 /* 314 */ "frame_bound_s",
161843 /* 315 */ "frame_bound_e",
161844 /* 316 */ "frame_exclude_opt",
161845 /* 317 */ "frame_exclude",
 
161846 };
161847 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
161848
161849 #ifndef NDEBUG
161850 /* For tracing reduce actions, the names of all rules are required.
@@ -162060,199 +162291,200 @@
162060 /* 207 */ "expr ::= expr IS expr",
162061 /* 208 */ "expr ::= expr IS NOT expr",
162062 /* 209 */ "expr ::= NOT expr",
162063 /* 210 */ "expr ::= BITNOT expr",
162064 /* 211 */ "expr ::= PLUS|MINUS expr",
162065 /* 212 */ "between_op ::= BETWEEN",
162066 /* 213 */ "between_op ::= NOT BETWEEN",
162067 /* 214 */ "expr ::= expr between_op expr AND expr",
162068 /* 215 */ "in_op ::= IN",
162069 /* 216 */ "in_op ::= NOT IN",
162070 /* 217 */ "expr ::= expr in_op LP exprlist RP",
162071 /* 218 */ "expr ::= LP select RP",
162072 /* 219 */ "expr ::= expr in_op LP select RP",
162073 /* 220 */ "expr ::= expr in_op nm dbnm paren_exprlist",
162074 /* 221 */ "expr ::= EXISTS LP select RP",
162075 /* 222 */ "expr ::= CASE case_operand case_exprlist case_else END",
162076 /* 223 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
162077 /* 224 */ "case_exprlist ::= WHEN expr THEN expr",
162078 /* 225 */ "case_else ::= ELSE expr",
162079 /* 226 */ "case_else ::=",
162080 /* 227 */ "case_operand ::= expr",
162081 /* 228 */ "case_operand ::=",
162082 /* 229 */ "exprlist ::=",
162083 /* 230 */ "nexprlist ::= nexprlist COMMA expr",
162084 /* 231 */ "nexprlist ::= expr",
162085 /* 232 */ "paren_exprlist ::=",
162086 /* 233 */ "paren_exprlist ::= LP exprlist RP",
162087 /* 234 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
162088 /* 235 */ "uniqueflag ::= UNIQUE",
162089 /* 236 */ "uniqueflag ::=",
162090 /* 237 */ "eidlist_opt ::=",
162091 /* 238 */ "eidlist_opt ::= LP eidlist RP",
162092 /* 239 */ "eidlist ::= eidlist COMMA nm collate sortorder",
162093 /* 240 */ "eidlist ::= nm collate sortorder",
162094 /* 241 */ "collate ::=",
162095 /* 242 */ "collate ::= COLLATE ID|STRING",
162096 /* 243 */ "cmd ::= DROP INDEX ifexists fullname",
162097 /* 244 */ "cmd ::= VACUUM vinto",
162098 /* 245 */ "cmd ::= VACUUM nm vinto",
162099 /* 246 */ "vinto ::= INTO expr",
162100 /* 247 */ "vinto ::=",
162101 /* 248 */ "cmd ::= PRAGMA nm dbnm",
162102 /* 249 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
162103 /* 250 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
162104 /* 251 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
162105 /* 252 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
162106 /* 253 */ "plus_num ::= PLUS INTEGER|FLOAT",
162107 /* 254 */ "minus_num ::= MINUS INTEGER|FLOAT",
162108 /* 255 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
162109 /* 256 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
162110 /* 257 */ "trigger_time ::= BEFORE|AFTER",
162111 /* 258 */ "trigger_time ::= INSTEAD OF",
162112 /* 259 */ "trigger_time ::=",
162113 /* 260 */ "trigger_event ::= DELETE|INSERT",
162114 /* 261 */ "trigger_event ::= UPDATE",
162115 /* 262 */ "trigger_event ::= UPDATE OF idlist",
162116 /* 263 */ "when_clause ::=",
162117 /* 264 */ "when_clause ::= WHEN expr",
162118 /* 265 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
162119 /* 266 */ "trigger_cmd_list ::= trigger_cmd SEMI",
162120 /* 267 */ "trnm ::= nm DOT nm",
162121 /* 268 */ "tridxby ::= INDEXED BY nm",
162122 /* 269 */ "tridxby ::= NOT INDEXED",
162123 /* 270 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
162124 /* 271 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
162125 /* 272 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
162126 /* 273 */ "trigger_cmd ::= scanpt select scanpt",
162127 /* 274 */ "expr ::= RAISE LP IGNORE RP",
162128 /* 275 */ "expr ::= RAISE LP raisetype COMMA nm RP",
162129 /* 276 */ "raisetype ::= ROLLBACK",
162130 /* 277 */ "raisetype ::= ABORT",
162131 /* 278 */ "raisetype ::= FAIL",
162132 /* 279 */ "cmd ::= DROP TRIGGER ifexists fullname",
162133 /* 280 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
162134 /* 281 */ "cmd ::= DETACH database_kw_opt expr",
162135 /* 282 */ "key_opt ::=",
162136 /* 283 */ "key_opt ::= KEY expr",
162137 /* 284 */ "cmd ::= REINDEX",
162138 /* 285 */ "cmd ::= REINDEX nm dbnm",
162139 /* 286 */ "cmd ::= ANALYZE",
162140 /* 287 */ "cmd ::= ANALYZE nm dbnm",
162141 /* 288 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
162142 /* 289 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
162143 /* 290 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
162144 /* 291 */ "add_column_fullname ::= fullname",
162145 /* 292 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
162146 /* 293 */ "cmd ::= create_vtab",
162147 /* 294 */ "cmd ::= create_vtab LP vtabarglist RP",
162148 /* 295 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
162149 /* 296 */ "vtabarg ::=",
162150 /* 297 */ "vtabargtoken ::= ANY",
162151 /* 298 */ "vtabargtoken ::= lp anylist RP",
162152 /* 299 */ "lp ::= LP",
162153 /* 300 */ "with ::= WITH wqlist",
162154 /* 301 */ "with ::= WITH RECURSIVE wqlist",
162155 /* 302 */ "wqas ::= AS",
162156 /* 303 */ "wqas ::= AS MATERIALIZED",
162157 /* 304 */ "wqas ::= AS NOT MATERIALIZED",
162158 /* 305 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
162159 /* 306 */ "wqlist ::= wqitem",
162160 /* 307 */ "wqlist ::= wqlist COMMA wqitem",
162161 /* 308 */ "windowdefn_list ::= windowdefn",
162162 /* 309 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
162163 /* 310 */ "windowdefn ::= nm AS LP window RP",
162164 /* 311 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
162165 /* 312 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
162166 /* 313 */ "window ::= ORDER BY sortlist frame_opt",
162167 /* 314 */ "window ::= nm ORDER BY sortlist frame_opt",
162168 /* 315 */ "window ::= frame_opt",
162169 /* 316 */ "window ::= nm frame_opt",
162170 /* 317 */ "frame_opt ::=",
162171 /* 318 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
162172 /* 319 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
162173 /* 320 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
162174 /* 321 */ "frame_bound_s ::= frame_bound",
162175 /* 322 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
162176 /* 323 */ "frame_bound_e ::= frame_bound",
162177 /* 324 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
162178 /* 325 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
162179 /* 326 */ "frame_bound ::= CURRENT ROW",
162180 /* 327 */ "frame_exclude_opt ::=",
162181 /* 328 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
162182 /* 329 */ "frame_exclude ::= NO OTHERS",
162183 /* 330 */ "frame_exclude ::= CURRENT ROW",
162184 /* 331 */ "frame_exclude ::= GROUP|TIES",
162185 /* 332 */ "window_clause ::= WINDOW windowdefn_list",
162186 /* 333 */ "filter_over ::= filter_clause over_clause",
162187 /* 334 */ "filter_over ::= over_clause",
162188 /* 335 */ "filter_over ::= filter_clause",
162189 /* 336 */ "over_clause ::= OVER LP window RP",
162190 /* 337 */ "over_clause ::= OVER nm",
162191 /* 338 */ "filter_clause ::= FILTER LP WHERE expr RP",
162192 /* 339 */ "input ::= cmdlist",
162193 /* 340 */ "cmdlist ::= cmdlist ecmd",
162194 /* 341 */ "cmdlist ::= ecmd",
162195 /* 342 */ "ecmd ::= SEMI",
162196 /* 343 */ "ecmd ::= cmdx SEMI",
162197 /* 344 */ "ecmd ::= explain cmdx SEMI",
162198 /* 345 */ "trans_opt ::=",
162199 /* 346 */ "trans_opt ::= TRANSACTION",
162200 /* 347 */ "trans_opt ::= TRANSACTION nm",
162201 /* 348 */ "savepoint_opt ::= SAVEPOINT",
162202 /* 349 */ "savepoint_opt ::=",
162203 /* 350 */ "cmd ::= create_table create_table_args",
162204 /* 351 */ "table_option_set ::= table_option",
162205 /* 352 */ "columnlist ::= columnlist COMMA columnname carglist",
162206 /* 353 */ "columnlist ::= columnname carglist",
162207 /* 354 */ "nm ::= ID|INDEXED",
162208 /* 355 */ "nm ::= STRING",
162209 /* 356 */ "nm ::= JOIN_KW",
162210 /* 357 */ "typetoken ::= typename",
162211 /* 358 */ "typename ::= ID|STRING",
162212 /* 359 */ "signed ::= plus_num",
162213 /* 360 */ "signed ::= minus_num",
162214 /* 361 */ "carglist ::= carglist ccons",
162215 /* 362 */ "carglist ::=",
162216 /* 363 */ "ccons ::= NULL onconf",
162217 /* 364 */ "ccons ::= GENERATED ALWAYS AS generated",
162218 /* 365 */ "ccons ::= AS generated",
162219 /* 366 */ "conslist_opt ::= COMMA conslist",
162220 /* 367 */ "conslist ::= conslist tconscomma tcons",
162221 /* 368 */ "conslist ::= tcons",
162222 /* 369 */ "tconscomma ::=",
162223 /* 370 */ "defer_subclause_opt ::= defer_subclause",
162224 /* 371 */ "resolvetype ::= raisetype",
162225 /* 372 */ "selectnowith ::= oneselect",
162226 /* 373 */ "oneselect ::= values",
162227 /* 374 */ "sclp ::= selcollist COMMA",
162228 /* 375 */ "as ::= ID|STRING",
162229 /* 376 */ "returning ::=",
162230 /* 377 */ "expr ::= term",
162231 /* 378 */ "likeop ::= LIKE_KW|MATCH",
162232 /* 379 */ "exprlist ::= nexprlist",
162233 /* 380 */ "nmnum ::= plus_num",
162234 /* 381 */ "nmnum ::= nm",
162235 /* 382 */ "nmnum ::= ON",
162236 /* 383 */ "nmnum ::= DELETE",
162237 /* 384 */ "nmnum ::= DEFAULT",
162238 /* 385 */ "plus_num ::= INTEGER|FLOAT",
162239 /* 386 */ "foreach_clause ::=",
162240 /* 387 */ "foreach_clause ::= FOR EACH ROW",
162241 /* 388 */ "trnm ::= nm",
162242 /* 389 */ "tridxby ::=",
162243 /* 390 */ "database_kw_opt ::= DATABASE",
162244 /* 391 */ "database_kw_opt ::=",
162245 /* 392 */ "kwcolumn_opt ::=",
162246 /* 393 */ "kwcolumn_opt ::= COLUMNKW",
162247 /* 394 */ "vtabarglist ::= vtabarg",
162248 /* 395 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
162249 /* 396 */ "vtabarg ::= vtabarg vtabargtoken",
162250 /* 397 */ "anylist ::=",
162251 /* 398 */ "anylist ::= anylist LP anylist RP",
162252 /* 399 */ "anylist ::= anylist ANY",
162253 /* 400 */ "with ::=",
 
162254 };
162255 #endif /* NDEBUG */
162256
162257
162258 #if YYSTACKDEPTH<=0
@@ -162374,103 +162606,103 @@
162374 ** Note: during a reduce, the only symbols destroyed are those
162375 ** which appear on the RHS of the rule, but which are *not* used
162376 ** inside the C code.
162377 */
162378 /********* Begin destructor definitions ***************************************/
162379 case 203: /* select */
162380 case 238: /* selectnowith */
162381 case 239: /* oneselect */
162382 case 251: /* values */
162383 {
162384 sqlite3SelectDelete(pParse->db, (yypminor->yy303));
162385 }
162386 break;
162387 case 215: /* term */
162388 case 216: /* expr */
162389 case 245: /* where_opt */
162390 case 247: /* having_opt */
162391 case 259: /* on_opt */
162392 case 266: /* where_opt_ret */
162393 case 277: /* case_operand */
162394 case 279: /* case_else */
162395 case 282: /* vinto */
162396 case 289: /* when_clause */
162397 case 294: /* key_opt */
162398 case 310: /* filter_clause */
162399 {
162400 sqlite3ExprDelete(pParse->db, (yypminor->yy626));
162401 }
162402 break;
162403 case 220: /* eidlist_opt */
162404 case 230: /* sortlist */
162405 case 231: /* eidlist */
162406 case 243: /* selcollist */
162407 case 246: /* groupby_opt */
162408 case 248: /* orderby_opt */
162409 case 252: /* nexprlist */
162410 case 253: /* sclp */
162411 case 261: /* exprlist */
162412 case 267: /* setlist */
162413 case 276: /* paren_exprlist */
162414 case 278: /* case_exprlist */
162415 case 309: /* part_opt */
162416 {
162417 sqlite3ExprListDelete(pParse->db, (yypminor->yy562));
162418 }
162419 break;
162420 case 237: /* fullname */
162421 case 244: /* from */
162422 case 255: /* seltablist */
162423 case 256: /* stl_prefix */
162424 case 262: /* xfullname */
162425 {
162426 sqlite3SrcListDelete(pParse->db, (yypminor->yy607));
162427 }
162428 break;
162429 case 240: /* wqlist */
162430 {
162431 sqlite3WithDelete(pParse->db, (yypminor->yy43));
162432 }
162433 break;
162434 case 250: /* window_clause */
162435 case 305: /* windowdefn_list */
162436 {
162437 sqlite3WindowListDelete(pParse->db, (yypminor->yy375));
162438 }
162439 break;
162440 case 260: /* using_opt */
162441 case 263: /* idlist */
162442 case 269: /* idlist_opt */
162443 {
162444 sqlite3IdListDelete(pParse->db, (yypminor->yy240));
162445 }
162446 break;
162447 case 272: /* filter_over */
162448 case 306: /* windowdefn */
162449 case 307: /* window */
162450 case 308: /* frame_opt */
162451 case 311: /* over_clause */
162452 {
162453 sqlite3WindowDelete(pParse->db, (yypminor->yy375));
162454 }
162455 break;
162456 case 285: /* trigger_cmd_list */
162457 case 290: /* trigger_cmd */
162458 {
162459 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy95));
162460 }
162461 break;
162462 case 287: /* trigger_event */
162463 {
162464 sqlite3IdListDelete(pParse->db, (yypminor->yy570).b);
162465 }
162466 break;
162467 case 313: /* frame_bound */
162468 case 314: /* frame_bound_s */
162469 case 315: /* frame_bound_e */
162470 {
162471 sqlite3ExprDelete(pParse->db, (yypminor->yy81).pExpr);
162472 }
162473 break;
162474 /********* End destructor definitions *****************************************/
162475 default: break; /* If no destructor action specified: do nothing */
162476 }
@@ -162757,411 +162989,412 @@
162757 }
162758
162759 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
162760 ** of that rule */
162761 static const YYCODETYPE yyRuleInfoLhs[] = {
162762 188, /* (0) explain ::= EXPLAIN */
162763 188, /* (1) explain ::= EXPLAIN QUERY PLAN */
162764 187, /* (2) cmdx ::= cmd */
162765 189, /* (3) cmd ::= BEGIN transtype trans_opt */
162766 190, /* (4) transtype ::= */
162767 190, /* (5) transtype ::= DEFERRED */
162768 190, /* (6) transtype ::= IMMEDIATE */
162769 190, /* (7) transtype ::= EXCLUSIVE */
162770 189, /* (8) cmd ::= COMMIT|END trans_opt */
162771 189, /* (9) cmd ::= ROLLBACK trans_opt */
162772 189, /* (10) cmd ::= SAVEPOINT nm */
162773 189, /* (11) cmd ::= RELEASE savepoint_opt nm */
162774 189, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
162775 194, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
162776 196, /* (14) createkw ::= CREATE */
162777 198, /* (15) ifnotexists ::= */
162778 198, /* (16) ifnotexists ::= IF NOT EXISTS */
162779 197, /* (17) temp ::= TEMP */
162780 197, /* (18) temp ::= */
162781 195, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
162782 195, /* (20) create_table_args ::= AS select */
162783 202, /* (21) table_option_set ::= */
162784 202, /* (22) table_option_set ::= table_option_set COMMA table_option */
162785 204, /* (23) table_option ::= WITHOUT nm */
162786 204, /* (24) table_option ::= nm */
162787 205, /* (25) columnname ::= nm typetoken */
162788 207, /* (26) typetoken ::= */
162789 207, /* (27) typetoken ::= typename LP signed RP */
162790 207, /* (28) typetoken ::= typename LP signed COMMA signed RP */
162791 208, /* (29) typename ::= typename ID|STRING */
162792 212, /* (30) scanpt ::= */
162793 213, /* (31) scantok ::= */
162794 214, /* (32) ccons ::= CONSTRAINT nm */
162795 214, /* (33) ccons ::= DEFAULT scantok term */
162796 214, /* (34) ccons ::= DEFAULT LP expr RP */
162797 214, /* (35) ccons ::= DEFAULT PLUS scantok term */
162798 214, /* (36) ccons ::= DEFAULT MINUS scantok term */
162799 214, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
162800 214, /* (38) ccons ::= NOT NULL onconf */
162801 214, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
162802 214, /* (40) ccons ::= UNIQUE onconf */
162803 214, /* (41) ccons ::= CHECK LP expr RP */
162804 214, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
162805 214, /* (43) ccons ::= defer_subclause */
162806 214, /* (44) ccons ::= COLLATE ID|STRING */
162807 223, /* (45) generated ::= LP expr RP */
162808 223, /* (46) generated ::= LP expr RP ID */
162809 219, /* (47) autoinc ::= */
162810 219, /* (48) autoinc ::= AUTOINCR */
162811 221, /* (49) refargs ::= */
162812 221, /* (50) refargs ::= refargs refarg */
162813 224, /* (51) refarg ::= MATCH nm */
162814 224, /* (52) refarg ::= ON INSERT refact */
162815 224, /* (53) refarg ::= ON DELETE refact */
162816 224, /* (54) refarg ::= ON UPDATE refact */
162817 225, /* (55) refact ::= SET NULL */
162818 225, /* (56) refact ::= SET DEFAULT */
162819 225, /* (57) refact ::= CASCADE */
162820 225, /* (58) refact ::= RESTRICT */
162821 225, /* (59) refact ::= NO ACTION */
162822 222, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
162823 222, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
162824 226, /* (62) init_deferred_pred_opt ::= */
162825 226, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
162826 226, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
162827 201, /* (65) conslist_opt ::= */
162828 228, /* (66) tconscomma ::= COMMA */
162829 229, /* (67) tcons ::= CONSTRAINT nm */
162830 229, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
162831 229, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
162832 229, /* (70) tcons ::= CHECK LP expr RP onconf */
162833 229, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
162834 232, /* (72) defer_subclause_opt ::= */
162835 217, /* (73) onconf ::= */
162836 217, /* (74) onconf ::= ON CONFLICT resolvetype */
162837 233, /* (75) orconf ::= */
162838 233, /* (76) orconf ::= OR resolvetype */
162839 234, /* (77) resolvetype ::= IGNORE */
162840 234, /* (78) resolvetype ::= REPLACE */
162841 189, /* (79) cmd ::= DROP TABLE ifexists fullname */
162842 236, /* (80) ifexists ::= IF EXISTS */
162843 236, /* (81) ifexists ::= */
162844 189, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
162845 189, /* (83) cmd ::= DROP VIEW ifexists fullname */
162846 189, /* (84) cmd ::= select */
162847 203, /* (85) select ::= WITH wqlist selectnowith */
162848 203, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
162849 203, /* (87) select ::= selectnowith */
162850 238, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
162851 241, /* (89) multiselect_op ::= UNION */
162852 241, /* (90) multiselect_op ::= UNION ALL */
162853 241, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
162854 239, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
162855 239, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
162856 251, /* (94) values ::= VALUES LP nexprlist RP */
162857 251, /* (95) values ::= values COMMA LP nexprlist RP */
162858 242, /* (96) distinct ::= DISTINCT */
162859 242, /* (97) distinct ::= ALL */
162860 242, /* (98) distinct ::= */
162861 253, /* (99) sclp ::= */
162862 243, /* (100) selcollist ::= sclp scanpt expr scanpt as */
162863 243, /* (101) selcollist ::= sclp scanpt STAR */
162864 243, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
162865 254, /* (103) as ::= AS nm */
162866 254, /* (104) as ::= */
162867 244, /* (105) from ::= */
162868 244, /* (106) from ::= FROM seltablist */
162869 256, /* (107) stl_prefix ::= seltablist joinop */
162870 256, /* (108) stl_prefix ::= */
162871 255, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
162872 255, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
162873 255, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
162874 255, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
162875 199, /* (113) dbnm ::= */
162876 199, /* (114) dbnm ::= DOT nm */
162877 237, /* (115) fullname ::= nm */
162878 237, /* (116) fullname ::= nm DOT nm */
162879 262, /* (117) xfullname ::= nm */
162880 262, /* (118) xfullname ::= nm DOT nm */
162881 262, /* (119) xfullname ::= nm DOT nm AS nm */
162882 262, /* (120) xfullname ::= nm AS nm */
162883 257, /* (121) joinop ::= COMMA|JOIN */
162884 257, /* (122) joinop ::= JOIN_KW JOIN */
162885 257, /* (123) joinop ::= JOIN_KW nm JOIN */
162886 257, /* (124) joinop ::= JOIN_KW nm nm JOIN */
162887 259, /* (125) on_opt ::= ON expr */
162888 259, /* (126) on_opt ::= */
162889 258, /* (127) indexed_opt ::= */
162890 258, /* (128) indexed_opt ::= INDEXED BY nm */
162891 258, /* (129) indexed_opt ::= NOT INDEXED */
162892 260, /* (130) using_opt ::= USING LP idlist RP */
162893 260, /* (131) using_opt ::= */
162894 248, /* (132) orderby_opt ::= */
162895 248, /* (133) orderby_opt ::= ORDER BY sortlist */
162896 230, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
162897 230, /* (135) sortlist ::= expr sortorder nulls */
162898 218, /* (136) sortorder ::= ASC */
162899 218, /* (137) sortorder ::= DESC */
162900 218, /* (138) sortorder ::= */
162901 264, /* (139) nulls ::= NULLS FIRST */
162902 264, /* (140) nulls ::= NULLS LAST */
162903 264, /* (141) nulls ::= */
162904 246, /* (142) groupby_opt ::= */
162905 246, /* (143) groupby_opt ::= GROUP BY nexprlist */
162906 247, /* (144) having_opt ::= */
162907 247, /* (145) having_opt ::= HAVING expr */
162908 249, /* (146) limit_opt ::= */
162909 249, /* (147) limit_opt ::= LIMIT expr */
162910 249, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
162911 249, /* (149) limit_opt ::= LIMIT expr COMMA expr */
162912 189, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
162913 245, /* (151) where_opt ::= */
162914 245, /* (152) where_opt ::= WHERE expr */
162915 266, /* (153) where_opt_ret ::= */
162916 266, /* (154) where_opt_ret ::= WHERE expr */
162917 266, /* (155) where_opt_ret ::= RETURNING selcollist */
162918 266, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
162919 189, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
162920 267, /* (158) setlist ::= setlist COMMA nm EQ expr */
162921 267, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
162922 267, /* (160) setlist ::= nm EQ expr */
162923 267, /* (161) setlist ::= LP idlist RP EQ expr */
162924 189, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
162925 189, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
162926 270, /* (164) upsert ::= */
162927 270, /* (165) upsert ::= RETURNING selcollist */
162928 270, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
162929 270, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
162930 270, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
162931 270, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
162932 271, /* (170) returning ::= RETURNING selcollist */
162933 268, /* (171) insert_cmd ::= INSERT orconf */
162934 268, /* (172) insert_cmd ::= REPLACE */
162935 269, /* (173) idlist_opt ::= */
162936 269, /* (174) idlist_opt ::= LP idlist RP */
162937 263, /* (175) idlist ::= idlist COMMA nm */
162938 263, /* (176) idlist ::= nm */
162939 216, /* (177) expr ::= LP expr RP */
162940 216, /* (178) expr ::= ID|INDEXED */
162941 216, /* (179) expr ::= JOIN_KW */
162942 216, /* (180) expr ::= nm DOT nm */
162943 216, /* (181) expr ::= nm DOT nm DOT nm */
162944 215, /* (182) term ::= NULL|FLOAT|BLOB */
162945 215, /* (183) term ::= STRING */
162946 215, /* (184) term ::= INTEGER */
162947 216, /* (185) expr ::= VARIABLE */
162948 216, /* (186) expr ::= expr COLLATE ID|STRING */
162949 216, /* (187) expr ::= CAST LP expr AS typetoken RP */
162950 216, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
162951 216, /* (189) expr ::= ID|INDEXED LP STAR RP */
162952 216, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
162953 216, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
162954 215, /* (192) term ::= CTIME_KW */
162955 216, /* (193) expr ::= LP nexprlist COMMA expr RP */
162956 216, /* (194) expr ::= expr AND expr */
162957 216, /* (195) expr ::= expr OR expr */
162958 216, /* (196) expr ::= expr LT|GT|GE|LE expr */
162959 216, /* (197) expr ::= expr EQ|NE expr */
162960 216, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
162961 216, /* (199) expr ::= expr PLUS|MINUS expr */
162962 216, /* (200) expr ::= expr STAR|SLASH|REM expr */
162963 216, /* (201) expr ::= expr CONCAT expr */
162964 273, /* (202) likeop ::= NOT LIKE_KW|MATCH */
162965 216, /* (203) expr ::= expr likeop expr */
162966 216, /* (204) expr ::= expr likeop expr ESCAPE expr */
162967 216, /* (205) expr ::= expr ISNULL|NOTNULL */
162968 216, /* (206) expr ::= expr NOT NULL */
162969 216, /* (207) expr ::= expr IS expr */
162970 216, /* (208) expr ::= expr IS NOT expr */
162971 216, /* (209) expr ::= NOT expr */
162972 216, /* (210) expr ::= BITNOT expr */
162973 216, /* (211) expr ::= PLUS|MINUS expr */
162974 274, /* (212) between_op ::= BETWEEN */
162975 274, /* (213) between_op ::= NOT BETWEEN */
162976 216, /* (214) expr ::= expr between_op expr AND expr */
162977 275, /* (215) in_op ::= IN */
162978 275, /* (216) in_op ::= NOT IN */
162979 216, /* (217) expr ::= expr in_op LP exprlist RP */
162980 216, /* (218) expr ::= LP select RP */
162981 216, /* (219) expr ::= expr in_op LP select RP */
162982 216, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */
162983 216, /* (221) expr ::= EXISTS LP select RP */
162984 216, /* (222) expr ::= CASE case_operand case_exprlist case_else END */
162985 278, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */
162986 278, /* (224) case_exprlist ::= WHEN expr THEN expr */
162987 279, /* (225) case_else ::= ELSE expr */
162988 279, /* (226) case_else ::= */
162989 277, /* (227) case_operand ::= expr */
162990 277, /* (228) case_operand ::= */
162991 261, /* (229) exprlist ::= */
162992 252, /* (230) nexprlist ::= nexprlist COMMA expr */
162993 252, /* (231) nexprlist ::= expr */
162994 276, /* (232) paren_exprlist ::= */
162995 276, /* (233) paren_exprlist ::= LP exprlist RP */
162996 189, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
162997 280, /* (235) uniqueflag ::= UNIQUE */
162998 280, /* (236) uniqueflag ::= */
162999 220, /* (237) eidlist_opt ::= */
163000 220, /* (238) eidlist_opt ::= LP eidlist RP */
163001 231, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */
163002 231, /* (240) eidlist ::= nm collate sortorder */
163003 281, /* (241) collate ::= */
163004 281, /* (242) collate ::= COLLATE ID|STRING */
163005 189, /* (243) cmd ::= DROP INDEX ifexists fullname */
163006 189, /* (244) cmd ::= VACUUM vinto */
163007 189, /* (245) cmd ::= VACUUM nm vinto */
163008 282, /* (246) vinto ::= INTO expr */
163009 282, /* (247) vinto ::= */
163010 189, /* (248) cmd ::= PRAGMA nm dbnm */
163011 189, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */
163012 189, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163013 189, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */
163014 189, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163015 210, /* (253) plus_num ::= PLUS INTEGER|FLOAT */
163016 211, /* (254) minus_num ::= MINUS INTEGER|FLOAT */
163017 189, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163018 284, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163019 286, /* (257) trigger_time ::= BEFORE|AFTER */
163020 286, /* (258) trigger_time ::= INSTEAD OF */
163021 286, /* (259) trigger_time ::= */
163022 287, /* (260) trigger_event ::= DELETE|INSERT */
163023 287, /* (261) trigger_event ::= UPDATE */
163024 287, /* (262) trigger_event ::= UPDATE OF idlist */
163025 289, /* (263) when_clause ::= */
163026 289, /* (264) when_clause ::= WHEN expr */
163027 285, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163028 285, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */
163029 291, /* (267) trnm ::= nm DOT nm */
163030 292, /* (268) tridxby ::= INDEXED BY nm */
163031 292, /* (269) tridxby ::= NOT INDEXED */
163032 290, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163033 290, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163034 290, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163035 290, /* (273) trigger_cmd ::= scanpt select scanpt */
163036 216, /* (274) expr ::= RAISE LP IGNORE RP */
163037 216, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */
163038 235, /* (276) raisetype ::= ROLLBACK */
163039 235, /* (277) raisetype ::= ABORT */
163040 235, /* (278) raisetype ::= FAIL */
163041 189, /* (279) cmd ::= DROP TRIGGER ifexists fullname */
163042 189, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163043 189, /* (281) cmd ::= DETACH database_kw_opt expr */
163044 294, /* (282) key_opt ::= */
163045 294, /* (283) key_opt ::= KEY expr */
163046 189, /* (284) cmd ::= REINDEX */
163047 189, /* (285) cmd ::= REINDEX nm dbnm */
163048 189, /* (286) cmd ::= ANALYZE */
163049 189, /* (287) cmd ::= ANALYZE nm dbnm */
163050 189, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */
163051 189, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163052 189, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163053 295, /* (291) add_column_fullname ::= fullname */
163054 189, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163055 189, /* (293) cmd ::= create_vtab */
163056 189, /* (294) cmd ::= create_vtab LP vtabarglist RP */
163057 297, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163058 299, /* (296) vtabarg ::= */
163059 300, /* (297) vtabargtoken ::= ANY */
163060 300, /* (298) vtabargtoken ::= lp anylist RP */
163061 301, /* (299) lp ::= LP */
163062 265, /* (300) with ::= WITH wqlist */
163063 265, /* (301) with ::= WITH RECURSIVE wqlist */
163064 304, /* (302) wqas ::= AS */
163065 304, /* (303) wqas ::= AS MATERIALIZED */
163066 304, /* (304) wqas ::= AS NOT MATERIALIZED */
163067 303, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */
163068 240, /* (306) wqlist ::= wqitem */
163069 240, /* (307) wqlist ::= wqlist COMMA wqitem */
163070 305, /* (308) windowdefn_list ::= windowdefn */
163071 305, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163072 306, /* (310) windowdefn ::= nm AS LP window RP */
163073 307, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163074 307, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163075 307, /* (313) window ::= ORDER BY sortlist frame_opt */
163076 307, /* (314) window ::= nm ORDER BY sortlist frame_opt */
163077 307, /* (315) window ::= frame_opt */
163078 307, /* (316) window ::= nm frame_opt */
163079 308, /* (317) frame_opt ::= */
163080 308, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163081 308, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163082 312, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */
163083 314, /* (321) frame_bound_s ::= frame_bound */
163084 314, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */
163085 315, /* (323) frame_bound_e ::= frame_bound */
163086 315, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */
163087 313, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */
163088 313, /* (326) frame_bound ::= CURRENT ROW */
163089 316, /* (327) frame_exclude_opt ::= */
163090 316, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */
163091 317, /* (329) frame_exclude ::= NO OTHERS */
163092 317, /* (330) frame_exclude ::= CURRENT ROW */
163093 317, /* (331) frame_exclude ::= GROUP|TIES */
163094 250, /* (332) window_clause ::= WINDOW windowdefn_list */
163095 272, /* (333) filter_over ::= filter_clause over_clause */
163096 272, /* (334) filter_over ::= over_clause */
163097 272, /* (335) filter_over ::= filter_clause */
163098 311, /* (336) over_clause ::= OVER LP window RP */
163099 311, /* (337) over_clause ::= OVER nm */
163100 310, /* (338) filter_clause ::= FILTER LP WHERE expr RP */
163101 184, /* (339) input ::= cmdlist */
163102 185, /* (340) cmdlist ::= cmdlist ecmd */
163103 185, /* (341) cmdlist ::= ecmd */
163104 186, /* (342) ecmd ::= SEMI */
163105 186, /* (343) ecmd ::= cmdx SEMI */
163106 186, /* (344) ecmd ::= explain cmdx SEMI */
163107 191, /* (345) trans_opt ::= */
163108 191, /* (346) trans_opt ::= TRANSACTION */
163109 191, /* (347) trans_opt ::= TRANSACTION nm */
163110 193, /* (348) savepoint_opt ::= SAVEPOINT */
163111 193, /* (349) savepoint_opt ::= */
163112 189, /* (350) cmd ::= create_table create_table_args */
163113 202, /* (351) table_option_set ::= table_option */
163114 200, /* (352) columnlist ::= columnlist COMMA columnname carglist */
163115 200, /* (353) columnlist ::= columnname carglist */
163116 192, /* (354) nm ::= ID|INDEXED */
163117 192, /* (355) nm ::= STRING */
163118 192, /* (356) nm ::= JOIN_KW */
163119 207, /* (357) typetoken ::= typename */
163120 208, /* (358) typename ::= ID|STRING */
163121 209, /* (359) signed ::= plus_num */
163122 209, /* (360) signed ::= minus_num */
163123 206, /* (361) carglist ::= carglist ccons */
163124 206, /* (362) carglist ::= */
163125 214, /* (363) ccons ::= NULL onconf */
163126 214, /* (364) ccons ::= GENERATED ALWAYS AS generated */
163127 214, /* (365) ccons ::= AS generated */
163128 201, /* (366) conslist_opt ::= COMMA conslist */
163129 227, /* (367) conslist ::= conslist tconscomma tcons */
163130 227, /* (368) conslist ::= tcons */
163131 228, /* (369) tconscomma ::= */
163132 232, /* (370) defer_subclause_opt ::= defer_subclause */
163133 234, /* (371) resolvetype ::= raisetype */
163134 238, /* (372) selectnowith ::= oneselect */
163135 239, /* (373) oneselect ::= values */
163136 253, /* (374) sclp ::= selcollist COMMA */
163137 254, /* (375) as ::= ID|STRING */
163138 271, /* (376) returning ::= */
163139 216, /* (377) expr ::= term */
163140 273, /* (378) likeop ::= LIKE_KW|MATCH */
163141 261, /* (379) exprlist ::= nexprlist */
163142 283, /* (380) nmnum ::= plus_num */
163143 283, /* (381) nmnum ::= nm */
163144 283, /* (382) nmnum ::= ON */
163145 283, /* (383) nmnum ::= DELETE */
163146 283, /* (384) nmnum ::= DEFAULT */
163147 210, /* (385) plus_num ::= INTEGER|FLOAT */
163148 288, /* (386) foreach_clause ::= */
163149 288, /* (387) foreach_clause ::= FOR EACH ROW */
163150 291, /* (388) trnm ::= nm */
163151 292, /* (389) tridxby ::= */
163152 293, /* (390) database_kw_opt ::= DATABASE */
163153 293, /* (391) database_kw_opt ::= */
163154 296, /* (392) kwcolumn_opt ::= */
163155 296, /* (393) kwcolumn_opt ::= COLUMNKW */
163156 298, /* (394) vtabarglist ::= vtabarg */
163157 298, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */
163158 299, /* (396) vtabarg ::= vtabarg vtabargtoken */
163159 302, /* (397) anylist ::= */
163160 302, /* (398) anylist ::= anylist LP anylist RP */
163161 302, /* (399) anylist ::= anylist ANY */
163162 265, /* (400) with ::= */
 
163163 };
163164
163165 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
163166 ** of symbols on the right-hand side of that rule. */
163167 static const signed char yyRuleInfoNRhs[] = {
@@ -163375,199 +163608,200 @@
163375 -3, /* (207) expr ::= expr IS expr */
163376 -4, /* (208) expr ::= expr IS NOT expr */
163377 -2, /* (209) expr ::= NOT expr */
163378 -2, /* (210) expr ::= BITNOT expr */
163379 -2, /* (211) expr ::= PLUS|MINUS expr */
163380 -1, /* (212) between_op ::= BETWEEN */
163381 -2, /* (213) between_op ::= NOT BETWEEN */
163382 -5, /* (214) expr ::= expr between_op expr AND expr */
163383 -1, /* (215) in_op ::= IN */
163384 -2, /* (216) in_op ::= NOT IN */
163385 -5, /* (217) expr ::= expr in_op LP exprlist RP */
163386 -3, /* (218) expr ::= LP select RP */
163387 -5, /* (219) expr ::= expr in_op LP select RP */
163388 -5, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */
163389 -4, /* (221) expr ::= EXISTS LP select RP */
163390 -5, /* (222) expr ::= CASE case_operand case_exprlist case_else END */
163391 -5, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163392 -4, /* (224) case_exprlist ::= WHEN expr THEN expr */
163393 -2, /* (225) case_else ::= ELSE expr */
163394 0, /* (226) case_else ::= */
163395 -1, /* (227) case_operand ::= expr */
163396 0, /* (228) case_operand ::= */
163397 0, /* (229) exprlist ::= */
163398 -3, /* (230) nexprlist ::= nexprlist COMMA expr */
163399 -1, /* (231) nexprlist ::= expr */
163400 0, /* (232) paren_exprlist ::= */
163401 -3, /* (233) paren_exprlist ::= LP exprlist RP */
163402 -12, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163403 -1, /* (235) uniqueflag ::= UNIQUE */
163404 0, /* (236) uniqueflag ::= */
163405 0, /* (237) eidlist_opt ::= */
163406 -3, /* (238) eidlist_opt ::= LP eidlist RP */
163407 -5, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */
163408 -3, /* (240) eidlist ::= nm collate sortorder */
163409 0, /* (241) collate ::= */
163410 -2, /* (242) collate ::= COLLATE ID|STRING */
163411 -4, /* (243) cmd ::= DROP INDEX ifexists fullname */
163412 -2, /* (244) cmd ::= VACUUM vinto */
163413 -3, /* (245) cmd ::= VACUUM nm vinto */
163414 -2, /* (246) vinto ::= INTO expr */
163415 0, /* (247) vinto ::= */
163416 -3, /* (248) cmd ::= PRAGMA nm dbnm */
163417 -5, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */
163418 -6, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163419 -5, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */
163420 -6, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163421 -2, /* (253) plus_num ::= PLUS INTEGER|FLOAT */
163422 -2, /* (254) minus_num ::= MINUS INTEGER|FLOAT */
163423 -5, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163424 -11, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163425 -1, /* (257) trigger_time ::= BEFORE|AFTER */
163426 -2, /* (258) trigger_time ::= INSTEAD OF */
163427 0, /* (259) trigger_time ::= */
163428 -1, /* (260) trigger_event ::= DELETE|INSERT */
163429 -1, /* (261) trigger_event ::= UPDATE */
163430 -3, /* (262) trigger_event ::= UPDATE OF idlist */
163431 0, /* (263) when_clause ::= */
163432 -2, /* (264) when_clause ::= WHEN expr */
163433 -3, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163434 -2, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */
163435 -3, /* (267) trnm ::= nm DOT nm */
163436 -3, /* (268) tridxby ::= INDEXED BY nm */
163437 -2, /* (269) tridxby ::= NOT INDEXED */
163438 -9, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163439 -8, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163440 -6, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163441 -3, /* (273) trigger_cmd ::= scanpt select scanpt */
163442 -4, /* (274) expr ::= RAISE LP IGNORE RP */
163443 -6, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */
163444 -1, /* (276) raisetype ::= ROLLBACK */
163445 -1, /* (277) raisetype ::= ABORT */
163446 -1, /* (278) raisetype ::= FAIL */
163447 -4, /* (279) cmd ::= DROP TRIGGER ifexists fullname */
163448 -6, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163449 -3, /* (281) cmd ::= DETACH database_kw_opt expr */
163450 0, /* (282) key_opt ::= */
163451 -2, /* (283) key_opt ::= KEY expr */
163452 -1, /* (284) cmd ::= REINDEX */
163453 -3, /* (285) cmd ::= REINDEX nm dbnm */
163454 -1, /* (286) cmd ::= ANALYZE */
163455 -3, /* (287) cmd ::= ANALYZE nm dbnm */
163456 -6, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */
163457 -7, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163458 -6, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163459 -1, /* (291) add_column_fullname ::= fullname */
163460 -8, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163461 -1, /* (293) cmd ::= create_vtab */
163462 -4, /* (294) cmd ::= create_vtab LP vtabarglist RP */
163463 -8, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163464 0, /* (296) vtabarg ::= */
163465 -1, /* (297) vtabargtoken ::= ANY */
163466 -3, /* (298) vtabargtoken ::= lp anylist RP */
163467 -1, /* (299) lp ::= LP */
163468 -2, /* (300) with ::= WITH wqlist */
163469 -3, /* (301) with ::= WITH RECURSIVE wqlist */
163470 -1, /* (302) wqas ::= AS */
163471 -2, /* (303) wqas ::= AS MATERIALIZED */
163472 -3, /* (304) wqas ::= AS NOT MATERIALIZED */
163473 -6, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */
163474 -1, /* (306) wqlist ::= wqitem */
163475 -3, /* (307) wqlist ::= wqlist COMMA wqitem */
163476 -1, /* (308) windowdefn_list ::= windowdefn */
163477 -3, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163478 -5, /* (310) windowdefn ::= nm AS LP window RP */
163479 -5, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163480 -6, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163481 -4, /* (313) window ::= ORDER BY sortlist frame_opt */
163482 -5, /* (314) window ::= nm ORDER BY sortlist frame_opt */
163483 -1, /* (315) window ::= frame_opt */
163484 -2, /* (316) window ::= nm frame_opt */
163485 0, /* (317) frame_opt ::= */
163486 -3, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163487 -6, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163488 -1, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */
163489 -1, /* (321) frame_bound_s ::= frame_bound */
163490 -2, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */
163491 -1, /* (323) frame_bound_e ::= frame_bound */
163492 -2, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */
163493 -2, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */
163494 -2, /* (326) frame_bound ::= CURRENT ROW */
163495 0, /* (327) frame_exclude_opt ::= */
163496 -2, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */
163497 -2, /* (329) frame_exclude ::= NO OTHERS */
163498 -2, /* (330) frame_exclude ::= CURRENT ROW */
163499 -1, /* (331) frame_exclude ::= GROUP|TIES */
163500 -2, /* (332) window_clause ::= WINDOW windowdefn_list */
163501 -2, /* (333) filter_over ::= filter_clause over_clause */
163502 -1, /* (334) filter_over ::= over_clause */
163503 -1, /* (335) filter_over ::= filter_clause */
163504 -4, /* (336) over_clause ::= OVER LP window RP */
163505 -2, /* (337) over_clause ::= OVER nm */
163506 -5, /* (338) filter_clause ::= FILTER LP WHERE expr RP */
163507 -1, /* (339) input ::= cmdlist */
163508 -2, /* (340) cmdlist ::= cmdlist ecmd */
163509 -1, /* (341) cmdlist ::= ecmd */
163510 -1, /* (342) ecmd ::= SEMI */
163511 -2, /* (343) ecmd ::= cmdx SEMI */
163512 -3, /* (344) ecmd ::= explain cmdx SEMI */
163513 0, /* (345) trans_opt ::= */
163514 -1, /* (346) trans_opt ::= TRANSACTION */
163515 -2, /* (347) trans_opt ::= TRANSACTION nm */
163516 -1, /* (348) savepoint_opt ::= SAVEPOINT */
163517 0, /* (349) savepoint_opt ::= */
163518 -2, /* (350) cmd ::= create_table create_table_args */
163519 -1, /* (351) table_option_set ::= table_option */
163520 -4, /* (352) columnlist ::= columnlist COMMA columnname carglist */
163521 -2, /* (353) columnlist ::= columnname carglist */
163522 -1, /* (354) nm ::= ID|INDEXED */
163523 -1, /* (355) nm ::= STRING */
163524 -1, /* (356) nm ::= JOIN_KW */
163525 -1, /* (357) typetoken ::= typename */
163526 -1, /* (358) typename ::= ID|STRING */
163527 -1, /* (359) signed ::= plus_num */
163528 -1, /* (360) signed ::= minus_num */
163529 -2, /* (361) carglist ::= carglist ccons */
163530 0, /* (362) carglist ::= */
163531 -2, /* (363) ccons ::= NULL onconf */
163532 -4, /* (364) ccons ::= GENERATED ALWAYS AS generated */
163533 -2, /* (365) ccons ::= AS generated */
163534 -2, /* (366) conslist_opt ::= COMMA conslist */
163535 -3, /* (367) conslist ::= conslist tconscomma tcons */
163536 -1, /* (368) conslist ::= tcons */
163537 0, /* (369) tconscomma ::= */
163538 -1, /* (370) defer_subclause_opt ::= defer_subclause */
163539 -1, /* (371) resolvetype ::= raisetype */
163540 -1, /* (372) selectnowith ::= oneselect */
163541 -1, /* (373) oneselect ::= values */
163542 -2, /* (374) sclp ::= selcollist COMMA */
163543 -1, /* (375) as ::= ID|STRING */
163544 0, /* (376) returning ::= */
163545 -1, /* (377) expr ::= term */
163546 -1, /* (378) likeop ::= LIKE_KW|MATCH */
163547 -1, /* (379) exprlist ::= nexprlist */
163548 -1, /* (380) nmnum ::= plus_num */
163549 -1, /* (381) nmnum ::= nm */
163550 -1, /* (382) nmnum ::= ON */
163551 -1, /* (383) nmnum ::= DELETE */
163552 -1, /* (384) nmnum ::= DEFAULT */
163553 -1, /* (385) plus_num ::= INTEGER|FLOAT */
163554 0, /* (386) foreach_clause ::= */
163555 -3, /* (387) foreach_clause ::= FOR EACH ROW */
163556 -1, /* (388) trnm ::= nm */
163557 0, /* (389) tridxby ::= */
163558 -1, /* (390) database_kw_opt ::= DATABASE */
163559 0, /* (391) database_kw_opt ::= */
163560 0, /* (392) kwcolumn_opt ::= */
163561 -1, /* (393) kwcolumn_opt ::= COLUMNKW */
163562 -1, /* (394) vtabarglist ::= vtabarg */
163563 -3, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */
163564 -2, /* (396) vtabarg ::= vtabarg vtabargtoken */
163565 0, /* (397) anylist ::= */
163566 -4, /* (398) anylist ::= anylist LP anylist RP */
163567 -2, /* (399) anylist ::= anylist ANY */
163568 0, /* (400) with ::= */
 
163569 };
163570
163571 static void yy_accept(yyParser*); /* Forward Declaration */
163572
163573 /*
@@ -163615,20 +163849,20 @@
163615 break;
163616 case 2: /* cmdx ::= cmd */
163617 { sqlite3FinishCoding(pParse); }
163618 break;
163619 case 3: /* cmd ::= BEGIN transtype trans_opt */
163620 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy64);}
163621 break;
163622 case 4: /* transtype ::= */
163623 {yymsp[1].minor.yy64 = TK_DEFERRED;}
163624 break;
163625 case 5: /* transtype ::= DEFERRED */
163626 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
163627 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
163628 case 320: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==320);
163629 {yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/}
163630 break;
163631 case 8: /* cmd ::= COMMIT|END trans_opt */
163632 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
163633 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
163634 break;
@@ -163647,11 +163881,11 @@
163647 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
163648 }
163649 break;
163650 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
163651 {
163652 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy64,0,0,yymsp[-2].minor.yy64);
163653 }
163654 break;
163655 case 14: /* createkw ::= CREATE */
163656 {disableLookaside(pParse);}
163657 break;
@@ -163660,57 +163894,57 @@
163660 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
163661 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
163662 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
163663 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
163664 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
163665 case 241: /* collate ::= */ yytestcase(yyruleno==241);
163666 {yymsp[1].minor.yy64 = 0;}
163667 break;
163668 case 16: /* ifnotexists ::= IF NOT EXISTS */
163669 {yymsp[-2].minor.yy64 = 1;}
163670 break;
163671 case 17: /* temp ::= TEMP */
163672 {yymsp[0].minor.yy64 = pParse->db->init.busy==0;}
163673 break;
163674 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
163675 {
163676 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy51,0);
163677 }
163678 break;
163679 case 20: /* create_table_args ::= AS select */
163680 {
163681 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy303);
163682 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303);
163683 }
163684 break;
163685 case 21: /* table_option_set ::= */
163686 {yymsp[1].minor.yy51 = 0;}
163687 break;
163688 case 22: /* table_option_set ::= table_option_set COMMA table_option */
163689 {yylhsminor.yy51 = yymsp[-2].minor.yy51|yymsp[0].minor.yy51;}
163690 yymsp[-2].minor.yy51 = yylhsminor.yy51;
163691 break;
163692 case 23: /* table_option ::= WITHOUT nm */
163693 {
163694 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
163695 yymsp[-1].minor.yy51 = TF_WithoutRowid | TF_NoVisibleRowid;
163696 }else{
163697 yymsp[-1].minor.yy51 = 0;
163698 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163699 }
163700 }
163701 break;
163702 case 24: /* table_option ::= nm */
163703 {
163704 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
163705 yylhsminor.yy51 = TF_Strict;
163706 }else{
163707 yylhsminor.yy51 = 0;
163708 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163709 }
163710 }
163711 yymsp[0].minor.yy51 = yylhsminor.yy51;
163712 break;
163713 case 25: /* columnname ::= nm typetoken */
163714 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
163715 break;
163716 case 26: /* typetoken ::= */
@@ -163732,11 +163966,11 @@
163732 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
163733 break;
163734 case 30: /* scanpt ::= */
163735 {
163736 assert( yyLookahead!=YYNOCODE );
163737 yymsp[1].minor.yy600 = yyLookaheadToken.z;
163738 }
163739 break;
163740 case 31: /* scantok ::= */
163741 {
163742 assert( yyLookahead!=YYNOCODE );
@@ -163746,21 +163980,21 @@
163746 case 32: /* ccons ::= CONSTRAINT nm */
163747 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
163748 {pParse->constraintName = yymsp[0].minor.yy0;}
163749 break;
163750 case 33: /* ccons ::= DEFAULT scantok term */
163751 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163752 break;
163753 case 34: /* ccons ::= DEFAULT LP expr RP */
163754 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
163755 break;
163756 case 35: /* ccons ::= DEFAULT PLUS scantok term */
163757 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163758 break;
163759 case 36: /* ccons ::= DEFAULT MINUS scantok term */
163760 {
163761 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy626, 0);
163762 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
163763 }
163764 break;
163765 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
163766 {
@@ -163771,308 +164005,308 @@
163771 }
163772 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
163773 }
163774 break;
163775 case 38: /* ccons ::= NOT NULL onconf */
163776 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy64);}
163777 break;
163778 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
163779 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy64,yymsp[0].minor.yy64,yymsp[-2].minor.yy64);}
163780 break;
163781 case 40: /* ccons ::= UNIQUE onconf */
163782 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy64,0,0,0,0,
163783 SQLITE_IDXTYPE_UNIQUE);}
163784 break;
163785 case 41: /* ccons ::= CHECK LP expr RP */
163786 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
163787 break;
163788 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
163789 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy562,yymsp[0].minor.yy64);}
163790 break;
163791 case 43: /* ccons ::= defer_subclause */
163792 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy64);}
163793 break;
163794 case 44: /* ccons ::= COLLATE ID|STRING */
163795 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
163796 break;
163797 case 45: /* generated ::= LP expr RP */
163798 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy626,0);}
163799 break;
163800 case 46: /* generated ::= LP expr RP ID */
163801 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy626,&yymsp[0].minor.yy0);}
163802 break;
163803 case 48: /* autoinc ::= AUTOINCR */
163804 {yymsp[0].minor.yy64 = 1;}
163805 break;
163806 case 49: /* refargs ::= */
163807 { yymsp[1].minor.yy64 = OE_None*0x0101; /* EV: R-19803-45884 */}
163808 break;
163809 case 50: /* refargs ::= refargs refarg */
163810 { yymsp[-1].minor.yy64 = (yymsp[-1].minor.yy64 & ~yymsp[0].minor.yy83.mask) | yymsp[0].minor.yy83.value; }
163811 break;
163812 case 51: /* refarg ::= MATCH nm */
163813 { yymsp[-1].minor.yy83.value = 0; yymsp[-1].minor.yy83.mask = 0x000000; }
163814 break;
163815 case 52: /* refarg ::= ON INSERT refact */
163816 { yymsp[-2].minor.yy83.value = 0; yymsp[-2].minor.yy83.mask = 0x000000; }
163817 break;
163818 case 53: /* refarg ::= ON DELETE refact */
163819 { yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64; yymsp[-2].minor.yy83.mask = 0x0000ff; }
163820 break;
163821 case 54: /* refarg ::= ON UPDATE refact */
163822 { yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64<<8; yymsp[-2].minor.yy83.mask = 0x00ff00; }
163823 break;
163824 case 55: /* refact ::= SET NULL */
163825 { yymsp[-1].minor.yy64 = OE_SetNull; /* EV: R-33326-45252 */}
163826 break;
163827 case 56: /* refact ::= SET DEFAULT */
163828 { yymsp[-1].minor.yy64 = OE_SetDflt; /* EV: R-33326-45252 */}
163829 break;
163830 case 57: /* refact ::= CASCADE */
163831 { yymsp[0].minor.yy64 = OE_Cascade; /* EV: R-33326-45252 */}
163832 break;
163833 case 58: /* refact ::= RESTRICT */
163834 { yymsp[0].minor.yy64 = OE_Restrict; /* EV: R-33326-45252 */}
163835 break;
163836 case 59: /* refact ::= NO ACTION */
163837 { yymsp[-1].minor.yy64 = OE_None; /* EV: R-33326-45252 */}
163838 break;
163839 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
163840 {yymsp[-2].minor.yy64 = 0;}
163841 break;
163842 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
163843 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
163844 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
163845 {yymsp[-1].minor.yy64 = yymsp[0].minor.yy64;}
163846 break;
163847 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
163848 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
163849 case 213: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==213);
163850 case 216: /* in_op ::= NOT IN */ yytestcase(yyruleno==216);
163851 case 242: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==242);
163852 {yymsp[-1].minor.yy64 = 1;}
163853 break;
163854 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
163855 {yymsp[-1].minor.yy64 = 0;}
163856 break;
163857 case 66: /* tconscomma ::= COMMA */
163858 {pParse->constraintName.n = 0;}
163859 break;
163860 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
163861 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy562,yymsp[0].minor.yy64,yymsp[-2].minor.yy64,0);}
163862 break;
163863 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
163864 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy562,yymsp[0].minor.yy64,0,0,0,0,
163865 SQLITE_IDXTYPE_UNIQUE);}
163866 break;
163867 case 70: /* tcons ::= CHECK LP expr RP onconf */
163868 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy626,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
163869 break;
163870 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
163871 {
163872 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy562, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[-1].minor.yy64);
163873 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy64);
163874 }
163875 break;
163876 case 73: /* onconf ::= */
163877 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
163878 {yymsp[1].minor.yy64 = OE_Default;}
163879 break;
163880 case 74: /* onconf ::= ON CONFLICT resolvetype */
163881 {yymsp[-2].minor.yy64 = yymsp[0].minor.yy64;}
163882 break;
163883 case 77: /* resolvetype ::= IGNORE */
163884 {yymsp[0].minor.yy64 = OE_Ignore;}
163885 break;
163886 case 78: /* resolvetype ::= REPLACE */
163887 case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172);
163888 {yymsp[0].minor.yy64 = OE_Replace;}
163889 break;
163890 case 79: /* cmd ::= DROP TABLE ifexists fullname */
163891 {
163892 sqlite3DropTable(pParse, yymsp[0].minor.yy607, 0, yymsp[-1].minor.yy64);
163893 }
163894 break;
163895 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
163896 {
163897 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[0].minor.yy303, yymsp[-7].minor.yy64, yymsp[-5].minor.yy64);
163898 }
163899 break;
163900 case 83: /* cmd ::= DROP VIEW ifexists fullname */
163901 {
163902 sqlite3DropTable(pParse, yymsp[0].minor.yy607, 1, yymsp[-1].minor.yy64);
163903 }
163904 break;
163905 case 84: /* cmd ::= select */
163906 {
163907 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
163908 sqlite3Select(pParse, yymsp[0].minor.yy303, &dest);
163909 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303);
163910 }
163911 break;
163912 case 85: /* select ::= WITH wqlist selectnowith */
163913 {yymsp[-2].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);}
163914 break;
163915 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
163916 {yymsp[-3].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);}
163917 break;
163918 case 87: /* select ::= selectnowith */
163919 {
163920 Select *p = yymsp[0].minor.yy303;
163921 if( p ){
163922 parserDoubleLinkSelect(pParse, p);
163923 }
163924 yymsp[0].minor.yy303 = p; /*A-overwrites-X*/
163925 }
163926 break;
163927 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
163928 {
163929 Select *pRhs = yymsp[0].minor.yy303;
163930 Select *pLhs = yymsp[-2].minor.yy303;
163931 if( pRhs && pRhs->pPrior ){
163932 SrcList *pFrom;
163933 Token x;
163934 x.n = 0;
163935 parserDoubleLinkSelect(pParse, pRhs);
163936 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
163937 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
163938 }
163939 if( pRhs ){
163940 pRhs->op = (u8)yymsp[-1].minor.yy64;
163941 pRhs->pPrior = pLhs;
163942 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
163943 pRhs->selFlags &= ~SF_MultiValue;
163944 if( yymsp[-1].minor.yy64!=TK_ALL ) pParse->hasCompound = 1;
163945 }else{
163946 sqlite3SelectDelete(pParse->db, pLhs);
163947 }
163948 yymsp[-2].minor.yy303 = pRhs;
163949 }
163950 break;
163951 case 89: /* multiselect_op ::= UNION */
163952 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
163953 {yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-OP*/}
163954 break;
163955 case 90: /* multiselect_op ::= UNION ALL */
163956 {yymsp[-1].minor.yy64 = TK_ALL;}
163957 break;
163958 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
163959 {
163960 yymsp[-8].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy562,yymsp[-5].minor.yy607,yymsp[-4].minor.yy626,yymsp[-3].minor.yy562,yymsp[-2].minor.yy626,yymsp[-1].minor.yy562,yymsp[-7].minor.yy64,yymsp[0].minor.yy626);
163961 }
163962 break;
163963 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
163964 {
163965 yymsp[-9].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy562,yymsp[-6].minor.yy607,yymsp[-5].minor.yy626,yymsp[-4].minor.yy562,yymsp[-3].minor.yy626,yymsp[-1].minor.yy562,yymsp[-8].minor.yy64,yymsp[0].minor.yy626);
163966 if( yymsp[-9].minor.yy303 ){
163967 yymsp[-9].minor.yy303->pWinDefn = yymsp[-2].minor.yy375;
163968 }else{
163969 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy375);
163970 }
163971 }
163972 break;
163973 case 94: /* values ::= VALUES LP nexprlist RP */
163974 {
163975 yymsp[-3].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values,0);
163976 }
163977 break;
163978 case 95: /* values ::= values COMMA LP nexprlist RP */
163979 {
163980 Select *pRight, *pLeft = yymsp[-4].minor.yy303;
163981 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values|SF_MultiValue,0);
163982 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
163983 if( pRight ){
163984 pRight->op = TK_ALL;
163985 pRight->pPrior = pLeft;
163986 yymsp[-4].minor.yy303 = pRight;
163987 }else{
163988 yymsp[-4].minor.yy303 = pLeft;
163989 }
163990 }
163991 break;
163992 case 96: /* distinct ::= DISTINCT */
163993 {yymsp[0].minor.yy64 = SF_Distinct;}
163994 break;
163995 case 97: /* distinct ::= ALL */
163996 {yymsp[0].minor.yy64 = SF_All;}
163997 break;
163998 case 99: /* sclp ::= */
163999 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
164000 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
164001 case 229: /* exprlist ::= */ yytestcase(yyruleno==229);
164002 case 232: /* paren_exprlist ::= */ yytestcase(yyruleno==232);
164003 case 237: /* eidlist_opt ::= */ yytestcase(yyruleno==237);
164004 {yymsp[1].minor.yy562 = 0;}
164005 break;
164006 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
164007 {
164008 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[-2].minor.yy626);
164009 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[0].minor.yy0, 1);
164010 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy562,yymsp[-3].minor.yy600,yymsp[-1].minor.yy600);
164011 }
164012 break;
164013 case 101: /* selcollist ::= sclp scanpt STAR */
164014 {
164015 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
164016 yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy562, p);
164017 }
164018 break;
164019 case 102: /* selcollist ::= sclp scanpt nm DOT STAR */
164020 {
164021 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
164022 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164023 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
164024 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, pDot);
164025 }
164026 break;
164027 case 103: /* as ::= AS nm */
164028 case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114);
164029 case 253: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==253);
164030 case 254: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==254);
164031 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
164032 break;
164033 case 105: /* from ::= */
164034 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
164035 {yymsp[1].minor.yy607 = 0;}
164036 break;
164037 case 106: /* from ::= FROM seltablist */
164038 {
164039 yymsp[-1].minor.yy607 = yymsp[0].minor.yy607;
164040 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy607);
164041 }
164042 break;
164043 case 107: /* stl_prefix ::= seltablist joinop */
164044 {
164045 if( ALWAYS(yymsp[-1].minor.yy607 && yymsp[-1].minor.yy607->nSrc>0) ) yymsp[-1].minor.yy607->a[yymsp[-1].minor.yy607->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy64;
164046 }
164047 break;
164048 case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
164049 {
164050 yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164051 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy607, &yymsp[-2].minor.yy0);
164052 }
164053 break;
164054 case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
164055 {
164056 yymsp[-8].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy607,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164057 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy607, yymsp[-4].minor.yy562);
164058 }
164059 break;
164060 case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
164061 {
164062 yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy303,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164063 }
164064 break;
164065 case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
164066 {
164067 if( yymsp[-6].minor.yy607==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy626==0 && yymsp[0].minor.yy240==0 ){
164068 yymsp[-6].minor.yy607 = yymsp[-4].minor.yy607;
164069 }else if( yymsp[-4].minor.yy607->nSrc==1 ){
164070 yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164071 if( yymsp[-6].minor.yy607 ){
164072 SrcItem *pNew = &yymsp[-6].minor.yy607->a[yymsp[-6].minor.yy607->nSrc-1];
164073 SrcItem *pOld = yymsp[-4].minor.yy607->a;
164074 pNew->zName = pOld->zName;
164075 pNew->zDatabase = pOld->zDatabase;
164076 pNew->pSelect = pOld->pSelect;
164077 if( pOld->fg.isTabFunc ){
164078 pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -164081,240 +164315,240 @@
164081 pNew->fg.isTabFunc = 1;
164082 }
164083 pOld->zName = pOld->zDatabase = 0;
164084 pOld->pSelect = 0;
164085 }
164086 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy607);
164087 }else{
164088 Select *pSubquery;
164089 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy607);
164090 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy607,0,0,0,0,SF_NestedFrom,0);
164091 yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy626,yymsp[0].minor.yy240);
164092 }
164093 }
164094 break;
164095 case 113: /* dbnm ::= */
164096 case 127: /* indexed_opt ::= */ yytestcase(yyruleno==127);
164097 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
164098 break;
164099 case 115: /* fullname ::= nm */
164100 {
164101 yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
164102 if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0);
164103 }
164104 yymsp[0].minor.yy607 = yylhsminor.yy607;
164105 break;
164106 case 116: /* fullname ::= nm DOT nm */
164107 {
164108 yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
164109 if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0);
164110 }
164111 yymsp[-2].minor.yy607 = yylhsminor.yy607;
164112 break;
164113 case 117: /* xfullname ::= nm */
164114 {yymsp[0].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
164115 break;
164116 case 118: /* xfullname ::= nm DOT nm */
164117 {yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
164118 break;
164119 case 119: /* xfullname ::= nm DOT nm AS nm */
164120 {
164121 yymsp[-4].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
164122 if( yymsp[-4].minor.yy607 ) yymsp[-4].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164123 }
164124 break;
164125 case 120: /* xfullname ::= nm AS nm */
164126 {
164127 yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
164128 if( yymsp[-2].minor.yy607 ) yymsp[-2].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164129 }
164130 break;
164131 case 121: /* joinop ::= COMMA|JOIN */
164132 { yymsp[0].minor.yy64 = JT_INNER; }
164133 break;
164134 case 122: /* joinop ::= JOIN_KW JOIN */
164135 {yymsp[-1].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
164136 break;
164137 case 123: /* joinop ::= JOIN_KW nm JOIN */
164138 {yymsp[-2].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
164139 break;
164140 case 124: /* joinop ::= JOIN_KW nm nm JOIN */
164141 {yymsp[-3].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
164142 break;
164143 case 125: /* on_opt ::= ON expr */
164144 case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145);
164145 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
164146 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
164147 case 225: /* case_else ::= ELSE expr */ yytestcase(yyruleno==225);
164148 case 246: /* vinto ::= INTO expr */ yytestcase(yyruleno==246);
164149 {yymsp[-1].minor.yy626 = yymsp[0].minor.yy626;}
164150 break;
164151 case 126: /* on_opt ::= */
164152 case 144: /* having_opt ::= */ yytestcase(yyruleno==144);
164153 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
164154 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
164155 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
164156 case 226: /* case_else ::= */ yytestcase(yyruleno==226);
164157 case 228: /* case_operand ::= */ yytestcase(yyruleno==228);
164158 case 247: /* vinto ::= */ yytestcase(yyruleno==247);
164159 {yymsp[1].minor.yy626 = 0;}
164160 break;
164161 case 128: /* indexed_opt ::= INDEXED BY nm */
164162 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
164163 break;
164164 case 129: /* indexed_opt ::= NOT INDEXED */
164165 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
164166 break;
164167 case 130: /* using_opt ::= USING LP idlist RP */
164168 {yymsp[-3].minor.yy240 = yymsp[-1].minor.yy240;}
164169 break;
164170 case 131: /* using_opt ::= */
164171 case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173);
164172 {yymsp[1].minor.yy240 = 0;}
164173 break;
164174 case 133: /* orderby_opt ::= ORDER BY sortlist */
164175 case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143);
164176 {yymsp[-2].minor.yy562 = yymsp[0].minor.yy562;}
164177 break;
164178 case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */
164179 {
164180 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562,yymsp[-2].minor.yy626);
164181 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64);
164182 }
164183 break;
164184 case 135: /* sortlist ::= expr sortorder nulls */
164185 {
164186 yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy626); /*A-overwrites-Y*/
164187 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64);
164188 }
164189 break;
164190 case 136: /* sortorder ::= ASC */
164191 {yymsp[0].minor.yy64 = SQLITE_SO_ASC;}
164192 break;
164193 case 137: /* sortorder ::= DESC */
164194 {yymsp[0].minor.yy64 = SQLITE_SO_DESC;}
164195 break;
164196 case 138: /* sortorder ::= */
164197 case 141: /* nulls ::= */ yytestcase(yyruleno==141);
164198 {yymsp[1].minor.yy64 = SQLITE_SO_UNDEFINED;}
164199 break;
164200 case 139: /* nulls ::= NULLS FIRST */
164201 {yymsp[-1].minor.yy64 = SQLITE_SO_ASC;}
164202 break;
164203 case 140: /* nulls ::= NULLS LAST */
164204 {yymsp[-1].minor.yy64 = SQLITE_SO_DESC;}
164205 break;
164206 case 147: /* limit_opt ::= LIMIT expr */
164207 {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,0);}
164208 break;
164209 case 148: /* limit_opt ::= LIMIT expr OFFSET expr */
164210 {yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164211 break;
164212 case 149: /* limit_opt ::= LIMIT expr COMMA expr */
164213 {yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,yymsp[-2].minor.yy626);}
164214 break;
164215 case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
164216 {
164217 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy607, &yymsp[-1].minor.yy0);
164218 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy607,yymsp[0].minor.yy626,0,0);
164219 }
164220 break;
164221 case 155: /* where_opt_ret ::= RETURNING selcollist */
164222 {sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-1].minor.yy626 = 0;}
164223 break;
164224 case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
164225 {sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-3].minor.yy626 = yymsp[-2].minor.yy626;}
164226 break;
164227 case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
164228 {
164229 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy607, &yymsp[-4].minor.yy0);
164230 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy562,"set list");
164231 yymsp[-5].minor.yy607 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy607, yymsp[-1].minor.yy607);
164232 sqlite3Update(pParse,yymsp[-5].minor.yy607,yymsp[-2].minor.yy562,yymsp[0].minor.yy626,yymsp[-6].minor.yy64,0,0,0);
164233 }
164234 break;
164235 case 158: /* setlist ::= setlist COMMA nm EQ expr */
164236 {
164237 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[0].minor.yy626);
164238 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, 1);
164239 }
164240 break;
164241 case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
164242 {
164243 yymsp[-6].minor.yy562 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy562, yymsp[-3].minor.yy240, yymsp[0].minor.yy626);
164244 }
164245 break;
164246 case 160: /* setlist ::= nm EQ expr */
164247 {
164248 yylhsminor.yy562 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy626);
164249 sqlite3ExprListSetName(pParse, yylhsminor.yy562, &yymsp[-2].minor.yy0, 1);
164250 }
164251 yymsp[-2].minor.yy562 = yylhsminor.yy562;
164252 break;
164253 case 161: /* setlist ::= LP idlist RP EQ expr */
164254 {
164255 yymsp[-4].minor.yy562 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy240, yymsp[0].minor.yy626);
164256 }
164257 break;
164258 case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
164259 {
164260 sqlite3Insert(pParse, yymsp[-3].minor.yy607, yymsp[-1].minor.yy303, yymsp[-2].minor.yy240, yymsp[-5].minor.yy64, yymsp[0].minor.yy138);
164261 }
164262 break;
164263 case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
164264 {
164265 sqlite3Insert(pParse, yymsp[-4].minor.yy607, 0, yymsp[-3].minor.yy240, yymsp[-6].minor.yy64, 0);
164266 }
164267 break;
164268 case 164: /* upsert ::= */
164269 { yymsp[1].minor.yy138 = 0; }
164270 break;
164271 case 165: /* upsert ::= RETURNING selcollist */
164272 { yymsp[-1].minor.yy138 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy562); }
164273 break;
164274 case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
164275 { yymsp[-11].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy562,yymsp[-6].minor.yy626,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,yymsp[0].minor.yy138);}
164276 break;
164277 case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
164278 { yymsp[-8].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy562,yymsp[-3].minor.yy626,0,0,yymsp[0].minor.yy138); }
164279 break;
164280 case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */
164281 { yymsp[-4].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
164282 break;
164283 case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
164284 { yymsp[-7].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,0);}
164285 break;
164286 case 170: /* returning ::= RETURNING selcollist */
164287 {sqlite3AddReturning(pParse,yymsp[0].minor.yy562);}
164288 break;
164289 case 174: /* idlist_opt ::= LP idlist RP */
164290 {yymsp[-2].minor.yy240 = yymsp[-1].minor.yy240;}
164291 break;
164292 case 175: /* idlist ::= idlist COMMA nm */
164293 {yymsp[-2].minor.yy240 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy240,&yymsp[0].minor.yy0);}
164294 break;
164295 case 176: /* idlist ::= nm */
164296 {yymsp[0].minor.yy240 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
164297 break;
164298 case 177: /* expr ::= LP expr RP */
164299 {yymsp[-2].minor.yy626 = yymsp[-1].minor.yy626;}
164300 break;
164301 case 178: /* expr ::= ID|INDEXED */
164302 case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
164303 {yymsp[0].minor.yy626=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164304 break;
164305 case 180: /* expr ::= nm DOT nm */
164306 {
164307 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164308 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
164309 if( IN_RENAME_OBJECT ){
164310 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
164311 sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
164312 }
164313 yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
164314 }
164315 yymsp[-2].minor.yy626 = yylhsminor.yy626;
164316 break;
164317 case 181: /* expr ::= nm DOT nm DOT nm */
164318 {
164319 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
164320 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -164322,768 +164556,776 @@
164322 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
164323 if( IN_RENAME_OBJECT ){
164324 sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
164325 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
164326 }
164327 yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
164328 }
164329 yymsp[-4].minor.yy626 = yylhsminor.yy626;
164330 break;
164331 case 182: /* term ::= NULL|FLOAT|BLOB */
164332 case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
164333 {yymsp[0].minor.yy626=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164334 break;
164335 case 184: /* term ::= INTEGER */
164336 {
164337 yylhsminor.yy626 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
164338 }
164339 yymsp[0].minor.yy626 = yylhsminor.yy626;
164340 break;
164341 case 185: /* expr ::= VARIABLE */
164342 {
164343 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
164344 u32 n = yymsp[0].minor.yy0.n;
164345 yymsp[0].minor.yy626 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
164346 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy626, n);
164347 }else{
164348 /* When doing a nested parse, one can include terms in an expression
164349 ** that look like this: #1 #2 ... These terms refer to registers
164350 ** in the virtual machine. #N is the N-th register. */
164351 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
164352 assert( t.n>=2 );
164353 if( pParse->nested==0 ){
164354 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
164355 yymsp[0].minor.yy626 = 0;
164356 }else{
164357 yymsp[0].minor.yy626 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
164358 if( yymsp[0].minor.yy626 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy626->iTable);
164359 }
164360 }
164361 }
164362 break;
164363 case 186: /* expr ::= expr COLLATE ID|STRING */
164364 {
164365 yymsp[-2].minor.yy626 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy626, &yymsp[0].minor.yy0, 1);
164366 }
164367 break;
164368 case 187: /* expr ::= CAST LP expr AS typetoken RP */
164369 {
164370 yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
164371 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy626, yymsp[-3].minor.yy626, 0);
164372 }
164373 break;
164374 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
164375 {
164376 yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy64);
164377 }
164378 yymsp[-4].minor.yy626 = yylhsminor.yy626;
164379 break;
164380 case 189: /* expr ::= ID|INDEXED LP STAR RP */
164381 {
164382 yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
164383 }
164384 yymsp[-3].minor.yy626 = yylhsminor.yy626;
164385 break;
164386 case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
164387 {
164388 yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy562, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy64);
164389 sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375);
164390 }
164391 yymsp[-5].minor.yy626 = yylhsminor.yy626;
164392 break;
164393 case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
164394 {
164395 yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
164396 sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375);
164397 }
164398 yymsp[-4].minor.yy626 = yylhsminor.yy626;
164399 break;
164400 case 192: /* term ::= CTIME_KW */
164401 {
164402 yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
164403 }
164404 yymsp[0].minor.yy626 = yylhsminor.yy626;
164405 break;
164406 case 193: /* expr ::= LP nexprlist COMMA expr RP */
164407 {
164408 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626);
164409 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
164410 if( yymsp[-4].minor.yy626 ){
164411 yymsp[-4].minor.yy626->x.pList = pList;
164412 if( ALWAYS(pList->nExpr) ){
164413 yymsp[-4].minor.yy626->flags |= pList->a[0].pExpr->flags & EP_Propagate;
164414 }
164415 }else{
164416 sqlite3ExprListDelete(pParse->db, pList);
164417 }
164418 }
164419 break;
164420 case 194: /* expr ::= expr AND expr */
164421 {yymsp[-2].minor.yy626=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164422 break;
164423 case 195: /* expr ::= expr OR expr */
164424 case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
164425 case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
164426 case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
164427 case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
164428 case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
164429 case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
164430 {yymsp[-2].minor.yy626=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);}
164431 break;
164432 case 202: /* likeop ::= NOT LIKE_KW|MATCH */
164433 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
164434 break;
164435 case 203: /* expr ::= expr likeop expr */
164436 {
164437 ExprList *pList;
164438 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
164439 yymsp[-1].minor.yy0.n &= 0x7fffffff;
164440 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy626);
164441 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy626);
164442 yymsp[-2].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164443 if( bNot ) yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy626, 0);
164444 if( yymsp[-2].minor.yy626 ) yymsp[-2].minor.yy626->flags |= EP_InfixFunc;
164445 }
164446 break;
164447 case 204: /* expr ::= expr likeop expr ESCAPE expr */
164448 {
164449 ExprList *pList;
164450 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
164451 yymsp[-3].minor.yy0.n &= 0x7fffffff;
164452 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164453 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy626);
164454 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626);
164455 yymsp[-4].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
164456 if( bNot ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164457 if( yymsp[-4].minor.yy626 ) yymsp[-4].minor.yy626->flags |= EP_InfixFunc;
164458 }
164459 break;
164460 case 205: /* expr ::= expr ISNULL|NOTNULL */
164461 {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy626,0);}
164462 break;
164463 case 206: /* expr ::= expr NOT NULL */
164464 {yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy626,0);}
164465 break;
164466 case 207: /* expr ::= expr IS expr */
164467 {
164468 yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);
164469 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-2].minor.yy626, TK_ISNULL);
164470 }
164471 break;
164472 case 208: /* expr ::= expr IS NOT expr */
164473 {
164474 yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy626,yymsp[0].minor.yy626);
164475 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-3].minor.yy626, TK_NOTNULL);
164476 }
164477 break;
164478 case 209: /* expr ::= NOT expr */
164479 case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210);
164480 {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy626, 0);/*A-overwrites-B*/}
164481 break;
164482 case 211: /* expr ::= PLUS|MINUS expr */
164483 {
164484 yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy626, 0);
164485 /*A-overwrites-B*/
164486 }
164487 break;
164488 case 212: /* between_op ::= BETWEEN */
164489 case 215: /* in_op ::= IN */ yytestcase(yyruleno==215);
164490 {yymsp[0].minor.yy64 = 0;}
 
 
 
 
164491 break;
164492 case 214: /* expr ::= expr between_op expr AND expr */
 
 
 
 
164493 {
164494 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164495 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626);
164496 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy626, 0);
164497 if( yymsp[-4].minor.yy626 ){
164498 yymsp[-4].minor.yy626->x.pList = pList;
164499 }else{
164500 sqlite3ExprListDelete(pParse->db, pList);
164501 }
164502 if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164503 }
164504 break;
164505 case 217: /* expr ::= expr in_op LP exprlist RP */
164506 {
164507 if( yymsp[-1].minor.yy562==0 ){
164508 /* Expressions of the form
164509 **
164510 ** expr1 IN ()
164511 ** expr1 NOT IN ()
164512 **
164513 ** simplify to constants 0 (false) and 1 (true), respectively,
164514 ** regardless of the value of expr1.
164515 */
164516 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy626);
164517 yymsp[-4].minor.yy626 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy64 ? "1" : "0");
164518 }else{
164519 Expr *pRHS = yymsp[-1].minor.yy562->a[0].pExpr;
164520 if( yymsp[-1].minor.yy562->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy626->op!=TK_VECTOR ){
164521 yymsp[-1].minor.yy562->a[0].pExpr = 0;
164522 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562);
164523 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
164524 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy626, pRHS);
164525 }else{
164526 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164527 if( yymsp[-4].minor.yy626==0 ){
164528 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562);
164529 }else if( yymsp[-4].minor.yy626->pLeft->op==TK_VECTOR ){
164530 int nExpr = yymsp[-4].minor.yy626->pLeft->x.pList->nExpr;
164531 Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy562);
164532 if( pSelectRHS ){
164533 parserDoubleLinkSelect(pParse, pSelectRHS);
164534 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelectRHS);
164535 }
164536 }else{
164537 yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy562;
164538 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626);
164539 }
164540 }
164541 if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164542 }
164543 }
164544 break;
164545 case 218: /* expr ::= LP select RP */
164546 {
164547 yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
164548 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy626, yymsp[-1].minor.yy303);
164549 }
164550 break;
164551 case 219: /* expr ::= expr in_op LP select RP */
164552 {
164553 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164554 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, yymsp[-1].minor.yy303);
164555 if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164556 }
164557 break;
164558 case 220: /* expr ::= expr in_op nm dbnm paren_exprlist */
164559 {
164560 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
164561 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
164562 if( yymsp[0].minor.yy562 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy562);
164563 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0);
164564 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelect);
164565 if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0);
164566 }
164567 break;
164568 case 221: /* expr ::= EXISTS LP select RP */
164569 {
164570 Expr *p;
164571 p = yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
164572 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy303);
164573 }
164574 break;
164575 case 222: /* expr ::= CASE case_operand case_exprlist case_else END */
164576 {
164577 yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy626, 0);
164578 if( yymsp[-4].minor.yy626 ){
164579 yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy626 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626) : yymsp[-2].minor.yy562;
164580 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626);
164581 }else{
164582 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy562);
164583 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626);
164584 }
164585 }
164586 break;
164587 case 223: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
164588 {
164589 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[-2].minor.yy626);
164590 yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[0].minor.yy626);
164591 }
164592 break;
164593 case 224: /* case_exprlist ::= WHEN expr THEN expr */
164594 {
164595 yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626);
164596 yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy562, yymsp[0].minor.yy626);
164597 }
164598 break;
164599 case 227: /* case_operand ::= expr */
164600 {yymsp[0].minor.yy626 = yymsp[0].minor.yy626; /*A-overwrites-X*/}
164601 break;
164602 case 230: /* nexprlist ::= nexprlist COMMA expr */
164603 {yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[0].minor.yy626);}
164604 break;
164605 case 231: /* nexprlist ::= expr */
164606 {yymsp[0].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy626); /*A-overwrites-Y*/}
164607 break;
164608 case 233: /* paren_exprlist ::= LP exprlist RP */
164609 case 238: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==238);
164610 {yymsp[-2].minor.yy562 = yymsp[-1].minor.yy562;}
164611 break;
164612 case 234: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
164613 {
164614 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
164615 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy562, yymsp[-10].minor.yy64,
164616 &yymsp[-11].minor.yy0, yymsp[0].minor.yy626, SQLITE_SO_ASC, yymsp[-8].minor.yy64, SQLITE_IDXTYPE_APPDEF);
164617 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
164618 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
164619 }
164620 }
164621 break;
164622 case 235: /* uniqueflag ::= UNIQUE */
164623 case 277: /* raisetype ::= ABORT */ yytestcase(yyruleno==277);
164624 {yymsp[0].minor.yy64 = OE_Abort;}
164625 break;
164626 case 236: /* uniqueflag ::= */
164627 {yymsp[1].minor.yy64 = OE_None;}
164628 break;
164629 case 239: /* eidlist ::= eidlist COMMA nm collate sortorder */
164630 {
164631 yymsp[-4].minor.yy562 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64);
164632 }
164633 break;
164634 case 240: /* eidlist ::= nm collate sortorder */
164635 {
164636 yymsp[-2].minor.yy562 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64); /*A-overwrites-Y*/
164637 }
164638 break;
164639 case 243: /* cmd ::= DROP INDEX ifexists fullname */
164640 {sqlite3DropIndex(pParse, yymsp[0].minor.yy607, yymsp[-1].minor.yy64);}
164641 break;
164642 case 244: /* cmd ::= VACUUM vinto */
164643 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy626);}
164644 break;
164645 case 245: /* cmd ::= VACUUM nm vinto */
164646 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy626);}
164647 break;
164648 case 248: /* cmd ::= PRAGMA nm dbnm */
164649 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
164650 break;
164651 case 249: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
164652 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
164653 break;
164654 case 250: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
164655 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
164656 break;
164657 case 251: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
164658 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
164659 break;
164660 case 252: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
164661 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
164662 break;
164663 case 255: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
164664 {
164665 Token all;
164666 all.z = yymsp[-3].minor.yy0.z;
164667 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
164668 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy95, &all);
164669 }
164670 break;
164671 case 256: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
164672 {
164673 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy64, yymsp[-4].minor.yy570.a, yymsp[-4].minor.yy570.b, yymsp[-2].minor.yy607, yymsp[0].minor.yy626, yymsp[-10].minor.yy64, yymsp[-8].minor.yy64);
164674 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
164675 }
164676 break;
164677 case 257: /* trigger_time ::= BEFORE|AFTER */
164678 { yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/ }
164679 break;
164680 case 258: /* trigger_time ::= INSTEAD OF */
164681 { yymsp[-1].minor.yy64 = TK_INSTEAD;}
164682 break;
164683 case 259: /* trigger_time ::= */
164684 { yymsp[1].minor.yy64 = TK_BEFORE; }
164685 break;
164686 case 260: /* trigger_event ::= DELETE|INSERT */
164687 case 261: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==261);
164688 {yymsp[0].minor.yy570.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy570.b = 0;}
164689 break;
164690 case 262: /* trigger_event ::= UPDATE OF idlist */
164691 {yymsp[-2].minor.yy570.a = TK_UPDATE; yymsp[-2].minor.yy570.b = yymsp[0].minor.yy240;}
164692 break;
164693 case 263: /* when_clause ::= */
164694 case 282: /* key_opt ::= */ yytestcase(yyruleno==282);
164695 { yymsp[1].minor.yy626 = 0; }
164696 break;
164697 case 264: /* when_clause ::= WHEN expr */
164698 case 283: /* key_opt ::= KEY expr */ yytestcase(yyruleno==283);
164699 { yymsp[-1].minor.yy626 = yymsp[0].minor.yy626; }
164700 break;
164701 case 265: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
164702 {
164703 assert( yymsp[-2].minor.yy95!=0 );
164704 yymsp[-2].minor.yy95->pLast->pNext = yymsp[-1].minor.yy95;
164705 yymsp[-2].minor.yy95->pLast = yymsp[-1].minor.yy95;
164706 }
164707 break;
164708 case 266: /* trigger_cmd_list ::= trigger_cmd SEMI */
164709 {
164710 assert( yymsp[-1].minor.yy95!=0 );
164711 yymsp[-1].minor.yy95->pLast = yymsp[-1].minor.yy95;
164712 }
164713 break;
164714 case 267: /* trnm ::= nm DOT nm */
164715 {
164716 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
164717 sqlite3ErrorMsg(pParse,
164718 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
164719 "statements within triggers");
164720 }
164721 break;
164722 case 268: /* tridxby ::= INDEXED BY nm */
164723 {
164724 sqlite3ErrorMsg(pParse,
164725 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
164726 "within triggers");
164727 }
164728 break;
164729 case 269: /* tridxby ::= NOT INDEXED */
164730 {
164731 sqlite3ErrorMsg(pParse,
164732 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
164733 "within triggers");
164734 }
164735 break;
164736 case 270: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
164737 {yylhsminor.yy95 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy607, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626, yymsp[-7].minor.yy64, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy600);}
164738 yymsp[-8].minor.yy95 = yylhsminor.yy95;
164739 break;
164740 case 271: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
164741 {
164742 yylhsminor.yy95 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy240,yymsp[-2].minor.yy303,yymsp[-6].minor.yy64,yymsp[-1].minor.yy138,yymsp[-7].minor.yy600,yymsp[0].minor.yy600);/*yylhsminor.yy95-overwrites-yymsp[-6].minor.yy64*/
164743 }
164744 yymsp[-7].minor.yy95 = yylhsminor.yy95;
164745 break;
164746 case 272: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
164747 {yylhsminor.yy95 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy626, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy600);}
164748 yymsp[-5].minor.yy95 = yylhsminor.yy95;
164749 break;
164750 case 273: /* trigger_cmd ::= scanpt select scanpt */
164751 {yylhsminor.yy95 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy303, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); /*yylhsminor.yy95-overwrites-yymsp[-1].minor.yy303*/}
164752 yymsp[-2].minor.yy95 = yylhsminor.yy95;
164753 break;
164754 case 274: /* expr ::= RAISE LP IGNORE RP */
164755 {
164756 yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
164757 if( yymsp[-3].minor.yy626 ){
164758 yymsp[-3].minor.yy626->affExpr = OE_Ignore;
164759 }
164760 }
164761 break;
164762 case 275: /* expr ::= RAISE LP raisetype COMMA nm RP */
164763 {
164764 yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
164765 if( yymsp[-5].minor.yy626 ) {
164766 yymsp[-5].minor.yy626->affExpr = (char)yymsp[-3].minor.yy64;
164767 }
164768 }
164769 break;
164770 case 276: /* raisetype ::= ROLLBACK */
164771 {yymsp[0].minor.yy64 = OE_Rollback;}
164772 break;
164773 case 278: /* raisetype ::= FAIL */
164774 {yymsp[0].minor.yy64 = OE_Fail;}
164775 break;
164776 case 279: /* cmd ::= DROP TRIGGER ifexists fullname */
164777 {
164778 sqlite3DropTrigger(pParse,yymsp[0].minor.yy607,yymsp[-1].minor.yy64);
164779 }
164780 break;
164781 case 280: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
164782 {
164783 sqlite3Attach(pParse, yymsp[-3].minor.yy626, yymsp[-1].minor.yy626, yymsp[0].minor.yy626);
164784 }
164785 break;
164786 case 281: /* cmd ::= DETACH database_kw_opt expr */
164787 {
164788 sqlite3Detach(pParse, yymsp[0].minor.yy626);
164789 }
164790 break;
164791 case 284: /* cmd ::= REINDEX */
164792 {sqlite3Reindex(pParse, 0, 0);}
164793 break;
164794 case 285: /* cmd ::= REINDEX nm dbnm */
164795 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
164796 break;
164797 case 286: /* cmd ::= ANALYZE */
164798 {sqlite3Analyze(pParse, 0, 0);}
164799 break;
164800 case 287: /* cmd ::= ANALYZE nm dbnm */
164801 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
164802 break;
164803 case 288: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
164804 {
164805 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy607,&yymsp[0].minor.yy0);
164806 }
164807 break;
164808 case 289: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
164809 {
164810 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
164811 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
164812 }
164813 break;
164814 case 290: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
164815 {
164816 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy607, &yymsp[0].minor.yy0);
164817 }
164818 break;
164819 case 291: /* add_column_fullname ::= fullname */
164820 {
164821 disableLookaside(pParse);
164822 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy607);
164823 }
164824 break;
164825 case 292: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
164826 {
164827 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy607, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
164828 }
164829 break;
164830 case 293: /* cmd ::= create_vtab */
164831 {sqlite3VtabFinishParse(pParse,0);}
164832 break;
164833 case 294: /* cmd ::= create_vtab LP vtabarglist RP */
164834 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
164835 break;
164836 case 295: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
164837 {
164838 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy64);
164839 }
164840 break;
164841 case 296: /* vtabarg ::= */
164842 {sqlite3VtabArgInit(pParse);}
164843 break;
164844 case 297: /* vtabargtoken ::= ANY */
164845 case 298: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==298);
164846 case 299: /* lp ::= LP */ yytestcase(yyruleno==299);
164847 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
164848 break;
164849 case 300: /* with ::= WITH wqlist */
164850 case 301: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==301);
164851 { sqlite3WithPush(pParse, yymsp[0].minor.yy43, 1); }
164852 break;
164853 case 302: /* wqas ::= AS */
164854 {yymsp[0].minor.yy534 = M10d_Any;}
164855 break;
164856 case 303: /* wqas ::= AS MATERIALIZED */
164857 {yymsp[-1].minor.yy534 = M10d_Yes;}
164858 break;
164859 case 304: /* wqas ::= AS NOT MATERIALIZED */
164860 {yymsp[-2].minor.yy534 = M10d_No;}
164861 break;
164862 case 305: /* wqitem ::= nm eidlist_opt wqas LP select RP */
164863 {
164864 yymsp[-5].minor.yy255 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy562, yymsp[-1].minor.yy303, yymsp[-3].minor.yy534); /*A-overwrites-X*/
164865 }
164866 break;
164867 case 306: /* wqlist ::= wqitem */
164868 {
164869 yymsp[0].minor.yy43 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy255); /*A-overwrites-X*/
164870 }
164871 break;
164872 case 307: /* wqlist ::= wqlist COMMA wqitem */
164873 {
164874 yymsp[-2].minor.yy43 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy43, yymsp[0].minor.yy255);
164875 }
164876 break;
164877 case 308: /* windowdefn_list ::= windowdefn */
164878 { yylhsminor.yy375 = yymsp[0].minor.yy375; }
164879 yymsp[0].minor.yy375 = yylhsminor.yy375;
164880 break;
164881 case 309: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
164882 {
164883 assert( yymsp[0].minor.yy375!=0 );
164884 sqlite3WindowChain(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy375);
164885 yymsp[0].minor.yy375->pNextWin = yymsp[-2].minor.yy375;
164886 yylhsminor.yy375 = yymsp[0].minor.yy375;
164887 }
164888 yymsp[-2].minor.yy375 = yylhsminor.yy375;
164889 break;
164890 case 310: /* windowdefn ::= nm AS LP window RP */
164891 {
164892 if( ALWAYS(yymsp[-1].minor.yy375) ){
164893 yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
164894 }
164895 yylhsminor.yy375 = yymsp[-1].minor.yy375;
164896 }
164897 yymsp[-4].minor.yy375 = yylhsminor.yy375;
164898 break;
164899 case 311: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
164900 {
164901 yymsp[-4].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, 0);
164902 }
164903 break;
164904 case 312: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
164905 {
164906 yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, &yymsp[-5].minor.yy0);
164907 }
164908 yymsp[-5].minor.yy375 = yylhsminor.yy375;
164909 break;
164910 case 313: /* window ::= ORDER BY sortlist frame_opt */
164911 {
164912 yymsp[-3].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, 0);
164913 }
164914 break;
164915 case 314: /* window ::= nm ORDER BY sortlist frame_opt */
164916 {
164917 yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0);
164918 }
164919 yymsp[-4].minor.yy375 = yylhsminor.yy375;
164920 break;
164921 case 315: /* window ::= frame_opt */
164922 case 334: /* filter_over ::= over_clause */ yytestcase(yyruleno==334);
164923 {
164924 yylhsminor.yy375 = yymsp[0].minor.yy375;
164925 }
164926 yymsp[0].minor.yy375 = yylhsminor.yy375;
164927 break;
164928 case 316: /* window ::= nm frame_opt */
164929 {
164930 yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, 0, &yymsp[-1].minor.yy0);
164931 }
164932 yymsp[-1].minor.yy375 = yylhsminor.yy375;
164933 break;
164934 case 317: /* frame_opt ::= */
164935 {
164936 yymsp[1].minor.yy375 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
164937 }
164938 break;
164939 case 318: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
164940 {
164941 yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy64, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy534);
164942 }
164943 yymsp[-2].minor.yy375 = yylhsminor.yy375;
164944 break;
164945 case 319: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
164946 {
164947 yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy64, yymsp[-3].minor.yy81.eType, yymsp[-3].minor.yy81.pExpr, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, yymsp[0].minor.yy534);
164948 }
164949 yymsp[-5].minor.yy375 = yylhsminor.yy375;
164950 break;
164951 case 321: /* frame_bound_s ::= frame_bound */
164952 case 323: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==323);
164953 {yylhsminor.yy81 = yymsp[0].minor.yy81;}
164954 yymsp[0].minor.yy81 = yylhsminor.yy81;
164955 break;
164956 case 322: /* frame_bound_s ::= UNBOUNDED PRECEDING */
164957 case 324: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==324);
164958 case 326: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==326);
164959 {yylhsminor.yy81.eType = yymsp[-1].major; yylhsminor.yy81.pExpr = 0;}
164960 yymsp[-1].minor.yy81 = yylhsminor.yy81;
164961 break;
164962 case 325: /* frame_bound ::= expr PRECEDING|FOLLOWING */
164963 {yylhsminor.yy81.eType = yymsp[0].major; yylhsminor.yy81.pExpr = yymsp[-1].minor.yy626;}
164964 yymsp[-1].minor.yy81 = yylhsminor.yy81;
164965 break;
164966 case 327: /* frame_exclude_opt ::= */
164967 {yymsp[1].minor.yy534 = 0;}
164968 break;
164969 case 328: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
164970 {yymsp[-1].minor.yy534 = yymsp[0].minor.yy534;}
164971 break;
164972 case 329: /* frame_exclude ::= NO OTHERS */
164973 case 330: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==330);
164974 {yymsp[-1].minor.yy534 = yymsp[-1].major; /*A-overwrites-X*/}
164975 break;
164976 case 331: /* frame_exclude ::= GROUP|TIES */
164977 {yymsp[0].minor.yy534 = yymsp[0].major; /*A-overwrites-X*/}
164978 break;
164979 case 332: /* window_clause ::= WINDOW windowdefn_list */
164980 { yymsp[-1].minor.yy375 = yymsp[0].minor.yy375; }
164981 break;
164982 case 333: /* filter_over ::= filter_clause over_clause */
164983 {
164984 if( yymsp[0].minor.yy375 ){
164985 yymsp[0].minor.yy375->pFilter = yymsp[-1].minor.yy626;
164986 }else{
164987 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626);
164988 }
164989 yylhsminor.yy375 = yymsp[0].minor.yy375;
164990 }
164991 yymsp[-1].minor.yy375 = yylhsminor.yy375;
164992 break;
164993 case 335: /* filter_over ::= filter_clause */
164994 {
164995 yylhsminor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
164996 if( yylhsminor.yy375 ){
164997 yylhsminor.yy375->eFrmType = TK_FILTER;
164998 yylhsminor.yy375->pFilter = yymsp[0].minor.yy626;
164999 }else{
165000 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy626);
165001 }
165002 }
165003 yymsp[0].minor.yy375 = yylhsminor.yy375;
165004 break;
165005 case 336: /* over_clause ::= OVER LP window RP */
165006 {
165007 yymsp[-3].minor.yy375 = yymsp[-1].minor.yy375;
165008 assert( yymsp[-3].minor.yy375!=0 );
165009 }
165010 break;
165011 case 337: /* over_clause ::= OVER nm */
165012 {
165013 yymsp[-1].minor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165014 if( yymsp[-1].minor.yy375 ){
165015 yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
165016 }
165017 }
165018 break;
165019 case 338: /* filter_clause ::= FILTER LP WHERE expr RP */
165020 { yymsp[-4].minor.yy626 = yymsp[-1].minor.yy626; }
165021 break;
165022 default:
165023 /* (339) input ::= cmdlist */ yytestcase(yyruleno==339);
165024 /* (340) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==340);
165025 /* (341) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=341);
165026 /* (342) ecmd ::= SEMI */ yytestcase(yyruleno==342);
165027 /* (343) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==343);
165028 /* (344) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=344);
165029 /* (345) trans_opt ::= */ yytestcase(yyruleno==345);
165030 /* (346) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==346);
165031 /* (347) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==347);
165032 /* (348) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==348);
165033 /* (349) savepoint_opt ::= */ yytestcase(yyruleno==349);
165034 /* (350) cmd ::= create_table create_table_args */ yytestcase(yyruleno==350);
165035 /* (351) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=351);
165036 /* (352) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==352);
165037 /* (353) columnlist ::= columnname carglist */ yytestcase(yyruleno==353);
165038 /* (354) nm ::= ID|INDEXED */ yytestcase(yyruleno==354);
165039 /* (355) nm ::= STRING */ yytestcase(yyruleno==355);
165040 /* (356) nm ::= JOIN_KW */ yytestcase(yyruleno==356);
165041 /* (357) typetoken ::= typename */ yytestcase(yyruleno==357);
165042 /* (358) typename ::= ID|STRING */ yytestcase(yyruleno==358);
165043 /* (359) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=359);
165044 /* (360) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
165045 /* (361) carglist ::= carglist ccons */ yytestcase(yyruleno==361);
165046 /* (362) carglist ::= */ yytestcase(yyruleno==362);
165047 /* (363) ccons ::= NULL onconf */ yytestcase(yyruleno==363);
165048 /* (364) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==364);
165049 /* (365) ccons ::= AS generated */ yytestcase(yyruleno==365);
165050 /* (366) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==366);
165051 /* (367) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==367);
165052 /* (368) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=368);
165053 /* (369) tconscomma ::= */ yytestcase(yyruleno==369);
165054 /* (370) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=370);
165055 /* (371) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=371);
165056 /* (372) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=372);
165057 /* (373) oneselect ::= values */ yytestcase(yyruleno==373);
165058 /* (374) sclp ::= selcollist COMMA */ yytestcase(yyruleno==374);
165059 /* (375) as ::= ID|STRING */ yytestcase(yyruleno==375);
165060 /* (376) returning ::= */ yytestcase(yyruleno==376);
165061 /* (377) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=377);
165062 /* (378) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==378);
165063 /* (379) exprlist ::= nexprlist */ yytestcase(yyruleno==379);
165064 /* (380) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=380);
165065 /* (381) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=381);
165066 /* (382) nmnum ::= ON */ yytestcase(yyruleno==382);
165067 /* (383) nmnum ::= DELETE */ yytestcase(yyruleno==383);
165068 /* (384) nmnum ::= DEFAULT */ yytestcase(yyruleno==384);
165069 /* (385) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==385);
165070 /* (386) foreach_clause ::= */ yytestcase(yyruleno==386);
165071 /* (387) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==387);
165072 /* (388) trnm ::= nm */ yytestcase(yyruleno==388);
165073 /* (389) tridxby ::= */ yytestcase(yyruleno==389);
165074 /* (390) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==390);
165075 /* (391) database_kw_opt ::= */ yytestcase(yyruleno==391);
165076 /* (392) kwcolumn_opt ::= */ yytestcase(yyruleno==392);
165077 /* (393) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==393);
165078 /* (394) vtabarglist ::= vtabarg */ yytestcase(yyruleno==394);
165079 /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==395);
165080 /* (396) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==396);
165081 /* (397) anylist ::= */ yytestcase(yyruleno==397);
165082 /* (398) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==398);
165083 /* (399) anylist ::= anylist ANY */ yytestcase(yyruleno==399);
165084 /* (400) with ::= */ yytestcase(yyruleno==400);
165085 break;
165086 /********** End reduce actions ************************************************/
165087 };
165088 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
165089 yygoto = yyRuleInfoLhs[yyruleno];
@@ -166202,10 +166444,13 @@
166202 case CC_MINUS: {
166203 if( z[1]=='-' ){
166204 for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
166205 *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
166206 return i;
 
 
 
166207 }
166208 *tokenType = TK_MINUS;
166209 return 1;
166210 }
166211 case CC_LP: {
@@ -166471,17 +166716,13 @@
166471 *tokenType = TK_ID;
166472 return i;
166473 }
166474
166475 /*
166476 ** Run the parser on the given SQL string. The parser structure is
166477 ** passed in. An SQLITE_ status code is returned. If an error occurs
166478 ** then an and attempt is made to write an error message into
166479 ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
166480 ** error message.
166481 */
166482 SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
166483 int nErr = 0; /* Number of errors encountered */
166484 void *pEngine; /* The LEMON-generated LALR(1) parser */
166485 int n = 0; /* Length of the next token token */
166486 int tokenType; /* type of the next token */
166487 int lastTokenParsed = -1; /* type of the previous token */
@@ -166498,11 +166739,10 @@
166498 if( db->nVdbeActive==0 ){
166499 AtomicStore(&db->u1.isInterrupted, 0);
166500 }
166501 pParse->rc = SQLITE_OK;
166502 pParse->zTail = zSql;
166503 assert( pzErrMsg!=0 );
166504 #ifdef SQLITE_DEBUG
166505 if( db->flags & SQLITE_ParserTrace ){
166506 printf("parser: [[[%s]]]\n", zSql);
166507 sqlite3ParserTrace(stdout, "parser: ");
166508 }else{
@@ -166541,10 +166781,11 @@
166541 if( tokenType>=TK_SPACE ){
166542 assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
166543 #endif /* SQLITE_OMIT_WINDOWFUNC */
166544 if( AtomicLoad(&db->u1.isInterrupted) ){
166545 pParse->rc = SQLITE_INTERRUPT;
 
166546 break;
166547 }
166548 if( tokenType==TK_SPACE ){
166549 zSql += n;
166550 continue;
@@ -166598,45 +166839,30 @@
166598 sqlite3ParserFree(pEngine, sqlite3_free);
166599 #endif
166600 if( db->mallocFailed ){
166601 pParse->rc = SQLITE_NOMEM_BKPT;
166602 }
166603 if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
166604 pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
166605 }
166606 assert( pzErrMsg!=0 );
166607 if( pParse->zErrMsg ){
166608 *pzErrMsg = pParse->zErrMsg;
166609 sqlite3_log(pParse->rc, "%s in \"%s\"",
166610 *pzErrMsg, pParse->zTail);
166611 pParse->zErrMsg = 0;
166612 nErr++;
166613 }
166614 pParse->zTail = zSql;
166615 if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
166616 sqlite3VdbeDelete(pParse->pVdbe);
166617 pParse->pVdbe = 0;
166618 }
166619 #ifndef SQLITE_OMIT_SHARED_CACHE
166620 if( pParse->nested==0 ){
166621 sqlite3DbFree(db, pParse->aTableLock);
166622 pParse->aTableLock = 0;
166623 pParse->nTableLock = 0;
166624 }
166625 #endif
166626 #ifndef SQLITE_OMIT_VIRTUALTABLE
166627 sqlite3_free(pParse->apVtabLock);
166628 #endif
166629
166630 if( !IN_SPECIAL_PARSE ){
166631 /* If the pParse->declareVtab flag is set, do not delete any table
166632 ** structure built up in pParse->pNewTable. The calling code (see vtab.c)
166633 ** will take responsibility for freeing the Table structure.
166634 */
166635 sqlite3DeleteTable(db, pParse->pNewTable);
166636 }
166637 if( !IN_RENAME_OBJECT ){
166638 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
166639 }
166640 sqlite3DbFree(db, pParse->pVList);
166641 db->pParse = pParentParse;
166642 assert( nErr==0 || pParse->rc!=SQLITE_OK );
@@ -167217,13 +167443,10 @@
167217 SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*);
167218 #endif
167219 #ifdef SQLITE_ENABLE_FTS5
167220 SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*);
167221 #endif
167222 #ifdef SQLITE_ENABLE_JSON1
167223 SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*);
167224 #endif
167225 #ifdef SQLITE_ENABLE_STMTVTAB
167226 SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*);
167227 #endif
167228
167229 /*
@@ -167254,12 +167477,12 @@
167254 #endif
167255 #ifdef SQLITE_ENABLE_DBSTAT_VTAB
167256 sqlite3DbstatRegister,
167257 #endif
167258 sqlite3TestExtInit,
167259 #ifdef SQLITE_ENABLE_JSON1
167260 sqlite3Json1Init,
167261 #endif
167262 #ifdef SQLITE_ENABLE_STMTVTAB
167263 sqlite3StmtVtabInit,
167264 #endif
167265 #ifdef SQLITE_ENABLE_BYTECODE_VTAB
@@ -169763,10 +169986,23 @@
169763 }
169764 }
169765 sqlite3_mutex_leave(db->mutex);
169766 return z;
169767 }
 
 
 
 
 
 
 
 
 
 
 
 
 
169768
169769 #ifndef SQLITE_OMIT_UTF16
169770 /*
169771 ** Return UTF-16 encoded English language explanation of the most recent
169772 ** error.
@@ -173514,11 +173750,11 @@
173514 SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
173515 SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
173516 SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
173517
173518 /* fts3_tokenize_vtab.c */
173519 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
173520
173521 /* fts3_unicode2.c (functions generated by parsing unicode text files) */
173522 #ifndef SQLITE_DISABLE_FTS3_UNICODE
173523 SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
173524 SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -173546,10 +173782,16 @@
173546 /* #include "fts3.h" */
173547 #ifndef SQLITE_CORE
173548 /* # include "sqlite3ext.h" */
173549 SQLITE_EXTENSION_INIT1
173550 #endif
 
 
 
 
 
 
173551
173552 static int fts3EvalNext(Fts3Cursor *pCsr);
173553 static int fts3EvalStart(Fts3Cursor *pCsr);
173554 static int fts3TermSegReaderCursor(
173555 Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **);
@@ -174411,11 +174653,11 @@
174411 int argc, /* Number of elements in argv array */
174412 const char * const *argv, /* xCreate/xConnect argument array */
174413 sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */
174414 char **pzErr /* Write any error message here */
174415 ){
174416 Fts3Hash *pHash = (Fts3Hash *)pAux;
174417 Fts3Table *p = 0; /* Pointer to allocated vtab */
174418 int rc = SQLITE_OK; /* Return code */
174419 int i; /* Iterator variable */
174420 sqlite3_int64 nByte; /* Size of allocation used for *p */
174421 int iCol; /* Column index */
@@ -177246,13 +177488,16 @@
177246 ** This function is registered as the module destructor (called when an
177247 ** FTS3 enabled database connection is closed). It frees the memory
177248 ** allocated for the tokenizer hash table.
177249 */
177250 static void hashDestroy(void *p){
177251 Fts3Hash *pHash = (Fts3Hash *)p;
177252 sqlite3Fts3HashClear(pHash);
177253 sqlite3_free(pHash);
 
 
 
177254 }
177255
177256 /*
177257 ** The fts3 built-in tokenizers - "simple", "porter" and "icu"- are
177258 ** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c
@@ -177278,11 +177523,11 @@
177278 ** SQLite. If fts3 is built as a dynamically loadable extension, this
177279 ** function is called by the sqlite3_extension_init() entry point.
177280 */
177281 SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
177282 int rc = SQLITE_OK;
177283 Fts3Hash *pHash = 0;
177284 const sqlite3_tokenizer_module *pSimple = 0;
177285 const sqlite3_tokenizer_module *pPorter = 0;
177286 #ifndef SQLITE_DISABLE_FTS3_UNICODE
177287 const sqlite3_tokenizer_module *pUnicode = 0;
177288 #endif
@@ -177306,70 +177551,74 @@
177306
177307 sqlite3Fts3SimpleTokenizerModule(&pSimple);
177308 sqlite3Fts3PorterTokenizerModule(&pPorter);
177309
177310 /* Allocate and initialize the hash-table used to store tokenizers. */
177311 pHash = sqlite3_malloc(sizeof(Fts3Hash));
177312 if( !pHash ){
177313 rc = SQLITE_NOMEM;
177314 }else{
177315 sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);
 
177316 }
177317
177318 /* Load the built-in tokenizers into the hash table */
177319 if( rc==SQLITE_OK ){
177320 if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
177321 || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
177322
177323 #ifndef SQLITE_DISABLE_FTS3_UNICODE
177324 || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
177325 #endif
177326 #ifdef SQLITE_ENABLE_ICU
177327 || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu))
177328 #endif
177329 ){
177330 rc = SQLITE_NOMEM;
177331 }
177332 }
177333
177334 #ifdef SQLITE_TEST
177335 if( rc==SQLITE_OK ){
177336 rc = sqlite3Fts3ExprInitTestInterface(db, pHash);
177337 }
177338 #endif
177339
177340 /* Create the virtual table wrapper around the hash-table and overload
177341 ** the four scalar functions. If this is successful, register the
177342 ** module with sqlite.
177343 */
177344 if( SQLITE_OK==rc
177345 && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
177346 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
177347 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
177348 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
177349 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
177350 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
177351 ){
 
177352 rc = sqlite3_create_module_v2(
177353 db, "fts3", &fts3Module, (void *)pHash, hashDestroy
177354 );
177355 if( rc==SQLITE_OK ){
 
177356 rc = sqlite3_create_module_v2(
177357 db, "fts4", &fts3Module, (void *)pHash, 0
177358 );
177359 }
177360 if( rc==SQLITE_OK ){
177361 rc = sqlite3Fts3InitTok(db, (void *)pHash);
 
177362 }
177363 return rc;
177364 }
177365
177366
177367 /* An error has occurred. Delete the hash table and return the error code. */
177368 assert( rc!=SQLITE_OK );
177369 if( pHash ){
177370 sqlite3Fts3HashClear(pHash);
177371 sqlite3_free(pHash);
177372 }
177373 return rc;
177374 }
177375
@@ -177712,11 +177961,11 @@
177712 ){
177713 char *p = *ppIter;
177714
177715 assert( nDoclist>0 );
177716 assert( *pbEof==0 );
177717 assert( p || *piDocid==0 );
177718 assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) );
177719
177720 if( p==0 ){
177721 sqlite3_int64 iDocid = 0;
177722 char *pNext = 0;
@@ -183429,11 +183678,11 @@
183429
183430 /*
183431 ** Register the fts3tok module with database connection db. Return SQLITE_OK
183432 ** if successful or an error code if sqlite3_create_module() fails.
183433 */
183434 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
183435 static const sqlite3_module fts3tok_module = {
183436 0, /* iVersion */
183437 fts3tokConnectMethod, /* xCreate */
183438 fts3tokConnectMethod, /* xConnect */
183439 fts3tokBestIndexMethod, /* xBestIndex */
@@ -183458,11 +183707,13 @@
183458 0, /* xRollbackTo */
183459 0 /* xShadowName */
183460 };
183461 int rc; /* Return code */
183462
183463 rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash);
 
 
183464 return rc;
183465 }
183466
183467 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
183468
@@ -191817,11 +192068,11 @@
191817 }
191818 #endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
191819 #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
191820
191821 /************** End of fts3_unicode2.c ***************************************/
191822 /************** Begin file json1.c *******************************************/
191823 /*
191824 ** 2015-08-12
191825 **
191826 ** The author disclaims copyright to this source code. In place of
191827 ** a legal notice, here is a blessing:
@@ -191830,63 +192081,23 @@
191830 ** May you find forgiveness for yourself and forgive others.
191831 ** May you share freely, never taking more than you give.
191832 **
191833 ******************************************************************************
191834 **
191835 ** This SQLite extension implements JSON functions. The interface is
191836 ** modeled after MySQL JSON functions:
191837 **
191838 ** https://dev.mysql.com/doc/refman/5.7/en/json.html
 
191839 **
191840 ** For the time being, all JSON is stored as pure text. (We might add
191841 ** a JSONB type in the future which stores a binary encoding of JSON in
191842 ** a BLOB, but there is no support for JSONB in the current implementation.
191843 ** This implementation parses JSON text at 250 MB/s, so it is hard to see
191844 ** how JSONB might improve on that.)
191845 */
191846 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1)
191847 #if !defined(SQLITEINT_H)
191848 /* #include "sqlite3ext.h" */
191849 #endif
191850 SQLITE_EXTENSION_INIT1
191851 /* #include <assert.h> */
191852 /* #include <string.h> */
191853 /* #include <stdlib.h> */
191854 /* #include <stdarg.h> */
191855
191856 /* Mark a function parameter as unused, to suppress nuisance compiler
191857 ** warnings. */
191858 #ifndef UNUSED_PARAM
191859 # define UNUSED_PARAM(X) (void)(X)
191860 #endif
191861
191862 #ifndef LARGEST_INT64
191863 # define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
191864 # define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
191865 #endif
191866
191867 #ifndef deliberate_fall_through
191868 # define deliberate_fall_through
191869 #endif
191870
191871 /*
191872 ** Versions of isspace(), isalnum() and isdigit() to which it is safe
191873 ** to pass signed char values.
191874 */
191875 #ifdef sqlite3Isdigit
191876 /* Use the SQLite core versions if this routine is part of the
191877 ** SQLite amalgamation */
191878 # define safe_isdigit(x) sqlite3Isdigit(x)
191879 # define safe_isalnum(x) sqlite3Isalnum(x)
191880 # define safe_isxdigit(x) sqlite3Isxdigit(x)
191881 #else
191882 /* Use the standard library for separate compilation */
191883 #include <ctype.h> /* amalgamator: keep */
191884 # define safe_isdigit(x) isdigit((unsigned char)(x))
191885 # define safe_isalnum(x) isalnum((unsigned char)(x))
191886 # define safe_isxdigit(x) isxdigit((unsigned char)(x))
191887 #endif
191888
191889 /*
191890 ** Growing our own isspace() routine this way is twice as fast as
191891 ** the library isspace() function, resulting in a 7% overall performance
191892 ** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
@@ -191907,48 +192118,18 @@
191907 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191908 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191909 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191910 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
191911 };
191912 #define safe_isspace(x) (jsonIsSpace[(unsigned char)x])
191913
191914 #ifndef SQLITE_AMALGAMATION
191915 /* Unsigned integer types. These are already defined in the sqliteInt.h,
191916 ** but the definitions need to be repeated for separate compilation. */
191917 typedef sqlite3_uint64 u64;
191918 typedef unsigned int u32;
191919 typedef unsigned short int u16;
191920 typedef unsigned char u8;
191921 # if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)
191922 # define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1
191923 # endif
191924 # if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS)
191925 # define ALWAYS(X) (1)
191926 # define NEVER(X) (0)
191927 # elif !defined(NDEBUG)
191928 # define ALWAYS(X) ((X)?1:(assert(0),0))
191929 # define NEVER(X) ((X)?(assert(0),1):0)
191930 # else
191931 # define ALWAYS(X) (X)
191932 # define NEVER(X) (X)
191933 # endif
191934 # define testcase(X)
191935 #endif
191936 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST)
191937 # define VVA(X)
191938 #else
191939 # define VVA(X) X
191940 #endif
191941
191942 /*
191943 ** Some of the testcase() macros in this file are problematic for gcov
191944 ** in that they generate false-miss errors randomly. This is a gcov problem,
191945 ** not a problem in this case. But to work around it, we disable the
191946 ** problematic test cases for production builds.
191947 */
191948 #define json_testcase(X)
191949
191950 /* Objects */
191951 typedef struct JsonString JsonString;
191952 typedef struct JsonNode JsonNode;
191953 typedef struct JsonParse JsonParse;
191954
@@ -192402,14 +192583,14 @@
192402 /*
192403 ** Convert a 4-byte hex string into an integer
192404 */
192405 static u32 jsonHexToInt4(const char *z){
192406 u32 v;
192407 assert( safe_isxdigit(z[0]) );
192408 assert( safe_isxdigit(z[1]) );
192409 assert( safe_isxdigit(z[2]) );
192410 assert( safe_isxdigit(z[3]) );
192411 v = (jsonHexToInt(z[0])<<12)
192412 + (jsonHexToInt(z[1])<<8)
192413 + (jsonHexToInt(z[2])<<4)
192414 + jsonHexToInt(z[3]);
192415 return v;
@@ -192640,11 +192821,11 @@
192640 /*
192641 ** Return true if z[] begins with 4 (or more) hexadecimal digits
192642 */
192643 static int jsonIs4Hex(const char *z){
192644 int i;
192645 for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
192646 return 1;
192647 }
192648
192649 /*
192650 ** Parse a single JSON value which begins at pParse->zJson[i]. Return the
@@ -192659,17 +192840,17 @@
192659 u32 j;
192660 int iThis;
192661 int x;
192662 JsonNode *pNode;
192663 const char *z = pParse->zJson;
192664 while( safe_isspace(z[i]) ){ i++; }
192665 if( (c = z[i])=='{' ){
192666 /* Parse object */
192667 iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
192668 if( iThis<0 ) return -1;
192669 for(j=i+1;;j++){
192670 while( safe_isspace(z[j]) ){ j++; }
192671 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192672 x = jsonParseValue(pParse, j);
192673 if( x<0 ){
192674 pParse->iDepth--;
192675 if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
@@ -192678,18 +192859,18 @@
192678 if( pParse->oom ) return -1;
192679 pNode = &pParse->aNode[pParse->nNode-1];
192680 if( pNode->eType!=JSON_STRING ) return -1;
192681 pNode->jnFlags |= JNODE_LABEL;
192682 j = x;
192683 while( safe_isspace(z[j]) ){ j++; }
192684 if( z[j]!=':' ) return -1;
192685 j++;
192686 x = jsonParseValue(pParse, j);
192687 pParse->iDepth--;
192688 if( x<0 ) return -1;
192689 j = x;
192690 while( safe_isspace(z[j]) ){ j++; }
192691 c = z[j];
192692 if( c==',' ) continue;
192693 if( c!='}' ) return -1;
192694 break;
192695 }
@@ -192699,20 +192880,20 @@
192699 /* Parse array */
192700 iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
192701 if( iThis<0 ) return -1;
192702 memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
192703 for(j=i+1;;j++){
192704 while( safe_isspace(z[j]) ){ j++; }
192705 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192706 x = jsonParseValue(pParse, j);
192707 pParse->iDepth--;
192708 if( x<0 ){
192709 if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
192710 return -1;
192711 }
192712 j = x;
192713 while( safe_isspace(z[j]) ){ j++; }
192714 c = z[j];
192715 if( c==',' ) continue;
192716 if( c!=']' ) return -1;
192717 break;
192718 }
@@ -192745,21 +192926,21 @@
192745 jsonParseAddNode(pParse, JSON_STRING, j+1-i, &z[i]);
192746 if( !pParse->oom ) pParse->aNode[pParse->nNode-1].jnFlags = jnFlags;
192747 return j+1;
192748 }else if( c=='n'
192749 && strncmp(z+i,"null",4)==0
192750 && !safe_isalnum(z[i+4]) ){
192751 jsonParseAddNode(pParse, JSON_NULL, 0, 0);
192752 return i+4;
192753 }else if( c=='t'
192754 && strncmp(z+i,"true",4)==0
192755 && !safe_isalnum(z[i+4]) ){
192756 jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
192757 return i+4;
192758 }else if( c=='f'
192759 && strncmp(z+i,"false",5)==0
192760 && !safe_isalnum(z[i+5]) ){
192761 jsonParseAddNode(pParse, JSON_FALSE, 0, 0);
192762 return i+5;
192763 }else if( c=='-' || (c>='0' && c<='9') ){
192764 /* Parse number */
192765 u8 seenDP = 0;
@@ -192826,11 +193007,11 @@
192826 pParse->zJson = zJson;
192827 i = jsonParseValue(pParse, 0);
192828 if( pParse->oom ) i = -1;
192829 if( i>0 ){
192830 assert( pParse->iDepth==0 );
192831 while( safe_isspace(zJson[i]) ) i++;
192832 if( zJson[i] ) i = -1;
192833 }
192834 if( i<=0 ){
192835 if( pCtx!=0 ){
192836 if( pParse->oom ){
@@ -193054,11 +193235,11 @@
193054 return pNode;
193055 }
193056 }else if( zPath[0]=='[' ){
193057 i = 0;
193058 j = 1;
193059 while( safe_isdigit(zPath[j]) ){
193060 i = i*10 + zPath[j] - '0';
193061 j++;
193062 }
193063 if( j<2 || zPath[j]!=']' ){
193064 if( zPath[1]=='#' ){
@@ -193075,17 +193256,17 @@
193075 iBase += pBase->u.iAppend;
193076 pBase = &pParse->aNode[iBase];
193077 j = 1;
193078 }
193079 j = 2;
193080 if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){
193081 unsigned int x = 0;
193082 j = 3;
193083 do{
193084 x = x*10 + zPath[j] - '0';
193085 j++;
193086 }while( safe_isdigit(zPath[j]) );
193087 if( x>i ) return 0;
193088 i -= x;
193089 }
193090 if( zPath[j]!=']' ){
193091 *pzErr = zPath;
@@ -193300,11 +193481,11 @@
193300 static void jsonTest1Func(
193301 sqlite3_context *ctx,
193302 int argc,
193303 sqlite3_value **argv
193304 ){
193305 UNUSED_PARAM(argc);
193306 sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE);
193307 }
193308 #endif /* SQLITE_DEBUG */
193309
193310 /****************************************************************************
@@ -193321,11 +193502,11 @@
193321 sqlite3_context *ctx,
193322 int argc,
193323 sqlite3_value **argv
193324 ){
193325 JsonString jx;
193326 UNUSED_PARAM(argc);
193327
193328 jsonInit(&jx, ctx);
193329 jsonAppendValue(&jx, argv[0]);
193330 jsonResult(&jx);
193331 sqlite3_result_subtype(ctx, JSON_SUBTYPE);
@@ -193392,55 +193573,118 @@
193392 }
193393 }
193394 sqlite3_result_int64(ctx, n);
193395 }
193396
 
 
 
 
 
 
 
 
 
193397 /*
193398 ** json_extract(JSON, PATH, ...)
 
 
193399 **
193400 ** Return the element described by PATH. Return NULL if there is no
193401 ** PATH element. If there are multiple PATHs, then return a JSON array
193402 ** with the result from each path. Throw an error if the JSON or any PATH
193403 ** is malformed.
 
 
 
 
 
 
 
 
 
 
193404 */
193405 static void jsonExtractFunc(
193406 sqlite3_context *ctx,
193407 int argc,
193408 sqlite3_value **argv
193409 ){
193410 JsonParse *p; /* The parse */
193411 JsonNode *pNode;
193412 const char *zPath;
 
193413 JsonString jx;
193414 int i;
193415
193416 if( argc<2 ) return;
193417 p = jsonParseCached(ctx, argv, ctx);
193418 if( p==0 ) return;
193419 jsonInit(&jx, ctx);
193420 jsonAppendChar(&jx, '[');
193421 for(i=1; i<argc; i++){
193422 zPath = (const char*)sqlite3_value_text(argv[i]);
193423 pNode = jsonLookup(p, zPath, 0, ctx);
193424 if( p->nErr ) break;
193425 if( argc>2 ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193426 jsonAppendSeparator(&jx);
193427 if( pNode ){
193428 jsonRenderNode(pNode, &jx, 0);
193429 }else{
193430 jsonAppendRaw(&jx, "null", 4);
193431 }
193432 }else if( pNode ){
193433 jsonReturn(pNode, ctx, 0);
193434 }
193435 }
193436 if( argc>2 && i==argc ){
193437 jsonAppendChar(&jx, ']');
193438 jsonResult(&jx);
193439 sqlite3_result_subtype(ctx, JSON_SUBTYPE);
193440 }
193441 jsonReset(&jx);
193442 }
193443
193444 /* This is the RFC 7396 MergePatch algorithm.
193445 */
193446 static JsonNode *jsonMergePatch(
@@ -193532,11 +193776,11 @@
193532 ){
193533 JsonParse x; /* The JSON that is being patched */
193534 JsonParse y; /* The patch */
193535 JsonNode *pResult; /* The result of the merge */
193536
193537 UNUSED_PARAM(argc);
193538 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
193539 if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){
193540 jsonParseReset(&x);
193541 return;
193542 }
@@ -193653,11 +193897,11 @@
193653 zPath = (const char*)sqlite3_value_text(argv[i]);
193654 pNode = jsonLookup(&x, zPath, 0, ctx);
193655 if( x.nErr ) goto replace_err;
193656 if( pNode ){
193657 assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 );
193658 json_testcase( pNode->eU!=0 && pNode->eU!=1 );
193659 pNode->jnFlags |= (u8)JNODE_REPLACE;
193660 VVA( pNode->eU = 4 );
193661 pNode->u.iReplace = i + 1;
193662 }
193663 }
@@ -193668,10 +193912,11 @@
193668 jsonReturnJson(x.aNode, ctx, argv);
193669 }
193670 replace_err:
193671 jsonParseReset(&x);
193672 }
 
193673
193674 /*
193675 ** json_set(JSON, PATH, VALUE, ...)
193676 **
193677 ** Set the value at PATH to VALUE. Create the PATH if it does not already
@@ -193691,11 +193936,11 @@
193691 JsonParse x; /* The parse */
193692 JsonNode *pNode;
193693 const char *zPath;
193694 u32 i;
193695 int bApnd;
193696 int bIsSet = *(int*)sqlite3_user_data(ctx);
193697
193698 if( argc<1 ) return;
193699 if( (argc&1)==0 ) {
193700 jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert");
193701 return;
@@ -193710,11 +193955,11 @@
193710 sqlite3_result_error_nomem(ctx);
193711 goto jsonSetDone;
193712 }else if( x.nErr ){
193713 goto jsonSetDone;
193714 }else if( pNode && (bApnd || bIsSet) ){
193715 json_testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 );
193716 assert( pNode->eU!=3 || pNode->eU!=5 );
193717 VVA( pNode->eU = 4 );
193718 pNode->jnFlags |= (u8)JNODE_REPLACE;
193719 pNode->u.iReplace = i + 1;
193720 }
@@ -193731,12 +193976,12 @@
193731
193732 /*
193733 ** json_type(JSON)
193734 ** json_type(JSON, PATH)
193735 **
193736 ** Return the top-level "type" of a JSON string. Throw an error if
193737 ** either the JSON or PATH inputs are not well-formed.
193738 */
193739 static void jsonTypeFunc(
193740 sqlite3_context *ctx,
193741 int argc,
193742 sqlite3_value **argv
@@ -193768,11 +194013,11 @@
193768 sqlite3_context *ctx,
193769 int argc,
193770 sqlite3_value **argv
193771 ){
193772 JsonParse *p; /* The parse */
193773 UNUSED_PARAM(argc);
193774 p = jsonParseCached(ctx, argv, 0);
193775 sqlite3_result_int(ctx, p!=0);
193776 }
193777
193778
@@ -193788,11 +194033,11 @@
193788 sqlite3_context *ctx,
193789 int argc,
193790 sqlite3_value **argv
193791 ){
193792 JsonString *pStr;
193793 UNUSED_PARAM(argc);
193794 pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
193795 if( pStr ){
193796 if( pStr->zBuf==0 ){
193797 jsonInit(pStr, ctx);
193798 jsonAppendChar(pStr, '[');
@@ -193848,12 +194093,12 @@
193848 int inStr = 0;
193849 int nNest = 0;
193850 char *z;
193851 char c;
193852 JsonString *pStr;
193853 UNUSED_PARAM(argc);
193854 UNUSED_PARAM(argv);
193855 pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
193856 #ifdef NEVER
193857 /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
193858 ** always have been called to initalize it */
193859 if( NEVER(!pStr) ) return;
@@ -193893,11 +194138,11 @@
193893 sqlite3_value **argv
193894 ){
193895 JsonString *pStr;
193896 const char *z;
193897 u32 n;
193898 UNUSED_PARAM(argc);
193899 pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
193900 if( pStr ){
193901 if( pStr->zBuf==0 ){
193902 jsonInit(pStr, ctx);
193903 jsonAppendChar(pStr, '{');
@@ -193984,14 +194229,14 @@
193984 ** the last two columns in the table. Should this ever changes, be
193985 ** sure to update the xBestIndex method. */
193986 #define JEACH_JSON 8
193987 #define JEACH_ROOT 9
193988
193989 UNUSED_PARAM(pzErr);
193990 UNUSED_PARAM(argv);
193991 UNUSED_PARAM(argc);
193992 UNUSED_PARAM(pAux);
193993 rc = sqlite3_declare_vtab(db,
193994 "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
193995 "json HIDDEN,root HIDDEN)");
193996 if( rc==SQLITE_OK ){
193997 pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
@@ -194010,11 +194255,11 @@
194010
194011 /* constructor for a JsonEachCursor object for json_each(). */
194012 static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
194013 JsonEachCursor *pCur;
194014
194015 UNUSED_PARAM(p);
194016 pCur = sqlite3_malloc( sizeof(*pCur) );
194017 if( pCur==0 ) return SQLITE_NOMEM;
194018 memset(pCur, 0, sizeof(*pCur));
194019 *ppCursor = &pCur->base;
194020 return SQLITE_OK;
@@ -194070,11 +194315,11 @@
194070 u32 iUp = p->sParse.aUp[p->i];
194071 JsonNode *pUp = &p->sParse.aNode[iUp];
194072 p->eType = pUp->eType;
194073 if( pUp->eType==JSON_ARRAY ){
194074 assert( pUp->eU==0 || pUp->eU==3 );
194075 json_testcase( pUp->eU==3 );
194076 VVA( pUp->eU = 3 );
194077 if( iUp==p->i-1 ){
194078 pUp->u.iKey = 0;
194079 }else{
194080 pUp->u.iKey++;
@@ -194257,11 +194502,11 @@
194257 const struct sqlite3_index_constraint *pConstraint;
194258
194259 /* This implementation assumes that JSON and ROOT are the last two
194260 ** columns in the table */
194261 assert( JEACH_ROOT == JEACH_JSON+1 );
194262 UNUSED_PARAM(tab);
194263 aIdx[0] = aIdx[1] = -1;
194264 pConstraint = pIdxInfo->aConstraint;
194265 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
194266 int iCol;
194267 int iMask;
@@ -194313,12 +194558,12 @@
194313 JsonEachCursor *p = (JsonEachCursor*)cur;
194314 const char *z;
194315 const char *zRoot = 0;
194316 sqlite3_int64 n;
194317
194318 UNUSED_PARAM(idxStr);
194319 UNUSED_PARAM(argc);
194320 jsonEachCursorReset(p);
194321 if( idxNum==0 ) return SQLITE_OK;
194322 z = (const char*)sqlite3_value_text(argv[0]);
194323 if( z==0 ) return SQLITE_OK;
194324 n = sqlite3_value_bytes(argv[0]);
@@ -194439,112 +194684,72 @@
194439 0, /* xRelease */
194440 0, /* xRollbackTo */
194441 0 /* xShadowName */
194442 };
194443 #endif /* SQLITE_OMIT_VIRTUALTABLE */
194444
194445 /****************************************************************************
194446 ** The following routines are the only publically visible identifiers in this
194447 ** file. Call the following routines in order to register the various SQL
194448 ** functions and the virtual table implemented by this file.
194449 ****************************************************************************/
194450
194451 SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){
194452 int rc = SQLITE_OK;
194453 unsigned int i;
194454 static const struct {
194455 const char *zName;
194456 int nArg;
194457 int flag;
194458 void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
194459 } aFunc[] = {
194460 { "json", 1, 0, jsonRemoveFunc },
194461 { "json_array", -1, 0, jsonArrayFunc },
194462 { "json_array_length", 1, 0, jsonArrayLengthFunc },
194463 { "json_array_length", 2, 0, jsonArrayLengthFunc },
194464 { "json_extract", -1, 0, jsonExtractFunc },
194465 { "json_insert", -1, 0, jsonSetFunc },
194466 { "json_object", -1, 0, jsonObjectFunc },
194467 { "json_patch", 2, 0, jsonPatchFunc },
194468 { "json_quote", 1, 0, jsonQuoteFunc },
194469 { "json_remove", -1, 0, jsonRemoveFunc },
194470 { "json_replace", -1, 0, jsonReplaceFunc },
194471 { "json_set", -1, 1, jsonSetFunc },
194472 { "json_type", 1, 0, jsonTypeFunc },
194473 { "json_type", 2, 0, jsonTypeFunc },
194474 { "json_valid", 1, 0, jsonValidFunc },
194475
194476 #if SQLITE_DEBUG
194477 /* DEBUG and TESTING functions */
194478 { "json_parse", 1, 0, jsonParseFunc },
194479 { "json_test1", 1, 0, jsonTest1Func },
194480 #endif
194481 };
194482 static const struct {
194483 const char *zName;
194484 int nArg;
194485 void (*xStep)(sqlite3_context*,int,sqlite3_value**);
194486 void (*xFinal)(sqlite3_context*);
194487 void (*xValue)(sqlite3_context*);
194488 } aAgg[] = {
194489 { "json_group_array", 1,
194490 jsonArrayStep, jsonArrayFinal, jsonArrayValue },
194491 { "json_group_object", 2,
194492 jsonObjectStep, jsonObjectFinal, jsonObjectValue },
194493 };
194494 #ifndef SQLITE_OMIT_VIRTUALTABLE
194495 static const struct {
194496 const char *zName;
194497 sqlite3_module *pModule;
 
 
194498 } aMod[] = {
194499 { "json_each", &jsonEachModule },
194500 { "json_tree", &jsonTreeModule },
194501 };
194502 #endif
194503 static const int enc =
194504 SQLITE_UTF8 |
194505 SQLITE_DETERMINISTIC |
194506 SQLITE_INNOCUOUS;
194507 for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
194508 rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc,
194509 (void*)&aFunc[i].flag,
194510 aFunc[i].xFunc, 0, 0);
194511 }
194512 #ifndef SQLITE_OMIT_WINDOWFUNC
194513 for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
194514 rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
194515 SQLITE_SUBTYPE | enc, 0,
194516 aAgg[i].xStep, aAgg[i].xFinal,
194517 aAgg[i].xValue, jsonGroupInverse, 0);
194518 }
194519 #endif
194520 #ifndef SQLITE_OMIT_VIRTUALTABLE
194521 for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
194522 rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
194523 }
194524 #endif
194525 return rc;
194526 }
194527
194528
194529 #ifndef SQLITE_CORE
194530 #ifdef _WIN32
194531 __declspec(dllexport)
194532 #endif
194533 SQLITE_API int sqlite3_json_init(
194534 sqlite3 *db,
194535 char **pzErrMsg,
194536 const sqlite3_api_routines *pApi
194537 ){
194538 SQLITE_EXTENSION_INIT2(pApi);
194539 (void)pzErrMsg; /* Unused parameter */
194540 return sqlite3Json1Init(db);
194541 }
194542 #endif
194543 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) */
194544
194545 /************** End of json1.c ***********************************************/
194546 /************** Begin file rtree.c *******************************************/
194547 /*
194548 ** 2001 September 15
194549 **
194550 ** The author disclaims copyright to this source code. In place of
@@ -198974,15 +199179,11 @@
198974 # define GEODEBUG(X) if(geo_debug)printf X
198975 #else
198976 # define GEODEBUG(X)
198977 #endif
198978
198979 #ifndef JSON_NULL /* The following stuff repeats things found in json1 */
198980 /*
198981 ** Versions of isspace(), isalnum() and isdigit() to which it is safe
198982 ** to pass signed char values.
198983 */
198984 #ifdef sqlite3Isdigit
198985 /* Use the SQLite core versions if this routine is part of the
198986 ** SQLite amalgamation */
198987 # define safe_isdigit(x) sqlite3Isdigit(x)
198988 # define safe_isalnum(x) sqlite3Isalnum(x)
@@ -198993,10 +199194,11 @@
198993 # define safe_isdigit(x) isdigit((unsigned char)(x))
198994 # define safe_isalnum(x) isalnum((unsigned char)(x))
198995 # define safe_isxdigit(x) isxdigit((unsigned char)(x))
198996 #endif
198997
 
198998 /*
198999 ** Growing our own isspace() routine this way is twice as fast as
199000 ** the library isspace() function.
199001 */
199002 static const char geopolyIsSpace[] = {
@@ -199015,11 +199217,11 @@
199015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199016 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199017 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199019 };
199020 #define safe_isspace(x) (geopolyIsSpace[(unsigned char)x])
199021 #endif /* JSON NULL - back to original code */
199022
199023 /* Compiler and version */
199024 #ifndef GCC_VERSION
199025 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
@@ -199104,11 +199306,11 @@
199104 a[2] = t;
199105 }
199106
199107 /* Skip whitespace. Return the next non-whitespace character. */
199108 static char geopolySkipSpace(GeoParse *p){
199109 while( safe_isspace(p->z[0]) ) p->z++;
199110 return p->z[0];
199111 }
199112
199113 /* Parse out a number. Write the value into *pVal if pVal!=0.
199114 ** return non-zero on success and zero if the next token is not a number.
@@ -229084,11 +229286,11 @@
229084 assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
229085
229086 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
229087 int iIdx = 0; /* Index to search */
229088 int iPrefixIdx = 0; /* +1 prefix index */
229089 if( nToken ) memcpy(&buf.p[1], pToken, nToken);
229090
229091 /* Figure out which index to search and set iIdx accordingly. If this
229092 ** is a prefix query for which there is no prefix index, set iIdx to
229093 ** greater than pConfig->nPrefix to indicate that the query will be
229094 ** satisfied by scanning multiple terms in the main index.
@@ -233132,11 +233334,11 @@
233132 int nArg, /* Number of args */
233133 sqlite3_value **apUnused /* Function arguments */
233134 ){
233135 assert( nArg==0 );
233136 UNUSED_PARAM2(nArg, apUnused);
233137 sqlite3_result_text(pCtx, "fts5: 2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882", -1, SQLITE_TRANSIENT);
233138 }
233139
233140 /*
233141 ** Return true if zName is the extension on one of the shadow tables used
233142 ** by this module.
233143
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.38.0"
456 #define SQLITE_VERSION_NUMBER 3038000
457 #define SQLITE_SOURCE_ID "2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -4128,17 +4128,18 @@
4128 **
4129 ** The values returned by sqlite3_errcode() and/or
4130 ** sqlite3_extended_errcode() might change with each API call.
4131 ** Except, there are some interfaces that are guaranteed to never
4132 ** change the value of the error code. The error-code preserving
4133 ** interfaces include the following:
4134 **
4135 ** <ul>
4136 ** <li> sqlite3_errcode()
4137 ** <li> sqlite3_extended_errcode()
4138 ** <li> sqlite3_errmsg()
4139 ** <li> sqlite3_errmsg16()
4140 ** <li> sqlite3_error_offset()
4141 ** </ul>
4142 **
4143 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
4144 ** text that describes the error, as either UTF-8 or UTF-16 respectively.
4145 ** ^(Memory to hold the error message string is managed internally.
@@ -4148,10 +4149,17 @@
4149 **
4150 ** ^The sqlite3_errstr() interface returns the English-language text
4151 ** that describes the [result code], as UTF-8.
4152 ** ^(Memory to hold the error message string is managed internally
4153 ** and must not be freed by the application)^.
4154 **
4155 ** ^If the most recent error references a specific token in the input
4156 ** SQL, the sqlite3_error_offset() interface returns the byte offset
4157 ** of the start of that token. ^The byte offset returned by
4158 ** sqlite3_error_offset() assumes that the input SQL is UTF8.
4159 ** ^If the most error does not reference a specific token in the input
4160 ** SQL, then the sqlite3_error_offset() function returns -1.
4161 **
4162 ** When the serialized [threading mode] is in use, it might be the
4163 ** case that a second error occurs on a separate thread in between
4164 ** the time of the first error and the call to these interfaces.
4165 ** When that happens, the second error will be reported since these
@@ -4168,10 +4176,11 @@
4176 SQLITE_API int sqlite3_errcode(sqlite3 *db);
4177 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
4178 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
4179 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
4180 SQLITE_API const char *sqlite3_errstr(int);
4181 SQLITE_API int sqlite3_error_offset(sqlite3 *db);
4182
4183 /*
4184 ** CAPI3REF: Prepared Statement Object
4185 ** KEYWORDS: {prepared statement} {prepared statements}
4186 **
@@ -9768,18 +9777,37 @@
9777
9778 /*
9779 ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9780 **
9781 ** This function may only be called from within a call to the [xBestIndex]
9782 ** method of a [virtual table]. This function returns a pointer to a string
9783 ** that is the name of the appropriate collation sequence to use for text
9784 ** comparisons on the constraint identified by its arguments.
9785 **
9786 ** The first argument must be the pointer to the sqlite3_index_info object
9787 ** that is the first parameter to the xBestIndex() method. The second argument
9788 ** must be an index into the aConstraint[] array belonging to the
9789 ** sqlite3_index_info structure passed to xBestIndex.
9790 **
9791 ** Important:
9792 ** The first parameter must be the same pointer that is passed into the
9793 ** xBestMethod() method. The first parameter may not be a pointer to a
9794 ** different sqlite3_index_info object, even an exact copy.
9795 **
9796 ** The return value is computed as follows:
9797 **
9798 ** <ol>
9799 ** <li><p> If the constraint comes from a WHERE clause expression that contains
9800 ** a [COLLATE operator], then the name of the collation specified by
9801 ** that COLLATE operator is returned.
9802 ** <li><p> If there is no COLLATE operator, but the column that is the subject
9803 ** of the constraint specifies an alternative collating sequence via
9804 ** a [COLLATE clause] on the column definition within the CREATE TABLE
9805 ** statement that was passed into [sqlite3_declare_vtab()], then the
9806 ** name of that alternative collating sequence is returned.
9807 ** <li><p> Otherwise, "BINARY" is returned.
9808 ** </ol>
9809 */
9810 SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9811
9812 /*
9813 ** CAPI3REF: Conflict resolution modes
@@ -13565,14 +13593,14 @@
13593 #define TK_DETACH 40
13594 #define TK_EACH 41
13595 #define TK_FAIL 42
13596 #define TK_OR 43
13597 #define TK_AND 44
13598 #define TK_IS 45
13599 #define TK_MATCH 46
13600 #define TK_LIKE_KW 47
13601 #define TK_BETWEEN 48
13602 #define TK_IN 49
13603 #define TK_ISNULL 50
13604 #define TK_NOTNULL 51
13605 #define TK_NE 52
13606 #define TK_EQ 53
@@ -13632,82 +13660,83 @@
13660 #define TK_MINUS 107
13661 #define TK_STAR 108
13662 #define TK_SLASH 109
13663 #define TK_REM 110
13664 #define TK_CONCAT 111
13665 #define TK_PTR 112
13666 #define TK_COLLATE 113
13667 #define TK_BITNOT 114
13668 #define TK_ON 115
13669 #define TK_INDEXED 116
13670 #define TK_STRING 117
13671 #define TK_JOIN_KW 118
13672 #define TK_CONSTRAINT 119
13673 #define TK_DEFAULT 120
13674 #define TK_NULL 121
13675 #define TK_PRIMARY 122
13676 #define TK_UNIQUE 123
13677 #define TK_CHECK 124
13678 #define TK_REFERENCES 125
13679 #define TK_AUTOINCR 126
13680 #define TK_INSERT 127
13681 #define TK_DELETE 128
13682 #define TK_UPDATE 129
13683 #define TK_SET 130
13684 #define TK_DEFERRABLE 131
13685 #define TK_FOREIGN 132
13686 #define TK_DROP 133
13687 #define TK_UNION 134
13688 #define TK_ALL 135
13689 #define TK_EXCEPT 136
13690 #define TK_INTERSECT 137
13691 #define TK_SELECT 138
13692 #define TK_VALUES 139
13693 #define TK_DISTINCT 140
13694 #define TK_DOT 141
13695 #define TK_FROM 142
13696 #define TK_JOIN 143
13697 #define TK_USING 144
13698 #define TK_ORDER 145
13699 #define TK_GROUP 146
13700 #define TK_HAVING 147
13701 #define TK_LIMIT 148
13702 #define TK_WHERE 149
13703 #define TK_RETURNING 150
13704 #define TK_INTO 151
13705 #define TK_NOTHING 152
13706 #define TK_FLOAT 153
13707 #define TK_BLOB 154
13708 #define TK_INTEGER 155
13709 #define TK_VARIABLE 156
13710 #define TK_CASE 157
13711 #define TK_WHEN 158
13712 #define TK_THEN 159
13713 #define TK_ELSE 160
13714 #define TK_INDEX 161
13715 #define TK_ALTER 162
13716 #define TK_ADD 163
13717 #define TK_WINDOW 164
13718 #define TK_OVER 165
13719 #define TK_FILTER 166
13720 #define TK_COLUMN 167
13721 #define TK_AGG_FUNCTION 168
13722 #define TK_AGG_COLUMN 169
13723 #define TK_TRUEFALSE 170
13724 #define TK_ISNOT 171
13725 #define TK_FUNCTION 172
13726 #define TK_UMINUS 173
13727 #define TK_UPLUS 174
13728 #define TK_TRUTH 175
13729 #define TK_REGISTER 176
13730 #define TK_VECTOR 177
13731 #define TK_SELECT_COLUMN 178
13732 #define TK_IF_NULL_ROW 179
13733 #define TK_ASTERISK 180
13734 #define TK_SPAN 181
13735 #define TK_ERROR 182
13736 #define TK_SPACE 183
13737 #define TK_ILLEGAL 184
13738
13739 /************** End of parse.h ***********************************************/
13740 /************** Continuing where we left off in sqliteInt.h ******************/
13741 #include <stdio.h>
13742 #include <stdlib.h>
@@ -15314,15 +15343,15 @@
15343 #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15344 #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15345 #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15346 #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15347 #define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */
15348 #define OP_OpenDup 113
15349 #define OP_BitNot 114 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15350 #define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
15351 #define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */
15352 #define OP_String8 117 /* same as TK_STRING, synopsis: r[P2]='P4' */
15353 #define OP_SorterOpen 118
15354 #define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15355 #define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */
15356 #define OP_Close 121
15357 #define OP_ColumnsUsed 122
@@ -15353,12 +15382,12 @@
15382 #define OP_SqlExec 147
15383 #define OP_ParseSchema 148
15384 #define OP_LoadAnalysis 149
15385 #define OP_DropTable 150
15386 #define OP_DropIndex 151
15387 #define OP_DropTrigger 152
15388 #define OP_Real 153 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15389 #define OP_IntegrityCk 154
15390 #define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */
15391 #define OP_Param 156
15392 #define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */
15393 #define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */
@@ -15411,16 +15440,16 @@
15440 /* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
15441 /* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\
15442 /* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\
15443 /* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
15444 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15445 /* 112 */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00,\
15446 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15447 /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
15448 /* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\
15449 /* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15450 /* 152 */ 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\
15451 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15452 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
15453 /* 176 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
15454 }
15455
@@ -16489,10 +16518,11 @@
16518 i64 lastRowid; /* ROWID of most recent insert (see above) */
16519 i64 szMmap; /* Default mmap_size setting */
16520 u32 nSchemaLock; /* Do not reset the schema when non-zero */
16521 unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
16522 int errCode; /* Most recent error code (SQLITE_*) */
16523 int errByteOffset; /* Byte offset of error in SQL statement */
16524 int errMask; /* & result codes with this before returning */
16525 int iSysErrno; /* Errno value from last system error */
16526 u32 dbOptFlags; /* Flags to enable/disable optimizations */
16527 u8 enc; /* Text encoding */
16528 u8 autoCommit; /* The auto-commit flag. */
@@ -16725,10 +16755,11 @@
16755 #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
16756 #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
16757 /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
16758 #define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
16759 #define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
16760 #define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */
16761 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
16762
16763 /*
16764 ** Macros for testing whether or not optimizations are enabled or disabled.
16765 */
@@ -16898,11 +16929,11 @@
16929 ** Used to create an aggregate function definition implemented by
16930 ** the C functions xStep and xFinal. The first four parameters
16931 ** are interpreted in the same way as the first 4 parameters to
16932 ** FUNCTION().
16933 **
16934 ** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
16935 ** Used to create an aggregate function definition implemented by
16936 ** the C functions xStep and xFinal. The first four parameters
16937 ** are interpreted in the same way as the first 4 parameters to
16938 ** FUNCTION().
16939 **
@@ -16925,10 +16956,14 @@
16956 {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
16957 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
16958 #define MFUNCTION(zName, nArg, xPtr, xFunc) \
16959 {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
16960 xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
16961 #define JFUNCTION(zName, nArg, iArg, xFunc) \
16962 {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS|\
16963 SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
16964 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
16965 #define INLINE_FUNC(zName, nArg, iArg, mFlags) \
16966 {nArg, SQLITE_FUNC_BUILTIN|\
16967 SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
16968 SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
16969 #define TEST_FUNC(zName, nArg, iArg, mFlags) \
@@ -18519,10 +18554,12 @@
18554 TableLock *aTableLock; /* Required table locks for shared-cache mode */
18555 #endif
18556 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
18557 Parse *pToplevel; /* Parse structure for main program (or NULL) */
18558 Table *pTriggerTab; /* Table triggers are being coded for */
18559 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
18560 ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
18561 union {
18562 int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
18563 Returning *pReturning; /* The RETURNING clause */
18564 } u1;
18565 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -18573,13 +18610,11 @@
18610 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
18611 #ifndef SQLITE_OMIT_VIRTUALTABLE
18612 Token sArg; /* Complete text of a module argument */
18613 Table **apVtabLock; /* Pointer to virtual tables needing locking */
18614 #endif
 
18615 With *pWith; /* Current WITH clause, or NULL */
 
18616 #ifndef SQLITE_OMIT_ALTERTABLE
18617 RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
18618 #endif
18619 };
18620
@@ -19366,11 +19401,11 @@
19401 SQLITE_PRIVATE void sqlite3Dequote(char*);
19402 SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
19403 SQLITE_PRIVATE void sqlite3DequoteToken(Token*);
19404 SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*);
19405 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);
19406 SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*);
19407 SQLITE_PRIVATE void sqlite3FinishCoding(Parse*);
19408 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
19409 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
19410 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
19411 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
@@ -19646,13 +19681,18 @@
19681 SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,const IdList*);
19682 SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int);
19683 SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*);
19684 SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int);
19685 SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
19686 SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum*,sqlite3_value*);
19687 SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void);
19688 SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void);
19689 SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void);
19690 SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);
19691 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
19692 SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3*);
19693 #endif
19694 SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*);
19695 SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*);
19696 SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int);
19697 SQLITE_PRIVATE With *sqlite3WithDup(sqlite3 *db, With *p);
19698
@@ -19932,15 +19972,17 @@
19972 SQLITE_PRIVATE void sqlite3OomClear(sqlite3*);
19973 SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);
19974 SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
19975
19976 SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int);
19977 SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum*, int);
19978 SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
19979 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8);
19980 SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
19981 SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
19982 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
19983 SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3*,const char*);
19984
19985 SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
19986 SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
19987
19988 #ifndef SQLITE_OMIT_SUBQUERY
@@ -20104,17 +20146,19 @@
20146 SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*);
20147 SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int);
20148 SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int);
20149 SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*);
20150 SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *);
20151 SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3*,int);
20152 #else
20153 #define sqlite3FkActions(a,b,c,d,e,f)
20154 #define sqlite3FkCheck(a,b,c,d,e,f)
20155 #define sqlite3FkDropTable(a,b,c)
20156 #define sqlite3FkOldmask(a,b) 0
20157 #define sqlite3FkRequired(a,b,c,d) 0
20158 #define sqlite3FkReferences(a) 0
20159 #define sqlite3FkClearTriggerCache(a,b)
20160 #endif
20161 #ifndef SQLITE_OMIT_FOREIGN_KEY
20162 SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*);
20163 SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);
20164 #else
@@ -20656,10 +20700,13 @@
20700 #ifdef SQLITE_DISABLE_FTS4_DEFERRED
20701 "DISABLE_FTS4_DEFERRED",
20702 #endif
20703 #ifdef SQLITE_DISABLE_INTRINSIC
20704 "DISABLE_INTRINSIC",
20705 #endif
20706 #ifdef SQLITE_DISABLE_JSON
20707 "DISABLE_JSON",
20708 #endif
20709 #ifdef SQLITE_DISABLE_LFS
20710 "DISABLE_LFS",
20711 #endif
20712 #ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
@@ -20735,13 +20782,10 @@
20782 "ENABLE_ICU",
20783 #endif
20784 #ifdef SQLITE_ENABLE_IOTRACE
20785 "ENABLE_IOTRACE",
20786 #endif
 
 
 
20787 #ifdef SQLITE_ENABLE_LOAD_EXTENSION
20788 "ENABLE_LOAD_EXTENSION",
20789 #endif
20790 #ifdef SQLITE_ENABLE_LOCKING_STYLE
20791 "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
@@ -21764,11 +21808,11 @@
21808 ** * A one-row "pseudotable" stored in a single register
21809 */
21810 typedef struct VdbeCursor VdbeCursor;
21811 struct VdbeCursor {
21812 u8 eCurType; /* One of the CURTYPE_* values above */
21813 i8 iDb; /* Index of cursor database in db->aDb[] */
21814 u8 nullRow; /* True if pointing to a row with no data */
21815 u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
21816 u8 isTable; /* True for rowid tables. False for indexes */
21817 #ifdef SQLITE_DEBUG
21818 u8 seekOp; /* Most recent seek operation on this cursor */
@@ -21777,13 +21821,15 @@
21821 Bool isEphemeral:1; /* True for an ephemeral table */
21822 Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
21823 Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
21824 Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */
21825 u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
21826 union { /* pBtx for isEphermeral. pAltMap otherwise */
21827 Btree *pBtx; /* Separate file holding temporary table */
21828 u32 *aAltMap; /* Mapping from table to index column numbers */
21829 } ub;
21830 i64 seqCount; /* Sequence counter */
 
21831
21832 /* Cached OP_Column parse information is only valid if cacheStatus matches
21833 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
21834 ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that
21835 ** the cache is out of date. */
@@ -22181,11 +22227,11 @@
22227 SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor**, u32*);
22228 SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*);
22229 SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32);
22230 SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8);
22231 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
22232 SQLITE_PRIVATE void sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
22233 SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
22234
22235 int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
22236 SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
22237 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
@@ -23319,22 +23365,21 @@
23365 **
23366 ** Where NNN is an arbitrary floating-point number and "days" can be one
23367 ** of several units of time.
23368 */
23369 static const struct {
23370 u8 nName; /* Length of the name */
23371 char zName[7]; /* Name of the transformation */
23372 float rLimit; /* Maximum NNN value for this transform */
23373 float rXform; /* Constant used for this transform */
 
23374 } aXformType[] = {
23375 { 6, "second", 4.6427e+14, 1.0 },
23376 { 6, "minute", 7.7379e+12, 60.0 },
23377 { 4, "hour", 1.2897e+11, 3600.0 },
23378 { 3, "day", 5373485.0, 86400.0 },
23379 { 5, "month", 176546.0, 2592000.0 },
23380 { 4, "year", 14713.0, 31536000.0 },
23381 };
23382
23383 /*
23384 ** Process a modifier to a date-time stamp. The modifiers are
23385 ** as follows:
@@ -23567,33 +23612,35 @@
23612 for(i=0; i<ArraySize(aXformType); i++){
23613 if( aXformType[i].nName==n
23614 && sqlite3_strnicmp(aXformType[i].zName, z, n)==0
23615 && r>-aXformType[i].rLimit && r<aXformType[i].rLimit
23616 ){
23617 switch( i ){
23618 case 4: { /* Special processing to add months */
23619 int x;
23620 assert( strcmp(aXformType[i].zName,"month")==0 );
23621 computeYMD_HMS(p);
23622 p->M += (int)r;
23623 x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
23624 p->Y += x;
23625 p->M -= x*12;
23626 p->validJD = 0;
23627 r -= (int)r;
23628 break;
23629 }
23630 case 5: { /* Special processing to add years */
23631 int y = (int)r;
23632 assert( strcmp(aXformType[i].zName,"year")==0 );
23633 computeYMD_HMS(p);
23634 p->Y += y;
23635 p->validJD = 0;
23636 r -= (int)r;
23637 break;
23638 }
23639 }
23640 computeJD(p);
23641 p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
23642 rc = 0;
23643 break;
23644 }
23645 }
23646 clearYMD_HMS_TZ(p);
@@ -29835,10 +29882,11 @@
29882 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
29883 pToken = va_arg(ap, Token*);
29884 assert( bArgList==0 );
29885 if( pToken && pToken->n ){
29886 sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
29887 sqlite3RecordErrorByteOffset(pAccum->db, pToken->z);
29888 }
29889 length = width = 0;
29890 break;
29891 }
29892 case etSRCITEM: {
@@ -29889,18 +29937,42 @@
29937 zExtra = 0;
29938 }
29939 }/* End for loop over the format string */
29940 } /* End of function */
29941
29942
29943 /*
29944 ** The z string points to the first character of a token that is
29945 ** associated with an error. If db does not already have an error
29946 ** byte offset recorded, try to compute the error byte offset for
29947 ** z and set the error byte offset in db.
29948 */
29949 SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
29950 const Parse *pParse;
29951 const char *zText;
29952 const char *zEnd;
29953 assert( z!=0 );
29954 if( NEVER(db==0) ) return;
29955 if( db->errByteOffset!=(-2) ) return;
29956 pParse = db->pParse;
29957 if( NEVER(pParse==0) ) return;
29958 zText =pParse->zTail;
29959 if( NEVER(zText==0) ) return;
29960 zEnd = &zText[strlen(zText)];
29961 if( SQLITE_WITHIN(z,zText,zEnd) ){
29962 db->errByteOffset = (int)(z-zText);
29963 }
29964 }
29965
29966 /*
29967 ** Enlarge the memory allocation on a StrAccum object so that it is
29968 ** able to accept at least N more bytes of text.
29969 **
29970 ** Return the number of bytes of text that StrAccum is able to accept
29971 ** after the attempted enlargement. The value returned might be zero.
29972 */
29973 SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum *p, int N){
29974 char *zNew;
29975 assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */
29976 if( p->accError ){
29977 testcase(p->accError==SQLITE_TOOBIG);
29978 testcase(p->accError==SQLITE_NOMEM);
@@ -32212,20 +32284,25 @@
32284 ** that would be appropriate.
32285 */
32286 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
32287 assert( db!=0 );
32288 db->errCode = err_code;
32289 if( err_code || db->pErr ){
32290 sqlite3ErrorFinish(db, err_code);
32291 }else{
32292 db->errByteOffset = -1;
32293 }
32294 }
32295
32296 /*
32297 ** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
32298 ** and error message.
32299 */
32300 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
32301 assert( db!=0 );
32302 db->errCode = SQLITE_OK;
32303 db->errByteOffset = -1;
32304 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
32305 }
32306
32307 /*
32308 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
@@ -32242,21 +32319,12 @@
32319 /*
32320 ** Set the most recent error code and error string for the sqlite
32321 ** handle "db". The error code is set to "err_code".
32322 **
32323 ** If it is not NULL, string zFormat specifies the format of the
32324 ** error string. zFormat and any string tokens that follow it are
32325 ** assumed to be encoded in UTF-8.
 
 
 
 
 
 
 
 
 
32326 **
32327 ** To clear the most recent error for sqlite handle "db", sqlite3Error
32328 ** should be called with err_code set to SQLITE_OK and zFormat set
32329 ** to NULL.
32330 */
@@ -32276,17 +32344,10 @@
32344 }
32345 }
32346
32347 /*
32348 ** Add an error message to pParse->zErrMsg and increment pParse->nErr.
 
 
 
 
 
 
 
32349 **
32350 ** This function should be used to report any error that occurs while
32351 ** compiling an SQL statement (i.e. within sqlite3_prepare()). The
32352 ** last thing the sqlite3_prepare() function does is copy the error
32353 ** stored by this function into the database handle using sqlite3Error().
@@ -32295,13 +32356,15 @@
32356 */
32357 SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
32358 char *zMsg;
32359 va_list ap;
32360 sqlite3 *db = pParse->db;
32361 db->errByteOffset = -2;
32362 va_start(ap, zFormat);
32363 zMsg = sqlite3VMPrintf(db, zFormat, ap);
32364 va_end(ap);
32365 if( db->errByteOffset<-1 ) db->errByteOffset = -1;
32366 if( db->suppressErr ){
32367 sqlite3DbFree(db, zMsg);
32368 }else{
32369 pParse->nErr++;
32370 sqlite3DbFree(db, pParse->zErrMsg);
@@ -34211,15 +34274,15 @@
34274 /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
34275 /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
34276 /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
34277 /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
34278 /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
34279 /* 113 */ "OpenDup" OpHelp(""),
34280 /* 114 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
34281 /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
34282 /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"),
34283 /* 117 */ "String8" OpHelp("r[P2]='P4'"),
34284 /* 118 */ "SorterOpen" OpHelp(""),
34285 /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
34286 /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
34287 /* 121 */ "Close" OpHelp(""),
34288 /* 122 */ "ColumnsUsed" OpHelp(""),
@@ -34250,12 +34313,12 @@
34313 /* 147 */ "SqlExec" OpHelp(""),
34314 /* 148 */ "ParseSchema" OpHelp(""),
34315 /* 149 */ "LoadAnalysis" OpHelp(""),
34316 /* 150 */ "DropTable" OpHelp(""),
34317 /* 151 */ "DropIndex" OpHelp(""),
34318 /* 152 */ "DropTrigger" OpHelp(""),
34319 /* 153 */ "Real" OpHelp("r[P2]=P4"),
34320 /* 154 */ "IntegrityCk" OpHelp(""),
34321 /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
34322 /* 156 */ "Param" OpHelp(""),
34323 /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
34324 /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
@@ -56614,12 +56677,11 @@
56677 **
56678 ** a) The page number is less than or equal to the size of the
56679 ** current database image, in pages, OR
56680 **
56681 ** b) if the page content were written at this time, it would not
56682 ** be necessary to write the current content out to the sub-journal.
 
56683 **
56684 ** If the condition asserted by this function were not true, and the
56685 ** dirty page were to be discarded from the cache via the pagerStress()
56686 ** routine, pagerStress() would not write the current page content to
56687 ** the database file. If a savepoint transaction were rolled back after
@@ -56630,12 +56692,20 @@
56692 ** database image would become corrupt. It is therefore fortunate that
56693 ** this circumstance cannot arise.
56694 */
56695 #if defined(SQLITE_DEBUG)
56696 static void assertTruncateConstraintCb(PgHdr *pPg){
56697 Pager *pPager = pPg->pPager;
56698 assert( pPg->flags&PGHDR_DIRTY );
56699 if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */
56700 Pgno pgno = pPg->pgno;
56701 int i;
56702 for(i=0; i<pPg->pPager->nSavepoint; i++){
56703 PagerSavepoint *p = &pPager->aSavepoint[i];
56704 assert( p->nOrig<pgno || sqlite3BitvecTestNotNull(p->pInSavepoint,pgno) );
56705 }
56706 }
56707 }
56708 static void assertTruncateConstraint(Pager *pPager){
56709 sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
56710 }
56711 #else
@@ -57972,11 +58042,11 @@
58042 ** other connection managed to get in and roll it back before
58043 ** this connection obtained the exclusive lock above. Or, it
58044 ** may mean that the pager was in the error-state when this
58045 ** function was called and the journal file does not exist.
58046 */
58047 if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
58048 sqlite3_vfs * const pVfs = pPager->pVfs;
58049 int bExists; /* True if journal file exists */
58050 rc = sqlite3OsAccess(
58051 pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);
58052 if( rc==SQLITE_OK && bExists ){
@@ -58374,10 +58444,11 @@
58444 Pager *pPager, /* The pager open on the database file */
58445 Pgno pgno, /* Page number to fetch */
58446 DbPage **ppPage, /* Write a pointer to the page here */
58447 int flags /* PAGER_GET_XXX flags */
58448 ){
58449 /* printf("PAGE %u\n", pgno); fflush(stdout); */
58450 return pPager->xGet(pPager, pgno, ppPage, flags);
58451 }
58452
58453 /*
58454 ** Acquire a page if it is already in the in-memory cache. Do
@@ -59979,16 +60050,16 @@
60050 */
60051 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
60052 u8 eOld = pPager->journalMode; /* Prior journalmode */
60053
60054 /* The eMode parameter is always valid */
60055 assert( eMode==PAGER_JOURNALMODE_DELETE /* 0 */
60056 || eMode==PAGER_JOURNALMODE_PERSIST /* 1 */
60057 || eMode==PAGER_JOURNALMODE_OFF /* 2 */
60058 || eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */
60059 || eMode==PAGER_JOURNALMODE_MEMORY /* 4 */
60060 || eMode==PAGER_JOURNALMODE_WAL /* 5 */ );
60061
60062 /* This routine is only called from the OP_JournalMode opcode, and
60063 ** the logic there will never allow a temporary file to be changed
60064 ** to WAL mode.
60065 */
@@ -60021,11 +60092,10 @@
60092 assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
60093 assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
60094
60095 assert( isOpen(pPager->fd) || pPager->exclusiveMode );
60096 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
 
60097 /* In this case we would like to delete the journal file. If it is
60098 ** not possible, then that is not a problem. Deleting the journal file
60099 ** here is an optimization only.
60100 **
60101 ** Before deleting the journal file, obtain a RESERVED lock on the
@@ -66854,32 +66924,46 @@
66924
66925 /* The next block of code is equivalent to:
66926 **
66927 ** pIter += getVarint(pIter, (u64*)&pInfo->nKey);
66928 **
66929 ** The code is inlined and the loop is unrolled for performance.
66930 ** This routine is a high-runner.
66931 */
66932 iKey = *pIter;
66933 if( iKey>=0x80 ){
66934 u8 x;
66935 iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
66936 if( x>=0x80 ){
66937 iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
66938 if( x>=0x80 ){
66939 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66940 if( x>=0x80 ){
66941 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66942 if( x>=0x80 ){
66943 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66944 if( x>=0x80 ){
66945 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66946 if( x>=0x80 ){
66947 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
66948 if( x>=0x80 ){
66949 iKey = (iKey<<8) | (*++pIter);
66950 }
66951 }
66952 }
66953 }
66954 }
66955 }
66956 }
66957 }
66958 pIter++;
66959
66960 pInfo->nKey = *(i64*)&iKey;
66961 pInfo->nPayload = nPayload;
66962 pInfo->pPayload = pIter;
66963 testcase( nPayload==pPage->maxLocal );
66964 testcase( nPayload==(u32)pPage->maxLocal+1 );
66965 if( nPayload<=pPage->maxLocal ){
66966 /* This is the (easy) common case where the entire payload fits
66967 ** on the local page. No overflow is required.
66968 */
66969 pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66912,11 +66996,11 @@
66996 pIter++;
66997 pInfo->nKey = nPayload;
66998 pInfo->nPayload = nPayload;
66999 pInfo->pPayload = pIter;
67000 testcase( nPayload==pPage->maxLocal );
67001 testcase( nPayload==(u32)pPage->maxLocal+1 );
67002 if( nPayload<=pPage->maxLocal ){
67003 /* This is the (easy) common case where the entire payload fits
67004 ** on the local page. No overflow is required.
67005 */
67006 pInfo->nSize = nPayload + (u16)(pIter - pCell);
@@ -66975,19 +67059,19 @@
67059 ** past the end of the key value. */
67060 pEnd = &pIter[9];
67061 while( (*pIter++)&0x80 && pIter<pEnd );
67062 }
67063 testcase( nSize==pPage->maxLocal );
67064 testcase( nSize==(u32)pPage->maxLocal+1 );
67065 if( nSize<=pPage->maxLocal ){
67066 nSize += (u32)(pIter - pCell);
67067 if( nSize<4 ) nSize = 4;
67068 }else{
67069 int minLocal = pPage->minLocal;
67070 nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
67071 testcase( nSize==pPage->maxLocal );
67072 testcase( nSize==(u32)pPage->maxLocal+1 );
67073 if( nSize>pPage->maxLocal ){
67074 nSize = minLocal;
67075 }
67076 nSize += 4 + (u16)(pIter - pCell);
67077 }
@@ -69882,11 +69966,11 @@
69966 */
69967 static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
69968 int nPage = get4byte(&pPage1->aData[28]);
69969 testcase( nPage==0 );
69970 if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
69971 testcase( pBt->nPage!=(u32)nPage );
69972 pBt->nPage = nPage;
69973 }
69974
69975 /*
69976 ** Rollback the transaction in progress.
@@ -70903,11 +70987,11 @@
70987 if( pCur->iPage ){
70988 releasePageNotNull(pCur->pPage);
70989 while( --pCur->iPage ){
70990 releasePageNotNull(pCur->apPage[pCur->iPage]);
70991 }
70992 pRoot = pCur->pPage = pCur->apPage[0];
70993 goto skip_init;
70994 }
70995 }else if( pCur->pgnoRoot==0 ){
70996 pCur->eState = CURSOR_INVALID;
70997 return SQLITE_EMPTY;
@@ -70950,11 +71034,10 @@
71034 skip_init:
71035 pCur->ix = 0;
71036 pCur->info.nSize = 0;
71037 pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
71038
 
71039 if( pRoot->nCell>0 ){
71040 pCur->eState = CURSOR_VALID;
71041 }else if( !pRoot->leaf ){
71042 Pgno subpage;
71043 if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
@@ -71191,11 +71274,10 @@
71274 assert( pPage->intKey );
71275 lwr = 0;
71276 upr = pPage->nCell-1;
71277 assert( biasRight==0 || biasRight==1 );
71278 idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
 
71279 for(;;){
71280 i64 nCellKey;
71281 pCell = findCellPastPtr(pPage, idx);
71282 if( pPage->intKeyLeaf ){
71283 while( 0x80 <= *(pCell++) ){
@@ -71333,11 +71415,10 @@
71415 assert( pPage->nCell>0 );
71416 assert( pPage->intKey==(pIdxKey==0) );
71417 lwr = 0;
71418 upr = pPage->nCell-1;
71419 idx = upr>>1; /* idx = (lwr+upr)/2; */
 
71420 for(;;){
71421 int nCell; /* Size of the pCell cell in bytes */
71422 pCell = findCellPastPtr(pPage, idx);
71423
71424 /* The maximum supported page-size is 65536 bytes. This means that
@@ -72449,20 +72530,22 @@
72530 u8 *ptr; /* Used to move bytes around within data[] */
72531 int rc; /* The return code */
72532 int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
72533
72534 if( *pRC ) return;
72535 assert( idx>=0 );
72536 assert( idx<pPage->nCell );
72537 assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
72538 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
72539 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
72540 assert( pPage->nFree>=0 );
72541 data = pPage->aData;
72542 ptr = &pPage->aCellIdx[2*idx];
72543 assert( pPage->pBt->usableSize > (u32)(ptr-data) );
72544 pc = get2byte(ptr);
72545 hdr = pPage->hdrOffset;
72546 testcase( pc==(u32)get2byte(&data[hdr+5]) );
72547 testcase( pc+sz==pPage->pBt->usableSize );
72548 if( pc+sz > pPage->pBt->usableSize ){
72549 *pRC = SQLITE_CORRUPT_BKPT;
72550 return;
72551 }
@@ -72750,11 +72833,11 @@
72833 int k; /* Current slot in pCArray->apEnd[] */
72834 u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
72835
72836 assert( i<iEnd );
72837 j = get2byte(&aData[hdr+5]);
72838 if( j>(u32)usableSize ){ j = 0; }
72839 memcpy(&pTmp[j], &aData[j], usableSize - j);
72840
72841 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
72842 pSrcEnd = pCArray->apEnd[k];
72843
@@ -72981,11 +73064,11 @@
73064 nCell -= nTail;
73065 }
73066
73067 pData = &aData[get2byteNotZero(&aData[hdr+5])];
73068 if( pData<pBegin ) goto editpage_fail;
73069 if( pData>pPg->aDataEnd ) goto editpage_fail;
73070
73071 /* Add cells to the start of the page */
73072 if( iNew<iOld ){
73073 int nAdd = MIN(nNew,iOld-iNew);
73074 assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
@@ -74857,18 +74940,17 @@
74940 ** but which might be used by alternative storage engines.
74941 */
74942 SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
74943 Btree *p = pCur->pBtree;
74944 BtShared *pBt = p->pBt;
74945 int rc; /* Return code */
74946 MemPage *pPage; /* Page to delete cell from */
74947 unsigned char *pCell; /* Pointer to cell to delete */
74948 int iCellIdx; /* Index of cell to delete */
74949 int iCellDepth; /* Depth of node containing pCell */
74950 CellInfo info; /* Size of the cell being deleted */
74951 u8 bPreserve; /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */
 
74952
74953 assert( cursorOwnsBtShared(pCur) );
74954 assert( pBt->inTransaction==TRANS_WRITE );
74955 assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
74956 assert( pCur->curFlags & BTCF_WriteFlag );
@@ -74883,22 +74965,35 @@
74965 assert( CORRUPT_DB || pCur->eState==CURSOR_VALID );
74966
74967 iCellDepth = pCur->iPage;
74968 iCellIdx = pCur->ix;
74969 pPage = pCur->pPage;
74970 if( pPage->nCell<=iCellIdx ){
74971 return SQLITE_CORRUPT_BKPT;
74972 }
74973 pCell = findCell(pPage, iCellIdx);
74974 if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
74975 return SQLITE_CORRUPT_BKPT;
74976 }
74977
74978 /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
74979 ** be preserved following this delete operation. If the current delete
74980 ** will cause a b-tree rebalance, then this is done by saving the cursor
74981 ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
74982 ** returning.
74983 **
74984 ** If the current delete will not cause a rebalance, then the cursor
74985 ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately
74986 ** before or after the deleted entry.
74987 **
74988 ** The bPreserve value records which path is required:
74989 **
74990 ** bPreserve==0 Not necessary to save the cursor position
74991 ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position
74992 ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT.
74993 */
74994 bPreserve = (flags & BTREE_SAVEPOSITION)!=0;
74995 if( bPreserve ){
74996 if( !pPage->leaf
74997 || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)
74998 || pPage->nCell==1 /* See dbfuzz001.test for a test case */
74999 ){
@@ -74905,11 +75000,11 @@
75000 /* A b-tree rebalance will be required after deleting this entry.
75001 ** Save the cursor key. */
75002 rc = saveCursorKey(pCur);
75003 if( rc ) return rc;
75004 }else{
75005 bPreserve = 2;
75006 }
75007 }
75008
75009 /* If the page containing the entry to delete is not a leaf page, move
75010 ** the cursor to the largest entry in the tree that is smaller than
@@ -75005,12 +75100,12 @@
75100 pCur->pPage = pCur->apPage[pCur->iPage];
75101 rc = balance(pCur);
75102 }
75103
75104 if( rc==SQLITE_OK ){
75105 if( bPreserve>1 ){
75106 assert( (pCur->iPage==iCellDepth || CORRUPT_DB) );
75107 assert( pPage==pCur->pPage || CORRUPT_DB );
75108 assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
75109 pCur->eState = CURSOR_SKIPNEXT;
75110 if( iCellIdx>=pPage->nCell ){
75111 pCur->skipNext = -1;
@@ -81704,12 +81799,10 @@
81799 */
81800 SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
81801 if( pCx==0 ){
81802 return;
81803 }
 
 
81804 switch( pCx->eCurType ){
81805 case CURTYPE_SORTER: {
81806 sqlite3VdbeSorterClose(p->db, pCx);
81807 break;
81808 }
@@ -82807,11 +82900,11 @@
82900 VdbeCursor *p = *pp;
82901 assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
82902 if( p->deferredMoveto ){
82903 u32 iMap;
82904 assert( !p->isEphemeral );
82905 if( p->ub.aAltMap && (iMap = p->ub.aAltMap[1+*piCol])>0 && !p->nullRow ){
82906 *pp = p->pAltCursor;
82907 *piCol = iMap - 1;
82908 return SQLITE_OK;
82909 }
82910 return sqlite3VdbeFinishMoveto(p);
@@ -83085,18 +83178,18 @@
83178 #define FOUR_BYTE_UINT(x) (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
83179 #define FOUR_BYTE_INT(x) (16777216*(i8)((x)[0])|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
83180
83181 /*
83182 ** Deserialize the data blob pointed to by buf as serial type serial_type
83183 ** and store the result in pMem.
83184 **
83185 ** This function is implemented as two separate routines for performance.
83186 ** The few cases that require local variables are broken out into a separate
83187 ** routine so that in most cases the overhead of moving the stack pointer
83188 ** is avoided.
83189 */
83190 static void serialGet(
83191 const unsigned char *buf, /* Buffer to deserialize from */
83192 u32 serial_type, /* Serial type to deserialize */
83193 Mem *pMem /* Memory cell to write value into */
83194 ){
83195 u64 x = FOUR_BYTE_UINT(buf);
@@ -83126,13 +83219,12 @@
83219 assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
83220 swapMixedEndianFloat(x);
83221 memcpy(&pMem->u.r, &x, sizeof(x));
83222 pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
83223 }
 
83224 }
83225 SQLITE_PRIVATE void sqlite3VdbeSerialGet(
83226 const unsigned char *buf, /* Buffer to deserialize from */
83227 u32 serial_type, /* Serial type to deserialize */
83228 Mem *pMem /* Memory cell to write value into */
83229 ){
83230 switch( serial_type ){
@@ -83139,41 +83231,41 @@
83231 case 10: { /* Internal use only: NULL with virtual table
83232 ** UPDATE no-change flag set */
83233 pMem->flags = MEM_Null|MEM_Zero;
83234 pMem->n = 0;
83235 pMem->u.nZero = 0;
83236 return;
83237 }
83238 case 11: /* Reserved for future use */
83239 case 0: { /* Null */
83240 /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
83241 pMem->flags = MEM_Null;
83242 return;
83243 }
83244 case 1: {
83245 /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
83246 ** integer. */
83247 pMem->u.i = ONE_BYTE_INT(buf);
83248 pMem->flags = MEM_Int;
83249 testcase( pMem->u.i<0 );
83250 return;
83251 }
83252 case 2: { /* 2-byte signed integer */
83253 /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
83254 ** twos-complement integer. */
83255 pMem->u.i = TWO_BYTE_INT(buf);
83256 pMem->flags = MEM_Int;
83257 testcase( pMem->u.i<0 );
83258 return;
83259 }
83260 case 3: { /* 3-byte signed integer */
83261 /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
83262 ** twos-complement integer. */
83263 pMem->u.i = THREE_BYTE_INT(buf);
83264 pMem->flags = MEM_Int;
83265 testcase( pMem->u.i<0 );
83266 return;
83267 }
83268 case 4: { /* 4-byte signed integer */
83269 /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
83270 ** twos-complement integer. */
83271 pMem->u.i = FOUR_BYTE_INT(buf);
@@ -83181,33 +83273,34 @@
83273 /* Work around a sign-extension bug in the HP compiler for HP/UX */
83274 if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;
83275 #endif
83276 pMem->flags = MEM_Int;
83277 testcase( pMem->u.i<0 );
83278 return;
83279 }
83280 case 5: { /* 6-byte signed integer */
83281 /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
83282 ** twos-complement integer. */
83283 pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
83284 pMem->flags = MEM_Int;
83285 testcase( pMem->u.i<0 );
83286 return;
83287 }
83288 case 6: /* 8-byte signed integer */
83289 case 7: { /* IEEE floating point */
83290 /* These use local variables, so do them in a separate routine
83291 ** to avoid having to move the frame pointer in the common case */
83292 serialGet(buf,serial_type,pMem);
83293 return;
83294 }
83295 case 8: /* Integer 0 */
83296 case 9: { /* Integer 1 */
83297 /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
83298 /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
83299 pMem->u.i = serial_type-8;
83300 pMem->flags = MEM_Int;
83301 return;
83302 }
83303 default: {
83304 /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
83305 ** length.
83306 ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
@@ -83214,14 +83307,14 @@
83307 ** (N-13)/2 bytes in length. */
83308 static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
83309 pMem->z = (char *)buf;
83310 pMem->n = (serial_type-12)/2;
83311 pMem->flags = aFlag[serial_type&1];
83312 return;
83313 }
83314 }
83315 return;
83316 }
83317 /*
83318 ** This routine is used to allocate sufficient space for an UnpackedRecord
83319 ** structure large enough to be used with sqlite3VdbeRecordUnpack() if
83320 ** the first argument is a pointer to KeyInfo structure pKeyInfo.
@@ -83280,11 +83373,12 @@
83373 pMem->enc = pKeyInfo->enc;
83374 pMem->db = pKeyInfo->db;
83375 /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
83376 pMem->szMalloc = 0;
83377 pMem->z = 0;
83378 sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
83379 d += sqlite3VdbeSerialTypeLen(serial_type);
83380 pMem++;
83381 if( (++u)>=p->nField ) break;
83382 }
83383 if( d>(u32)nKey && u ){
83384 assert( CORRUPT_DB );
@@ -83364,11 +83458,12 @@
83458 break;
83459 }
83460
83461 /* Extract the values to be compared.
83462 */
83463 sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
83464 d1 += sqlite3VdbeSerialTypeLen(serial_type1);
83465
83466 /* Do the comparison
83467 */
83468 rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
83469 pKeyInfo->nAllField>i ? pKeyInfo->aColl[i] : 0);
@@ -84168,11 +84263,11 @@
84263 }
84264
84265 /* The index entry must begin with a header size */
84266 getVarint32NR((u8*)m.z, szHdr);
84267 testcase( szHdr==3 );
84268 testcase( szHdr==(u32)m.n );
84269 testcase( szHdr>0x7fffffff );
84270 assert( m.n>=0 );
84271 if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
84272 goto idx_rowid_corruption;
84273 }
@@ -87006,11 +87101,10 @@
87101 */
87102 static VdbeCursor *allocateCursor(
87103 Vdbe *p, /* The virtual machine */
87104 int iCur, /* Index of the new VdbeCursor */
87105 int nField, /* Number of fields in the table or index */
 
87106 u8 eCurType /* Type of the new cursor */
87107 ){
87108 /* Find the memory cell that will be used to store the blob of memory
87109 ** required for this VdbeCursor structure. It is convenient to use a
87110 ** vdbe memory cell to manage the memory allocation required for a
@@ -87063,11 +87157,10 @@
87157 }
87158
87159 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
87160 memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
87161 pCx->eCurType = eCurType;
 
87162 pCx->nField = nField;
87163 pCx->aOffset = &pCx->aType[nField];
87164 if( eCurType==CURTYPE_BTREE ){
87165 pCx->uc.pCursor = (BtCursor*)
87166 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
@@ -87446,11 +87539,10 @@
87539 int i, mx;
87540 u64 h = 0;
87541
87542 i = pOp->p3;
87543 assert( pOp->p4type==P4_INT32 );
 
87544 for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
87545 const Mem *p = &aMem[i];
87546 if( p->flags & (MEM_Int|MEM_IntReal) ){
87547 h += p->u.i;
87548 }else if( p->flags & MEM_Real ){
@@ -89458,10 +89550,11 @@
89550 pDest = &aMem[pOp->p3];
89551 memAboutToChange(p, pDest);
89552 assert( pC!=0 );
89553 assert( p2<(u32)pC->nField );
89554 aOffset = pC->aOffset;
89555 assert( aOffset==pC->aType+pC->nField );
89556 assert( pC->eCurType!=CURTYPE_VTAB );
89557 assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );
89558 assert( pC->eCurType!=CURTYPE_SORTER );
89559
89560 if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
@@ -90607,10 +90700,11 @@
90700 rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);
90701 if( pOp->p2==BTREE_SCHEMA_VERSION ){
90702 /* When the schema cookie changes, record the new cookie internally */
90703 pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5;
90704 db->mDbFlags |= DBFLAG_SchemaChange;
90705 sqlite3FkClearTriggerCache(db, pOp->p1);
90706 }else if( pOp->p2==BTREE_FILE_FORMAT ){
90707 /* Record changes in the file format */
90708 pDb->pSchema->file_format = pOp->p3;
90709 }
90710 if( pOp->p1==1 ){
@@ -90784,12 +90878,13 @@
90878 nField = pOp->p4.i;
90879 }
90880 assert( pOp->p1>=0 );
90881 assert( nField>=0 );
90882 testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */
90883 pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_BTREE);
90884 if( pCur==0 ) goto no_mem;
90885 pCur->iDb = iDb;
90886 pCur->nullRow = 1;
90887 pCur->isOrdered = 1;
90888 pCur->pgnoRoot = p2;
90889 #ifdef SQLITE_DEBUG
90890 pCur->wrFlag = wrFlag;
@@ -90827,22 +90922,22 @@
90922
90923 pOrig = p->apCsr[pOp->p2];
90924 assert( pOrig );
90925 assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */
90926
90927 pCx = allocateCursor(p, pOp->p1, pOrig->nField, CURTYPE_BTREE);
90928 if( pCx==0 ) goto no_mem;
90929 pCx->nullRow = 1;
90930 pCx->isEphemeral = 1;
90931 pCx->pKeyInfo = pOrig->pKeyInfo;
90932 pCx->isTable = pOrig->isTable;
90933 pCx->pgnoRoot = pOrig->pgnoRoot;
90934 pCx->isOrdered = pOrig->isOrdered;
90935 pCx->ub.pBtx = pOrig->ub.pBtx;
90936 pCx->hasBeenDuped = 1;
90937 pOrig->hasBeenDuped = 1;
90938 rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
90939 pCx->pKeyInfo, pCx->uc.pCursor);
90940 /* The sqlite3BtreeCursor() routine can only fail for the first cursor
90941 ** opened for a database. Since there is already an open cursor when this
90942 ** opcode is run, the sqlite3BtreeCursor() cannot fail */
90943 assert( rc==SQLITE_OK );
@@ -90911,48 +91006,48 @@
91006 ** OP_OpenDup, then erase all existing content so that the table is
91007 ** empty again, rather than creating a new table. */
91008 assert( pCx->isEphemeral );
91009 pCx->seqCount = 0;
91010 pCx->cacheStatus = CACHE_STALE;
91011 rc = sqlite3BtreeClearTable(pCx->ub.pBtx, pCx->pgnoRoot, 0);
91012 }else{
91013 pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_BTREE);
91014 if( pCx==0 ) goto no_mem;
91015 pCx->isEphemeral = 1;
91016 rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->ub.pBtx,
91017 BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
91018 vfsFlags);
91019 if( rc==SQLITE_OK ){
91020 rc = sqlite3BtreeBeginTrans(pCx->ub.pBtx, 1, 0);
91021 if( rc==SQLITE_OK ){
91022 /* If a transient index is required, create it by calling
91023 ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before
91024 ** opening it. If a transient table is required, just use the
91025 ** automatically created table with root-page 1 (an BLOB_INTKEY table).
91026 */
91027 if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
91028 assert( pOp->p4type==P4_KEYINFO );
91029 rc = sqlite3BtreeCreateTable(pCx->ub.pBtx, &pCx->pgnoRoot,
91030 BTREE_BLOBKEY | pOp->p5);
91031 if( rc==SQLITE_OK ){
91032 assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
91033 assert( pKeyInfo->db==db );
91034 assert( pKeyInfo->enc==ENC(db) );
91035 rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
91036 pKeyInfo, pCx->uc.pCursor);
91037 }
91038 pCx->isTable = 0;
91039 }else{
91040 pCx->pgnoRoot = SCHEMA_ROOT;
91041 rc = sqlite3BtreeCursor(pCx->ub.pBtx, SCHEMA_ROOT, BTREE_WRCSR,
91042 0, pCx->uc.pCursor);
91043 pCx->isTable = 1;
91044 }
91045 }
91046 pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
91047 if( rc ){
91048 sqlite3BtreeClose(pCx->ub.pBtx);
91049 }
91050 }
91051 }
91052 if( rc ) goto abort_due_to_error;
91053 pCx->nullRow = 1;
@@ -90972,11 +91067,11 @@
91067 case OP_SorterOpen: {
91068 VdbeCursor *pCx;
91069
91070 assert( pOp->p1>=0 );
91071 assert( pOp->p2>=0 );
91072 pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_SORTER);
91073 if( pCx==0 ) goto no_mem;
91074 pCx->pKeyInfo = pOp->p4.pKeyInfo;
91075 assert( pCx->pKeyInfo->db==db );
91076 assert( pCx->pKeyInfo->enc==ENC(db) );
91077 rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);
@@ -91021,11 +91116,11 @@
91116 case OP_OpenPseudo: {
91117 VdbeCursor *pCx;
91118
91119 assert( pOp->p1>=0 );
91120 assert( pOp->p3>=0 );
91121 pCx = allocateCursor(p, pOp->p1, pOp->p3, CURTYPE_PSEUDO);
91122 if( pCx==0 ) goto no_mem;
91123 pCx->nullRow = 1;
91124 pCx->seekResult = pOp->p2;
91125 pCx->isTable = 1;
91126 /* Give this pseudo-cursor a fake BtCursor pointer so that pCx
@@ -92961,13 +93056,13 @@
93056 assert( pTabCur->isTable );
93057 pTabCur->nullRow = 0;
93058 pTabCur->movetoTarget = rowid;
93059 pTabCur->deferredMoveto = 1;
93060 assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );
 
 
93061 assert( !pTabCur->isEphemeral );
93062 pTabCur->ub.aAltMap = pOp->p4.ai;
93063 assert( !pC->isEphemeral );
93064 pTabCur->pAltCursor = pC;
93065 }else{
93066 pOut = out2Prerelease(p, pOp);
93067 pOut->u.i = rowid;
93068 }
@@ -94485,11 +94580,11 @@
94580
94581 /* Initialize sqlite3_vtab_cursor base class */
94582 pVCur->pVtab = pVtab;
94583
94584 /* Initialize vdbe cursor object */
94585 pCur = allocateCursor(p, pOp->p1, 0, CURTYPE_VTAB);
94586 if( pCur ){
94587 pCur->uc.pVCur = pVCur;
94588 pVtab->nRef++;
94589 }else{
94590 assert( db->mallocFailed );
@@ -96810,11 +96905,12 @@
96905 if( nWorker>=SORTER_MAX_MERGE_COUNT ){
96906 nWorker = SORTER_MAX_MERGE_COUNT-1;
96907 }
96908 #endif
96909
96910 assert( pCsr->pKeyInfo );
96911 assert( !pCsr->isEphemeral );
96912 assert( pCsr->eCurType==CURTYPE_SORTER );
96913 szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
96914 sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
96915
96916 pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
@@ -99310,11 +99406,11 @@
99406 if( size==0 ){
99407 memjrnlFreeChunks(p->pFirst);
99408 p->pFirst = 0;
99409 }else{
99410 i64 iOff = p->nChunkSize;
99411 for(pIter=p->pFirst; ALWAYS(pIter) && iOff<size; pIter=pIter->pNext){
99412 iOff += p->nChunkSize;
99413 }
99414 if( ALWAYS(pIter) ){
99415 memjrnlFreeChunks(pIter->pNext);
99416 pIter->pNext = 0;
@@ -100064,12 +100160,13 @@
100160 hit = 1;
100161 }
100162 }
100163 if( hit || zTab==0 ) continue;
100164 }
100165 if( zDb ){
100166 if( pTab->pSchema!=pSchema ) continue;
100167 if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue;
100168 }
100169 if( zTab ){
100170 const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
100171 assert( zTabName!=0 );
100172 if( sqlite3StrICmp(zTabName, zTab)!=0 ){
@@ -100196,10 +100293,11 @@
100293 {
100294 assert( ExprUseYTab(pExpr) );
100295 pExpr->y.pTab = pTab;
100296 if( pParse->bReturning ){
100297 eNewExprOp = TK_REGISTER;
100298 pExpr->op2 = TK_COLUMN;
100299 pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable +
100300 sqlite3TableColumnToStorage(pTab, iCol) + 1;
100301 }else{
100302 pExpr->iColumn = (i16)iCol;
100303 eNewExprOp = TK_TRIGGER;
@@ -109275,11 +109373,10 @@
109373 sqlite3 *db, /* Database handle */
109374 const char *zSql, /* SQL to parse */
109375 int bTemp /* True if SQL is from temp schema */
109376 ){
109377 int rc;
 
109378
109379 db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
109380
109381 /* Parse the SQL statement passed as the first argument. If no error
109382 ** occurs and the parse does not result in a new table, index or
@@ -109286,14 +109383,11 @@
109383 ** trigger object, the database must be corrupt. */
109384 memset(p, 0, sizeof(Parse));
109385 p->eParseMode = PARSE_MODE_RENAME;
109386 p->db = db;
109387 p->nQueryLoop = 1;
109388 rc = zSql ? sqlite3RunParser(p, zSql) : SQLITE_NOMEM;
 
 
 
109389 if( db->mallocFailed ) rc = SQLITE_NOMEM;
109390 if( rc==SQLITE_OK
109391 && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
109392 ){
109393 rc = SQLITE_CORRUPT_BKPT;
@@ -113359,11 +113453,11 @@
113453 Returning *pReturning = pParse->u1.pReturning;
113454 int addrRewind;
113455 int i;
113456 int reg;
113457
113458 if( NEVER(pReturning->nRetCol==0) ){
113459 assert( CORRUPT_DB );
113460 }else{
113461 sqlite3VdbeAddOp0(v, OP_FkCheck);
113462 addrRewind =
113463 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
@@ -113455,11 +113549,11 @@
113549 }
113550 }
113551
113552 if( pParse->bReturning ){
113553 Returning *pRet = pParse->u1.pReturning;
113554 if( NEVER(pRet->nRetCol==0) ){
113555 assert( CORRUPT_DB );
113556 }else{
113557 sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
113558 }
113559 }
@@ -113496,11 +113590,10 @@
113590 ** built-in function.
113591 */
113592 SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
113593 va_list ap;
113594 char *zSql;
 
113595 sqlite3 *db = pParse->db;
113596 u32 savedDbFlags = db->mDbFlags;
113597 char saveBuf[PARSE_TAIL_SZ];
113598
113599 if( pParse->nErr ) return;
@@ -113518,13 +113611,12 @@
113611 }
113612 pParse->nested++;
113613 memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
113614 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
113615 db->mDbFlags |= DBFLAG_PreferBuiltin;
113616 sqlite3RunParser(pParse, zSql);
113617 db->mDbFlags = savedDbFlags;
 
113618 sqlite3DbFree(db, zSql);
113619 memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
113620 pParse->nested--;
113621 }
113622
@@ -119179,11 +119271,10 @@
119271 for(i=0; i<nDef; i++){
119272 FuncDef *pOther;
119273 const char *zName = aDef[i].zName;
119274 int nName = sqlite3Strlen30(zName);
119275 int h = SQLITE_FUNC_HASH(zName[0], nName);
 
119276 assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN );
119277 pOther = sqlite3FunctionSearch(h, zName);
119278 if( pOther ){
119279 assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
119280 aDef[i].pNext = pOther->pNext;
@@ -120442,10 +120533,21 @@
120533 ** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT,
120534 ** SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. */
120535 sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
120536 }
120537
120538 /* subtype(X)
120539 **
120540 ** Return the subtype of X
120541 */
120542 static void subtypeFunc(
120543 sqlite3_context *context,
120544 int argc,
120545 sqlite3_value **argv
120546 ){
120547 sqlite3_result_int(context, sqlite3_value_subtype(argv[0]));
120548 }
120549
120550 /*
120551 ** Implementation of the length() function
120552 */
120553 static void lengthFunc(
@@ -120603,11 +120705,11 @@
120705 sqlite3_result_error_nomem(context);
120706 goto endInstr;
120707 }
120708
120709 /*
120710 ** Implementation of the printf() (a.k.a. format()) SQL function.
120711 */
120712 static void printfFunc(
120713 sqlite3_context *context,
120714 int argc,
120715 sqlite3_value **argv
@@ -121372,87 +121474,95 @@
121474 '0', '1', '2', '3', '4', '5', '6', '7',
121475 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
121476 };
121477
121478 /*
121479 ** Append to pStr text that is the SQL literal representation of the
121480 ** value contained in pValue.
 
 
 
121481 */
121482 SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){
121483 /* As currently implemented, the string must be initially empty.
121484 ** we might relax this requirement in the future, but that will
121485 ** require enhancements to the implementation. */
121486 assert( pStr!=0 && pStr->nChar==0 );
121487
121488 switch( sqlite3_value_type(pValue) ){
121489 case SQLITE_FLOAT: {
121490 double r1, r2;
121491 const char *zVal;
121492 r1 = sqlite3_value_double(pValue);
121493 sqlite3_str_appendf(pStr, "%!.15g", r1);
121494 zVal = sqlite3_str_value(pStr);
121495 if( zVal ){
121496 sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8);
121497 if( r1!=r2 ){
121498 sqlite3_str_reset(pStr);
121499 sqlite3_str_appendf(pStr, "%!.20e", r1);
121500 }
121501 }
121502 break;
121503 }
121504 case SQLITE_INTEGER: {
121505 sqlite3_str_appendf(pStr, "%lld", sqlite3_value_int64(pValue));
121506 break;
121507 }
121508 case SQLITE_BLOB: {
121509 char const *zBlob = sqlite3_value_blob(pValue);
121510 int nBlob = sqlite3_value_bytes(pValue);
121511 assert( zBlob==sqlite3_value_blob(pValue) ); /* No encoding change */
121512 sqlite3StrAccumEnlarge(pStr, nBlob*2 + 4);
121513 if( pStr->accError==0 ){
121514 char *zText = pStr->zText;
121515 int i;
121516 for(i=0; i<nBlob; i++){
121517 zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];
121518 zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];
121519 }
121520 zText[(nBlob*2)+2] = '\'';
121521 zText[(nBlob*2)+3] = '\0';
121522 zText[0] = 'X';
121523 zText[1] = '\'';
121524 pStr->nChar = nBlob*2 + 3;
 
121525 }
121526 break;
121527 }
121528 case SQLITE_TEXT: {
121529 const unsigned char *zArg = sqlite3_value_text(pValue);
121530 sqlite3_str_appendf(pStr, "%Q", zArg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121531 break;
121532 }
121533 default: {
121534 assert( sqlite3_value_type(pValue)==SQLITE_NULL );
121535 sqlite3_str_append(pStr, "NULL", 4);
121536 break;
121537 }
121538 }
121539 }
121540
121541 /*
121542 ** Implementation of the QUOTE() function.
121543 **
121544 ** The quote(X) function returns the text of an SQL literal which is the
121545 ** value of its argument suitable for inclusion into an SQL statement.
121546 ** Strings are surrounded by single-quotes with escapes on interior quotes
121547 ** as needed. BLOBs are encoded as hexadecimal literals. Strings with
121548 ** embedded NUL characters cannot be represented as string literals in SQL
121549 ** and hence the returned string literal is truncated prior to the first NUL.
121550 */
121551 static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
121552 sqlite3_str str;
121553 sqlite3 *db = sqlite3_context_db_handle(context);
121554 assert( argc==1 );
121555 UNUSED_PARAMETER(argc);
121556 sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
121557 sqlite3QuoteValue(&str,argv[0]);
121558 sqlite3_result_text(context, sqlite3StrAccumFinish(&str), str.nChar,
121559 SQLITE_DYNAMIC);
121560 if( str.accError==SQLITE_NOMEM ){
121561 sqlite3_result_error_nomem(context);
121562 }
121563 }
121564
121565 /*
121566 ** The unicode() function. Return the integer unicode code-point value
121567 ** for the first character of the input string.
121568 */
@@ -122583,13 +122693,15 @@
122693 FUNCTION(max, -1, 1, 1, minmaxFunc ),
122694 FUNCTION(max, 0, 1, 1, 0 ),
122695 WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0,
122696 SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ),
122697 FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
122698 FUNCTION2(subtype, 1, 0, 0, subtypeFunc, SQLITE_FUNC_TYPEOF),
122699 FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH),
122700 FUNCTION(instr, 2, 0, 0, instrFunc ),
122701 FUNCTION(printf, -1, 0, 0, printfFunc ),
122702 FUNCTION(format, -1, 0, 0, printfFunc ),
122703 FUNCTION(unicode, 1, 0, 0, unicodeFunc ),
122704 FUNCTION(char, -1, 0, 0, charFunc ),
122705 FUNCTION(abs, 1, 0, 0, absFunc ),
122706 #ifndef SQLITE_OMIT_FLOATING_POINT
122707 FUNCTION(round, 1, 0, 0, roundFunc ),
@@ -122684,10 +122796,11 @@
122796 #ifndef SQLITE_OMIT_ALTERTABLE
122797 sqlite3AlterFunctions();
122798 #endif
122799 sqlite3WindowFunctions();
122800 sqlite3RegisterDateTimeFunctions();
122801 sqlite3RegisterJsonFunctions();
122802 sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc));
122803
122804 #if 0 /* Enable to print out how the built-in functions are hashed */
122805 {
122806 int i;
@@ -123409,10 +123522,29 @@
123522 sqlite3SelectDelete(dbMem, pStep->pSelect);
123523 sqlite3ExprDelete(dbMem, p->pWhen);
123524 sqlite3DbFree(dbMem, p);
123525 }
123526 }
123527
123528 /*
123529 ** Clear the apTrigger[] cache of CASCADE triggers for all foreign keys
123530 ** in a particular database. This needs to happen when the schema
123531 ** changes.
123532 */
123533 SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3 *db, int iDb){
123534 HashElem *k;
123535 Hash *pHash = &db->aDb[iDb].pSchema->tblHash;
123536 for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k)){
123537 Table *pTab = sqliteHashData(k);
123538 FKey *pFKey;
123539 if( !IsOrdinaryTable(pTab) ) continue;
123540 for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){
123541 fkTriggerDelete(db, pFKey->apTrigger[0]); pFKey->apTrigger[0] = 0;
123542 fkTriggerDelete(db, pFKey->apTrigger[1]); pFKey->apTrigger[1] = 0;
123543 }
123544 }
123545 }
123546
123547 /*
123548 ** This function is called to generate code that runs when table pTab is
123549 ** being dropped from the database. The SrcList passed as the second argument
123550 ** to this function contains a single entry guaranteed to resolve to
@@ -124210,11 +124342,11 @@
124342 sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol);
124343 VdbeComment((v, "%s", pTab->zName));
124344 }else{
124345 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
124346 assert( pPk!=0 );
124347 assert( pPk->tnum==pTab->tnum || CORRUPT_DB );
124348 sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb);
124349 sqlite3VdbeSetP4KeyInfo(pParse, pPk);
124350 VdbeComment((v, "%s", pTab->zName));
124351 }
124352 }
@@ -126174,10 +126306,11 @@
126306 ** the UNIQUE constraints have run.
126307 */
126308 if( onError==OE_Replace /* IPK rule is REPLACE */
126309 && onError!=overrideError /* Rules for other constraints are different */
126310 && pTab->pIndex /* There exist other constraints */
126311 && !upsertIpkDelay /* IPK check already deferred by UPSERT */
126312 ){
126313 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
126314 VdbeComment((v, "defer IPK REPLACE until last"));
126315 }
126316
@@ -126582,10 +126715,11 @@
126715
126716 /* If the IPK constraint is a REPLACE, run it last */
126717 if( ipkTop ){
126718 sqlite3VdbeGoto(v, ipkTop);
126719 VdbeComment((v, "Do IPK REPLACE"));
126720 assert( ipkBottom>0 );
126721 sqlite3VdbeJumpHere(v, ipkBottom);
126722 }
126723
126724 /* Recheck all uniqueness constraints after replace triggers have run */
126725 testcase( regTrigCnt!=0 && nReplaceTrig==0 );
@@ -126712,11 +126846,10 @@
126846 sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
126847 VdbeCoverage(v);
126848 }
126849 pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
126850 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
 
126851 pik_flags |= OPFLAG_NCHANGE;
126852 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
126853 if( update_flags==0 ){
126854 codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
126855 }
@@ -127802,10 +127935,12 @@
127935 sqlite3_int64 (*total_changes64)(sqlite3*);
127936 /* Version 3.37.0 and later */
127937 int (*autovacuum_pages)(sqlite3*,
127938 unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
127939 void*, void(*)(void*));
127940 /* Version 3.38.0 and later */
127941 int (*error_offset)(sqlite3*);
127942 };
127943
127944 /*
127945 ** This is the function signature used for all extension entry points. It
127946 ** is also defined in the file "loadext.c".
@@ -128113,10 +128248,12 @@
128248 /* Version 3.36.1 and later */
128249 #define sqlite3_changes64 sqlite3_api->changes64
128250 #define sqlite3_total_changes64 sqlite3_api->total_changes64
128251 /* Version 3.37.0 and later */
128252 #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
128253 /* Version 3.38.0 and later */
128254 #define sqlite3_error_offset sqlite3_api->error_offset
128255 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
128256
128257 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
128258 /* This case when the file really is being compiled as a loadable
128259 ** extension */
@@ -128602,10 +128739,12 @@
128739 /* Version 3.36.1 and later */
128740 sqlite3_changes64,
128741 sqlite3_total_changes64,
128742 /* Version 3.37.0 and later */
128743 sqlite3_autovacuum_pages,
128744 /* Version 3.38.0 and later */
128745 sqlite3_error_offset,
128746 };
128747
128748 /* True if x is the directory separator character
128749 */
128750 #if SQLITE_OS_WIN
@@ -132941,10 +133080,14 @@
133080 /*
133081 ** Free all memory allocations in the pParse object
133082 */
133083 SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
133084 sqlite3 *db = pParse->db;
133085 assert( pParse->nested==0 );
133086 #ifndef SQLITE_OMIT_SHARED_CACHE
133087 sqlite3DbFree(db, pParse->aTableLock);
133088 #endif
133089 while( pParse->pCleanup ){
133090 ParseCleanup *pCleanup = pParse->pCleanup;
133091 pParse->pCleanup = pCleanup->pNext;
133092 pCleanup->xCleanup(db, pCleanup->pPtr);
133093 sqlite3DbFreeNN(db, pCleanup);
@@ -133020,11 +133163,10 @@
133163 u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
133164 Vdbe *pReprepare, /* VM being reprepared */
133165 sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
133166 const char **pzTail /* OUT: End of parsed string */
133167 ){
 
133168 int rc = SQLITE_OK; /* Result code */
133169 int i; /* Loop counter */
133170 Parse sParse; /* Parsing context */
133171
133172 memset(&sParse, 0, PARSE_HDR_SZ);
@@ -133095,18 +133237,18 @@
133237 rc = sqlite3ApiExit(db, SQLITE_TOOBIG);
133238 goto end_prepare;
133239 }
133240 zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
133241 if( zSqlCopy ){
133242 sqlite3RunParser(&sParse, zSqlCopy);
133243 sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
133244 sqlite3DbFree(db, zSqlCopy);
133245 }else{
133246 sParse.zTail = &zSql[nBytes];
133247 }
133248 }else{
133249 sqlite3RunParser(&sParse, zSql);
133250 }
133251 assert( 0==sParse.nQueryLoop );
133252
133253 if( pzTail ){
133254 *pzTail = sParse.zTail;
@@ -133118,26 +133260,26 @@
133260 if( db->mallocFailed ){
133261 sParse.rc = SQLITE_NOMEM_BKPT;
133262 sParse.checkSchema = 0;
133263 }
133264 if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
133265 if( sParse.checkSchema && db->init.busy==0 ){
133266 schemaIsValid(&sParse);
133267 }
133268 if( sParse.pVdbe ){
133269 sqlite3VdbeFinalize(sParse.pVdbe);
133270 }
133271 assert( 0==(*ppStmt) );
133272 rc = sParse.rc;
133273 if( sParse.zErrMsg ){
133274 sqlite3ErrorWithMsg(db, rc, "%s", sParse.zErrMsg);
133275 sqlite3DbFree(db, sParse.zErrMsg);
133276 }else{
133277 sqlite3Error(db, rc);
133278 }
133279 }else{
133280 assert( sParse.zErrMsg==0 );
133281 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
133282 rc = SQLITE_OK;
133283 sqlite3ErrorClear(db);
133284 }
133285
@@ -136696,10 +136838,12 @@
136838 Select *p, /* The right-most of SELECTs to be coded */
136839 SelectDest *pDest /* What to do with query results */
136840 ){
136841 int i, j; /* Loop counters */
136842 Select *pPrior; /* Another SELECT immediately to our left */
136843 Select *pSplit; /* Left-most SELECT in the right-hand group */
136844 int nSelect; /* Number of SELECT statements in the compound */
136845 Vdbe *v; /* Generate code to this VDBE */
136846 SelectDest destA; /* Destination for coroutine A */
136847 SelectDest destB; /* Destination for coroutine B */
136848 int regAddrA; /* Address register for select-A coroutine */
136849 int regAddrB; /* Address register for select-B coroutine */
@@ -136741,12 +136885,11 @@
136885
136886
136887 /* Patch up the ORDER BY clause
136888 */
136889 op = p->op;
136890 assert( p->pPrior->pOrderBy==0 );
 
136891 pOrderBy = p->pOrderBy;
136892 assert( pOrderBy );
136893 nOrderBy = pOrderBy->nExpr;
136894
136895 /* For operators other than UNION ALL we have to make sure that
@@ -136792,15 +136935,10 @@
136935 pKeyMerge = multiSelectOrderByKeyInfo(pParse, p, 1);
136936 }else{
136937 pKeyMerge = 0;
136938 }
136939
 
 
 
 
 
136940 /* Allocate a range of temporary registers and the KeyInfo needed
136941 ** for the logic that removes duplicate result rows when the
136942 ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).
136943 */
136944 if( op==TK_ALL ){
@@ -136821,16 +136959,33 @@
136959 }
136960 }
136961
136962 /* Separate the left and the right query from one another
136963 */
136964 nSelect = 1;
136965 if( (op==TK_ALL || op==TK_UNION)
136966 && OptimizationEnabled(db, SQLITE_BalancedMerge)
136967 ){
136968 for(pSplit=p; pSplit->pPrior!=0 && pSplit->op==op; pSplit=pSplit->pPrior){
136969 nSelect++;
136970 assert( pSplit->pPrior->pNext==pSplit );
136971 }
136972 }
136973 if( nSelect<=3 ){
136974 pSplit = p;
136975 }else{
136976 pSplit = p;
136977 for(i=2; i<nSelect; i+=2){ pSplit = pSplit->pPrior; }
136978 }
136979 pPrior = pSplit->pPrior;
136980 pSplit->pPrior = 0;
136981 pPrior->pNext = 0;
136982 assert( p->pOrderBy == pOrderBy );
136983 assert( pOrderBy!=0 || db->mallocFailed );
136984 pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
136985 sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER");
136986 sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
 
 
136987
136988 /* Compute the limit registers */
136989 computeLimitRegisters(pParse, p, labelEnd);
136990 if( p->iLimit && op==TK_ALL ){
136991 regLimitA = ++pParse->nMem;
@@ -136977,16 +137132,15 @@
137132 */
137133 sqlite3VdbeResolveLabel(v, labelEnd);
137134
137135 /* Reassembly the compound query so that it will be freed correctly
137136 ** by the calling function */
137137 if( pSplit->pPrior ){
137138 sqlite3SelectDelete(db, pSplit->pPrior);
137139 }
137140 pSplit->pPrior = pPrior;
137141 pPrior->pNext = pSplit;
 
137142 sqlite3ExprListDelete(db, pPrior->pOrderBy);
137143 pPrior->pOrderBy = 0;
137144
137145 /*** TBD: Insert subroutine calls to close cursors on incomplete
137146 **** subqueries ****/
@@ -142061,11 +142215,11 @@
142215 if( db->mallocFailed==0 && pParse->nErr==0 ){
142216 sqlite3GenerateColumnNames(pParse, &sSelect);
142217 }
142218 sqlite3ExprListDelete(db, sSelect.pEList);
142219 pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
142220 if( !db->mallocFailed ){
142221 NameContext sNC;
142222 memset(&sNC, 0, sizeof(sNC));
142223 if( pReturning->nRetCol==0 ){
142224 pReturning->nRetCol = pNew->nExpr;
142225 pReturning->iRetCur = pParse->nTab++;
@@ -142073,28 +142227,34 @@
142227 sNC.pParse = pParse;
142228 sNC.uNC.iBaseReg = regIn;
142229 sNC.ncFlags = NC_UBaseReg;
142230 pParse->eTriggerOp = pTrigger->op;
142231 pParse->pTriggerTab = pTab;
142232 if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK
142233 && !db->mallocFailed
142234 ){
142235 int i;
142236 int nCol = pNew->nExpr;
142237 int reg = pParse->nMem+1;
142238 pParse->nMem += nCol+2;
142239 pReturning->iRetReg = reg;
142240 for(i=0; i<nCol; i++){
142241 Expr *pCol = pNew->a[i].pExpr;
142242 assert( pCol!=0 ); /* Due to !db->mallocFailed ~9 lines above */
142243 sqlite3ExprCodeFactorable(pParse, pCol, reg+i);
142244 if( sqlite3ExprAffinity(pCol)==SQLITE_AFF_REAL ){
142245 sqlite3VdbeAddOp1(v, OP_RealAffinity, reg+i);
142246 }
142247 }
142248 sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i);
142249 sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1);
142250 sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1);
142251 }
 
 
 
142252 }
142253 sqlite3ExprListDelete(db, pNew);
142254 pParse->eTriggerOp = 0;
142255 pParse->pTriggerTab = 0;
142256 }
142257
142258
142259
142260 /*
@@ -145420,11 +145580,10 @@
145580 */
145581 SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
145582 VtabCtx *pCtx;
145583 int rc = SQLITE_OK;
145584 Table *pTab;
 
145585 Parse sParse;
145586 int initBusy;
145587
145588 #ifdef SQLITE_ENABLE_API_ARMOR
145589 if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
@@ -145449,15 +145608,16 @@
145608 ** in case a bug arises. */
145609 assert( db->init.busy==0 );
145610 initBusy = db->init.busy;
145611 db->init.busy = 0;
145612 sParse.nQueryLoop = 1;
145613 if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable)
145614 && ALWAYS(sParse.pNewTable!=0)
145615 && ALWAYS(!db->mallocFailed)
145616 && IsOrdinaryTable(sParse.pNewTable)
145617 ){
145618 assert( sParse.zErrMsg==0 );
145619 if( !pTab->aCol ){
145620 Table *pNew = sParse.pNewTable;
145621 Index *pIdx;
145622 pTab->aCol = pNew->aCol;
145623 sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
@@ -145483,12 +145643,13 @@
145643 pIdx->pTable = pTab;
145644 }
145645 }
145646 pCtx->bDeclared = 1;
145647 }else{
145648 sqlite3ErrorWithMsg(db, SQLITE_ERROR,
145649 (sParse.zErrMsg ? "%s" : 0), sParse.zErrMsg);
145650 sqlite3DbFree(db, sParse.zErrMsg);
145651 rc = SQLITE_ERROR;
145652 }
145653 sParse.eParseMode = PARSE_MODE_NORMAL;
145654
145655 if( sParse.pVdbe ){
@@ -146251,11 +146412,11 @@
146412 #define TERM_VIRTUAL 0x0002 /* Added by the optimizer. Do not code */
146413 #define TERM_CODED 0x0004 /* This term is already coded */
146414 #define TERM_COPIED 0x0008 /* Has a child */
146415 #define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */
146416 #define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */
146417 #define TERM_OK 0x0040 /* Used during OR-clause processing */
146418 #define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */
146419 #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */
146420 #define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */
146421 #define TERM_LIKE 0x0400 /* The original LIKE operator */
146422 #define TERM_IS 0x0800 /* Term.pExpr is an IS operator */
@@ -147961,11 +148122,11 @@
148122 ){
148123 while( ++iLevel < pWInfo->nLevel ){
148124 WhereLevel *pLevel = &pWInfo->a[iLevel];
148125 WhereLoop *pLoop = pLevel->pWLoop;
148126 if( pLevel->regFilter==0 ) continue;
148127 /* ,--- Because sqlite3ConstructBloomFilter() has will not have set
148128 ** vvvvv--' pLevel->regFilter if this were true. */
148129 if( NEVER(pLoop->prereq & notReady) ) continue;
148130 if( pLoop->wsFlags & WHERE_IPK ){
148131 WhereTerm *pTerm = pLoop->aLTerm[0];
148132 int regRowid;
@@ -147981,10 +148142,11 @@
148142 u16 nEq = pLoop->u.btree.nEq;
148143 int r1;
148144 char *zStartAff;
148145
148146 assert( pLoop->wsFlags & WHERE_INDEXED );
148147 assert( (pLoop->wsFlags & WHERE_COLUMN_IN)==0 );
148148 r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff);
148149 codeApplyAffinity(pParse, r1, nEq, zStartAff);
148150 sqlite3DbFree(pParse->db, zStartAff);
148151 sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
148152 addrNxt, r1, nEq);
@@ -150043,11 +150205,11 @@
150205 for(j=0; j<2 && !okToChngToIN; j++){
150206 Expr *pLeft = 0;
150207 pOrTerm = pOrWc->a;
150208 for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){
150209 assert( pOrTerm->eOperator & WO_EQ );
150210 pOrTerm->wtFlags &= ~TERM_OK;
150211 if( pOrTerm->leftCursor==iCursor ){
150212 /* This is the 2-bit case and we are on the second iteration and
150213 ** current term is from the first iteration. So skip this term. */
150214 assert( j==1 );
150215 continue;
@@ -150084,11 +150246,11 @@
150246 okToChngToIN = 1;
150247 for(; i>=0 && okToChngToIN; i--, pOrTerm++){
150248 assert( pOrTerm->eOperator & WO_EQ );
150249 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150250 if( pOrTerm->leftCursor!=iCursor ){
150251 pOrTerm->wtFlags &= ~TERM_OK;
150252 }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
150253 && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
150254 )){
150255 okToChngToIN = 0;
150256 }else{
@@ -150100,11 +150262,11 @@
150262 affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);
150263 affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);
150264 if( affRight!=0 && affRight!=affLeft ){
150265 okToChngToIN = 0;
150266 }else{
150267 pOrTerm->wtFlags |= TERM_OK;
150268 }
150269 }
150270 }
150271 }
150272
@@ -150117,11 +150279,11 @@
150279 ExprList *pList = 0; /* The RHS of the IN operator */
150280 Expr *pLeft = 0; /* The LHS of the IN operator */
150281 Expr *pNew; /* The complete IN operator */
150282
150283 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
150284 if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue;
150285 assert( pOrTerm->eOperator & WO_EQ );
150286 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
150287 assert( pOrTerm->leftCursor==iCursor );
150288 assert( pOrTerm->u.x.leftColumn==iColumn );
150289 pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);
@@ -151651,16 +151813,18 @@
151813 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED)
151814 static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
151815 int i;
151816 if( !sqlite3WhereTrace ) return;
151817 for(i=0; i<p->nConstraint; i++){
151818 sqlite3DebugPrintf(
151819 " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n",
151820 i,
151821 p->aConstraint[i].iColumn,
151822 p->aConstraint[i].iTermOffset,
151823 p->aConstraint[i].op,
151824 p->aConstraint[i].usable,
151825 sqlite3_vtab_collation(p,i));
151826 }
151827 for(i=0; i<p->nOrderBy; i++){
151828 sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n",
151829 i,
151830 p->aOrderBy[i].iColumn,
@@ -151960,11 +152124,11 @@
152124 **
152125 ** This routine may only be called if it has previously been determined that
152126 ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit
152127 ** is set.
152128 */
152129 static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
152130 WhereInfo *pWInfo, /* The WHERE clause */
152131 int iLevel, /* Index in pWInfo->a[] that is pLevel */
152132 WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */
152133 Bitmask notReady /* Loops that are not ready */
152134 ){
@@ -152044,17 +152208,24 @@
152208 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
152209 VdbeCoverage(v);
152210 sqlite3VdbeJumpHere(v, addrTop);
152211 pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
152212 if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
152213 while( ++iLevel < pWInfo->nLevel ){
 
152214 pLevel = &pWInfo->a[iLevel];
152215 pLoop = pLevel->pWLoop;
152216 if( NEVER(pLoop==0) ) continue;
152217 if( pLoop->prereq & notReady ) continue;
152218 if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN))
152219 ==WHERE_BLOOMFILTER
152220 ){
152221 /* This is a candidate for bloom-filter pull-down (early evaluation).
152222 ** The test that WHERE_COLUMN_IN is omitted is important, as we are
152223 ** not able to do early evaluation of bloom filters that make use of
152224 ** the IN operator */
152225 break;
152226 }
152227 }
152228 }while( iLevel < pWInfo->nLevel );
152229 sqlite3VdbeJumpHere(v, addrOnce);
152230 }
152231
@@ -152081,14 +152252,23 @@
152252 struct HiddenIndexInfo *pHidden;
152253 WhereTerm *pTerm;
152254 int nOrderBy;
152255 sqlite3_index_info *pIdxInfo;
152256 u16 mNoOmit = 0;
152257 const Table *pTab;
152258
152259 assert( pSrc!=0 );
152260 pTab = pSrc->pTab;
152261 assert( pTab!=0 );
152262 assert( IsVirtual(pTab) );
152263
152264 /* Find all WHERE clause constraints referring to this virtual table.
152265 ** Mark each term with the TERM_OK flag. Set nTerm to the number of
152266 ** terms found.
152267 */
152268 for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
152269 pTerm->wtFlags &= ~TERM_OK;
152270 if( pTerm->leftCursor != pSrc->iCursor ) continue;
152271 if( pTerm->prereqRight & mUnusable ) continue;
152272 assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
152273 testcase( pTerm->eOperator & WO_IN );
152274 testcase( pTerm->eOperator & WO_ISNULL );
@@ -152095,12 +152275,23 @@
152275 testcase( pTerm->eOperator & WO_IS );
152276 testcase( pTerm->eOperator & WO_ALL );
152277 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
152278 if( pTerm->wtFlags & TERM_VNULL ) continue;
152279 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
152280 assert( pTerm->u.x.leftColumn>=XN_ROWID );
152281 assert( pTerm->u.x.leftColumn<pTab->nCol );
152282
152283 /* tag-20191211-002: WHERE-clause constraints are not useful to the
152284 ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the
152285 ** equivalent restriction for ordinary tables. */
152286 if( (pSrc->fg.jointype & JT_LEFT)!=0
152287 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
152288 ){
152289 continue;
152290 }
152291 nTerm++;
152292 pTerm->wtFlags |= TERM_OK;
152293 }
152294
152295 /* If the ORDER BY clause contains only columns in the current
152296 ** virtual table then allocate space for the aOrderBy part of
152297 ** the sqlite3_index_info structure.
@@ -152108,12 +152299,45 @@
152299 nOrderBy = 0;
152300 if( pOrderBy ){
152301 int n = pOrderBy->nExpr;
152302 for(i=0; i<n; i++){
152303 Expr *pExpr = pOrderBy->a[i].pExpr;
152304 Expr *pE2;
152305
152306 /* Skip over constant terms in the ORDER BY clause */
152307 if( sqlite3ExprIsConstant(pExpr) ){
152308 continue;
152309 }
152310
152311 /* Virtual tables are unable to deal with NULLS FIRST */
152312 if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break;
152313
152314 /* First case - a direct column references without a COLLATE operator */
152315 if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){
152316 assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumn<pTab->nCol );
152317 continue;
152318 }
152319
152320 /* 2nd case - a column reference with a COLLATE operator. Only match
152321 ** of the COLLATE operator matches the collation of the column. */
152322 if( pExpr->op==TK_COLLATE
152323 && (pE2 = pExpr->pLeft)->op==TK_COLUMN
152324 && pE2->iTable==pSrc->iCursor
152325 ){
152326 const char *zColl; /* The collating sequence name */
152327 assert( !ExprHasProperty(pExpr, EP_IntValue) );
152328 assert( pExpr->u.zToken!=0 );
152329 assert( pE2->iColumn>=XN_ROWID && pE2->iColumn<pTab->nCol );
152330 pExpr->iColumn = pE2->iColumn;
152331 if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */
152332 zColl = sqlite3ColumnColl(&pTab->aCol[pE2->iColumn]);
152333 if( zColl==0 ) zColl = sqlite3StrBINARY;
152334 if( sqlite3_stricmp(pExpr->u.zToken, zColl)==0 ) continue;
152335 }
152336
152337 /* No matches cause a break out of the loop */
152338 break;
152339 }
152340 if( i==n){
152341 nOrderBy = n;
152342 }
152343 }
@@ -152129,38 +152353,18 @@
152353 }
152354 pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1];
152355 pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1];
152356 pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];
152357 pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];
 
152358 pIdxInfo->aConstraint = pIdxCons;
152359 pIdxInfo->aOrderBy = pIdxOrderBy;
152360 pIdxInfo->aConstraintUsage = pUsage;
152361 pHidden->pWC = pWC;
152362 pHidden->pParse = pParse;
152363 for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
152364 u16 op;
152365 if( (pTerm->wtFlags & TERM_OK)==0 ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152366 pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
152367 pIdxCons[j].iTermOffset = i;
152368 op = pTerm->eOperator & WO_ALL;
152369 if( op==WO_IN ) op = WO_EQ;
152370 if( op==WO_AUX ){
@@ -152193,16 +152397,23 @@
152397 }
152398 }
152399
152400 j++;
152401 }
152402 assert( j==nTerm );
152403 pIdxInfo->nConstraint = j;
152404 for(i=j=0; i<nOrderBy; i++){
152405 Expr *pExpr = pOrderBy->a[i].pExpr;
152406 if( sqlite3ExprIsConstant(pExpr) ) continue;
152407 assert( pExpr->op==TK_COLUMN
152408 || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN
152409 && pExpr->iColumn==pExpr->pLeft->iColumn) );
152410 pIdxOrderBy[j].iColumn = pExpr->iColumn;
152411 pIdxOrderBy[j].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC;
152412 j++;
152413 }
152414 pIdxInfo->nOrderBy = j;
152415
152416 *pmNoOmit = mNoOmit;
152417 return pIdxInfo;
152418 }
152419
@@ -154530,15 +154741,23 @@
154741
154742 return rc;
154743 }
154744
154745 /*
154746 ** Return the collating sequence for a constraint passed into xBestIndex.
154747 **
154748 ** pIdxInfo must be an sqlite3_index_info structure passed into xBestIndex.
154749 ** This routine depends on there being a HiddenIndexInfo structure immediately
154750 ** following the sqlite3_index_info structure.
154751 **
154752 ** Return a pointer to the collation name:
154753 **
154754 ** 1. If there is an explicit COLLATE operator on the constaint, return it.
154755 **
154756 ** 2. Else, if the column has an alternative collation, return that.
154757 **
154758 ** 3. Otherwise, return "BINARY".
154759 */
154760 SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){
154761 HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1];
154762 const char *zRet = 0;
154763 if( iCons>=0 && iCons<pIdxInfo->nConstraint ){
@@ -155972,11 +156191,11 @@
156191 assert( pWInfo->nLevel>=2 );
156192 assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
156193 nSearch = pWInfo->a[0].pWLoop->nOut;
156194 for(i=1; i<pWInfo->nLevel; i++){
156195 WhereLoop *pLoop = pWInfo->a[i].pWLoop;
156196 const unsigned int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ);
156197 if( (pLoop->wsFlags & reqFlags)==reqFlags
156198 /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
156199 && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
156200 ){
156201 SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
@@ -156590,11 +156809,11 @@
156809 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
156810 constructAutomaticIndex(pParse, &pWInfo->sWC,
156811 &pTabList->a[pLevel->iFrom], notReady, pLevel);
156812 #endif
156813 }else{
156814 sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady);
156815 }
156816 if( db->mallocFailed ) goto whereBeginError;
156817 }
156818 addrExplain = sqlite3WhereExplainOneScan(
156819 pParse, pTabList, pLevel, wctrlFlags
@@ -160320,14 +160539,14 @@
160539 #define TK_DETACH 40
160540 #define TK_EACH 41
160541 #define TK_FAIL 42
160542 #define TK_OR 43
160543 #define TK_AND 44
160544 #define TK_IS 45
160545 #define TK_MATCH 46
160546 #define TK_LIKE_KW 47
160547 #define TK_BETWEEN 48
160548 #define TK_IN 49
160549 #define TK_ISNULL 50
160550 #define TK_NOTNULL 51
160551 #define TK_NE 52
160552 #define TK_EQ 53
@@ -160387,82 +160606,83 @@
160606 #define TK_MINUS 107
160607 #define TK_STAR 108
160608 #define TK_SLASH 109
160609 #define TK_REM 110
160610 #define TK_CONCAT 111
160611 #define TK_PTR 112
160612 #define TK_COLLATE 113
160613 #define TK_BITNOT 114
160614 #define TK_ON 115
160615 #define TK_INDEXED 116
160616 #define TK_STRING 117
160617 #define TK_JOIN_KW 118
160618 #define TK_CONSTRAINT 119
160619 #define TK_DEFAULT 120
160620 #define TK_NULL 121
160621 #define TK_PRIMARY 122
160622 #define TK_UNIQUE 123
160623 #define TK_CHECK 124
160624 #define TK_REFERENCES 125
160625 #define TK_AUTOINCR 126
160626 #define TK_INSERT 127
160627 #define TK_DELETE 128
160628 #define TK_UPDATE 129
160629 #define TK_SET 130
160630 #define TK_DEFERRABLE 131
160631 #define TK_FOREIGN 132
160632 #define TK_DROP 133
160633 #define TK_UNION 134
160634 #define TK_ALL 135
160635 #define TK_EXCEPT 136
160636 #define TK_INTERSECT 137
160637 #define TK_SELECT 138
160638 #define TK_VALUES 139
160639 #define TK_DISTINCT 140
160640 #define TK_DOT 141
160641 #define TK_FROM 142
160642 #define TK_JOIN 143
160643 #define TK_USING 144
160644 #define TK_ORDER 145
160645 #define TK_GROUP 146
160646 #define TK_HAVING 147
160647 #define TK_LIMIT 148
160648 #define TK_WHERE 149
160649 #define TK_RETURNING 150
160650 #define TK_INTO 151
160651 #define TK_NOTHING 152
160652 #define TK_FLOAT 153
160653 #define TK_BLOB 154
160654 #define TK_INTEGER 155
160655 #define TK_VARIABLE 156
160656 #define TK_CASE 157
160657 #define TK_WHEN 158
160658 #define TK_THEN 159
160659 #define TK_ELSE 160
160660 #define TK_INDEX 161
160661 #define TK_ALTER 162
160662 #define TK_ADD 163
160663 #define TK_WINDOW 164
160664 #define TK_OVER 165
160665 #define TK_FILTER 166
160666 #define TK_COLUMN 167
160667 #define TK_AGG_FUNCTION 168
160668 #define TK_AGG_COLUMN 169
160669 #define TK_TRUEFALSE 170
160670 #define TK_ISNOT 171
160671 #define TK_FUNCTION 172
160672 #define TK_UMINUS 173
160673 #define TK_UPLUS 174
160674 #define TK_TRUTH 175
160675 #define TK_REGISTER 176
160676 #define TK_VECTOR 177
160677 #define TK_SELECT_COLUMN 178
160678 #define TK_IF_NULL_ROW 179
160679 #define TK_ASTERISK 180
160680 #define TK_SPAN 181
160681 #define TK_ERROR 182
160682 #define TK_SPACE 183
160683 #define TK_ILLEGAL 184
160684 #endif
160685 /**************** End token definitions ***************************************/
160686
160687 /* The next sections is a series of control #defines.
160688 ** various aspects of the generated parser.
@@ -160518,34 +160738,34 @@
160738 #ifndef INTERFACE
160739 # define INTERFACE 1
160740 #endif
160741 /************* Begin control #defines *****************************************/
160742 #define YYCODETYPE unsigned short int
160743 #define YYNOCODE 319
160744 #define YYACTIONTYPE unsigned short int
160745 #define YYWILDCARD 101
160746 #define sqlite3ParserTOKENTYPE Token
160747 typedef union {
160748 int yyinit;
160749 sqlite3ParserTOKENTYPE yy0;
160750 TriggerStep* yy33;
160751 Window* yy41;
160752 Select* yy47;
160753 SrcList* yy131;
160754 struct TrigEvent yy180;
160755 struct {int value; int mask;} yy231;
160756 IdList* yy254;
160757 u32 yy285;
160758 ExprList* yy322;
160759 Cte* yy385;
160760 int yy394;
160761 Upsert* yy444;
160762 u8 yy516;
160763 With* yy521;
160764 const char* yy522;
160765 Expr* yy528;
160766 struct FrameBound yy595;
160767 } YYMINORTYPE;
160768 #ifndef YYSTACKDEPTH
160769 #define YYSTACKDEPTH 100
160770 #endif
160771 #define sqlite3ParserARG_SDECL
@@ -160557,22 +160777,22 @@
160777 #define sqlite3ParserCTX_PDECL ,Parse *pParse
160778 #define sqlite3ParserCTX_PARAM ,pParse
160779 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
160780 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
160781 #define YYFALLBACK 1
160782 #define YYNSTATE 574
160783 #define YYNRULE 402
160784 #define YYNRULE_WITH_ACTION 340
160785 #define YYNTOKEN 185
160786 #define YY_MAX_SHIFT 573
160787 #define YY_MIN_SHIFTREDUCE 831
160788 #define YY_MAX_SHIFTREDUCE 1232
160789 #define YY_ERROR_ACTION 1233
160790 #define YY_ACCEPT_ACTION 1234
160791 #define YY_NO_ACTION 1235
160792 #define YY_MIN_REDUCE 1236
160793 #define YY_MAX_REDUCE 1637
160794 /************* End control #defines *******************************************/
160795 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
160796
160797 /* Define the yytestcase() macro to be a no-op if is not already defined
160798 ** otherwise.
@@ -160635,607 +160855,616 @@
160855 ** yy_reduce_ofst[] For each state, the offset into yy_action for
160856 ** shifting non-terminals after a reduce.
160857 ** yy_default[] Default action for each state.
160858 **
160859 *********** Begin parsing tables **********************************************/
160860 #define YY_ACTTAB_COUNT (2070)
160861 static const YYACTIONTYPE yy_action[] = {
160862 /* 0 */ 566, 1307, 566, 1286, 201, 201, 566, 116, 112, 222,
160863 /* 10 */ 566, 1307, 377, 566, 116, 112, 222, 397, 408, 409,
160864 /* 20 */ 1260, 378, 1269, 41, 41, 41, 41, 1412, 1517, 71,
160865 /* 30 */ 71, 967, 1258, 41, 41, 491, 71, 71, 272, 968,
160866 /* 40 */ 298, 476, 298, 123, 124, 114, 1210, 1210, 1044, 1047,
160867 /* 50 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 543, 409,
160868 /* 60 */ 1234, 1, 1, 573, 2, 1238, 548, 116, 112, 222,
160869 /* 70 */ 309, 480, 142, 548, 1272, 524, 116, 112, 222, 1320,
160870 /* 80 */ 417, 523, 547, 123, 124, 114, 1210, 1210, 1044, 1047,
160871 /* 90 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 424, 116,
160872 /* 100 */ 112, 222, 120, 120, 120, 120, 119, 119, 118, 118,
160873 /* 110 */ 118, 117, 113, 444, 277, 277, 277, 277, 560, 560,
160874 /* 120 */ 560, 1558, 376, 1560, 1186, 375, 1157, 563, 1157, 563,
160875 /* 130 */ 409, 1558, 537, 252, 219, 1553, 99, 141, 449, 6,
160876 /* 140 */ 365, 233, 120, 120, 120, 120, 119, 119, 118, 118,
160877 /* 150 */ 118, 117, 113, 444, 123, 124, 114, 1210, 1210, 1044,
160878 /* 160 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 138,
160879 /* 170 */ 289, 1186, 1546, 448, 118, 118, 118, 117, 113, 444,
160880 /* 180 */ 125, 1186, 1187, 1188, 144, 465, 334, 566, 150, 127,
160881 /* 190 */ 444, 122, 122, 122, 122, 115, 120, 120, 120, 120,
160882 /* 200 */ 119, 119, 118, 118, 118, 117, 113, 444, 454, 419,
160883 /* 210 */ 13, 13, 215, 120, 120, 120, 120, 119, 119, 118,
160884 /* 220 */ 118, 118, 117, 113, 444, 422, 308, 557, 1186, 1187,
160885 /* 230 */ 1188, 441, 440, 409, 1271, 122, 122, 122, 122, 120,
160886 /* 240 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113,
160887 /* 250 */ 444, 1543, 98, 1033, 1033, 1045, 1048, 123, 124, 114,
160888 /* 260 */ 1210, 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122,
160889 /* 270 */ 122, 122, 566, 406, 405, 1186, 566, 409, 1217, 319,
160890 /* 280 */ 1217, 80, 81, 120, 120, 120, 120, 119, 119, 118,
160891 /* 290 */ 118, 118, 117, 113, 444, 70, 70, 1186, 1604, 71,
160892 /* 300 */ 71, 123, 124, 114, 1210, 1210, 1044, 1047, 1036, 1036,
160893 /* 310 */ 121, 121, 122, 122, 122, 122, 120, 120, 120, 120,
160894 /* 320 */ 119, 119, 118, 118, 118, 117, 113, 444, 1037, 210,
160895 /* 330 */ 1186, 365, 1186, 1187, 1188, 245, 548, 399, 504, 501,
160896 /* 340 */ 500, 108, 558, 138, 4, 516, 933, 433, 499, 217,
160897 /* 350 */ 514, 522, 352, 879, 1186, 1187, 1188, 383, 561, 566,
160898 /* 360 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
160899 /* 370 */ 113, 444, 277, 277, 16, 16, 1598, 441, 440, 153,
160900 /* 380 */ 409, 445, 13, 13, 1279, 563, 1214, 1186, 1187, 1188,
160901 /* 390 */ 1003, 1216, 264, 555, 1574, 186, 566, 427, 138, 1215,
160902 /* 400 */ 308, 557, 472, 138, 123, 124, 114, 1210, 1210, 1044,
160903 /* 410 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 55,
160904 /* 420 */ 55, 413, 1023, 507, 1217, 1186, 1217, 474, 106, 106,
160905 /* 430 */ 1312, 1312, 1186, 171, 566, 384, 107, 380, 445, 568,
160906 /* 440 */ 567, 430, 1543, 1013, 332, 549, 565, 263, 280, 360,
160907 /* 450 */ 510, 355, 509, 250, 491, 308, 557, 71, 71, 351,
160908 /* 460 */ 308, 557, 374, 120, 120, 120, 120, 119, 119, 118,
160909 /* 470 */ 118, 118, 117, 113, 444, 1013, 1013, 1015, 1016, 27,
160910 /* 480 */ 277, 277, 1186, 1187, 1188, 1152, 566, 528, 409, 1186,
160911 /* 490 */ 1187, 1188, 348, 563, 548, 1260, 533, 517, 1152, 1516,
160912 /* 500 */ 317, 1152, 285, 550, 485, 569, 566, 569, 482, 51,
160913 /* 510 */ 51, 207, 123, 124, 114, 1210, 1210, 1044, 1047, 1036,
160914 /* 520 */ 1036, 121, 121, 122, 122, 122, 122, 171, 1412, 13,
160915 /* 530 */ 13, 409, 277, 277, 1186, 505, 119, 119, 118, 118,
160916 /* 540 */ 118, 117, 113, 444, 429, 563, 518, 220, 515, 1552,
160917 /* 550 */ 365, 546, 1186, 6, 532, 123, 124, 114, 1210, 1210,
160918 /* 560 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160919 /* 570 */ 145, 120, 120, 120, 120, 119, 119, 118, 118, 118,
160920 /* 580 */ 117, 113, 444, 245, 566, 474, 504, 501, 500, 566,
160921 /* 590 */ 1481, 1186, 1187, 1188, 1310, 1310, 499, 1186, 149, 425,
160922 /* 600 */ 1186, 480, 409, 274, 365, 952, 872, 56, 56, 1186,
160923 /* 610 */ 1187, 1188, 71, 71, 120, 120, 120, 120, 119, 119,
160924 /* 620 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160925 /* 630 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160926 /* 640 */ 122, 409, 541, 1552, 83, 865, 98, 6, 928, 529,
160927 /* 650 */ 848, 543, 151, 927, 1186, 1187, 1188, 1186, 1187, 1188,
160928 /* 660 */ 290, 1543, 187, 1633, 395, 123, 124, 114, 1210, 1210,
160929 /* 670 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160930 /* 680 */ 566, 954, 566, 453, 953, 120, 120, 120, 120, 119,
160931 /* 690 */ 119, 118, 118, 118, 117, 113, 444, 1152, 221, 1186,
160932 /* 700 */ 331, 453, 452, 13, 13, 13, 13, 1003, 365, 463,
160933 /* 710 */ 1152, 193, 409, 1152, 382, 1543, 1170, 32, 297, 474,
160934 /* 720 */ 195, 1527, 5, 952, 120, 120, 120, 120, 119, 119,
160935 /* 730 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160936 /* 740 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160937 /* 750 */ 122, 409, 1067, 419, 1186, 1024, 1186, 1187, 1188, 1186,
160938 /* 760 */ 419, 332, 460, 320, 544, 1545, 442, 442, 442, 566,
160939 /* 770 */ 3, 117, 113, 444, 453, 123, 124, 114, 1210, 1210,
160940 /* 780 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160941 /* 790 */ 1473, 566, 15, 15, 293, 120, 120, 120, 120, 119,
160942 /* 800 */ 119, 118, 118, 118, 117, 113, 444, 1186, 566, 1486,
160943 /* 810 */ 1412, 1186, 1187, 1188, 13, 13, 1186, 1187, 1188, 1544,
160944 /* 820 */ 271, 271, 409, 286, 308, 557, 1008, 1486, 1488, 196,
160945 /* 830 */ 288, 71, 71, 563, 120, 120, 120, 120, 119, 119,
160946 /* 840 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160947 /* 850 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160948 /* 860 */ 122, 409, 201, 1087, 1186, 1187, 1188, 1324, 304, 1529,
160949 /* 870 */ 388, 278, 278, 450, 564, 402, 922, 922, 566, 563,
160950 /* 880 */ 566, 426, 491, 480, 563, 123, 124, 114, 1210, 1210,
160951 /* 890 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122,
160952 /* 900 */ 1486, 71, 71, 13, 13, 120, 120, 120, 120, 119,
160953 /* 910 */ 119, 118, 118, 118, 117, 113, 444, 566, 545, 566,
160954 /* 920 */ 1577, 573, 2, 1238, 1092, 1092, 488, 1480, 309, 1525,
160955 /* 930 */ 142, 324, 409, 836, 837, 838, 312, 1320, 305, 363,
160956 /* 940 */ 43, 43, 57, 57, 120, 120, 120, 120, 119, 119,
160957 /* 950 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210,
160958 /* 960 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160959 /* 970 */ 122, 12, 277, 277, 566, 1152, 409, 572, 428, 1238,
160960 /* 980 */ 465, 334, 296, 474, 309, 563, 142, 249, 1152, 308,
160961 /* 990 */ 557, 1152, 321, 1320, 323, 491, 455, 71, 71, 233,
160962 /* 1000 */ 283, 101, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121,
160963 /* 1010 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119,
160964 /* 1020 */ 119, 118, 118, 118, 117, 113, 444, 1108, 277, 277,
160965 /* 1030 */ 1412, 448, 394, 1230, 439, 277, 277, 248, 247, 246,
160966 /* 1040 */ 1319, 563, 1109, 313, 198, 294, 491, 1318, 563, 464,
160967 /* 1050 */ 566, 1427, 394, 1130, 1023, 233, 414, 1110, 295, 120,
160968 /* 1060 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113,
160969 /* 1070 */ 444, 1014, 104, 71, 71, 1013, 322, 496, 908, 566,
160970 /* 1080 */ 277, 277, 277, 277, 1108, 1261, 415, 448, 909, 361,
160971 /* 1090 */ 1571, 1315, 409, 563, 952, 563, 9, 202, 255, 1109,
160972 /* 1100 */ 316, 487, 44, 44, 249, 559, 415, 1013, 1013, 1015,
160973 /* 1110 */ 443, 1231, 409, 1603, 1110, 897, 123, 124, 114, 1210,
160974 /* 1120 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160975 /* 1130 */ 122, 1231, 409, 1207, 215, 554, 123, 124, 114, 1210,
160976 /* 1140 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160977 /* 1150 */ 122, 1131, 1631, 470, 1631, 255, 123, 111, 114, 1210,
160978 /* 1160 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122,
160979 /* 1170 */ 122, 1131, 1632, 414, 1632, 120, 120, 120, 120, 119,
160980 /* 1180 */ 119, 118, 118, 118, 117, 113, 444, 221, 209, 351,
160981 /* 1190 */ 1207, 1207, 147, 1426, 491, 120, 120, 120, 120, 119,
160982 /* 1200 */ 119, 118, 118, 118, 117, 113, 444, 1256, 539, 519,
160983 /* 1210 */ 888, 551, 952, 12, 566, 120, 120, 120, 120, 119,
160984 /* 1220 */ 119, 118, 118, 118, 117, 113, 444, 538, 566, 860,
160985 /* 1230 */ 1129, 361, 1571, 346, 1356, 409, 1163, 58, 58, 339,
160986 /* 1240 */ 1355, 508, 277, 277, 277, 277, 277, 277, 1207, 889,
160987 /* 1250 */ 1129, 59, 59, 459, 363, 563, 566, 563, 96, 563,
160988 /* 1260 */ 124, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121, 121,
160989 /* 1270 */ 122, 122, 122, 122, 566, 1412, 566, 281, 1186, 60,
160990 /* 1280 */ 60, 110, 392, 392, 391, 266, 389, 860, 1163, 845,
160991 /* 1290 */ 566, 481, 566, 436, 341, 1152, 344, 61, 61, 62,
160992 /* 1300 */ 62, 967, 227, 1550, 315, 431, 540, 6, 1152, 968,
160993 /* 1310 */ 566, 1152, 314, 45, 45, 46, 46, 512, 120, 120,
160994 /* 1320 */ 120, 120, 119, 119, 118, 118, 118, 117, 113, 444,
160995 /* 1330 */ 416, 173, 1532, 47, 47, 1186, 1187, 1188, 108, 558,
160996 /* 1340 */ 325, 4, 229, 1551, 928, 566, 437, 6, 566, 927,
160997 /* 1350 */ 164, 566, 1290, 137, 1190, 561, 566, 1549, 566, 1089,
160998 /* 1360 */ 566, 6, 566, 1089, 531, 566, 868, 8, 49, 49,
160999 /* 1370 */ 228, 50, 50, 566, 63, 63, 566, 457, 445, 64,
161000 /* 1380 */ 64, 65, 65, 14, 14, 66, 66, 407, 129, 129,
161001 /* 1390 */ 555, 566, 458, 566, 1505, 486, 67, 67, 566, 52,
161002 /* 1400 */ 52, 546, 407, 467, 535, 410, 226, 1023, 566, 534,
161003 /* 1410 */ 308, 557, 1190, 407, 68, 68, 69, 69, 566, 1023,
161004 /* 1420 */ 566, 53, 53, 868, 1014, 106, 106, 525, 1013, 566,
161005 /* 1430 */ 1504, 159, 159, 107, 451, 445, 568, 567, 471, 307,
161006 /* 1440 */ 1013, 160, 160, 76, 76, 566, 1548, 466, 407, 407,
161007 /* 1450 */ 6, 1225, 54, 54, 478, 276, 219, 566, 887, 886,
161008 /* 1460 */ 1013, 1013, 1015, 84, 206, 1206, 230, 282, 72, 72,
161009 /* 1470 */ 329, 483, 1013, 1013, 1015, 1016, 27, 1576, 1174, 447,
161010 /* 1480 */ 130, 130, 281, 148, 105, 38, 103, 392, 392, 391,
161011 /* 1490 */ 266, 389, 566, 1126, 845, 396, 566, 108, 558, 566,
161012 /* 1500 */ 4, 311, 566, 30, 17, 566, 279, 227, 566, 315,
161013 /* 1510 */ 108, 558, 468, 4, 561, 73, 73, 314, 566, 157,
161014 /* 1520 */ 157, 566, 131, 131, 526, 132, 132, 561, 128, 128,
161015 /* 1530 */ 566, 158, 158, 566, 31, 291, 566, 445, 330, 521,
161016 /* 1540 */ 98, 152, 152, 420, 136, 136, 1005, 229, 254, 555,
161017 /* 1550 */ 445, 479, 336, 135, 135, 164, 133, 133, 137, 134,
161018 /* 1560 */ 134, 875, 555, 535, 566, 473, 566, 254, 536, 475,
161019 /* 1570 */ 335, 254, 98, 894, 895, 228, 535, 566, 1023, 566,
161020 /* 1580 */ 1074, 534, 210, 232, 106, 106, 1352, 75, 75, 77,
161021 /* 1590 */ 77, 1023, 107, 340, 445, 568, 567, 106, 106, 1013,
161022 /* 1600 */ 74, 74, 42, 42, 566, 107, 343, 445, 568, 567,
161023 /* 1610 */ 410, 497, 1013, 251, 359, 308, 557, 1135, 349, 875,
161024 /* 1620 */ 98, 1070, 345, 251, 358, 1591, 347, 48, 48, 1017,
161025 /* 1630 */ 1303, 1013, 1013, 1015, 1016, 27, 1289, 1287, 1074, 451,
161026 /* 1640 */ 961, 925, 254, 110, 1013, 1013, 1015, 1016, 27, 1174,
161027 /* 1650 */ 447, 970, 971, 281, 108, 558, 1288, 4, 392, 392,
161028 /* 1660 */ 391, 266, 389, 1343, 1086, 845, 1086, 1085, 858, 1085,
161029 /* 1670 */ 146, 561, 926, 354, 110, 303, 364, 553, 227, 1364,
161030 /* 1680 */ 315, 108, 558, 1411, 4, 1339, 492, 1017, 314, 1350,
161031 /* 1690 */ 1565, 552, 1417, 1268, 445, 204, 1259, 1247, 561, 1246,
161032 /* 1700 */ 1248, 1584, 269, 1336, 367, 369, 555, 371, 11, 212,
161033 /* 1710 */ 393, 225, 1393, 284, 1398, 456, 287, 327, 229, 328,
161034 /* 1720 */ 292, 445, 1386, 216, 333, 1403, 164, 477, 373, 137,
161035 /* 1730 */ 1402, 400, 502, 555, 1286, 1023, 357, 1477, 199, 1587,
161036 /* 1740 */ 211, 106, 106, 932, 1476, 1225, 228, 556, 175, 107,
161037 /* 1750 */ 200, 445, 568, 567, 258, 387, 1013, 1524, 1522, 223,
161038 /* 1760 */ 1222, 418, 1023, 83, 208, 79, 82, 184, 106, 106,
161039 /* 1770 */ 1482, 169, 177, 461, 179, 462, 107, 1399, 445, 568,
161040 /* 1780 */ 567, 410, 180, 1013, 495, 181, 308, 557, 1013, 1013,
161041 /* 1790 */ 1015, 1016, 27, 182, 35, 235, 100, 558, 398, 4,
161042 /* 1800 */ 96, 1405, 1404, 36, 484, 469, 1407, 188, 401, 1471,
161043 /* 1810 */ 451, 89, 1493, 561, 239, 1013, 1013, 1015, 1016, 27,
161044 /* 1820 */ 490, 338, 270, 241, 192, 342, 493, 242, 403, 1249,
161045 /* 1830 */ 243, 511, 432, 1297, 1306, 91, 445, 1305, 1304, 879,
161046 /* 1840 */ 217, 434, 435, 1570, 1276, 1602, 520, 1601, 555, 301,
161047 /* 1850 */ 527, 404, 1275, 302, 356, 1274, 1600, 95, 1347, 366,
161048 /* 1860 */ 1296, 362, 1348, 368, 256, 257, 1556, 1555, 438, 1346,
161049 /* 1870 */ 370, 126, 1345, 10, 1371, 546, 381, 1023, 102, 1457,
161050 /* 1880 */ 97, 530, 34, 106, 106, 570, 1180, 372, 265, 1329,
161051 /* 1890 */ 379, 107, 203, 445, 568, 567, 1328, 385, 1013, 1370,
161052 /* 1900 */ 386, 267, 268, 571, 1244, 161, 1239, 162, 1509, 1510,
161053 /* 1910 */ 1508, 143, 1507, 299, 832, 213, 214, 78, 446, 205,
161054 /* 1920 */ 310, 306, 163, 224, 1084, 140, 1082, 318, 165, 176,
161055 /* 1930 */ 1013, 1013, 1015, 1016, 27, 178, 1206, 231, 911, 234,
161056 /* 1940 */ 326, 1098, 183, 421, 166, 167, 411, 185, 85, 423,
161057 /* 1950 */ 412, 86, 174, 87, 168, 88, 1101, 236, 1097, 237,
161058 /* 1960 */ 154, 18, 238, 254, 337, 1219, 489, 1090, 240, 190,
161059 /* 1970 */ 37, 847, 189, 494, 358, 244, 350, 506, 191, 877,
161060 /* 1980 */ 90, 498, 19, 20, 503, 92, 353, 890, 300, 170,
161061 /* 1990 */ 155, 93, 513, 94, 1168, 156, 1050, 1137, 39, 218,
161062 /* 2000 */ 273, 275, 1136, 960, 194, 955, 110, 1154, 1158, 253,
161063 /* 2010 */ 7, 1162, 1156, 21, 22, 1161, 1142, 23, 24, 25,
161064 /* 2020 */ 33, 542, 26, 260, 197, 98, 1065, 1051, 1049, 1053,
161065 /* 2030 */ 1107, 1054, 1106, 259, 28, 40, 562, 1018, 859, 109,
161066 /* 2040 */ 29, 921, 390, 1176, 172, 139, 1175, 1235, 261, 1235,
161067 /* 2050 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 262, 1235, 1235,
161068 /* 2060 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1593, 1592,
161069 };
161070 static const YYCODETYPE yy_lookahead[] = {
161071 /* 0 */ 193, 223, 193, 225, 193, 193, 193, 274, 275, 276,
161072 /* 10 */ 193, 233, 219, 193, 274, 275, 276, 206, 206, 19,
161073 /* 20 */ 193, 219, 216, 216, 217, 216, 217, 193, 295, 216,
161074 /* 30 */ 217, 31, 205, 216, 217, 193, 216, 217, 213, 39,
161075 /* 40 */ 228, 193, 230, 43, 44, 45, 46, 47, 48, 49,
161076 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19,
161077 /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276,
161078 /* 70 */ 195, 193, 197, 253, 216, 262, 274, 275, 276, 204,
161079 /* 80 */ 238, 204, 262, 43, 44, 45, 46, 47, 48, 49,
161080 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 264, 274,
161081 /* 100 */ 275, 276, 102, 103, 104, 105, 106, 107, 108, 109,
161082 /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211,
161083 /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252,
161084 /* 130 */ 19, 314, 315, 256, 257, 309, 25, 72, 296, 313,
161085 /* 140 */ 193, 266, 102, 103, 104, 105, 106, 107, 108, 109,
161086 /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48,
161087 /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81,
161088 /* 170 */ 292, 59, 307, 298, 108, 109, 110, 111, 112, 113,
161089 /* 180 */ 69, 116, 117, 118, 72, 128, 129, 193, 241, 22,
161090 /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105,
161091 /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 193,
161092 /* 210 */ 216, 217, 25, 102, 103, 104, 105, 106, 107, 108,
161093 /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117,
161094 /* 230 */ 118, 106, 107, 19, 216, 54, 55, 56, 57, 102,
161095 /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
161096 /* 250 */ 113, 304, 25, 46, 47, 48, 49, 43, 44, 45,
161097 /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
161098 /* 270 */ 56, 57, 193, 106, 107, 59, 193, 19, 153, 263,
161099 /* 280 */ 155, 67, 24, 102, 103, 104, 105, 106, 107, 108,
161100 /* 290 */ 109, 110, 111, 112, 113, 216, 217, 59, 230, 216,
161101 /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51,
161102 /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105,
161103 /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 142,
161104 /* 330 */ 59, 193, 116, 117, 118, 119, 253, 204, 122, 123,
161105 /* 340 */ 124, 19, 20, 81, 22, 262, 108, 19, 132, 165,
161106 /* 350 */ 166, 193, 24, 126, 116, 117, 118, 278, 36, 193,
161107 /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
161108 /* 370 */ 112, 113, 239, 240, 216, 217, 215, 106, 107, 241,
161109 /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118,
161110 /* 390 */ 73, 120, 26, 71, 193, 22, 193, 231, 81, 128,
161111 /* 400 */ 138, 139, 269, 81, 43, 44, 45, 46, 47, 48,
161112 /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 216,
161113 /* 420 */ 217, 198, 100, 95, 153, 59, 155, 193, 106, 107,
161114 /* 430 */ 235, 236, 59, 193, 193, 249, 114, 251, 116, 117,
161115 /* 440 */ 118, 113, 304, 121, 127, 204, 193, 119, 120, 121,
161116 /* 450 */ 122, 123, 124, 125, 193, 138, 139, 216, 217, 131,
161117 /* 460 */ 138, 139, 193, 102, 103, 104, 105, 106, 107, 108,
161118 /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157,
161119 /* 480 */ 239, 240, 116, 117, 118, 76, 193, 193, 19, 116,
161120 /* 490 */ 117, 118, 23, 252, 253, 193, 87, 204, 89, 238,
161121 /* 500 */ 193, 92, 268, 262, 281, 203, 193, 205, 285, 216,
161122 /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50,
161123 /* 520 */ 51, 52, 53, 54, 55, 56, 57, 193, 193, 216,
161124 /* 530 */ 217, 19, 239, 240, 59, 23, 106, 107, 108, 109,
161125 /* 540 */ 110, 111, 112, 113, 231, 252, 253, 193, 308, 309,
161126 /* 550 */ 193, 145, 59, 313, 145, 43, 44, 45, 46, 47,
161127 /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161128 /* 570 */ 164, 102, 103, 104, 105, 106, 107, 108, 109, 110,
161129 /* 580 */ 111, 112, 113, 119, 193, 193, 122, 123, 124, 193,
161130 /* 590 */ 283, 116, 117, 118, 235, 236, 132, 59, 241, 264,
161131 /* 600 */ 59, 193, 19, 23, 193, 25, 23, 216, 217, 116,
161132 /* 610 */ 117, 118, 216, 217, 102, 103, 104, 105, 106, 107,
161133 /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161134 /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161135 /* 640 */ 57, 19, 308, 309, 151, 23, 25, 313, 135, 253,
161136 /* 650 */ 21, 193, 241, 140, 116, 117, 118, 116, 117, 118,
161137 /* 660 */ 268, 304, 22, 301, 302, 43, 44, 45, 46, 47,
161138 /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161139 /* 680 */ 193, 143, 193, 193, 143, 102, 103, 104, 105, 106,
161140 /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59,
161141 /* 700 */ 292, 211, 212, 216, 217, 216, 217, 73, 193, 80,
161142 /* 710 */ 89, 25, 19, 92, 193, 304, 23, 22, 231, 193,
161143 /* 720 */ 231, 193, 22, 143, 102, 103, 104, 105, 106, 107,
161144 /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161145 /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161146 /* 750 */ 57, 19, 123, 193, 59, 23, 116, 117, 118, 59,
161147 /* 760 */ 193, 127, 128, 129, 306, 307, 210, 211, 212, 193,
161148 /* 770 */ 22, 111, 112, 113, 284, 43, 44, 45, 46, 47,
161149 /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161150 /* 790 */ 161, 193, 216, 217, 268, 102, 103, 104, 105, 106,
161151 /* 800 */ 107, 108, 109, 110, 111, 112, 113, 59, 193, 193,
161152 /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 304,
161153 /* 820 */ 239, 240, 19, 263, 138, 139, 23, 211, 212, 231,
161154 /* 830 */ 263, 216, 217, 252, 102, 103, 104, 105, 106, 107,
161155 /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161156 /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161157 /* 860 */ 57, 19, 193, 11, 116, 117, 118, 240, 253, 193,
161158 /* 870 */ 201, 239, 240, 193, 134, 206, 136, 137, 193, 252,
161159 /* 880 */ 193, 264, 193, 193, 252, 43, 44, 45, 46, 47,
161160 /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
161161 /* 900 */ 284, 216, 217, 216, 217, 102, 103, 104, 105, 106,
161162 /* 910 */ 107, 108, 109, 110, 111, 112, 113, 193, 231, 193,
161163 /* 920 */ 187, 188, 189, 190, 127, 128, 129, 238, 195, 193,
161164 /* 930 */ 197, 16, 19, 7, 8, 9, 193, 204, 253, 193,
161165 /* 940 */ 216, 217, 216, 217, 102, 103, 104, 105, 106, 107,
161166 /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46,
161167 /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161168 /* 970 */ 57, 213, 239, 240, 193, 76, 19, 188, 232, 190,
161169 /* 980 */ 128, 129, 292, 193, 195, 252, 197, 46, 89, 138,
161170 /* 990 */ 139, 92, 77, 204, 79, 193, 269, 216, 217, 266,
161171 /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52,
161172 /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106,
161173 /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240,
161174 /* 1030 */ 193, 298, 22, 23, 253, 239, 240, 127, 128, 129,
161175 /* 1040 */ 238, 252, 27, 193, 286, 204, 193, 204, 252, 291,
161176 /* 1050 */ 193, 273, 22, 23, 100, 266, 115, 42, 268, 102,
161177 /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
161178 /* 1070 */ 113, 117, 159, 216, 217, 121, 161, 19, 63, 193,
161179 /* 1080 */ 239, 240, 239, 240, 12, 208, 209, 298, 73, 311,
161180 /* 1090 */ 312, 238, 19, 252, 25, 252, 22, 24, 24, 27,
161181 /* 1100 */ 193, 264, 216, 217, 46, 208, 209, 153, 154, 155,
161182 /* 1110 */ 253, 101, 19, 23, 42, 25, 43, 44, 45, 46,
161183 /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161184 /* 1130 */ 57, 101, 19, 59, 25, 63, 43, 44, 45, 46,
161185 /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161186 /* 1150 */ 57, 22, 23, 115, 25, 24, 43, 44, 45, 46,
161187 /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
161188 /* 1170 */ 57, 22, 23, 115, 25, 102, 103, 104, 105, 106,
161189 /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 118, 150, 131,
161190 /* 1190 */ 59, 117, 22, 273, 193, 102, 103, 104, 105, 106,
161191 /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 204, 66, 204,
161192 /* 1210 */ 35, 204, 143, 213, 193, 102, 103, 104, 105, 106,
161193 /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 85, 193, 59,
161194 /* 1230 */ 101, 311, 312, 16, 193, 19, 94, 216, 217, 238,
161195 /* 1240 */ 193, 66, 239, 240, 239, 240, 239, 240, 117, 74,
161196 /* 1250 */ 101, 216, 217, 193, 193, 252, 193, 252, 149, 252,
161197 /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
161198 /* 1270 */ 54, 55, 56, 57, 193, 193, 193, 5, 59, 216,
161199 /* 1280 */ 217, 25, 10, 11, 12, 13, 14, 117, 146, 17,
161200 /* 1290 */ 193, 291, 193, 232, 77, 76, 79, 216, 217, 216,
161201 /* 1300 */ 217, 31, 30, 309, 32, 130, 87, 313, 89, 39,
161202 /* 1310 */ 193, 92, 40, 216, 217, 216, 217, 108, 102, 103,
161203 /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
161204 /* 1330 */ 299, 300, 193, 216, 217, 116, 117, 118, 19, 20,
161205 /* 1340 */ 193, 22, 70, 309, 135, 193, 264, 313, 193, 140,
161206 /* 1350 */ 78, 193, 226, 81, 59, 36, 193, 309, 193, 29,
161207 /* 1360 */ 193, 313, 193, 33, 145, 193, 59, 48, 216, 217,
161208 /* 1370 */ 98, 216, 217, 193, 216, 217, 193, 244, 59, 216,
161209 /* 1380 */ 217, 216, 217, 216, 217, 216, 217, 254, 216, 217,
161210 /* 1390 */ 71, 193, 244, 193, 193, 65, 216, 217, 193, 216,
161211 /* 1400 */ 217, 145, 254, 244, 85, 133, 15, 100, 193, 90,
161212 /* 1410 */ 138, 139, 117, 254, 216, 217, 216, 217, 193, 100,
161213 /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 19, 121, 193,
161214 /* 1430 */ 193, 216, 217, 114, 162, 116, 117, 118, 244, 244,
161215 /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 129, 254, 254,
161216 /* 1450 */ 313, 60, 216, 217, 19, 256, 257, 193, 120, 121,
161217 /* 1460 */ 153, 154, 155, 149, 150, 25, 24, 99, 216, 217,
161218 /* 1470 */ 152, 193, 153, 154, 155, 156, 157, 0, 1, 2,
161219 /* 1480 */ 216, 217, 5, 22, 158, 24, 160, 10, 11, 12,
161220 /* 1490 */ 13, 14, 193, 23, 17, 25, 193, 19, 20, 193,
161221 /* 1500 */ 22, 133, 193, 22, 22, 193, 22, 30, 193, 32,
161222 /* 1510 */ 19, 20, 129, 22, 36, 216, 217, 40, 193, 216,
161223 /* 1520 */ 217, 193, 216, 217, 116, 216, 217, 36, 216, 217,
161224 /* 1530 */ 193, 216, 217, 193, 53, 152, 193, 59, 23, 19,
161225 /* 1540 */ 25, 216, 217, 61, 216, 217, 23, 70, 25, 71,
161226 /* 1550 */ 59, 116, 193, 216, 217, 78, 216, 217, 81, 216,
161227 /* 1560 */ 217, 59, 71, 85, 193, 23, 193, 25, 90, 23,
161228 /* 1570 */ 23, 25, 25, 7, 8, 98, 85, 193, 100, 193,
161229 /* 1580 */ 59, 90, 142, 141, 106, 107, 193, 216, 217, 216,
161230 /* 1590 */ 217, 100, 114, 193, 116, 117, 118, 106, 107, 121,
161231 /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118,
161232 /* 1610 */ 133, 23, 121, 25, 121, 138, 139, 97, 23, 117,
161233 /* 1620 */ 25, 23, 193, 25, 131, 141, 193, 216, 217, 59,
161234 /* 1630 */ 193, 153, 154, 155, 156, 157, 226, 193, 117, 162,
161235 /* 1640 */ 23, 23, 25, 25, 153, 154, 155, 156, 157, 1,
161236 /* 1650 */ 2, 83, 84, 5, 19, 20, 226, 22, 10, 11,
161237 /* 1660 */ 12, 13, 14, 258, 153, 17, 155, 153, 23, 155,
161238 /* 1670 */ 25, 36, 23, 193, 25, 255, 193, 236, 30, 193,
161239 /* 1680 */ 32, 19, 20, 193, 22, 193, 288, 117, 40, 193,
161240 /* 1690 */ 318, 193, 193, 193, 59, 242, 193, 193, 36, 193,
161241 /* 1700 */ 193, 193, 287, 255, 255, 255, 71, 255, 243, 214,
161242 /* 1710 */ 191, 297, 267, 245, 271, 259, 259, 293, 70, 246,
161243 /* 1720 */ 246, 59, 267, 229, 245, 271, 78, 293, 259, 81,
161244 /* 1730 */ 271, 271, 220, 71, 225, 100, 219, 219, 249, 196,
161245 /* 1740 */ 243, 106, 107, 108, 219, 60, 98, 280, 297, 114,
161246 /* 1750 */ 249, 116, 117, 118, 141, 245, 121, 200, 200, 297,
161247 /* 1760 */ 38, 200, 100, 151, 150, 294, 294, 22, 106, 107,
161248 /* 1770 */ 283, 43, 234, 18, 237, 200, 114, 272, 116, 117,
161249 /* 1780 */ 118, 133, 237, 121, 18, 237, 138, 139, 153, 154,
161250 /* 1790 */ 155, 156, 157, 237, 270, 199, 19, 20, 246, 22,
161251 /* 1800 */ 149, 272, 272, 270, 200, 246, 234, 234, 246, 246,
161252 /* 1810 */ 162, 158, 290, 36, 199, 153, 154, 155, 156, 157,
161253 /* 1820 */ 62, 289, 200, 199, 22, 200, 221, 199, 221, 200,
161254 /* 1830 */ 199, 115, 64, 227, 218, 22, 59, 218, 218, 126,
161255 /* 1840 */ 165, 24, 113, 312, 218, 224, 305, 224, 71, 282,
161256 /* 1850 */ 144, 221, 220, 282, 218, 218, 218, 115, 261, 260,
161257 /* 1860 */ 227, 221, 261, 260, 200, 91, 317, 317, 82, 261,
161258 /* 1870 */ 260, 148, 261, 22, 265, 145, 200, 100, 158, 277,
161259 /* 1880 */ 147, 146, 25, 106, 107, 202, 13, 260, 194, 250,
161260 /* 1890 */ 249, 114, 248, 116, 117, 118, 250, 247, 121, 265,
161261 /* 1900 */ 246, 194, 6, 192, 192, 207, 192, 207, 213, 213,
161262 /* 1910 */ 213, 222, 213, 222, 4, 214, 214, 213, 3, 22,
161263 /* 1920 */ 163, 279, 207, 15, 23, 16, 23, 139, 130, 151,
161264 /* 1930 */ 153, 154, 155, 156, 157, 142, 25, 24, 20, 144,
161265 /* 1940 */ 16, 1, 142, 61, 130, 130, 303, 151, 53, 37,
161266 /* 1950 */ 303, 53, 300, 53, 130, 53, 116, 34, 1, 141,
161267 /* 1960 */ 5, 22, 115, 25, 161, 75, 41, 68, 141, 115,
161268 /* 1970 */ 24, 20, 68, 19, 131, 125, 23, 96, 22, 59,
161269 /* 1980 */ 22, 67, 22, 22, 67, 22, 24, 28, 67, 37,
161270 /* 1990 */ 23, 149, 22, 25, 23, 23, 23, 23, 22, 141,
161271 /* 2000 */ 23, 23, 97, 116, 22, 143, 25, 88, 75, 34,
161272 /* 2010 */ 44, 75, 86, 34, 34, 93, 23, 34, 34, 34,
161273 /* 2020 */ 22, 24, 34, 22, 25, 25, 23, 23, 23, 23,
161274 /* 2030 */ 23, 11, 23, 25, 22, 22, 25, 23, 23, 22,
161275 /* 2040 */ 22, 135, 15, 1, 25, 23, 1, 319, 141, 319,
161276 /* 2050 */ 319, 319, 319, 319, 319, 319, 319, 141, 319, 319,
161277 /* 2060 */ 319, 319, 319, 319, 319, 319, 319, 319, 141, 141,
161278 /* 2070 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161279 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161280 /* 2090 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161281 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161282 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161283 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161284 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161285 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161286 /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161287 /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161288 /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161289 /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161290 /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161291 /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161292 /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161293 /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161294 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161295 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
161296 /* 2250 */ 319, 319, 319, 319, 319,
161297 };
161298 #define YY_SHIFT_COUNT (573)
161299 #define YY_SHIFT_MIN (0)
161300 #define YY_SHIFT_MAX (2045)
161301 static const unsigned short int yy_shift_ofst[] = {
161302 /* 0 */ 1648, 1477, 1272, 322, 322, 262, 1319, 1478, 1491, 1662,
161303 /* 10 */ 1662, 1662, 317, 0, 0, 214, 1093, 1662, 1662, 1662,
161304 /* 20 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161305 /* 30 */ 271, 271, 1219, 1219, 216, 88, 262, 262, 262, 262,
161306 /* 40 */ 262, 40, 111, 258, 361, 469, 512, 583, 622, 693,
161307 /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093,
161308 /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
161309 /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662,
161310 /* 80 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161311 /* 90 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161312 /* 100 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662,
161313 /* 110 */ 1662, 1662, 1662, 1662, 1777, 1662, 1662, 1662, 1662, 1662,
161314 /* 120 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 137, 181,
161315 /* 130 */ 181, 181, 181, 181, 94, 430, 66, 65, 112, 366,
161316 /* 140 */ 475, 475, 629, 1058, 475, 475, 125, 125, 475, 686,
161317 /* 150 */ 686, 686, 660, 686, 57, 184, 184, 77, 77, 2070,
161318 /* 160 */ 2070, 328, 328, 328, 493, 373, 373, 373, 373, 1015,
161319 /* 170 */ 1015, 409, 366, 1129, 1149, 475, 475, 475, 475, 475,
161320 /* 180 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
161321 /* 190 */ 475, 475, 475, 475, 475, 621, 621, 475, 852, 899,
161322 /* 200 */ 899, 1295, 1295, 406, 851, 2070, 2070, 2070, 2070, 2070,
161323 /* 210 */ 2070, 2070, 1307, 954, 954, 640, 464, 695, 238, 700,
161324 /* 220 */ 538, 541, 748, 475, 475, 475, 475, 475, 475, 475,
161325 /* 230 */ 475, 475, 475, 634, 475, 475, 475, 475, 475, 475,
161326 /* 240 */ 475, 475, 475, 475, 475, 475, 1175, 1175, 1175, 475,
161327 /* 250 */ 475, 475, 580, 475, 475, 475, 1074, 1142, 475, 475,
161328 /* 260 */ 1072, 475, 475, 475, 475, 475, 475, 475, 475, 797,
161329 /* 270 */ 1330, 740, 1131, 1131, 1131, 1131, 1069, 740, 740, 1209,
161330 /* 280 */ 167, 926, 1391, 1038, 1314, 187, 1408, 1314, 1408, 1435,
161331 /* 290 */ 1109, 1038, 1038, 1109, 1038, 187, 1435, 227, 1090, 941,
161332 /* 300 */ 1270, 1270, 1270, 1408, 1256, 1256, 1326, 1440, 513, 1461,
161333 /* 310 */ 1685, 1685, 1613, 1613, 1722, 1722, 1613, 1612, 1614, 1745,
161334 /* 320 */ 1728, 1755, 1755, 1755, 1755, 1613, 1766, 1651, 1614, 1614,
161335 /* 330 */ 1651, 1745, 1728, 1651, 1728, 1651, 1613, 1766, 1653, 1758,
161336 /* 340 */ 1613, 1766, 1802, 1613, 1766, 1613, 1766, 1802, 1716, 1716,
161337 /* 350 */ 1716, 1768, 1813, 1813, 1802, 1716, 1713, 1716, 1768, 1716,
161338 /* 360 */ 1716, 1675, 1817, 1729, 1729, 1802, 1706, 1742, 1706, 1742,
161339 /* 370 */ 1706, 1742, 1706, 1742, 1613, 1774, 1774, 1786, 1786, 1723,
161340 /* 380 */ 1730, 1851, 1613, 1720, 1723, 1733, 1735, 1651, 1857, 1873,
161341 /* 390 */ 1873, 1896, 1896, 1896, 2070, 2070, 2070, 2070, 2070, 2070,
161342 /* 400 */ 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 207,
161343 /* 410 */ 915, 1010, 1030, 1217, 910, 1170, 1470, 1368, 1481, 1442,
161344 /* 420 */ 1318, 1383, 1515, 1482, 1523, 1542, 1546, 1547, 1588, 1595,
161345 /* 430 */ 1502, 1338, 1566, 1493, 1520, 1521, 1598, 1617, 1568, 1618,
161346 /* 440 */ 1511, 1514, 1645, 1649, 1570, 1484, 1910, 1915, 1897, 1757,
161347 /* 450 */ 1908, 1909, 1901, 1903, 1788, 1778, 1798, 1911, 1911, 1913,
161348 /* 460 */ 1793, 1918, 1795, 1924, 1940, 1800, 1814, 1911, 1815, 1882,
161349 /* 470 */ 1912, 1911, 1796, 1895, 1898, 1900, 1902, 1824, 1840, 1923,
161350 /* 480 */ 1818, 1957, 1955, 1939, 1847, 1803, 1899, 1938, 1904, 1890,
161351 /* 490 */ 1925, 1827, 1854, 1946, 1951, 1954, 1843, 1850, 1956, 1914,
161352 /* 500 */ 1958, 1960, 1953, 1961, 1917, 1920, 1962, 1881, 1959, 1963,
161353 /* 510 */ 1921, 1952, 1967, 1842, 1970, 1971, 1972, 1973, 1968, 1974,
161354 /* 520 */ 1976, 1905, 1858, 1977, 1978, 1887, 1975, 1982, 1862, 1981,
161355 /* 530 */ 1979, 1980, 1983, 1984, 1919, 1933, 1926, 1966, 1936, 1922,
161356 /* 540 */ 1985, 1993, 1998, 1997, 1999, 2000, 1988, 2003, 1981, 2004,
161357 /* 550 */ 2005, 2006, 2007, 2008, 2009, 2001, 2020, 2012, 2013, 2014,
161358 /* 560 */ 2015, 2017, 2018, 2011, 1906, 1907, 1916, 1927, 1928, 2019,
161359 /* 570 */ 2022, 2027, 2042, 2045,
161360 };
161361 #define YY_REDUCE_COUNT (408)
161362 #define YY_REDUCE_MIN (-267)
161363 #define YY_REDUCE_MAX (1715)
161364 static const short yy_reduce_ofst[] = {
161365 /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187,
161366 /* 10 */ -180, 83, 133, -207, -198, -267, -175, -6, 166, 313,
161367 /* 20 */ 487, 396, 489, 598, 615, 685, 687, 79, 781, 857,
161368 /* 30 */ 490, 616, 240, 334, -188, 796, 841, 843, 1003, 1005,
161369 /* 40 */ 1007, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161370 /* 50 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161371 /* 60 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260,
161372 /* 70 */ -260, -260, -260, -260, -260, -260, -260, -260, 158, 203,
161373 /* 80 */ 391, 576, 724, 726, 886, 1021, 1035, 1063, 1081, 1083,
161374 /* 90 */ 1097, 1099, 1117, 1152, 1155, 1158, 1163, 1165, 1167, 1169,
161375 /* 100 */ 1172, 1180, 1183, 1198, 1200, 1205, 1215, 1225, 1227, 1236,
161376 /* 110 */ 1252, 1264, 1299, 1303, 1306, 1309, 1312, 1315, 1325, 1328,
161377 /* 120 */ 1337, 1340, 1343, 1371, 1373, 1384, 1386, 1411, -260, -260,
161378 /* 130 */ -260, -260, -260, -260, -260, -260, -260, -53, 138, 302,
161379 /* 140 */ -158, 357, 223, -222, 411, 458, -92, 556, 669, 581,
161380 /* 150 */ 632, 581, -260, 632, 758, 778, 920, -260, -260, -260,
161381 /* 160 */ -260, 161, 161, 161, 307, 234, 392, 526, 790, 195,
161382 /* 170 */ 359, -174, -173, 362, 362, -189, 16, 560, 567, 261,
161383 /* 180 */ 689, 802, 853, -122, -166, 408, 335, 617, 690, 837,
161384 /* 190 */ 1001, 746, 1061, 515, 1082, 994, 1034, -135, 1000, 1048,
161385 /* 200 */ 1137, 877, 897, 186, 627, 1031, 1133, 1148, 1159, 1194,
161386 /* 210 */ 1199, 1195, -194, -142, 18, -152, 68, 201, 253, 269,
161387 /* 220 */ 294, 354, 521, 528, 676, 680, 736, 743, 850, 907,
161388 /* 230 */ 1041, 1047, 1060, 727, 1139, 1147, 1201, 1237, 1278, 1359,
161389 /* 240 */ 1393, 1400, 1413, 1429, 1433, 1437, 1126, 1410, 1430, 1444,
161390 /* 250 */ 1480, 1483, 1405, 1486, 1490, 1492, 1420, 1372, 1496, 1498,
161391 /* 260 */ 1441, 1499, 253, 1500, 1503, 1504, 1506, 1507, 1508, 1398,
161392 /* 270 */ 1415, 1453, 1448, 1449, 1450, 1452, 1405, 1453, 1453, 1465,
161393 /* 280 */ 1495, 1519, 1414, 1443, 1445, 1468, 1456, 1455, 1457, 1424,
161394 /* 290 */ 1473, 1454, 1459, 1474, 1460, 1479, 1434, 1512, 1494, 1509,
161395 /* 300 */ 1517, 1518, 1525, 1469, 1489, 1501, 1467, 1510, 1497, 1543,
161396 /* 310 */ 1451, 1462, 1557, 1558, 1471, 1472, 1561, 1487, 1505, 1524,
161397 /* 320 */ 1538, 1537, 1545, 1548, 1556, 1575, 1596, 1552, 1529, 1530,
161398 /* 330 */ 1559, 1533, 1572, 1562, 1573, 1563, 1604, 1615, 1522, 1532,
161399 /* 340 */ 1622, 1624, 1605, 1625, 1628, 1629, 1631, 1607, 1616, 1619,
161400 /* 350 */ 1620, 1606, 1621, 1623, 1630, 1626, 1632, 1636, 1633, 1637,
161401 /* 360 */ 1638, 1531, 1541, 1567, 1571, 1640, 1597, 1599, 1601, 1603,
161402 /* 370 */ 1608, 1610, 1611, 1627, 1664, 1549, 1550, 1609, 1634, 1639,
161403 /* 380 */ 1641, 1602, 1676, 1642, 1646, 1644, 1650, 1654, 1683, 1694,
161404 /* 390 */ 1707, 1711, 1712, 1714, 1643, 1647, 1652, 1698, 1695, 1696,
161405 /* 400 */ 1697, 1699, 1700, 1689, 1691, 1701, 1702, 1704, 1715,
161406 };
161407 static const YYACTIONTYPE yy_default[] = {
161408 /* 0 */ 1637, 1637, 1637, 1466, 1233, 1344, 1233, 1233, 1233, 1466,
161409 /* 10 */ 1466, 1466, 1233, 1374, 1374, 1519, 1266, 1233, 1233, 1233,
161410 /* 20 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1465, 1233, 1233,
161411 /* 30 */ 1233, 1233, 1554, 1554, 1233, 1233, 1233, 1233, 1233, 1233,
161412 /* 40 */ 1233, 1233, 1383, 1233, 1390, 1233, 1233, 1233, 1233, 1233,
161413 /* 50 */ 1467, 1468, 1233, 1233, 1233, 1518, 1520, 1483, 1397, 1396,
161414 /* 60 */ 1395, 1394, 1501, 1361, 1388, 1381, 1385, 1461, 1462, 1460,
161415 /* 70 */ 1464, 1468, 1467, 1233, 1384, 1431, 1445, 1430, 1233, 1233,
161416 /* 80 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161417 /* 90 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161418 /* 100 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161419 /* 110 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161420 /* 120 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1439, 1444,
161421 /* 130 */ 1451, 1443, 1440, 1433, 1432, 1434, 1435, 1233, 1233, 1257,
161422 /* 140 */ 1233, 1233, 1254, 1308, 1233, 1233, 1233, 1233, 1233, 1538,
161423 /* 150 */ 1537, 1233, 1436, 1233, 1266, 1425, 1424, 1448, 1437, 1447,
161424 /* 160 */ 1446, 1526, 1590, 1589, 1484, 1233, 1233, 1233, 1233, 1233,
161425 /* 170 */ 1233, 1554, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161426 /* 180 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161427 /* 190 */ 1233, 1233, 1233, 1233, 1233, 1554, 1554, 1233, 1266, 1554,
161428 /* 200 */ 1554, 1262, 1262, 1368, 1233, 1533, 1335, 1335, 1335, 1335,
161429 /* 210 */ 1344, 1335, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161430 /* 220 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1523, 1521, 1233,
161431 /* 230 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161432 /* 240 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161433 /* 250 */ 1233, 1233, 1233, 1233, 1233, 1233, 1340, 1233, 1233, 1233,
161434 /* 260 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1583, 1233,
161435 /* 270 */ 1496, 1322, 1340, 1340, 1340, 1340, 1342, 1323, 1321, 1334,
161436 /* 280 */ 1267, 1240, 1629, 1400, 1389, 1341, 1363, 1389, 1363, 1626,
161437 /* 290 */ 1387, 1400, 1400, 1387, 1400, 1341, 1626, 1283, 1606, 1278,
161438 /* 300 */ 1374, 1374, 1374, 1363, 1368, 1368, 1463, 1341, 1334, 1233,
161439 /* 310 */ 1629, 1629, 1349, 1349, 1628, 1628, 1349, 1484, 1613, 1409,
161440 /* 320 */ 1311, 1317, 1317, 1317, 1317, 1349, 1251, 1387, 1613, 1613,
161441 /* 330 */ 1387, 1409, 1311, 1387, 1311, 1387, 1349, 1251, 1500, 1623,
161442 /* 340 */ 1349, 1251, 1474, 1349, 1251, 1349, 1251, 1474, 1309, 1309,
161443 /* 350 */ 1309, 1298, 1233, 1233, 1474, 1309, 1283, 1309, 1298, 1309,
161444 /* 360 */ 1309, 1572, 1233, 1478, 1478, 1474, 1367, 1362, 1367, 1362,
161445 /* 370 */ 1367, 1362, 1367, 1362, 1349, 1564, 1564, 1377, 1377, 1382,
161446 /* 380 */ 1368, 1469, 1349, 1233, 1382, 1380, 1378, 1387, 1301, 1586,
161447 /* 390 */ 1586, 1582, 1582, 1582, 1634, 1634, 1533, 1599, 1266, 1266,
161448 /* 400 */ 1266, 1266, 1599, 1285, 1285, 1267, 1267, 1266, 1599, 1233,
161449 /* 410 */ 1233, 1233, 1233, 1233, 1233, 1594, 1233, 1528, 1485, 1353,
161450 /* 420 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161451 /* 430 */ 1233, 1233, 1233, 1233, 1539, 1233, 1233, 1233, 1233, 1233,
161452 /* 440 */ 1233, 1233, 1233, 1233, 1233, 1414, 1233, 1236, 1530, 1233,
161453 /* 450 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1391, 1392, 1354,
161454 /* 460 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1406, 1233, 1233,
161455 /* 470 */ 1233, 1401, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161456 /* 480 */ 1625, 1233, 1233, 1233, 1233, 1233, 1233, 1499, 1498, 1233,
161457 /* 490 */ 1233, 1351, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161458 /* 500 */ 1233, 1233, 1233, 1233, 1233, 1281, 1233, 1233, 1233, 1233,
161459 /* 510 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161460 /* 520 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1379,
161461 /* 530 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161462 /* 540 */ 1233, 1233, 1233, 1233, 1569, 1369, 1233, 1233, 1616, 1233,
161463 /* 550 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233,
161464 /* 560 */ 1233, 1233, 1233, 1610, 1325, 1416, 1233, 1415, 1419, 1255,
161465 /* 570 */ 1233, 1245, 1233, 1233,
161466 };
161467 /********** End of lemon-generated parsing tables *****************************/
161468
161469 /* The next table maps tokens (terminal symbols) into fallback tokens.
161470 ** If a construct like the following:
@@ -161296,14 +161525,14 @@
161525 59, /* DETACH => ID */
161526 59, /* EACH => ID */
161527 59, /* FAIL => ID */
161528 0, /* OR => nothing */
161529 0, /* AND => nothing */
161530 0, /* IS => nothing */
161531 59, /* MATCH => ID */
161532 59, /* LIKE_KW => ID */
161533 0, /* BETWEEN => nothing */
 
161534 0, /* IN => nothing */
161535 0, /* ISNULL => nothing */
161536 0, /* NOTNULL => nothing */
161537 0, /* NE => nothing */
161538 0, /* EQ => nothing */
@@ -161363,10 +161592,11 @@
161592 0, /* MINUS => nothing */
161593 0, /* STAR => nothing */
161594 0, /* SLASH => nothing */
161595 0, /* REM => nothing */
161596 0, /* CONCAT => nothing */
161597 0, /* PTR => nothing */
161598 0, /* COLLATE => nothing */
161599 0, /* BITNOT => nothing */
161600 0, /* ON => nothing */
161601 0, /* INDEXED => nothing */
161602 0, /* STRING => nothing */
@@ -161568,14 +161798,14 @@
161798 /* 40 */ "DETACH",
161799 /* 41 */ "EACH",
161800 /* 42 */ "FAIL",
161801 /* 43 */ "OR",
161802 /* 44 */ "AND",
161803 /* 45 */ "IS",
161804 /* 46 */ "MATCH",
161805 /* 47 */ "LIKE_KW",
161806 /* 48 */ "BETWEEN",
161807 /* 49 */ "IN",
161808 /* 50 */ "ISNULL",
161809 /* 51 */ "NOTNULL",
161810 /* 52 */ "NE",
161811 /* 53 */ "EQ",
@@ -161635,216 +161865,217 @@
161865 /* 107 */ "MINUS",
161866 /* 108 */ "STAR",
161867 /* 109 */ "SLASH",
161868 /* 110 */ "REM",
161869 /* 111 */ "CONCAT",
161870 /* 112 */ "PTR",
161871 /* 113 */ "COLLATE",
161872 /* 114 */ "BITNOT",
161873 /* 115 */ "ON",
161874 /* 116 */ "INDEXED",
161875 /* 117 */ "STRING",
161876 /* 118 */ "JOIN_KW",
161877 /* 119 */ "CONSTRAINT",
161878 /* 120 */ "DEFAULT",
161879 /* 121 */ "NULL",
161880 /* 122 */ "PRIMARY",
161881 /* 123 */ "UNIQUE",
161882 /* 124 */ "CHECK",
161883 /* 125 */ "REFERENCES",
161884 /* 126 */ "AUTOINCR",
161885 /* 127 */ "INSERT",
161886 /* 128 */ "DELETE",
161887 /* 129 */ "UPDATE",
161888 /* 130 */ "SET",
161889 /* 131 */ "DEFERRABLE",
161890 /* 132 */ "FOREIGN",
161891 /* 133 */ "DROP",
161892 /* 134 */ "UNION",
161893 /* 135 */ "ALL",
161894 /* 136 */ "EXCEPT",
161895 /* 137 */ "INTERSECT",
161896 /* 138 */ "SELECT",
161897 /* 139 */ "VALUES",
161898 /* 140 */ "DISTINCT",
161899 /* 141 */ "DOT",
161900 /* 142 */ "FROM",
161901 /* 143 */ "JOIN",
161902 /* 144 */ "USING",
161903 /* 145 */ "ORDER",
161904 /* 146 */ "GROUP",
161905 /* 147 */ "HAVING",
161906 /* 148 */ "LIMIT",
161907 /* 149 */ "WHERE",
161908 /* 150 */ "RETURNING",
161909 /* 151 */ "INTO",
161910 /* 152 */ "NOTHING",
161911 /* 153 */ "FLOAT",
161912 /* 154 */ "BLOB",
161913 /* 155 */ "INTEGER",
161914 /* 156 */ "VARIABLE",
161915 /* 157 */ "CASE",
161916 /* 158 */ "WHEN",
161917 /* 159 */ "THEN",
161918 /* 160 */ "ELSE",
161919 /* 161 */ "INDEX",
161920 /* 162 */ "ALTER",
161921 /* 163 */ "ADD",
161922 /* 164 */ "WINDOW",
161923 /* 165 */ "OVER",
161924 /* 166 */ "FILTER",
161925 /* 167 */ "COLUMN",
161926 /* 168 */ "AGG_FUNCTION",
161927 /* 169 */ "AGG_COLUMN",
161928 /* 170 */ "TRUEFALSE",
161929 /* 171 */ "ISNOT",
161930 /* 172 */ "FUNCTION",
161931 /* 173 */ "UMINUS",
161932 /* 174 */ "UPLUS",
161933 /* 175 */ "TRUTH",
161934 /* 176 */ "REGISTER",
161935 /* 177 */ "VECTOR",
161936 /* 178 */ "SELECT_COLUMN",
161937 /* 179 */ "IF_NULL_ROW",
161938 /* 180 */ "ASTERISK",
161939 /* 181 */ "SPAN",
161940 /* 182 */ "ERROR",
161941 /* 183 */ "SPACE",
161942 /* 184 */ "ILLEGAL",
161943 /* 185 */ "input",
161944 /* 186 */ "cmdlist",
161945 /* 187 */ "ecmd",
161946 /* 188 */ "cmdx",
161947 /* 189 */ "explain",
161948 /* 190 */ "cmd",
161949 /* 191 */ "transtype",
161950 /* 192 */ "trans_opt",
161951 /* 193 */ "nm",
161952 /* 194 */ "savepoint_opt",
161953 /* 195 */ "create_table",
161954 /* 196 */ "create_table_args",
161955 /* 197 */ "createkw",
161956 /* 198 */ "temp",
161957 /* 199 */ "ifnotexists",
161958 /* 200 */ "dbnm",
161959 /* 201 */ "columnlist",
161960 /* 202 */ "conslist_opt",
161961 /* 203 */ "table_option_set",
161962 /* 204 */ "select",
161963 /* 205 */ "table_option",
161964 /* 206 */ "columnname",
161965 /* 207 */ "carglist",
161966 /* 208 */ "typetoken",
161967 /* 209 */ "typename",
161968 /* 210 */ "signed",
161969 /* 211 */ "plus_num",
161970 /* 212 */ "minus_num",
161971 /* 213 */ "scanpt",
161972 /* 214 */ "scantok",
161973 /* 215 */ "ccons",
161974 /* 216 */ "term",
161975 /* 217 */ "expr",
161976 /* 218 */ "onconf",
161977 /* 219 */ "sortorder",
161978 /* 220 */ "autoinc",
161979 /* 221 */ "eidlist_opt",
161980 /* 222 */ "refargs",
161981 /* 223 */ "defer_subclause",
161982 /* 224 */ "generated",
161983 /* 225 */ "refarg",
161984 /* 226 */ "refact",
161985 /* 227 */ "init_deferred_pred_opt",
161986 /* 228 */ "conslist",
161987 /* 229 */ "tconscomma",
161988 /* 230 */ "tcons",
161989 /* 231 */ "sortlist",
161990 /* 232 */ "eidlist",
161991 /* 233 */ "defer_subclause_opt",
161992 /* 234 */ "orconf",
161993 /* 235 */ "resolvetype",
161994 /* 236 */ "raisetype",
161995 /* 237 */ "ifexists",
161996 /* 238 */ "fullname",
161997 /* 239 */ "selectnowith",
161998 /* 240 */ "oneselect",
161999 /* 241 */ "wqlist",
162000 /* 242 */ "multiselect_op",
162001 /* 243 */ "distinct",
162002 /* 244 */ "selcollist",
162003 /* 245 */ "from",
162004 /* 246 */ "where_opt",
162005 /* 247 */ "groupby_opt",
162006 /* 248 */ "having_opt",
162007 /* 249 */ "orderby_opt",
162008 /* 250 */ "limit_opt",
162009 /* 251 */ "window_clause",
162010 /* 252 */ "values",
162011 /* 253 */ "nexprlist",
162012 /* 254 */ "sclp",
162013 /* 255 */ "as",
162014 /* 256 */ "seltablist",
162015 /* 257 */ "stl_prefix",
162016 /* 258 */ "joinop",
162017 /* 259 */ "indexed_opt",
162018 /* 260 */ "on_opt",
162019 /* 261 */ "using_opt",
162020 /* 262 */ "exprlist",
162021 /* 263 */ "xfullname",
162022 /* 264 */ "idlist",
162023 /* 265 */ "nulls",
162024 /* 266 */ "with",
162025 /* 267 */ "where_opt_ret",
162026 /* 268 */ "setlist",
162027 /* 269 */ "insert_cmd",
162028 /* 270 */ "idlist_opt",
162029 /* 271 */ "upsert",
162030 /* 272 */ "returning",
162031 /* 273 */ "filter_over",
162032 /* 274 */ "likeop",
162033 /* 275 */ "between_op",
162034 /* 276 */ "in_op",
162035 /* 277 */ "paren_exprlist",
162036 /* 278 */ "case_operand",
162037 /* 279 */ "case_exprlist",
162038 /* 280 */ "case_else",
162039 /* 281 */ "uniqueflag",
162040 /* 282 */ "collate",
162041 /* 283 */ "vinto",
162042 /* 284 */ "nmnum",
162043 /* 285 */ "trigger_decl",
162044 /* 286 */ "trigger_cmd_list",
162045 /* 287 */ "trigger_time",
162046 /* 288 */ "trigger_event",
162047 /* 289 */ "foreach_clause",
162048 /* 290 */ "when_clause",
162049 /* 291 */ "trigger_cmd",
162050 /* 292 */ "trnm",
162051 /* 293 */ "tridxby",
162052 /* 294 */ "database_kw_opt",
162053 /* 295 */ "key_opt",
162054 /* 296 */ "add_column_fullname",
162055 /* 297 */ "kwcolumn_opt",
162056 /* 298 */ "create_vtab",
162057 /* 299 */ "vtabarglist",
162058 /* 300 */ "vtabarg",
162059 /* 301 */ "vtabargtoken",
162060 /* 302 */ "lp",
162061 /* 303 */ "anylist",
162062 /* 304 */ "wqitem",
162063 /* 305 */ "wqas",
162064 /* 306 */ "windowdefn_list",
162065 /* 307 */ "windowdefn",
162066 /* 308 */ "window",
162067 /* 309 */ "frame_opt",
162068 /* 310 */ "part_opt",
162069 /* 311 */ "filter_clause",
162070 /* 312 */ "over_clause",
162071 /* 313 */ "range_or_rows",
162072 /* 314 */ "frame_bound",
162073 /* 315 */ "frame_bound_s",
162074 /* 316 */ "frame_bound_e",
162075 /* 317 */ "frame_exclude_opt",
162076 /* 318 */ "frame_exclude",
162077 };
162078 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
162079
162080 #ifndef NDEBUG
162081 /* For tracing reduce actions, the names of all rules are required.
@@ -162060,199 +162291,200 @@
162291 /* 207 */ "expr ::= expr IS expr",
162292 /* 208 */ "expr ::= expr IS NOT expr",
162293 /* 209 */ "expr ::= NOT expr",
162294 /* 210 */ "expr ::= BITNOT expr",
162295 /* 211 */ "expr ::= PLUS|MINUS expr",
162296 /* 212 */ "expr ::= expr PTR expr",
162297 /* 213 */ "between_op ::= BETWEEN",
162298 /* 214 */ "between_op ::= NOT BETWEEN",
162299 /* 215 */ "expr ::= expr between_op expr AND expr",
162300 /* 216 */ "in_op ::= IN",
162301 /* 217 */ "in_op ::= NOT IN",
162302 /* 218 */ "expr ::= expr in_op LP exprlist RP",
162303 /* 219 */ "expr ::= LP select RP",
162304 /* 220 */ "expr ::= expr in_op LP select RP",
162305 /* 221 */ "expr ::= expr in_op nm dbnm paren_exprlist",
162306 /* 222 */ "expr ::= EXISTS LP select RP",
162307 /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END",
162308 /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
162309 /* 225 */ "case_exprlist ::= WHEN expr THEN expr",
162310 /* 226 */ "case_else ::= ELSE expr",
162311 /* 227 */ "case_else ::=",
162312 /* 228 */ "case_operand ::= expr",
162313 /* 229 */ "case_operand ::=",
162314 /* 230 */ "exprlist ::=",
162315 /* 231 */ "nexprlist ::= nexprlist COMMA expr",
162316 /* 232 */ "nexprlist ::= expr",
162317 /* 233 */ "paren_exprlist ::=",
162318 /* 234 */ "paren_exprlist ::= LP exprlist RP",
162319 /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
162320 /* 236 */ "uniqueflag ::= UNIQUE",
162321 /* 237 */ "uniqueflag ::=",
162322 /* 238 */ "eidlist_opt ::=",
162323 /* 239 */ "eidlist_opt ::= LP eidlist RP",
162324 /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder",
162325 /* 241 */ "eidlist ::= nm collate sortorder",
162326 /* 242 */ "collate ::=",
162327 /* 243 */ "collate ::= COLLATE ID|STRING",
162328 /* 244 */ "cmd ::= DROP INDEX ifexists fullname",
162329 /* 245 */ "cmd ::= VACUUM vinto",
162330 /* 246 */ "cmd ::= VACUUM nm vinto",
162331 /* 247 */ "vinto ::= INTO expr",
162332 /* 248 */ "vinto ::=",
162333 /* 249 */ "cmd ::= PRAGMA nm dbnm",
162334 /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
162335 /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
162336 /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
162337 /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
162338 /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT",
162339 /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT",
162340 /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
162341 /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
162342 /* 258 */ "trigger_time ::= BEFORE|AFTER",
162343 /* 259 */ "trigger_time ::= INSTEAD OF",
162344 /* 260 */ "trigger_time ::=",
162345 /* 261 */ "trigger_event ::= DELETE|INSERT",
162346 /* 262 */ "trigger_event ::= UPDATE",
162347 /* 263 */ "trigger_event ::= UPDATE OF idlist",
162348 /* 264 */ "when_clause ::=",
162349 /* 265 */ "when_clause ::= WHEN expr",
162350 /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
162351 /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI",
162352 /* 268 */ "trnm ::= nm DOT nm",
162353 /* 269 */ "tridxby ::= INDEXED BY nm",
162354 /* 270 */ "tridxby ::= NOT INDEXED",
162355 /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
162356 /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
162357 /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
162358 /* 274 */ "trigger_cmd ::= scanpt select scanpt",
162359 /* 275 */ "expr ::= RAISE LP IGNORE RP",
162360 /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP",
162361 /* 277 */ "raisetype ::= ROLLBACK",
162362 /* 278 */ "raisetype ::= ABORT",
162363 /* 279 */ "raisetype ::= FAIL",
162364 /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname",
162365 /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
162366 /* 282 */ "cmd ::= DETACH database_kw_opt expr",
162367 /* 283 */ "key_opt ::=",
162368 /* 284 */ "key_opt ::= KEY expr",
162369 /* 285 */ "cmd ::= REINDEX",
162370 /* 286 */ "cmd ::= REINDEX nm dbnm",
162371 /* 287 */ "cmd ::= ANALYZE",
162372 /* 288 */ "cmd ::= ANALYZE nm dbnm",
162373 /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
162374 /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
162375 /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
162376 /* 292 */ "add_column_fullname ::= fullname",
162377 /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
162378 /* 294 */ "cmd ::= create_vtab",
162379 /* 295 */ "cmd ::= create_vtab LP vtabarglist RP",
162380 /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
162381 /* 297 */ "vtabarg ::=",
162382 /* 298 */ "vtabargtoken ::= ANY",
162383 /* 299 */ "vtabargtoken ::= lp anylist RP",
162384 /* 300 */ "lp ::= LP",
162385 /* 301 */ "with ::= WITH wqlist",
162386 /* 302 */ "with ::= WITH RECURSIVE wqlist",
162387 /* 303 */ "wqas ::= AS",
162388 /* 304 */ "wqas ::= AS MATERIALIZED",
162389 /* 305 */ "wqas ::= AS NOT MATERIALIZED",
162390 /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
162391 /* 307 */ "wqlist ::= wqitem",
162392 /* 308 */ "wqlist ::= wqlist COMMA wqitem",
162393 /* 309 */ "windowdefn_list ::= windowdefn",
162394 /* 310 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
162395 /* 311 */ "windowdefn ::= nm AS LP window RP",
162396 /* 312 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
162397 /* 313 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
162398 /* 314 */ "window ::= ORDER BY sortlist frame_opt",
162399 /* 315 */ "window ::= nm ORDER BY sortlist frame_opt",
162400 /* 316 */ "window ::= frame_opt",
162401 /* 317 */ "window ::= nm frame_opt",
162402 /* 318 */ "frame_opt ::=",
162403 /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
162404 /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
162405 /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
162406 /* 322 */ "frame_bound_s ::= frame_bound",
162407 /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
162408 /* 324 */ "frame_bound_e ::= frame_bound",
162409 /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
162410 /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
162411 /* 327 */ "frame_bound ::= CURRENT ROW",
162412 /* 328 */ "frame_exclude_opt ::=",
162413 /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
162414 /* 330 */ "frame_exclude ::= NO OTHERS",
162415 /* 331 */ "frame_exclude ::= CURRENT ROW",
162416 /* 332 */ "frame_exclude ::= GROUP|TIES",
162417 /* 333 */ "window_clause ::= WINDOW windowdefn_list",
162418 /* 334 */ "filter_over ::= filter_clause over_clause",
162419 /* 335 */ "filter_over ::= over_clause",
162420 /* 336 */ "filter_over ::= filter_clause",
162421 /* 337 */ "over_clause ::= OVER LP window RP",
162422 /* 338 */ "over_clause ::= OVER nm",
162423 /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP",
162424 /* 340 */ "input ::= cmdlist",
162425 /* 341 */ "cmdlist ::= cmdlist ecmd",
162426 /* 342 */ "cmdlist ::= ecmd",
162427 /* 343 */ "ecmd ::= SEMI",
162428 /* 344 */ "ecmd ::= cmdx SEMI",
162429 /* 345 */ "ecmd ::= explain cmdx SEMI",
162430 /* 346 */ "trans_opt ::=",
162431 /* 347 */ "trans_opt ::= TRANSACTION",
162432 /* 348 */ "trans_opt ::= TRANSACTION nm",
162433 /* 349 */ "savepoint_opt ::= SAVEPOINT",
162434 /* 350 */ "savepoint_opt ::=",
162435 /* 351 */ "cmd ::= create_table create_table_args",
162436 /* 352 */ "table_option_set ::= table_option",
162437 /* 353 */ "columnlist ::= columnlist COMMA columnname carglist",
162438 /* 354 */ "columnlist ::= columnname carglist",
162439 /* 355 */ "nm ::= ID|INDEXED",
162440 /* 356 */ "nm ::= STRING",
162441 /* 357 */ "nm ::= JOIN_KW",
162442 /* 358 */ "typetoken ::= typename",
162443 /* 359 */ "typename ::= ID|STRING",
162444 /* 360 */ "signed ::= plus_num",
162445 /* 361 */ "signed ::= minus_num",
162446 /* 362 */ "carglist ::= carglist ccons",
162447 /* 363 */ "carglist ::=",
162448 /* 364 */ "ccons ::= NULL onconf",
162449 /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
162450 /* 366 */ "ccons ::= AS generated",
162451 /* 367 */ "conslist_opt ::= COMMA conslist",
162452 /* 368 */ "conslist ::= conslist tconscomma tcons",
162453 /* 369 */ "conslist ::= tcons",
162454 /* 370 */ "tconscomma ::=",
162455 /* 371 */ "defer_subclause_opt ::= defer_subclause",
162456 /* 372 */ "resolvetype ::= raisetype",
162457 /* 373 */ "selectnowith ::= oneselect",
162458 /* 374 */ "oneselect ::= values",
162459 /* 375 */ "sclp ::= selcollist COMMA",
162460 /* 376 */ "as ::= ID|STRING",
162461 /* 377 */ "returning ::=",
162462 /* 378 */ "expr ::= term",
162463 /* 379 */ "likeop ::= LIKE_KW|MATCH",
162464 /* 380 */ "exprlist ::= nexprlist",
162465 /* 381 */ "nmnum ::= plus_num",
162466 /* 382 */ "nmnum ::= nm",
162467 /* 383 */ "nmnum ::= ON",
162468 /* 384 */ "nmnum ::= DELETE",
162469 /* 385 */ "nmnum ::= DEFAULT",
162470 /* 386 */ "plus_num ::= INTEGER|FLOAT",
162471 /* 387 */ "foreach_clause ::=",
162472 /* 388 */ "foreach_clause ::= FOR EACH ROW",
162473 /* 389 */ "trnm ::= nm",
162474 /* 390 */ "tridxby ::=",
162475 /* 391 */ "database_kw_opt ::= DATABASE",
162476 /* 392 */ "database_kw_opt ::=",
162477 /* 393 */ "kwcolumn_opt ::=",
162478 /* 394 */ "kwcolumn_opt ::= COLUMNKW",
162479 /* 395 */ "vtabarglist ::= vtabarg",
162480 /* 396 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
162481 /* 397 */ "vtabarg ::= vtabarg vtabargtoken",
162482 /* 398 */ "anylist ::=",
162483 /* 399 */ "anylist ::= anylist LP anylist RP",
162484 /* 400 */ "anylist ::= anylist ANY",
162485 /* 401 */ "with ::=",
162486 };
162487 #endif /* NDEBUG */
162488
162489
162490 #if YYSTACKDEPTH<=0
@@ -162374,103 +162606,103 @@
162606 ** Note: during a reduce, the only symbols destroyed are those
162607 ** which appear on the RHS of the rule, but which are *not* used
162608 ** inside the C code.
162609 */
162610 /********* Begin destructor definitions ***************************************/
162611 case 204: /* select */
162612 case 239: /* selectnowith */
162613 case 240: /* oneselect */
162614 case 252: /* values */
162615 {
162616 sqlite3SelectDelete(pParse->db, (yypminor->yy47));
162617 }
162618 break;
162619 case 216: /* term */
162620 case 217: /* expr */
162621 case 246: /* where_opt */
162622 case 248: /* having_opt */
162623 case 260: /* on_opt */
162624 case 267: /* where_opt_ret */
162625 case 278: /* case_operand */
162626 case 280: /* case_else */
162627 case 283: /* vinto */
162628 case 290: /* when_clause */
162629 case 295: /* key_opt */
162630 case 311: /* filter_clause */
162631 {
162632 sqlite3ExprDelete(pParse->db, (yypminor->yy528));
162633 }
162634 break;
162635 case 221: /* eidlist_opt */
162636 case 231: /* sortlist */
162637 case 232: /* eidlist */
162638 case 244: /* selcollist */
162639 case 247: /* groupby_opt */
162640 case 249: /* orderby_opt */
162641 case 253: /* nexprlist */
162642 case 254: /* sclp */
162643 case 262: /* exprlist */
162644 case 268: /* setlist */
162645 case 277: /* paren_exprlist */
162646 case 279: /* case_exprlist */
162647 case 310: /* part_opt */
162648 {
162649 sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
162650 }
162651 break;
162652 case 238: /* fullname */
162653 case 245: /* from */
162654 case 256: /* seltablist */
162655 case 257: /* stl_prefix */
162656 case 263: /* xfullname */
162657 {
162658 sqlite3SrcListDelete(pParse->db, (yypminor->yy131));
162659 }
162660 break;
162661 case 241: /* wqlist */
162662 {
162663 sqlite3WithDelete(pParse->db, (yypminor->yy521));
162664 }
162665 break;
162666 case 251: /* window_clause */
162667 case 306: /* windowdefn_list */
162668 {
162669 sqlite3WindowListDelete(pParse->db, (yypminor->yy41));
162670 }
162671 break;
162672 case 261: /* using_opt */
162673 case 264: /* idlist */
162674 case 270: /* idlist_opt */
162675 {
162676 sqlite3IdListDelete(pParse->db, (yypminor->yy254));
162677 }
162678 break;
162679 case 273: /* filter_over */
162680 case 307: /* windowdefn */
162681 case 308: /* window */
162682 case 309: /* frame_opt */
162683 case 312: /* over_clause */
162684 {
162685 sqlite3WindowDelete(pParse->db, (yypminor->yy41));
162686 }
162687 break;
162688 case 286: /* trigger_cmd_list */
162689 case 291: /* trigger_cmd */
162690 {
162691 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33));
162692 }
162693 break;
162694 case 288: /* trigger_event */
162695 {
162696 sqlite3IdListDelete(pParse->db, (yypminor->yy180).b);
162697 }
162698 break;
162699 case 314: /* frame_bound */
162700 case 315: /* frame_bound_s */
162701 case 316: /* frame_bound_e */
162702 {
162703 sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr);
162704 }
162705 break;
162706 /********* End destructor definitions *****************************************/
162707 default: break; /* If no destructor action specified: do nothing */
162708 }
@@ -162757,411 +162989,412 @@
162989 }
162990
162991 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
162992 ** of that rule */
162993 static const YYCODETYPE yyRuleInfoLhs[] = {
162994 189, /* (0) explain ::= EXPLAIN */
162995 189, /* (1) explain ::= EXPLAIN QUERY PLAN */
162996 188, /* (2) cmdx ::= cmd */
162997 190, /* (3) cmd ::= BEGIN transtype trans_opt */
162998 191, /* (4) transtype ::= */
162999 191, /* (5) transtype ::= DEFERRED */
163000 191, /* (6) transtype ::= IMMEDIATE */
163001 191, /* (7) transtype ::= EXCLUSIVE */
163002 190, /* (8) cmd ::= COMMIT|END trans_opt */
163003 190, /* (9) cmd ::= ROLLBACK trans_opt */
163004 190, /* (10) cmd ::= SAVEPOINT nm */
163005 190, /* (11) cmd ::= RELEASE savepoint_opt nm */
163006 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
163007 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
163008 197, /* (14) createkw ::= CREATE */
163009 199, /* (15) ifnotexists ::= */
163010 199, /* (16) ifnotexists ::= IF NOT EXISTS */
163011 198, /* (17) temp ::= TEMP */
163012 198, /* (18) temp ::= */
163013 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
163014 196, /* (20) create_table_args ::= AS select */
163015 203, /* (21) table_option_set ::= */
163016 203, /* (22) table_option_set ::= table_option_set COMMA table_option */
163017 205, /* (23) table_option ::= WITHOUT nm */
163018 205, /* (24) table_option ::= nm */
163019 206, /* (25) columnname ::= nm typetoken */
163020 208, /* (26) typetoken ::= */
163021 208, /* (27) typetoken ::= typename LP signed RP */
163022 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */
163023 209, /* (29) typename ::= typename ID|STRING */
163024 213, /* (30) scanpt ::= */
163025 214, /* (31) scantok ::= */
163026 215, /* (32) ccons ::= CONSTRAINT nm */
163027 215, /* (33) ccons ::= DEFAULT scantok term */
163028 215, /* (34) ccons ::= DEFAULT LP expr RP */
163029 215, /* (35) ccons ::= DEFAULT PLUS scantok term */
163030 215, /* (36) ccons ::= DEFAULT MINUS scantok term */
163031 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */
163032 215, /* (38) ccons ::= NOT NULL onconf */
163033 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */
163034 215, /* (40) ccons ::= UNIQUE onconf */
163035 215, /* (41) ccons ::= CHECK LP expr RP */
163036 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */
163037 215, /* (43) ccons ::= defer_subclause */
163038 215, /* (44) ccons ::= COLLATE ID|STRING */
163039 224, /* (45) generated ::= LP expr RP */
163040 224, /* (46) generated ::= LP expr RP ID */
163041 220, /* (47) autoinc ::= */
163042 220, /* (48) autoinc ::= AUTOINCR */
163043 222, /* (49) refargs ::= */
163044 222, /* (50) refargs ::= refargs refarg */
163045 225, /* (51) refarg ::= MATCH nm */
163046 225, /* (52) refarg ::= ON INSERT refact */
163047 225, /* (53) refarg ::= ON DELETE refact */
163048 225, /* (54) refarg ::= ON UPDATE refact */
163049 226, /* (55) refact ::= SET NULL */
163050 226, /* (56) refact ::= SET DEFAULT */
163051 226, /* (57) refact ::= CASCADE */
163052 226, /* (58) refact ::= RESTRICT */
163053 226, /* (59) refact ::= NO ACTION */
163054 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
163055 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
163056 227, /* (62) init_deferred_pred_opt ::= */
163057 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */
163058 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
163059 202, /* (65) conslist_opt ::= */
163060 229, /* (66) tconscomma ::= COMMA */
163061 230, /* (67) tcons ::= CONSTRAINT nm */
163062 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
163063 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */
163064 230, /* (70) tcons ::= CHECK LP expr RP onconf */
163065 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
163066 233, /* (72) defer_subclause_opt ::= */
163067 218, /* (73) onconf ::= */
163068 218, /* (74) onconf ::= ON CONFLICT resolvetype */
163069 234, /* (75) orconf ::= */
163070 234, /* (76) orconf ::= OR resolvetype */
163071 235, /* (77) resolvetype ::= IGNORE */
163072 235, /* (78) resolvetype ::= REPLACE */
163073 190, /* (79) cmd ::= DROP TABLE ifexists fullname */
163074 237, /* (80) ifexists ::= IF EXISTS */
163075 237, /* (81) ifexists ::= */
163076 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
163077 190, /* (83) cmd ::= DROP VIEW ifexists fullname */
163078 190, /* (84) cmd ::= select */
163079 204, /* (85) select ::= WITH wqlist selectnowith */
163080 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */
163081 204, /* (87) select ::= selectnowith */
163082 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */
163083 242, /* (89) multiselect_op ::= UNION */
163084 242, /* (90) multiselect_op ::= UNION ALL */
163085 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */
163086 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
163087 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
163088 252, /* (94) values ::= VALUES LP nexprlist RP */
163089 252, /* (95) values ::= values COMMA LP nexprlist RP */
163090 243, /* (96) distinct ::= DISTINCT */
163091 243, /* (97) distinct ::= ALL */
163092 243, /* (98) distinct ::= */
163093 254, /* (99) sclp ::= */
163094 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */
163095 244, /* (101) selcollist ::= sclp scanpt STAR */
163096 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */
163097 255, /* (103) as ::= AS nm */
163098 255, /* (104) as ::= */
163099 245, /* (105) from ::= */
163100 245, /* (106) from ::= FROM seltablist */
163101 257, /* (107) stl_prefix ::= seltablist joinop */
163102 257, /* (108) stl_prefix ::= */
163103 256, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
163104 256, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
163105 256, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
163106 256, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
163107 200, /* (113) dbnm ::= */
163108 200, /* (114) dbnm ::= DOT nm */
163109 238, /* (115) fullname ::= nm */
163110 238, /* (116) fullname ::= nm DOT nm */
163111 263, /* (117) xfullname ::= nm */
163112 263, /* (118) xfullname ::= nm DOT nm */
163113 263, /* (119) xfullname ::= nm DOT nm AS nm */
163114 263, /* (120) xfullname ::= nm AS nm */
163115 258, /* (121) joinop ::= COMMA|JOIN */
163116 258, /* (122) joinop ::= JOIN_KW JOIN */
163117 258, /* (123) joinop ::= JOIN_KW nm JOIN */
163118 258, /* (124) joinop ::= JOIN_KW nm nm JOIN */
163119 260, /* (125) on_opt ::= ON expr */
163120 260, /* (126) on_opt ::= */
163121 259, /* (127) indexed_opt ::= */
163122 259, /* (128) indexed_opt ::= INDEXED BY nm */
163123 259, /* (129) indexed_opt ::= NOT INDEXED */
163124 261, /* (130) using_opt ::= USING LP idlist RP */
163125 261, /* (131) using_opt ::= */
163126 249, /* (132) orderby_opt ::= */
163127 249, /* (133) orderby_opt ::= ORDER BY sortlist */
163128 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */
163129 231, /* (135) sortlist ::= expr sortorder nulls */
163130 219, /* (136) sortorder ::= ASC */
163131 219, /* (137) sortorder ::= DESC */
163132 219, /* (138) sortorder ::= */
163133 265, /* (139) nulls ::= NULLS FIRST */
163134 265, /* (140) nulls ::= NULLS LAST */
163135 265, /* (141) nulls ::= */
163136 247, /* (142) groupby_opt ::= */
163137 247, /* (143) groupby_opt ::= GROUP BY nexprlist */
163138 248, /* (144) having_opt ::= */
163139 248, /* (145) having_opt ::= HAVING expr */
163140 250, /* (146) limit_opt ::= */
163141 250, /* (147) limit_opt ::= LIMIT expr */
163142 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */
163143 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */
163144 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
163145 246, /* (151) where_opt ::= */
163146 246, /* (152) where_opt ::= WHERE expr */
163147 267, /* (153) where_opt_ret ::= */
163148 267, /* (154) where_opt_ret ::= WHERE expr */
163149 267, /* (155) where_opt_ret ::= RETURNING selcollist */
163150 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */
163151 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
163152 268, /* (158) setlist ::= setlist COMMA nm EQ expr */
163153 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */
163154 268, /* (160) setlist ::= nm EQ expr */
163155 268, /* (161) setlist ::= LP idlist RP EQ expr */
163156 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
163157 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
163158 271, /* (164) upsert ::= */
163159 271, /* (165) upsert ::= RETURNING selcollist */
163160 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
163161 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
163162 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */
163163 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
163164 272, /* (170) returning ::= RETURNING selcollist */
163165 269, /* (171) insert_cmd ::= INSERT orconf */
163166 269, /* (172) insert_cmd ::= REPLACE */
163167 270, /* (173) idlist_opt ::= */
163168 270, /* (174) idlist_opt ::= LP idlist RP */
163169 264, /* (175) idlist ::= idlist COMMA nm */
163170 264, /* (176) idlist ::= nm */
163171 217, /* (177) expr ::= LP expr RP */
163172 217, /* (178) expr ::= ID|INDEXED */
163173 217, /* (179) expr ::= JOIN_KW */
163174 217, /* (180) expr ::= nm DOT nm */
163175 217, /* (181) expr ::= nm DOT nm DOT nm */
163176 216, /* (182) term ::= NULL|FLOAT|BLOB */
163177 216, /* (183) term ::= STRING */
163178 216, /* (184) term ::= INTEGER */
163179 217, /* (185) expr ::= VARIABLE */
163180 217, /* (186) expr ::= expr COLLATE ID|STRING */
163181 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
163182 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
163183 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
163184 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
163185 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
163186 216, /* (192) term ::= CTIME_KW */
163187 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
163188 217, /* (194) expr ::= expr AND expr */
163189 217, /* (195) expr ::= expr OR expr */
163190 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
163191 217, /* (197) expr ::= expr EQ|NE expr */
163192 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
163193 217, /* (199) expr ::= expr PLUS|MINUS expr */
163194 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
163195 217, /* (201) expr ::= expr CONCAT expr */
163196 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
163197 217, /* (203) expr ::= expr likeop expr */
163198 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
163199 217, /* (205) expr ::= expr ISNULL|NOTNULL */
163200 217, /* (206) expr ::= expr NOT NULL */
163201 217, /* (207) expr ::= expr IS expr */
163202 217, /* (208) expr ::= expr IS NOT expr */
163203 217, /* (209) expr ::= NOT expr */
163204 217, /* (210) expr ::= BITNOT expr */
163205 217, /* (211) expr ::= PLUS|MINUS expr */
163206 217, /* (212) expr ::= expr PTR expr */
163207 275, /* (213) between_op ::= BETWEEN */
163208 275, /* (214) between_op ::= NOT BETWEEN */
163209 217, /* (215) expr ::= expr between_op expr AND expr */
163210 276, /* (216) in_op ::= IN */
163211 276, /* (217) in_op ::= NOT IN */
163212 217, /* (218) expr ::= expr in_op LP exprlist RP */
163213 217, /* (219) expr ::= LP select RP */
163214 217, /* (220) expr ::= expr in_op LP select RP */
163215 217, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */
163216 217, /* (222) expr ::= EXISTS LP select RP */
163217 217, /* (223) expr ::= CASE case_operand case_exprlist case_else END */
163218 279, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163219 279, /* (225) case_exprlist ::= WHEN expr THEN expr */
163220 280, /* (226) case_else ::= ELSE expr */
163221 280, /* (227) case_else ::= */
163222 278, /* (228) case_operand ::= expr */
163223 278, /* (229) case_operand ::= */
163224 262, /* (230) exprlist ::= */
163225 253, /* (231) nexprlist ::= nexprlist COMMA expr */
163226 253, /* (232) nexprlist ::= expr */
163227 277, /* (233) paren_exprlist ::= */
163228 277, /* (234) paren_exprlist ::= LP exprlist RP */
163229 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163230 281, /* (236) uniqueflag ::= UNIQUE */
163231 281, /* (237) uniqueflag ::= */
163232 221, /* (238) eidlist_opt ::= */
163233 221, /* (239) eidlist_opt ::= LP eidlist RP */
163234 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */
163235 232, /* (241) eidlist ::= nm collate sortorder */
163236 282, /* (242) collate ::= */
163237 282, /* (243) collate ::= COLLATE ID|STRING */
163238 190, /* (244) cmd ::= DROP INDEX ifexists fullname */
163239 190, /* (245) cmd ::= VACUUM vinto */
163240 190, /* (246) cmd ::= VACUUM nm vinto */
163241 283, /* (247) vinto ::= INTO expr */
163242 283, /* (248) vinto ::= */
163243 190, /* (249) cmd ::= PRAGMA nm dbnm */
163244 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */
163245 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163246 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */
163247 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163248 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */
163249 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */
163250 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163251 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163252 287, /* (258) trigger_time ::= BEFORE|AFTER */
163253 287, /* (259) trigger_time ::= INSTEAD OF */
163254 287, /* (260) trigger_time ::= */
163255 288, /* (261) trigger_event ::= DELETE|INSERT */
163256 288, /* (262) trigger_event ::= UPDATE */
163257 288, /* (263) trigger_event ::= UPDATE OF idlist */
163258 290, /* (264) when_clause ::= */
163259 290, /* (265) when_clause ::= WHEN expr */
163260 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163261 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */
163262 292, /* (268) trnm ::= nm DOT nm */
163263 293, /* (269) tridxby ::= INDEXED BY nm */
163264 293, /* (270) tridxby ::= NOT INDEXED */
163265 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163266 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163267 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163268 291, /* (274) trigger_cmd ::= scanpt select scanpt */
163269 217, /* (275) expr ::= RAISE LP IGNORE RP */
163270 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */
163271 236, /* (277) raisetype ::= ROLLBACK */
163272 236, /* (278) raisetype ::= ABORT */
163273 236, /* (279) raisetype ::= FAIL */
163274 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */
163275 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163276 190, /* (282) cmd ::= DETACH database_kw_opt expr */
163277 295, /* (283) key_opt ::= */
163278 295, /* (284) key_opt ::= KEY expr */
163279 190, /* (285) cmd ::= REINDEX */
163280 190, /* (286) cmd ::= REINDEX nm dbnm */
163281 190, /* (287) cmd ::= ANALYZE */
163282 190, /* (288) cmd ::= ANALYZE nm dbnm */
163283 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */
163284 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163285 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163286 296, /* (292) add_column_fullname ::= fullname */
163287 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163288 190, /* (294) cmd ::= create_vtab */
163289 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */
163290 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163291 300, /* (297) vtabarg ::= */
163292 301, /* (298) vtabargtoken ::= ANY */
163293 301, /* (299) vtabargtoken ::= lp anylist RP */
163294 302, /* (300) lp ::= LP */
163295 266, /* (301) with ::= WITH wqlist */
163296 266, /* (302) with ::= WITH RECURSIVE wqlist */
163297 305, /* (303) wqas ::= AS */
163298 305, /* (304) wqas ::= AS MATERIALIZED */
163299 305, /* (305) wqas ::= AS NOT MATERIALIZED */
163300 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */
163301 241, /* (307) wqlist ::= wqitem */
163302 241, /* (308) wqlist ::= wqlist COMMA wqitem */
163303 306, /* (309) windowdefn_list ::= windowdefn */
163304 306, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163305 307, /* (311) windowdefn ::= nm AS LP window RP */
163306 308, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163307 308, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163308 308, /* (314) window ::= ORDER BY sortlist frame_opt */
163309 308, /* (315) window ::= nm ORDER BY sortlist frame_opt */
163310 308, /* (316) window ::= frame_opt */
163311 308, /* (317) window ::= nm frame_opt */
163312 309, /* (318) frame_opt ::= */
163313 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163314 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163315 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
163316 315, /* (322) frame_bound_s ::= frame_bound */
163317 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
163318 316, /* (324) frame_bound_e ::= frame_bound */
163319 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
163320 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
163321 314, /* (327) frame_bound ::= CURRENT ROW */
163322 317, /* (328) frame_exclude_opt ::= */
163323 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
163324 318, /* (330) frame_exclude ::= NO OTHERS */
163325 318, /* (331) frame_exclude ::= CURRENT ROW */
163326 318, /* (332) frame_exclude ::= GROUP|TIES */
163327 251, /* (333) window_clause ::= WINDOW windowdefn_list */
163328 273, /* (334) filter_over ::= filter_clause over_clause */
163329 273, /* (335) filter_over ::= over_clause */
163330 273, /* (336) filter_over ::= filter_clause */
163331 312, /* (337) over_clause ::= OVER LP window RP */
163332 312, /* (338) over_clause ::= OVER nm */
163333 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
163334 185, /* (340) input ::= cmdlist */
163335 186, /* (341) cmdlist ::= cmdlist ecmd */
163336 186, /* (342) cmdlist ::= ecmd */
163337 187, /* (343) ecmd ::= SEMI */
163338 187, /* (344) ecmd ::= cmdx SEMI */
163339 187, /* (345) ecmd ::= explain cmdx SEMI */
163340 192, /* (346) trans_opt ::= */
163341 192, /* (347) trans_opt ::= TRANSACTION */
163342 192, /* (348) trans_opt ::= TRANSACTION nm */
163343 194, /* (349) savepoint_opt ::= SAVEPOINT */
163344 194, /* (350) savepoint_opt ::= */
163345 190, /* (351) cmd ::= create_table create_table_args */
163346 203, /* (352) table_option_set ::= table_option */
163347 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */
163348 201, /* (354) columnlist ::= columnname carglist */
163349 193, /* (355) nm ::= ID|INDEXED */
163350 193, /* (356) nm ::= STRING */
163351 193, /* (357) nm ::= JOIN_KW */
163352 208, /* (358) typetoken ::= typename */
163353 209, /* (359) typename ::= ID|STRING */
163354 210, /* (360) signed ::= plus_num */
163355 210, /* (361) signed ::= minus_num */
163356 207, /* (362) carglist ::= carglist ccons */
163357 207, /* (363) carglist ::= */
163358 215, /* (364) ccons ::= NULL onconf */
163359 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
163360 215, /* (366) ccons ::= AS generated */
163361 202, /* (367) conslist_opt ::= COMMA conslist */
163362 228, /* (368) conslist ::= conslist tconscomma tcons */
163363 228, /* (369) conslist ::= tcons */
163364 229, /* (370) tconscomma ::= */
163365 233, /* (371) defer_subclause_opt ::= defer_subclause */
163366 235, /* (372) resolvetype ::= raisetype */
163367 239, /* (373) selectnowith ::= oneselect */
163368 240, /* (374) oneselect ::= values */
163369 254, /* (375) sclp ::= selcollist COMMA */
163370 255, /* (376) as ::= ID|STRING */
163371 272, /* (377) returning ::= */
163372 217, /* (378) expr ::= term */
163373 274, /* (379) likeop ::= LIKE_KW|MATCH */
163374 262, /* (380) exprlist ::= nexprlist */
163375 284, /* (381) nmnum ::= plus_num */
163376 284, /* (382) nmnum ::= nm */
163377 284, /* (383) nmnum ::= ON */
163378 284, /* (384) nmnum ::= DELETE */
163379 284, /* (385) nmnum ::= DEFAULT */
163380 211, /* (386) plus_num ::= INTEGER|FLOAT */
163381 289, /* (387) foreach_clause ::= */
163382 289, /* (388) foreach_clause ::= FOR EACH ROW */
163383 292, /* (389) trnm ::= nm */
163384 293, /* (390) tridxby ::= */
163385 294, /* (391) database_kw_opt ::= DATABASE */
163386 294, /* (392) database_kw_opt ::= */
163387 297, /* (393) kwcolumn_opt ::= */
163388 297, /* (394) kwcolumn_opt ::= COLUMNKW */
163389 299, /* (395) vtabarglist ::= vtabarg */
163390 299, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */
163391 300, /* (397) vtabarg ::= vtabarg vtabargtoken */
163392 303, /* (398) anylist ::= */
163393 303, /* (399) anylist ::= anylist LP anylist RP */
163394 303, /* (400) anylist ::= anylist ANY */
163395 266, /* (401) with ::= */
163396 };
163397
163398 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
163399 ** of symbols on the right-hand side of that rule. */
163400 static const signed char yyRuleInfoNRhs[] = {
@@ -163375,199 +163608,200 @@
163608 -3, /* (207) expr ::= expr IS expr */
163609 -4, /* (208) expr ::= expr IS NOT expr */
163610 -2, /* (209) expr ::= NOT expr */
163611 -2, /* (210) expr ::= BITNOT expr */
163612 -2, /* (211) expr ::= PLUS|MINUS expr */
163613 -3, /* (212) expr ::= expr PTR expr */
163614 -1, /* (213) between_op ::= BETWEEN */
163615 -2, /* (214) between_op ::= NOT BETWEEN */
163616 -5, /* (215) expr ::= expr between_op expr AND expr */
163617 -1, /* (216) in_op ::= IN */
163618 -2, /* (217) in_op ::= NOT IN */
163619 -5, /* (218) expr ::= expr in_op LP exprlist RP */
163620 -3, /* (219) expr ::= LP select RP */
163621 -5, /* (220) expr ::= expr in_op LP select RP */
163622 -5, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */
163623 -4, /* (222) expr ::= EXISTS LP select RP */
163624 -5, /* (223) expr ::= CASE case_operand case_exprlist case_else END */
163625 -5, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */
163626 -4, /* (225) case_exprlist ::= WHEN expr THEN expr */
163627 -2, /* (226) case_else ::= ELSE expr */
163628 0, /* (227) case_else ::= */
163629 -1, /* (228) case_operand ::= expr */
163630 0, /* (229) case_operand ::= */
163631 0, /* (230) exprlist ::= */
163632 -3, /* (231) nexprlist ::= nexprlist COMMA expr */
163633 -1, /* (232) nexprlist ::= expr */
163634 0, /* (233) paren_exprlist ::= */
163635 -3, /* (234) paren_exprlist ::= LP exprlist RP */
163636 -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
163637 -1, /* (236) uniqueflag ::= UNIQUE */
163638 0, /* (237) uniqueflag ::= */
163639 0, /* (238) eidlist_opt ::= */
163640 -3, /* (239) eidlist_opt ::= LP eidlist RP */
163641 -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */
163642 -3, /* (241) eidlist ::= nm collate sortorder */
163643 0, /* (242) collate ::= */
163644 -2, /* (243) collate ::= COLLATE ID|STRING */
163645 -4, /* (244) cmd ::= DROP INDEX ifexists fullname */
163646 -2, /* (245) cmd ::= VACUUM vinto */
163647 -3, /* (246) cmd ::= VACUUM nm vinto */
163648 -2, /* (247) vinto ::= INTO expr */
163649 0, /* (248) vinto ::= */
163650 -3, /* (249) cmd ::= PRAGMA nm dbnm */
163651 -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */
163652 -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */
163653 -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */
163654 -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */
163655 -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */
163656 -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */
163657 -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
163658 -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
163659 -1, /* (258) trigger_time ::= BEFORE|AFTER */
163660 -2, /* (259) trigger_time ::= INSTEAD OF */
163661 0, /* (260) trigger_time ::= */
163662 -1, /* (261) trigger_event ::= DELETE|INSERT */
163663 -1, /* (262) trigger_event ::= UPDATE */
163664 -3, /* (263) trigger_event ::= UPDATE OF idlist */
163665 0, /* (264) when_clause ::= */
163666 -2, /* (265) when_clause ::= WHEN expr */
163667 -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
163668 -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */
163669 -3, /* (268) trnm ::= nm DOT nm */
163670 -3, /* (269) tridxby ::= INDEXED BY nm */
163671 -2, /* (270) tridxby ::= NOT INDEXED */
163672 -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
163673 -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
163674 -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
163675 -3, /* (274) trigger_cmd ::= scanpt select scanpt */
163676 -4, /* (275) expr ::= RAISE LP IGNORE RP */
163677 -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */
163678 -1, /* (277) raisetype ::= ROLLBACK */
163679 -1, /* (278) raisetype ::= ABORT */
163680 -1, /* (279) raisetype ::= FAIL */
163681 -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */
163682 -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
163683 -3, /* (282) cmd ::= DETACH database_kw_opt expr */
163684 0, /* (283) key_opt ::= */
163685 -2, /* (284) key_opt ::= KEY expr */
163686 -1, /* (285) cmd ::= REINDEX */
163687 -3, /* (286) cmd ::= REINDEX nm dbnm */
163688 -1, /* (287) cmd ::= ANALYZE */
163689 -3, /* (288) cmd ::= ANALYZE nm dbnm */
163690 -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */
163691 -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
163692 -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
163693 -1, /* (292) add_column_fullname ::= fullname */
163694 -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
163695 -1, /* (294) cmd ::= create_vtab */
163696 -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */
163697 -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
163698 0, /* (297) vtabarg ::= */
163699 -1, /* (298) vtabargtoken ::= ANY */
163700 -3, /* (299) vtabargtoken ::= lp anylist RP */
163701 -1, /* (300) lp ::= LP */
163702 -2, /* (301) with ::= WITH wqlist */
163703 -3, /* (302) with ::= WITH RECURSIVE wqlist */
163704 -1, /* (303) wqas ::= AS */
163705 -2, /* (304) wqas ::= AS MATERIALIZED */
163706 -3, /* (305) wqas ::= AS NOT MATERIALIZED */
163707 -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */
163708 -1, /* (307) wqlist ::= wqitem */
163709 -3, /* (308) wqlist ::= wqlist COMMA wqitem */
163710 -1, /* (309) windowdefn_list ::= windowdefn */
163711 -3, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */
163712 -5, /* (311) windowdefn ::= nm AS LP window RP */
163713 -5, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
163714 -6, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
163715 -4, /* (314) window ::= ORDER BY sortlist frame_opt */
163716 -5, /* (315) window ::= nm ORDER BY sortlist frame_opt */
163717 -1, /* (316) window ::= frame_opt */
163718 -2, /* (317) window ::= nm frame_opt */
163719 0, /* (318) frame_opt ::= */
163720 -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
163721 -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
163722 -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */
163723 -1, /* (322) frame_bound_s ::= frame_bound */
163724 -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */
163725 -1, /* (324) frame_bound_e ::= frame_bound */
163726 -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */
163727 -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */
163728 -2, /* (327) frame_bound ::= CURRENT ROW */
163729 0, /* (328) frame_exclude_opt ::= */
163730 -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */
163731 -2, /* (330) frame_exclude ::= NO OTHERS */
163732 -2, /* (331) frame_exclude ::= CURRENT ROW */
163733 -1, /* (332) frame_exclude ::= GROUP|TIES */
163734 -2, /* (333) window_clause ::= WINDOW windowdefn_list */
163735 -2, /* (334) filter_over ::= filter_clause over_clause */
163736 -1, /* (335) filter_over ::= over_clause */
163737 -1, /* (336) filter_over ::= filter_clause */
163738 -4, /* (337) over_clause ::= OVER LP window RP */
163739 -2, /* (338) over_clause ::= OVER nm */
163740 -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */
163741 -1, /* (340) input ::= cmdlist */
163742 -2, /* (341) cmdlist ::= cmdlist ecmd */
163743 -1, /* (342) cmdlist ::= ecmd */
163744 -1, /* (343) ecmd ::= SEMI */
163745 -2, /* (344) ecmd ::= cmdx SEMI */
163746 -3, /* (345) ecmd ::= explain cmdx SEMI */
163747 0, /* (346) trans_opt ::= */
163748 -1, /* (347) trans_opt ::= TRANSACTION */
163749 -2, /* (348) trans_opt ::= TRANSACTION nm */
163750 -1, /* (349) savepoint_opt ::= SAVEPOINT */
163751 0, /* (350) savepoint_opt ::= */
163752 -2, /* (351) cmd ::= create_table create_table_args */
163753 -1, /* (352) table_option_set ::= table_option */
163754 -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */
163755 -2, /* (354) columnlist ::= columnname carglist */
163756 -1, /* (355) nm ::= ID|INDEXED */
163757 -1, /* (356) nm ::= STRING */
163758 -1, /* (357) nm ::= JOIN_KW */
163759 -1, /* (358) typetoken ::= typename */
163760 -1, /* (359) typename ::= ID|STRING */
163761 -1, /* (360) signed ::= plus_num */
163762 -1, /* (361) signed ::= minus_num */
163763 -2, /* (362) carglist ::= carglist ccons */
163764 0, /* (363) carglist ::= */
163765 -2, /* (364) ccons ::= NULL onconf */
163766 -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
163767 -2, /* (366) ccons ::= AS generated */
163768 -2, /* (367) conslist_opt ::= COMMA conslist */
163769 -3, /* (368) conslist ::= conslist tconscomma tcons */
163770 -1, /* (369) conslist ::= tcons */
163771 0, /* (370) tconscomma ::= */
163772 -1, /* (371) defer_subclause_opt ::= defer_subclause */
163773 -1, /* (372) resolvetype ::= raisetype */
163774 -1, /* (373) selectnowith ::= oneselect */
163775 -1, /* (374) oneselect ::= values */
163776 -2, /* (375) sclp ::= selcollist COMMA */
163777 -1, /* (376) as ::= ID|STRING */
163778 0, /* (377) returning ::= */
163779 -1, /* (378) expr ::= term */
163780 -1, /* (379) likeop ::= LIKE_KW|MATCH */
163781 -1, /* (380) exprlist ::= nexprlist */
163782 -1, /* (381) nmnum ::= plus_num */
163783 -1, /* (382) nmnum ::= nm */
163784 -1, /* (383) nmnum ::= ON */
163785 -1, /* (384) nmnum ::= DELETE */
163786 -1, /* (385) nmnum ::= DEFAULT */
163787 -1, /* (386) plus_num ::= INTEGER|FLOAT */
163788 0, /* (387) foreach_clause ::= */
163789 -3, /* (388) foreach_clause ::= FOR EACH ROW */
163790 -1, /* (389) trnm ::= nm */
163791 0, /* (390) tridxby ::= */
163792 -1, /* (391) database_kw_opt ::= DATABASE */
163793 0, /* (392) database_kw_opt ::= */
163794 0, /* (393) kwcolumn_opt ::= */
163795 -1, /* (394) kwcolumn_opt ::= COLUMNKW */
163796 -1, /* (395) vtabarglist ::= vtabarg */
163797 -3, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */
163798 -2, /* (397) vtabarg ::= vtabarg vtabargtoken */
163799 0, /* (398) anylist ::= */
163800 -4, /* (399) anylist ::= anylist LP anylist RP */
163801 -2, /* (400) anylist ::= anylist ANY */
163802 0, /* (401) with ::= */
163803 };
163804
163805 static void yy_accept(yyParser*); /* Forward Declaration */
163806
163807 /*
@@ -163615,20 +163849,20 @@
163849 break;
163850 case 2: /* cmdx ::= cmd */
163851 { sqlite3FinishCoding(pParse); }
163852 break;
163853 case 3: /* cmd ::= BEGIN transtype trans_opt */
163854 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);}
163855 break;
163856 case 4: /* transtype ::= */
163857 {yymsp[1].minor.yy394 = TK_DEFERRED;}
163858 break;
163859 case 5: /* transtype ::= DEFERRED */
163860 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
163861 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
163862 case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321);
163863 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
163864 break;
163865 case 8: /* cmd ::= COMMIT|END trans_opt */
163866 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
163867 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
163868 break;
@@ -163647,11 +163881,11 @@
163881 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
163882 }
163883 break;
163884 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
163885 {
163886 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394);
163887 }
163888 break;
163889 case 14: /* createkw ::= CREATE */
163890 {disableLookaside(pParse);}
163891 break;
@@ -163660,57 +163894,57 @@
163894 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
163895 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
163896 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
163897 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
163898 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
163899 case 242: /* collate ::= */ yytestcase(yyruleno==242);
163900 {yymsp[1].minor.yy394 = 0;}
163901 break;
163902 case 16: /* ifnotexists ::= IF NOT EXISTS */
163903 {yymsp[-2].minor.yy394 = 1;}
163904 break;
163905 case 17: /* temp ::= TEMP */
163906 {yymsp[0].minor.yy394 = pParse->db->init.busy==0;}
163907 break;
163908 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */
163909 {
163910 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0);
163911 }
163912 break;
163913 case 20: /* create_table_args ::= AS select */
163914 {
163915 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47);
163916 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
163917 }
163918 break;
163919 case 21: /* table_option_set ::= */
163920 {yymsp[1].minor.yy285 = 0;}
163921 break;
163922 case 22: /* table_option_set ::= table_option_set COMMA table_option */
163923 {yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;}
163924 yymsp[-2].minor.yy285 = yylhsminor.yy285;
163925 break;
163926 case 23: /* table_option ::= WITHOUT nm */
163927 {
163928 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
163929 yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid;
163930 }else{
163931 yymsp[-1].minor.yy285 = 0;
163932 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163933 }
163934 }
163935 break;
163936 case 24: /* table_option ::= nm */
163937 {
163938 if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){
163939 yylhsminor.yy285 = TF_Strict;
163940 }else{
163941 yylhsminor.yy285 = 0;
163942 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
163943 }
163944 }
163945 yymsp[0].minor.yy285 = yylhsminor.yy285;
163946 break;
163947 case 25: /* columnname ::= nm typetoken */
163948 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
163949 break;
163950 case 26: /* typetoken ::= */
@@ -163732,11 +163966,11 @@
163966 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
163967 break;
163968 case 30: /* scanpt ::= */
163969 {
163970 assert( yyLookahead!=YYNOCODE );
163971 yymsp[1].minor.yy522 = yyLookaheadToken.z;
163972 }
163973 break;
163974 case 31: /* scantok ::= */
163975 {
163976 assert( yyLookahead!=YYNOCODE );
@@ -163746,21 +163980,21 @@
163980 case 32: /* ccons ::= CONSTRAINT nm */
163981 case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67);
163982 {pParse->constraintName = yymsp[0].minor.yy0;}
163983 break;
163984 case 33: /* ccons ::= DEFAULT scantok term */
163985 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163986 break;
163987 case 34: /* ccons ::= DEFAULT LP expr RP */
163988 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
163989 break;
163990 case 35: /* ccons ::= DEFAULT PLUS scantok term */
163991 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
163992 break;
163993 case 36: /* ccons ::= DEFAULT MINUS scantok term */
163994 {
163995 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0);
163996 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
163997 }
163998 break;
163999 case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */
164000 {
@@ -163771,308 +164005,308 @@
164005 }
164006 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
164007 }
164008 break;
164009 case 38: /* ccons ::= NOT NULL onconf */
164010 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);}
164011 break;
164012 case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
164013 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);}
164014 break;
164015 case 40: /* ccons ::= UNIQUE onconf */
164016 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0,
164017 SQLITE_IDXTYPE_UNIQUE);}
164018 break;
164019 case 41: /* ccons ::= CHECK LP expr RP */
164020 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
164021 break;
164022 case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */
164023 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);}
164024 break;
164025 case 43: /* ccons ::= defer_subclause */
164026 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);}
164027 break;
164028 case 44: /* ccons ::= COLLATE ID|STRING */
164029 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
164030 break;
164031 case 45: /* generated ::= LP expr RP */
164032 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);}
164033 break;
164034 case 46: /* generated ::= LP expr RP ID */
164035 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);}
164036 break;
164037 case 48: /* autoinc ::= AUTOINCR */
164038 {yymsp[0].minor.yy394 = 1;}
164039 break;
164040 case 49: /* refargs ::= */
164041 { yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */}
164042 break;
164043 case 50: /* refargs ::= refargs refarg */
164044 { yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; }
164045 break;
164046 case 51: /* refarg ::= MATCH nm */
164047 { yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; }
164048 break;
164049 case 52: /* refarg ::= ON INSERT refact */
164050 { yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; }
164051 break;
164052 case 53: /* refarg ::= ON DELETE refact */
164053 { yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; }
164054 break;
164055 case 54: /* refarg ::= ON UPDATE refact */
164056 { yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; }
164057 break;
164058 case 55: /* refact ::= SET NULL */
164059 { yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */}
164060 break;
164061 case 56: /* refact ::= SET DEFAULT */
164062 { yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */}
164063 break;
164064 case 57: /* refact ::= CASCADE */
164065 { yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */}
164066 break;
164067 case 58: /* refact ::= RESTRICT */
164068 { yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */}
164069 break;
164070 case 59: /* refact ::= NO ACTION */
164071 { yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */}
164072 break;
164073 case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
164074 {yymsp[-2].minor.yy394 = 0;}
164075 break;
164076 case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
164077 case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76);
164078 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
164079 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
164080 break;
164081 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
164082 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
164083 case 214: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==214);
164084 case 217: /* in_op ::= NOT IN */ yytestcase(yyruleno==217);
164085 case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243);
164086 {yymsp[-1].minor.yy394 = 1;}
164087 break;
164088 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
164089 {yymsp[-1].minor.yy394 = 0;}
164090 break;
164091 case 66: /* tconscomma ::= COMMA */
164092 {pParse->constraintName.n = 0;}
164093 break;
164094 case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
164095 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);}
164096 break;
164097 case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */
164098 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0,
164099 SQLITE_IDXTYPE_UNIQUE);}
164100 break;
164101 case 70: /* tcons ::= CHECK LP expr RP onconf */
164102 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
164103 break;
164104 case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
164105 {
164106 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394);
164107 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394);
164108 }
164109 break;
164110 case 73: /* onconf ::= */
164111 case 75: /* orconf ::= */ yytestcase(yyruleno==75);
164112 {yymsp[1].minor.yy394 = OE_Default;}
164113 break;
164114 case 74: /* onconf ::= ON CONFLICT resolvetype */
164115 {yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;}
164116 break;
164117 case 77: /* resolvetype ::= IGNORE */
164118 {yymsp[0].minor.yy394 = OE_Ignore;}
164119 break;
164120 case 78: /* resolvetype ::= REPLACE */
164121 case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172);
164122 {yymsp[0].minor.yy394 = OE_Replace;}
164123 break;
164124 case 79: /* cmd ::= DROP TABLE ifexists fullname */
164125 {
164126 sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394);
164127 }
164128 break;
164129 case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
164130 {
164131 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394);
164132 }
164133 break;
164134 case 83: /* cmd ::= DROP VIEW ifexists fullname */
164135 {
164136 sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394);
164137 }
164138 break;
164139 case 84: /* cmd ::= select */
164140 {
164141 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
164142 sqlite3Select(pParse, yymsp[0].minor.yy47, &dest);
164143 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47);
164144 }
164145 break;
164146 case 85: /* select ::= WITH wqlist selectnowith */
164147 {yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
164148 break;
164149 case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */
164150 {yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);}
164151 break;
164152 case 87: /* select ::= selectnowith */
164153 {
164154 Select *p = yymsp[0].minor.yy47;
164155 if( p ){
164156 parserDoubleLinkSelect(pParse, p);
164157 }
164158 yymsp[0].minor.yy47 = p; /*A-overwrites-X*/
164159 }
164160 break;
164161 case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */
164162 {
164163 Select *pRhs = yymsp[0].minor.yy47;
164164 Select *pLhs = yymsp[-2].minor.yy47;
164165 if( pRhs && pRhs->pPrior ){
164166 SrcList *pFrom;
164167 Token x;
164168 x.n = 0;
164169 parserDoubleLinkSelect(pParse, pRhs);
164170 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
164171 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
164172 }
164173 if( pRhs ){
164174 pRhs->op = (u8)yymsp[-1].minor.yy394;
164175 pRhs->pPrior = pLhs;
164176 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
164177 pRhs->selFlags &= ~SF_MultiValue;
164178 if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1;
164179 }else{
164180 sqlite3SelectDelete(pParse->db, pLhs);
164181 }
164182 yymsp[-2].minor.yy47 = pRhs;
164183 }
164184 break;
164185 case 89: /* multiselect_op ::= UNION */
164186 case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91);
164187 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/}
164188 break;
164189 case 90: /* multiselect_op ::= UNION ALL */
164190 {yymsp[-1].minor.yy394 = TK_ALL;}
164191 break;
164192 case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
164193 {
164194 yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528);
164195 }
164196 break;
164197 case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
164198 {
164199 yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528);
164200 if( yymsp[-9].minor.yy47 ){
164201 yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41;
164202 }else{
164203 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41);
164204 }
164205 }
164206 break;
164207 case 94: /* values ::= VALUES LP nexprlist RP */
164208 {
164209 yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
164210 }
164211 break;
164212 case 95: /* values ::= values COMMA LP nexprlist RP */
164213 {
164214 Select *pRight, *pLeft = yymsp[-4].minor.yy47;
164215 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
164216 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
164217 if( pRight ){
164218 pRight->op = TK_ALL;
164219 pRight->pPrior = pLeft;
164220 yymsp[-4].minor.yy47 = pRight;
164221 }else{
164222 yymsp[-4].minor.yy47 = pLeft;
164223 }
164224 }
164225 break;
164226 case 96: /* distinct ::= DISTINCT */
164227 {yymsp[0].minor.yy394 = SF_Distinct;}
164228 break;
164229 case 97: /* distinct ::= ALL */
164230 {yymsp[0].minor.yy394 = SF_All;}
164231 break;
164232 case 99: /* sclp ::= */
164233 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
164234 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
164235 case 230: /* exprlist ::= */ yytestcase(yyruleno==230);
164236 case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233);
164237 case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238);
164238 {yymsp[1].minor.yy322 = 0;}
164239 break;
164240 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
164241 {
164242 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
164243 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1);
164244 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522);
164245 }
164246 break;
164247 case 101: /* selcollist ::= sclp scanpt STAR */
164248 {
164249 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
164250 yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
164251 }
164252 break;
164253 case 102: /* selcollist ::= sclp scanpt nm DOT STAR */
164254 {
164255 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
164256 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164257 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
164258 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
164259 }
164260 break;
164261 case 103: /* as ::= AS nm */
164262 case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114);
164263 case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254);
164264 case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
164265 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
164266 break;
164267 case 105: /* from ::= */
164268 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
164269 {yymsp[1].minor.yy131 = 0;}
164270 break;
164271 case 106: /* from ::= FROM seltablist */
164272 {
164273 yymsp[-1].minor.yy131 = yymsp[0].minor.yy131;
164274 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy131);
164275 }
164276 break;
164277 case 107: /* stl_prefix ::= seltablist joinop */
164278 {
164279 if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394;
164280 }
164281 break;
164282 case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
164283 {
164284 yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164285 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy131, &yymsp[-2].minor.yy0);
164286 }
164287 break;
164288 case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
164289 {
164290 yymsp[-8].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy131,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164291 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy131, yymsp[-4].minor.yy322);
164292 }
164293 break;
164294 case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
164295 {
164296 yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy47,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164297 }
164298 break;
164299 case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
164300 {
164301 if( yymsp[-6].minor.yy131==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy528==0 && yymsp[0].minor.yy254==0 ){
164302 yymsp[-6].minor.yy131 = yymsp[-4].minor.yy131;
164303 }else if( yymsp[-4].minor.yy131->nSrc==1 ){
164304 yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164305 if( yymsp[-6].minor.yy131 ){
164306 SrcItem *pNew = &yymsp[-6].minor.yy131->a[yymsp[-6].minor.yy131->nSrc-1];
164307 SrcItem *pOld = yymsp[-4].minor.yy131->a;
164308 pNew->zName = pOld->zName;
164309 pNew->zDatabase = pOld->zDatabase;
164310 pNew->pSelect = pOld->pSelect;
164311 if( pOld->fg.isTabFunc ){
164312 pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -164081,240 +164315,240 @@
164315 pNew->fg.isTabFunc = 1;
164316 }
164317 pOld->zName = pOld->zDatabase = 0;
164318 pOld->pSelect = 0;
164319 }
164320 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy131);
164321 }else{
164322 Select *pSubquery;
164323 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy131);
164324 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy131,0,0,0,0,SF_NestedFrom,0);
164325 yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy528,yymsp[0].minor.yy254);
164326 }
164327 }
164328 break;
164329 case 113: /* dbnm ::= */
164330 case 127: /* indexed_opt ::= */ yytestcase(yyruleno==127);
164331 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
164332 break;
164333 case 115: /* fullname ::= nm */
164334 {
164335 yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
164336 if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
164337 }
164338 yymsp[0].minor.yy131 = yylhsminor.yy131;
164339 break;
164340 case 116: /* fullname ::= nm DOT nm */
164341 {
164342 yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
164343 if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0);
164344 }
164345 yymsp[-2].minor.yy131 = yylhsminor.yy131;
164346 break;
164347 case 117: /* xfullname ::= nm */
164348 {yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
164349 break;
164350 case 118: /* xfullname ::= nm DOT nm */
164351 {yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
164352 break;
164353 case 119: /* xfullname ::= nm DOT nm AS nm */
164354 {
164355 yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
164356 if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164357 }
164358 break;
164359 case 120: /* xfullname ::= nm AS nm */
164360 {
164361 yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
164362 if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
164363 }
164364 break;
164365 case 121: /* joinop ::= COMMA|JOIN */
164366 { yymsp[0].minor.yy394 = JT_INNER; }
164367 break;
164368 case 122: /* joinop ::= JOIN_KW JOIN */
164369 {yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
164370 break;
164371 case 123: /* joinop ::= JOIN_KW nm JOIN */
164372 {yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
164373 break;
164374 case 124: /* joinop ::= JOIN_KW nm nm JOIN */
164375 {yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
164376 break;
164377 case 125: /* on_opt ::= ON expr */
164378 case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145);
164379 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
164380 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
164381 case 226: /* case_else ::= ELSE expr */ yytestcase(yyruleno==226);
164382 case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247);
164383 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
164384 break;
164385 case 126: /* on_opt ::= */
164386 case 144: /* having_opt ::= */ yytestcase(yyruleno==144);
164387 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
164388 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
164389 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
164390 case 227: /* case_else ::= */ yytestcase(yyruleno==227);
164391 case 229: /* case_operand ::= */ yytestcase(yyruleno==229);
164392 case 248: /* vinto ::= */ yytestcase(yyruleno==248);
164393 {yymsp[1].minor.yy528 = 0;}
164394 break;
164395 case 128: /* indexed_opt ::= INDEXED BY nm */
164396 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
164397 break;
164398 case 129: /* indexed_opt ::= NOT INDEXED */
164399 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
164400 break;
164401 case 130: /* using_opt ::= USING LP idlist RP */
164402 {yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
164403 break;
164404 case 131: /* using_opt ::= */
164405 case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173);
164406 {yymsp[1].minor.yy254 = 0;}
164407 break;
164408 case 133: /* orderby_opt ::= ORDER BY sortlist */
164409 case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143);
164410 {yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
164411 break;
164412 case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */
164413 {
164414 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528);
164415 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
164416 }
164417 break;
164418 case 135: /* sortlist ::= expr sortorder nulls */
164419 {
164420 yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/
164421 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394);
164422 }
164423 break;
164424 case 136: /* sortorder ::= ASC */
164425 {yymsp[0].minor.yy394 = SQLITE_SO_ASC;}
164426 break;
164427 case 137: /* sortorder ::= DESC */
164428 {yymsp[0].minor.yy394 = SQLITE_SO_DESC;}
164429 break;
164430 case 138: /* sortorder ::= */
164431 case 141: /* nulls ::= */ yytestcase(yyruleno==141);
164432 {yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;}
164433 break;
164434 case 139: /* nulls ::= NULLS FIRST */
164435 {yymsp[-1].minor.yy394 = SQLITE_SO_ASC;}
164436 break;
164437 case 140: /* nulls ::= NULLS LAST */
164438 {yymsp[-1].minor.yy394 = SQLITE_SO_DESC;}
164439 break;
164440 case 147: /* limit_opt ::= LIMIT expr */
164441 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
164442 break;
164443 case 148: /* limit_opt ::= LIMIT expr OFFSET expr */
164444 {yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164445 break;
164446 case 149: /* limit_opt ::= LIMIT expr COMMA expr */
164447 {yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);}
164448 break;
164449 case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
164450 {
164451 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0);
164452 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0);
164453 }
164454 break;
164455 case 155: /* where_opt_ret ::= RETURNING selcollist */
164456 {sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;}
164457 break;
164458 case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
164459 {sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;}
164460 break;
164461 case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
164462 {
164463 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0);
164464 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list");
164465 yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, yymsp[-1].minor.yy131);
164466 sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0);
164467 }
164468 break;
164469 case 158: /* setlist ::= setlist COMMA nm EQ expr */
164470 {
164471 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
164472 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
164473 }
164474 break;
164475 case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
164476 {
164477 yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
164478 }
164479 break;
164480 case 160: /* setlist ::= nm EQ expr */
164481 {
164482 yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528);
164483 sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
164484 }
164485 yymsp[-2].minor.yy322 = yylhsminor.yy322;
164486 break;
164487 case 161: /* setlist ::= LP idlist RP EQ expr */
164488 {
164489 yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528);
164490 }
164491 break;
164492 case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
164493 {
164494 sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444);
164495 }
164496 break;
164497 case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
164498 {
164499 sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0);
164500 }
164501 break;
164502 case 164: /* upsert ::= */
164503 { yymsp[1].minor.yy444 = 0; }
164504 break;
164505 case 165: /* upsert ::= RETURNING selcollist */
164506 { yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); }
164507 break;
164508 case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
164509 { yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);}
164510 break;
164511 case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
164512 { yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); }
164513 break;
164514 case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */
164515 { yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
164516 break;
164517 case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
164518 { yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);}
164519 break;
164520 case 170: /* returning ::= RETURNING selcollist */
164521 {sqlite3AddReturning(pParse,yymsp[0].minor.yy322);}
164522 break;
164523 case 174: /* idlist_opt ::= LP idlist RP */
164524 {yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
164525 break;
164526 case 175: /* idlist ::= idlist COMMA nm */
164527 {yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
164528 break;
164529 case 176: /* idlist ::= nm */
164530 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
164531 break;
164532 case 177: /* expr ::= LP expr RP */
164533 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
164534 break;
164535 case 178: /* expr ::= ID|INDEXED */
164536 case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
164537 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164538 break;
164539 case 180: /* expr ::= nm DOT nm */
164540 {
164541 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
164542 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
164543 if( IN_RENAME_OBJECT ){
164544 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
164545 sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
164546 }
164547 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
164548 }
164549 yymsp[-2].minor.yy528 = yylhsminor.yy528;
164550 break;
164551 case 181: /* expr ::= nm DOT nm DOT nm */
164552 {
164553 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
164554 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -164322,768 +164556,776 @@
164556 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
164557 if( IN_RENAME_OBJECT ){
164558 sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
164559 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
164560 }
164561 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
164562 }
164563 yymsp[-4].minor.yy528 = yylhsminor.yy528;
164564 break;
164565 case 182: /* term ::= NULL|FLOAT|BLOB */
164566 case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
164567 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
164568 break;
164569 case 184: /* term ::= INTEGER */
164570 {
164571 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
164572 }
164573 yymsp[0].minor.yy528 = yylhsminor.yy528;
164574 break;
164575 case 185: /* expr ::= VARIABLE */
164576 {
164577 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
164578 u32 n = yymsp[0].minor.yy0.n;
164579 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
164580 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
164581 }else{
164582 /* When doing a nested parse, one can include terms in an expression
164583 ** that look like this: #1 #2 ... These terms refer to registers
164584 ** in the virtual machine. #N is the N-th register. */
164585 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
164586 assert( t.n>=2 );
164587 if( pParse->nested==0 ){
164588 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
164589 yymsp[0].minor.yy528 = 0;
164590 }else{
164591 yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
164592 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
164593 }
164594 }
164595 }
164596 break;
164597 case 186: /* expr ::= expr COLLATE ID|STRING */
164598 {
164599 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
164600 }
164601 break;
164602 case 187: /* expr ::= CAST LP expr AS typetoken RP */
164603 {
164604 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
164605 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
164606 }
164607 break;
164608 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
164609 {
164610 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
164611 }
164612 yymsp[-4].minor.yy528 = yylhsminor.yy528;
164613 break;
164614 case 189: /* expr ::= ID|INDEXED LP STAR RP */
164615 {
164616 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
164617 }
164618 yymsp[-3].minor.yy528 = yylhsminor.yy528;
164619 break;
164620 case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
164621 {
164622 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
164623 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
164624 }
164625 yymsp[-5].minor.yy528 = yylhsminor.yy528;
164626 break;
164627 case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
164628 {
164629 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
164630 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
164631 }
164632 yymsp[-4].minor.yy528 = yylhsminor.yy528;
164633 break;
164634 case 192: /* term ::= CTIME_KW */
164635 {
164636 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
164637 }
164638 yymsp[0].minor.yy528 = yylhsminor.yy528;
164639 break;
164640 case 193: /* expr ::= LP nexprlist COMMA expr RP */
164641 {
164642 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
164643 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
164644 if( yymsp[-4].minor.yy528 ){
164645 yymsp[-4].minor.yy528->x.pList = pList;
164646 if( ALWAYS(pList->nExpr) ){
164647 yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate;
164648 }
164649 }else{
164650 sqlite3ExprListDelete(pParse->db, pList);
164651 }
164652 }
164653 break;
164654 case 194: /* expr ::= expr AND expr */
164655 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164656 break;
164657 case 195: /* expr ::= expr OR expr */
164658 case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
164659 case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
164660 case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
164661 case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
164662 case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
164663 case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
164664 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
164665 break;
164666 case 202: /* likeop ::= NOT LIKE_KW|MATCH */
164667 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
164668 break;
164669 case 203: /* expr ::= expr likeop expr */
164670 {
164671 ExprList *pList;
164672 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
164673 yymsp[-1].minor.yy0.n &= 0x7fffffff;
164674 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
164675 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528);
164676 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164677 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
164678 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
164679 }
164680 break;
164681 case 204: /* expr ::= expr likeop expr ESCAPE expr */
164682 {
164683 ExprList *pList;
164684 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
164685 yymsp[-3].minor.yy0.n &= 0x7fffffff;
164686 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164687 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528);
164688 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
164689 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
164690 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164691 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
164692 }
164693 break;
164694 case 205: /* expr ::= expr ISNULL|NOTNULL */
164695 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
164696 break;
164697 case 206: /* expr ::= expr NOT NULL */
164698 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
164699 break;
164700 case 207: /* expr ::= expr IS expr */
164701 {
164702 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
164703 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
164704 }
164705 break;
164706 case 208: /* expr ::= expr IS NOT expr */
164707 {
164708 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
164709 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
164710 }
164711 break;
164712 case 209: /* expr ::= NOT expr */
164713 case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210);
164714 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
164715 break;
164716 case 211: /* expr ::= PLUS|MINUS expr */
164717 {
164718 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
164719 /*A-overwrites-B*/
164720 }
164721 break;
164722 case 212: /* expr ::= expr PTR expr */
164723 {
164724 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
164725 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
164726 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
164727 }
164728 yymsp[-2].minor.yy528 = yylhsminor.yy528;
164729 break;
164730 case 213: /* between_op ::= BETWEEN */
164731 case 216: /* in_op ::= IN */ yytestcase(yyruleno==216);
164732 {yymsp[0].minor.yy394 = 0;}
164733 break;
164734 case 215: /* expr ::= expr between_op expr AND expr */
164735 {
164736 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164737 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
164738 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
164739 if( yymsp[-4].minor.yy528 ){
164740 yymsp[-4].minor.yy528->x.pList = pList;
164741 }else{
164742 sqlite3ExprListDelete(pParse->db, pList);
164743 }
164744 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164745 }
164746 break;
164747 case 218: /* expr ::= expr in_op LP exprlist RP */
164748 {
164749 if( yymsp[-1].minor.yy322==0 ){
164750 /* Expressions of the form
164751 **
164752 ** expr1 IN ()
164753 ** expr1 NOT IN ()
164754 **
164755 ** simplify to constants 0 (false) and 1 (true), respectively,
164756 ** regardless of the value of expr1.
164757 */
164758 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528);
164759 yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy394 ? "1" : "0");
164760 }else{
164761 Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
164762 if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){
164763 yymsp[-1].minor.yy322->a[0].pExpr = 0;
164764 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
164765 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
164766 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS);
164767 }else{
164768 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164769 if( yymsp[-4].minor.yy528==0 ){
164770 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
164771 }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){
164772 int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr;
164773 Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322);
164774 if( pSelectRHS ){
164775 parserDoubleLinkSelect(pParse, pSelectRHS);
164776 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS);
164777 }
164778 }else{
164779 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322;
164780 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
164781 }
164782 }
164783 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164784 }
164785 }
164786 break;
164787 case 219: /* expr ::= LP select RP */
164788 {
164789 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
164790 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
164791 }
164792 break;
164793 case 220: /* expr ::= expr in_op LP select RP */
164794 {
164795 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164796 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
164797 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164798 }
164799 break;
164800 case 221: /* expr ::= expr in_op nm dbnm paren_exprlist */
164801 {
164802 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
164803 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
164804 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
164805 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
164806 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
164807 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
164808 }
164809 break;
164810 case 222: /* expr ::= EXISTS LP select RP */
164811 {
164812 Expr *p;
164813 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
164814 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
164815 }
164816 break;
164817 case 223: /* expr ::= CASE case_operand case_exprlist case_else END */
164818 {
164819 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
164820 if( yymsp[-4].minor.yy528 ){
164821 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
164822 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
164823 }else{
164824 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
164825 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
164826 }
164827 }
164828 break;
164829 case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
164830 {
164831 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
164832 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
164833 }
164834 break;
164835 case 225: /* case_exprlist ::= WHEN expr THEN expr */
164836 {
164837 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
164838 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
164839 }
164840 break;
164841 case 228: /* case_operand ::= expr */
164842 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
164843 break;
164844 case 231: /* nexprlist ::= nexprlist COMMA expr */
164845 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
164846 break;
164847 case 232: /* nexprlist ::= expr */
164848 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
164849 break;
164850 case 234: /* paren_exprlist ::= LP exprlist RP */
164851 case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239);
164852 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
164853 break;
164854 case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
164855 {
164856 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
164857 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
164858 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
164859 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
164860 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
164861 }
164862 }
164863 break;
164864 case 236: /* uniqueflag ::= UNIQUE */
164865 case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278);
164866 {yymsp[0].minor.yy394 = OE_Abort;}
164867 break;
164868 case 237: /* uniqueflag ::= */
164869 {yymsp[1].minor.yy394 = OE_None;}
164870 break;
164871 case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */
164872 {
164873 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
164874 }
164875 break;
164876 case 241: /* eidlist ::= nm collate sortorder */
164877 {
164878 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
164879 }
164880 break;
164881 case 244: /* cmd ::= DROP INDEX ifexists fullname */
164882 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
164883 break;
164884 case 245: /* cmd ::= VACUUM vinto */
164885 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
164886 break;
164887 case 246: /* cmd ::= VACUUM nm vinto */
164888 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
164889 break;
164890 case 249: /* cmd ::= PRAGMA nm dbnm */
164891 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
164892 break;
164893 case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
164894 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
164895 break;
164896 case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
164897 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
164898 break;
164899 case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
164900 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
164901 break;
164902 case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
164903 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
164904 break;
164905 case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
164906 {
164907 Token all;
164908 all.z = yymsp[-3].minor.yy0.z;
164909 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
164910 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
164911 }
164912 break;
164913 case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
164914 {
164915 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
164916 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
164917 }
164918 break;
164919 case 258: /* trigger_time ::= BEFORE|AFTER */
164920 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
164921 break;
164922 case 259: /* trigger_time ::= INSTEAD OF */
164923 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
164924 break;
164925 case 260: /* trigger_time ::= */
164926 { yymsp[1].minor.yy394 = TK_BEFORE; }
164927 break;
164928 case 261: /* trigger_event ::= DELETE|INSERT */
164929 case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262);
164930 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
164931 break;
164932 case 263: /* trigger_event ::= UPDATE OF idlist */
164933 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
164934 break;
164935 case 264: /* when_clause ::= */
164936 case 283: /* key_opt ::= */ yytestcase(yyruleno==283);
164937 { yymsp[1].minor.yy528 = 0; }
164938 break;
164939 case 265: /* when_clause ::= WHEN expr */
164940 case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284);
164941 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
164942 break;
164943 case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
164944 {
164945 assert( yymsp[-2].minor.yy33!=0 );
164946 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
164947 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
164948 }
164949 break;
164950 case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */
164951 {
164952 assert( yymsp[-1].minor.yy33!=0 );
164953 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
164954 }
164955 break;
164956 case 268: /* trnm ::= nm DOT nm */
164957 {
164958 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
164959 sqlite3ErrorMsg(pParse,
164960 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
164961 "statements within triggers");
164962 }
164963 break;
164964 case 269: /* tridxby ::= INDEXED BY nm */
164965 {
164966 sqlite3ErrorMsg(pParse,
164967 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
164968 "within triggers");
164969 }
164970 break;
164971 case 270: /* tridxby ::= NOT INDEXED */
164972 {
164973 sqlite3ErrorMsg(pParse,
164974 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
164975 "within triggers");
164976 }
164977 break;
164978 case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
164979 {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
164980 yymsp[-8].minor.yy33 = yylhsminor.yy33;
164981 break;
164982 case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
164983 {
164984 yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
164985 }
164986 yymsp[-7].minor.yy33 = yylhsminor.yy33;
164987 break;
164988 case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
164989 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
164990 yymsp[-5].minor.yy33 = yylhsminor.yy33;
164991 break;
164992 case 274: /* trigger_cmd ::= scanpt select scanpt */
164993 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
164994 yymsp[-2].minor.yy33 = yylhsminor.yy33;
164995 break;
164996 case 275: /* expr ::= RAISE LP IGNORE RP */
164997 {
164998 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
164999 if( yymsp[-3].minor.yy528 ){
165000 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
165001 }
165002 }
165003 break;
165004 case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */
165005 {
165006 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
165007 if( yymsp[-5].minor.yy528 ) {
165008 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
165009 }
165010 }
165011 break;
165012 case 277: /* raisetype ::= ROLLBACK */
165013 {yymsp[0].minor.yy394 = OE_Rollback;}
165014 break;
165015 case 279: /* raisetype ::= FAIL */
165016 {yymsp[0].minor.yy394 = OE_Fail;}
165017 break;
165018 case 280: /* cmd ::= DROP TRIGGER ifexists fullname */
165019 {
165020 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
165021 }
165022 break;
165023 case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
165024 {
165025 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
165026 }
165027 break;
165028 case 282: /* cmd ::= DETACH database_kw_opt expr */
165029 {
165030 sqlite3Detach(pParse, yymsp[0].minor.yy528);
165031 }
165032 break;
165033 case 285: /* cmd ::= REINDEX */
165034 {sqlite3Reindex(pParse, 0, 0);}
165035 break;
165036 case 286: /* cmd ::= REINDEX nm dbnm */
165037 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
165038 break;
165039 case 287: /* cmd ::= ANALYZE */
165040 {sqlite3Analyze(pParse, 0, 0);}
165041 break;
165042 case 288: /* cmd ::= ANALYZE nm dbnm */
165043 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
165044 break;
165045 case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
165046 {
165047 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
165048 }
165049 break;
165050 case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
165051 {
165052 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
165053 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
165054 }
165055 break;
165056 case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
165057 {
165058 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
165059 }
165060 break;
165061 case 292: /* add_column_fullname ::= fullname */
165062 {
165063 disableLookaside(pParse);
165064 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
165065 }
165066 break;
165067 case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
165068 {
165069 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
165070 }
165071 break;
165072 case 294: /* cmd ::= create_vtab */
165073 {sqlite3VtabFinishParse(pParse,0);}
165074 break;
165075 case 295: /* cmd ::= create_vtab LP vtabarglist RP */
165076 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
165077 break;
165078 case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
165079 {
165080 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
165081 }
165082 break;
165083 case 297: /* vtabarg ::= */
165084 {sqlite3VtabArgInit(pParse);}
165085 break;
165086 case 298: /* vtabargtoken ::= ANY */
165087 case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299);
165088 case 300: /* lp ::= LP */ yytestcase(yyruleno==300);
165089 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
165090 break;
165091 case 301: /* with ::= WITH wqlist */
165092 case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302);
165093 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
165094 break;
165095 case 303: /* wqas ::= AS */
165096 {yymsp[0].minor.yy516 = M10d_Any;}
165097 break;
165098 case 304: /* wqas ::= AS MATERIALIZED */
165099 {yymsp[-1].minor.yy516 = M10d_Yes;}
165100 break;
165101 case 305: /* wqas ::= AS NOT MATERIALIZED */
165102 {yymsp[-2].minor.yy516 = M10d_No;}
165103 break;
165104 case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */
165105 {
165106 yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
165107 }
165108 break;
165109 case 307: /* wqlist ::= wqitem */
165110 {
165111 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
165112 }
165113 break;
165114 case 308: /* wqlist ::= wqlist COMMA wqitem */
165115 {
165116 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
165117 }
165118 break;
165119 case 309: /* windowdefn_list ::= windowdefn */
165120 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
165121 yymsp[0].minor.yy41 = yylhsminor.yy41;
165122 break;
165123 case 310: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
165124 {
165125 assert( yymsp[0].minor.yy41!=0 );
165126 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
165127 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
165128 yylhsminor.yy41 = yymsp[0].minor.yy41;
165129 }
165130 yymsp[-2].minor.yy41 = yylhsminor.yy41;
165131 break;
165132 case 311: /* windowdefn ::= nm AS LP window RP */
165133 {
165134 if( ALWAYS(yymsp[-1].minor.yy41) ){
165135 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
165136 }
165137 yylhsminor.yy41 = yymsp[-1].minor.yy41;
165138 }
165139 yymsp[-4].minor.yy41 = yylhsminor.yy41;
165140 break;
165141 case 312: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
165142 {
165143 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
165144 }
165145 break;
165146 case 313: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
165147 {
165148 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
165149 }
165150 yymsp[-5].minor.yy41 = yylhsminor.yy41;
165151 break;
165152 case 314: /* window ::= ORDER BY sortlist frame_opt */
165153 {
165154 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
165155 }
165156 break;
165157 case 315: /* window ::= nm ORDER BY sortlist frame_opt */
165158 {
165159 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
165160 }
165161 yymsp[-4].minor.yy41 = yylhsminor.yy41;
165162 break;
165163 case 316: /* window ::= frame_opt */
165164 case 335: /* filter_over ::= over_clause */ yytestcase(yyruleno==335);
165165 {
165166 yylhsminor.yy41 = yymsp[0].minor.yy41;
165167 }
165168 yymsp[0].minor.yy41 = yylhsminor.yy41;
165169 break;
165170 case 317: /* window ::= nm frame_opt */
165171 {
165172 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
165173 }
165174 yymsp[-1].minor.yy41 = yylhsminor.yy41;
165175 break;
165176 case 318: /* frame_opt ::= */
165177 {
165178 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
165179 }
165180 break;
165181 case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
165182 {
165183 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
165184 }
165185 yymsp[-2].minor.yy41 = yylhsminor.yy41;
165186 break;
165187 case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
165188 {
165189 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
165190 }
165191 yymsp[-5].minor.yy41 = yylhsminor.yy41;
165192 break;
165193 case 322: /* frame_bound_s ::= frame_bound */
165194 case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324);
165195 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
165196 yymsp[0].minor.yy595 = yylhsminor.yy595;
165197 break;
165198 case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */
165199 case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325);
165200 case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327);
165201 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
165202 yymsp[-1].minor.yy595 = yylhsminor.yy595;
165203 break;
165204 case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */
165205 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
165206 yymsp[-1].minor.yy595 = yylhsminor.yy595;
165207 break;
165208 case 328: /* frame_exclude_opt ::= */
165209 {yymsp[1].minor.yy516 = 0;}
165210 break;
165211 case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
165212 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
165213 break;
165214 case 330: /* frame_exclude ::= NO OTHERS */
165215 case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331);
165216 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
165217 break;
165218 case 332: /* frame_exclude ::= GROUP|TIES */
165219 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
165220 break;
165221 case 333: /* window_clause ::= WINDOW windowdefn_list */
165222 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
165223 break;
165224 case 334: /* filter_over ::= filter_clause over_clause */
165225 {
165226 if( yymsp[0].minor.yy41 ){
165227 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
165228 }else{
165229 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
165230 }
165231 yylhsminor.yy41 = yymsp[0].minor.yy41;
165232 }
165233 yymsp[-1].minor.yy41 = yylhsminor.yy41;
165234 break;
165235 case 336: /* filter_over ::= filter_clause */
165236 {
165237 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165238 if( yylhsminor.yy41 ){
165239 yylhsminor.yy41->eFrmType = TK_FILTER;
165240 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
165241 }else{
165242 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
165243 }
165244 }
165245 yymsp[0].minor.yy41 = yylhsminor.yy41;
165246 break;
165247 case 337: /* over_clause ::= OVER LP window RP */
165248 {
165249 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
165250 assert( yymsp[-3].minor.yy41!=0 );
165251 }
165252 break;
165253 case 338: /* over_clause ::= OVER nm */
165254 {
165255 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
165256 if( yymsp[-1].minor.yy41 ){
165257 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
165258 }
165259 }
165260 break;
165261 case 339: /* filter_clause ::= FILTER LP WHERE expr RP */
165262 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
165263 break;
165264 default:
165265 /* (340) input ::= cmdlist */ yytestcase(yyruleno==340);
165266 /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341);
165267 /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342);
165268 /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343);
165269 /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344);
165270 /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345);
165271 /* (346) trans_opt ::= */ yytestcase(yyruleno==346);
165272 /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347);
165273 /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348);
165274 /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349);
165275 /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350);
165276 /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351);
165277 /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352);
165278 /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353);
165279 /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354);
165280 /* (355) nm ::= ID|INDEXED */ yytestcase(yyruleno==355);
165281 /* (356) nm ::= STRING */ yytestcase(yyruleno==356);
165282 /* (357) nm ::= JOIN_KW */ yytestcase(yyruleno==357);
165283 /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
165284 /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
165285 /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
165286 /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
165287 /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
165288 /* (363) carglist ::= */ yytestcase(yyruleno==363);
165289 /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
165290 /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
165291 /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
165292 /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
165293 /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
165294 /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
165295 /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
165296 /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
165297 /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
165298 /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
165299 /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
165300 /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
165301 /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
165302 /* (377) returning ::= */ yytestcase(yyruleno==377);
165303 /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378);
165304 /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379);
165305 /* (380) exprlist ::= nexprlist */ yytestcase(yyruleno==380);
165306 /* (381) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=381);
165307 /* (382) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=382);
165308 /* (383) nmnum ::= ON */ yytestcase(yyruleno==383);
165309 /* (384) nmnum ::= DELETE */ yytestcase(yyruleno==384);
165310 /* (385) nmnum ::= DEFAULT */ yytestcase(yyruleno==385);
165311 /* (386) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==386);
165312 /* (387) foreach_clause ::= */ yytestcase(yyruleno==387);
165313 /* (388) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==388);
165314 /* (389) trnm ::= nm */ yytestcase(yyruleno==389);
165315 /* (390) tridxby ::= */ yytestcase(yyruleno==390);
165316 /* (391) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==391);
165317 /* (392) database_kw_opt ::= */ yytestcase(yyruleno==392);
165318 /* (393) kwcolumn_opt ::= */ yytestcase(yyruleno==393);
165319 /* (394) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==394);
165320 /* (395) vtabarglist ::= vtabarg */ yytestcase(yyruleno==395);
165321 /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==396);
165322 /* (397) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==397);
165323 /* (398) anylist ::= */ yytestcase(yyruleno==398);
165324 /* (399) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==399);
165325 /* (400) anylist ::= anylist ANY */ yytestcase(yyruleno==400);
165326 /* (401) with ::= */ yytestcase(yyruleno==401);
165327 break;
165328 /********** End reduce actions ************************************************/
165329 };
165330 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
165331 yygoto = yyRuleInfoLhs[yyruleno];
@@ -166202,10 +166444,13 @@
166444 case CC_MINUS: {
166445 if( z[1]=='-' ){
166446 for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
166447 *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
166448 return i;
166449 }else if( z[1]=='>' ){
166450 *tokenType = TK_PTR;
166451 return 2 + (z[2]=='>');
166452 }
166453 *tokenType = TK_MINUS;
166454 return 1;
166455 }
166456 case CC_LP: {
@@ -166471,17 +166716,13 @@
166716 *tokenType = TK_ID;
166717 return i;
166718 }
166719
166720 /*
166721 ** Run the parser on the given SQL string.
 
 
 
 
166722 */
166723 SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){
166724 int nErr = 0; /* Number of errors encountered */
166725 void *pEngine; /* The LEMON-generated LALR(1) parser */
166726 int n = 0; /* Length of the next token token */
166727 int tokenType; /* type of the next token */
166728 int lastTokenParsed = -1; /* type of the previous token */
@@ -166498,11 +166739,10 @@
166739 if( db->nVdbeActive==0 ){
166740 AtomicStore(&db->u1.isInterrupted, 0);
166741 }
166742 pParse->rc = SQLITE_OK;
166743 pParse->zTail = zSql;
 
166744 #ifdef SQLITE_DEBUG
166745 if( db->flags & SQLITE_ParserTrace ){
166746 printf("parser: [[[%s]]]\n", zSql);
166747 sqlite3ParserTrace(stdout, "parser: ");
166748 }else{
@@ -166541,10 +166781,11 @@
166781 if( tokenType>=TK_SPACE ){
166782 assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
166783 #endif /* SQLITE_OMIT_WINDOWFUNC */
166784 if( AtomicLoad(&db->u1.isInterrupted) ){
166785 pParse->rc = SQLITE_INTERRUPT;
166786 pParse->nErr++;
166787 break;
166788 }
166789 if( tokenType==TK_SPACE ){
166790 zSql += n;
166791 continue;
@@ -166598,45 +166839,30 @@
166839 sqlite3ParserFree(pEngine, sqlite3_free);
166840 #endif
166841 if( db->mallocFailed ){
166842 pParse->rc = SQLITE_NOMEM_BKPT;
166843 }
166844 if( pParse->zErrMsg || (pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE) ){
166845 if( pParse->zErrMsg==0 ){
166846 pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
166847 }
166848 sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail);
 
 
 
 
166849 nErr++;
166850 }
166851 pParse->zTail = zSql;
 
 
 
 
 
 
 
 
 
 
 
166852 #ifndef SQLITE_OMIT_VIRTUALTABLE
166853 sqlite3_free(pParse->apVtabLock);
166854 #endif
166855
166856 if( pParse->pNewTable && !IN_SPECIAL_PARSE ){
166857 /* If the pParse->declareVtab flag is set, do not delete any table
166858 ** structure built up in pParse->pNewTable. The calling code (see vtab.c)
166859 ** will take responsibility for freeing the Table structure.
166860 */
166861 sqlite3DeleteTable(db, pParse->pNewTable);
166862 }
166863 if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
166864 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
166865 }
166866 sqlite3DbFree(db, pParse->pVList);
166867 db->pParse = pParentParse;
166868 assert( nErr==0 || pParse->rc!=SQLITE_OK );
@@ -167217,13 +167443,10 @@
167443 SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*);
167444 #endif
167445 #ifdef SQLITE_ENABLE_FTS5
167446 SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*);
167447 #endif
 
 
 
167448 #ifdef SQLITE_ENABLE_STMTVTAB
167449 SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*);
167450 #endif
167451
167452 /*
@@ -167254,12 +167477,12 @@
167477 #endif
167478 #ifdef SQLITE_ENABLE_DBSTAT_VTAB
167479 sqlite3DbstatRegister,
167480 #endif
167481 sqlite3TestExtInit,
167482 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
167483 sqlite3JsonTableFunctions,
167484 #endif
167485 #ifdef SQLITE_ENABLE_STMTVTAB
167486 sqlite3StmtVtabInit,
167487 #endif
167488 #ifdef SQLITE_ENABLE_BYTECODE_VTAB
@@ -169763,10 +169986,23 @@
169986 }
169987 }
169988 sqlite3_mutex_leave(db->mutex);
169989 return z;
169990 }
169991
169992 /*
169993 ** Return the byte offset of the most recent error
169994 */
169995 SQLITE_API int sqlite3_error_offset(sqlite3 *db){
169996 int iOffset = -1;
169997 if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){
169998 sqlite3_mutex_enter(db->mutex);
169999 iOffset = db->errByteOffset;
170000 sqlite3_mutex_leave(db->mutex);
170001 }
170002 return iOffset;
170003 }
170004
170005 #ifndef SQLITE_OMIT_UTF16
170006 /*
170007 ** Return UTF-16 encoded English language explanation of the most recent
170008 ** error.
@@ -173514,11 +173750,11 @@
173750 SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
173751 SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
173752 SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
173753
173754 /* fts3_tokenize_vtab.c */
173755 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*));
173756
173757 /* fts3_unicode2.c (functions generated by parsing unicode text files) */
173758 #ifndef SQLITE_DISABLE_FTS3_UNICODE
173759 SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
173760 SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -173546,10 +173782,16 @@
173782 /* #include "fts3.h" */
173783 #ifndef SQLITE_CORE
173784 /* # include "sqlite3ext.h" */
173785 SQLITE_EXTENSION_INIT1
173786 #endif
173787
173788 typedef struct Fts3HashWrapper Fts3HashWrapper;
173789 struct Fts3HashWrapper {
173790 Fts3Hash hash; /* Hash table */
173791 int nRef; /* Number of pointers to this object */
173792 };
173793
173794 static int fts3EvalNext(Fts3Cursor *pCsr);
173795 static int fts3EvalStart(Fts3Cursor *pCsr);
173796 static int fts3TermSegReaderCursor(
173797 Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **);
@@ -174411,11 +174653,11 @@
174653 int argc, /* Number of elements in argv array */
174654 const char * const *argv, /* xCreate/xConnect argument array */
174655 sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */
174656 char **pzErr /* Write any error message here */
174657 ){
174658 Fts3Hash *pHash = &((Fts3HashWrapper*)pAux)->hash;
174659 Fts3Table *p = 0; /* Pointer to allocated vtab */
174660 int rc = SQLITE_OK; /* Return code */
174661 int i; /* Iterator variable */
174662 sqlite3_int64 nByte; /* Size of allocation used for *p */
174663 int iCol; /* Column index */
@@ -177246,13 +177488,16 @@
177488 ** This function is registered as the module destructor (called when an
177489 ** FTS3 enabled database connection is closed). It frees the memory
177490 ** allocated for the tokenizer hash table.
177491 */
177492 static void hashDestroy(void *p){
177493 Fts3HashWrapper *pHash = (Fts3HashWrapper *)p;
177494 pHash->nRef--;
177495 if( pHash->nRef<=0 ){
177496 sqlite3Fts3HashClear(&pHash->hash);
177497 sqlite3_free(pHash);
177498 }
177499 }
177500
177501 /*
177502 ** The fts3 built-in tokenizers - "simple", "porter" and "icu"- are
177503 ** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c
@@ -177278,11 +177523,11 @@
177523 ** SQLite. If fts3 is built as a dynamically loadable extension, this
177524 ** function is called by the sqlite3_extension_init() entry point.
177525 */
177526 SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
177527 int rc = SQLITE_OK;
177528 Fts3HashWrapper *pHash = 0;
177529 const sqlite3_tokenizer_module *pSimple = 0;
177530 const sqlite3_tokenizer_module *pPorter = 0;
177531 #ifndef SQLITE_DISABLE_FTS3_UNICODE
177532 const sqlite3_tokenizer_module *pUnicode = 0;
177533 #endif
@@ -177306,70 +177551,74 @@
177551
177552 sqlite3Fts3SimpleTokenizerModule(&pSimple);
177553 sqlite3Fts3PorterTokenizerModule(&pPorter);
177554
177555 /* Allocate and initialize the hash-table used to store tokenizers. */
177556 pHash = sqlite3_malloc(sizeof(Fts3HashWrapper));
177557 if( !pHash ){
177558 rc = SQLITE_NOMEM;
177559 }else{
177560 sqlite3Fts3HashInit(&pHash->hash, FTS3_HASH_STRING, 1);
177561 pHash->nRef = 0;
177562 }
177563
177564 /* Load the built-in tokenizers into the hash table */
177565 if( rc==SQLITE_OK ){
177566 if( sqlite3Fts3HashInsert(&pHash->hash, "simple", 7, (void *)pSimple)
177567 || sqlite3Fts3HashInsert(&pHash->hash, "porter", 7, (void *)pPorter)
177568
177569 #ifndef SQLITE_DISABLE_FTS3_UNICODE
177570 || sqlite3Fts3HashInsert(&pHash->hash, "unicode61", 10, (void *)pUnicode)
177571 #endif
177572 #ifdef SQLITE_ENABLE_ICU
177573 || (pIcu && sqlite3Fts3HashInsert(&pHash->hash, "icu", 4, (void *)pIcu))
177574 #endif
177575 ){
177576 rc = SQLITE_NOMEM;
177577 }
177578 }
177579
177580 #ifdef SQLITE_TEST
177581 if( rc==SQLITE_OK ){
177582 rc = sqlite3Fts3ExprInitTestInterface(db, &pHash->hash);
177583 }
177584 #endif
177585
177586 /* Create the virtual table wrapper around the hash-table and overload
177587 ** the four scalar functions. If this is successful, register the
177588 ** module with sqlite.
177589 */
177590 if( SQLITE_OK==rc
177591 && SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
177592 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
177593 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
177594 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
177595 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
177596 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
177597 ){
177598 pHash->nRef++;
177599 rc = sqlite3_create_module_v2(
177600 db, "fts3", &fts3Module, (void *)pHash, hashDestroy
177601 );
177602 if( rc==SQLITE_OK ){
177603 pHash->nRef++;
177604 rc = sqlite3_create_module_v2(
177605 db, "fts4", &fts3Module, (void *)pHash, hashDestroy
177606 );
177607 }
177608 if( rc==SQLITE_OK ){
177609 pHash->nRef++;
177610 rc = sqlite3Fts3InitTok(db, (void *)pHash, hashDestroy);
177611 }
177612 return rc;
177613 }
177614
177615
177616 /* An error has occurred. Delete the hash table and return the error code. */
177617 assert( rc!=SQLITE_OK );
177618 if( pHash ){
177619 sqlite3Fts3HashClear(&pHash->hash);
177620 sqlite3_free(pHash);
177621 }
177622 return rc;
177623 }
177624
@@ -177712,11 +177961,11 @@
177961 ){
177962 char *p = *ppIter;
177963
177964 assert( nDoclist>0 );
177965 assert( *pbEof==0 );
177966 assert_fts3_nc( p || *piDocid==0 );
177967 assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) );
177968
177969 if( p==0 ){
177970 sqlite3_int64 iDocid = 0;
177971 char *pNext = 0;
@@ -183429,11 +183678,11 @@
183678
183679 /*
183680 ** Register the fts3tok module with database connection db. Return SQLITE_OK
183681 ** if successful or an error code if sqlite3_create_module() fails.
183682 */
183683 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){
183684 static const sqlite3_module fts3tok_module = {
183685 0, /* iVersion */
183686 fts3tokConnectMethod, /* xCreate */
183687 fts3tokConnectMethod, /* xConnect */
183688 fts3tokBestIndexMethod, /* xBestIndex */
@@ -183458,11 +183707,13 @@
183707 0, /* xRollbackTo */
183708 0 /* xShadowName */
183709 };
183710 int rc; /* Return code */
183711
183712 rc = sqlite3_create_module_v2(
183713 db, "fts3tokenize", &fts3tok_module, (void*)pHash, xDestroy
183714 );
183715 return rc;
183716 }
183717
183718 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
183719
@@ -191817,11 +192068,11 @@
192068 }
192069 #endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
192070 #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
192071
192072 /************** End of fts3_unicode2.c ***************************************/
192073 /************** Begin file json.c ********************************************/
192074 /*
192075 ** 2015-08-12
192076 **
192077 ** The author disclaims copyright to this source code. In place of
192078 ** a legal notice, here is a blessing:
@@ -191830,63 +192081,23 @@
192081 ** May you find forgiveness for yourself and forgive others.
192082 ** May you share freely, never taking more than you give.
192083 **
192084 ******************************************************************************
192085 **
192086 ** This SQLite JSON functions.
 
192087 **
192088 ** This file began as an extension in ext/misc/json1.c in 2015. That
192089 ** extension proved so useful that it has now been moved into the core.
192090 **
192091 ** For the time being, all JSON is stored as pure text. (We might add
192092 ** a JSONB type in the future which stores a binary encoding of JSON in
192093 ** a BLOB, but there is no support for JSONB in the current implementation.
192094 ** This implementation parses JSON text at 250 MB/s, so it is hard to see
192095 ** how JSONB might improve on that.)
192096 */
192097 #ifndef SQLITE_OMIT_JSON
192098 /* #include "sqliteInt.h" */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192099
192100 /*
192101 ** Growing our own isspace() routine this way is twice as fast as
192102 ** the library isspace() function, resulting in a 7% overall performance
192103 ** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
@@ -191907,48 +192118,18 @@
192118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192122 };
192123 #define fast_isspace(x) (jsonIsSpace[(unsigned char)x])
192124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192125 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST)
192126 # define VVA(X)
192127 #else
192128 # define VVA(X) X
192129 #endif
192130
 
 
 
 
 
 
 
 
192131 /* Objects */
192132 typedef struct JsonString JsonString;
192133 typedef struct JsonNode JsonNode;
192134 typedef struct JsonParse JsonParse;
192135
@@ -192402,14 +192583,14 @@
192583 /*
192584 ** Convert a 4-byte hex string into an integer
192585 */
192586 static u32 jsonHexToInt4(const char *z){
192587 u32 v;
192588 assert( sqlite3Isxdigit(z[0]) );
192589 assert( sqlite3Isxdigit(z[1]) );
192590 assert( sqlite3Isxdigit(z[2]) );
192591 assert( sqlite3Isxdigit(z[3]) );
192592 v = (jsonHexToInt(z[0])<<12)
192593 + (jsonHexToInt(z[1])<<8)
192594 + (jsonHexToInt(z[2])<<4)
192595 + jsonHexToInt(z[3]);
192596 return v;
@@ -192640,11 +192821,11 @@
192821 /*
192822 ** Return true if z[] begins with 4 (or more) hexadecimal digits
192823 */
192824 static int jsonIs4Hex(const char *z){
192825 int i;
192826 for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0;
192827 return 1;
192828 }
192829
192830 /*
192831 ** Parse a single JSON value which begins at pParse->zJson[i]. Return the
@@ -192659,17 +192840,17 @@
192840 u32 j;
192841 int iThis;
192842 int x;
192843 JsonNode *pNode;
192844 const char *z = pParse->zJson;
192845 while( fast_isspace(z[i]) ){ i++; }
192846 if( (c = z[i])=='{' ){
192847 /* Parse object */
192848 iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
192849 if( iThis<0 ) return -1;
192850 for(j=i+1;;j++){
192851 while( fast_isspace(z[j]) ){ j++; }
192852 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192853 x = jsonParseValue(pParse, j);
192854 if( x<0 ){
192855 pParse->iDepth--;
192856 if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
@@ -192678,18 +192859,18 @@
192859 if( pParse->oom ) return -1;
192860 pNode = &pParse->aNode[pParse->nNode-1];
192861 if( pNode->eType!=JSON_STRING ) return -1;
192862 pNode->jnFlags |= JNODE_LABEL;
192863 j = x;
192864 while( fast_isspace(z[j]) ){ j++; }
192865 if( z[j]!=':' ) return -1;
192866 j++;
192867 x = jsonParseValue(pParse, j);
192868 pParse->iDepth--;
192869 if( x<0 ) return -1;
192870 j = x;
192871 while( fast_isspace(z[j]) ){ j++; }
192872 c = z[j];
192873 if( c==',' ) continue;
192874 if( c!='}' ) return -1;
192875 break;
192876 }
@@ -192699,20 +192880,20 @@
192880 /* Parse array */
192881 iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
192882 if( iThis<0 ) return -1;
192883 memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
192884 for(j=i+1;;j++){
192885 while( fast_isspace(z[j]) ){ j++; }
192886 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
192887 x = jsonParseValue(pParse, j);
192888 pParse->iDepth--;
192889 if( x<0 ){
192890 if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
192891 return -1;
192892 }
192893 j = x;
192894 while( fast_isspace(z[j]) ){ j++; }
192895 c = z[j];
192896 if( c==',' ) continue;
192897 if( c!=']' ) return -1;
192898 break;
192899 }
@@ -192745,21 +192926,21 @@
192926 jsonParseAddNode(pParse, JSON_STRING, j+1-i, &z[i]);
192927 if( !pParse->oom ) pParse->aNode[pParse->nNode-1].jnFlags = jnFlags;
192928 return j+1;
192929 }else if( c=='n'
192930 && strncmp(z+i,"null",4)==0
192931 && !sqlite3Isalnum(z[i+4]) ){
192932 jsonParseAddNode(pParse, JSON_NULL, 0, 0);
192933 return i+4;
192934 }else if( c=='t'
192935 && strncmp(z+i,"true",4)==0
192936 && !sqlite3Isalnum(z[i+4]) ){
192937 jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
192938 return i+4;
192939 }else if( c=='f'
192940 && strncmp(z+i,"false",5)==0
192941 && !sqlite3Isalnum(z[i+5]) ){
192942 jsonParseAddNode(pParse, JSON_FALSE, 0, 0);
192943 return i+5;
192944 }else if( c=='-' || (c>='0' && c<='9') ){
192945 /* Parse number */
192946 u8 seenDP = 0;
@@ -192826,11 +193007,11 @@
193007 pParse->zJson = zJson;
193008 i = jsonParseValue(pParse, 0);
193009 if( pParse->oom ) i = -1;
193010 if( i>0 ){
193011 assert( pParse->iDepth==0 );
193012 while( fast_isspace(zJson[i]) ) i++;
193013 if( zJson[i] ) i = -1;
193014 }
193015 if( i<=0 ){
193016 if( pCtx!=0 ){
193017 if( pParse->oom ){
@@ -193054,11 +193235,11 @@
193235 return pNode;
193236 }
193237 }else if( zPath[0]=='[' ){
193238 i = 0;
193239 j = 1;
193240 while( sqlite3Isdigit(zPath[j]) ){
193241 i = i*10 + zPath[j] - '0';
193242 j++;
193243 }
193244 if( j<2 || zPath[j]!=']' ){
193245 if( zPath[1]=='#' ){
@@ -193075,17 +193256,17 @@
193256 iBase += pBase->u.iAppend;
193257 pBase = &pParse->aNode[iBase];
193258 j = 1;
193259 }
193260 j = 2;
193261 if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){
193262 unsigned int x = 0;
193263 j = 3;
193264 do{
193265 x = x*10 + zPath[j] - '0';
193266 j++;
193267 }while( sqlite3Isdigit(zPath[j]) );
193268 if( x>i ) return 0;
193269 i -= x;
193270 }
193271 if( zPath[j]!=']' ){
193272 *pzErr = zPath;
@@ -193300,11 +193481,11 @@
193481 static void jsonTest1Func(
193482 sqlite3_context *ctx,
193483 int argc,
193484 sqlite3_value **argv
193485 ){
193486 UNUSED_PARAMETER(argc);
193487 sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE);
193488 }
193489 #endif /* SQLITE_DEBUG */
193490
193491 /****************************************************************************
@@ -193321,11 +193502,11 @@
193502 sqlite3_context *ctx,
193503 int argc,
193504 sqlite3_value **argv
193505 ){
193506 JsonString jx;
193507 UNUSED_PARAMETER(argc);
193508
193509 jsonInit(&jx, ctx);
193510 jsonAppendValue(&jx, argv[0]);
193511 jsonResult(&jx);
193512 sqlite3_result_subtype(ctx, JSON_SUBTYPE);
@@ -193392,55 +193573,118 @@
193573 }
193574 }
193575 sqlite3_result_int64(ctx, n);
193576 }
193577
193578 /*
193579 ** Bit values for the flags passed into jsonExtractFunc() or
193580 ** jsonSetFunc() via the user-data value.
193581 */
193582 #define JSON_JSON 0x01 /* Result is always JSON */
193583 #define JSON_SQL 0x02 /* Result is always SQL */
193584 #define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */
193585 #define JSON_ISSET 0x04 /* json_set(), not json_insert() */
193586
193587 /*
193588 ** json_extract(JSON, PATH, ...)
193589 ** "->"(JSON,PATH)
193590 ** "->>"(JSON,PATH)
193591 **
193592 ** Return the element described by PATH. Return NULL if that PATH element
193593 ** is not found.
193594 **
193595 ** If JSON_JSON is set or if more that one PATH argument is supplied then
193596 ** always return a JSON representation of the result. If JSON_SQL is set,
193597 ** then always return an SQL representation of the result. If neither flag
193598 ** is present and argc==2, then return JSON for objects and arrays and SQL
193599 ** for all other values.
193600 **
193601 ** When multiple PATH arguments are supplied, the result is a JSON array
193602 ** containing the result of each PATH.
193603 **
193604 ** Abbreviated JSON path expressions are allows if JSON_ABPATH, for
193605 ** compatibility with PG.
193606 */
193607 static void jsonExtractFunc(
193608 sqlite3_context *ctx,
193609 int argc,
193610 sqlite3_value **argv
193611 ){
193612 JsonParse *p; /* The parse */
193613 JsonNode *pNode;
193614 const char *zPath;
193615 int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx));
193616 JsonString jx;
 
193617
193618 if( argc<2 ) return;
193619 p = jsonParseCached(ctx, argv, ctx);
193620 if( p==0 ) return;
193621 if( argc==2 ){
193622 /* With a single PATH argument */
193623 zPath = (const char*)sqlite3_value_text(argv[1]);
193624 if( zPath==0 ) return;
193625 if( flags & JSON_ABPATH ){
193626 if( zPath[0]!='$' ){
193627 /* The -> and ->> operators accept abbreviated PATH arguments. This
193628 ** is mostly for compatibility with PostgreSQL, but also for
193629 ** convenience.
193630 **
193631 ** NUMBER ==> $[NUMBER] // PG compatible
193632 ** LABEL ==> $.LABEL // PG compatible
193633 ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience
193634 */
193635 jsonInit(&jx, ctx);
193636 if( sqlite3Isdigit(zPath[0]) ){
193637 jsonAppendRaw(&jx, "$[", 2);
193638 jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
193639 jsonAppendRaw(&jx, "]", 2);
193640 }else{
193641 jsonAppendRaw(&jx, "$.", 1 + (zPath[0]!='['));
193642 jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
193643 jsonAppendChar(&jx, 0);
193644 }
193645 pNode = jx.bErr ? 0 : jsonLookup(p, jx.zBuf, 0, ctx);
193646 jsonReset(&jx);
193647 }else{
193648 pNode = jsonLookup(p, zPath, 0, ctx);
193649 }
193650 if( pNode ){
193651 if( flags & JSON_JSON ){
193652 jsonReturnJson(pNode, ctx, 0);
193653 }else{
193654 jsonReturn(pNode, ctx, 0);
193655 sqlite3_result_subtype(ctx, 0);
193656 }
193657 }
193658 }else{
193659 pNode = jsonLookup(p, zPath, 0, ctx);
193660 if( p->nErr==0 && pNode ) jsonReturn(pNode, ctx, 0);
193661 }
193662 }else{
193663 /* Two or more PATH arguments results in a JSON array with each
193664 ** element of the array being the value selected by one of the PATHs */
193665 int i;
193666 jsonInit(&jx, ctx);
193667 jsonAppendChar(&jx, '[');
193668 for(i=1; i<argc; i++){
193669 zPath = (const char*)sqlite3_value_text(argv[i]);
193670 pNode = jsonLookup(p, zPath, 0, ctx);
193671 if( p->nErr ) break;
193672 jsonAppendSeparator(&jx);
193673 if( pNode ){
193674 jsonRenderNode(pNode, &jx, 0);
193675 }else{
193676 jsonAppendRaw(&jx, "null", 4);
193677 }
193678 }
193679 if( i==argc ){
193680 jsonAppendChar(&jx, ']');
193681 jsonResult(&jx);
193682 sqlite3_result_subtype(ctx, JSON_SUBTYPE);
193683 }
193684 jsonReset(&jx);
193685 }
 
 
193686 }
193687
193688 /* This is the RFC 7396 MergePatch algorithm.
193689 */
193690 static JsonNode *jsonMergePatch(
@@ -193532,11 +193776,11 @@
193776 ){
193777 JsonParse x; /* The JSON that is being patched */
193778 JsonParse y; /* The patch */
193779 JsonNode *pResult; /* The result of the merge */
193780
193781 UNUSED_PARAMETER(argc);
193782 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
193783 if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){
193784 jsonParseReset(&x);
193785 return;
193786 }
@@ -193653,11 +193897,11 @@
193897 zPath = (const char*)sqlite3_value_text(argv[i]);
193898 pNode = jsonLookup(&x, zPath, 0, ctx);
193899 if( x.nErr ) goto replace_err;
193900 if( pNode ){
193901 assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 );
193902 testcase( pNode->eU!=0 && pNode->eU!=1 );
193903 pNode->jnFlags |= (u8)JNODE_REPLACE;
193904 VVA( pNode->eU = 4 );
193905 pNode->u.iReplace = i + 1;
193906 }
193907 }
@@ -193668,10 +193912,11 @@
193912 jsonReturnJson(x.aNode, ctx, argv);
193913 }
193914 replace_err:
193915 jsonParseReset(&x);
193916 }
193917
193918
193919 /*
193920 ** json_set(JSON, PATH, VALUE, ...)
193921 **
193922 ** Set the value at PATH to VALUE. Create the PATH if it does not already
@@ -193691,11 +193936,11 @@
193936 JsonParse x; /* The parse */
193937 JsonNode *pNode;
193938 const char *zPath;
193939 u32 i;
193940 int bApnd;
193941 int bIsSet = sqlite3_user_data(ctx)!=0;
193942
193943 if( argc<1 ) return;
193944 if( (argc&1)==0 ) {
193945 jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert");
193946 return;
@@ -193710,11 +193955,11 @@
193955 sqlite3_result_error_nomem(ctx);
193956 goto jsonSetDone;
193957 }else if( x.nErr ){
193958 goto jsonSetDone;
193959 }else if( pNode && (bApnd || bIsSet) ){
193960 testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 );
193961 assert( pNode->eU!=3 || pNode->eU!=5 );
193962 VVA( pNode->eU = 4 );
193963 pNode->jnFlags |= (u8)JNODE_REPLACE;
193964 pNode->u.iReplace = i + 1;
193965 }
@@ -193731,12 +193976,12 @@
193976
193977 /*
193978 ** json_type(JSON)
193979 ** json_type(JSON, PATH)
193980 **
193981 ** Return the top-level "type" of a JSON string. json_type() raises an
193982 ** error if either the JSON or PATH inputs are not well-formed.
193983 */
193984 static void jsonTypeFunc(
193985 sqlite3_context *ctx,
193986 int argc,
193987 sqlite3_value **argv
@@ -193768,11 +194013,11 @@
194013 sqlite3_context *ctx,
194014 int argc,
194015 sqlite3_value **argv
194016 ){
194017 JsonParse *p; /* The parse */
194018 UNUSED_PARAMETER(argc);
194019 p = jsonParseCached(ctx, argv, 0);
194020 sqlite3_result_int(ctx, p!=0);
194021 }
194022
194023
@@ -193788,11 +194033,11 @@
194033 sqlite3_context *ctx,
194034 int argc,
194035 sqlite3_value **argv
194036 ){
194037 JsonString *pStr;
194038 UNUSED_PARAMETER(argc);
194039 pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
194040 if( pStr ){
194041 if( pStr->zBuf==0 ){
194042 jsonInit(pStr, ctx);
194043 jsonAppendChar(pStr, '[');
@@ -193848,12 +194093,12 @@
194093 int inStr = 0;
194094 int nNest = 0;
194095 char *z;
194096 char c;
194097 JsonString *pStr;
194098 UNUSED_PARAMETER(argc);
194099 UNUSED_PARAMETER(argv);
194100 pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
194101 #ifdef NEVER
194102 /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
194103 ** always have been called to initalize it */
194104 if( NEVER(!pStr) ) return;
@@ -193893,11 +194138,11 @@
194138 sqlite3_value **argv
194139 ){
194140 JsonString *pStr;
194141 const char *z;
194142 u32 n;
194143 UNUSED_PARAMETER(argc);
194144 pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr));
194145 if( pStr ){
194146 if( pStr->zBuf==0 ){
194147 jsonInit(pStr, ctx);
194148 jsonAppendChar(pStr, '{');
@@ -193984,14 +194229,14 @@
194229 ** the last two columns in the table. Should this ever changes, be
194230 ** sure to update the xBestIndex method. */
194231 #define JEACH_JSON 8
194232 #define JEACH_ROOT 9
194233
194234 UNUSED_PARAMETER(pzErr);
194235 UNUSED_PARAMETER(argv);
194236 UNUSED_PARAMETER(argc);
194237 UNUSED_PARAMETER(pAux);
194238 rc = sqlite3_declare_vtab(db,
194239 "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
194240 "json HIDDEN,root HIDDEN)");
194241 if( rc==SQLITE_OK ){
194242 pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
@@ -194010,11 +194255,11 @@
194255
194256 /* constructor for a JsonEachCursor object for json_each(). */
194257 static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
194258 JsonEachCursor *pCur;
194259
194260 UNUSED_PARAMETER(p);
194261 pCur = sqlite3_malloc( sizeof(*pCur) );
194262 if( pCur==0 ) return SQLITE_NOMEM;
194263 memset(pCur, 0, sizeof(*pCur));
194264 *ppCursor = &pCur->base;
194265 return SQLITE_OK;
@@ -194070,11 +194315,11 @@
194315 u32 iUp = p->sParse.aUp[p->i];
194316 JsonNode *pUp = &p->sParse.aNode[iUp];
194317 p->eType = pUp->eType;
194318 if( pUp->eType==JSON_ARRAY ){
194319 assert( pUp->eU==0 || pUp->eU==3 );
194320 testcase( pUp->eU==3 );
194321 VVA( pUp->eU = 3 );
194322 if( iUp==p->i-1 ){
194323 pUp->u.iKey = 0;
194324 }else{
194325 pUp->u.iKey++;
@@ -194257,11 +194502,11 @@
194502 const struct sqlite3_index_constraint *pConstraint;
194503
194504 /* This implementation assumes that JSON and ROOT are the last two
194505 ** columns in the table */
194506 assert( JEACH_ROOT == JEACH_JSON+1 );
194507 UNUSED_PARAMETER(tab);
194508 aIdx[0] = aIdx[1] = -1;
194509 pConstraint = pIdxInfo->aConstraint;
194510 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
194511 int iCol;
194512 int iMask;
@@ -194313,12 +194558,12 @@
194558 JsonEachCursor *p = (JsonEachCursor*)cur;
194559 const char *z;
194560 const char *zRoot = 0;
194561 sqlite3_int64 n;
194562
194563 UNUSED_PARAMETER(idxStr);
194564 UNUSED_PARAMETER(argc);
194565 jsonEachCursorReset(p);
194566 if( idxNum==0 ) return SQLITE_OK;
194567 z = (const char*)sqlite3_value_text(argv[0]);
194568 if( z==0 ) return SQLITE_OK;
194569 n = sqlite3_value_bytes(argv[0]);
@@ -194439,112 +194684,72 @@
194684 0, /* xRelease */
194685 0, /* xRollbackTo */
194686 0 /* xShadowName */
194687 };
194688 #endif /* SQLITE_OMIT_VIRTUALTABLE */
194689 #endif /* !defined(SQLITE_OMIT_JSON) */
194690
194691 /*
194692 ** Register JSON functions.
194693 */
194694 SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){
194695 #ifndef SQLITE_OMIT_JSON
194696 static FuncDef aJsonFunc[] = {
194697 JFUNCTION(json, 1, 0, jsonRemoveFunc),
194698 JFUNCTION(json_array, -1, 0, jsonArrayFunc),
194699 JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc),
194700 JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc),
194701 JFUNCTION(json_extract, -1, 0, jsonExtractFunc),
194702 JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc),
194703 JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc),
194704 JFUNCTION(json_insert, -1, 0, jsonSetFunc),
194705 JFUNCTION(json_object, -1, 0, jsonObjectFunc),
194706 JFUNCTION(json_patch, 2, 0, jsonPatchFunc),
194707 JFUNCTION(json_quote, 1, 0, jsonQuoteFunc),
194708 JFUNCTION(json_remove, -1, 0, jsonRemoveFunc),
194709 JFUNCTION(json_replace, -1, 0, jsonReplaceFunc),
194710 JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc),
194711 JFUNCTION(json_type, 1, 0, jsonTypeFunc),
194712 JFUNCTION(json_type, 2, 0, jsonTypeFunc),
194713 JFUNCTION(json_valid, 1, 0, jsonValidFunc),
 
 
 
 
 
 
 
194714 #if SQLITE_DEBUG
194715 JFUNCTION(json_parse, 1, 0, jsonParseFunc),
194716 JFUNCTION(json_test1, 1, 0, jsonTest1Func),
194717 #endif
194718 WAGGREGATE(json_group_array, 1, 0, 0,
194719 jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse,
194720 SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS),
194721 WAGGREGATE(json_group_object, 2, 0, 0,
194722 jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse,
194723 SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS)
194724 };
194725 sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc));
194726 #endif
194727 }
194728
194729 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
194730 /*
194731 ** Register the JSON table-valued functions
194732 */
194733 SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3 *db){
194734 int rc = SQLITE_OK;
194735 static const struct {
194736 const char *zName;
194737 sqlite3_module *pModule;
194738 } aMod[] = {
194739 { "json_each", &jsonEachModule },
194740 { "json_tree", &jsonTreeModule },
194741 };
194742 int i;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194743 for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){
194744 rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
194745 }
 
194746 return rc;
194747 }
194748 #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */
194749
194750 /************** End of json.c ************************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194751 /************** Begin file rtree.c *******************************************/
194752 /*
194753 ** 2001 September 15
194754 **
194755 ** The author disclaims copyright to this source code. In place of
@@ -198974,15 +199179,11 @@
199179 # define GEODEBUG(X) if(geo_debug)printf X
199180 #else
199181 # define GEODEBUG(X)
199182 #endif
199183
199184 /* Character class routines */
 
 
 
 
199185 #ifdef sqlite3Isdigit
199186 /* Use the SQLite core versions if this routine is part of the
199187 ** SQLite amalgamation */
199188 # define safe_isdigit(x) sqlite3Isdigit(x)
199189 # define safe_isalnum(x) sqlite3Isalnum(x)
@@ -198993,10 +199194,11 @@
199194 # define safe_isdigit(x) isdigit((unsigned char)(x))
199195 # define safe_isalnum(x) isalnum((unsigned char)(x))
199196 # define safe_isxdigit(x) isxdigit((unsigned char)(x))
199197 #endif
199198
199199 #ifndef JSON_NULL /* The following stuff repeats things found in json1 */
199200 /*
199201 ** Growing our own isspace() routine this way is twice as fast as
199202 ** the library isspace() function.
199203 */
199204 static const char geopolyIsSpace[] = {
@@ -199015,11 +199217,11 @@
199217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
199221 };
199222 #define fast_isspace(x) (geopolyIsSpace[(unsigned char)x])
199223 #endif /* JSON NULL - back to original code */
199224
199225 /* Compiler and version */
199226 #ifndef GCC_VERSION
199227 #if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
@@ -199104,11 +199306,11 @@
199306 a[2] = t;
199307 }
199308
199309 /* Skip whitespace. Return the next non-whitespace character. */
199310 static char geopolySkipSpace(GeoParse *p){
199311 while( fast_isspace(p->z[0]) ) p->z++;
199312 return p->z[0];
199313 }
199314
199315 /* Parse out a number. Write the value into *pVal if pVal!=0.
199316 ** return non-zero on success and zero if the next token is not a number.
@@ -229084,11 +229286,11 @@
229286 assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
229287
229288 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
229289 int iIdx = 0; /* Index to search */
229290 int iPrefixIdx = 0; /* +1 prefix index */
229291 if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken);
229292
229293 /* Figure out which index to search and set iIdx accordingly. If this
229294 ** is a prefix query for which there is no prefix index, set iIdx to
229295 ** greater than pConfig->nPrefix to indicate that the query will be
229296 ** satisfied by scanning multiple terms in the main index.
@@ -233132,11 +233334,11 @@
233334 int nArg, /* Number of args */
233335 sqlite3_value **apUnused /* Function arguments */
233336 ){
233337 assert( nArg==0 );
233338 UNUSED_PARAM2(nArg, apUnused);
233339 sqlite3_result_text(pCtx, "fts5: 2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec", -1, SQLITE_TRANSIENT);
233340 }
233341
233342 /*
233343 ** Return true if zName is the extension on one of the shadow tables used
233344 ** by this module.
233345
+37 -9
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.38.0"
150150
#define SQLITE_VERSION_NUMBER 3038000
151
-#define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
151
+#define SQLITE_SOURCE_ID "2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -3822,17 +3822,18 @@
38223822
**
38233823
** The values returned by sqlite3_errcode() and/or
38243824
** sqlite3_extended_errcode() might change with each API call.
38253825
** Except, there are some interfaces that are guaranteed to never
38263826
** change the value of the error code. The error-code preserving
3827
-** interfaces are:
3827
+** interfaces include the following:
38283828
**
38293829
** <ul>
38303830
** <li> sqlite3_errcode()
38313831
** <li> sqlite3_extended_errcode()
38323832
** <li> sqlite3_errmsg()
38333833
** <li> sqlite3_errmsg16()
3834
+** <li> sqlite3_error_offset()
38343835
** </ul>
38353836
**
38363837
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
38373838
** text that describes the error, as either UTF-8 or UTF-16 respectively.
38383839
** ^(Memory to hold the error message string is managed internally.
@@ -3842,10 +3843,17 @@
38423843
**
38433844
** ^The sqlite3_errstr() interface returns the English-language text
38443845
** that describes the [result code], as UTF-8.
38453846
** ^(Memory to hold the error message string is managed internally
38463847
** and must not be freed by the application)^.
3848
+**
3849
+** ^If the most recent error references a specific token in the input
3850
+** SQL, the sqlite3_error_offset() interface returns the byte offset
3851
+** of the start of that token. ^The byte offset returned by
3852
+** sqlite3_error_offset() assumes that the input SQL is UTF8.
3853
+** ^If the most error does not reference a specific token in the input
3854
+** SQL, then the sqlite3_error_offset() function returns -1.
38473855
**
38483856
** When the serialized [threading mode] is in use, it might be the
38493857
** case that a second error occurs on a separate thread in between
38503858
** the time of the first error and the call to these interfaces.
38513859
** When that happens, the second error will be reported since these
@@ -3862,10 +3870,11 @@
38623870
SQLITE_API int sqlite3_errcode(sqlite3 *db);
38633871
SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
38643872
SQLITE_API const char *sqlite3_errmsg(sqlite3*);
38653873
SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
38663874
SQLITE_API const char *sqlite3_errstr(int);
3875
+SQLITE_API int sqlite3_error_offset(sqlite3 *db);
38673876
38683877
/*
38693878
** CAPI3REF: Prepared Statement Object
38703879
** KEYWORDS: {prepared statement} {prepared statements}
38713880
**
@@ -9462,18 +9471,37 @@
94629471
94639472
/*
94649473
** CAPI3REF: Determine The Collation For a Virtual Table Constraint
94659474
**
94669475
** This function may only be called from within a call to the [xBestIndex]
9467
-** method of a [virtual table].
9476
+** method of a [virtual table]. This function returns a pointer to a string
9477
+** that is the name of the appropriate collation sequence to use for text
9478
+** comparisons on the constraint identified by its arguments.
94689479
**
9469
-** The first argument must be the sqlite3_index_info object that is the
9470
-** first parameter to the xBestIndex() method. The second argument must be
9471
-** an index into the aConstraint[] array belonging to the sqlite3_index_info
9472
-** structure passed to xBestIndex. This function returns a pointer to a buffer
9473
-** containing the name of the collation sequence for the corresponding
9474
-** constraint.
9480
+** The first argument must be the pointer to the sqlite3_index_info object
9481
+** that is the first parameter to the xBestIndex() method. The second argument
9482
+** must be an index into the aConstraint[] array belonging to the
9483
+** sqlite3_index_info structure passed to xBestIndex.
9484
+**
9485
+** Important:
9486
+** The first parameter must be the same pointer that is passed into the
9487
+** xBestMethod() method. The first parameter may not be a pointer to a
9488
+** different sqlite3_index_info object, even an exact copy.
9489
+**
9490
+** The return value is computed as follows:
9491
+**
9492
+** <ol>
9493
+** <li><p> If the constraint comes from a WHERE clause expression that contains
9494
+** a [COLLATE operator], then the name of the collation specified by
9495
+** that COLLATE operator is returned.
9496
+** <li><p> If there is no COLLATE operator, but the column that is the subject
9497
+** of the constraint specifies an alternative collating sequence via
9498
+** a [COLLATE clause] on the column definition within the CREATE TABLE
9499
+** statement that was passed into [sqlite3_declare_vtab()], then the
9500
+** name of that alternative collating sequence is returned.
9501
+** <li><p> Otherwise, "BINARY" is returned.
9502
+** </ol>
94759503
*/
94769504
SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
94779505
94789506
/*
94799507
** CAPI3REF: Conflict resolution modes
94809508
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.38.0"
150 #define SQLITE_VERSION_NUMBER 3038000
151 #define SQLITE_SOURCE_ID "2021-12-09 20:06:18 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -3822,17 +3822,18 @@
3822 **
3823 ** The values returned by sqlite3_errcode() and/or
3824 ** sqlite3_extended_errcode() might change with each API call.
3825 ** Except, there are some interfaces that are guaranteed to never
3826 ** change the value of the error code. The error-code preserving
3827 ** interfaces are:
3828 **
3829 ** <ul>
3830 ** <li> sqlite3_errcode()
3831 ** <li> sqlite3_extended_errcode()
3832 ** <li> sqlite3_errmsg()
3833 ** <li> sqlite3_errmsg16()
 
3834 ** </ul>
3835 **
3836 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3837 ** text that describes the error, as either UTF-8 or UTF-16 respectively.
3838 ** ^(Memory to hold the error message string is managed internally.
@@ -3842,10 +3843,17 @@
3842 **
3843 ** ^The sqlite3_errstr() interface returns the English-language text
3844 ** that describes the [result code], as UTF-8.
3845 ** ^(Memory to hold the error message string is managed internally
3846 ** and must not be freed by the application)^.
 
 
 
 
 
 
 
3847 **
3848 ** When the serialized [threading mode] is in use, it might be the
3849 ** case that a second error occurs on a separate thread in between
3850 ** the time of the first error and the call to these interfaces.
3851 ** When that happens, the second error will be reported since these
@@ -3862,10 +3870,11 @@
3862 SQLITE_API int sqlite3_errcode(sqlite3 *db);
3863 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3864 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3865 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3866 SQLITE_API const char *sqlite3_errstr(int);
 
3867
3868 /*
3869 ** CAPI3REF: Prepared Statement Object
3870 ** KEYWORDS: {prepared statement} {prepared statements}
3871 **
@@ -9462,18 +9471,37 @@
9462
9463 /*
9464 ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9465 **
9466 ** This function may only be called from within a call to the [xBestIndex]
9467 ** method of a [virtual table].
 
 
9468 **
9469 ** The first argument must be the sqlite3_index_info object that is the
9470 ** first parameter to the xBestIndex() method. The second argument must be
9471 ** an index into the aConstraint[] array belonging to the sqlite3_index_info
9472 ** structure passed to xBestIndex. This function returns a pointer to a buffer
9473 ** containing the name of the collation sequence for the corresponding
9474 ** constraint.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9475 */
9476 SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9477
9478 /*
9479 ** CAPI3REF: Conflict resolution modes
9480
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.38.0"
150 #define SQLITE_VERSION_NUMBER 3038000
151 #define SQLITE_SOURCE_ID "2022-01-12 00:28:12 adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -3822,17 +3822,18 @@
3822 **
3823 ** The values returned by sqlite3_errcode() and/or
3824 ** sqlite3_extended_errcode() might change with each API call.
3825 ** Except, there are some interfaces that are guaranteed to never
3826 ** change the value of the error code. The error-code preserving
3827 ** interfaces include the following:
3828 **
3829 ** <ul>
3830 ** <li> sqlite3_errcode()
3831 ** <li> sqlite3_extended_errcode()
3832 ** <li> sqlite3_errmsg()
3833 ** <li> sqlite3_errmsg16()
3834 ** <li> sqlite3_error_offset()
3835 ** </ul>
3836 **
3837 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3838 ** text that describes the error, as either UTF-8 or UTF-16 respectively.
3839 ** ^(Memory to hold the error message string is managed internally.
@@ -3842,10 +3843,17 @@
3843 **
3844 ** ^The sqlite3_errstr() interface returns the English-language text
3845 ** that describes the [result code], as UTF-8.
3846 ** ^(Memory to hold the error message string is managed internally
3847 ** and must not be freed by the application)^.
3848 **
3849 ** ^If the most recent error references a specific token in the input
3850 ** SQL, the sqlite3_error_offset() interface returns the byte offset
3851 ** of the start of that token. ^The byte offset returned by
3852 ** sqlite3_error_offset() assumes that the input SQL is UTF8.
3853 ** ^If the most error does not reference a specific token in the input
3854 ** SQL, then the sqlite3_error_offset() function returns -1.
3855 **
3856 ** When the serialized [threading mode] is in use, it might be the
3857 ** case that a second error occurs on a separate thread in between
3858 ** the time of the first error and the call to these interfaces.
3859 ** When that happens, the second error will be reported since these
@@ -3862,10 +3870,11 @@
3870 SQLITE_API int sqlite3_errcode(sqlite3 *db);
3871 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3872 SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3873 SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3874 SQLITE_API const char *sqlite3_errstr(int);
3875 SQLITE_API int sqlite3_error_offset(sqlite3 *db);
3876
3877 /*
3878 ** CAPI3REF: Prepared Statement Object
3879 ** KEYWORDS: {prepared statement} {prepared statements}
3880 **
@@ -9462,18 +9471,37 @@
9471
9472 /*
9473 ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9474 **
9475 ** This function may only be called from within a call to the [xBestIndex]
9476 ** method of a [virtual table]. This function returns a pointer to a string
9477 ** that is the name of the appropriate collation sequence to use for text
9478 ** comparisons on the constraint identified by its arguments.
9479 **
9480 ** The first argument must be the pointer to the sqlite3_index_info object
9481 ** that is the first parameter to the xBestIndex() method. The second argument
9482 ** must be an index into the aConstraint[] array belonging to the
9483 ** sqlite3_index_info structure passed to xBestIndex.
9484 **
9485 ** Important:
9486 ** The first parameter must be the same pointer that is passed into the
9487 ** xBestMethod() method. The first parameter may not be a pointer to a
9488 ** different sqlite3_index_info object, even an exact copy.
9489 **
9490 ** The return value is computed as follows:
9491 **
9492 ** <ol>
9493 ** <li><p> If the constraint comes from a WHERE clause expression that contains
9494 ** a [COLLATE operator], then the name of the collation specified by
9495 ** that COLLATE operator is returned.
9496 ** <li><p> If there is no COLLATE operator, but the column that is the subject
9497 ** of the constraint specifies an alternative collating sequence via
9498 ** a [COLLATE clause] on the column definition within the CREATE TABLE
9499 ** statement that was passed into [sqlite3_declare_vtab()], then the
9500 ** name of that alternative collating sequence is returned.
9501 ** <li><p> Otherwise, "BINARY" is returned.
9502 ** </ol>
9503 */
9504 SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9505
9506 /*
9507 ** CAPI3REF: Conflict resolution modes
9508
+28 -13
--- src/cgi.c
+++ src/cgi.c
@@ -1185,10 +1185,37 @@
11851185
fputs(z, pLog);
11861186
}
11871187
11881188
/* Forward declaration */
11891189
static NORETURN void malformed_request(const char *zMsg);
1190
+
1191
+/*
1192
+** Checks the QUERY_STRING environment variable, sets it up
1193
+** via add_param_list() and, if found, applies its "skin"
1194
+** setting. Returns 0 if no QUERY_STRING is set, 1 if it is,
1195
+** and 2 if it sets the skin (in which case the cookie may
1196
+** still need flushing by the page, via cookie_render()).
1197
+*/
1198
+int cgi_setup_query_string(void){
1199
+ int rc = 0;
1200
+ char * z = (char*)P("QUERY_STRING");
1201
+ if( z ){
1202
+ ++rc;
1203
+ z = fossil_strdup(z);
1204
+ add_param_list(z, '&');
1205
+ z = (char*)P("skin");
1206
+ if(z){
1207
+ char *zErr = skin_use_alternative(z, 2);
1208
+ ++rc;
1209
+ if(!zErr && !P("once")){
1210
+ cookie_write_parameter("skin","skin",z);
1211
+ }
1212
+ fossil_free(zErr);
1213
+ }
1214
+ }
1215
+ return rc;
1216
+}
11901217
11911218
/*
11921219
** Initialize the query parameter database. Information is pulled from
11931220
** the QUERY_STRING environment variable (if it exists), from standard
11941221
** input if there is POST data, and from HTTP_COOKIE.
@@ -1317,23 +1344,11 @@
13171344
if(z){
13181345
skin_use_alternative(z, 2);
13191346
}
13201347
}
13211348
1322
- z = (char*)P("QUERY_STRING");
1323
- if( z ){
1324
- z = fossil_strdup(z);
1325
- add_param_list(z, '&');
1326
- z = (char*)P("skin");
1327
- if(z){
1328
- char *zErr = skin_use_alternative(z, 2);
1329
- if(!zErr && !P("once")){
1330
- cookie_write_parameter("skin","skin",z);
1331
- }
1332
- fossil_free(zErr);
1333
- }
1334
- }
1349
+ cgi_setup_query_string();
13351350
13361351
z = (char*)P("REMOTE_ADDR");
13371352
if( z ){
13381353
g.zIpAddr = fossil_strdup(z);
13391354
}
13401355
--- src/cgi.c
+++ src/cgi.c
@@ -1185,10 +1185,37 @@
1185 fputs(z, pLog);
1186 }
1187
1188 /* Forward declaration */
1189 static NORETURN void malformed_request(const char *zMsg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1190
1191 /*
1192 ** Initialize the query parameter database. Information is pulled from
1193 ** the QUERY_STRING environment variable (if it exists), from standard
1194 ** input if there is POST data, and from HTTP_COOKIE.
@@ -1317,23 +1344,11 @@
1317 if(z){
1318 skin_use_alternative(z, 2);
1319 }
1320 }
1321
1322 z = (char*)P("QUERY_STRING");
1323 if( z ){
1324 z = fossil_strdup(z);
1325 add_param_list(z, '&');
1326 z = (char*)P("skin");
1327 if(z){
1328 char *zErr = skin_use_alternative(z, 2);
1329 if(!zErr && !P("once")){
1330 cookie_write_parameter("skin","skin",z);
1331 }
1332 fossil_free(zErr);
1333 }
1334 }
1335
1336 z = (char*)P("REMOTE_ADDR");
1337 if( z ){
1338 g.zIpAddr = fossil_strdup(z);
1339 }
1340
--- src/cgi.c
+++ src/cgi.c
@@ -1185,10 +1185,37 @@
1185 fputs(z, pLog);
1186 }
1187
1188 /* Forward declaration */
1189 static NORETURN void malformed_request(const char *zMsg);
1190
1191 /*
1192 ** Checks the QUERY_STRING environment variable, sets it up
1193 ** via add_param_list() and, if found, applies its "skin"
1194 ** setting. Returns 0 if no QUERY_STRING is set, 1 if it is,
1195 ** and 2 if it sets the skin (in which case the cookie may
1196 ** still need flushing by the page, via cookie_render()).
1197 */
1198 int cgi_setup_query_string(void){
1199 int rc = 0;
1200 char * z = (char*)P("QUERY_STRING");
1201 if( z ){
1202 ++rc;
1203 z = fossil_strdup(z);
1204 add_param_list(z, '&');
1205 z = (char*)P("skin");
1206 if(z){
1207 char *zErr = skin_use_alternative(z, 2);
1208 ++rc;
1209 if(!zErr && !P("once")){
1210 cookie_write_parameter("skin","skin",z);
1211 }
1212 fossil_free(zErr);
1213 }
1214 }
1215 return rc;
1216 }
1217
1218 /*
1219 ** Initialize the query parameter database. Information is pulled from
1220 ** the QUERY_STRING environment variable (if it exists), from standard
1221 ** input if there is POST data, and from HTTP_COOKIE.
@@ -1317,23 +1344,11 @@
1344 if(z){
1345 skin_use_alternative(z, 2);
1346 }
1347 }
1348
1349 cgi_setup_query_string();
 
 
 
 
 
 
 
 
 
 
 
 
1350
1351 z = (char*)P("REMOTE_ADDR");
1352 if( z ){
1353 g.zIpAddr = fossil_strdup(z);
1354 }
1355
+5 -2
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835835
**
836836
** This command sends a new message to the chatroom. The message
837837
** to be sent is determined by arguments as follows:
838838
**
839839
** -f|--file FILENAME File to attach to the message
840
+** --as FILENAME2 Causes --file FILENAME to be sent with
841
+** the attachment name FILENAME2
840842
** -m|--message TEXT Text of the chat message
841843
** --remote URL Send to this remote URL
842844
** --unsafe Allow the use of unencrypted http://
843845
**
844846
** > fossil chat url
@@ -892,10 +894,11 @@
892894
zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
893895
#endif
894896
fossil_system(zCmd);
895897
}else if( strcmp(g.argv[2],"send")==0 ){
896898
const char *zFilename = find_option("file","r",1);
899
+ const char *zAs = find_option("as",0,1);
897900
const char *zMsg = find_option("message","m",1);
898901
int allowUnsafe = find_option("unsafe",0,0)!=0;
899902
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
900903
int i;
901904
const char *zPw;
@@ -941,13 +944,13 @@
941944
if( zMsg && zMsg[0] ){
942945
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
943946
"\r\n%s\r\n%s", zMsg, zBoundary);
944947
}
945948
if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
946
- char *zFN = mprintf("%s", file_tail(zFilename));
949
+ char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
947950
int i;
948
- const char *zMime = mimetype_from_name(zFilename);
951
+ const char *zMime = mimetype_from_name(zFN);
949952
for(i=0; zFN[i]; i++){
950953
char c = zFN[i];
951954
if( fossil_isalnum(c) ) continue;
952955
if( c=='.' ) continue;
953956
if( c=='-' ) continue;
954957
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835 **
836 ** This command sends a new message to the chatroom. The message
837 ** to be sent is determined by arguments as follows:
838 **
839 ** -f|--file FILENAME File to attach to the message
 
 
840 ** -m|--message TEXT Text of the chat message
841 ** --remote URL Send to this remote URL
842 ** --unsafe Allow the use of unencrypted http://
843 **
844 ** > fossil chat url
@@ -892,10 +894,11 @@
892 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
893 #endif
894 fossil_system(zCmd);
895 }else if( strcmp(g.argv[2],"send")==0 ){
896 const char *zFilename = find_option("file","r",1);
 
897 const char *zMsg = find_option("message","m",1);
898 int allowUnsafe = find_option("unsafe",0,0)!=0;
899 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
900 int i;
901 const char *zPw;
@@ -941,13 +944,13 @@
941 if( zMsg && zMsg[0] ){
942 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
943 "\r\n%s\r\n%s", zMsg, zBoundary);
944 }
945 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
946 char *zFN = mprintf("%s", file_tail(zFilename));
947 int i;
948 const char *zMime = mimetype_from_name(zFilename);
949 for(i=0; zFN[i]; i++){
950 char c = zFN[i];
951 if( fossil_isalnum(c) ) continue;
952 if( c=='.' ) continue;
953 if( c=='-' ) continue;
954
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835 **
836 ** This command sends a new message to the chatroom. The message
837 ** to be sent is determined by arguments as follows:
838 **
839 ** -f|--file FILENAME File to attach to the message
840 ** --as FILENAME2 Causes --file FILENAME to be sent with
841 ** the attachment name FILENAME2
842 ** -m|--message TEXT Text of the chat message
843 ** --remote URL Send to this remote URL
844 ** --unsafe Allow the use of unencrypted http://
845 **
846 ** > fossil chat url
@@ -892,10 +894,11 @@
894 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
895 #endif
896 fossil_system(zCmd);
897 }else if( strcmp(g.argv[2],"send")==0 ){
898 const char *zFilename = find_option("file","r",1);
899 const char *zAs = find_option("as",0,1);
900 const char *zMsg = find_option("message","m",1);
901 int allowUnsafe = find_option("unsafe",0,0)!=0;
902 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
903 int i;
904 const char *zPw;
@@ -941,13 +944,13 @@
944 if( zMsg && zMsg[0] ){
945 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
946 "\r\n%s\r\n%s", zMsg, zBoundary);
947 }
948 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
949 char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
950 int i;
951 const char *zMime = mimetype_from_name(zFN);
952 for(i=0; zFN[i]; i++){
953 char c = zFN[i];
954 if( fossil_isalnum(c) ) continue;
955 if( c=='.' ) continue;
956 if( c=='-' ) continue;
957
+5 -2
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835835
**
836836
** This command sends a new message to the chatroom. The message
837837
** to be sent is determined by arguments as follows:
838838
**
839839
** -f|--file FILENAME File to attach to the message
840
+** --as FILENAME2 Causes --file FILENAME to be sent with
841
+** the attachment name FILENAME2
840842
** -m|--message TEXT Text of the chat message
841843
** --remote URL Send to this remote URL
842844
** --unsafe Allow the use of unencrypted http://
843845
**
844846
** > fossil chat url
@@ -892,10 +894,11 @@
892894
zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
893895
#endif
894896
fossil_system(zCmd);
895897
}else if( strcmp(g.argv[2],"send")==0 ){
896898
const char *zFilename = find_option("file","r",1);
899
+ const char *zAs = find_option("as",0,1);
897900
const char *zMsg = find_option("message","m",1);
898901
int allowUnsafe = find_option("unsafe",0,0)!=0;
899902
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
900903
int i;
901904
const char *zPw;
@@ -941,13 +944,13 @@
941944
if( zMsg && zMsg[0] ){
942945
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
943946
"\r\n%s\r\n%s", zMsg, zBoundary);
944947
}
945948
if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
946
- char *zFN = mprintf("%s", file_tail(zFilename));
949
+ char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
947950
int i;
948
- const char *zMime = mimetype_from_name(zFilename);
951
+ const char *zMime = mimetype_from_name(zFN);
949952
for(i=0; zFN[i]; i++){
950953
char c = zFN[i];
951954
if( fossil_isalnum(c) ) continue;
952955
if( c=='.' ) continue;
953956
if( c=='-' ) continue;
954957
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835 **
836 ** This command sends a new message to the chatroom. The message
837 ** to be sent is determined by arguments as follows:
838 **
839 ** -f|--file FILENAME File to attach to the message
 
 
840 ** -m|--message TEXT Text of the chat message
841 ** --remote URL Send to this remote URL
842 ** --unsafe Allow the use of unencrypted http://
843 **
844 ** > fossil chat url
@@ -892,10 +894,11 @@
892 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
893 #endif
894 fossil_system(zCmd);
895 }else if( strcmp(g.argv[2],"send")==0 ){
896 const char *zFilename = find_option("file","r",1);
 
897 const char *zMsg = find_option("message","m",1);
898 int allowUnsafe = find_option("unsafe",0,0)!=0;
899 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
900 int i;
901 const char *zPw;
@@ -941,13 +944,13 @@
941 if( zMsg && zMsg[0] ){
942 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
943 "\r\n%s\r\n%s", zMsg, zBoundary);
944 }
945 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
946 char *zFN = mprintf("%s", file_tail(zFilename));
947 int i;
948 const char *zMime = mimetype_from_name(zFilename);
949 for(i=0; zFN[i]; i++){
950 char c = zFN[i];
951 if( fossil_isalnum(c) ) continue;
952 if( c=='.' ) continue;
953 if( c=='-' ) continue;
954
--- src/chat.c
+++ src/chat.c
@@ -835,10 +835,12 @@
835 **
836 ** This command sends a new message to the chatroom. The message
837 ** to be sent is determined by arguments as follows:
838 **
839 ** -f|--file FILENAME File to attach to the message
840 ** --as FILENAME2 Causes --file FILENAME to be sent with
841 ** the attachment name FILENAME2
842 ** -m|--message TEXT Text of the chat message
843 ** --remote URL Send to this remote URL
844 ** --unsafe Allow the use of unencrypted http://
845 **
846 ** > fossil chat url
@@ -892,10 +894,11 @@
894 zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
895 #endif
896 fossil_system(zCmd);
897 }else if( strcmp(g.argv[2],"send")==0 ){
898 const char *zFilename = find_option("file","r",1);
899 const char *zAs = find_option("as",0,1);
900 const char *zMsg = find_option("message","m",1);
901 int allowUnsafe = find_option("unsafe",0,0)!=0;
902 const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
903 int i;
904 const char *zPw;
@@ -941,13 +944,13 @@
944 if( zMsg && zMsg[0] ){
945 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
946 "\r\n%s\r\n%s", zMsg, zBoundary);
947 }
948 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
949 char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
950 int i;
951 const char *zMime = mimetype_from_name(zFN);
952 for(i=0; zFN[i]; i++){
953 char c = zFN[i];
954 if( fossil_isalnum(c) ) continue;
955 if( c=='.' ) continue;
956 if( c=='-' ) continue;
957
+51 -26
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
18471847
static int commit_warning(
18481848
Blob *pContent, /* The content of the file being committed. */
18491849
int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
18501850
int binOk, /* Non-zero if binary warnings should be disabled. */
18511851
int encodingOk, /* Non-zero if encoding warnings should be disabled. */
1852
+ int sizeOk, /* Non-zero if oversize warnings are disabled */
18521853
int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
18531854
const char *zFilename, /* The full name of the file being committed. */
18541855
Blob *pReason /* Reason for warning, if any (non-fatal only). */
18551856
){
18561857
int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,33 @@
18641865
char *zMsg; /* Warning message */
18651866
Blob fname; /* Relative pathname of the file */
18661867
static int allOk = 0; /* Set to true to disable this routine */
18671868
18681869
if( allOk ) return 0;
1869
- fUnicode = could_be_utf16(pContent, &bReverse);
1870
- if( fUnicode ){
1871
- lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1870
+ if( sizeOk ){
1871
+ fUnicode = could_be_utf16(pContent, &bReverse);
1872
+ if( fUnicode ){
1873
+ lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1874
+ }else{
1875
+ lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1876
+ if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1877
+ fHasInvalidUtf8 = 1;
1878
+ }
1879
+ }
1880
+ fHasAnyCr = (lookFlags & LOOK_CR);
1881
+ fBinary = (lookFlags & LOOK_BINARY);
1882
+ fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1883
+ fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
18721884
}else{
1873
- lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1874
- if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1875
- fHasInvalidUtf8 = 1;
1876
- }
1877
- }
1878
- fHasAnyCr = (lookFlags & LOOK_CR);
1879
- fBinary = (lookFlags & LOOK_BINARY);
1880
- fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1881
- fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1882
- if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1883
- const char *zWarning;
1884
- const char *zDisable;
1885
+ fUnicode = fHasAnyCr = fBinary = fHasInvalidUtf8 = 0;
1886
+ fHasLoneCrOnly = fHasCrLfOnly = 0;
1887
+ }
1888
+ if( !sizeOk || fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1889
+ const char *zWarning = 0;
1890
+ const char *zDisable = 0;
18851891
const char *zConvert = "c=convert/";
1892
+ const char *zIn = "in";
18861893
Blob ans;
18871894
char cReply;
18881895
18891896
if( fBinary ){
18901897
int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1935,33 @@
19281935
zWarning = "CR/LF line endings";
19291936
}else{
19301937
zWarning = "mixed line endings";
19311938
}
19321939
zDisable = "\"crlf-glob\" setting";
1940
+ }else if( !sizeOk ){
1941
+ zWarning = "oversize";
1942
+ zIn = "file";
19331943
}else{
19341944
if( encodingOk ){
19351945
return 0; /* We don't want encoding warnings for this file. */
19361946
}
19371947
zWarning = "Unicode";
19381948
zDisable = "\"encoding-glob\" setting";
19391949
}
19401950
file_relative_name(zFilename, &fname, 0);
1941
- zMsg = mprintf(
1942
- "%s contains %s. Use --no-warnings or the %s to"
1943
- " disable this warning.\n"
1944
- "Commit anyhow (a=all/%sy/N)? ",
1945
- blob_str(&fname), zWarning, zDisable, zConvert);
1951
+ if( !sizeOk ){
1952
+ zMsg = mprintf(
1953
+ "%s is more than %,lld bytes in size.\n"
1954
+ "Commit anyhow (a=all/y/N)? ",
1955
+ blob_str(&fname), db_large_file_size());
1956
+ }else{
1957
+ zMsg = mprintf(
1958
+ "%s contains %s. Use --no-warnings or the %s to"
1959
+ " disable this warning.\n"
1960
+ "Commit anyhow (a=all/%sy/N)? ",
1961
+ blob_str(&fname), zWarning, zDisable, zConvert);
1962
+ }
19461963
if( noPrompt==0 ){
19471964
prompt_user(zMsg, &ans);
19481965
cReply = blob_str(&ans)[0];
19491966
blob_reset(&ans);
19501967
}else if( noPrompt==2 ){
@@ -1978,12 +1995,12 @@
19781995
fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
19791996
fclose(f);
19801997
}
19811998
return 1;
19821999
}else if( cReply!='y' && cReply!='Y' ){
1983
- fossil_fatal("Abandoning commit due to %s in %s",
1984
- zWarning, blob_str(&fname));
2000
+ fossil_fatal("Abandoning commit due to %s %s %s",
2001
+ zWarning, zIn, blob_str(&fname));
19852002
}else if( noPrompt==2 ){
19862003
if( pReason ){
19872004
blob_append(pReason, zWarning, -1);
19882005
}
19892006
return 1;
@@ -2009,15 +2026,17 @@
20092026
*/
20102027
void test_commit_warning(void){
20112028
int rc = 0;
20122029
int noSettings;
20132030
int verboseFlag;
2031
+ i64 mxSize;
20142032
Stmt q;
20152033
noSettings = find_option("no-settings",0,0)!=0;
20162034
verboseFlag = find_option("verbose","v",0)!=0;
20172035
verify_all_options();
20182036
db_must_be_within_tree();
2037
+ mxSize = db_large_file_size();
20192038
db_prepare(&q,
20202039
"SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
20212040
" WHERE NOT deleted",
20222041
g.zLocalRoot,
20232042
glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2047,23 @@
20282047
while( db_step(&q)==SQLITE_ROW ){
20292048
const char *zFullname;
20302049
const char *zName;
20312050
Blob content;
20322051
Blob reason;
2033
- int crlfOk, binOk, encodingOk;
2052
+ int crlfOk, binOk, encodingOk, sizeOk;
20342053
int fileRc;
20352054
20362055
zFullname = db_column_text(&q, 0);
20372056
zName = db_column_text(&q, 1);
20382057
crlfOk = db_column_int(&q, 2);
20392058
binOk = db_column_int(&q, 3);
20402059
encodingOk = db_column_int(&q, 4);
2060
+ sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
20412061
blob_zero(&content);
20422062
blob_read_from_file(&content, zFullname, RepoFILE);
20432063
blob_zero(&reason);
2044
- fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, 2,
2064
+ fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, sizeOk, 2,
20452065
zFullname, &reason);
20462066
if( fileRc || verboseFlag ){
20472067
fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
20482068
}
20492069
blob_reset(&reason);
@@ -2138,10 +2158,11 @@
21382158
** than relying on file mtimes
21392159
** --ignore-clock-skew If a clock skew is detected, ignore it and
21402160
** behave as if the user had entered 'yes' to
21412161
** the question of whether to proceed despite
21422162
** the skew.
2163
+** --ignore-oversize Do not warning the user about oversized files
21432164
** --integrate close all merged-in branches
21442165
** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
21452166
** -M|--message-file FILE read the commit comment from given file
21462167
** --mimetype MIMETYPE mimetype of check-in comment
21472168
** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2233,11 @@
22122233
Blob ans; /* Answer to continuation prompts */
22132234
char cReply; /* First character of ans */
22142235
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
22152236
int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
22162237
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2238
+ int mxSize;
22172239
22182240
memset(&sCiInfo, 0, sizeof(sCiInfo));
22192241
url_proxy_options();
22202242
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
22212243
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2293,12 @@
22712293
noSign = db_get_boolean("omitsign", 0)|noSign;
22722294
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
22732295
useCksum = db_get_boolean("repo-cksum", 1);
22742296
bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
22752297
outputManifest = db_get_manifest_setting();
2298
+ mxSize = db_large_file_size();
2299
+ if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
22762300
verify_all_options();
22772301
22782302
/* Get the ID of the parent manifest artifact */
22792303
vid = db_lget_int("checkout", 0);
22802304
if( vid==0 ){
@@ -2592,25 +2616,26 @@
25922616
);
25932617
while( db_step(&q)==SQLITE_ROW ){
25942618
int id, rid;
25952619
const char *zFullname;
25962620
Blob content;
2597
- int crlfOk, binOk, encodingOk;
2621
+ int crlfOk, binOk, encodingOk, sizeOk;
25982622
25992623
id = db_column_int(&q, 0);
26002624
zFullname = db_column_text(&q, 1);
26012625
rid = db_column_int(&q, 2);
26022626
crlfOk = db_column_int(&q, 3);
26032627
binOk = db_column_int(&q, 4);
26042628
encodingOk = db_column_int(&q, 5);
2629
+ sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
26052630
26062631
blob_zero(&content);
26072632
blob_read_from_file(&content, zFullname, RepoFILE);
26082633
/* Do not emit any warnings when they are disabled. */
26092634
if( !noWarningFlag ){
26102635
abortCommit |= commit_warning(&content, crlfOk, binOk,
2611
- encodingOk, noPrompt,
2636
+ encodingOk, sizeOk, noPrompt,
26122637
zFullname, 0);
26132638
}
26142639
if( contains_merge_marker(&content) ){
26152640
Blob fname; /* Relative pathname of the file */
26162641
26172642
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
1847 static int commit_warning(
1848 Blob *pContent, /* The content of the file being committed. */
1849 int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
1850 int binOk, /* Non-zero if binary warnings should be disabled. */
1851 int encodingOk, /* Non-zero if encoding warnings should be disabled. */
 
1852 int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
1853 const char *zFilename, /* The full name of the file being committed. */
1854 Blob *pReason /* Reason for warning, if any (non-fatal only). */
1855 ){
1856 int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,33 @@
1864 char *zMsg; /* Warning message */
1865 Blob fname; /* Relative pathname of the file */
1866 static int allOk = 0; /* Set to true to disable this routine */
1867
1868 if( allOk ) return 0;
1869 fUnicode = could_be_utf16(pContent, &bReverse);
1870 if( fUnicode ){
1871 lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
 
 
 
 
 
 
 
 
 
 
 
1872 }else{
1873 lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1874 if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1875 fHasInvalidUtf8 = 1;
1876 }
1877 }
1878 fHasAnyCr = (lookFlags & LOOK_CR);
1879 fBinary = (lookFlags & LOOK_BINARY);
1880 fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1881 fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1882 if( fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1883 const char *zWarning;
1884 const char *zDisable;
1885 const char *zConvert = "c=convert/";
 
1886 Blob ans;
1887 char cReply;
1888
1889 if( fBinary ){
1890 int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1935,33 @@
1928 zWarning = "CR/LF line endings";
1929 }else{
1930 zWarning = "mixed line endings";
1931 }
1932 zDisable = "\"crlf-glob\" setting";
 
 
 
1933 }else{
1934 if( encodingOk ){
1935 return 0; /* We don't want encoding warnings for this file. */
1936 }
1937 zWarning = "Unicode";
1938 zDisable = "\"encoding-glob\" setting";
1939 }
1940 file_relative_name(zFilename, &fname, 0);
1941 zMsg = mprintf(
1942 "%s contains %s. Use --no-warnings or the %s to"
1943 " disable this warning.\n"
1944 "Commit anyhow (a=all/%sy/N)? ",
1945 blob_str(&fname), zWarning, zDisable, zConvert);
 
 
 
 
 
 
 
1946 if( noPrompt==0 ){
1947 prompt_user(zMsg, &ans);
1948 cReply = blob_str(&ans)[0];
1949 blob_reset(&ans);
1950 }else if( noPrompt==2 ){
@@ -1978,12 +1995,12 @@
1978 fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
1979 fclose(f);
1980 }
1981 return 1;
1982 }else if( cReply!='y' && cReply!='Y' ){
1983 fossil_fatal("Abandoning commit due to %s in %s",
1984 zWarning, blob_str(&fname));
1985 }else if( noPrompt==2 ){
1986 if( pReason ){
1987 blob_append(pReason, zWarning, -1);
1988 }
1989 return 1;
@@ -2009,15 +2026,17 @@
2009 */
2010 void test_commit_warning(void){
2011 int rc = 0;
2012 int noSettings;
2013 int verboseFlag;
 
2014 Stmt q;
2015 noSettings = find_option("no-settings",0,0)!=0;
2016 verboseFlag = find_option("verbose","v",0)!=0;
2017 verify_all_options();
2018 db_must_be_within_tree();
 
2019 db_prepare(&q,
2020 "SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
2021 " WHERE NOT deleted",
2022 g.zLocalRoot,
2023 glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2047,23 @@
2028 while( db_step(&q)==SQLITE_ROW ){
2029 const char *zFullname;
2030 const char *zName;
2031 Blob content;
2032 Blob reason;
2033 int crlfOk, binOk, encodingOk;
2034 int fileRc;
2035
2036 zFullname = db_column_text(&q, 0);
2037 zName = db_column_text(&q, 1);
2038 crlfOk = db_column_int(&q, 2);
2039 binOk = db_column_int(&q, 3);
2040 encodingOk = db_column_int(&q, 4);
 
2041 blob_zero(&content);
2042 blob_read_from_file(&content, zFullname, RepoFILE);
2043 blob_zero(&reason);
2044 fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, 2,
2045 zFullname, &reason);
2046 if( fileRc || verboseFlag ){
2047 fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
2048 }
2049 blob_reset(&reason);
@@ -2138,10 +2158,11 @@
2138 ** than relying on file mtimes
2139 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2140 ** behave as if the user had entered 'yes' to
2141 ** the question of whether to proceed despite
2142 ** the skew.
 
2143 ** --integrate close all merged-in branches
2144 ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
2145 ** -M|--message-file FILE read the commit comment from given file
2146 ** --mimetype MIMETYPE mimetype of check-in comment
2147 ** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2233,11 @@
2212 Blob ans; /* Answer to continuation prompts */
2213 char cReply; /* First character of ans */
2214 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2215 int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
2216 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
 
2217
2218 memset(&sCiInfo, 0, sizeof(sCiInfo));
2219 url_proxy_options();
2220 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2221 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2293,12 @@
2271 noSign = db_get_boolean("omitsign", 0)|noSign;
2272 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2273 useCksum = db_get_boolean("repo-cksum", 1);
2274 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2275 outputManifest = db_get_manifest_setting();
 
 
2276 verify_all_options();
2277
2278 /* Get the ID of the parent manifest artifact */
2279 vid = db_lget_int("checkout", 0);
2280 if( vid==0 ){
@@ -2592,25 +2616,26 @@
2592 );
2593 while( db_step(&q)==SQLITE_ROW ){
2594 int id, rid;
2595 const char *zFullname;
2596 Blob content;
2597 int crlfOk, binOk, encodingOk;
2598
2599 id = db_column_int(&q, 0);
2600 zFullname = db_column_text(&q, 1);
2601 rid = db_column_int(&q, 2);
2602 crlfOk = db_column_int(&q, 3);
2603 binOk = db_column_int(&q, 4);
2604 encodingOk = db_column_int(&q, 5);
 
2605
2606 blob_zero(&content);
2607 blob_read_from_file(&content, zFullname, RepoFILE);
2608 /* Do not emit any warnings when they are disabled. */
2609 if( !noWarningFlag ){
2610 abortCommit |= commit_warning(&content, crlfOk, binOk,
2611 encodingOk, noPrompt,
2612 zFullname, 0);
2613 }
2614 if( contains_merge_marker(&content) ){
2615 Blob fname; /* Relative pathname of the file */
2616
2617
--- src/checkin.c
+++ src/checkin.c
@@ -1847,10 +1847,11 @@
1847 static int commit_warning(
1848 Blob *pContent, /* The content of the file being committed. */
1849 int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
1850 int binOk, /* Non-zero if binary warnings should be disabled. */
1851 int encodingOk, /* Non-zero if encoding warnings should be disabled. */
1852 int sizeOk, /* Non-zero if oversize warnings are disabled */
1853 int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
1854 const char *zFilename, /* The full name of the file being committed. */
1855 Blob *pReason /* Reason for warning, if any (non-fatal only). */
1856 ){
1857 int bReverse; /* UTF-16 byte order is reversed? */
@@ -1864,27 +1865,33 @@
1865 char *zMsg; /* Warning message */
1866 Blob fname; /* Relative pathname of the file */
1867 static int allOk = 0; /* Set to true to disable this routine */
1868
1869 if( allOk ) return 0;
1870 if( sizeOk ){
1871 fUnicode = could_be_utf16(pContent, &bReverse);
1872 if( fUnicode ){
1873 lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
1874 }else{
1875 lookFlags = looks_like_utf8(pContent, LOOK_NUL);
1876 if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
1877 fHasInvalidUtf8 = 1;
1878 }
1879 }
1880 fHasAnyCr = (lookFlags & LOOK_CR);
1881 fBinary = (lookFlags & LOOK_BINARY);
1882 fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
1883 fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
1884 }else{
1885 fUnicode = fHasAnyCr = fBinary = fHasInvalidUtf8 = 0;
1886 fHasLoneCrOnly = fHasCrLfOnly = 0;
1887 }
1888 if( !sizeOk || fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
1889 const char *zWarning = 0;
1890 const char *zDisable = 0;
 
 
 
 
 
 
1891 const char *zConvert = "c=convert/";
1892 const char *zIn = "in";
1893 Blob ans;
1894 char cReply;
1895
1896 if( fBinary ){
1897 int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
@@ -1928,23 +1935,33 @@
1935 zWarning = "CR/LF line endings";
1936 }else{
1937 zWarning = "mixed line endings";
1938 }
1939 zDisable = "\"crlf-glob\" setting";
1940 }else if( !sizeOk ){
1941 zWarning = "oversize";
1942 zIn = "file";
1943 }else{
1944 if( encodingOk ){
1945 return 0; /* We don't want encoding warnings for this file. */
1946 }
1947 zWarning = "Unicode";
1948 zDisable = "\"encoding-glob\" setting";
1949 }
1950 file_relative_name(zFilename, &fname, 0);
1951 if( !sizeOk ){
1952 zMsg = mprintf(
1953 "%s is more than %,lld bytes in size.\n"
1954 "Commit anyhow (a=all/y/N)? ",
1955 blob_str(&fname), db_large_file_size());
1956 }else{
1957 zMsg = mprintf(
1958 "%s contains %s. Use --no-warnings or the %s to"
1959 " disable this warning.\n"
1960 "Commit anyhow (a=all/%sy/N)? ",
1961 blob_str(&fname), zWarning, zDisable, zConvert);
1962 }
1963 if( noPrompt==0 ){
1964 prompt_user(zMsg, &ans);
1965 cReply = blob_str(&ans)[0];
1966 blob_reset(&ans);
1967 }else if( noPrompt==2 ){
@@ -1978,12 +1995,12 @@
1995 fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
1996 fclose(f);
1997 }
1998 return 1;
1999 }else if( cReply!='y' && cReply!='Y' ){
2000 fossil_fatal("Abandoning commit due to %s %s %s",
2001 zWarning, zIn, blob_str(&fname));
2002 }else if( noPrompt==2 ){
2003 if( pReason ){
2004 blob_append(pReason, zWarning, -1);
2005 }
2006 return 1;
@@ -2009,15 +2026,17 @@
2026 */
2027 void test_commit_warning(void){
2028 int rc = 0;
2029 int noSettings;
2030 int verboseFlag;
2031 i64 mxSize;
2032 Stmt q;
2033 noSettings = find_option("no-settings",0,0)!=0;
2034 verboseFlag = find_option("verbose","v",0)!=0;
2035 verify_all_options();
2036 db_must_be_within_tree();
2037 mxSize = db_large_file_size();
2038 db_prepare(&q,
2039 "SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
2040 " WHERE NOT deleted",
2041 g.zLocalRoot,
2042 glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
@@ -2028,22 +2047,23 @@
2047 while( db_step(&q)==SQLITE_ROW ){
2048 const char *zFullname;
2049 const char *zName;
2050 Blob content;
2051 Blob reason;
2052 int crlfOk, binOk, encodingOk, sizeOk;
2053 int fileRc;
2054
2055 zFullname = db_column_text(&q, 0);
2056 zName = db_column_text(&q, 1);
2057 crlfOk = db_column_int(&q, 2);
2058 binOk = db_column_int(&q, 3);
2059 encodingOk = db_column_int(&q, 4);
2060 sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
2061 blob_zero(&content);
2062 blob_read_from_file(&content, zFullname, RepoFILE);
2063 blob_zero(&reason);
2064 fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, sizeOk, 2,
2065 zFullname, &reason);
2066 if( fileRc || verboseFlag ){
2067 fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
2068 }
2069 blob_reset(&reason);
@@ -2138,10 +2158,11 @@
2158 ** than relying on file mtimes
2159 ** --ignore-clock-skew If a clock skew is detected, ignore it and
2160 ** behave as if the user had entered 'yes' to
2161 ** the question of whether to proceed despite
2162 ** the skew.
2163 ** --ignore-oversize Do not warning the user about oversized files
2164 ** --integrate close all merged-in branches
2165 ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment
2166 ** -M|--message-file FILE read the commit comment from given file
2167 ** --mimetype MIMETYPE mimetype of check-in comment
2168 ** -n|--dry-run If given, display instead of run actions
@@ -2212,10 +2233,11 @@
2233 Blob ans; /* Answer to continuation prompts */
2234 char cReply; /* First character of ans */
2235 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2236 int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
2237 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2238 int mxSize;
2239
2240 memset(&sCiInfo, 0, sizeof(sCiInfo));
2241 url_proxy_options();
2242 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2243 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2271,10 +2293,12 @@
2293 noSign = db_get_boolean("omitsign", 0)|noSign;
2294 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2295 useCksum = db_get_boolean("repo-cksum", 1);
2296 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2297 outputManifest = db_get_manifest_setting();
2298 mxSize = db_large_file_size();
2299 if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
2300 verify_all_options();
2301
2302 /* Get the ID of the parent manifest artifact */
2303 vid = db_lget_int("checkout", 0);
2304 if( vid==0 ){
@@ -2592,25 +2616,26 @@
2616 );
2617 while( db_step(&q)==SQLITE_ROW ){
2618 int id, rid;
2619 const char *zFullname;
2620 Blob content;
2621 int crlfOk, binOk, encodingOk, sizeOk;
2622
2623 id = db_column_int(&q, 0);
2624 zFullname = db_column_text(&q, 1);
2625 rid = db_column_int(&q, 2);
2626 crlfOk = db_column_int(&q, 3);
2627 binOk = db_column_int(&q, 4);
2628 encodingOk = db_column_int(&q, 5);
2629 sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
2630
2631 blob_zero(&content);
2632 blob_read_from_file(&content, zFullname, RepoFILE);
2633 /* Do not emit any warnings when they are disabled. */
2634 if( !noWarningFlag ){
2635 abortCommit |= commit_warning(&content, crlfOk, binOk,
2636 encodingOk, sizeOk, noPrompt,
2637 zFullname, 0);
2638 }
2639 if( contains_merge_marker(&content) ){
2640 Blob fname; /* Relative pathname of the file */
2641
2642
+21
--- src/db.c
+++ src/db.c
@@ -2776,10 +2776,12 @@
27762776
** Options:
27772777
** --template FILE Copy settings from repository file
27782778
** -A|--admin-user USERNAME Select given USERNAME as admin user
27792779
** --date-override DATETIME Use DATETIME as time of the initial check-in
27802780
** --sha1 Use an initial hash policy of "sha1"
2781
+** --project-name STRING The name of the project "project name in quotes"
2782
+** --project-desc STRING The descritption of the project "project description in quotes"
27812783
**
27822784
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
27832785
** year-month-day form, it may be truncated, the "T" may be replaced by
27842786
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
27852787
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2790,17 +2792,21 @@
27902792
void create_repository_cmd(void){
27912793
char *zPassword;
27922794
const char *zTemplate; /* Repository from which to copy settings */
27932795
const char *zDate; /* Date of the initial check-in */
27942796
const char *zDefaultUser; /* Optional name of the default user */
2797
+ const char *zProjectName; /* Optional project name of the repo */
2798
+ const char *zProjectDesc; /* Optional project description "description of project in quotes" */
27952799
int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
27962800
27972801
27982802
zTemplate = find_option("template",0,1);
27992803
zDate = find_option("date-override",0,1);
28002804
zDefaultUser = find_option("admin-user","A",1);
28012805
bUseSha1 = find_option("sha1",0,0)!=0;
2806
+ zProjectName = find_option("project-name", 0, 1);
2807
+ zProjectDesc = find_option("project-desc", 0, 1);
28022808
/* We should be done with options.. */
28032809
verify_all_options();
28042810
28052811
if( g.argc!=3 ){
28062812
usage("REPOSITORY-NAME");
@@ -2817,14 +2823,18 @@
28172823
db_begin_transaction();
28182824
if( bUseSha1 ){
28192825
g.eHashPolicy = HPOLICY_SHA1;
28202826
db_set_int("hash-policy", HPOLICY_SHA1, 0);
28212827
}
2828
+ if( zProjectName ) db_set("project-name", zProjectName, 0);
2829
+ if( zProjectDesc ) db_set("project-description", zProjectDesc, 0);
28222830
if( zDate==0 ) zDate = "now";
28232831
db_initial_setup(zTemplate, zDate, zDefaultUser);
28242832
db_end_transaction(0);
28252833
if( zTemplate ) db_detach("settingSrc");
2834
+ if( zProjectName ) fossil_print("project-name: %s\n", zProjectName);
2835
+ if( zProjectDesc ) fossil_print("project-description: %s\n", zProjectDesc);
28262836
fossil_print("project-id: %s\n", db_get("project-code", 0));
28272837
fossil_print("server-id: %s\n", db_get("server-code", 0));
28282838
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
28292839
fossil_print("admin-user: %s (initial password is \"%s\")\n",
28302840
g.zLogin, zPassword);
@@ -3324,10 +3334,14 @@
33243334
}
33253335
db_reset(&q2);
33263336
}
33273337
return v;
33283338
}
3339
+i64 db_large_file_size(void){
3340
+ /* Return size of the largest file that is not considered oversized */
3341
+ return strtoll(db_get("large-file-size","20000000"),0,0);
3342
+}
33293343
void db_set_int(const char *zName, int value, int globalFlag){
33303344
db_assert_protection_off_or_not_sensitive(zName);
33313345
db_unprotect(PROTECT_CONFIG);
33323346
if( globalFlag ){
33333347
db_swap_connections();
@@ -4395,10 +4409,17 @@
43954409
** A shell command used to launch your preferred
43964410
** web browser when given a URL as an argument.
43974411
** Defaults to "start" on windows, "open" on Mac,
43984412
** and "firefox" on Unix.
43994413
*/
4414
+/*
4415
+** SETTING: large-file-size width=10 default=200000000
4416
+** Fossil considers any file whose size is greater than this value
4417
+** to be a "large file". Fossil might issue warnings if you try to
4418
+** "add" or "commit" a "large file". Set this value to 0 or less
4419
+** to disable all such warnings.
4420
+*/
44004421
44014422
/*
44024423
** Look up a control setting by its name. Return a pointer to the Setting
44034424
** object, or NULL if there is no such setting.
44044425
**
44054426
--- src/db.c
+++ src/db.c
@@ -2776,10 +2776,12 @@
2776 ** Options:
2777 ** --template FILE Copy settings from repository file
2778 ** -A|--admin-user USERNAME Select given USERNAME as admin user
2779 ** --date-override DATETIME Use DATETIME as time of the initial check-in
2780 ** --sha1 Use an initial hash policy of "sha1"
 
 
2781 **
2782 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2783 ** year-month-day form, it may be truncated, the "T" may be replaced by
2784 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2785 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2790,17 +2792,21 @@
2790 void create_repository_cmd(void){
2791 char *zPassword;
2792 const char *zTemplate; /* Repository from which to copy settings */
2793 const char *zDate; /* Date of the initial check-in */
2794 const char *zDefaultUser; /* Optional name of the default user */
 
 
2795 int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
2796
2797
2798 zTemplate = find_option("template",0,1);
2799 zDate = find_option("date-override",0,1);
2800 zDefaultUser = find_option("admin-user","A",1);
2801 bUseSha1 = find_option("sha1",0,0)!=0;
 
 
2802 /* We should be done with options.. */
2803 verify_all_options();
2804
2805 if( g.argc!=3 ){
2806 usage("REPOSITORY-NAME");
@@ -2817,14 +2823,18 @@
2817 db_begin_transaction();
2818 if( bUseSha1 ){
2819 g.eHashPolicy = HPOLICY_SHA1;
2820 db_set_int("hash-policy", HPOLICY_SHA1, 0);
2821 }
 
 
2822 if( zDate==0 ) zDate = "now";
2823 db_initial_setup(zTemplate, zDate, zDefaultUser);
2824 db_end_transaction(0);
2825 if( zTemplate ) db_detach("settingSrc");
 
 
2826 fossil_print("project-id: %s\n", db_get("project-code", 0));
2827 fossil_print("server-id: %s\n", db_get("server-code", 0));
2828 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
2829 fossil_print("admin-user: %s (initial password is \"%s\")\n",
2830 g.zLogin, zPassword);
@@ -3324,10 +3334,14 @@
3324 }
3325 db_reset(&q2);
3326 }
3327 return v;
3328 }
 
 
 
 
3329 void db_set_int(const char *zName, int value, int globalFlag){
3330 db_assert_protection_off_or_not_sensitive(zName);
3331 db_unprotect(PROTECT_CONFIG);
3332 if( globalFlag ){
3333 db_swap_connections();
@@ -4395,10 +4409,17 @@
4395 ** A shell command used to launch your preferred
4396 ** web browser when given a URL as an argument.
4397 ** Defaults to "start" on windows, "open" on Mac,
4398 ** and "firefox" on Unix.
4399 */
 
 
 
 
 
 
 
4400
4401 /*
4402 ** Look up a control setting by its name. Return a pointer to the Setting
4403 ** object, or NULL if there is no such setting.
4404 **
4405
--- src/db.c
+++ src/db.c
@@ -2776,10 +2776,12 @@
2776 ** Options:
2777 ** --template FILE Copy settings from repository file
2778 ** -A|--admin-user USERNAME Select given USERNAME as admin user
2779 ** --date-override DATETIME Use DATETIME as time of the initial check-in
2780 ** --sha1 Use an initial hash policy of "sha1"
2781 ** --project-name STRING The name of the project "project name in quotes"
2782 ** --project-desc STRING The descritption of the project "project description in quotes"
2783 **
2784 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2785 ** year-month-day form, it may be truncated, the "T" may be replaced by
2786 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2787 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2790,17 +2792,21 @@
2792 void create_repository_cmd(void){
2793 char *zPassword;
2794 const char *zTemplate; /* Repository from which to copy settings */
2795 const char *zDate; /* Date of the initial check-in */
2796 const char *zDefaultUser; /* Optional name of the default user */
2797 const char *zProjectName; /* Optional project name of the repo */
2798 const char *zProjectDesc; /* Optional project description "description of project in quotes" */
2799 int bUseSha1 = 0; /* True to set the hash-policy to sha1 */
2800
2801
2802 zTemplate = find_option("template",0,1);
2803 zDate = find_option("date-override",0,1);
2804 zDefaultUser = find_option("admin-user","A",1);
2805 bUseSha1 = find_option("sha1",0,0)!=0;
2806 zProjectName = find_option("project-name", 0, 1);
2807 zProjectDesc = find_option("project-desc", 0, 1);
2808 /* We should be done with options.. */
2809 verify_all_options();
2810
2811 if( g.argc!=3 ){
2812 usage("REPOSITORY-NAME");
@@ -2817,14 +2823,18 @@
2823 db_begin_transaction();
2824 if( bUseSha1 ){
2825 g.eHashPolicy = HPOLICY_SHA1;
2826 db_set_int("hash-policy", HPOLICY_SHA1, 0);
2827 }
2828 if( zProjectName ) db_set("project-name", zProjectName, 0);
2829 if( zProjectDesc ) db_set("project-description", zProjectDesc, 0);
2830 if( zDate==0 ) zDate = "now";
2831 db_initial_setup(zTemplate, zDate, zDefaultUser);
2832 db_end_transaction(0);
2833 if( zTemplate ) db_detach("settingSrc");
2834 if( zProjectName ) fossil_print("project-name: %s\n", zProjectName);
2835 if( zProjectDesc ) fossil_print("project-description: %s\n", zProjectDesc);
2836 fossil_print("project-id: %s\n", db_get("project-code", 0));
2837 fossil_print("server-id: %s\n", db_get("server-code", 0));
2838 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
2839 fossil_print("admin-user: %s (initial password is \"%s\")\n",
2840 g.zLogin, zPassword);
@@ -3324,10 +3334,14 @@
3334 }
3335 db_reset(&q2);
3336 }
3337 return v;
3338 }
3339 i64 db_large_file_size(void){
3340 /* Return size of the largest file that is not considered oversized */
3341 return strtoll(db_get("large-file-size","20000000"),0,0);
3342 }
3343 void db_set_int(const char *zName, int value, int globalFlag){
3344 db_assert_protection_off_or_not_sensitive(zName);
3345 db_unprotect(PROTECT_CONFIG);
3346 if( globalFlag ){
3347 db_swap_connections();
@@ -4395,10 +4409,17 @@
4409 ** A shell command used to launch your preferred
4410 ** web browser when given a URL as an argument.
4411 ** Defaults to "start" on windows, "open" on Mac,
4412 ** and "firefox" on Unix.
4413 */
4414 /*
4415 ** SETTING: large-file-size width=10 default=200000000
4416 ** Fossil considers any file whose size is greater than this value
4417 ** to be a "large file". Fossil might issue warnings if you try to
4418 ** "add" or "commit" a "large file". Set this value to 0 or less
4419 ** to disable all such warnings.
4420 */
4421
4422 /*
4423 ** Look up a control setting by its name. Return a pointer to the Setting
4424 ** object, or NULL if there is no such setting.
4425 **
4426
+1
--- src/diff.c
+++ src/diff.c
@@ -580,10 +580,11 @@
580580
int mxi = -1;
581581
int mxLen = -1;
582582
int x, i;
583583
int aLCS[4];
584584
struct Span *a, *b;
585
+ memset(aLCS, 0, sizeof(aLCS));
585586
for(i=0; i<p->n; i++){
586587
if( p->a[i].isMin ) continue;
587588
x = p->a[i].iLen1;
588589
if( p->a[i].iLen2<x ) x = p->a[i].iLen2;
589590
if( x>mxLen ){
590591
--- src/diff.c
+++ src/diff.c
@@ -580,10 +580,11 @@
580 int mxi = -1;
581 int mxLen = -1;
582 int x, i;
583 int aLCS[4];
584 struct Span *a, *b;
 
585 for(i=0; i<p->n; i++){
586 if( p->a[i].isMin ) continue;
587 x = p->a[i].iLen1;
588 if( p->a[i].iLen2<x ) x = p->a[i].iLen2;
589 if( x>mxLen ){
590
--- src/diff.c
+++ src/diff.c
@@ -580,10 +580,11 @@
580 int mxi = -1;
581 int mxLen = -1;
582 int x, i;
583 int aLCS[4];
584 struct Span *a, *b;
585 memset(aLCS, 0, sizeof(aLCS));
586 for(i=0; i<p->n; i++){
587 if( p->a[i].isMin ) continue;
588 x = p->a[i].iLen1;
589 if( p->a[i].iLen2<x ) x = p->a[i].iLen2;
590 if( x>mxLen ){
591
+41 -12
--- src/forum.c
+++ src/forum.c
@@ -500,21 +500,21 @@
500500
}
501501
zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", p->rDate);
502502
if( p->pEditPrev ){
503503
zPosterName = forum_post_display_name(p->pEditHead, 0);
504504
zEditorName = forum_post_display_name(p, pManifest);
505
- zHist = bHist ? "" : "&hist";
505
+ zHist = bHist ? "" : zQuery[0]==0 ? "?hist" : "&hist";
506506
@ <h3 class='forumPostHdr'>(%d(p->sid)\
507507
@ .%0*d(fossil_num_digits(p->nEdit))(p->rev)) \
508508
if( fossil_strcmp(zPosterName, zEditorName)==0 ){
509509
@ By %s(zPosterName) on %h(zDate) edited from \
510510
@ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
511511
@ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
512512
}else{
513513
@ Originally by %s(zPosterName) \
514514
@ with edits by %s(zEditorName) on %h(zDate) from \
515
- @ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
515
+ @ %z(href("%R/forumpost/%S%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
516516
@ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
517517
}
518518
}else{
519519
zPosterName = forum_post_display_name(p, pManifest);
520520
@ <h3 class='forumPostHdr'>(%d(p->sid)) \
@@ -529,28 +529,28 @@
529529
@ <a href="%R/artifact/%h(p->zUuid)">(artifact-%d(p->fpid))</a></span>
530530
}
531531
532532
/* If this is a reply, refer back to the parent post. */
533533
if( p->pIrt ){
534
- @ in reply to %z(href("%R/forumpost/%S?%s",p->pIrt->zUuid,zQuery))\
534
+ @ in reply to %z(href("%R/forumpost/%S%s",p->pIrt->zUuid,zQuery))\
535535
@ %d(p->pIrt->sid)\
536536
if( p->pIrt->nEdit ){
537537
@ .%0*d(fossil_num_digits(p->pIrt->nEdit))(p->pIrt->rev)\
538538
}
539539
@ </a>
540540
}
541541
542542
/* If this post was later edited, refer forward to the next edit. */
543543
if( p->pEditNext ){
544
- @ updated by %z(href("%R/forumpost/%S?%s",p->pEditNext->zUuid,zQuery))\
544
+ @ updated by %z(href("%R/forumpost/%S%s",p->pEditNext->zUuid,zQuery))\
545545
@ %d(p->pEditNext->sid)\
546546
@ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a>
547547
}
548548
549549
/* Provide a link to select the individual post. */
550550
if( !bSelect ){
551
- @ %z(href("%R/forumpost/%!S?%s",p->zUuid,zQuery))[link]</a>
551
+ @ %z(href("%R/forumpost/%!S%s",p->zUuid,zQuery))[link]</a>
552552
}
553553
554554
/* Provide a link to the raw source code. */
555555
if( !bUnf ){
556556
@ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a>
@@ -632,19 +632,21 @@
632632
*/
633633
static void forum_display_thread(
634634
int froot, /* Forum thread root post ID */
635635
int fpid, /* Selected forum post ID, or 0 if none selected */
636636
int mode, /* Forum display mode, one of the FD_* enumerations */
637
+ int autoMode, /* mode was selected automatically */
637638
int bUnf, /* True if rendering unformatted */
638639
int bHist /* True if showing edit history, ignored for FD_RAW */
639640
){
640641
ForumThread *pThread; /* Thread structure */
641642
ForumPost *pSelect; /* Currently selected post, or NULL if none */
642643
ForumPost *p; /* Post iterator pointer */
643
- char *zQuery; /* Common query string */
644
+ char zQuery[30]; /* Common query string */
644645
int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */
645646
int sid; /* Comparison serial ID */
647
+ int i;
646648
647649
/* In raw mode, force unformatted display and disable history. */
648650
if( mode == FD_RAW ){
649651
bUnf = 1;
650652
bHist = 0;
@@ -675,13 +677,39 @@
675677
if( !pSelect && (mode==FD_RAW || mode==FD_SINGLE) ){
676678
return;
677679
}
678680
679681
/* Create the common query string to append to nearly all post links. */
680
- zQuery = mode==FD_RAW ? 0 : mprintf("t=%c%s%s",
681
- mode==FD_SINGLE ? 's' : mode==FD_CHRONO ? 'c' : 'h',
682
- bUnf ? "&unf" : "", bHist ? "&hist" : "");
682
+ i = 0;
683
+ if( !autoMode ){
684
+ char m = 'a';
685
+ switch( mode ){
686
+ case FD_RAW: m = 'r'; break;
687
+ case FD_CHRONO: m = 'c'; break;
688
+ case FD_HIER: m = 'h'; break;
689
+ case FD_SINGLE: m = 's'; break;
690
+ }
691
+ zQuery[i++] = '?';
692
+ zQuery[i++] = 't';
693
+ zQuery[i++] = '=';
694
+ zQuery[i++] = m;
695
+ }
696
+ if( bUnf ){
697
+ zQuery[i] = i==0 ? '?' : '&'; i++;
698
+ zQuery[i++] = 'u';
699
+ zQuery[i++] = 'n';
700
+ zQuery[i++] = 'f';
701
+ }
702
+ if( bHist ){
703
+ zQuery[i] = i==0 ? '?' : '&'; i++;
704
+ zQuery[i++] = 'h';
705
+ zQuery[i++] = 'i';
706
+ zQuery[i++] = 's';
707
+ zQuery[i++] = 't';
708
+ }
709
+ assert( i<sizeof(zQuery) );
710
+ zQuery[i] = 0;
683711
684712
/* Identify which post to display first. If history is shown, start with the
685713
** original, unedited post. Otherwise advance to the post's latest edit. */
686714
if( mode==FD_RAW || mode==FD_SINGLE ){
687715
p = pSelect;
@@ -744,11 +772,10 @@
744772
@ </table>
745773
}
746774
747775
/* Clean up. */
748776
forumthread_delete(pThread);
749
- fossil_free(zQuery);
750777
}
751778
752779
/*
753780
** Emit Forum Javascript which applies (or optionally can apply)
754781
** to all forum-related pages. It does not include page-specific
@@ -813,10 +840,11 @@
813840
const char *zMode = PD("t","a");
814841
int bRaw = PB("raw");
815842
int bUnf = PB("unf");
816843
int bHist = PB("hist");
817844
int mode = 0;
845
+ int autoMode = 0;
818846
login_check_credentials();
819847
if( !g.perm.RdForum ){
820848
login_needed(g.anon.RdForum);
821849
return;
822850
}
@@ -846,11 +874,12 @@
846874
cgi_replace_query_parameter("unf", "on");
847875
cgi_delete_query_parameter("hist");
848876
cgi_delete_query_parameter("raw");
849877
}else{
850878
switch( *zMode ){
851
- case 'a': mode = cgi_from_mobile() ? FD_CHRONO : FD_HIER; break;
879
+ case 'a': mode = cgi_from_mobile() ? FD_CHRONO : FD_HIER;
880
+ autoMode=1; break;
852881
case 'c': mode = FD_CHRONO; break;
853882
case 'h': mode = FD_HIER; break;
854883
case 's': mode = FD_SINGLE; break;
855884
case 'r': mode = FD_CHRONO; break;
856885
case 'y': mode = FD_SINGLE; break;
@@ -887,11 +916,11 @@
887916
}
888917
style_submenu_checkbox("unf", "Unformatted", 0, 0);
889918
style_submenu_checkbox("hist", "History", 0, 0);
890919
891920
/* Display the thread. */
892
- forum_display_thread(froot, fpid, mode, bUnf, bHist);
921
+ forum_display_thread(froot, fpid, mode, autoMode, bUnf, bHist);
893922
894923
/* Emit Forum Javascript. */
895924
builtin_request_js("forum.js");
896925
forum_emit_js();
897926
898927
--- src/forum.c
+++ src/forum.c
@@ -500,21 +500,21 @@
500 }
501 zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", p->rDate);
502 if( p->pEditPrev ){
503 zPosterName = forum_post_display_name(p->pEditHead, 0);
504 zEditorName = forum_post_display_name(p, pManifest);
505 zHist = bHist ? "" : "&hist";
506 @ <h3 class='forumPostHdr'>(%d(p->sid)\
507 @ .%0*d(fossil_num_digits(p->nEdit))(p->rev)) \
508 if( fossil_strcmp(zPosterName, zEditorName)==0 ){
509 @ By %s(zPosterName) on %h(zDate) edited from \
510 @ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
511 @ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
512 }else{
513 @ Originally by %s(zPosterName) \
514 @ with edits by %s(zEditorName) on %h(zDate) from \
515 @ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
516 @ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
517 }
518 }else{
519 zPosterName = forum_post_display_name(p, pManifest);
520 @ <h3 class='forumPostHdr'>(%d(p->sid)) \
@@ -529,28 +529,28 @@
529 @ <a href="%R/artifact/%h(p->zUuid)">(artifact-%d(p->fpid))</a></span>
530 }
531
532 /* If this is a reply, refer back to the parent post. */
533 if( p->pIrt ){
534 @ in reply to %z(href("%R/forumpost/%S?%s",p->pIrt->zUuid,zQuery))\
535 @ %d(p->pIrt->sid)\
536 if( p->pIrt->nEdit ){
537 @ .%0*d(fossil_num_digits(p->pIrt->nEdit))(p->pIrt->rev)\
538 }
539 @ </a>
540 }
541
542 /* If this post was later edited, refer forward to the next edit. */
543 if( p->pEditNext ){
544 @ updated by %z(href("%R/forumpost/%S?%s",p->pEditNext->zUuid,zQuery))\
545 @ %d(p->pEditNext->sid)\
546 @ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a>
547 }
548
549 /* Provide a link to select the individual post. */
550 if( !bSelect ){
551 @ %z(href("%R/forumpost/%!S?%s",p->zUuid,zQuery))[link]</a>
552 }
553
554 /* Provide a link to the raw source code. */
555 if( !bUnf ){
556 @ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a>
@@ -632,19 +632,21 @@
632 */
633 static void forum_display_thread(
634 int froot, /* Forum thread root post ID */
635 int fpid, /* Selected forum post ID, or 0 if none selected */
636 int mode, /* Forum display mode, one of the FD_* enumerations */
 
637 int bUnf, /* True if rendering unformatted */
638 int bHist /* True if showing edit history, ignored for FD_RAW */
639 ){
640 ForumThread *pThread; /* Thread structure */
641 ForumPost *pSelect; /* Currently selected post, or NULL if none */
642 ForumPost *p; /* Post iterator pointer */
643 char *zQuery; /* Common query string */
644 int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */
645 int sid; /* Comparison serial ID */
 
646
647 /* In raw mode, force unformatted display and disable history. */
648 if( mode == FD_RAW ){
649 bUnf = 1;
650 bHist = 0;
@@ -675,13 +677,39 @@
675 if( !pSelect && (mode==FD_RAW || mode==FD_SINGLE) ){
676 return;
677 }
678
679 /* Create the common query string to append to nearly all post links. */
680 zQuery = mode==FD_RAW ? 0 : mprintf("t=%c%s%s",
681 mode==FD_SINGLE ? 's' : mode==FD_CHRONO ? 'c' : 'h',
682 bUnf ? "&unf" : "", bHist ? "&hist" : "");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
684 /* Identify which post to display first. If history is shown, start with the
685 ** original, unedited post. Otherwise advance to the post's latest edit. */
686 if( mode==FD_RAW || mode==FD_SINGLE ){
687 p = pSelect;
@@ -744,11 +772,10 @@
744 @ </table>
745 }
746
747 /* Clean up. */
748 forumthread_delete(pThread);
749 fossil_free(zQuery);
750 }
751
752 /*
753 ** Emit Forum Javascript which applies (or optionally can apply)
754 ** to all forum-related pages. It does not include page-specific
@@ -813,10 +840,11 @@
813 const char *zMode = PD("t","a");
814 int bRaw = PB("raw");
815 int bUnf = PB("unf");
816 int bHist = PB("hist");
817 int mode = 0;
 
818 login_check_credentials();
819 if( !g.perm.RdForum ){
820 login_needed(g.anon.RdForum);
821 return;
822 }
@@ -846,11 +874,12 @@
846 cgi_replace_query_parameter("unf", "on");
847 cgi_delete_query_parameter("hist");
848 cgi_delete_query_parameter("raw");
849 }else{
850 switch( *zMode ){
851 case 'a': mode = cgi_from_mobile() ? FD_CHRONO : FD_HIER; break;
 
852 case 'c': mode = FD_CHRONO; break;
853 case 'h': mode = FD_HIER; break;
854 case 's': mode = FD_SINGLE; break;
855 case 'r': mode = FD_CHRONO; break;
856 case 'y': mode = FD_SINGLE; break;
@@ -887,11 +916,11 @@
887 }
888 style_submenu_checkbox("unf", "Unformatted", 0, 0);
889 style_submenu_checkbox("hist", "History", 0, 0);
890
891 /* Display the thread. */
892 forum_display_thread(froot, fpid, mode, bUnf, bHist);
893
894 /* Emit Forum Javascript. */
895 builtin_request_js("forum.js");
896 forum_emit_js();
897
898
--- src/forum.c
+++ src/forum.c
@@ -500,21 +500,21 @@
500 }
501 zDate = db_text(0, "SELECT datetime(%.17g,toLocal())", p->rDate);
502 if( p->pEditPrev ){
503 zPosterName = forum_post_display_name(p->pEditHead, 0);
504 zEditorName = forum_post_display_name(p, pManifest);
505 zHist = bHist ? "" : zQuery[0]==0 ? "?hist" : "&hist";
506 @ <h3 class='forumPostHdr'>(%d(p->sid)\
507 @ .%0*d(fossil_num_digits(p->nEdit))(p->rev)) \
508 if( fossil_strcmp(zPosterName, zEditorName)==0 ){
509 @ By %s(zPosterName) on %h(zDate) edited from \
510 @ %z(href("%R/forumpost/%S?%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
511 @ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
512 }else{
513 @ Originally by %s(zPosterName) \
514 @ with edits by %s(zEditorName) on %h(zDate) from \
515 @ %z(href("%R/forumpost/%S%s%s",p->pEditPrev->zUuid,zQuery,zHist))\
516 @ %d(p->sid).%0*d(fossil_num_digits(p->nEdit))(p->pEditPrev->rev)</a>
517 }
518 }else{
519 zPosterName = forum_post_display_name(p, pManifest);
520 @ <h3 class='forumPostHdr'>(%d(p->sid)) \
@@ -529,28 +529,28 @@
529 @ <a href="%R/artifact/%h(p->zUuid)">(artifact-%d(p->fpid))</a></span>
530 }
531
532 /* If this is a reply, refer back to the parent post. */
533 if( p->pIrt ){
534 @ in reply to %z(href("%R/forumpost/%S%s",p->pIrt->zUuid,zQuery))\
535 @ %d(p->pIrt->sid)\
536 if( p->pIrt->nEdit ){
537 @ .%0*d(fossil_num_digits(p->pIrt->nEdit))(p->pIrt->rev)\
538 }
539 @ </a>
540 }
541
542 /* If this post was later edited, refer forward to the next edit. */
543 if( p->pEditNext ){
544 @ updated by %z(href("%R/forumpost/%S%s",p->pEditNext->zUuid,zQuery))\
545 @ %d(p->pEditNext->sid)\
546 @ .%0*d(fossil_num_digits(p->nEdit))(p->pEditNext->rev)</a>
547 }
548
549 /* Provide a link to select the individual post. */
550 if( !bSelect ){
551 @ %z(href("%R/forumpost/%!S%s",p->zUuid,zQuery))[link]</a>
552 }
553
554 /* Provide a link to the raw source code. */
555 if( !bUnf ){
556 @ %z(href("%R/forumpost/%!S?raw",p->zUuid))[source]</a>
@@ -632,19 +632,21 @@
632 */
633 static void forum_display_thread(
634 int froot, /* Forum thread root post ID */
635 int fpid, /* Selected forum post ID, or 0 if none selected */
636 int mode, /* Forum display mode, one of the FD_* enumerations */
637 int autoMode, /* mode was selected automatically */
638 int bUnf, /* True if rendering unformatted */
639 int bHist /* True if showing edit history, ignored for FD_RAW */
640 ){
641 ForumThread *pThread; /* Thread structure */
642 ForumPost *pSelect; /* Currently selected post, or NULL if none */
643 ForumPost *p; /* Post iterator pointer */
644 char zQuery[30]; /* Common query string */
645 int iIndentScale = 4; /* Indent scale factor, measured in "ex" units */
646 int sid; /* Comparison serial ID */
647 int i;
648
649 /* In raw mode, force unformatted display and disable history. */
650 if( mode == FD_RAW ){
651 bUnf = 1;
652 bHist = 0;
@@ -675,13 +677,39 @@
677 if( !pSelect && (mode==FD_RAW || mode==FD_SINGLE) ){
678 return;
679 }
680
681 /* Create the common query string to append to nearly all post links. */
682 i = 0;
683 if( !autoMode ){
684 char m = 'a';
685 switch( mode ){
686 case FD_RAW: m = 'r'; break;
687 case FD_CHRONO: m = 'c'; break;
688 case FD_HIER: m = 'h'; break;
689 case FD_SINGLE: m = 's'; break;
690 }
691 zQuery[i++] = '?';
692 zQuery[i++] = 't';
693 zQuery[i++] = '=';
694 zQuery[i++] = m;
695 }
696 if( bUnf ){
697 zQuery[i] = i==0 ? '?' : '&'; i++;
698 zQuery[i++] = 'u';
699 zQuery[i++] = 'n';
700 zQuery[i++] = 'f';
701 }
702 if( bHist ){
703 zQuery[i] = i==0 ? '?' : '&'; i++;
704 zQuery[i++] = 'h';
705 zQuery[i++] = 'i';
706 zQuery[i++] = 's';
707 zQuery[i++] = 't';
708 }
709 assert( i<sizeof(zQuery) );
710 zQuery[i] = 0;
711
712 /* Identify which post to display first. If history is shown, start with the
713 ** original, unedited post. Otherwise advance to the post's latest edit. */
714 if( mode==FD_RAW || mode==FD_SINGLE ){
715 p = pSelect;
@@ -744,11 +772,10 @@
772 @ </table>
773 }
774
775 /* Clean up. */
776 forumthread_delete(pThread);
 
777 }
778
779 /*
780 ** Emit Forum Javascript which applies (or optionally can apply)
781 ** to all forum-related pages. It does not include page-specific
@@ -813,10 +840,11 @@
840 const char *zMode = PD("t","a");
841 int bRaw = PB("raw");
842 int bUnf = PB("unf");
843 int bHist = PB("hist");
844 int mode = 0;
845 int autoMode = 0;
846 login_check_credentials();
847 if( !g.perm.RdForum ){
848 login_needed(g.anon.RdForum);
849 return;
850 }
@@ -846,11 +874,12 @@
874 cgi_replace_query_parameter("unf", "on");
875 cgi_delete_query_parameter("hist");
876 cgi_delete_query_parameter("raw");
877 }else{
878 switch( *zMode ){
879 case 'a': mode = cgi_from_mobile() ? FD_CHRONO : FD_HIER;
880 autoMode=1; break;
881 case 'c': mode = FD_CHRONO; break;
882 case 'h': mode = FD_HIER; break;
883 case 's': mode = FD_SINGLE; break;
884 case 'r': mode = FD_CHRONO; break;
885 case 'y': mode = FD_SINGLE; break;
@@ -887,11 +916,11 @@
916 }
917 style_submenu_checkbox("unf", "Unformatted", 0, 0);
918 style_submenu_checkbox("hist", "History", 0, 0);
919
920 /* Display the thread. */
921 forum_display_thread(froot, fpid, mode, autoMode, bUnf, bHist);
922
923 /* Emit Forum Javascript. */
924 builtin_request_js("forum.js");
925 forum_emit_js();
926
927
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
10711071
};
10721072
10731073
const canEmbedFile = function f(msg){
10741074
if(!f.$rx){
10751075
f.$rx = /\.((html?)|(txt))$/i;
1076
+ f.$specificTypes = [
1077
+ 'text/plain',
1078
+ 'text/html'
1079
+ // add more as we discover which ones Firefox won't
1080
+ // force the user to try to download.
1081
+ ];
1082
+ }
1083
+ if(msg.fmime){
1084
+ return (msg.fmime.startsWith("image/")
1085
+ || f.$specificTypes.indexOf(msg.fmime)>=0);
1086
+ }
1087
+ return msg.fname && f.$rx.test(msg.fname);
1088
+ };
1089
+
1090
+ const adjustIFrameSize = function(msgObj){
1091
+ const iframe = msgObj.e.iframe;
1092
+ const body = iframe.contentWindow.document.querySelector('body');
1093
+ if(body && !body.style.fontSize){
1094
+ /** _Attempt_ to force the iframe to inherit the message's text size
1095
+ if the body has no explicit size set. On desktop systems
1096
+ the size is apparently being inherited in that case, but on mobile
1097
+ not. */
1098
+ body.style.fontSize = window.getComputedStyle(msgObj.e.content);
10761099
}
1077
- return msg.fname && (
1078
- f.$rx.test(msg.fname)
1079
- || (msg.fmime
1080
- && msg.fmime.startsWith("image/"))
1081
- );
1100
+ if('' === iframe.style.maxHeight){
1101
+ /* Resize iframe height to fit the content. Workaround: if we
1102
+ adjust the iframe height while it's hidden then its height
1103
+ is 0, so we must briefly unhide it. */
1104
+ const isHidden = iframe.classList.contains('hidden');
1105
+ if(isHidden) D.removeClass(iframe, 'hidden');
1106
+ iframe.style.maxHeight = iframe.style.height
1107
+ = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1108
+ if(isHidden) D.addClass(iframe, 'hidden');
1109
+ }
10821110
};
1083
-
1111
+
10841112
cf.prototype = {
10851113
scrollIntoView: function(){
10861114
this.e.content.scrollIntoView();
10871115
},
10881116
setMessage: function(m){
@@ -1121,11 +1149,14 @@
11211149
if( m.xfrom && m.fsize>0 ){
11221150
if( m.fmime
11231151
&& m.fmime.startsWith("image/")
11241152
&& Chat.settings.getBool('images-inline',true)
11251153
){
1126
- contentTarget.appendChild(D.img("chat-download/" + m.msgid));
1154
+ const extension = m.fname.split('.').pop();
1155
+ contentTarget.appendChild(D.img("chat-download/" + m.msgid +(
1156
+ extension ? ('.'+extension) : ''/*So that IMG tag mimetype guessing works*/
1157
+ )));
11271158
ds.hasImage = 1;
11281159
}else{
11291160
// Add a download link.
11301161
const downloadUri = window.fossil.rootPath+
11311162
'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
11431174
const embedTarget = this.e.content;
11441175
const self = this;
11451176
const btnEmbed = D.attr(D.checkbox("1", false), 'id',
11461177
'embed-'+ds.msgid);
11471178
const btnLabel = D.label(btnEmbed, "Embed");
1179
+ /* Maintenance reminder: do not disable the toggle
1180
+ button while the content is loading because that will
1181
+ cause it to get stuck in disabled mode if the browser
1182
+ decides that loading the content should prompt the
1183
+ user to download it, rather than embed it in the
1184
+ iframe. */
11481185
btnEmbed.addEventListener('change',function(){
11491186
if(self.e.iframe){
1150
- if(btnEmbed.checked) D.removeClass(self.e.iframe, 'hidden');
1187
+ if(btnEmbed.checked){
1188
+ D.removeClass(self.e.iframe, 'hidden');
1189
+ if(self.e.$iframeLoaded) adjustIFrameSize(self);
1190
+ }
11511191
else D.addClass(self.e.iframe, 'hidden');
11521192
return;
11531193
}
1154
- D.disable(btnEmbed);
11551194
const iframe = self.e.iframe = document.createElement('iframe');
1156
- D.append(embedTarget, iframe);
1195
+ D.append(embedTarget, iframe);
11571196
iframe.addEventListener('load', function(){
1158
- D.enable(btnEmbed);
1159
- const body = iframe.contentWindow.document.querySelector('body');
1160
- if(body && !body.style.fontSize){
1161
- /** _Attempt_ to force the iframe to inherit the message's text size
1162
- if the body has no explicit size set. On desktop systems
1163
- the size is apparently being inherited in that case, but on mobile
1164
- not. */
1165
- const cs = window.getComputedStyle(self.e.content);
1166
- body.style.fontSize = cs.fontSize;
1167
- }
1168
- iframe.style.maxHeight = iframe.style.height
1169
- = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1197
+ self.e.$iframeLoaded = true;
1198
+ adjustIFrameSize(self);
11701199
});
11711200
iframe.setAttribute('src', downloadUri);
11721201
});
11731202
D.append(w, btnEmbed, btnLabel);
11741203
}
11751204
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
1071 };
1072
1073 const canEmbedFile = function f(msg){
1074 if(!f.$rx){
1075 f.$rx = /\.((html?)|(txt))$/i;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1076 }
1077 return msg.fname && (
1078 f.$rx.test(msg.fname)
1079 || (msg.fmime
1080 && msg.fmime.startsWith("image/"))
1081 );
 
 
 
 
 
1082 };
1083
1084 cf.prototype = {
1085 scrollIntoView: function(){
1086 this.e.content.scrollIntoView();
1087 },
1088 setMessage: function(m){
@@ -1121,11 +1149,14 @@
1121 if( m.xfrom && m.fsize>0 ){
1122 if( m.fmime
1123 && m.fmime.startsWith("image/")
1124 && Chat.settings.getBool('images-inline',true)
1125 ){
1126 contentTarget.appendChild(D.img("chat-download/" + m.msgid));
 
 
 
1127 ds.hasImage = 1;
1128 }else{
1129 // Add a download link.
1130 const downloadUri = window.fossil.rootPath+
1131 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
1143 const embedTarget = this.e.content;
1144 const self = this;
1145 const btnEmbed = D.attr(D.checkbox("1", false), 'id',
1146 'embed-'+ds.msgid);
1147 const btnLabel = D.label(btnEmbed, "Embed");
 
 
 
 
 
 
1148 btnEmbed.addEventListener('change',function(){
1149 if(self.e.iframe){
1150 if(btnEmbed.checked) D.removeClass(self.e.iframe, 'hidden');
 
 
 
1151 else D.addClass(self.e.iframe, 'hidden');
1152 return;
1153 }
1154 D.disable(btnEmbed);
1155 const iframe = self.e.iframe = document.createElement('iframe');
1156 D.append(embedTarget, iframe);
1157 iframe.addEventListener('load', function(){
1158 D.enable(btnEmbed);
1159 const body = iframe.contentWindow.document.querySelector('body');
1160 if(body && !body.style.fontSize){
1161 /** _Attempt_ to force the iframe to inherit the message's text size
1162 if the body has no explicit size set. On desktop systems
1163 the size is apparently being inherited in that case, but on mobile
1164 not. */
1165 const cs = window.getComputedStyle(self.e.content);
1166 body.style.fontSize = cs.fontSize;
1167 }
1168 iframe.style.maxHeight = iframe.style.height
1169 = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1170 });
1171 iframe.setAttribute('src', downloadUri);
1172 });
1173 D.append(w, btnEmbed, btnLabel);
1174 }
1175
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
1071 };
1072
1073 const canEmbedFile = function f(msg){
1074 if(!f.$rx){
1075 f.$rx = /\.((html?)|(txt))$/i;
1076 f.$specificTypes = [
1077 'text/plain',
1078 'text/html'
1079 // add more as we discover which ones Firefox won't
1080 // force the user to try to download.
1081 ];
1082 }
1083 if(msg.fmime){
1084 return (msg.fmime.startsWith("image/")
1085 || f.$specificTypes.indexOf(msg.fmime)>=0);
1086 }
1087 return msg.fname && f.$rx.test(msg.fname);
1088 };
1089
1090 const adjustIFrameSize = function(msgObj){
1091 const iframe = msgObj.e.iframe;
1092 const body = iframe.contentWindow.document.querySelector('body');
1093 if(body && !body.style.fontSize){
1094 /** _Attempt_ to force the iframe to inherit the message's text size
1095 if the body has no explicit size set. On desktop systems
1096 the size is apparently being inherited in that case, but on mobile
1097 not. */
1098 body.style.fontSize = window.getComputedStyle(msgObj.e.content);
1099 }
1100 if('' === iframe.style.maxHeight){
1101 /* Resize iframe height to fit the content. Workaround: if we
1102 adjust the iframe height while it's hidden then its height
1103 is 0, so we must briefly unhide it. */
1104 const isHidden = iframe.classList.contains('hidden');
1105 if(isHidden) D.removeClass(iframe, 'hidden');
1106 iframe.style.maxHeight = iframe.style.height
1107 = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1108 if(isHidden) D.addClass(iframe, 'hidden');
1109 }
1110 };
1111
1112 cf.prototype = {
1113 scrollIntoView: function(){
1114 this.e.content.scrollIntoView();
1115 },
1116 setMessage: function(m){
@@ -1121,11 +1149,14 @@
1149 if( m.xfrom && m.fsize>0 ){
1150 if( m.fmime
1151 && m.fmime.startsWith("image/")
1152 && Chat.settings.getBool('images-inline',true)
1153 ){
1154 const extension = m.fname.split('.').pop();
1155 contentTarget.appendChild(D.img("chat-download/" + m.msgid +(
1156 extension ? ('.'+extension) : ''/*So that IMG tag mimetype guessing works*/
1157 )));
1158 ds.hasImage = 1;
1159 }else{
1160 // Add a download link.
1161 const downloadUri = window.fossil.rootPath+
1162 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
1174 const embedTarget = this.e.content;
1175 const self = this;
1176 const btnEmbed = D.attr(D.checkbox("1", false), 'id',
1177 'embed-'+ds.msgid);
1178 const btnLabel = D.label(btnEmbed, "Embed");
1179 /* Maintenance reminder: do not disable the toggle
1180 button while the content is loading because that will
1181 cause it to get stuck in disabled mode if the browser
1182 decides that loading the content should prompt the
1183 user to download it, rather than embed it in the
1184 iframe. */
1185 btnEmbed.addEventListener('change',function(){
1186 if(self.e.iframe){
1187 if(btnEmbed.checked){
1188 D.removeClass(self.e.iframe, 'hidden');
1189 if(self.e.$iframeLoaded) adjustIFrameSize(self);
1190 }
1191 else D.addClass(self.e.iframe, 'hidden');
1192 return;
1193 }
 
1194 const iframe = self.e.iframe = document.createElement('iframe');
1195 D.append(embedTarget, iframe);
1196 iframe.addEventListener('load', function(){
1197 self.e.$iframeLoaded = true;
1198 adjustIFrameSize(self);
 
 
 
 
 
 
 
 
 
 
1199 });
1200 iframe.setAttribute('src', downloadUri);
1201 });
1202 D.append(w, btnEmbed, btnLabel);
1203 }
1204
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
10711071
};
10721072
10731073
const canEmbedFile = function f(msg){
10741074
if(!f.$rx){
10751075
f.$rx = /\.((html?)|(txt))$/i;
1076
+ f.$specificTypes = [
1077
+ 'text/plain',
1078
+ 'text/html'
1079
+ // add more as we discover which ones Firefox won't
1080
+ // force the user to try to download.
1081
+ ];
1082
+ }
1083
+ if(msg.fmime){
1084
+ return (msg.fmime.startsWith("image/")
1085
+ || f.$specificTypes.indexOf(msg.fmime)>=0);
1086
+ }
1087
+ return msg.fname && f.$rx.test(msg.fname);
1088
+ };
1089
+
1090
+ const adjustIFrameSize = function(msgObj){
1091
+ const iframe = msgObj.e.iframe;
1092
+ const body = iframe.contentWindow.document.querySelector('body');
1093
+ if(body && !body.style.fontSize){
1094
+ /** _Attempt_ to force the iframe to inherit the message's text size
1095
+ if the body has no explicit size set. On desktop systems
1096
+ the size is apparently being inherited in that case, but on mobile
1097
+ not. */
1098
+ body.style.fontSize = window.getComputedStyle(msgObj.e.content);
10761099
}
1077
- return msg.fname && (
1078
- f.$rx.test(msg.fname)
1079
- || (msg.fmime
1080
- && msg.fmime.startsWith("image/"))
1081
- );
1100
+ if('' === iframe.style.maxHeight){
1101
+ /* Resize iframe height to fit the content. Workaround: if we
1102
+ adjust the iframe height while it's hidden then its height
1103
+ is 0, so we must briefly unhide it. */
1104
+ const isHidden = iframe.classList.contains('hidden');
1105
+ if(isHidden) D.removeClass(iframe, 'hidden');
1106
+ iframe.style.maxHeight = iframe.style.height
1107
+ = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1108
+ if(isHidden) D.addClass(iframe, 'hidden');
1109
+ }
10821110
};
1083
-
1111
+
10841112
cf.prototype = {
10851113
scrollIntoView: function(){
10861114
this.e.content.scrollIntoView();
10871115
},
10881116
setMessage: function(m){
@@ -1121,11 +1149,14 @@
11211149
if( m.xfrom && m.fsize>0 ){
11221150
if( m.fmime
11231151
&& m.fmime.startsWith("image/")
11241152
&& Chat.settings.getBool('images-inline',true)
11251153
){
1126
- contentTarget.appendChild(D.img("chat-download/" + m.msgid));
1154
+ const extension = m.fname.split('.').pop();
1155
+ contentTarget.appendChild(D.img("chat-download/" + m.msgid +(
1156
+ extension ? ('.'+extension) : ''/*So that IMG tag mimetype guessing works*/
1157
+ )));
11271158
ds.hasImage = 1;
11281159
}else{
11291160
// Add a download link.
11301161
const downloadUri = window.fossil.rootPath+
11311162
'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
11431174
const embedTarget = this.e.content;
11441175
const self = this;
11451176
const btnEmbed = D.attr(D.checkbox("1", false), 'id',
11461177
'embed-'+ds.msgid);
11471178
const btnLabel = D.label(btnEmbed, "Embed");
1179
+ /* Maintenance reminder: do not disable the toggle
1180
+ button while the content is loading because that will
1181
+ cause it to get stuck in disabled mode if the browser
1182
+ decides that loading the content should prompt the
1183
+ user to download it, rather than embed it in the
1184
+ iframe. */
11481185
btnEmbed.addEventListener('change',function(){
11491186
if(self.e.iframe){
1150
- if(btnEmbed.checked) D.removeClass(self.e.iframe, 'hidden');
1187
+ if(btnEmbed.checked){
1188
+ D.removeClass(self.e.iframe, 'hidden');
1189
+ if(self.e.$iframeLoaded) adjustIFrameSize(self);
1190
+ }
11511191
else D.addClass(self.e.iframe, 'hidden');
11521192
return;
11531193
}
1154
- D.disable(btnEmbed);
11551194
const iframe = self.e.iframe = document.createElement('iframe');
1156
- D.append(embedTarget, iframe);
1195
+ D.append(embedTarget, iframe);
11571196
iframe.addEventListener('load', function(){
1158
- D.enable(btnEmbed);
1159
- const body = iframe.contentWindow.document.querySelector('body');
1160
- if(body && !body.style.fontSize){
1161
- /** _Attempt_ to force the iframe to inherit the message's text size
1162
- if the body has no explicit size set. On desktop systems
1163
- the size is apparently being inherited in that case, but on mobile
1164
- not. */
1165
- const cs = window.getComputedStyle(self.e.content);
1166
- body.style.fontSize = cs.fontSize;
1167
- }
1168
- iframe.style.maxHeight = iframe.style.height
1169
- = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1197
+ self.e.$iframeLoaded = true;
1198
+ adjustIFrameSize(self);
11701199
});
11711200
iframe.setAttribute('src', downloadUri);
11721201
});
11731202
D.append(w, btnEmbed, btnLabel);
11741203
}
11751204
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
1071 };
1072
1073 const canEmbedFile = function f(msg){
1074 if(!f.$rx){
1075 f.$rx = /\.((html?)|(txt))$/i;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1076 }
1077 return msg.fname && (
1078 f.$rx.test(msg.fname)
1079 || (msg.fmime
1080 && msg.fmime.startsWith("image/"))
1081 );
 
 
 
 
 
1082 };
1083
1084 cf.prototype = {
1085 scrollIntoView: function(){
1086 this.e.content.scrollIntoView();
1087 },
1088 setMessage: function(m){
@@ -1121,11 +1149,14 @@
1121 if( m.xfrom && m.fsize>0 ){
1122 if( m.fmime
1123 && m.fmime.startsWith("image/")
1124 && Chat.settings.getBool('images-inline',true)
1125 ){
1126 contentTarget.appendChild(D.img("chat-download/" + m.msgid));
 
 
 
1127 ds.hasImage = 1;
1128 }else{
1129 // Add a download link.
1130 const downloadUri = window.fossil.rootPath+
1131 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
1143 const embedTarget = this.e.content;
1144 const self = this;
1145 const btnEmbed = D.attr(D.checkbox("1", false), 'id',
1146 'embed-'+ds.msgid);
1147 const btnLabel = D.label(btnEmbed, "Embed");
 
 
 
 
 
 
1148 btnEmbed.addEventListener('change',function(){
1149 if(self.e.iframe){
1150 if(btnEmbed.checked) D.removeClass(self.e.iframe, 'hidden');
 
 
 
1151 else D.addClass(self.e.iframe, 'hidden');
1152 return;
1153 }
1154 D.disable(btnEmbed);
1155 const iframe = self.e.iframe = document.createElement('iframe');
1156 D.append(embedTarget, iframe);
1157 iframe.addEventListener('load', function(){
1158 D.enable(btnEmbed);
1159 const body = iframe.contentWindow.document.querySelector('body');
1160 if(body && !body.style.fontSize){
1161 /** _Attempt_ to force the iframe to inherit the message's text size
1162 if the body has no explicit size set. On desktop systems
1163 the size is apparently being inherited in that case, but on mobile
1164 not. */
1165 const cs = window.getComputedStyle(self.e.content);
1166 body.style.fontSize = cs.fontSize;
1167 }
1168 iframe.style.maxHeight = iframe.style.height
1169 = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1170 });
1171 iframe.setAttribute('src', downloadUri);
1172 });
1173 D.append(w, btnEmbed, btnLabel);
1174 }
1175
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1071,18 +1071,46 @@
1071 };
1072
1073 const canEmbedFile = function f(msg){
1074 if(!f.$rx){
1075 f.$rx = /\.((html?)|(txt))$/i;
1076 f.$specificTypes = [
1077 'text/plain',
1078 'text/html'
1079 // add more as we discover which ones Firefox won't
1080 // force the user to try to download.
1081 ];
1082 }
1083 if(msg.fmime){
1084 return (msg.fmime.startsWith("image/")
1085 || f.$specificTypes.indexOf(msg.fmime)>=0);
1086 }
1087 return msg.fname && f.$rx.test(msg.fname);
1088 };
1089
1090 const adjustIFrameSize = function(msgObj){
1091 const iframe = msgObj.e.iframe;
1092 const body = iframe.contentWindow.document.querySelector('body');
1093 if(body && !body.style.fontSize){
1094 /** _Attempt_ to force the iframe to inherit the message's text size
1095 if the body has no explicit size set. On desktop systems
1096 the size is apparently being inherited in that case, but on mobile
1097 not. */
1098 body.style.fontSize = window.getComputedStyle(msgObj.e.content);
1099 }
1100 if('' === iframe.style.maxHeight){
1101 /* Resize iframe height to fit the content. Workaround: if we
1102 adjust the iframe height while it's hidden then its height
1103 is 0, so we must briefly unhide it. */
1104 const isHidden = iframe.classList.contains('hidden');
1105 if(isHidden) D.removeClass(iframe, 'hidden');
1106 iframe.style.maxHeight = iframe.style.height
1107 = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
1108 if(isHidden) D.addClass(iframe, 'hidden');
1109 }
1110 };
1111
1112 cf.prototype = {
1113 scrollIntoView: function(){
1114 this.e.content.scrollIntoView();
1115 },
1116 setMessage: function(m){
@@ -1121,11 +1149,14 @@
1149 if( m.xfrom && m.fsize>0 ){
1150 if( m.fmime
1151 && m.fmime.startsWith("image/")
1152 && Chat.settings.getBool('images-inline',true)
1153 ){
1154 const extension = m.fname.split('.').pop();
1155 contentTarget.appendChild(D.img("chat-download/" + m.msgid +(
1156 extension ? ('.'+extension) : ''/*So that IMG tag mimetype guessing works*/
1157 )));
1158 ds.hasImage = 1;
1159 }else{
1160 // Add a download link.
1161 const downloadUri = window.fossil.rootPath+
1162 'chat-download/' + m.msgid+'/'+encodeURIComponent(m.fname);
@@ -1143,32 +1174,30 @@
1174 const embedTarget = this.e.content;
1175 const self = this;
1176 const btnEmbed = D.attr(D.checkbox("1", false), 'id',
1177 'embed-'+ds.msgid);
1178 const btnLabel = D.label(btnEmbed, "Embed");
1179 /* Maintenance reminder: do not disable the toggle
1180 button while the content is loading because that will
1181 cause it to get stuck in disabled mode if the browser
1182 decides that loading the content should prompt the
1183 user to download it, rather than embed it in the
1184 iframe. */
1185 btnEmbed.addEventListener('change',function(){
1186 if(self.e.iframe){
1187 if(btnEmbed.checked){
1188 D.removeClass(self.e.iframe, 'hidden');
1189 if(self.e.$iframeLoaded) adjustIFrameSize(self);
1190 }
1191 else D.addClass(self.e.iframe, 'hidden');
1192 return;
1193 }
 
1194 const iframe = self.e.iframe = document.createElement('iframe');
1195 D.append(embedTarget, iframe);
1196 iframe.addEventListener('load', function(){
1197 self.e.$iframeLoaded = true;
1198 adjustIFrameSize(self);
 
 
 
 
 
 
 
 
 
 
1199 });
1200 iframe.setAttribute('src', downloadUri);
1201 });
1202 D.append(w, btnEmbed, btnLabel);
1203 }
1204
+13 -13
--- src/hook.c
+++ src/hook.c
@@ -329,11 +329,13 @@
329329
"INSERT OR IGNORE INTO config(name,value) VALUES('hooks','[]');\n"
330330
);
331331
for(i=3; i<g.argc; i++){
332332
const char *zId = g.argv[i];
333333
if( strcmp(zId,"all")==0 ){
334
+ db_unprotect(PROTECT_ALL);
334335
db_set("hooks","[]", 0);
336
+ db_protect_pop();
335337
break;
336338
}
337339
if( sqlite3_strglob("*[^0-9]*", g.argv[i])==0 ){
338340
fossil_fatal("not a valid ID: \"%s\"", g.argv[i]);
339341
}
@@ -353,13 +355,13 @@
353355
Stmt q;
354356
int n = 0;
355357
verify_all_options();
356358
db_prepare(&q,
357359
"SELECT jx.key,"
358
- " json_extract(jx.value,'$.seq'),"
359
- " json_extract(jx.value,'$.cmd'),"
360
- " json_extract(jx.value,'$.type')"
360
+ " jx.value->>'seq',"
361
+ " jx.value->>'cmd',"
362
+ " jx.value->>'type'"
361363
" FROM config, json_each(config.value) AS jx"
362364
" WHERE config.name='hooks' AND json_valid(config.value)"
363365
);
364366
while( db_step(&q)==SQLITE_ROW ){
365367
if( n++ ) fossil_print("\n");
@@ -393,12 +395,11 @@
393395
id = atoi(g.argv[3]);
394396
if( zOrigRcvid==0 ){
395397
zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom");
396398
}
397399
db_prepare(&q,
398
- "SELECT json_extract(value,'$[%d].cmd'), "
399
- " json_extract(value,'$[%d].type')=='after-receive'"
400
+ "SELECT value->>'$[%d].cmd', value->>'$[%d].type'=='after-receive'"
400401
" FROM config"
401402
" WHERE name='hooks' AND json_valid(value)",
402403
id, id
403404
);
404405
while( db_step(&q)==SQLITE_ROW ){
@@ -460,15 +461,15 @@
460461
if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){
461462
goto hook_backoffice_done; /* no new content */
462463
}
463464
blob_init(&chng, 0, 0);
464465
db_prepare(&q,
465
- "SELECT json_extract(jx.value,'$.cmd') "
466
+ "SELECT jx.value->>'cmd'"
466467
" FROM config, json_each(config.value) AS jx"
467468
" WHERE config.name='hooks' AND json_valid(config.value)"
468
- " AND json_extract(jx.value,'$.type')='after-receive'"
469
- " ORDER BY json_extract(jx.value,'$.seq');"
469
+ " AND jx.value->>'type'='after-receive'"
470
+ " ORDER BY jx.value->>'seq';"
470471
);
471472
while( db_step(&q)==SQLITE_ROW ){
472473
char *zCmd;
473474
int fdFromChild;
474475
FILE *toChild;
@@ -500,12 +501,11 @@
500501
int hook_exists(const char *zType){
501502
return db_exists(
502503
"SELECT 1"
503504
" FROM config, json_each(config.value) AS jx"
504505
" WHERE config.name='hooks' AND json_valid(config.value)"
505
- " AND json_extract(jx.value,'$.type')=%Q"
506
- " ORDER BY json_extract(jx.value,'$.seq');",
506
+ " AND jx.value->>'type'=%Q;",
507507
zType
508508
);
509509
}
510510
511511
/*
@@ -520,15 +520,15 @@
520520
int rc = 0;
521521
if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){
522522
return 0;
523523
}
524524
db_prepare(&q,
525
- "SELECT json_extract(jx.value,'$.cmd') "
525
+ "SELECT jx.value->>'cmd' "
526526
" FROM config, json_each(config.value) AS jx"
527527
" WHERE config.name='hooks' AND json_valid(config.value)"
528
- " AND json_extract(jx.value,'$.type')=%Q"
529
- " ORDER BY json_extract(jx.value,'$.seq');",
528
+ " AND jx.value->>'type'==%Q"
529
+ " ORDER BY jx.value->'seq';",
530530
zType
531531
);
532532
while( db_step(&q)==SQLITE_ROW ){
533533
char *zCmd;
534534
zCmd = hook_subst(db_column_text(&q,0), zAuxFile);
535535
--- src/hook.c
+++ src/hook.c
@@ -329,11 +329,13 @@
329 "INSERT OR IGNORE INTO config(name,value) VALUES('hooks','[]');\n"
330 );
331 for(i=3; i<g.argc; i++){
332 const char *zId = g.argv[i];
333 if( strcmp(zId,"all")==0 ){
 
334 db_set("hooks","[]", 0);
 
335 break;
336 }
337 if( sqlite3_strglob("*[^0-9]*", g.argv[i])==0 ){
338 fossil_fatal("not a valid ID: \"%s\"", g.argv[i]);
339 }
@@ -353,13 +355,13 @@
353 Stmt q;
354 int n = 0;
355 verify_all_options();
356 db_prepare(&q,
357 "SELECT jx.key,"
358 " json_extract(jx.value,'$.seq'),"
359 " json_extract(jx.value,'$.cmd'),"
360 " json_extract(jx.value,'$.type')"
361 " FROM config, json_each(config.value) AS jx"
362 " WHERE config.name='hooks' AND json_valid(config.value)"
363 );
364 while( db_step(&q)==SQLITE_ROW ){
365 if( n++ ) fossil_print("\n");
@@ -393,12 +395,11 @@
393 id = atoi(g.argv[3]);
394 if( zOrigRcvid==0 ){
395 zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom");
396 }
397 db_prepare(&q,
398 "SELECT json_extract(value,'$[%d].cmd'), "
399 " json_extract(value,'$[%d].type')=='after-receive'"
400 " FROM config"
401 " WHERE name='hooks' AND json_valid(value)",
402 id, id
403 );
404 while( db_step(&q)==SQLITE_ROW ){
@@ -460,15 +461,15 @@
460 if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){
461 goto hook_backoffice_done; /* no new content */
462 }
463 blob_init(&chng, 0, 0);
464 db_prepare(&q,
465 "SELECT json_extract(jx.value,'$.cmd') "
466 " FROM config, json_each(config.value) AS jx"
467 " WHERE config.name='hooks' AND json_valid(config.value)"
468 " AND json_extract(jx.value,'$.type')='after-receive'"
469 " ORDER BY json_extract(jx.value,'$.seq');"
470 );
471 while( db_step(&q)==SQLITE_ROW ){
472 char *zCmd;
473 int fdFromChild;
474 FILE *toChild;
@@ -500,12 +501,11 @@
500 int hook_exists(const char *zType){
501 return db_exists(
502 "SELECT 1"
503 " FROM config, json_each(config.value) AS jx"
504 " WHERE config.name='hooks' AND json_valid(config.value)"
505 " AND json_extract(jx.value,'$.type')=%Q"
506 " ORDER BY json_extract(jx.value,'$.seq');",
507 zType
508 );
509 }
510
511 /*
@@ -520,15 +520,15 @@
520 int rc = 0;
521 if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){
522 return 0;
523 }
524 db_prepare(&q,
525 "SELECT json_extract(jx.value,'$.cmd') "
526 " FROM config, json_each(config.value) AS jx"
527 " WHERE config.name='hooks' AND json_valid(config.value)"
528 " AND json_extract(jx.value,'$.type')=%Q"
529 " ORDER BY json_extract(jx.value,'$.seq');",
530 zType
531 );
532 while( db_step(&q)==SQLITE_ROW ){
533 char *zCmd;
534 zCmd = hook_subst(db_column_text(&q,0), zAuxFile);
535
--- src/hook.c
+++ src/hook.c
@@ -329,11 +329,13 @@
329 "INSERT OR IGNORE INTO config(name,value) VALUES('hooks','[]');\n"
330 );
331 for(i=3; i<g.argc; i++){
332 const char *zId = g.argv[i];
333 if( strcmp(zId,"all")==0 ){
334 db_unprotect(PROTECT_ALL);
335 db_set("hooks","[]", 0);
336 db_protect_pop();
337 break;
338 }
339 if( sqlite3_strglob("*[^0-9]*", g.argv[i])==0 ){
340 fossil_fatal("not a valid ID: \"%s\"", g.argv[i]);
341 }
@@ -353,13 +355,13 @@
355 Stmt q;
356 int n = 0;
357 verify_all_options();
358 db_prepare(&q,
359 "SELECT jx.key,"
360 " jx.value->>'seq',"
361 " jx.value->>'cmd',"
362 " jx.value->>'type'"
363 " FROM config, json_each(config.value) AS jx"
364 " WHERE config.name='hooks' AND json_valid(config.value)"
365 );
366 while( db_step(&q)==SQLITE_ROW ){
367 if( n++ ) fossil_print("\n");
@@ -393,12 +395,11 @@
395 id = atoi(g.argv[3]);
396 if( zOrigRcvid==0 ){
397 zOrigRcvid = db_text(0, "SELECT max(rcvid)-1 FROM rcvfrom");
398 }
399 db_prepare(&q,
400 "SELECT value->>'$[%d].cmd', value->>'$[%d].type'=='after-receive'"
 
401 " FROM config"
402 " WHERE name='hooks' AND json_valid(value)",
403 id, id
404 );
405 while( db_step(&q)==SQLITE_ROW ){
@@ -460,15 +461,15 @@
461 if( atoi(zLastRcvid)>=atoi(zNewRcvid) ){
462 goto hook_backoffice_done; /* no new content */
463 }
464 blob_init(&chng, 0, 0);
465 db_prepare(&q,
466 "SELECT jx.value->>'cmd'"
467 " FROM config, json_each(config.value) AS jx"
468 " WHERE config.name='hooks' AND json_valid(config.value)"
469 " AND jx.value->>'type'='after-receive'"
470 " ORDER BY jx.value->>'seq';"
471 );
472 while( db_step(&q)==SQLITE_ROW ){
473 char *zCmd;
474 int fdFromChild;
475 FILE *toChild;
@@ -500,12 +501,11 @@
501 int hook_exists(const char *zType){
502 return db_exists(
503 "SELECT 1"
504 " FROM config, json_each(config.value) AS jx"
505 " WHERE config.name='hooks' AND json_valid(config.value)"
506 " AND jx.value->>'type'=%Q;",
 
507 zType
508 );
509 }
510
511 /*
@@ -520,15 +520,15 @@
520 int rc = 0;
521 if( !db_exists("SELECT 1 FROM config WHERE name='hooks'") ){
522 return 0;
523 }
524 db_prepare(&q,
525 "SELECT jx.value->>'cmd' "
526 " FROM config, json_each(config.value) AS jx"
527 " WHERE config.name='hooks' AND json_valid(config.value)"
528 " AND jx.value->>'type'==%Q"
529 " ORDER BY jx.value->'seq';",
530 zType
531 );
532 while( db_step(&q)==SQLITE_ROW ){
533 char *zCmd;
534 zCmd = hook_subst(db_column_text(&q,0), zAuxFile);
535
+6 -6
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -714,11 +714,11 @@
714714
if( sslCtx==0 ){
715715
ERR_print_errors_fp(stderr);
716716
fossil_fatal("Error initializing the SSL server");
717717
}
718718
if( zCertFile && zCertFile[0] ){
719
- if( SSL_CTX_use_certificate_file(sslCtx,zCertFile,SSL_FILETYPE_PEM)<=0 ){
719
+ if( SSL_CTX_use_certificate_chain_file(sslCtx,zCertFile)!=1 ){
720720
ERR_print_errors_fp(stderr);
721721
fossil_fatal("Error loading CERT file \"%s\"", zCertFile);
722722
}
723723
if( zKeyFile==0 ) zKeyFile = zCertFile;
724724
if( SSL_CTX_use_PrivateKey_file(sslCtx, zKeyFile, SSL_FILETYPE_PEM)<=0 ){
@@ -964,11 +964,10 @@
964964
}else{
965965
blob_append(&allText, blob_buffer(&x), blob_size(&x));
966966
}
967967
}
968968
}
969
- db_protect_pop();
970969
if( !haveCert ){
971970
if( !haveKey ){
972971
fossil_fatal("missing certificate and private-key");
973972
}else{
974973
fossil_fatal("missing certificate");
@@ -977,10 +976,11 @@
977976
fossil_fatal("missing private-key");
978977
}
979978
if( !bFN ){
980979
db_set("ssl-cert", blob_str(&allText), 0);
981980
}
981
+ db_protect_pop();
982982
db_commit_transaction();
983983
}else
984984
if( strncmp("scrub",zCmd,nCmd)==0 && nCmd>4 ){
985985
int bForce = find_option("force","f",0)!=0;
986986
verify_all_options();
@@ -1061,21 +1061,21 @@
10611061
10621062
fossil_print("ssl-ca-location: %s\n", db_get("ssl-ca-location",""));
10631063
if( verbose ){
10641064
fossil_print("\n"
10651065
" This setting is the name of a file or directory that contains\n"
1066
- " the complete set of root certificates to used by Fossil when it\n"
1066
+ " the complete set of root certificates used by Fossil when it\n"
10671067
" is acting as a SSL client. If defined, this setting takes\n"
10681068
" priority over built-in paths and environment variables\n\n"
10691069
);
10701070
}
10711071
10721072
fossil_print("ssl-identity: %s\n", db_get("ssl-identity",""));
10731073
if( verbose ){
10741074
fossil_print("\n"
10751075
" This setting is the name of a file that contains the PEM-format\n"
1076
- " certificate and private-key used by Fossil clients to authentice\n"
1076
+ " certificate and private-key used by Fossil clients to authenticate\n"
10771077
" with servers. Few servers actually require this, so this setting\n"
10781078
" is usually blank.\n\n"
10791079
);
10801080
}
10811081
@@ -1095,11 +1095,11 @@
10951095
10961096
fossil_print("ssl-cert-file: %s\n", db_get("ssl-cert-file",""));
10971097
fossil_print("ssl-key-file: %s\n", db_get("ssl-key-file",""));
10981098
if( verbose ){
10991099
fossil_print("\n"
1100
- " This settings are the names of files that contin the certificate\n"
1100
+ " This settings are the names of files that contain the certificate\n"
11011101
" private-key used by Fossil when it is acting as a server.\n\n"
11021102
);
11031103
}
11041104
11051105
db_prepare(&q,
@@ -1165,11 +1165,11 @@
11651165
db_commit_transaction();
11661166
blob_reset(&sql);
11671167
}else
11681168
/*default*/{
11691169
fossil_fatal("unknown sub-command \"%s\".\nshould be one of:"
1170
- " clear-certs load-certs remove-exception scrub show",
1170
+ " clear-cert load-cert remove-exception scrub show",
11711171
zCmd);
11721172
}
11731173
}
11741174
11751175
/*
11761176
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -714,11 +714,11 @@
714 if( sslCtx==0 ){
715 ERR_print_errors_fp(stderr);
716 fossil_fatal("Error initializing the SSL server");
717 }
718 if( zCertFile && zCertFile[0] ){
719 if( SSL_CTX_use_certificate_file(sslCtx,zCertFile,SSL_FILETYPE_PEM)<=0 ){
720 ERR_print_errors_fp(stderr);
721 fossil_fatal("Error loading CERT file \"%s\"", zCertFile);
722 }
723 if( zKeyFile==0 ) zKeyFile = zCertFile;
724 if( SSL_CTX_use_PrivateKey_file(sslCtx, zKeyFile, SSL_FILETYPE_PEM)<=0 ){
@@ -964,11 +964,10 @@
964 }else{
965 blob_append(&allText, blob_buffer(&x), blob_size(&x));
966 }
967 }
968 }
969 db_protect_pop();
970 if( !haveCert ){
971 if( !haveKey ){
972 fossil_fatal("missing certificate and private-key");
973 }else{
974 fossil_fatal("missing certificate");
@@ -977,10 +976,11 @@
977 fossil_fatal("missing private-key");
978 }
979 if( !bFN ){
980 db_set("ssl-cert", blob_str(&allText), 0);
981 }
 
982 db_commit_transaction();
983 }else
984 if( strncmp("scrub",zCmd,nCmd)==0 && nCmd>4 ){
985 int bForce = find_option("force","f",0)!=0;
986 verify_all_options();
@@ -1061,21 +1061,21 @@
1061
1062 fossil_print("ssl-ca-location: %s\n", db_get("ssl-ca-location",""));
1063 if( verbose ){
1064 fossil_print("\n"
1065 " This setting is the name of a file or directory that contains\n"
1066 " the complete set of root certificates to used by Fossil when it\n"
1067 " is acting as a SSL client. If defined, this setting takes\n"
1068 " priority over built-in paths and environment variables\n\n"
1069 );
1070 }
1071
1072 fossil_print("ssl-identity: %s\n", db_get("ssl-identity",""));
1073 if( verbose ){
1074 fossil_print("\n"
1075 " This setting is the name of a file that contains the PEM-format\n"
1076 " certificate and private-key used by Fossil clients to authentice\n"
1077 " with servers. Few servers actually require this, so this setting\n"
1078 " is usually blank.\n\n"
1079 );
1080 }
1081
@@ -1095,11 +1095,11 @@
1095
1096 fossil_print("ssl-cert-file: %s\n", db_get("ssl-cert-file",""));
1097 fossil_print("ssl-key-file: %s\n", db_get("ssl-key-file",""));
1098 if( verbose ){
1099 fossil_print("\n"
1100 " This settings are the names of files that contin the certificate\n"
1101 " private-key used by Fossil when it is acting as a server.\n\n"
1102 );
1103 }
1104
1105 db_prepare(&q,
@@ -1165,11 +1165,11 @@
1165 db_commit_transaction();
1166 blob_reset(&sql);
1167 }else
1168 /*default*/{
1169 fossil_fatal("unknown sub-command \"%s\".\nshould be one of:"
1170 " clear-certs load-certs remove-exception scrub show",
1171 zCmd);
1172 }
1173 }
1174
1175 /*
1176
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -714,11 +714,11 @@
714 if( sslCtx==0 ){
715 ERR_print_errors_fp(stderr);
716 fossil_fatal("Error initializing the SSL server");
717 }
718 if( zCertFile && zCertFile[0] ){
719 if( SSL_CTX_use_certificate_chain_file(sslCtx,zCertFile)!=1 ){
720 ERR_print_errors_fp(stderr);
721 fossil_fatal("Error loading CERT file \"%s\"", zCertFile);
722 }
723 if( zKeyFile==0 ) zKeyFile = zCertFile;
724 if( SSL_CTX_use_PrivateKey_file(sslCtx, zKeyFile, SSL_FILETYPE_PEM)<=0 ){
@@ -964,11 +964,10 @@
964 }else{
965 blob_append(&allText, blob_buffer(&x), blob_size(&x));
966 }
967 }
968 }
 
969 if( !haveCert ){
970 if( !haveKey ){
971 fossil_fatal("missing certificate and private-key");
972 }else{
973 fossil_fatal("missing certificate");
@@ -977,10 +976,11 @@
976 fossil_fatal("missing private-key");
977 }
978 if( !bFN ){
979 db_set("ssl-cert", blob_str(&allText), 0);
980 }
981 db_protect_pop();
982 db_commit_transaction();
983 }else
984 if( strncmp("scrub",zCmd,nCmd)==0 && nCmd>4 ){
985 int bForce = find_option("force","f",0)!=0;
986 verify_all_options();
@@ -1061,21 +1061,21 @@
1061
1062 fossil_print("ssl-ca-location: %s\n", db_get("ssl-ca-location",""));
1063 if( verbose ){
1064 fossil_print("\n"
1065 " This setting is the name of a file or directory that contains\n"
1066 " the complete set of root certificates used by Fossil when it\n"
1067 " is acting as a SSL client. If defined, this setting takes\n"
1068 " priority over built-in paths and environment variables\n\n"
1069 );
1070 }
1071
1072 fossil_print("ssl-identity: %s\n", db_get("ssl-identity",""));
1073 if( verbose ){
1074 fossil_print("\n"
1075 " This setting is the name of a file that contains the PEM-format\n"
1076 " certificate and private-key used by Fossil clients to authenticate\n"
1077 " with servers. Few servers actually require this, so this setting\n"
1078 " is usually blank.\n\n"
1079 );
1080 }
1081
@@ -1095,11 +1095,11 @@
1095
1096 fossil_print("ssl-cert-file: %s\n", db_get("ssl-cert-file",""));
1097 fossil_print("ssl-key-file: %s\n", db_get("ssl-key-file",""));
1098 if( verbose ){
1099 fossil_print("\n"
1100 " This settings are the names of files that contain the certificate\n"
1101 " private-key used by Fossil when it is acting as a server.\n\n"
1102 );
1103 }
1104
1105 db_prepare(&q,
@@ -1165,11 +1165,11 @@
1165 db_commit_transaction();
1166 blob_reset(&sql);
1167 }else
1168 /*default*/{
1169 fossil_fatal("unknown sub-command \"%s\".\nshould be one of:"
1170 " clear-cert load-cert remove-exception scrub show",
1171 zCmd);
1172 }
1173 }
1174
1175 /*
1176
+8 -14
--- src/interwiki.c
+++ src/interwiki.c
@@ -83,14 +83,12 @@
8383
nCode = i;
8484
if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
8585
zPage = zTarget + nCode + 1;
8686
nPage = (int)strlen(zPage);
8787
db_static_prepare(&q,
88
- "SELECT json_extract(value,'$.base'),"
89
- " json_extract(value,'$.hash'),"
90
- " json_extract(value,'$.wiki')"
91
- " FROM config WHERE name=lower($name)"
88
+ "SELECT value->>'base', value->>'hash', value->>'wiki'"
89
+ " FROM config WHERE name=lower($name) AND json_valid(value)"
9290
);
9391
zName = mprintf("interwiki:%.*s", nCode, zTarget);
9492
db_bind_text(&q, "$name", zName);
9593
while( db_step(&q)==SQLITE_ROW ){
9694
const char *zBase = db_column_text(&q,0);
@@ -238,14 +236,12 @@
238236
Stmt q;
239237
int n = 0;
240238
verify_all_options();
241239
db_prepare(&q,
242240
"SELECT substr(name,11),"
243
- " json_extract(value,'$.base'),"
244
- " json_extract(value,'$.hash'),"
245
- " json_extract(value,'$.wiki')"
246
- " FROM config WHERE name glob 'interwiki:*'"
241
+ " value->>'base', value->>'hash', value->>'wiki'"
242
+ " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
247243
);
248244
while( db_step(&q)==SQLITE_ROW ){
249245
const char *zBase, *z, *zName;
250246
if( n++ ) fossil_print("\n");
251247
zName = db_column_text(&q,0);
@@ -275,12 +271,12 @@
275271
*/
276272
void interwiki_append_map_table(Blob *out){
277273
int n = 0;
278274
Stmt q;
279275
db_prepare(&q,
280
- "SELECT substr(name,11), json_extract(value,'$.base')"
281
- " FROM config WHERE name glob 'interwiki:*'"
276
+ "SELECT substr(name,11), value->>'base'"
277
+ " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
282278
" ORDER BY name;"
283279
);
284280
while( db_step(&q)==SQLITE_ROW ){
285281
if( n==0 ){
286282
blob_appendf(out, "<blockquote><table>\n");
@@ -352,14 +348,12 @@
352348
@ <p>Such links resolve to links to <i>PageName</i> on a separate server
353349
@ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
354350
@ from <i>Tags</i> to complete Server URLs.
355351
db_prepare(&q,
356352
"SELECT substr(name,11),"
357
- " json_extract(value,'$.base'),"
358
- " json_extract(value,'$.hash'),"
359
- " json_extract(value,'$.wiki')"
360
- " FROM config WHERE name glob 'interwiki:*'"
353
+ " value->>'base', value->>'hash', value->>'wiki'"
354
+ " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
361355
);
362356
while( db_step(&q)==SQLITE_ROW ){
363357
if( n==0 ){
364358
@ The current mapping is as follows:
365359
@ <ol>
366360
--- src/interwiki.c
+++ src/interwiki.c
@@ -83,14 +83,12 @@
83 nCode = i;
84 if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
85 zPage = zTarget + nCode + 1;
86 nPage = (int)strlen(zPage);
87 db_static_prepare(&q,
88 "SELECT json_extract(value,'$.base'),"
89 " json_extract(value,'$.hash'),"
90 " json_extract(value,'$.wiki')"
91 " FROM config WHERE name=lower($name)"
92 );
93 zName = mprintf("interwiki:%.*s", nCode, zTarget);
94 db_bind_text(&q, "$name", zName);
95 while( db_step(&q)==SQLITE_ROW ){
96 const char *zBase = db_column_text(&q,0);
@@ -238,14 +236,12 @@
238 Stmt q;
239 int n = 0;
240 verify_all_options();
241 db_prepare(&q,
242 "SELECT substr(name,11),"
243 " json_extract(value,'$.base'),"
244 " json_extract(value,'$.hash'),"
245 " json_extract(value,'$.wiki')"
246 " FROM config WHERE name glob 'interwiki:*'"
247 );
248 while( db_step(&q)==SQLITE_ROW ){
249 const char *zBase, *z, *zName;
250 if( n++ ) fossil_print("\n");
251 zName = db_column_text(&q,0);
@@ -275,12 +271,12 @@
275 */
276 void interwiki_append_map_table(Blob *out){
277 int n = 0;
278 Stmt q;
279 db_prepare(&q,
280 "SELECT substr(name,11), json_extract(value,'$.base')"
281 " FROM config WHERE name glob 'interwiki:*'"
282 " ORDER BY name;"
283 );
284 while( db_step(&q)==SQLITE_ROW ){
285 if( n==0 ){
286 blob_appendf(out, "<blockquote><table>\n");
@@ -352,14 +348,12 @@
352 @ <p>Such links resolve to links to <i>PageName</i> on a separate server
353 @ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
354 @ from <i>Tags</i> to complete Server URLs.
355 db_prepare(&q,
356 "SELECT substr(name,11),"
357 " json_extract(value,'$.base'),"
358 " json_extract(value,'$.hash'),"
359 " json_extract(value,'$.wiki')"
360 " FROM config WHERE name glob 'interwiki:*'"
361 );
362 while( db_step(&q)==SQLITE_ROW ){
363 if( n==0 ){
364 @ The current mapping is as follows:
365 @ <ol>
366
--- src/interwiki.c
+++ src/interwiki.c
@@ -83,14 +83,12 @@
83 nCode = i;
84 if( nCode==4 && strncmp(zTarget,"wiki",4)==0 ) return 0;
85 zPage = zTarget + nCode + 1;
86 nPage = (int)strlen(zPage);
87 db_static_prepare(&q,
88 "SELECT value->>'base', value->>'hash', value->>'wiki'"
89 " FROM config WHERE name=lower($name) AND json_valid(value)"
 
 
90 );
91 zName = mprintf("interwiki:%.*s", nCode, zTarget);
92 db_bind_text(&q, "$name", zName);
93 while( db_step(&q)==SQLITE_ROW ){
94 const char *zBase = db_column_text(&q,0);
@@ -238,14 +236,12 @@
236 Stmt q;
237 int n = 0;
238 verify_all_options();
239 db_prepare(&q,
240 "SELECT substr(name,11),"
241 " value->>'base', value->>'hash', value->>'wiki'"
242 " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
 
 
243 );
244 while( db_step(&q)==SQLITE_ROW ){
245 const char *zBase, *z, *zName;
246 if( n++ ) fossil_print("\n");
247 zName = db_column_text(&q,0);
@@ -275,12 +271,12 @@
271 */
272 void interwiki_append_map_table(Blob *out){
273 int n = 0;
274 Stmt q;
275 db_prepare(&q,
276 "SELECT substr(name,11), value->>'base'"
277 " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
278 " ORDER BY name;"
279 );
280 while( db_step(&q)==SQLITE_ROW ){
281 if( n==0 ){
282 blob_appendf(out, "<blockquote><table>\n");
@@ -352,14 +348,12 @@
348 @ <p>Such links resolve to links to <i>PageName</i> on a separate server
349 @ identified by <i>Tag</i>. The Interwiki Map or "intermap" is a mapping
350 @ from <i>Tags</i> to complete Server URLs.
351 db_prepare(&q,
352 "SELECT substr(name,11),"
353 " value->>'base', value->>'hash', value->>'wiki'"
354 " FROM config WHERE name glob 'interwiki:*' AND json_valid(value)"
 
 
355 );
356 while( db_step(&q)==SQLITE_ROW ){
357 if( n==0 ){
358 @ The current mapping is as follows:
359 @ <ol>
360
+12 -2
--- src/main.c
+++ src/main.c
@@ -697,12 +697,14 @@
697697
fossil_limit_memory(1);
698698
699699
/* When updating the minimum SQLite version, change the number here,
700700
** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
701701
** care that both places agree! */
702
- if( sqlite3_libversion_number()<3037000 ){
703
- fossil_panic("Unsuitable SQLite version %s, must be at least 3.37.0",
702
+ if( sqlite3_libversion_number()<3038000
703
+ || strncmp(sqlite3_sourceid(),"2022-01-12",10)<0
704
+ ){
705
+ fossil_panic("Unsuitable SQLite version %s, must be at least 3.38.0",
704706
sqlite3_libversion());
705707
}
706708
707709
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
708710
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
@@ -1446,10 +1448,18 @@
14461448
14471449
/*
14481450
** Send an HTTP redirect back to the designated Index Page.
14491451
*/
14501452
NORETURN void fossil_redirect_home(void){
1453
+ /* In order for ?skin=... to work when visiting the site from
1454
+ ** a typical external link, we have to process is here, as
1455
+ ** that parameter gets lost during the redirect. We "could"
1456
+ ** pass the whole query string along instead, but that seems
1457
+ ** unnecessary. */
1458
+ if(cgi_setup_query_string()>1){
1459
+ cookie_render();
1460
+ }
14511461
cgi_redirectf("%R%s", db_get("index-page", "/index"));
14521462
}
14531463
14541464
/*
14551465
** If running as root, chroot to the directory containing the
14561466
--- src/main.c
+++ src/main.c
@@ -697,12 +697,14 @@
697 fossil_limit_memory(1);
698
699 /* When updating the minimum SQLite version, change the number here,
700 ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
701 ** care that both places agree! */
702 if( sqlite3_libversion_number()<3037000 ){
703 fossil_panic("Unsuitable SQLite version %s, must be at least 3.37.0",
 
 
704 sqlite3_libversion());
705 }
706
707 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
708 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
@@ -1446,10 +1448,18 @@
1446
1447 /*
1448 ** Send an HTTP redirect back to the designated Index Page.
1449 */
1450 NORETURN void fossil_redirect_home(void){
 
 
 
 
 
 
 
 
1451 cgi_redirectf("%R%s", db_get("index-page", "/index"));
1452 }
1453
1454 /*
1455 ** If running as root, chroot to the directory containing the
1456
--- src/main.c
+++ src/main.c
@@ -697,12 +697,14 @@
697 fossil_limit_memory(1);
698
699 /* When updating the minimum SQLite version, change the number here,
700 ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
701 ** care that both places agree! */
702 if( sqlite3_libversion_number()<3038000
703 || strncmp(sqlite3_sourceid(),"2022-01-12",10)<0
704 ){
705 fossil_panic("Unsuitable SQLite version %s, must be at least 3.38.0",
706 sqlite3_libversion());
707 }
708
709 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
710 sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
@@ -1446,10 +1448,18 @@
1448
1449 /*
1450 ** Send an HTTP redirect back to the designated Index Page.
1451 */
1452 NORETURN void fossil_redirect_home(void){
1453 /* In order for ?skin=... to work when visiting the site from
1454 ** a typical external link, we have to process is here, as
1455 ** that parameter gets lost during the redirect. We "could"
1456 ** pass the whole query string along instead, but that seems
1457 ** unnecessary. */
1458 if(cgi_setup_query_string()>1){
1459 cookie_render();
1460 }
1461 cgi_redirectf("%R%s", db_get("index-page", "/index"));
1462 }
1463
1464 /*
1465 ** If running as root, chroot to the directory containing the
1466
+6 -1
--- src/merge.c
+++ src/merge.c
@@ -274,20 +274,22 @@
274274
}
275275
276276
277277
/*
278278
** COMMAND: merge
279
+** COMMAND: cherry-pick
279280
**
280281
** Usage: %fossil merge ?OPTIONS? ?VERSION?
281282
**
282283
** The argument VERSION is a version that should be merged into the
283284
** current checkout. All changes from VERSION back to the nearest
284285
** common ancestor are merged. Except, if either of the --cherrypick or
285286
** --backout options are used only the changes associated with the
286287
** single check-in VERSION are merged. The --backout option causes
287288
** the changes associated with VERSION to be removed from the current
288
-** checkout rather than added.
289
+** checkout rather than added. When invoked with the name cherry-pick,
290
+** this command works exactly like merge --cherrypick.
289291
**
290292
** If the VERSION argument is omitted, then Fossil attempts to find
291293
** a recent fork on the current branch to merge.
292294
**
293295
** Only file content is merged. The result continues to use the
@@ -364,10 +366,13 @@
364366
forceMissingFlag = find_option("force-missing",0,0)!=0;
365367
if( !verboseFlag ){
366368
verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
367369
}
368370
pickFlag = find_option("cherrypick",0,0)!=0;
371
+ if('c'==*g.zCmdName/*called as cherry-pick, possibly a short form*/){
372
+ pickFlag = 1;
373
+ }
369374
integrateFlag = find_option("integrate",0,0)!=0;
370375
backoutFlag = find_option("backout",0,0)!=0;
371376
zBinGlob = find_option("binary",0,1);
372377
dryRunFlag = find_option("dry-run","n",0)!=0;
373378
if( !dryRunFlag ){
374379
--- src/merge.c
+++ src/merge.c
@@ -274,20 +274,22 @@
274 }
275
276
277 /*
278 ** COMMAND: merge
 
279 **
280 ** Usage: %fossil merge ?OPTIONS? ?VERSION?
281 **
282 ** The argument VERSION is a version that should be merged into the
283 ** current checkout. All changes from VERSION back to the nearest
284 ** common ancestor are merged. Except, if either of the --cherrypick or
285 ** --backout options are used only the changes associated with the
286 ** single check-in VERSION are merged. The --backout option causes
287 ** the changes associated with VERSION to be removed from the current
288 ** checkout rather than added.
 
289 **
290 ** If the VERSION argument is omitted, then Fossil attempts to find
291 ** a recent fork on the current branch to merge.
292 **
293 ** Only file content is merged. The result continues to use the
@@ -364,10 +366,13 @@
364 forceMissingFlag = find_option("force-missing",0,0)!=0;
365 if( !verboseFlag ){
366 verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
367 }
368 pickFlag = find_option("cherrypick",0,0)!=0;
 
 
 
369 integrateFlag = find_option("integrate",0,0)!=0;
370 backoutFlag = find_option("backout",0,0)!=0;
371 zBinGlob = find_option("binary",0,1);
372 dryRunFlag = find_option("dry-run","n",0)!=0;
373 if( !dryRunFlag ){
374
--- src/merge.c
+++ src/merge.c
@@ -274,20 +274,22 @@
274 }
275
276
277 /*
278 ** COMMAND: merge
279 ** COMMAND: cherry-pick
280 **
281 ** Usage: %fossil merge ?OPTIONS? ?VERSION?
282 **
283 ** The argument VERSION is a version that should be merged into the
284 ** current checkout. All changes from VERSION back to the nearest
285 ** common ancestor are merged. Except, if either of the --cherrypick or
286 ** --backout options are used only the changes associated with the
287 ** single check-in VERSION are merged. The --backout option causes
288 ** the changes associated with VERSION to be removed from the current
289 ** checkout rather than added. When invoked with the name cherry-pick,
290 ** this command works exactly like merge --cherrypick.
291 **
292 ** If the VERSION argument is omitted, then Fossil attempts to find
293 ** a recent fork on the current branch to merge.
294 **
295 ** Only file content is merged. The result continues to use the
@@ -364,10 +366,13 @@
366 forceMissingFlag = find_option("force-missing",0,0)!=0;
367 if( !verboseFlag ){
368 verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
369 }
370 pickFlag = find_option("cherrypick",0,0)!=0;
371 if('c'==*g.zCmdName/*called as cherry-pick, possibly a short form*/){
372 pickFlag = 1;
373 }
374 integrateFlag = find_option("integrate",0,0)!=0;
375 backoutFlag = find_option("backout",0,0)!=0;
376 zBinGlob = find_option("binary",0,1);
377 dryRunFlag = find_option("dry-run","n",0)!=0;
378 if( !dryRunFlag ){
379
+58 -10
--- src/rebuild.c
+++ src/rebuild.c
@@ -745,33 +745,80 @@
745745
fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal);
746746
}
747747
}
748748
749749
/*
750
-** COMMAND: test-detach
751
-**
752
-** Usage: %fossil test-detach ?REPOSITORY?
753
-**
754
-** Change the project-code and make other changes in order to prevent
755
-** the repository from ever again pushing or pulling to other
756
-** repositories. Used to create a "test" repository for development
757
-** testing by cloning a working project repository.
750
+** COMMAND: detach*
751
+**
752
+** Usage: %fossil detach ?REPOSITORY?
753
+**
754
+** Change the project-code and make other changes to REPOSITORY so that
755
+** it becomes a new and distinct child project. After being detached,
756
+** REPOSITORY will not longer be able to push and pull from other clones
757
+** of the original project. However REPOSITORY will still be able to pull
758
+** from those other clones using the --from-parent-project option of the
759
+** "fossil pull" command.
760
+**
761
+** This is an experts-only command. You should not use this command unless
762
+** you fully understand what you are doing.
763
+**
764
+** The original use-case for this command was to create test repositories
765
+** from real-world working repositories that could be safely altered by
766
+** making strange commits or other changes, without having to worry that
767
+** those test changes would leak back into the original project via an
768
+** accidental auto-sync.
758769
*/
759770
void test_detach_cmd(void){
771
+ const char *zXfer[] = {
772
+ "project-name", "parent-project-name",
773
+ "project-code", "parent-project-code",
774
+ "last-sync-url", "parent-project-url",
775
+ "last-sync-pw", "parent-project-pw"
776
+ };
777
+ int i;
778
+ Blob ans;
779
+ char cReply;
760780
db_find_and_open_repository(0, 2);
781
+ prompt_user("This change will be difficult to undo. Are you sure (y/N)? ",
782
+ &ans);
783
+ cReply = blob_str(&ans)[0];
784
+ if( cReply!='y' && cReply!='Y' ) return;
761785
db_begin_transaction();
762786
db_unprotect(PROTECT_CONFIG);
787
+ for(i=0; i<ArraySize(zXfer)-1; i+=2 ){
788
+ db_multi_exec(
789
+ "REPLACE INTO config(name,value,mtime)"
790
+ " SELECT %Q, value, now() FROM config WHERE name=%Q",
791
+ zXfer[i+1], zXfer[i]
792
+ );
793
+ }
763794
db_multi_exec(
764
- "DELETE FROM config WHERE name GLOB 'last-sync-*';"
765
- "DELETE FROM config WHERE name GLOB 'sync-*:*';"
795
+ "DELETE FROM config WHERE name IN"
796
+ "(WITH pattern(x) AS (VALUES"
797
+ " ('baseurl:*'),"
798
+ " ('cert:*'),"
799
+ " ('ckout:*'),"
800
+ " ('gitpush:*'),"
801
+ " ('http-auth:*'),"
802
+ " ('last-sync-*'),"
803
+ " ('link:*'),"
804
+ " ('login-group-*'),"
805
+ " ('peer-*'),"
806
+ " ('subrepo:*'),"
807
+ " ('sync-*'),"
808
+ " ('syncfrom:*'),"
809
+ " ('syncwith:*'),"
810
+ " ('ssl-*')"
811
+ ") SELECT name FROM config, pattern WHERE name GLOB x);"
766812
"UPDATE config SET value=lower(hex(randomblob(20)))"
767813
" WHERE name='project-code';"
768814
"UPDATE config SET value='detached-' || value"
769815
" WHERE name='project-name' AND value NOT GLOB 'detached-*';"
770816
);
771817
db_protect_pop();
772818
db_end_transaction(0);
819
+ fossil_print("New project code: %s\n", db_get("project-code",""));
773820
}
774821
775822
/*
776823
** COMMAND: test-create-clusters
777824
**
@@ -929,10 +976,11 @@
929976
" ('gitpush:*'),"
930977
" ('http-auth:*'),"
931978
" ('last-sync-*'),"
932979
" ('link:*'),"
933980
" ('login-group-*'),"
981
+ " ('parent-project-*'),"
934982
" ('peer-*'),"
935983
" ('skin:*'),"
936984
" ('subrepo:*'),"
937985
" ('sync-*'),"
938986
" ('syncfrom:*'),"
939987
--- src/rebuild.c
+++ src/rebuild.c
@@ -745,33 +745,80 @@
745 fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal);
746 }
747 }
748
749 /*
750 ** COMMAND: test-detach
751 **
752 ** Usage: %fossil test-detach ?REPOSITORY?
753 **
754 ** Change the project-code and make other changes in order to prevent
755 ** the repository from ever again pushing or pulling to other
756 ** repositories. Used to create a "test" repository for development
757 ** testing by cloning a working project repository.
 
 
 
 
 
 
 
 
 
 
 
758 */
759 void test_detach_cmd(void){
 
 
 
 
 
 
 
 
 
760 db_find_and_open_repository(0, 2);
 
 
 
 
761 db_begin_transaction();
762 db_unprotect(PROTECT_CONFIG);
 
 
 
 
 
 
 
763 db_multi_exec(
764 "DELETE FROM config WHERE name GLOB 'last-sync-*';"
765 "DELETE FROM config WHERE name GLOB 'sync-*:*';"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766 "UPDATE config SET value=lower(hex(randomblob(20)))"
767 " WHERE name='project-code';"
768 "UPDATE config SET value='detached-' || value"
769 " WHERE name='project-name' AND value NOT GLOB 'detached-*';"
770 );
771 db_protect_pop();
772 db_end_transaction(0);
 
773 }
774
775 /*
776 ** COMMAND: test-create-clusters
777 **
@@ -929,10 +976,11 @@
929 " ('gitpush:*'),"
930 " ('http-auth:*'),"
931 " ('last-sync-*'),"
932 " ('link:*'),"
933 " ('login-group-*'),"
 
934 " ('peer-*'),"
935 " ('skin:*'),"
936 " ('subrepo:*'),"
937 " ('sync-*'),"
938 " ('syncfrom:*'),"
939
--- src/rebuild.c
+++ src/rebuild.c
@@ -745,33 +745,80 @@
745 fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal);
746 }
747 }
748
749 /*
750 ** COMMAND: detach*
751 **
752 ** Usage: %fossil detach ?REPOSITORY?
753 **
754 ** Change the project-code and make other changes to REPOSITORY so that
755 ** it becomes a new and distinct child project. After being detached,
756 ** REPOSITORY will not longer be able to push and pull from other clones
757 ** of the original project. However REPOSITORY will still be able to pull
758 ** from those other clones using the --from-parent-project option of the
759 ** "fossil pull" command.
760 **
761 ** This is an experts-only command. You should not use this command unless
762 ** you fully understand what you are doing.
763 **
764 ** The original use-case for this command was to create test repositories
765 ** from real-world working repositories that could be safely altered by
766 ** making strange commits or other changes, without having to worry that
767 ** those test changes would leak back into the original project via an
768 ** accidental auto-sync.
769 */
770 void test_detach_cmd(void){
771 const char *zXfer[] = {
772 "project-name", "parent-project-name",
773 "project-code", "parent-project-code",
774 "last-sync-url", "parent-project-url",
775 "last-sync-pw", "parent-project-pw"
776 };
777 int i;
778 Blob ans;
779 char cReply;
780 db_find_and_open_repository(0, 2);
781 prompt_user("This change will be difficult to undo. Are you sure (y/N)? ",
782 &ans);
783 cReply = blob_str(&ans)[0];
784 if( cReply!='y' && cReply!='Y' ) return;
785 db_begin_transaction();
786 db_unprotect(PROTECT_CONFIG);
787 for(i=0; i<ArraySize(zXfer)-1; i+=2 ){
788 db_multi_exec(
789 "REPLACE INTO config(name,value,mtime)"
790 " SELECT %Q, value, now() FROM config WHERE name=%Q",
791 zXfer[i+1], zXfer[i]
792 );
793 }
794 db_multi_exec(
795 "DELETE FROM config WHERE name IN"
796 "(WITH pattern(x) AS (VALUES"
797 " ('baseurl:*'),"
798 " ('cert:*'),"
799 " ('ckout:*'),"
800 " ('gitpush:*'),"
801 " ('http-auth:*'),"
802 " ('last-sync-*'),"
803 " ('link:*'),"
804 " ('login-group-*'),"
805 " ('peer-*'),"
806 " ('subrepo:*'),"
807 " ('sync-*'),"
808 " ('syncfrom:*'),"
809 " ('syncwith:*'),"
810 " ('ssl-*')"
811 ") SELECT name FROM config, pattern WHERE name GLOB x);"
812 "UPDATE config SET value=lower(hex(randomblob(20)))"
813 " WHERE name='project-code';"
814 "UPDATE config SET value='detached-' || value"
815 " WHERE name='project-name' AND value NOT GLOB 'detached-*';"
816 );
817 db_protect_pop();
818 db_end_transaction(0);
819 fossil_print("New project code: %s\n", db_get("project-code",""));
820 }
821
822 /*
823 ** COMMAND: test-create-clusters
824 **
@@ -929,10 +976,11 @@
976 " ('gitpush:*'),"
977 " ('http-auth:*'),"
978 " ('last-sync-*'),"
979 " ('link:*'),"
980 " ('login-group-*'),"
981 " ('parent-project-*'),"
982 " ('peer-*'),"
983 " ('skin:*'),"
984 " ('subrepo:*'),"
985 " ('sync-*'),"
986 " ('syncfrom:*'),"
987
+1 -1
--- src/repolist.c
+++ src/repolist.c
@@ -256,11 +256,11 @@
256256
db_open_repository(zSkinRepo);
257257
fossil_free(zSkinRepo);
258258
fossil_free(zSkinUrl);
259259
}
260260
if( g.repositoryOpen ){
261
- /* This case runs if remote_repository_info() found a repository
261
+ /* This case runs if remote_repo_info() found a repository
262262
** that has the "repolist_skin" property set to non-zero and left
263263
** that repository open in g.db. Use the skin of that repository
264264
** for display. */
265265
login_check_credentials();
266266
style_set_current_feature("repolist");
267267
--- src/repolist.c
+++ src/repolist.c
@@ -256,11 +256,11 @@
256 db_open_repository(zSkinRepo);
257 fossil_free(zSkinRepo);
258 fossil_free(zSkinUrl);
259 }
260 if( g.repositoryOpen ){
261 /* This case runs if remote_repository_info() found a repository
262 ** that has the "repolist_skin" property set to non-zero and left
263 ** that repository open in g.db. Use the skin of that repository
264 ** for display. */
265 login_check_credentials();
266 style_set_current_feature("repolist");
267
--- src/repolist.c
+++ src/repolist.c
@@ -256,11 +256,11 @@
256 db_open_repository(zSkinRepo);
257 fossil_free(zSkinRepo);
258 fossil_free(zSkinUrl);
259 }
260 if( g.repositoryOpen ){
261 /* This case runs if remote_repo_info() found a repository
262 ** that has the "repolist_skin" property set to non-zero and left
263 ** that repository open in g.db. Use the skin of that repository
264 ** for display. */
265 login_check_credentials();
266 style_set_current_feature("repolist");
267
+2 -2
--- src/stat.c
+++ src/stat.c
@@ -609,12 +609,12 @@
609609
cnt = 0;
610610
db_prepare(&q,
611611
"SELECT"
612612
" substr(name,6),"
613613
" datetime(mtime,'unixepoch'),"
614
- " json_extract(value,'$.type'),"
615
- " json_extract(value,'$.src')\n"
614
+ " value->>'type',"
615
+ " value->>'src'\n"
616616
"FROM config\n"
617617
"WHERE name GLOB 'link:*'\n"
618618
"AND json_valid(value)\n"
619619
"ORDER BY 4, 2 DESC"
620620
);
621621
--- src/stat.c
+++ src/stat.c
@@ -609,12 +609,12 @@
609 cnt = 0;
610 db_prepare(&q,
611 "SELECT"
612 " substr(name,6),"
613 " datetime(mtime,'unixepoch'),"
614 " json_extract(value,'$.type'),"
615 " json_extract(value,'$.src')\n"
616 "FROM config\n"
617 "WHERE name GLOB 'link:*'\n"
618 "AND json_valid(value)\n"
619 "ORDER BY 4, 2 DESC"
620 );
621
--- src/stat.c
+++ src/stat.c
@@ -609,12 +609,12 @@
609 cnt = 0;
610 db_prepare(&q,
611 "SELECT"
612 " substr(name,6),"
613 " datetime(mtime,'unixepoch'),"
614 " value->>'type',"
615 " value->>'src'\n"
616 "FROM config\n"
617 "WHERE name GLOB 'link:*'\n"
618 "AND json_valid(value)\n"
619 "ORDER BY 4, 2 DESC"
620 );
621
+1 -1
--- src/sync.c
+++ src/sync.c
@@ -208,11 +208,11 @@
208208
urlOptional = 1;
209209
urlFlags = 0;
210210
}
211211
zHttpAuth = find_option("httpauth","B",1);
212212
if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER;
213
- if( (*pSyncFlags) & SYNC_FROMPARENT ) urlFlags &= ~URL_REMEMBER;
213
+ if( (*pSyncFlags) & SYNC_FROMPARENT ) urlFlags |= URL_USE_PARENT;
214214
if( !uvOnly ){
215215
if( find_option("private",0,0)!=0 ){
216216
*pSyncFlags |= SYNC_PRIVATE;
217217
}
218218
/* The --verily option to sync, push, and pull forces extra igot cards
219219
--- src/sync.c
+++ src/sync.c
@@ -208,11 +208,11 @@
208 urlOptional = 1;
209 urlFlags = 0;
210 }
211 zHttpAuth = find_option("httpauth","B",1);
212 if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER;
213 if( (*pSyncFlags) & SYNC_FROMPARENT ) urlFlags &= ~URL_REMEMBER;
214 if( !uvOnly ){
215 if( find_option("private",0,0)!=0 ){
216 *pSyncFlags |= SYNC_PRIVATE;
217 }
218 /* The --verily option to sync, push, and pull forces extra igot cards
219
--- src/sync.c
+++ src/sync.c
@@ -208,11 +208,11 @@
208 urlOptional = 1;
209 urlFlags = 0;
210 }
211 zHttpAuth = find_option("httpauth","B",1);
212 if( find_option("once",0,0)!=0 ) urlFlags &= ~URL_REMEMBER;
213 if( (*pSyncFlags) & SYNC_FROMPARENT ) urlFlags |= URL_USE_PARENT;
214 if( !uvOnly ){
215 if( find_option("private",0,0)!=0 ){
216 *pSyncFlags |= SYNC_PRIVATE;
217 }
218 /* The --verily option to sync, push, and pull forces extra igot cards
219
+1 -1
--- src/th_main.c
+++ src/th_main.c
@@ -847,11 +847,11 @@
847847
}else if( azCap[i][0]=='*' ){
848848
rc = 1;
849849
}else{
850850
rc = login_has_capability(azCap[i], anCap[i], 0);
851851
}
852
- break;
852
+ if( rc ) break;
853853
}
854854
Th_Free(interp, azCap);
855855
Th_SetResultInt(interp, rc);
856856
return TH_OK;
857857
}
858858
--- src/th_main.c
+++ src/th_main.c
@@ -847,11 +847,11 @@
847 }else if( azCap[i][0]=='*' ){
848 rc = 1;
849 }else{
850 rc = login_has_capability(azCap[i], anCap[i], 0);
851 }
852 break;
853 }
854 Th_Free(interp, azCap);
855 Th_SetResultInt(interp, rc);
856 return TH_OK;
857 }
858
--- src/th_main.c
+++ src/th_main.c
@@ -847,11 +847,11 @@
847 }else if( azCap[i][0]=='*' ){
848 rc = 1;
849 }else{
850 rc = login_has_capability(azCap[i], anCap[i], 0);
851 }
852 if( rc ) break;
853 }
854 Th_Free(interp, azCap);
855 Th_SetResultInt(interp, rc);
856 return TH_OK;
857 }
858
--- src/timeline.c
+++ src/timeline.c
@@ -1607,10 +1607,12 @@
16071607
** ym=YYYY-MM Show only events for the given year/month
16081608
** yw=YYYY-WW Show only events for the given week of the given year
16091609
** yw=YYYY-MM-DD Show events for the week that includes the given day
16101610
** ymd=YYYY-MM-DD Show only events on the given day. The use "ymd=now"
16111611
** to see all changes for the current week.
1612
+** year=YYYY Show only events on the given year. The use "year=0"
1613
+** to see all changes for the current year.
16121614
** days=N Show events over the previous N days
16131615
** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
16141616
** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
16151617
** bisect Show the check-ins that are in the current bisect
16161618
** showid Show RIDs
@@ -1618,10 +1620,14 @@
16181620
**
16191621
** p= and d= can appear individually or together. If either p= or d=
16201622
** appear, then u=, y=, a=, and b= are ignored.
16211623
**
16221624
** If both a= and b= appear then both upper and lower bounds are honored.
1625
+**
1626
+** When multiple time-related filters are used, e.g. ym, yw, and ymd,
1627
+** which one(s) is/are applied is unspecified and may change between
1628
+** fossil versions.
16231629
**
16241630
** CHECKIN or TIMEORTAG can be a check-in hash prefix, or a tag, or the
16251631
** name of a branch.
16261632
*/
16271633
void page_timeline(void){
@@ -1650,10 +1656,11 @@
16501656
const char *zUses = P("uf"); /* Only show check-ins hold this file */
16511657
const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
16521658
const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
16531659
char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
16541660
const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1661
+ const char *zYear = P("year"); /* Events for the year YYYY */
16551662
const char *zNDays = P("days"); /* Show events over the previous N days */
16561663
int nDays = 0; /* Numeric value for zNDays */
16571664
const char *zChng = P("chng"); /* List of GLOBs for files that changed */
16581665
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
16591666
int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
@@ -2315,10 +2322,48 @@
23152322
nDays = atoi(zNDays);
23162323
if( nDays<1 ) nDays = 1;
23172324
blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ",
23182325
nDays);
23192326
nEntry = -1;
2327
+ }
2328
+ else if( zYear &&
2329
+ ((4==strlen(zYear) && atoi(zYear)>1900)
2330
+ || (1==strlen(zYear) && 0==atoi(zYear)))){
2331
+ int year = atoi(zYear);
2332
+ char *zNext = 0;
2333
+ if(0==year){/*use current year*/
2334
+ Stmt qy;
2335
+ db_prepare(&qy, "SELECT strftime('%%Y','now')");
2336
+ db_step(&qy);
2337
+ year = db_column_int(&qy, 0);
2338
+ zYear = fossil_strdup(db_column_text(&qy, 0));
2339
+ db_finalize(&qy);
2340
+ }else{
2341
+ zNext = mprintf("%d", year+1);
2342
+ if( db_int(0,
2343
+ "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
2344
+ " WHERE blob.rid=event.objid AND strftime('%%Y',mtime)=%Q %s)",
2345
+ zNext, blob_sql_text(&cond))
2346
+ ){
2347
+ zNewerButton = fossil_strdup(url_render(&url, "year", zNext, 0, 0));
2348
+ zNewerButtonLabel = "Following year";
2349
+ }
2350
+ fossil_free(zNext);
2351
+ }
2352
+ zNext = mprintf("%d", year-1);
2353
+ if( db_int(0,
2354
+ "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
2355
+ " WHERE blob.rid=event.objid AND strftime('%%Y',mtime)=%Q %s)",
2356
+ zNext, blob_sql_text(&cond))
2357
+ ){
2358
+ zOlderButton = fossil_strdup(url_render(&url, "year", zNext, 0, 0));
2359
+ zOlderButtonLabel = "Previous year";
2360
+ }
2361
+ fossil_free(zNext);
2362
+ blob_append_sql(&cond, " AND %Q=strftime('%%Y',event.mtime) ",
2363
+ zYear);
2364
+ nEntry = -1;
23202365
}
23212366
if( zTagSql ){
23222367
db_multi_exec(
23232368
"CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);"
23242369
"INSERT OR IGNORE INTO selected_nodes"
23252370
--- src/timeline.c
+++ src/timeline.c
@@ -1607,10 +1607,12 @@
1607 ** ym=YYYY-MM Show only events for the given year/month
1608 ** yw=YYYY-WW Show only events for the given week of the given year
1609 ** yw=YYYY-MM-DD Show events for the week that includes the given day
1610 ** ymd=YYYY-MM-DD Show only events on the given day. The use "ymd=now"
1611 ** to see all changes for the current week.
 
 
1612 ** days=N Show events over the previous N days
1613 ** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
1614 ** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
1615 ** bisect Show the check-ins that are in the current bisect
1616 ** showid Show RIDs
@@ -1618,10 +1620,14 @@
1618 **
1619 ** p= and d= can appear individually or together. If either p= or d=
1620 ** appear, then u=, y=, a=, and b= are ignored.
1621 **
1622 ** If both a= and b= appear then both upper and lower bounds are honored.
 
 
 
 
1623 **
1624 ** CHECKIN or TIMEORTAG can be a check-in hash prefix, or a tag, or the
1625 ** name of a branch.
1626 */
1627 void page_timeline(void){
@@ -1650,10 +1656,11 @@
1650 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1651 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1652 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1653 char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
1654 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
 
1655 const char *zNDays = P("days"); /* Show events over the previous N days */
1656 int nDays = 0; /* Numeric value for zNDays */
1657 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1658 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1659 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
@@ -2315,10 +2322,48 @@
2315 nDays = atoi(zNDays);
2316 if( nDays<1 ) nDays = 1;
2317 blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ",
2318 nDays);
2319 nEntry = -1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2320 }
2321 if( zTagSql ){
2322 db_multi_exec(
2323 "CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);"
2324 "INSERT OR IGNORE INTO selected_nodes"
2325
--- src/timeline.c
+++ src/timeline.c
@@ -1607,10 +1607,12 @@
1607 ** ym=YYYY-MM Show only events for the given year/month
1608 ** yw=YYYY-WW Show only events for the given week of the given year
1609 ** yw=YYYY-MM-DD Show events for the week that includes the given day
1610 ** ymd=YYYY-MM-DD Show only events on the given day. The use "ymd=now"
1611 ** to see all changes for the current week.
1612 ** year=YYYY Show only events on the given year. The use "year=0"
1613 ** to see all changes for the current year.
1614 ** days=N Show events over the previous N days
1615 ** datefmt=N Override the date format: 0=HH:MM, 1=HH:MM:SS,
1616 ** 2=YYYY-MM-DD HH:MM:SS, 3=YYMMDD HH:MM, and 4 means "off".
1617 ** bisect Show the check-ins that are in the current bisect
1618 ** showid Show RIDs
@@ -1618,10 +1620,14 @@
1620 **
1621 ** p= and d= can appear individually or together. If either p= or d=
1622 ** appear, then u=, y=, a=, and b= are ignored.
1623 **
1624 ** If both a= and b= appear then both upper and lower bounds are honored.
1625 **
1626 ** When multiple time-related filters are used, e.g. ym, yw, and ymd,
1627 ** which one(s) is/are applied is unspecified and may change between
1628 ** fossil versions.
1629 **
1630 ** CHECKIN or TIMEORTAG can be a check-in hash prefix, or a tag, or the
1631 ** name of a branch.
1632 */
1633 void page_timeline(void){
@@ -1650,10 +1656,11 @@
1656 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1657 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1658 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1659 char *zYearWeekStart = 0; /* YYYY-MM-DD for start of YYYY-WW */
1660 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1661 const char *zYear = P("year"); /* Events for the year YYYY */
1662 const char *zNDays = P("days"); /* Show events over the previous N days */
1663 int nDays = 0; /* Numeric value for zNDays */
1664 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1665 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1666 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
@@ -2315,10 +2322,48 @@
2322 nDays = atoi(zNDays);
2323 if( nDays<1 ) nDays = 1;
2324 blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ",
2325 nDays);
2326 nEntry = -1;
2327 }
2328 else if( zYear &&
2329 ((4==strlen(zYear) && atoi(zYear)>1900)
2330 || (1==strlen(zYear) && 0==atoi(zYear)))){
2331 int year = atoi(zYear);
2332 char *zNext = 0;
2333 if(0==year){/*use current year*/
2334 Stmt qy;
2335 db_prepare(&qy, "SELECT strftime('%%Y','now')");
2336 db_step(&qy);
2337 year = db_column_int(&qy, 0);
2338 zYear = fossil_strdup(db_column_text(&qy, 0));
2339 db_finalize(&qy);
2340 }else{
2341 zNext = mprintf("%d", year+1);
2342 if( db_int(0,
2343 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
2344 " WHERE blob.rid=event.objid AND strftime('%%Y',mtime)=%Q %s)",
2345 zNext, blob_sql_text(&cond))
2346 ){
2347 zNewerButton = fossil_strdup(url_render(&url, "year", zNext, 0, 0));
2348 zNewerButtonLabel = "Following year";
2349 }
2350 fossil_free(zNext);
2351 }
2352 zNext = mprintf("%d", year-1);
2353 if( db_int(0,
2354 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
2355 " WHERE blob.rid=event.objid AND strftime('%%Y',mtime)=%Q %s)",
2356 zNext, blob_sql_text(&cond))
2357 ){
2358 zOlderButton = fossil_strdup(url_render(&url, "year", zNext, 0, 0));
2359 zOlderButtonLabel = "Previous year";
2360 }
2361 fossil_free(zNext);
2362 blob_append_sql(&cond, " AND %Q=strftime('%%Y',event.mtime) ",
2363 zYear);
2364 nEntry = -1;
2365 }
2366 if( zTagSql ){
2367 db_multi_exec(
2368 "CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);"
2369 "INSERT OR IGNORE INTO selected_nodes"
2370
+32 -8
--- src/url.c
+++ src/url.c
@@ -40,10 +40,11 @@
4040
#define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */
4141
#define URL_REMEMBER_PW 0x008 /* Should remember pw */
4242
#define URL_PROMPTED 0x010 /* Prompted for PW already */
4343
#define URL_OMIT_USER 0x020 /* Omit the user name from URL */
4444
#define URL_USE_CONFIG 0x040 /* Use remembered URLs from CONFIG table */
45
+#define URL_USE_PARENT 0x080 /* Use the URL of the parent project */
4546
4647
/*
4748
** The URL related data used with this subsystem.
4849
*/
4950
struct UrlData {
@@ -85,14 +86,19 @@
8586
** user Userid.
8687
** passwd Password.
8788
** hostname HOST:PORT or just HOST if port is the default.
8889
** canonical The URL in canonical form, omitting the password
8990
**
90
-** If zUrl==0, then parse the URL store in last-sync-url and last-sync-pw
91
-** of the CONFIG table. Or if zUrl is a symbolic name, look up the URL
92
-** in sync-url:%Q and sync-pw:%Q elements of the CONFIG table. But only
93
-** use the CONFIG table alternatives if the URL_FROM_CONFIG flag is set.
91
+** If zUrl==0 and URL_USE_CONFIG is set, then parse the URL stored
92
+** in last-sync-url and last-sync-pw of the CONFIG table. Or if
93
+** URL_USE_PARENT is also set, then use parent-project-url and
94
+** parent-project-pw from the CONFIG table instead of last-sync-url
95
+** and last-sync-pw.
96
+**
97
+** If zUrl is a symbolic name and URL_USE_CONFIG is true, then look up
98
+** the URL in sync-url:%Q and sync-pw:%Q elements of the CONFIG table where
99
+** %Q is the symbolic name.
94100
**
95101
** This routine differs from url_parse() in that this routine stores the
96102
** results in pUrlData and does not change the values of global variables.
97103
** The url_parse() routine puts its result in g.url.
98104
*/
@@ -104,14 +110,24 @@
104110
int i, j, c;
105111
char *zFile = 0;
106112
107113
if( urlFlags & URL_USE_CONFIG ){
108114
if( zUrl==0 || strcmp(zUrl,"default")==0 ){
109
- zUrl = db_get("last-sync-url", 0);
115
+ const char *zPwConfig = "last-sync-pw";
116
+ if( urlFlags & URL_USE_PARENT ){
117
+ zUrl = db_get("parent-project-url", 0);
118
+ if( zUrl==0 ){
119
+ zUrl = db_get("last-sync-url",0);
120
+ }else{
121
+ zPwConfig = "parent-project-pw";
122
+ }
123
+ }else{
124
+ zUrl = db_get("last-sync-url", 0);
125
+ }
110126
if( zUrl==0 ) return;
111127
if( pUrlData->passwd==0 ){
112
- pUrlData->passwd = unobscure(db_get("last-sync-pw", 0));
128
+ pUrlData->passwd = unobscure(db_get(zPwConfig, 0));
113129
}
114130
pUrlData->isAlias = 1;
115131
}else{
116132
char *zKey = sqlite3_mprintf("sync-url:%q", zUrl);
117133
char *zAlt = db_get(zKey, 0);
@@ -706,13 +722,21 @@
706722
/*
707723
** Remember the URL and password if requested.
708724
*/
709725
void url_remember(void){
710726
if( g.url.flags & URL_REMEMBER ){
711
- db_set("last-sync-url", g.url.canonical, 0);
727
+ if( g.url.flags & URL_USE_PARENT ){
728
+ db_set("parent-project-url", g.url.canonical, 0);
729
+ }else{
730
+ db_set("last-sync-url", g.url.canonical, 0);
731
+ }
712732
if( g.url.user!=0 && g.url.passwd!=0 && ( g.url.flags & URL_REMEMBER_PW ) ){
713
- db_set("last-sync-pw", obscure(g.url.passwd), 0);
733
+ if( g.url.flags & URL_USE_PARENT ){
734
+ db_set("parent-project-pw", obscure(g.url.passwd), 0);
735
+ }else{
736
+ db_set("last-sync-pw", obscure(g.url.passwd), 0);
737
+ }
714738
}
715739
}
716740
}
717741
718742
/* Preemptively prompt for a password if a username is given in the
719743
--- src/url.c
+++ src/url.c
@@ -40,10 +40,11 @@
40 #define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */
41 #define URL_REMEMBER_PW 0x008 /* Should remember pw */
42 #define URL_PROMPTED 0x010 /* Prompted for PW already */
43 #define URL_OMIT_USER 0x020 /* Omit the user name from URL */
44 #define URL_USE_CONFIG 0x040 /* Use remembered URLs from CONFIG table */
 
45
46 /*
47 ** The URL related data used with this subsystem.
48 */
49 struct UrlData {
@@ -85,14 +86,19 @@
85 ** user Userid.
86 ** passwd Password.
87 ** hostname HOST:PORT or just HOST if port is the default.
88 ** canonical The URL in canonical form, omitting the password
89 **
90 ** If zUrl==0, then parse the URL store in last-sync-url and last-sync-pw
91 ** of the CONFIG table. Or if zUrl is a symbolic name, look up the URL
92 ** in sync-url:%Q and sync-pw:%Q elements of the CONFIG table. But only
93 ** use the CONFIG table alternatives if the URL_FROM_CONFIG flag is set.
 
 
 
 
 
94 **
95 ** This routine differs from url_parse() in that this routine stores the
96 ** results in pUrlData and does not change the values of global variables.
97 ** The url_parse() routine puts its result in g.url.
98 */
@@ -104,14 +110,24 @@
104 int i, j, c;
105 char *zFile = 0;
106
107 if( urlFlags & URL_USE_CONFIG ){
108 if( zUrl==0 || strcmp(zUrl,"default")==0 ){
109 zUrl = db_get("last-sync-url", 0);
 
 
 
 
 
 
 
 
 
 
110 if( zUrl==0 ) return;
111 if( pUrlData->passwd==0 ){
112 pUrlData->passwd = unobscure(db_get("last-sync-pw", 0));
113 }
114 pUrlData->isAlias = 1;
115 }else{
116 char *zKey = sqlite3_mprintf("sync-url:%q", zUrl);
117 char *zAlt = db_get(zKey, 0);
@@ -706,13 +722,21 @@
706 /*
707 ** Remember the URL and password if requested.
708 */
709 void url_remember(void){
710 if( g.url.flags & URL_REMEMBER ){
711 db_set("last-sync-url", g.url.canonical, 0);
 
 
 
 
712 if( g.url.user!=0 && g.url.passwd!=0 && ( g.url.flags & URL_REMEMBER_PW ) ){
713 db_set("last-sync-pw", obscure(g.url.passwd), 0);
 
 
 
 
714 }
715 }
716 }
717
718 /* Preemptively prompt for a password if a username is given in the
719
--- src/url.c
+++ src/url.c
@@ -40,10 +40,11 @@
40 #define URL_ASK_REMEMBER_PW 0x004 /* Ask whether to remember prompted pw */
41 #define URL_REMEMBER_PW 0x008 /* Should remember pw */
42 #define URL_PROMPTED 0x010 /* Prompted for PW already */
43 #define URL_OMIT_USER 0x020 /* Omit the user name from URL */
44 #define URL_USE_CONFIG 0x040 /* Use remembered URLs from CONFIG table */
45 #define URL_USE_PARENT 0x080 /* Use the URL of the parent project */
46
47 /*
48 ** The URL related data used with this subsystem.
49 */
50 struct UrlData {
@@ -85,14 +86,19 @@
86 ** user Userid.
87 ** passwd Password.
88 ** hostname HOST:PORT or just HOST if port is the default.
89 ** canonical The URL in canonical form, omitting the password
90 **
91 ** If zUrl==0 and URL_USE_CONFIG is set, then parse the URL stored
92 ** in last-sync-url and last-sync-pw of the CONFIG table. Or if
93 ** URL_USE_PARENT is also set, then use parent-project-url and
94 ** parent-project-pw from the CONFIG table instead of last-sync-url
95 ** and last-sync-pw.
96 **
97 ** If zUrl is a symbolic name and URL_USE_CONFIG is true, then look up
98 ** the URL in sync-url:%Q and sync-pw:%Q elements of the CONFIG table where
99 ** %Q is the symbolic name.
100 **
101 ** This routine differs from url_parse() in that this routine stores the
102 ** results in pUrlData and does not change the values of global variables.
103 ** The url_parse() routine puts its result in g.url.
104 */
@@ -104,14 +110,24 @@
110 int i, j, c;
111 char *zFile = 0;
112
113 if( urlFlags & URL_USE_CONFIG ){
114 if( zUrl==0 || strcmp(zUrl,"default")==0 ){
115 const char *zPwConfig = "last-sync-pw";
116 if( urlFlags & URL_USE_PARENT ){
117 zUrl = db_get("parent-project-url", 0);
118 if( zUrl==0 ){
119 zUrl = db_get("last-sync-url",0);
120 }else{
121 zPwConfig = "parent-project-pw";
122 }
123 }else{
124 zUrl = db_get("last-sync-url", 0);
125 }
126 if( zUrl==0 ) return;
127 if( pUrlData->passwd==0 ){
128 pUrlData->passwd = unobscure(db_get(zPwConfig, 0));
129 }
130 pUrlData->isAlias = 1;
131 }else{
132 char *zKey = sqlite3_mprintf("sync-url:%q", zUrl);
133 char *zAlt = db_get(zKey, 0);
@@ -706,13 +722,21 @@
722 /*
723 ** Remember the URL and password if requested.
724 */
725 void url_remember(void){
726 if( g.url.flags & URL_REMEMBER ){
727 if( g.url.flags & URL_USE_PARENT ){
728 db_set("parent-project-url", g.url.canonical, 0);
729 }else{
730 db_set("last-sync-url", g.url.canonical, 0);
731 }
732 if( g.url.user!=0 && g.url.passwd!=0 && ( g.url.flags & URL_REMEMBER_PW ) ){
733 if( g.url.flags & URL_USE_PARENT ){
734 db_set("parent-project-pw", obscure(g.url.passwd), 0);
735 }else{
736 db_set("last-sync-pw", obscure(g.url.passwd), 0);
737 }
738 }
739 }
740 }
741
742 /* Preemptively prompt for a password if a username is given in the
743
+6 -4
--- src/xfer.c
+++ src/xfer.c
@@ -1667,16 +1667,18 @@
16671667
Stmt q;
16681668
sqlite3_int64 iNow = time(0);
16691669
sqlite3_int64 maxAge = db_get_int("lock-timeout",60);
16701670
int seenFault = 0;
16711671
db_prepare(&q,
1672
- "SELECT json_extract(value,'$.login'),"
1672
+ "SELECT value->>'login',"
16731673
" mtime,"
1674
- " json_extract(value,'$.clientid'),"
1674
+ " value->>'clientid',"
16751675
" (SELECT rid FROM blob WHERE uuid=substr(name,9)),"
16761676
" name"
1677
- " FROM config WHERE name GLOB 'ci-lock-*'"
1677
+ " FROM config"
1678
+ " WHERE name GLOB 'ci-lock-*'"
1679
+ " AND json_valid(value)"
16781680
);
16791681
while( db_step(&q)==SQLITE_ROW ){
16801682
int x = db_column_int(&q,3);
16811683
const char *zName = db_column_text(&q,4);
16821684
if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
@@ -1725,11 +1727,11 @@
17251727
){
17261728
db_unprotect(PROTECT_CONFIG);
17271729
db_multi_exec(
17281730
"DELETE FROM config"
17291731
" WHERE name GLOB 'ci-lock-*'"
1730
- " AND json_extract(value,'$.clientid')=%Q",
1732
+ " AND (NOT json_valid(value) OR value->>'clientid'==%Q)",
17311733
blob_str(&xfer.aToken[2])
17321734
);
17331735
db_protect_pop();
17341736
}else
17351737
17361738
--- src/xfer.c
+++ src/xfer.c
@@ -1667,16 +1667,18 @@
1667 Stmt q;
1668 sqlite3_int64 iNow = time(0);
1669 sqlite3_int64 maxAge = db_get_int("lock-timeout",60);
1670 int seenFault = 0;
1671 db_prepare(&q,
1672 "SELECT json_extract(value,'$.login'),"
1673 " mtime,"
1674 " json_extract(value,'$.clientid'),"
1675 " (SELECT rid FROM blob WHERE uuid=substr(name,9)),"
1676 " name"
1677 " FROM config WHERE name GLOB 'ci-lock-*'"
 
 
1678 );
1679 while( db_step(&q)==SQLITE_ROW ){
1680 int x = db_column_int(&q,3);
1681 const char *zName = db_column_text(&q,4);
1682 if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
@@ -1725,11 +1727,11 @@
1725 ){
1726 db_unprotect(PROTECT_CONFIG);
1727 db_multi_exec(
1728 "DELETE FROM config"
1729 " WHERE name GLOB 'ci-lock-*'"
1730 " AND json_extract(value,'$.clientid')=%Q",
1731 blob_str(&xfer.aToken[2])
1732 );
1733 db_protect_pop();
1734 }else
1735
1736
--- src/xfer.c
+++ src/xfer.c
@@ -1667,16 +1667,18 @@
1667 Stmt q;
1668 sqlite3_int64 iNow = time(0);
1669 sqlite3_int64 maxAge = db_get_int("lock-timeout",60);
1670 int seenFault = 0;
1671 db_prepare(&q,
1672 "SELECT value->>'login',"
1673 " mtime,"
1674 " value->>'clientid',"
1675 " (SELECT rid FROM blob WHERE uuid=substr(name,9)),"
1676 " name"
1677 " FROM config"
1678 " WHERE name GLOB 'ci-lock-*'"
1679 " AND json_valid(value)"
1680 );
1681 while( db_step(&q)==SQLITE_ROW ){
1682 int x = db_column_int(&q,3);
1683 const char *zName = db_column_text(&q,4);
1684 if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
@@ -1725,11 +1727,11 @@
1727 ){
1728 db_unprotect(PROTECT_CONFIG);
1729 db_multi_exec(
1730 "DELETE FROM config"
1731 " WHERE name GLOB 'ci-lock-*'"
1732 " AND (NOT json_valid(value) OR value->>'clientid'==%Q)",
1733 blob_str(&xfer.aToken[2])
1734 );
1735 db_protect_pop();
1736 }else
1737
1738
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1909,11 +1909,11 @@
19091909
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
19101910
19111911
"$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
19121912
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
19131913
1914
-"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c" "$(B)\win\Makefile.msc"
1914
+"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
19151915
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
19161916
19171917
"$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
19181918
"$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
19191919
19201920
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1909,11 +1909,11 @@
1909 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1910
1911 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1912 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1913
1914 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c" "$(B)\win\Makefile.msc"
1915 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1916
1917 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1918 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1919
1920
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -1909,11 +1909,11 @@
1909 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1910
1911 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1912 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1913
1914 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1915 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1916
1917 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1918 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1919
1920
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -1031,11 +1031,11 @@
10311031
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
10321032
10331033
"$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
10341034
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
10351035
1036
-"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c" "$(B)\win\Makefile.msc"
1036
+"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
10371037
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
10381038
10391039
"$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
10401040
"$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
10411041
10421042
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -1031,11 +1031,11 @@
1031 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1032
1033 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1034 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1035
1036 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c" "$(B)\win\Makefile.msc"
1037 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1038
1039 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1040 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1041
1042
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -1031,11 +1031,11 @@
1031 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1032
1033 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1034 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1035
1036 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1037 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1038
1039 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1040 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1041
1042
--- www/adding_code.wiki
+++ www/adding_code.wiki
@@ -45,11 +45,11 @@
4545
<h2>3.0 Adding New Source Code Files</h2>
4646
4747
New source code files are added in the "src/" subdirectory of the Fossil
4848
source tree. Suppose one wants to add a new source code file named
4949
"xyzzy.c". The first step is to add this file to the various makefiles.
50
-Do so by editing the file src/makemake.tcl and adding "xyzzy" (without
50
+Do so by editing the file tools/makemake.tcl and adding "xyzzy" (without
5151
the final ".c") to the list of source modules at the top of that script.
5252
Save the result and then run the makemake.tcl script using a TCL
5353
interpreter. The command to run the makemake.tcl script is:
5454
5555
<b>tclsh makemake.tcl</b>
@@ -91,11 +91,11 @@
9191
9292
The "#if INTERFACE ... #endif" section is optional and is only needed
9393
if there are structure definitions or typedefs or macros that need to
9494
be used by other source code files. The makeheaders preprocessor
9595
uses definitions in the INTERFACE section to help it generate header
96
-files. See [../src/makeheaders.html | makeheaders.html] for additional
96
+files. See [../tools/makeheaders.html | makeheaders.html] for additional
9797
information.
9898
9999
After creating a template file such as shown above, and after updating
100100
the makefiles, you should be able to recompile Fossil and have it include
101101
your new source file, even before you source file contains any code.
102102
--- www/adding_code.wiki
+++ www/adding_code.wiki
@@ -45,11 +45,11 @@
45 <h2>3.0 Adding New Source Code Files</h2>
46
47 New source code files are added in the "src/" subdirectory of the Fossil
48 source tree. Suppose one wants to add a new source code file named
49 "xyzzy.c". The first step is to add this file to the various makefiles.
50 Do so by editing the file src/makemake.tcl and adding "xyzzy" (without
51 the final ".c") to the list of source modules at the top of that script.
52 Save the result and then run the makemake.tcl script using a TCL
53 interpreter. The command to run the makemake.tcl script is:
54
55 <b>tclsh makemake.tcl</b>
@@ -91,11 +91,11 @@
91
92 The "#if INTERFACE ... #endif" section is optional and is only needed
93 if there are structure definitions or typedefs or macros that need to
94 be used by other source code files. The makeheaders preprocessor
95 uses definitions in the INTERFACE section to help it generate header
96 files. See [../src/makeheaders.html | makeheaders.html] for additional
97 information.
98
99 After creating a template file such as shown above, and after updating
100 the makefiles, you should be able to recompile Fossil and have it include
101 your new source file, even before you source file contains any code.
102
--- www/adding_code.wiki
+++ www/adding_code.wiki
@@ -45,11 +45,11 @@
45 <h2>3.0 Adding New Source Code Files</h2>
46
47 New source code files are added in the "src/" subdirectory of the Fossil
48 source tree. Suppose one wants to add a new source code file named
49 "xyzzy.c". The first step is to add this file to the various makefiles.
50 Do so by editing the file tools/makemake.tcl and adding "xyzzy" (without
51 the final ".c") to the list of source modules at the top of that script.
52 Save the result and then run the makemake.tcl script using a TCL
53 interpreter. The command to run the makemake.tcl script is:
54
55 <b>tclsh makemake.tcl</b>
@@ -91,11 +91,11 @@
91
92 The "#if INTERFACE ... #endif" section is optional and is only needed
93 if there are structure definitions or typedefs or macros that need to
94 be used by other source code files. The makeheaders preprocessor
95 uses definitions in the INTERFACE section to help it generate header
96 files. See [../tools/makeheaders.html | makeheaders.html] for additional
97 information.
98
99 After creating a template file such as shown above, and after updating
100 the makefiles, you should be able to recompile Fossil and have it include
101 your new source file, even before you source file contains any code.
102
--- www/changes.wiki
+++ www/changes.wiki
@@ -13,10 +13,12 @@
1313
again for better cross-browser portability.
1414
* When sending a [/help?cmd=/chat|/chat] message fails, it is no longer
1515
immediately lost and sending may optionally be retried.
1616
* [/help?cmd=/chat|/chat] can now optionally embed attachments of certain
1717
types directly into message bodies via an iframe.
18
+ * The new [/help?cmd=cherry-pick|cherry-pick command] is an alias for
19
+ [/help?cmd=merge|merge --cherrypick].
1820
1921
<h2 id='v2_17'>Changes for version 2.17 (2021-10-09)</h2>
2022
2123
* Major improvements to the "diff" subsystem, including: <ul>
2224
<li> Added new [/help?cmd=diff|formatting options]: --by, -b, --webpage, --json, --tcl.
2325
--- www/changes.wiki
+++ www/changes.wiki
@@ -13,10 +13,12 @@
13 again for better cross-browser portability.
14 * When sending a [/help?cmd=/chat|/chat] message fails, it is no longer
15 immediately lost and sending may optionally be retried.
16 * [/help?cmd=/chat|/chat] can now optionally embed attachments of certain
17 types directly into message bodies via an iframe.
 
 
18
19 <h2 id='v2_17'>Changes for version 2.17 (2021-10-09)</h2>
20
21 * Major improvements to the "diff" subsystem, including: <ul>
22 <li> Added new [/help?cmd=diff|formatting options]: --by, -b, --webpage, --json, --tcl.
23
--- www/changes.wiki
+++ www/changes.wiki
@@ -13,10 +13,12 @@
13 again for better cross-browser portability.
14 * When sending a [/help?cmd=/chat|/chat] message fails, it is no longer
15 immediately lost and sending may optionally be retried.
16 * [/help?cmd=/chat|/chat] can now optionally embed attachments of certain
17 types directly into message bodies via an iframe.
18 * The new [/help?cmd=cherry-pick|cherry-pick command] is an alias for
19 [/help?cmd=merge|merge --cherrypick].
20
21 <h2 id='v2_17'>Changes for version 2.17 (2021-10-09)</h2>
22
23 * Major improvements to the "diff" subsystem, including: <ul>
24 <li> Added new [/help?cmd=diff|formatting options]: --by, -b, --webpage, --json, --tcl.
25
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -403,21 +403,10 @@
403403
all: it may have an arbitrary number of differences relative to the
404404
repository it originally cloned from. Git encourages siloed development.
405405
Select work in a developer's local repository may remain private
406406
indefinitely.
407407
408
-The Git preference for siloed development has been strongly adopted by GitHub,
409
-who say
410
-"[https://guides.github.com/activities/forking|Forking is at the core of social coding at GitHub]".
411
-As of September 2021,
412
-[https://github.com/search?q=is:public|Github hosts 46 million distinct software projects],
413
-most of them created by forking a previously-existing project. Since
414
-this is [https://evansdata.com/reports/viewRelease.php?reportID=9 |
415
-roughly twice the number of developers in the world], it beggars belief
416
-that most of these forks are still under active development. We expect
417
-that the vast bulk of these are abandoned one-off efforts.
418
-
419408
All of this is exactly what one wants when doing bazaar-style
420409
development.
421410
422411
Fossil's normal mode of operation differs on every one of these points,
423412
with the specific designed-in goal of promoting SQLite's cathedral
@@ -500,10 +489,21 @@
500489
Fossil places a lot of emphasis on synchronizing everyone's work and on
501490
reporting on the state of the project and the work of its developers, so
502491
that everyone — especially the project leader — can maintain a better
503492
mental picture of what is happening, leading to better situational
504493
awareness.
494
+
495
+By contrast, "…[https://guides.github.com/activities/forking|forking is
496
+at the core of social coding at GitHub]". As of January 2022,
497
+[https://github.com/search?q=is:public|Github hosts 47 million distinct
498
+software projects], most of which were created by forking a
499
+previously-existing project. Since this is
500
+[https://evansdata.com/reports/viewRelease.php?reportID=9 | roughly
501
+twice the number of developers in the world], it beggars belief that
502
+most of these forks are still under active development. The vast bulk
503
+of these must be abandoned one-off efforts. This is part of the nature
504
+of bazaar style development.
505505
506506
You can think about this difference in terms of
507507
[https://en.wikipedia.org/wiki/Feedback | feedback loop size], which we
508508
know from the mathematics of
509509
[https://en.wikipedia.org/wiki/Control_theory | control theory] to
@@ -524,11 +524,11 @@
524524
<h4 id="scale">2.5.2 Scale</h4>
525525
526526
The Linux kernel has a far bigger developer community than that of
527527
SQLite: there are thousands and thousands of contributors to Linux, most
528528
of whom do not know each others names. These thousands are responsible
529
-for producing roughly 89⨉ more code than is in SQLite. (10.7
529
+for producing roughly 89× more code than is in SQLite. (10.7
530530
[https://en.wikipedia.org/wiki/Source_lines_of_code|MLOC] vs. 0.12 MLOC
531531
according to [https://dwheeler.com/sloccount/|SLOCCount].) The Linux
532532
kernel and its development process were already uncommonly large back in
533533
2005 when Git was designed, specifically to support the consequences of
534534
having such a large set of developers working on such a large code base.
@@ -536,16 +536,21 @@
536536
95% of the code in SQLite comes from just four programmers, and 64% of
537537
it is from the lead developer alone. The SQLite developers know each
538538
other well and interact daily. Fossil was designed for this development
539539
model.
540540
541
-We think you should ask yourself whether you have Linus Torvalds scale
542
-software configuration management problems or D. Richard Hipp scale
543
-problems when choosing your DVCS. An
544
-[https://en.wikipedia.org/wiki/Impact_wrench|automotive air impact
545
-wrench] running at 8000 RPM driving an M8 socket-cap bolt at 16 cm/s is
546
-not the best way to hang a picture on the living room wall.
541
+When choosing your DVCS, we think you should ask yourself whether the
542
+scale of your software configuration management problems is closer to
543
+those Linus Torvalds designed Git to cope with or whether your work's
544
+scale is closer to that of SQLite, for which D. Richard Hipp designed
545
+Fossil. An [https://en.wikipedia.org/wiki/Impact_wrench|automotive air
546
+impact wrench] running at 8000 RPM driving an M8 socket-cap bolt at 16
547
+cm/s is not the best way to hang a picture on the living room wall.
548
+
549
+Fossil works well for projects several times the size of SQLite,
550
+[https://core.tcl-lang.org/tcl/ | such as Tcl], with a repository over
551
+twice the size and with many more core committers.
547552
548553
549554
<h4 id="branches">2.5.3 Individual Branches vs. The Entire Change History</h4>
550555
551556
Both Fossil and Git store history as a directed acyclic graph (DAG)
552557
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -403,21 +403,10 @@
403 all: it may have an arbitrary number of differences relative to the
404 repository it originally cloned from. Git encourages siloed development.
405 Select work in a developer's local repository may remain private
406 indefinitely.
407
408 The Git preference for siloed development has been strongly adopted by GitHub,
409 who say
410 "[https://guides.github.com/activities/forking|Forking is at the core of social coding at GitHub]".
411 As of September 2021,
412 [https://github.com/search?q=is:public|Github hosts 46 million distinct software projects],
413 most of them created by forking a previously-existing project. Since
414 this is [https://evansdata.com/reports/viewRelease.php?reportID=9 |
415 roughly twice the number of developers in the world], it beggars belief
416 that most of these forks are still under active development. We expect
417 that the vast bulk of these are abandoned one-off efforts.
418
419 All of this is exactly what one wants when doing bazaar-style
420 development.
421
422 Fossil's normal mode of operation differs on every one of these points,
423 with the specific designed-in goal of promoting SQLite's cathedral
@@ -500,10 +489,21 @@
500 Fossil places a lot of emphasis on synchronizing everyone's work and on
501 reporting on the state of the project and the work of its developers, so
502 that everyone — especially the project leader — can maintain a better
503 mental picture of what is happening, leading to better situational
504 awareness.
 
 
 
 
 
 
 
 
 
 
 
505
506 You can think about this difference in terms of
507 [https://en.wikipedia.org/wiki/Feedback | feedback loop size], which we
508 know from the mathematics of
509 [https://en.wikipedia.org/wiki/Control_theory | control theory] to
@@ -524,11 +524,11 @@
524 <h4 id="scale">2.5.2 Scale</h4>
525
526 The Linux kernel has a far bigger developer community than that of
527 SQLite: there are thousands and thousands of contributors to Linux, most
528 of whom do not know each others names. These thousands are responsible
529 for producing roughly 89⨉ more code than is in SQLite. (10.7
530 [https://en.wikipedia.org/wiki/Source_lines_of_code|MLOC] vs. 0.12 MLOC
531 according to [https://dwheeler.com/sloccount/|SLOCCount].) The Linux
532 kernel and its development process were already uncommonly large back in
533 2005 when Git was designed, specifically to support the consequences of
534 having such a large set of developers working on such a large code base.
@@ -536,16 +536,21 @@
536 95% of the code in SQLite comes from just four programmers, and 64% of
537 it is from the lead developer alone. The SQLite developers know each
538 other well and interact daily. Fossil was designed for this development
539 model.
540
541 We think you should ask yourself whether you have Linus Torvalds scale
542 software configuration management problems or D. Richard Hipp scale
543 problems when choosing your DVCS. An
544 [https://en.wikipedia.org/wiki/Impact_wrench|automotive air impact
545 wrench] running at 8000 RPM driving an M8 socket-cap bolt at 16 cm/s is
546 not the best way to hang a picture on the living room wall.
 
 
 
 
 
547
548
549 <h4 id="branches">2.5.3 Individual Branches vs. The Entire Change History</h4>
550
551 Both Fossil and Git store history as a directed acyclic graph (DAG)
552
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -403,21 +403,10 @@
403 all: it may have an arbitrary number of differences relative to the
404 repository it originally cloned from. Git encourages siloed development.
405 Select work in a developer's local repository may remain private
406 indefinitely.
407
 
 
 
 
 
 
 
 
 
 
 
408 All of this is exactly what one wants when doing bazaar-style
409 development.
410
411 Fossil's normal mode of operation differs on every one of these points,
412 with the specific designed-in goal of promoting SQLite's cathedral
@@ -500,10 +489,21 @@
489 Fossil places a lot of emphasis on synchronizing everyone's work and on
490 reporting on the state of the project and the work of its developers, so
491 that everyone — especially the project leader — can maintain a better
492 mental picture of what is happening, leading to better situational
493 awareness.
494
495 By contrast, "…[https://guides.github.com/activities/forking|forking is
496 at the core of social coding at GitHub]". As of January 2022,
497 [https://github.com/search?q=is:public|Github hosts 47 million distinct
498 software projects], most of which were created by forking a
499 previously-existing project. Since this is
500 [https://evansdata.com/reports/viewRelease.php?reportID=9 | roughly
501 twice the number of developers in the world], it beggars belief that
502 most of these forks are still under active development. The vast bulk
503 of these must be abandoned one-off efforts. This is part of the nature
504 of bazaar style development.
505
506 You can think about this difference in terms of
507 [https://en.wikipedia.org/wiki/Feedback | feedback loop size], which we
508 know from the mathematics of
509 [https://en.wikipedia.org/wiki/Control_theory | control theory] to
@@ -524,11 +524,11 @@
524 <h4 id="scale">2.5.2 Scale</h4>
525
526 The Linux kernel has a far bigger developer community than that of
527 SQLite: there are thousands and thousands of contributors to Linux, most
528 of whom do not know each others names. These thousands are responsible
529 for producing roughly 89× more code than is in SQLite. (10.7
530 [https://en.wikipedia.org/wiki/Source_lines_of_code|MLOC] vs. 0.12 MLOC
531 according to [https://dwheeler.com/sloccount/|SLOCCount].) The Linux
532 kernel and its development process were already uncommonly large back in
533 2005 when Git was designed, specifically to support the consequences of
534 having such a large set of developers working on such a large code base.
@@ -536,16 +536,21 @@
536 95% of the code in SQLite comes from just four programmers, and 64% of
537 it is from the lead developer alone. The SQLite developers know each
538 other well and interact daily. Fossil was designed for this development
539 model.
540
541 When choosing your DVCS, we think you should ask yourself whether the
542 scale of your software configuration management problems is closer to
543 those Linus Torvalds designed Git to cope with or whether your work's
544 scale is closer to that of SQLite, for which D. Richard Hipp designed
545 Fossil. An [https://en.wikipedia.org/wiki/Impact_wrench|automotive air
546 impact wrench] running at 8000 RPM driving an M8 socket-cap bolt at 16
547 cm/s is not the best way to hang a picture on the living room wall.
548
549 Fossil works well for projects several times the size of SQLite,
550 [https://core.tcl-lang.org/tcl/ | such as Tcl], with a repository over
551 twice the size and with many more core committers.
552
553
554 <h4 id="branches">2.5.3 Individual Branches vs. The Entire Change History</h4>
555
556 Both Fossil and Git store history as a directed acyclic graph (DAG)
557
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -23,13 +23,13 @@
2323
2424
Each preprocessor program is a separate C program implemented in
2525
a single file of C source code. The three preprocessor programs
2626
are:
2727
28
- 1. [/file/src/mkindex.c | mkindex.c]
29
- 2. [/file/src/translate.c | translate.c]
30
- 3. [/file/src/makeheaders.c | makeheaders.c]
28
+ 1. [/file/tools/mkindex.c | mkindex.c]
29
+ 2. [/file/tools/translate.c | translate.c]
30
+ 3. [/file/tools/makeheaders.c | makeheaders.c]
3131
3232
Fossil uses [http://www.sqlite.org/ | SQLite] for on-disk
3333
storage. The SQLite implementation is contained in three source
3434
code files that do not participate in the preprocessing steps.
3535
These three files that implement SQLite are:
@@ -81,11 +81,11 @@
8181
[/file/src/makemake.tcl | makemake.tcl].
8282
8383
The src/ subdirectory also contains documentation about the
8484
makeheaders preprocessor program:
8585
86
- 13. [../src/makeheaders.html | makeheaders.html]
86
+ 13. [../tools/makeheaders.html | makeheaders.html]
8787
8888
Click on the link to read this documentation. In addition there is
8989
a [http://www.tcl-lang.org/ | Tcl] script used to build the various makefiles:
9090
9191
14. makemake.tcl
@@ -226,11 +226,11 @@
226226
For each C source module "src.c", there is an automatically generated
227227
header module "src.h" that contains all of the datatype and procedure
228228
declarations needed by the source module. These header files are generated
229229
automatically by the makeheaders program. The sources to makeheaders
230230
are contained in a single file "makeheaders.c". Additional documentation
231
-on makeheaders can be found in [../src/makeheaders.html | src/makeheaders.html].
231
+on makeheaders can be found in [../tools/makeheaders.html | tools/makeheaders.html].
232232
233233
The makeheaders program is run once. It scans all inputs source files and
234234
generates header files for each one. Note that the sqlite3.c and shell.c
235235
source files are not scanned by makeheaders. Makeheaders only runs over
236236
"ordinary" source files, not the exceptional source files. However,
237237
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -23,13 +23,13 @@
23
24 Each preprocessor program is a separate C program implemented in
25 a single file of C source code. The three preprocessor programs
26 are:
27
28 1. [/file/src/mkindex.c | mkindex.c]
29 2. [/file/src/translate.c | translate.c]
30 3. [/file/src/makeheaders.c | makeheaders.c]
31
32 Fossil uses [http://www.sqlite.org/ | SQLite] for on-disk
33 storage. The SQLite implementation is contained in three source
34 code files that do not participate in the preprocessing steps.
35 These three files that implement SQLite are:
@@ -81,11 +81,11 @@
81 [/file/src/makemake.tcl | makemake.tcl].
82
83 The src/ subdirectory also contains documentation about the
84 makeheaders preprocessor program:
85
86 13. [../src/makeheaders.html | makeheaders.html]
87
88 Click on the link to read this documentation. In addition there is
89 a [http://www.tcl-lang.org/ | Tcl] script used to build the various makefiles:
90
91 14. makemake.tcl
@@ -226,11 +226,11 @@
226 For each C source module "src.c", there is an automatically generated
227 header module "src.h" that contains all of the datatype and procedure
228 declarations needed by the source module. These header files are generated
229 automatically by the makeheaders program. The sources to makeheaders
230 are contained in a single file "makeheaders.c". Additional documentation
231 on makeheaders can be found in [../src/makeheaders.html | src/makeheaders.html].
232
233 The makeheaders program is run once. It scans all inputs source files and
234 generates header files for each one. Note that the sqlite3.c and shell.c
235 source files are not scanned by makeheaders. Makeheaders only runs over
236 "ordinary" source files, not the exceptional source files. However,
237
--- www/makefile.wiki
+++ www/makefile.wiki
@@ -23,13 +23,13 @@
23
24 Each preprocessor program is a separate C program implemented in
25 a single file of C source code. The three preprocessor programs
26 are:
27
28 1. [/file/tools/mkindex.c | mkindex.c]
29 2. [/file/tools/translate.c | translate.c]
30 3. [/file/tools/makeheaders.c | makeheaders.c]
31
32 Fossil uses [http://www.sqlite.org/ | SQLite] for on-disk
33 storage. The SQLite implementation is contained in three source
34 code files that do not participate in the preprocessing steps.
35 These three files that implement SQLite are:
@@ -81,11 +81,11 @@
81 [/file/src/makemake.tcl | makemake.tcl].
82
83 The src/ subdirectory also contains documentation about the
84 makeheaders preprocessor program:
85
86 13. [../tools/makeheaders.html | makeheaders.html]
87
88 Click on the link to read this documentation. In addition there is
89 a [http://www.tcl-lang.org/ | Tcl] script used to build the various makefiles:
90
91 14. makemake.tcl
@@ -226,11 +226,11 @@
226 For each C source module "src.c", there is an automatically generated
227 header module "src.h" that contains all of the datatype and procedure
228 declarations needed by the source module. These header files are generated
229 automatically by the makeheaders program. The sources to makeheaders
230 are contained in a single file "makeheaders.c". Additional documentation
231 on makeheaders can be found in [../tools/makeheaders.html | tools/makeheaders.html].
232
233 The makeheaders program is run once. It scans all inputs source files and
234 generates header files for each one. Note that the sqlite3.c and shell.c
235 source files are not scanned by makeheaders. Makeheaders only runs over
236 "ordinary" source files, not the exceptional source files. However,
237
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -107,10 +107,11 @@
107107
/sitemap {Site Map}
108108
shunning.wiki {Shunning: Deleting Content From Fossil}
109109
stats.wiki {Performance Statistics}
110110
style.wiki {Source Code Style Guidelines}
111111
ssl.wiki {Using SSL with Fossil}
112
+ ssl-server.md {SSL/TLS Server Mode}
112113
sync.wiki {The Fossil Sync Protocol}
113114
tech_overview.wiki {A Technical Overview Of The Design And Implementation
114115
Of Fossil}
115116
tech_overview.wiki {SQLite Databases Used By Fossil}
116117
th1.md {The TH1 Scripting Language}
117118
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -107,10 +107,11 @@
107 /sitemap {Site Map}
108 shunning.wiki {Shunning: Deleting Content From Fossil}
109 stats.wiki {Performance Statistics}
110 style.wiki {Source Code Style Guidelines}
111 ssl.wiki {Using SSL with Fossil}
 
112 sync.wiki {The Fossil Sync Protocol}
113 tech_overview.wiki {A Technical Overview Of The Design And Implementation
114 Of Fossil}
115 tech_overview.wiki {SQLite Databases Used By Fossil}
116 th1.md {The TH1 Scripting Language}
117
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -107,10 +107,11 @@
107 /sitemap {Site Map}
108 shunning.wiki {Shunning: Deleting Content From Fossil}
109 stats.wiki {Performance Statistics}
110 style.wiki {Source Code Style Guidelines}
111 ssl.wiki {Using SSL with Fossil}
112 ssl-server.md {SSL/TLS Server Mode}
113 sync.wiki {The Fossil Sync Protocol}
114 tech_overview.wiki {A Technical Overview Of The Design And Implementation
115 Of Fossil}
116 tech_overview.wiki {SQLite Databases Used By Fossil}
117 th1.md {The TH1 Scripting Language}
118
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -104,10 +104,11 @@
104104
<li><a href="chroot.md">Server Chroot Jail</a></li>
105105
<li><a href="shunning.wiki">Shunning: Deleting Content From Fossil</a></li>
106106
<li><a href="../../../sitemap">Site Map</a></li>
107107
<li><a href="style.wiki">Source Code Style Guidelines</a></li>
108108
<li><a href="tech_overview.wiki">SQLite Databases Used By Fossil</a></li>
109
+<li><a href="ssl-server.md">SSL/TLS Server Mode</a></li>
109110
<li><a href="backoffice.md">The "Backoffice" mechanism of Fossil</a></li>
110111
<li><a href="patchcmd.md">The "fossil patch" Command</a></li>
111112
<li><a href="blame.wiki">The Annotate/Blame Algorithm Of Fossil</a></li>
112113
<li><a href="defcsp.md">The Default Content Security Policy</a></li>
113114
<li><a href="fileedit-page.md">The fileedit Page</a></li>
114115
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -104,10 +104,11 @@
104 <li><a href="chroot.md">Server Chroot Jail</a></li>
105 <li><a href="shunning.wiki">Shunning: Deleting Content From Fossil</a></li>
106 <li><a href="../../../sitemap">Site Map</a></li>
107 <li><a href="style.wiki">Source Code Style Guidelines</a></li>
108 <li><a href="tech_overview.wiki">SQLite Databases Used By Fossil</a></li>
 
109 <li><a href="backoffice.md">The "Backoffice" mechanism of Fossil</a></li>
110 <li><a href="patchcmd.md">The "fossil patch" Command</a></li>
111 <li><a href="blame.wiki">The Annotate/Blame Algorithm Of Fossil</a></li>
112 <li><a href="defcsp.md">The Default Content Security Policy</a></li>
113 <li><a href="fileedit-page.md">The fileedit Page</a></li>
114
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -104,10 +104,11 @@
104 <li><a href="chroot.md">Server Chroot Jail</a></li>
105 <li><a href="shunning.wiki">Shunning: Deleting Content From Fossil</a></li>
106 <li><a href="../../../sitemap">Site Map</a></li>
107 <li><a href="style.wiki">Source Code Style Guidelines</a></li>
108 <li><a href="tech_overview.wiki">SQLite Databases Used By Fossil</a></li>
109 <li><a href="ssl-server.md">SSL/TLS Server Mode</a></li>
110 <li><a href="backoffice.md">The "Backoffice" mechanism of Fossil</a></li>
111 <li><a href="patchcmd.md">The "fossil patch" Command</a></li>
112 <li><a href="blame.wiki">The Annotate/Blame Algorithm Of Fossil</a></li>
113 <li><a href="defcsp.md">The Default Content Security Policy</a></li>
114 <li><a href="fileedit-page.md">The fileedit Page</a></li>
115
--- www/ssl-server.md
+++ www/ssl-server.md
@@ -1,17 +1,18 @@
11
# SSL/TLS Server Mode
22
33
## History
44
5
-Fossil has supported client-side SSL/TLS since [2010][1]. This means
5
+Fossil has supported [client-side SSL/TLS][0] since [2010][1]. This means
66
that commands like "[fossil sync](/help?cmd=sync)" could use SSL/TLS when
77
contacting a server. But on the server side, commands like
88
"[fossil server](/help?cmd=server)" operated in clear-text only. To implement
99
an encrypted server, you had to put Fossil behind a web server or reverse
1010
proxy that handled the SSL/TLS decryption/encryption and passed cleartext
1111
down to Fossil.
1212
13
+[0]: ./ssl.wiki
1314
[1]: /timeline?c=b05cb4a0e15d0712&y=ci&n=13
1415
1516
Beginning in [late December 2021](/timeline?c=f6263bb64195b07f&y=a&n=13),
1617
this has been fixed. Commands like
1718
@@ -74,13 +75,15 @@
7475
7576
If you do not tell Fossil about a cert and private key, it uses a
7677
generic "private key" and self-signed cert that is built into Fossil.
7778
This is wildly insecure, since the private key is not really private -
7879
it is [in plain sight](/info/c2a7b14c3f541edb96?ln=89-116) in the Fossil
79
-source tree for anybody to read. So the built-in cert is only useful
80
-for testing. If you want actual security, you will need to come up with
81
-your own private key and cert.
80
+source tree for anybody to read. <b>Never add the private key that is
81
+built into Fossil to your OS's trust store</b> as doing so will severely
82
+compromise your computer. The built-in cert is only useful for testing.
83
+If you want actual security, you will need to come up with your own private
84
+key and cert.
8285
8386
Fossil wants to read certs and public keys in the
8487
[PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail).
8588
PEM is a pure ASCII text format. The private key consists of text
8689
like this:
@@ -177,11 +180,11 @@
177180
If you do not want to concatenate your cert and private key, you can
178181
tell Fossil about the files separately using settings. Run a command
179182
like this on your repository:
180183
181184
> ~~~
182
-fossil ssl-config load-certs --filename CERT-FILE.pem PRIVATE-KEY.pem
185
+fossil ssl-config load-cert --filename CERT-FILE.pem PRIVATE-KEY.pem
183186
~~~
184187
185188
Substitute whatever filenames are appropriate in the command above, of
186189
course. Run "[fossil ssl-config](/help?cmd=ssl-config)" by itself to see
187190
the resulting configuration. Once you have done this, you can then
188191
--- www/ssl-server.md
+++ www/ssl-server.md
@@ -1,17 +1,18 @@
1 # SSL/TLS Server Mode
2
3 ## History
4
5 Fossil has supported client-side SSL/TLS since [2010][1]. This means
6 that commands like "[fossil sync](/help?cmd=sync)" could use SSL/TLS when
7 contacting a server. But on the server side, commands like
8 "[fossil server](/help?cmd=server)" operated in clear-text only. To implement
9 an encrypted server, you had to put Fossil behind a web server or reverse
10 proxy that handled the SSL/TLS decryption/encryption and passed cleartext
11 down to Fossil.
12
 
13 [1]: /timeline?c=b05cb4a0e15d0712&y=ci&n=13
14
15 Beginning in [late December 2021](/timeline?c=f6263bb64195b07f&y=a&n=13),
16 this has been fixed. Commands like
17
@@ -74,13 +75,15 @@
74
75 If you do not tell Fossil about a cert and private key, it uses a
76 generic "private key" and self-signed cert that is built into Fossil.
77 This is wildly insecure, since the private key is not really private -
78 it is [in plain sight](/info/c2a7b14c3f541edb96?ln=89-116) in the Fossil
79 source tree for anybody to read. So the built-in cert is only useful
80 for testing. If you want actual security, you will need to come up with
81 your own private key and cert.
 
 
82
83 Fossil wants to read certs and public keys in the
84 [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail).
85 PEM is a pure ASCII text format. The private key consists of text
86 like this:
@@ -177,11 +180,11 @@
177 If you do not want to concatenate your cert and private key, you can
178 tell Fossil about the files separately using settings. Run a command
179 like this on your repository:
180
181 > ~~~
182 fossil ssl-config load-certs --filename CERT-FILE.pem PRIVATE-KEY.pem
183 ~~~
184
185 Substitute whatever filenames are appropriate in the command above, of
186 course. Run "[fossil ssl-config](/help?cmd=ssl-config)" by itself to see
187 the resulting configuration. Once you have done this, you can then
188
--- www/ssl-server.md
+++ www/ssl-server.md
@@ -1,17 +1,18 @@
1 # SSL/TLS Server Mode
2
3 ## History
4
5 Fossil has supported [client-side SSL/TLS][0] since [2010][1]. This means
6 that commands like "[fossil sync](/help?cmd=sync)" could use SSL/TLS when
7 contacting a server. But on the server side, commands like
8 "[fossil server](/help?cmd=server)" operated in clear-text only. To implement
9 an encrypted server, you had to put Fossil behind a web server or reverse
10 proxy that handled the SSL/TLS decryption/encryption and passed cleartext
11 down to Fossil.
12
13 [0]: ./ssl.wiki
14 [1]: /timeline?c=b05cb4a0e15d0712&y=ci&n=13
15
16 Beginning in [late December 2021](/timeline?c=f6263bb64195b07f&y=a&n=13),
17 this has been fixed. Commands like
18
@@ -74,13 +75,15 @@
75
76 If you do not tell Fossil about a cert and private key, it uses a
77 generic "private key" and self-signed cert that is built into Fossil.
78 This is wildly insecure, since the private key is not really private -
79 it is [in plain sight](/info/c2a7b14c3f541edb96?ln=89-116) in the Fossil
80 source tree for anybody to read. <b>Never add the private key that is
81 built into Fossil to your OS's trust store</b> as doing so will severely
82 compromise your computer. The built-in cert is only useful for testing.
83 If you want actual security, you will need to come up with your own private
84 key and cert.
85
86 Fossil wants to read certs and public keys in the
87 [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail).
88 PEM is a pure ASCII text format. The private key consists of text
89 like this:
@@ -177,11 +180,11 @@
180 If you do not want to concatenate your cert and private key, you can
181 tell Fossil about the files separately using settings. Run a command
182 like this on your repository:
183
184 > ~~~
185 fossil ssl-config load-cert --filename CERT-FILE.pem PRIVATE-KEY.pem
186 ~~~
187
188 Substitute whatever filenames are appropriate in the command above, of
189 course. Run "[fossil ssl-config](/help?cmd=ssl-config)" by itself to see
190 the resulting configuration. Once you have done this, you can then
191
+6 -6
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -226,16 +226,16 @@
226226
which explains what to do to authenticate with the server.
227227
228228
229229
<h2 id="server">Fossil TLS Configuration: Server Side</h2>
230230
231
-Fossil's built-in HTTP server feature does not currently have a built-in
232
-way to serve via HTTP over TLS, a.k.a. HTTPS, even when you've linked
233
-Fossil to OpenSSL. To serve a Fossil repository via HTTPS, you must put
234
-it behind some kind of HTTPS proxy. We have a number of documents
235
-elsewhere in this repository that cover your options for [./server/
236
-| serving Fossil repositories]. A few of the most useful of these are:
231
+Fossil's built-in HTTP server feature did not add [./ssl-server.md|support HTTP over TLS]
232
+(a.k.a. HTTPS) until version 2.18 (2022). Prior to that, system administrators
233
+that wanted to add HTTPS support to a Fossil server had to put Fossil
234
+behind a web-server or reverse-proxy that would do the HTTPS to HTTP
235
+translation. [./server/ | Instructions for doing so] are found elsewhere
236
+in this documentation. A few of the most useful of these are:
237237
238238
* <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a>
239239
* <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a>
240240
* <a id="nginx" href="./server/debian/nginx.md#tls">Serving via SCGI with nginx on Debian</a>
241241
242242
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -226,16 +226,16 @@
226 which explains what to do to authenticate with the server.
227
228
229 <h2 id="server">Fossil TLS Configuration: Server Side</h2>
230
231 Fossil's built-in HTTP server feature does not currently have a built-in
232 way to serve via HTTP over TLS, a.k.a. HTTPS, even when you've linked
233 Fossil to OpenSSL. To serve a Fossil repository via HTTPS, you must put
234 it behind some kind of HTTPS proxy. We have a number of documents
235 elsewhere in this repository that cover your options for [./server/
236 | serving Fossil repositories]. A few of the most useful of these are:
237
238 * <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a>
239 * <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a>
240 * <a id="nginx" href="./server/debian/nginx.md#tls">Serving via SCGI with nginx on Debian</a>
241
242
--- www/ssl.wiki
+++ www/ssl.wiki
@@ -226,16 +226,16 @@
226 which explains what to do to authenticate with the server.
227
228
229 <h2 id="server">Fossil TLS Configuration: Server Side</h2>
230
231 Fossil's built-in HTTP server feature did not add [./ssl-server.md|support HTTP over TLS]
232 (a.k.a. HTTPS) until version 2.18 (2022). Prior to that, system administrators
233 that wanted to add HTTPS support to a Fossil server had to put Fossil
234 behind a web-server or reverse-proxy that would do the HTTPS to HTTP
235 translation. [./server/ | Instructions for doing so] are found elsewhere
236 in this documentation. A few of the most useful of these are:
237
238 * <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a>
239 * <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a>
240 * <a id="nginx" href="./server/debian/nginx.md#tls">Serving via SCGI with nginx on Debian</a>
241
242
+11 -11
--- www/sync.wiki
+++ www/sync.wiki
@@ -32,20 +32,20 @@
3232
[/help?cmd=configuration|config pull]
3333
commands.
3434
3535
<h3 id="crdt">1.1 Conflict-Free Replicated Datatypes</h3>
3636
37
-<p>The "bag of artifacts" data model used by Fossil
38
-Fossil is apparently an implementation of a particular
39
-[https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|Conflict-Free Replicated
40
-Datatype (CRDT)]
41
-called a "G-Set" or "Grow-only Set".
42
-The academic literature on CRDTs only began to appear in about 2011, and
43
-Fossil predates that research by at least 4 years. But it is nice to know
44
-that theorists have now proven that the underlying data model of Fossil can
45
-provide strongly-consistent replicas using only peer-to-peer communication
46
-and without any kind of central authority.</p>
37
+<p>The "bag of artifacts" data model used by Fossil is apparently an
38
+implementation of a particular
39
+[https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|Conflict-Free
40
+Replicated Datatype (CRDT)] called a "G-Set" or "Grow-only Set". The
41
+academic literature on CRDTs only began to appear in about 2011, and
42
+Fossil predates that research by at least 4 years. But it is nice to
43
+know that theorists have now proven that the underlying data model of
44
+Fossil can provide strongly-consistent replicas using only
45
+peer-to-peer communication and without any kind of central
46
+authority.</p>
4747
4848
<p>If you are already familiar with CRDTs and were wondering if Fossil
4949
used them, the answer is "yes". We just don't call them by that name.</p>
5050
5151
@@ -593,11 +593,11 @@
593593
<li> crlf-glob
594594
<ul></td><td valign="top"><ul>
595595
<li> crnl-glob
596596
<li> encoding-glob
597597
<li> empty-dirs
598
-<li> allow-symlinks
598
+<li> <s>allow-symlinks</s> (removed 2020-08, version 2.12.1)
599599
<li> dotfiles
600600
<li> parent-project-code
601601
<li> parent-projet-name
602602
<li> hash-policy
603603
<li> mv-rm-files
604604
--- www/sync.wiki
+++ www/sync.wiki
@@ -32,20 +32,20 @@
32 [/help?cmd=configuration|config pull]
33 commands.
34
35 <h3 id="crdt">1.1 Conflict-Free Replicated Datatypes</h3>
36
37 <p>The "bag of artifacts" data model used by Fossil
38 Fossil is apparently an implementation of a particular
39 [https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|Conflict-Free Replicated
40 Datatype (CRDT)]
41 called a "G-Set" or "Grow-only Set".
42 The academic literature on CRDTs only began to appear in about 2011, and
43 Fossil predates that research by at least 4 years. But it is nice to know
44 that theorists have now proven that the underlying data model of Fossil can
45 provide strongly-consistent replicas using only peer-to-peer communication
46 and without any kind of central authority.</p>
47
48 <p>If you are already familiar with CRDTs and were wondering if Fossil
49 used them, the answer is "yes". We just don't call them by that name.</p>
50
51
@@ -593,11 +593,11 @@
593 <li> crlf-glob
594 <ul></td><td valign="top"><ul>
595 <li> crnl-glob
596 <li> encoding-glob
597 <li> empty-dirs
598 <li> allow-symlinks
599 <li> dotfiles
600 <li> parent-project-code
601 <li> parent-projet-name
602 <li> hash-policy
603 <li> mv-rm-files
604
--- www/sync.wiki
+++ www/sync.wiki
@@ -32,20 +32,20 @@
32 [/help?cmd=configuration|config pull]
33 commands.
34
35 <h3 id="crdt">1.1 Conflict-Free Replicated Datatypes</h3>
36
37 <p>The "bag of artifacts" data model used by Fossil is apparently an
38 implementation of a particular
39 [https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|Conflict-Free
40 Replicated Datatype (CRDT)] called a "G-Set" or "Grow-only Set". The
41 academic literature on CRDTs only began to appear in about 2011, and
42 Fossil predates that research by at least 4 years. But it is nice to
43 know that theorists have now proven that the underlying data model of
44 Fossil can provide strongly-consistent replicas using only
45 peer-to-peer communication and without any kind of central
46 authority.</p>
47
48 <p>If you are already familiar with CRDTs and were wondering if Fossil
49 used them, the answer is "yes". We just don't call them by that name.</p>
50
51
@@ -593,11 +593,11 @@
593 <li> crlf-glob
594 <ul></td><td valign="top"><ul>
595 <li> crnl-glob
596 <li> encoding-glob
597 <li> empty-dirs
598 <li> <s>allow-symlinks</s> (removed 2020-08, version 2.12.1)
599 <li> dotfiles
600 <li> parent-project-code
601 <li> parent-projet-name
602 <li> hash-policy
603 <li> mv-rm-files
604

Keyboard Shortcuts

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